[fix] More PHP-8.1 issues

This commit is contained in:
Solomon Peachy 2022-11-20 11:49:54 -05:00
parent e438d95292
commit 0462c9c6a5
4 changed files with 44 additions and 44 deletions

View File

@ -45,7 +45,7 @@ if ($action == 'edit') {
if ($po_user['id'] != $owner) {
site_push_error($strings['errors_not_owner']);
location("event.php?event=$event");
site_epilog($database);
site_epilog($database);
exit();
}
}
@ -69,7 +69,7 @@ if ($go) {
case 'add':
$client = pg_escape_string($database, $_REQUEST['client']);
if ($client != "null") $client = "'$client'";
$start_date = pg_escape_string($database, $_REQUEST['start_date']);
$end_date = pg_escape_string($database, $_REQUEST['end_date']);
$remark = pg_escape_string($database, $_REQUEST['remark']);
@ -85,7 +85,7 @@ if ($go) {
} else {
$result = pg_query($database, "update calendar set start_date='$start_date', end_date='$end_date', remark='$remark', client = $client, location = $location where identifier=$event");
}
break;
}
@ -95,7 +95,7 @@ if ($go) {
} else {
pg_query($database, "commit");
}
header("Location: my.datebook.php?year=$year&month=$month&day=$day");
site_epilog($database);
exit();
@ -111,7 +111,7 @@ print "<br/>";
switch ($action) {
case 'view':
$num_photos = photos_between_dates_sql($database, $owner,
$num_photos = photos_between_dates_sql($database, $owner,
$start_date, $end_date);
print "<table class=\"listing\">\n";
@ -129,15 +129,15 @@ switch ($action) {
$master = "";
}
$num_photos = emit_a("search.text.advanced.php?start_date=$start&amp;end_date=$end&amp;date_type=photo.date_of_exposure&amp;date_operator=or$master", $num_photos);
print "<tr><td>".$strings['generic_photos']."</td> <td>$num_photos</td></tr>\n";
print "<tr><td>".$strings['generic_photos']."</td> <td>$num_photos</td></tr>\n";
}
print "</table>\n";
display_folders($database, "", 0, $event);
display_albums($database, "", 0, $event);
print "<br/>";
print "<center>";
print $thm_elem['button.back'];
@ -158,7 +158,7 @@ switch ($action) {
print "<tr><td>".$strings['datebook_end']."</td><td><a href=my.datebook.php?year=$year&amp;month=$month&amp;day=$day>".emit_date_html($end_date, "full_date")."</a></td></tr>\n";
print "<tr><td>".$strings['generic_remark']."</td><td>$remark</td></tr>\n";
print "</table>\n";
print "<br/>\n";
print "<center>\n";
print $thm_elem['button.confirm.delete'];
@ -170,7 +170,7 @@ switch ($action) {
case 'edit':
$timestamp = mktime(12, 0, 0, $month, $day, $year);
$date = strftime($strings['formats_date'], $timestamp);
$date = date($strings['formats_date'], $timestamp);
$dayNameIndex = $date["wday"];
/* Retrieve location info */
@ -198,7 +198,7 @@ switch ($action) {
print "<tr><td>".$strings['datebook_client']."</td><td>" . generate_html_clients_combo("client", $database, $po_user['id'], $client) . "</td></tr>";
print "<tr><td>".$strings['generic_remark']."</td><td><textarea id=\"template_editor\" name=\"remark\" rows=\"7\" cols=\"60\">$remark</textarea></td></tr>\n";
print "</table>\n";
print "<br/>";
print "<center>";
print $thm_elem['button.save.changes'];
@ -218,7 +218,7 @@ switch ($action) {
$days_in_month = getDaysInMonth($year, $month);
if ($day < 1 || $day > $days_in_month) {
$day = 1;
}
}
$start_date = sprintf("%04d-%02d-%02d 00:00:00", $year, $month, $day);
$end_date = sprintf("%04d-%02d-%02d 01:00:00", $year, $month, $day);
@ -232,7 +232,7 @@ switch ($action) {
$users_location = pg_query($database, "select identifier, country, state, city, place from view_location $location_mod order by country, state, city, place");
$values = array('location' => $location);
print "<form method=\"post\" action=\"event.php\" accept-charset=\"".$strings['formats_encoding']."\">\n";
print "<input type=\"hidden\" name=\"go\" value=\"go\" />\n";
print "<input type=\"hidden\" name=\"action\" value=\"add\" />\n";
@ -247,7 +247,7 @@ switch ($action) {
print "<tr><td>".$strings['datebook_client']."</td><td>" . generate_html_clients_combo("client", $database, $po_user['id'], "") . "</td></tr>";
print "<tr><td>".$strings['generic_remark']."</td><td><textarea id=\"template_editor\" name=\"remark\" rows=\"7\" cols=\"60\"></textarea></td></tr>\n";
print "</table>\n";
print "<br/>\n";
print "<center>\n";
print $thm_elem['button.add'];
@ -255,7 +255,7 @@ switch ($action) {
print $thm_elem['button.cancel'];
print "</center>\n";
print "</form>\n";
break;
}

View File

@ -47,7 +47,7 @@ function emit_user_quota($value, $type) {
if ($value == 0)
return $strings['generic_unlimited'];
else
else
return "$value" . (($type == 1) ? " MB" : "");
}
@ -89,7 +89,7 @@ function display_image_repository($database, $image_repository_path) {
$size['size'] = round($size['size']/1048576, 2);
$stat = stat($image_repository_path ."/". $file_name);
$max_size = $po_options_default['volume_max_size'];
$stat[9] = strftime($strings['formats_date'], $stat[9]);
$stat[9] = date($strings['formats_date'], $stat[9]);
print "<tr>\n";
print emit_td($file_name);
@ -118,12 +118,12 @@ function display_users_and_clients($database, $my_user_id, $auth_handle) {
$num_of_photo_versions[0] -= $num_of_photos[0];
$user_list = pg_query($database, "
select users.identifier, last_name, first_name, member_since,
value, user_type.identifier,
get_user_pref(users.identifier, 'bulk_upload_enable'),
get_user_pref(users.identifier, 'last_updated'),
select users.identifier, last_name, first_name, member_since,
value, user_type.identifier,
get_user_pref(users.identifier, 'bulk_upload_enable'),
get_user_pref(users.identifier, 'last_updated'),
get_user_pref(users.identifier, 'quota_count'),
get_user_pref(users.identifier, 'quota_size'),
get_user_pref(users.identifier, 'quota_size'),
username, hide,
count_photos_by_user(users.identifier) as photos,
count_photo_versions_by_user(users.identifier) as versions,
@ -197,7 +197,7 @@ function display_users_and_clients($database, $my_user_id, $auth_handle) {
$total_storage_space = round($total_storage_space/1048576, 2);
print "<div align=\"center\">\n";
print "$num_of_users[0] ".$strings['generic_members_storing']." $num_of_photos[0] ".$strings['generic_photos'];
print "$num_of_users[0] ".$strings['generic_members_storing']." $num_of_photos[0] ".$strings['generic_photos'];
if ($num_of_photo_versions[0] > 0) {
print " + $num_of_photo_versions[0] ".$strings['generic_add_versions'];
}
@ -228,21 +228,21 @@ function register_user($database, $username, $user_type, $password, $fn, $ln, $e
$zipcode = pg_escape_string($database, $_REQUEST['zipcode']);
$state = pg_escape_string($database, $_REQUEST['state']);
$country = pg_escape_string($database, $_REQUEST['country']);
pg_query($database, "begin");
$new_user_id = pg_fetch_row(pg_query($database, "select nextval('users_id_sequence')"));
$user_id = $new_user_id[0];
if (strlen($url) && (substr($url, 0, 7) != "http://"))
$url = "http://".$url;
$password = pg_escape_string($database, $auth_handle->passwd_transform($password, $username));
$username = pg_escape_string($database, $username);
$result = pg_query($database, "insert into users (identifier, first_name, last_name, company, username, password, member_since, type, address1, address2, city, zipcode, state, country, phone, email, url)
values ('$user_id', '$first_name', '$last_name', '$company', '$username', '$password', now(), $user_type, '$address1', '$address2', '$city', '$zipcode', $state, $country, '$phone', '$email', '$url')");
if ($result) {
if ($result) {
$result = pg_query($database, "insert into folder (identifier, parent_folder, users, caption, access_rights)
values (nextval('folder_id_sequence'), null, '$user_id', 'Trash', 3)");
}
@ -251,7 +251,7 @@ function register_user($database, $username, $user_type, $password, $fn, $ln, $e
values (nextval('album_id_sequence'), null, $user_id,
'Spool', 3, null)");
}
if ($result)
$result = store_user_pref($database, $user_id, 'lang', $lang);
if ($result)
@ -260,13 +260,13 @@ function register_user($database, $username, $user_type, $password, $fn, $ln, $e
$result = store_user_pref($database, $user_id, 'quota_count', $po_options_default['quota_count']);
if ($result)
$result = store_user_pref($database, $user_id, 'bulk_upload_enable', $po_options_default['bulk_upload_enable']);
/* Create the client association */
if ($result && $po_user['type'] == PO_USER_TYPE_USER) {
$result = pg_query($database, "insert into client (identifier, users, client, status, trusted)
values (nextval('client_id_sequence'), '$po_user[id]', '$user_id', 2, 't')");
}
if ($result) {
pg_query($database, "commit");
return $user_id;

View File

@ -171,13 +171,13 @@ function emit_date_html($timestamp, $format, $special = FALSE) {
global $po_user;
global $strings;
if ($special)
if ($special)
$link = FALSE;
else if ($po_user['type'] > PO_USER_TYPE_DISABLED)
$link = TRUE;
else
else
$link = FALSE;
if (!$timestamp)
return "";
@ -225,19 +225,19 @@ function emit_date_html($timestamp, $format, $special = FALSE) {
$html_string = "";
if ($date_format) {
$html_string .= strftime($date_format, $timestamp);
$html_string .= date($date_format, $timestamp);
}
if ($link)
if ($link)
$html_string = emit_a("my.datebook.php?view=1&amp;year=$year&amp;month=$month&amp;day=$day", $html_string);
if ($time_format) {
if ($time_format == $format) {
$html_string .= $format;
} else {
if ($date_format)
if ($date_format)
$html_string .= " @ ";
$html_string .= strftime($time_format, $timestamp);
$html_string .= date($time_format, $timestamp);
}
}

View File

@ -115,10 +115,10 @@ switch ($calendar_view) {
print "<div class=\"photo_nav\">";
$yesterday = adjustDay($calendar_year, $calendar_month, $calendar_day - 1);
print sprintf($thm_elem['button.previous'], "my.datebook.php?view=1&amp;year=$yesterday[0]&amp;month=$yesterday[1]&amp;day=$yesterday[2]", $strings['generic_day'], "");
print "<b>&nbsp;&nbsp; $dayNames[$dayNameIndex] ".strftime($strings['formats_date'], $timestamp)."&nbsp;&nbsp;</b>";
print "<b>&nbsp;&nbsp; $dayNames[$dayNameIndex] ".date($strings['formats_date'], $timestamp)."&nbsp;&nbsp;</b>";
$tomorrow = adjustDay($calendar_year, $calendar_month, $calendar_day + 1);
print sprintf($thm_elem['button.next'], "my.datebook.php?view=1&amp;year=$tomorrow[0]&amp;month=$tomorrow[1]&amp;day=$tomorrow[2]", $strings['generic_day'], "");
@ -228,7 +228,7 @@ switch ($calendar_view) {
$curDate = adjustDay($calendar_year, $calendar_month, $day);
$num_photos = 0;
if ($showcounts) {
$num_photos = photos_between_dates($database, $po_user['id'],
$num_photos = photos_between_dates($database, $po_user['id'],
mktime(0,0,0,$curDate[1],$curDate[2],$curDate[0]),
mktime(0,0,0,$curDate[1],$curDate[2]+1,$curDate[0]));
}
@ -236,8 +236,8 @@ switch ($calendar_view) {
$bgcolor = "";
if ($curDate[2]!=$day)
$bgcolor = "class=\"inactive\"";
if (($calendar_year == $today["year"]) &&
($calendar_month == $today["mon"]) &&
if (($calendar_year == $today["year"]) &&
($calendar_month == $today["mon"]) &&
($day == $today["mday"])) {
$bgcolor = "class=\"selected\"";
}