A couple of minor PHP 8 fixes that can be applied now

This commit is contained in:
Ana Els 2021-01-18 15:18:40 +00:00 committed by MatthieuLP
parent c64efe6ecb
commit 65acb988db
11 changed files with 27 additions and 9 deletions

View file

@ -239,6 +239,13 @@ if ($nb_photos_in_caddie > 0)
'U_CADDIE' => $link_start.'batch_manager&filter=prefilter-caddie', 'U_CADDIE' => $link_start.'batch_manager&filter=prefilter-caddie',
) )
); );
} else {
$template->assign(
array(
'NB_PHOTOS_IN_CADDIE' => 0,
'U_CADDIE' => '',
)
);
} }
// any photos with no md5sum ? // any photos with no md5sum ?
@ -263,6 +270,13 @@ if ($nb_orphans > 0)
'U_ORPHANS' => $link_start.'batch_manager&filter=prefilter-no_album', 'U_ORPHANS' => $link_start.'batch_manager&filter=prefilter-no_album',
) )
); );
} else {
$template->assign(
array(
'NB_ORPHANS' => 0,
'U_ORPHANS' => '',
)
);
} }
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+

View file

@ -486,6 +486,8 @@ if (isset($page['no_md5sum_number']))
'NB_NO_MD5SUM' => $page['no_md5sum_number'], 'NB_NO_MD5SUM' => $page['no_md5sum_number'],
) )
); );
} else {
$template->assign('NB_NO_MD5SUM', '');
} }
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+

View file

@ -66,7 +66,7 @@ class c13y_internal
foreach (array('show_exif', 'use_exif') as $value) foreach (array('show_exif', 'use_exif') as $value)
{ {
if (($conf[$value]) and (!function_exists('read_exif_data'))) if (($conf[$value]) and (!function_exists('exif_read_data')))
{ {
$c13y->add_anomaly( $c13y->add_anomaly(
sprintf(l10n('%s value is not correct file because exif are not supported'), '$conf[\''.$value.'\']'), sprintf(l10n('%s value is not correct file because exif are not supported'), '$conf[\''.$value.'\']'),

View file

@ -390,7 +390,7 @@ SELECT
} }
// update metadata from the uploaded file (exif/iptc) // update metadata from the uploaded file (exif/iptc)
if ($conf['use_exif'] and !function_exists('read_exif_data')) if ($conf['use_exif'] and !function_exists('exif_read_data'))
{ {
$conf['use_exif'] = false; $conf['use_exif'] = false;
} }

View file

@ -191,7 +191,7 @@ if (!isset($_SESSION['upload_hide_warnings']))
{ {
$setup_warnings = array(); $setup_warnings = array();
if ($conf['use_exif'] and !function_exists('read_exif_data')) if ($conf['use_exif'] and !function_exists('exif_read_data'))
{ {
$setup_warnings[] = l10n('Exif extension not available, admin should disable exif use'); $setup_warnings[] = l10n('Exif extension not available, admin should disable exif use');
} }

View file

@ -168,6 +168,8 @@ SELECT COUNT(*)
;'; ;';
list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
$template->assign('NB_COMMENTS', $nb_comments); $template->assign('NB_COMMENTS', $nb_comments);
} else {
$template->assign('NB_COMMENTS', 0);
} }
if ($nb_photos > 0) if ($nb_photos > 0)

View file

@ -17,7 +17,7 @@ $t2 = microtime(true);
// addslashes to vars if magic_quotes_gpc is off this is a security // addslashes to vars if magic_quotes_gpc is off this is a security
// precaution to prevent someone trying to break out of a SQL statement. // precaution to prevent someone trying to break out of a SQL statement.
// //
if( !@get_magic_quotes_gpc() ) if(function_exists('get_magic_quotes_gpc') && !@get_magic_quotes_gpc() )
{ {
function sanitize_mysql_kv(&$v, $k) function sanitize_mysql_kv(&$v, $k)
{ {

View file

@ -129,13 +129,13 @@ function get_exif_data($filename, $map)
$result = array(); $result = array();
if (!function_exists('read_exif_data')) if (!function_exists('exif_read_data'))
{ {
die('Exif extension not available, admin should disable exif use'); die('Exif extension not available, admin should disable exif use');
} }
// Read EXIF data // Read EXIF data
if ($exif = @read_exif_data($filename) or $exif2 = trigger_change('format_exif_data', $exif=null, $filename, $map)) if ($exif = @exif_read_data($filename) or $exif2 = trigger_change('format_exif_data', $exif=null, $filename, $map))
{ {
if (!empty($exif2)) if (!empty($exif2))
{ {

View file

@ -13,7 +13,7 @@
include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php'); include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
if (($conf['show_exif']) and (function_exists('read_exif_data'))) if (($conf['show_exif']) and (function_exists('exif_read_data')))
{ {
$exif_mapping = array(); $exif_mapping = array();
foreach ($conf['show_exif_fields'] as $field) foreach ($conf['show_exif_fields'] as $field)

View file

@ -14,7 +14,7 @@ define('PHPWG_ROOT_PATH','./');
// addslashes to vars if magic_quotes_gpc is off this is a security // addslashes to vars if magic_quotes_gpc is off this is a security
// precaution to prevent someone trying to break out of a SQL statement. // precaution to prevent someone trying to break out of a SQL statement.
// //
if( !@get_magic_quotes_gpc() ) if(function_exists('get_magic_quotes_gpc') && !@get_magic_quotes_gpc() )
{ {
if( is_array($_POST) ) if( is_array($_POST) )
{ {

View file

@ -75,7 +75,7 @@ else
echo '<br><br><br>'; echo '<br><br><br>';
echo 'EXIF Fields in '.$filename.'<br>'; echo 'EXIF Fields in '.$filename.'<br>';
$exif = read_exif_data($filename); $exif = exif_read_data($filename);
echo '<pre>'; echo '<pre>';
print_r($exif); print_r($exif);
echo '</pre>'; echo '</pre>';