PHP 8.1 Deprecated

Adapt for 8.1
This commit is contained in:
Dany De Bontridder 2022-08-24 22:26:12 +02:00 committed by sparkyx
parent bfa9dde763
commit e93283ba65
8 changed files with 15 additions and 10 deletions

View file

@ -174,7 +174,7 @@ hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #0
$a_table=$html->getElementsByTagName("table");
// For PHP < 7 , we must change the attribute "width"
if ( substr(phpversion(),0,1) != "7" )
if ( substr(phpversion(),0,1) < 7 )
{
for ( $i = 0 ; $i < $a_table->length;$i++) {
$node=$a_table->item($i);

View file

@ -141,7 +141,7 @@ if ( ! isset ($_REQUEST['oper_detail']))
$export->add($op['deb_montant'],"number");
$export->add($op['cred_montant'],"number");
$export->add(abs($progress),"number");
if ($op['letter'] !=-1){
if ( $op['letter'] !=-1 && ! empty($op['letter'])){
$export->add(strtoupper(base_convert($op['letter'],10,36)));
} else {
$export->add("");

View file

@ -149,7 +149,8 @@ for ($e=0;$e<count($array);$e++)
$pdf->LongLine($size[$l],6,($description.'('.$row['jr_internal'].")"),0,$align[$l]);
$l++;
$pdf->LongLine($size[$l],6,(($row['letter']!=-1)?strtoupper(base_convert($row['letter'],10,36)):''),0,$align[$l]);
$pdf->LongLine($size[$l],6,((!empty($row['letter']) && $row['letter']!=-1)?strtoupper(base_convert($row['letter'],10,36)):''),0,$align[$l]);
$l++;
$pdf->LongLine($size[$l],6,(sprintf('% 12.2f',$row['deb_montant'])),0,$align[$l]);
$l++;

View file

@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
*/
function h($p_string)
{
return htmlspecialchars($p_string,ENT_QUOTES|ENT_HTML5,'UTF-8',true);
return ( $p_string == null)?"":htmlspecialchars($p_string,ENT_QUOTES|ENT_HTML5,'UTF-8',true);
}
function p($p_string)
{
@ -852,6 +852,7 @@ function smaller_date($p_date)
*/
function format_date($p_date, $p_from_format = 'YYYY-MM-DD',$p_to_format='DD.MM.YYYY')
{
if (empty($p_date)) {return $p_date;}
if ($p_from_format == 'YYYY-MM-DD')
{
$date = explode('-', $p_date);
@ -1478,7 +1479,7 @@ function generate_random_string($car)
{
$string="";
$chaine="abcdefghijklmnpqrstuvwxyABCDEFGHIJKLMNPQRSTUVWXY0123456789*/+-=";
srand((double) microtime()*1020030);
srand((int) microtime()*1020030);
for ($i=0; $i<$car; $i++)
{
$string .= $chaine[rand()%strlen($chaine)];

View file

@ -846,7 +846,9 @@ class DatabaseCore
static function escape_string($p_string)
{
return pg_escape_string($p_string);
static $cn=null;
if ( $cn==null) $cn=new Database();
return pg_escape_string($cn->db,$p_string);
}
/**\brief wrapper for the function pg_close

View file

@ -36,7 +36,7 @@ class IButton extends HtmlInput
{
$this->name=($p_name==null)?$this->name:$p_name;
$this->value=($p_value==null)?$this->value:$p_value;
$this->label=(trim($this->label) != '')?$this->label:$this->value;
$this->label=(!empty($this->label))?$this->label:$this->value;
$this->class=($p_class != "")?$p_class:$this->class;
$this->class=($this->class=="")?"smallbutton ":$this->class;
if ( $this->readOnly==true) return $this->display();

View file

@ -142,8 +142,9 @@ class Noalyss_Csv
}
else
{
$export=($this->element[$i]['value']==null)?"":$this->element[$i]['value'];
// remove break-line,
$export=str_replace("\n"," ",$this->element[$i]['value']);
$export=str_replace("\n"," ",$export);
$export=str_replace("\r"," ", $export);
// remove double quote
$export=str_replace('"',"", $export);

View file

@ -46,7 +46,7 @@ echo td(_('Tiers')).td($view_card_detail);
<tr>
<?php
$itext=new IText('lib');
$itext->value=strip_tags($obj->det->jr_comment);
$itext->value=(!empty($obj->det->jr_comment))?strip_tags($obj->det->jr_comment):'';
$itext->size=40;
echo td(_('Libellé')).td($itext->input(),' colspan="2" style="width:auto"');
@ -59,7 +59,7 @@ echo td(_('Tiers')).td($view_card_detail);
<tr>
<?php
$itext=new IText('npj');
$itext->value=strip_tags($obj->det->jr_pj_number);
$itext->value=(!empty($obj->det->jr_pj_number))?strip_tags($obj->det->jr_pj_number):'';
echo td(_('Pièce')).td($itext->input());
?>