[misc] Fix an oversignt in the previous commit

This commit is contained in:
Solomon Peachy 2022-05-08 12:46:04 -04:00
parent 649ca36f36
commit c3560e8065
2 changed files with 132 additions and 128 deletions

View File

@ -43,16 +43,16 @@ function emit_th($value, $attrs = "") {
function emit_option($value, $text, $selected, $disabled = FALSE) {
$sel = "";
if ($selected === TRUE)
if ($selected === TRUE)
$sel = ' selected="selected" ';
if ($disabled === TRUE)
$sel .= ' disabled="disabled" ';
return "<option value=\"$value\" $sel>$text</option>\n";
}
function emit_float_combo($identifier, $current_value,
function emit_float_combo($identifier, $current_value,
$min_value, $max_value, $step) {
global $strings;
@ -83,7 +83,7 @@ function get_generic_row_query($database, $query, $key = FALSE, $assoc = FALSE)
$val = $memcache->get($key);
if ($val !== FALSE)
return $val;
}
}
if ($assoc)
$val = pg_fetch_assoc(pg_query($database, $query));
@ -115,7 +115,7 @@ function get_generic_query_all($database, $query, $key = FALSE) {
$val = $memcache->get($key);
if ($val !== FALSE)
return $val;
}
}
$val = pg_fetch_all(pg_query($database, $query));
@ -253,7 +253,7 @@ function emit_popup_delay_combo($identifier, $popup_delay, $popup_enabled) {
function emit_first_day_combo($identifier, $current_value) {
global $dayNames;
$rval = "";
$rval .= "<select name=\"$identifier\">";
@ -261,7 +261,7 @@ function emit_first_day_combo($identifier, $current_value) {
$rval .= emit_option($i, $dayNames[$i], $current_value == $i);
}
$rval .= "</select>";
return $rval;
}
@ -294,7 +294,7 @@ function emit_colorspace_combo($identifier, $current_value) {
$rval .= emit_option("99", $strings['generic_embedded'], $current_value == 99);
$rval .= "</select>";
return $rval;
return $rval;
}
function display_photo_index_status($offset, $limit, $num_of_items) {
@ -350,7 +350,7 @@ function emit_enable_disable_combo($item_name, $value) {
global $strings;
$val = "<select name=\"$item_name\">\n";
$val .= emit_option('t', $strings['generic_enabled'], $value == 't');
$val .= emit_option('f', $strings['generic_disabled'], $value == 'f');
$val .= "</select>\n";
@ -413,9 +413,9 @@ function display_photo_navigator($hyperlink, $offset, $limit, $num_of_items) {
global $thm_elem;
global $strings;
global $po_options;
/* Sanity checking */
if ($limit <= 0)
if ($limit <= 0)
$limit = 1;
if (($offset == 0) &&
@ -424,7 +424,7 @@ function display_photo_navigator($hyperlink, $offset, $limit, $num_of_items) {
}
/* Compute the limits of the pager */
$entries = 15;
$entries = 15;
if (($num_of_items / $limit) > $entries) {
$show_x_nav = TRUE;
$count = $limit * $entries;
@ -447,10 +447,10 @@ function display_photo_navigator($hyperlink, $offset, $limit, $num_of_items) {
}
$last = $limit * floor($num_of_items/$limit);
$previous = $offset - $limit;
$next = $offset + $limit;
if ($previous < 0)
$previous = 0;
@ -470,16 +470,16 @@ function display_photo_navigator($hyperlink, $offset, $limit, $num_of_items) {
print sprintf($thm_elem['button.previous2'], $hyperlink.$delim."offset=$first_lim", $count / 2, "");
}
print sprintf($thm_elem['button.previous'], $hyperlink.$delim."offset=$previous", $strings['generic_page'], "");
for ($i=($first_lim/$limit); $i < ceil($last_lim/$limit); $i++) {
$aux=$i*$limit;
$aux1 = $aux + 1;
$aux2=($i+1)*$limit;
if ($aux2 > $num_of_items) $aux2 = $num_of_items;
if ($aux == $offset)
if ($aux == $offset)
print sprintf($thm_elem['button.option.a'], $hyperlink.$delim."offset=$aux", "$aux1-$aux2");
else
print sprintf($thm_elem['button.option'], $hyperlink.$delim."offset=$aux", "$aux1-$aux2");
}
@ -523,7 +523,7 @@ function emit_folder_actions($folder_all, $folder_id) {
$rval .= "<br/>";
$rval .= "<span>";
$rval .= "<input type=\"hidden\" name=\"source_folder\" value=\"$folder_id\"/>\n";
$rval .= $thm_elem['button.move.to.f'];
$rval .= $thm_elem['button.go.to.f'];
@ -625,13 +625,13 @@ function emit_import_actions($database, $userid) {
$num_photos2 = $results_import[0];
$rval = "";
if ($num_photos > 0 || $num_photos2 > 0) {
$rval .= "<br/>";
$rval .= "<span>";
$rval .= "<b><a href=\"import.log.php\">".$strings['import_results'].": $num_photos2&nbsp;</a></b> ";
$rval .= "<b>".$strings['import_remaining'].": $num_photos&nbsp;</b> ";
$rval .= "</span>";
$rval .= "</span>";
}
return $rval;
@ -648,13 +648,13 @@ function emit_print_actions($database, $userid) {
$num_photos2 = $results_import[0];
$rval = "";
if ($num_photos > 0 || $num_photos2 > 0) {
$rval .= "<br/>";
$rval .= "<span>";
$rval .= "<b><a href=\"print.log.php\">".$strings['print_results'].": $num_photos2&nbsp;</a></b> ";
$rval .= "<b>".$strings['import_remaining'].": $num_photos&nbsp;</b> ";
$rval .= "</span>";
$rval .= "</span>";
}
return $rval;
@ -714,14 +714,14 @@ function emit_export() {
global $strings;
$rval = "";
$rval .= "<span>";
$rval .= $thm_elem['button.export'];
$rval .= "<select name=\"export_type\">\n";
$rval .= emit_option("", '&nbsp;', TRUE);
$rval .= emit_option("photo", $strings['generic_photos_only'], FALSE);
$rval .= emit_option("photo_xml", $strings['generic_photos_xml'], FALSE);
// $rval .= emit_option("photo_iptcl", $strings['generic_photos_iptc'], FALSE);
// $rval .= emit_option("photo_iptc_xml", $strings['generic_photos_iptc_xml'], FALSE);
@ -772,11 +772,11 @@ function get_photo_count($database, $froms, $filter)
$froms = ", $froms";
}
$photos = pg_fetch_row(pg_query($database,
$photos = pg_fetch_row(pg_query($database,
"select count(photo.identifier)
from photo, photo_version $froms
where $filter
and photo.identifier = photo_version.photo
and photo.identifier = photo_version.photo
$sql_query_photo_access_rights_string
and get_image_path(photo_version.identifier, 2) is not null"));
@ -801,15 +801,15 @@ function get_photo_query($database, $fields, $froms, $filter, $offset, $limit, $
} else {
$froms = "";
}
if ($filter)
if ($filter)
$filter = "$filter and ";
if ($offset != 0)
$offset = " offset $offset ";
else
else
$offset = "";
if ($limit != 0)
$limit = " limit $limit ";
else
else
$limit = "";
$sql_query_photo_access_rights_string = "can_access_photo(photo.identifier, $po_user[id], '{".$passwords."}')";
@ -819,8 +819,8 @@ function get_photo_query($database, $fields, $froms, $filter, $offset, $limit, $
$sql_query_order_by_string = "";
}
$query =
"select photo.identifier, photo.caption, photo.date_of_exposure,
$query =
"select photo.identifier, photo.caption, photo.date_of_exposure,
photo.date_added, photo.access_rights,
(select avg(rating.value) from rating where rating.photo=photo.identifier) as rating,
views, photo.title, photo.author,
@ -832,7 +832,7 @@ function get_photo_query($database, $fields, $froms, $filter, $offset, $limit, $
$fields
from photo left join photo_version on photo.identifier = photo_version.photo
$froms
where $filter
where $filter
$sql_query_photo_access_rights_string
and get_image_path(photo_version.identifier, 2) is not null
$sql_query_order_by_string
@ -854,7 +854,7 @@ function display_photo_slides($display_type, $container_id, $photo_data, $offset
$my_user_id = $po_user['id'];
$my_user_type = $po_user['type'];
if ($my_user_type < PO_USER_TYPE_CLIENT)
if ($my_user_type < PO_USER_TYPE_CLIENT)
$checks = FALSE;
$global_args = array();
@ -879,11 +879,11 @@ function display_photo_slides($display_type, $container_id, $photo_data, $offset
}
$content = "";
if ($po_options['popup_enable'] == 't') {
$tt_id = "tt_img_$photo[identifier]_$photo[version]";
$content .= "<div class=\"hide_tooltip\" id=\"$tt_id\"><table class=\"tooltip\">";
if ($photo['title'])
if ($photo['title'])
$content .= tooltip_row($strings['generic_title'], $photo['title']);
else
$content .= tooltip_row($strings['generic_orig_file'], $photo['original_image_name']);
@ -915,10 +915,10 @@ function display_photo_slides($display_type, $container_id, $photo_data, $offset
$content .= "</table></div>\n";
}
if ($framed)
if ($framed)
$class="class=\"slide\"";
else
$class="";
else
$class="";
$photo_args = $global_args;
$photo_args['ver'] = $photo['version'];
@ -932,7 +932,7 @@ function display_photo_slides($display_type, $container_id, $photo_data, $offset
}
$content .= emit_a(generate_link('photo', $photo['identifier'], $photo_args2),
emit_img(generate_link("image", $photo['identifier'],
emit_img(generate_link("image", $photo['identifier'],
$photo_args),
"$class alt=\"# $photo[identifier]:$photo[version]\""),
$properties);
@ -950,7 +950,7 @@ function display_photo_slides($display_type, $container_id, $photo_data, $offset
print "</div>\n";
if ($cell_counter)
if ($cell_counter)
return $checkboxes;
else
return FALSE;
@ -1012,7 +1012,7 @@ function display_photo_list($display_type, $container_id, $photo_data, $offset,
$onmouseover = "onmouseover=\"TagToTip('$tt_id', DELAY, $po_options[popup_delay], COPYCONTENT, false, BORDERWIDTH, 0, PADDING, 0);\" onmouseout=\"UnTip();\"";
} else {
$onmouseover = "";
}
}
$photo_args = array('ver'=>$photo['version']);
@ -1076,7 +1076,7 @@ function emit_profile_manuf_combo($url, $type, $span, $rows, $filter) {
$span -= 2;
$rval = "";
$rval .= "<tr class=\"folder_top\">";
$rval .= emit_td('');
$rval .= "<td>";
@ -1107,7 +1107,7 @@ function emit_manufacturer_combo($name, $rows, $current_value) {
}
$rval .= "</select>\n";
return $rval;
}
@ -1128,9 +1128,9 @@ function get_users_folder($database) {
if ($val === FALSE) {
$order_by = $po_options['folder_order_by'];
$sql_query_order_by_string = $folder_order_by_string[$order_by][0];
$res = pg_query($database, "select identifier, caption, parent_folder, (select count(f2.identifier) from folder f2 where f2.parent_folder = f.identifier) as subs, (select count(p.identifier) from photo p where p.folder = f.identifier) as photos from folder f where users=$po_user[id] and identifier != $po_user[trash_folder] order by parent_folder asc, $sql_query_order_by_string");
$val = array();
for ($i=0; $i < pg_num_rows($res); $i++) {
$val[] = pg_fetch_array($res, $i);
@ -1140,7 +1140,7 @@ function get_users_folder($database) {
po_log("memcache: set allfolder.$po_user[id]", PEAR_LOG_DEBUG);
$memcache->set("allfolder.$po_user[id]", $val);
}
}
}
return $val;
}
@ -1162,9 +1162,9 @@ function get_users_album($database) {
if ($val === FALSE) {
$order_by = $po_options['folder_order_by'];
$sql_query_order_by_string = $folder_order_by_string[$order_by][0];
$res = pg_query($database, "select identifier, caption, parent_album, (select count(a2.identifier) from album a2 where a2.parent_album = a.identifier) as subs, (select count(*) from album_content p where p.album = a.identifier) as photos from album a where users=$po_user[id] and identifier != $po_user[spool_album] order by parent_album asc, $sql_query_order_by_string");
$val = array();
for ($i=0; $i < pg_num_rows($res); $i++) {
$val[] = pg_fetch_array($res, $i);
@ -1353,10 +1353,10 @@ function display_users($database, $viewer_user_id, $sql_search_string = '') {
count_photos_by_user(identifier) as photos,
count_folders_by_user(identifier) -1 as folders,
count_albums_by_user(identifier) -1 as albums
from users
where users.type>".PO_USER_TYPE_CLIENT."
from users
where users.type>".PO_USER_TYPE_CLIENT."
and identifier=$viewer_user_id"));
print "<div class=\"folder\">";
print "<table class=\"folder\">\n";
print "<tr>\n";
@ -1383,8 +1383,8 @@ function display_users($database, $viewer_user_id, $sql_search_string = '') {
count_photos_by_user(identifier, $po_user[id], '{".$passwords."}') as photos,
count_folders_by_user(identifier, $po_user[id], '{".$passwords."}') as folders,
count_albums_by_user(identifier, $po_user[id], '{".$passwords."}') as albums
from users
where users.type > ".PO_USER_TYPE_CLIENT."
from users
where users.type > ".PO_USER_TYPE_CLIENT."
$sql_search_string
order by last_name, first_name");
@ -1439,12 +1439,12 @@ function display_albums($database, $album_id, $owner_user_id, $event = FALSE, $d
if ($event === FALSE)
$filter = " users = $owner_user_id and $selector";
else
else
$filter = " event = $event ";
$all_albums = pg_query($database, "
select album.identifier, caption, date_of_creation, access_rights, date_changed,
count_subalbums_by_album(album.identifier, $po_user[id], '{".$passwords."}') as subs,
count_subalbums_by_album(album.identifier, $po_user[id], '{".$passwords."}') as subs,
count_photos_by_album(album.identifier, $po_user[id], '{".$passwords."}') as photos,
thumb_ver, users.identifier as user_id, users.first_name, users.last_name
from album, users
@ -1488,10 +1488,10 @@ function really_display_albums($all_albums, $display_extra, $display_user, $albu
$colspan+=3;
if ($display_user)
$colspan++;
if ($album_id == "")
print "<td colspan=\"$colspan\">".$strings['generic_albums']."</td>\n";
else
else
print "<td colspan=\"$colspan\">".$strings['generic_subalbums']."</td>\n";
print "</tr>\n";
@ -1526,7 +1526,7 @@ function really_display_albums($all_albums, $display_extra, $display_user, $albu
if (!is_array($album)) {
continue;
}
if ($album['caption'] == 'Spool' ||
if ($album['caption'] == 'Spool' ||
$album['identifier'] == $po_user['spool_album']) {
continue;
} else {
@ -1545,7 +1545,7 @@ function really_display_albums($all_albums, $display_extra, $display_user, $albu
$album['caption'], $on_mouse_over));
print emit_td($album['subs']);
print emit_td($album['photos']);
print emit_td(emit_date_html($album['date_of_creation'], 'date'));
print emit_td(emit_date_html($album['date_changed'], 'date'));
@ -1586,16 +1586,16 @@ function column_sort_helper($order_by, $text, $base, $uri = "")
}
if ($uri == "") {
if (isset($_REQUEST['user']))
if (isset($_REQUEST['user']))
$uri = generate_link('user', $_REQUEST['user'], $args);
elseif (isset($_REQUEST['folder']))
elseif (isset($_REQUEST['folder']))
$uri = generate_link('folder', $_REQUEST['folder'], $args);
elseif (isset($_REQUEST['album']))
elseif (isset($_REQUEST['album']))
$uri = generate_link('album', $_REQUEST['album'], $args);
} else {
$uri = generate_link($uri, '', $args);
}
return emit_a($uri, "$text$order_txt");
}
@ -1617,18 +1617,18 @@ function display_folders($database, $folder_id, $owner_user_id, $event = FALSE,
if ($event === FALSE)
$filter = " users = $owner_user_id and $folder_selector";
else
else
$filter = " event = $event ";
$all_folders = pg_query($database, "
select folder.identifier, caption, date_of_creation, access_rights, date_changed,
count_subfolders_by_folder(folder.identifier, $po_user[id], '{".$passwords."}') as subs,
count_subfolders_by_folder(folder.identifier, $po_user[id], '{".$passwords."}') as subs,
count_photos_by_folder(folder.identifier, $po_user[id], '{".$passwords."}') as photos,
thumb_ver, users.identifier as user_id, users.first_name, users.last_name
thumb_ver, users.identifier as user_id, users.first_name, users.last_name
from folder, users
where $filter
and folder.users = users.identifier
and can_access_folder(folder.identifier, $po_user[id], '{".$passwords."}')
and can_access_folder(folder.identifier, $po_user[id], '{".$passwords."}')
order by $sql_query_order_by_string");
$all_folders = pg_fetch_all($all_folders);
@ -1657,16 +1657,16 @@ function really_display_folders($all_folders, $display_extra, $display_user, $fo
print "<div class=\"folder\">";
print "<table class=\"folder\">\n";
print "<tr class=\"folder_top\">\n";
$colspan = 5;
if ($display_extra)
$colspan+=3;
if ($display_user)
$colspan++;
if ($folder_id == "")
print "<td colspan=\"$colspan\">".$strings['generic_folders']."</td>\n";
else
else
print "<td colspan=\"$colspan\">".$strings['generic_subfolders']."</td>\n";
print "</tr>\n";
@ -1714,7 +1714,7 @@ function really_display_folders($all_folders, $display_extra, $display_user, $fo
} else {
$on_mouse_over = "";
}
print "<tr>\n";
print "<tr>\n";
print emit_td($tt . emit_a(generate_link('folder', $folder['identifier']),
$folder['caption'], $on_mouse_over));
print emit_td($folder['subs']);
@ -1735,7 +1735,7 @@ function really_display_folders($all_folders, $display_extra, $display_user, $fo
print "</tr>\n";
}
}
if ($display_extra && $display_special_folders &&
if ($display_extra && $display_special_folders &&
($trash['photos'] > 0)) {
print "<tr>\n";
print "<td colspan=\"2\">".emit_a(generate_link('folder', $trash['identifier']), $strings['generic_trash'])."</td>\n";
@ -1957,7 +1957,7 @@ function add_folder($database, $userid, $parent, $access_rights, $name, $descr,
return FALSE;
} else {
$string = "insert into folder (identifier, parent_folder, users, caption, description, access_rights, password, event, orderby)
values (nextval('folder_id_sequence'), $parent,
values (nextval('folder_id_sequence'), $parent,
$userid, '$name', '$descr', $access_rights, '$password', $event, $orderby)";
pg_query($database, "begin");
@ -1994,7 +1994,7 @@ function photos_between_dates_sql($database, $userid, $from, $to)
function emit_form_helper($key, $values, $bulk_update) {
global $strings;
$val = "<tr>";
$val = "<tr>";
if (isset($values[$key]))
$value = $values[$key];
@ -2002,9 +2002,9 @@ function emit_form_helper($key, $values, $bulk_update) {
$value = '';
if ($bulk_update)
$val .= emit_td($strings['generic_'.$key] . emit_checkbox_item("to_update[]", "set_$key", "", false));
$val .= emit_td($strings['generic_'.$key] . emit_checkbox_item("to_update[]", "set_$key", "", false));
else
$val .= emit_td($strings['generic_'.$key]);
$val .= emit_td($strings['generic_'.$key]);
$val .= emit_td("<textarea name=\"$key\" rows=\"2\" cols=\"60\">$value</textarea>");
$val .= "</tr>\n";
@ -2015,7 +2015,7 @@ function emit_form_helper($key, $values, $bulk_update) {
function emit_form_combo_helper($key, $values, $bulk_update, $combo_vals, $sep = '', $no_null = FALSE) {
global $strings;
$val = "<tr>";
$val = "<tr>";
if (isset($values[$key]))
$value = $values[$key];
@ -2023,9 +2023,9 @@ function emit_form_combo_helper($key, $values, $bulk_update, $combo_vals, $sep =
$value = '';
if ($bulk_update)
$val .= emit_td($strings['generic_'.$key] . emit_checkbox_item("to_update[]", "set_$key", "", false));
$val .= emit_td($strings['generic_'.$key] . emit_checkbox_item("to_update[]", "set_$key", "", false));
else
$val .= emit_td($strings['generic_'.$key]);
$val .= emit_td($strings['generic_'.$key]);
$val .= emit_td(emit_combo($key, $combo_vals, $value, $sep, $no_null));
$val .= "</tr>\n";
@ -2075,27 +2075,27 @@ function emit_iptc_form($database, $bulk_update, $spec_values = array()) {
$users_location = pg_query($database, "select identifier, country, state, city, place from view_location $location_mod order by country, state, city, place");
/* And now for the form */
$rval .= emit_form_helper('title', $values, $bulk_update);
$rval .= emit_form_helper('author', $values, $bulk_update);
if ($bulk_update) {
$rval .= "<tr>";
$rval .= emit_td($strings['generic_set_keywords'] .emit_checkbox_item("to_update[]", "set_keyword", "", false));
$rval .= "<tr>";
$rval .= emit_td($strings['generic_set_keywords'] .emit_checkbox_item("to_update[]", "set_keyword", "", false));
$rval .= emit_td(emit_keyword_helper("keywords", 'set_', array(), TRUE));
$rval .= "</tr>\n";
$rval .= "<tr>";
$rval .= emit_td($strings['generic_clear_keywords'].emit_checkbox_item("to_update[]", "clear_keyword", "", false));
$rval .= "<tr>";
$rval .= emit_td($strings['generic_clear_keywords'].emit_checkbox_item("to_update[]", "clear_keyword", "", false));
$rval .= emit_td(emit_keyword_helper("keywords", 'clear_', array(), TRUE));
$rval .= "</tr>\n";
} else {
$rval .= "<tr>";
$rval .= "<tr>";
$rval .= emit_td($strings['generic_keywords']);
$rval .= emit_td(emit_keyword_helper("keywords", '', $values['keywords'], FALSE));
$rval .= "</tr>\n";
}
$rval .= emit_form_helper('headline', $values, $bulk_update);
$rval .= emit_form_helper('caption_writer', $values, $bulk_update);
$rval .= emit_form_helper('caption', $values, $bulk_update);
@ -2108,7 +2108,7 @@ function emit_iptc_form($database, $bulk_update, $spec_values = array()) {
$rval .= emit_form_helper('source', $values, $bulk_update);
$rval .= emit_form_helper('transmission_reference', $values, $bulk_update);
$rval .= "<tr>";
$rval .= "<tr>";
if ($bulk_update)
$rval .= emit_td($strings['generic_exposed'].emit_checkbox_item("to_update[]", "set_date_of_exposure", "", false));
else
@ -2145,10 +2145,10 @@ function emit_iptc_form($database, $bulk_update, $spec_values = array()) {
function emit_equipment_helper($id, $combo_rows, $num, $prefix = '') {
global $strings;
$val = "<tr>";
$val = "<tr>";
$val .= emit_td($strings['generic_'.$id]);
$val .= emit_td(emit_combo("$prefix$id", $combo_rows, 0, "", 0) ." <button title=\"".$strings['generic_add']."\" type=\"button\" onclick=\"javascript: addEquipment('$id', $num, '$prefix');\" >".$strings['generic_add']."</button>");
$val .= "</tr>";
$val .= "</tr>";
return $val;
}
@ -2163,7 +2163,7 @@ function emit_keyword_helper($id, $prefix = '', $list, $bulk_update) {
$val .= "<script type=\"text/javascript\" src=\"javascript/equipmentlist.js\"></script>";
$equip_inc = 1;
}
$val .= "<table><tr><td></td><td>";
$val .= "<input type=\"text\" name=\"$prefix$id\" value=\"\" /> <button title=\"".$strings['generic_add']."\" type=\"button\" onclick=\"javascript: addKeyword('$id', '$prefix');\" >".$strings['generic_add']."</button>";
$val .= "</td></tr>";
@ -2197,7 +2197,7 @@ function emit_equipment_form($database, $bulk_update, $current = FALSE) {
$val .= "<script type=\"text/javascript\" src=\"javascript/equipmentlist.js\"></script>";
$equip_inc = 1;
}
if ($bulk_update) {
$prefixes = array('add', 'delete');
} else {
@ -2208,7 +2208,7 @@ function emit_equipment_form($database, $bulk_update, $current = FALSE) {
$val .= "<tr>";
if ($bulk_update)
$val .= emit_td($strings['generic_'.$prefix] ." ".$strings['generic_equipment'] .emit_checkbox_item("to_update[]", "$prefix"."_equipment", "", false));
else
else
$val .= emit_td($strings['generic_equipment']);
if ($prefix)
$prefix = $prefix . "_";
@ -2238,7 +2238,7 @@ function emit_equipment_form($database, $bulk_update, $current = FALSE) {
function emit_photo_tech_form($database, $bulk_update, $spec_values = array()) {
global $strings;
global $po_user;
global $po_user;
global $po_options;
$rval = "";
@ -2316,7 +2316,7 @@ function emit_photo_tech_form($database, $bulk_update, $spec_values = array()) {
$rval .= "<tr>";
if ($bulk_update)
$rval .= emit_td($strings['photo_geolocation']. emit_checkbox_item("to_update[]", "set_geo_location", "", false));
else
else
$rval .= emit_td($strings['photo_geolocation']);
$values['latitude'] = htmlentities(latitude_dms($values['latitude'], "latitude"));
@ -2334,7 +2334,7 @@ function emit_photo_tech_form($database, $bulk_update, $spec_values = array()) {
$rval .= emit_td($strings['generic_scan_parameters'].emit_checkbox_item("to_update[]", "set_scan_params", "", false));
else
$rval .= emit_td($strings['generic_scan_parameters']);
$scan_bitdepths = explode(',', $po_options['scan_bitdepths']);
$scan_multiscans = explode(',', $po_options['scan_multiscans']);
$scan_resolutions = explode(',', $po_options['scan_resolutions']);
@ -2365,7 +2365,7 @@ function space_string_to_array($str){
function po_get_image_size($file) {
global $sys_exiftool;
if (!is_executable($sys_exiftool))
if (!is_executable($sys_exiftool))
return getimagesize($file);
$width = FALSE;
@ -2461,7 +2461,7 @@ function refresh_user_prefs($database) {
$po_options[$row['key']] = $row['value'];
}
}
/* Update Session state */
$po_user['last_updated'] = time();
store_user_pref($database, $po_user['id'], 'last_updated', $po_user['last_updated']);
@ -2483,7 +2483,7 @@ function emit_theme_combo($thm) {
$rval .= emit_option($file, $file, $thm == $file);
}
closedir($dh);
}
}
$rval .= "</select></td>";
$rval .= "</tr>";
@ -2513,7 +2513,7 @@ function emit_language_combo($lang) {
$rval .= emit_option($file, $strings['formats_name'], $lang == $file);
}
closedir($dh);
}
}
include "lang/".$po_options['lang'].".php";
@ -2528,7 +2528,7 @@ function parse_latitude($value) {
if ($value == "")
return "";
$regexp = "/((?:[+-]?)(?=\d|\.\d)\d*(?:\.\d*)?)/";
$res = array();
$rval = "";
@ -2543,7 +2543,7 @@ function parse_latitude($value) {
if (preg_match("/[^A-Z](S|W)$/i", $value))
$rval = - $rval;
return $rval;
}
@ -2554,17 +2554,17 @@ function latitude_dms($latitude_deg, $type) {
return "";
if ($type == "latitude") {
if ($latitude_deg > 0)
if ($latitude_deg > 0)
$dir = $strings['generic_north'];
else
else
$dir = $strings['generic_south'];
} else {
if ($latitude_deg > 0)
if ($latitude_deg > 0)
$dir = $strings['generic_east'];
else
else
$dir = $strings['generic_west'];
}
$latitude_deg = abs($latitude_deg);
$deg = intval($latitude_deg);
@ -2578,7 +2578,7 @@ function disp_user_string($database, $owner_id, $link = TRUE) {
global $strings;
global $po_user;
global $memcache;
$user_data = FALSE;
if (!$owner_id) {
@ -2592,7 +2592,7 @@ function disp_user_string($database, $owner_id, $link = TRUE) {
po_log("memcache: get user_data_s.$owner_id", PEAR_LOG_DEBUG);
$user_data = $memcache->get("user_data_s.$owner_id");
}
if ($user_data === FALSE) {
$user_data = pg_fetch_assoc(pg_query($database, "
select last_name, first_name, username
@ -2655,7 +2655,7 @@ function generate_html_users_combo($identifier, $database, $default_user_id, $al
}
for ($i=0; $i < pg_num_rows($user_list); $i++) {
$user = pg_fetch_row($user_list, $i);
if (($user[0] != $po_user['id']) &&
if (($user[0] != $po_user['id']) &&
($po_user['type'] != PO_USER_TYPE_ADMIN) &&
($user[3] == 't') &&
($user[0] != $default_user_id)) {
@ -2683,9 +2683,9 @@ function generate_html_clients_combo($identifier, $database, $owner_user_id, $cu
return $html_string;
}
/* PHP's internal symlink function is unreliable.
Some versions always create absolute symlinks,
while others create relative symlinks.
/* PHP's internal symlink function is unreliable.
Some versions always create absolute symlinks,
while others create relative symlinks.
Sigh. */
function po_symlink($src, $dest) {
@ -2694,7 +2694,7 @@ function po_symlink($src, $dest) {
$dest = escapeshellarg($dest);
$retval;
system("ln -s $src $dest", $retval);
return ($retval == 0);
}
@ -2703,7 +2703,7 @@ function po_symlink($src, $dest) {
function generate_password($length = 10) {
// 'l','1','I' look alike so they're removed. Likewise with '0' and 'O'.
$allowable_characters = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
// We see how many characters are in the allowable list
$ps_len = strlen($allowable_characters);
@ -2716,11 +2716,11 @@ function generate_password($length = 10) {
// Loop the number of times specified by $length
for($i = 0; $i < $length; $i++) {
// Each iteration, pick a random character from the
// allowable string and append it to the password.
$pass .= $allowable_characters[mt_rand(0,$ps_len-1)];
} // End for
// Retun the password we've selected
@ -2752,20 +2752,20 @@ function deltree($path) {
$entries = array();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) $entries[] = $file;
closedir($handle);
}
} else {
$entries = scandir($path);
if ($entries === false) $entries = array(); // just in case scandir fail...
}
foreach ($entries as $entry) {
if ($entry != '.' && $entry != '..') {
deltree($path.'/'.$entry);
}
}
return rmdir($path);
} else {
return unlink($path);
@ -2791,13 +2791,13 @@ function generate_link($type, $arg0='', $args = array(), $raw = FALSE) {
case 'album':
if ($pretty_urls)
$url = "album/$arg0";
else
else
$url = "album.php?album=$arg0";
break;
case 'folder':
if ($pretty_urls)
$url = "folder/$arg0";
else
else
$url = "folder.php?folder=$arg0";
break;
case 'search.folder':
@ -2848,6 +2848,10 @@ function generate_link($type, $arg0='', $args = array(), $raw = FALSE) {
if (isset($args['ver']) && $args['ver']) {
$url .= ":$args[ver]";
unset($args['ver']);
if (isset($args['size']) && $args['size']) {
$url .= ":$args[size]";
unset($args['size']);
}
}
} else {
$url = "photo.php?photo=$arg0";
@ -2857,7 +2861,7 @@ function generate_link($type, $arg0='', $args = array(), $raw = FALSE) {
if ($arg0) {
if ($pretty_urls)
$url = "user/$arg0";
else
else
$url = "user.php?user=$arg0";
} else {
if ($pretty_urls)
@ -2930,7 +2934,7 @@ function nuke_photos($database, $folder_id, $user_id)
$result = TRUE;
if ($result) {
// Nuke any watermark preferences that use this photo
// Nuke any watermark preferences that use this photo
$result = pg_query($database, "delete from user_preferences where key = 'watermark_photo' and value in (select text(v.identifier) from photo_version v, photo p where p.identifier = v.photo and v.photo in ($sel2))");
}
if ($result) {
@ -3004,7 +3008,7 @@ function emit_metadata_order_combo($identifier, $current_value) {
'exif,xmp,iptc','exif,iptc,xmp',
'xmp,iptc,exif','xmp,exif,iptc',
'iptc,xmp,exif','iptc,exif,xmp');
return emit_combo_array($identifier,$all,$current_value,TRUE);
}
@ -3013,7 +3017,7 @@ function po_log($msg, $level = PEAR_LOG_NOTICE) {
global $po_user;
global $po_log_level;
if (($po_log !== FALSE) && ($po_log_level >= $level)) {
$po_log->log("$po_user[username]($po_user[id]) $msg", $level);
}
@ -3059,7 +3063,7 @@ function emit_files_list($database, $photo_id, $version_id) {
$ret .= "<div id=\"image_sizes\">$strings[photo_sizes]<ul>";
for ($i = 0 ; $i < pg_num_rows($query); $i++) {
$row = pg_fetch_assoc($query, $i);
if (($row['size'] == 0 || $row['size'] == 4) &&
if (($row['size'] == 0 || $row['size'] == 4) &&
!grant_access_to_original($row['original_image_name'] != "",
($po_user['id'] == $row['users']),
($po_user['type'] == PO_USER_TYPE_ADMIN),

View File

@ -247,7 +247,7 @@ if ($prev_idx !== FALSE) {
print "</div>\n";
$on_mouse_over ="TagToTip('prev_tip', OFFSETX, 12, ABOVE, true);";
print sprintf($thm_elem['button.previous'],
generate_link('photo', $prev, array('ver'=>$prev_ver, 'detail_info'=>$detail_info,'album'=>$album_id)),
generate_link('photo', $prev, array('ver'=>$prev_ver, 'detail_info'=>$detail_info,'album'=>$album_id,'size'=>$size)),
$strings['generic_photo'],
"onmouseover=\"$on_mouse_over\" onmouseout=\"UnTip();\" ");
}