977 lines
37 KiB
PHP
977 lines
37 KiB
PHP
<?php
|
|
|
|
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
|
|
// Copyright (C) 2005-2013 Solomon Peachy (pizza@shaftnet.org)
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation; either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program; if not, write to the Free Software
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
include_once "include/config.php";
|
|
include_once "include/common.php";
|
|
include_once "include/site.php";
|
|
include_once "include/iptc.php";
|
|
include_once "include/orderby.php";
|
|
|
|
function display_itemized_keyword_list($keywords) {
|
|
global $thm_elem;
|
|
global $strings;
|
|
|
|
print "<form method=\"post\" action=\"photo.move.php\" accept-charset=\"".$strings['formats_encoding']."\">\n";
|
|
foreach ($keywords as $keyword) {
|
|
print emit_checkbox_item("keywords[]", $keyword, "", false) . " $keyword ";
|
|
}
|
|
print $thm_elem['button.search'];
|
|
print "</form>\n";
|
|
}
|
|
|
|
$database = site_prolog();
|
|
|
|
$size = isset($_REQUEST['size']) ? pg_escape_string($database, $_REQUEST['size']) : 2;
|
|
|
|
$photo_id = pg_escape_string($database, $_REQUEST['photo']);
|
|
$version = isset($_REQUEST['ver']) ? pg_escape_string($database, $_REQUEST['ver']) : FALSE;
|
|
$album_id = isset($_REQUEST['album']) ? pg_escape_string($database, $_REQUEST['album']) : FALSE;
|
|
|
|
$detail_info = isset($_REQUEST['detail_info']) ? $_REQUEST['detail_info'] : FALSE;
|
|
$order_by = $po_options['order_by'];
|
|
|
|
$album_data="";
|
|
|
|
$photo_data = FALSE;
|
|
if ($photo_id && !is_numeric($photo_id)) {
|
|
$photo_id = FALSE;
|
|
$version = FALSE;
|
|
}
|
|
if ($version && !is_numeric($version)) {
|
|
$photo_id = FALSE;
|
|
$version = FALSE;
|
|
}
|
|
if ($detail_info && !is_numeric($detail_info)) {
|
|
$detail_info = FALSE;
|
|
}
|
|
if ($album_id && !is_numeric($album_id)) {
|
|
$album_id = FALSE;
|
|
}
|
|
|
|
if ($photo_id || $version) {
|
|
/* select photo data */
|
|
$photo_sel = $photo_id ? "and photo.identifier = '$photo_id'" : "";
|
|
$version_selector = $version ? "photo_version.identifier=$version" : "photo_version.master='t'";
|
|
$photo_data = pg_fetch_assoc(pg_query($database, "
|
|
select photo.identifier, users, folder, location, caption, date_of_exposure, get_image_path(photo_version.identifier, 0) as original_path,
|
|
photo.access_rights, copyright_statement, views,
|
|
(select avg(rating.value) from rating where rating.photo=photo.identifier) as rating,
|
|
hide_original, author, title,
|
|
caption_writer, category, credit, source,
|
|
headline, instructions, transmission_reference,
|
|
supplemental_category, web_statement, colorspace, orientation, date_added,
|
|
photo_version.identifier as version, photo.date_changed, store_url, photo.comments,
|
|
can_access_photo(photo.identifier, $po_user[id], '{".$passwords."}') as ok,
|
|
photo_version.original_image_name
|
|
from photo left join photo_version on photo.identifier = photo_version.photo
|
|
where $version_selector
|
|
$photo_sel"));
|
|
}
|
|
|
|
if (!$photo_data) {
|
|
header("HTTP/1.1 404 Not found");
|
|
site_header($strings['generic_photo']);
|
|
site_navigator(1);
|
|
site_navigator_status(disp_user_string($database, 0). " : ". $strings['errors_no_such_photo'], "");
|
|
site_footer($database);
|
|
site_epilog($database);
|
|
exit();
|
|
}
|
|
|
|
$photo_id = $photo_data['identifier'];
|
|
$version = $photo_data['version'];
|
|
$owner_id = $photo_data['users'];
|
|
|
|
if ($photo_data['ok'] != 't') {
|
|
if ($photo_data['access_rights'] == $access['private']) {
|
|
header("HTTP/1.1 403 Forbidden");
|
|
site_header($strings['generic_display_folder']);
|
|
site_navigator(1);
|
|
site_navigator_status(disp_user_string($database, 0). " : ". $strings['errors_private'], "");
|
|
site_footer($database);
|
|
site_epilog($database);
|
|
exit();
|
|
} else {
|
|
site_push_error($strings['errors_protected']);
|
|
header("Location: $site_url/login.php?reason=protected&orig=".urlencode(generate_link('photo', $photo_id, array('ver'=>$version, 'detail_info'=>$detail_info,'album'=>$album_id), TRUE)));
|
|
}
|
|
}
|
|
|
|
$sql_folder_access_rights = "and can_access_folder(folder.identifier, $po_user[id], '{".$passwords."}')";
|
|
$sql_album_access_rights = "and can_access_album(album.identifier, $po_user[id], '{".$passwords."}')";
|
|
|
|
$sql_order_by_string = $order_by_string[$order_by][0];
|
|
|
|
if ($album_id) {
|
|
$photos_in_container = pg_query($database, "
|
|
select album_content.photo, album_content.version
|
|
from album_content, photo, photo_version
|
|
where album_content.album = $album_id
|
|
and photo.identifier = album_content.photo
|
|
and photo_version.identifier = album_content.version
|
|
and can_access_photo(album_content.photo, $po_user[id], '{".$passwords."}')
|
|
order by $sql_order_by_string");
|
|
} else {
|
|
$photos_in_container = pg_query($database, "
|
|
select photo.identifier, photo_version.identifier as version
|
|
from photo, photo_version
|
|
where photo.folder = $photo_data[folder]
|
|
and can_access_photo(photo.identifier, $po_user[id], '{".$passwords."}')
|
|
and photo.identifier = photo_version.photo
|
|
and photo_version.master = 't'
|
|
order by $sql_order_by_string");
|
|
}
|
|
|
|
$next_idx = FALSE;
|
|
$prev_idx = FALSE;
|
|
|
|
for ($i=0; $i < pg_num_rows($photos_in_container); $i++) {
|
|
$tmp = pg_fetch_row($photos_in_container, $i);
|
|
if (($album_id === FALSE && $tmp[0] == $photo_id) ||
|
|
($album_id && $tmp[1] == $version)) {
|
|
if ($i+1 < pg_num_rows($photos_in_container)) {
|
|
$next_idx = $i+1;
|
|
$tmp = pg_fetch_row($photos_in_container, $next_idx);
|
|
$next = $tmp[0];
|
|
$next_ver = $tmp[1];
|
|
}
|
|
if ($i-1 >= 0) {
|
|
$prev_idx = $i-1;
|
|
$tmp = pg_fetch_row($photos_in_container, $prev_idx);
|
|
$prev = $tmp[0];
|
|
$prev_ver = $tmp[1];
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
/* Get any keywords for the photo... */
|
|
if (!$detail_info)
|
|
$detail_info = 1;
|
|
|
|
switch ($detail_info) {
|
|
case 1:
|
|
case 2:
|
|
case 5:
|
|
case 6:
|
|
/* Do nothing */
|
|
break;
|
|
case 3:
|
|
case 98:
|
|
case 99:
|
|
if (!(($po_user['id'] == $owner_id) || ($po_user['type'] == PO_USER_TYPE_ADMIN)))
|
|
$detail_info = 1;
|
|
break;
|
|
default:
|
|
$detail_info = 1;
|
|
}
|
|
|
|
if ($photo_data['title'] != "")
|
|
$hdr_txt = "$photo_data[title] (# $photo_id:$version)";
|
|
elseif ($photo_data['caption'] != "")
|
|
$hdr_txt = "$photo_data[caption] (# $photo_id:$version)";
|
|
else
|
|
$hdr_txt = "$photo_data[original_image_name] (# $photo_id:$version) (".$strings['photo_no_title'].")";
|
|
|
|
site_header($hdr_txt);
|
|
|
|
$user_display_string = disp_user_string($database, $owner_id);
|
|
|
|
if ($po_user['id'] == $owner_id) {
|
|
site_navigator(5);
|
|
} else {
|
|
site_navigator(1);
|
|
}
|
|
|
|
$zanza = strip_tags(get_photo_title($photo_data['caption'], $photo_data['title'], $photo_data['original_image_name']), '<b><i><u>');
|
|
$folder_data = pg_fetch_assoc(pg_query($database, "
|
|
select folder.identifier, folder.caption, folder.description
|
|
from folder
|
|
where folder.identifier=$photo_data[folder]
|
|
$sql_folder_access_rights"));
|
|
|
|
$additional_info="";
|
|
$path_info = "";
|
|
|
|
if ($album_id) {
|
|
$album_data = pg_fetch_assoc(pg_query($database, "
|
|
select album.identifier, album.caption, album.description
|
|
from album, album_content
|
|
where album.identifier=$album_id
|
|
and album_content.album = $album_id
|
|
and album_content.photo = $photo_id
|
|
$sql_album_access_rights"));
|
|
if ($album_data['identifier']) {
|
|
$path_to_album = get_path_to_album($database, $album_id);
|
|
$path_info = $path_to_album . " : ". $zanza;
|
|
} else {
|
|
$path_info = " : ".$strings['photo_hidden_path'] ." : " . $zanza;
|
|
}
|
|
if ($folder_data['identifier'])
|
|
$additional_info=$strings['photo_from_folder'] ." : ".emit_a(generate_link('folder', $folder_data['identifier']), $folder_data['caption'] ." ");
|
|
} else {
|
|
if ($folder_data['identifier']) {
|
|
$path_to_folder = get_path_to_folder($database, $folder_data['identifier']);
|
|
$path_info = $path_to_folder . " : " . $zanza;
|
|
} else {
|
|
$path_info = " : ".$strings['photo_hidden_path'] ." : " . $zanza;
|
|
}
|
|
}
|
|
|
|
site_navigator_status("$user_display_string $path_info", $additional_info);
|
|
|
|
print "<div class=\"photo_preview\">";
|
|
|
|
print "<table width=\"100%\" class=\"photo_preview\" align=\"center\">\n<tr>\n";
|
|
|
|
print "<td align=\"center\" valign=\"middle\" height=\"25\" width=\"29\">\n";
|
|
if ($prev_idx !== FALSE) {
|
|
print "<div class=\"hide_tooltip\" id=\"prev_tip\">";
|
|
print "<img src=\"".generate_link('image', $prev, array('ver'=>$prev_ver, 'size'=>1))."\" alt=\"$prev:$prev_ver\" />";
|
|
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,'size'=>$size)),
|
|
$strings['generic_photo'],
|
|
"onmouseover=\"$on_mouse_over\" onmouseout=\"UnTip();\" ");
|
|
}
|
|
print "</td>\n";
|
|
print "<td align=\"center\" valign=\"middle\">\n";
|
|
|
|
theme_display_photo(generate_link('image', $photo_id, array('ver'=>$version, 'size'=>$size)), "");
|
|
|
|
print "</td>";
|
|
print "<td align=\"center\" valign=\"middle\" height=\"25\" width=\"29\">\n";
|
|
if ($next_idx !== FALSE) {
|
|
print "<div class=\"hide_tooltip\" id=\"next_tip\">";
|
|
print "<img src=\"".generate_link('image', $next, array('ver'=>$next_ver, 'size'=>1))."\" alt=\"$next:$next_ver\" />";
|
|
print "</div>\n";
|
|
$on_mouse_over ="TagToTip('next_tip', OFFSETX, 12, ABOVE, true, LEFT, true);";
|
|
|
|
print sprintf($thm_elem['button.next'],
|
|
generate_link('photo', $next, array('ver'=>$next_ver, 'detail_info'=>$detail_info,'album'=>$album_id, 'size'=>$size)),
|
|
$strings['generic_photo'],
|
|
"onmouseover=\"$on_mouse_over\" onmouseout=\"UnTip();\" ");
|
|
}
|
|
print "</td>\n";
|
|
print "</tr>\n</table>";
|
|
print "</div>";
|
|
|
|
if (($po_user['id'] == $owner_id) || ($po_user['type'] == PO_USER_TYPE_ADMIN))
|
|
print emit_files_list($database, $photo_id, $version);
|
|
|
|
/* Generate the photo menu */
|
|
|
|
print "<div class=\"navigatorf\">";
|
|
print "<ul>";
|
|
|
|
$photo_args = array('ver' => $version,
|
|
'detail_info' => 1);
|
|
if ($album_id)
|
|
$photo_args['album'] = $album_id;
|
|
|
|
if ($detail_info == 1) {
|
|
$here = "class=\"menu_here\" ";
|
|
} else {
|
|
$here = "";
|
|
}
|
|
|
|
print "<li $here>".emit_a(generate_link('photo', $photo_id, $photo_args), $strings['photo_details'], $here)."</li>\n";
|
|
|
|
if ($detail_info == 2 || $detail_info == 98 || $detail_info == 99) {
|
|
$here = "class=\"menu_here\" ";
|
|
} else {
|
|
$here = "";
|
|
}
|
|
|
|
$photo_args['detail_info'] = 2;
|
|
print "<li $here>".emit_a(generate_link('photo', $photo_id, $photo_args), $strings['photo_technical'], $here)."</li>\n";
|
|
|
|
if ($detail_info == 5) {
|
|
$here = "class=\"menu_here\" ";
|
|
} else {
|
|
$here = "";
|
|
}
|
|
|
|
$photo_args['detail_info'] = 5;
|
|
print "<li $here>".emit_a(generate_link('photo', $photo_id, $photo_args), $strings['photo_versions'], $here)."</li>\n";
|
|
|
|
if ($detail_info == 6) {
|
|
$here = "class=\"menu_here\" ";
|
|
} else {
|
|
$here = "";
|
|
}
|
|
|
|
$photo_args['detail_info'] = 6;
|
|
print "<li $here>".emit_a(generate_link('photo', $photo_id, $photo_args), $strings['photo_ratings'], $here)."</li>\n";
|
|
|
|
print "</ul>";
|
|
print "</div>";
|
|
|
|
/* Now for the form elements */
|
|
|
|
print "<div>";
|
|
|
|
switch ($detail_info) {
|
|
default:
|
|
case 1:
|
|
print "<table class=\"listing\" cellspacing=\"1\" cellpadding=\"4\">\n";
|
|
print "<tr>".emit_td($strings['photo_identifier']);
|
|
print "<td>$photo_id</td></tr>\n";
|
|
if ($photo_data['title'] != "") {
|
|
print "<tr>".emit_td($strings['generic_title']);
|
|
print "<td>$photo_data[title]</td></tr>\n";
|
|
}
|
|
if ($photo_data['author'] != "") {
|
|
print "<tr>".emit_td($strings['generic_author']);
|
|
print "<td>$photo_data[author]</td></tr>\n";
|
|
}
|
|
$keywords = get_photo_keywords($database, $photo_id);
|
|
if (count($keywords)) {
|
|
print "<tr>".emit_td($strings['generic_keywords']);
|
|
print "<td>";
|
|
display_itemized_keyword_list($keywords);
|
|
print "</td></tr>\n";
|
|
}
|
|
|
|
if ($photo_data['headline'] != "") {
|
|
print "<tr>".emit_td($strings['generic_headline']);
|
|
print "<td>$photo_data[headline]</td></tr>\n";
|
|
}
|
|
if ($photo_data['credit'] != "") {
|
|
print "<tr>".emit_td($strings['generic_credit']);
|
|
print "<td>$photo_data[credit]</td></tr>\n";
|
|
}
|
|
|
|
if ($photo_data['caption_writer'] != "") {
|
|
print "<tr>".emit_td($strings['generic_caption_writer']);
|
|
print "<td>$photo_data[caption_writer]</td></tr>\n";
|
|
}
|
|
if ($photo_data['caption'] != "") {
|
|
print "<tr>".emit_td($strings['generic_caption']);
|
|
print "<td>$photo_data[caption]</td></tr>\n";
|
|
}
|
|
if ($photo_data['comments'] != "") {
|
|
print "<tr>".emit_td($strings['generic_remark']);
|
|
print "<td>$photo_data[comments]</td></tr>\n";
|
|
}
|
|
if ($album_id && ($album_data['description'] != "")) {
|
|
print "<tr>".emit_td($strings['photo_album_descr']);
|
|
print "<td>$album_data[description]</td></tr>\n";
|
|
}
|
|
if ($folder_data['description'] != "") {
|
|
print "<tr>".emit_td($strings['photo_folder_descr']);
|
|
print "<td>$folder_data[description]</td></tr>\n";
|
|
}
|
|
if ($photo_data['category'] != "") {
|
|
print "<tr>".emit_td($strings['generic_category']);
|
|
print "<td>$photo_data[category]</td></tr>\n";
|
|
}
|
|
if ($photo_data['supplemental_category'] != "") {
|
|
print "<tr>".emit_td($strings['generic_supplemental_category']);
|
|
print "<td>$photo_data[supplemental_category]</td></tr>\n";
|
|
}
|
|
if ($photo_data['source'] != "") {
|
|
print "<tr>".emit_td($strings['generic_source']);
|
|
print "<td>$photo_data[source]</td></tr>\n";
|
|
}
|
|
if ($photo_data['instructions'] != "") {
|
|
print "<tr>".emit_td($strings['generic_instructions']);
|
|
print "<td>$photo_data[instructions]</td></tr>\n";
|
|
}
|
|
if ($photo_data['transmission_reference'] != "") {
|
|
print "<tr>".emit_td($strings['generic_transmission_reference']);
|
|
print "<td>$photo_data[transmission_reference]</td></tr>\n";
|
|
}
|
|
|
|
if ($photo_data['location']) {
|
|
$location = get_generic_assoc_query($database, "select place, city, state, country, latitude, longitude from view_location where identifier=$photo_data[location]", "location.$photo_data[location]");
|
|
$foo = array();
|
|
if ($location['place'] != "")
|
|
$foo[] = $location['place'];
|
|
if ($location['city'] != "")
|
|
$foo[] = $location['city'];
|
|
if ($location['state'] != "")
|
|
$foo[] = $location['state'];
|
|
if ($location['country'] != "")
|
|
$foo[] = $location['country'];
|
|
|
|
print "<tr>".emit_td($strings['generic_location']);
|
|
|
|
if ($location['place'] == 'Unknown') {
|
|
$foo = $strings['generic_unknown'];
|
|
} else {
|
|
$foo = implode(", ", $foo);
|
|
if ($location['latitude'] || $location['longitude']) {
|
|
$foo = emit_a("http://maps.google.com/maps?q=$location[latitude]+$location[longitude]($foo)&t=h", $foo, "target=\"_new\"");
|
|
} else {
|
|
$foo = emit_a("http://maps.google.com/maps?q=$foo&t=h", $foo, "target=\"_new\"");
|
|
}
|
|
}
|
|
print emit_td($foo);
|
|
print "</tr>\n";
|
|
}
|
|
|
|
/* Knock off the seconds for each */
|
|
if ($photo_data['date_of_exposure'])
|
|
$photo_data['date_of_exposure'] = substr($photo_data['date_of_exposure'], 0, 16) . ":00";
|
|
|
|
if ($photo_data['date_of_exposure'])
|
|
$photo_data['date_added'] = substr($photo_data['date_added'], 0, 16) . ":00";
|
|
|
|
if ($photo_data['date_changed'])
|
|
$photo_data['date_changed'] = substr($photo_data['date_changed'], 0, 16) . ":00";
|
|
|
|
if ($photo_data['date_of_exposure'] != "") {
|
|
print "<tr>".emit_td($strings['generic_exposed']);
|
|
print "<td>";
|
|
if (substr($photo_data['date_of_exposure'], 11, 8) != "00:00:00") {
|
|
print emit_date_html($photo_data['date_of_exposure'], "full");
|
|
} else {
|
|
print emit_date_html($photo_data['date_of_exposure'], "date");
|
|
}
|
|
print "</td></tr>\n";
|
|
}
|
|
if (($photo_data['date_added'] != "") && ($photo_data['date_added'] != $photo_data['date_of_exposure'])) {
|
|
print "<tr>".emit_td($strings['generic_imported']);
|
|
print "<td>";
|
|
if (substr($photo_data['date_added'], 11, 8) != "00:00:00") {
|
|
print emit_date_html($photo_data['date_added'], "full");
|
|
} else {
|
|
print emit_date_html($photo_data['date_added'], "date");
|
|
}
|
|
print "</td></tr>\n";
|
|
}
|
|
if (($photo_data['date_changed'] != "") &&
|
|
($photo_data['date_changed'] != $photo_data['date_of_exposure']) &&
|
|
($photo_data['date_changed'] != $photo_data['date_added'])) {
|
|
print "<tr>".emit_td($strings['generic_changed']);
|
|
print "<td>";
|
|
if (substr($photo_data['date_changed'], 11, 8) != "00:00:00") {
|
|
print emit_date_html($photo_data['date_changed'], "full");
|
|
} else {
|
|
print emit_date_html($photo_data['date_changed'], "date");
|
|
}
|
|
print "</td></tr>\n";
|
|
}
|
|
|
|
$result = pg_fetch_all(pg_query($database, "select album.identifier as identifier, album.caption as description, album_content.date_added from album, album_content where album_content.album = album.identifier and album_content.photo = $photo_id $sql_album_access_rights"));
|
|
if ($result) {
|
|
print "<tr>".emit_td($strings['photo_albums']);
|
|
print "<td>";
|
|
print "<ul>";
|
|
for ($i = 0 ; $i < sizeof($result); $i++) {
|
|
$row = $result[$i];
|
|
print "<li>". emit_a(generate_link('album', $row['identifier']), $row['description'])." [". emit_date_html($row['date_added'], "full")."]</li>";
|
|
}
|
|
print "</ul>";
|
|
print "</td></tr>\n";
|
|
}
|
|
|
|
if ($photo_data['access_rights'] != "") {
|
|
print "<tr>".emit_td($strings['generic_access']);
|
|
print "<td>" . $strings['generic_'.$access[$photo_data['access_rights']]];
|
|
if ($photo_data['hide_original'] == "f")
|
|
print ", ".$strings['generic_access_auth_users'];
|
|
else
|
|
print ", ".$strings['generic_access_owner_only'];
|
|
print "</td></tr>\n";
|
|
}
|
|
if ($photo_data['views'] != "") {
|
|
print "<tr>".emit_td($strings['generic_views']);
|
|
print "<td>$photo_data[views]</td></tr>\n";
|
|
}
|
|
if ($photo_data['store_url'] != "") {
|
|
print "<tr>".emit_td($strings['photo_purchase']);
|
|
print emit_td(emit_a($photo_data['store_url'], $photo_data['store_url']));
|
|
print "</tr>\n";
|
|
}
|
|
|
|
if ($photo_data['copyright_statement']) {
|
|
print "<tr>".emit_td($strings['generic_copyright']);
|
|
$photo_data['copyright_statement'] = preg_replace('/@/', '{at}', $photo_data['copyright_statement']);
|
|
print emit_td($photo_data['copyright_statement']);
|
|
print "</tr>\n";
|
|
}
|
|
if ($photo_data['web_statement']) {
|
|
if (strncmp($photo_data['web_statement'], "http", 4) == 0) {
|
|
$photo_data['web_statement'] = emit_a($photo_data['web_statement'], $photo_data['web_statement']);
|
|
}
|
|
print "<tr>".emit_td($strings['generic_web_statement']);
|
|
print emit_td($photo_data['web_statement']);
|
|
print "</tr>\n";
|
|
}
|
|
print "</table>\n";
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$photo_tech = get_generic_assoc_query($database, "
|
|
select camera, film, scan_resolution,
|
|
aperture, focal_length, shutter, camera_metering, camera_program,
|
|
flash_mode, exposure_comp, flash_comp, ev_difference, iso_override,
|
|
scan_bitdepth, scan_multiscan,
|
|
latitude, longitude, altitude, img_direction
|
|
from photo_tech
|
|
where photo=$photo_id", "photo_tech_$photo_id");
|
|
|
|
print "<table class=\"listing\">\n";
|
|
if ($photo_tech['camera']!="") {
|
|
$camera = get_generic_row_query($database, "select name, model, variation, serial_number from view_camera where identifier=$photo_tech[camera]");
|
|
print "<tr>".emit_td($strings['generic_camera']);
|
|
print "<td>$camera[0] $camera[1] $camera[2] ".($camera[3]?"[$camera[3]]":"")."</td></tr>\n";
|
|
}
|
|
if ($photo_tech['focal_length']!="") {
|
|
print "<tr>".emit_td($strings['generic_focal_length']);
|
|
print "<td>$photo_tech[focal_length] mm</td></tr>\n";
|
|
}
|
|
|
|
$equipment = get_generic_query_all($database, "select name, model, type_name, serial from view_equipment, photo_equipment where view_equipment.identifier = photo_equipment.equipment and photo = $photo_id", "photo_equipment.$photo_id");
|
|
if ($equipment) {
|
|
for ($i = 0 ; $i < sizeof($equipment); $i++) {
|
|
$row = $equipment[$i];
|
|
print "<tr>";
|
|
print emit_td($strings['generic_'.$row['type_name']]);
|
|
print emit_td("$row[name] $row[model]" . ($row['serial']?" [$row[serial]]" : ''));
|
|
print "</tr>";
|
|
}
|
|
}
|
|
|
|
if ($photo_tech['camera_metering']!="") {
|
|
$camera_metering = get_generic_row_query($database, "select value from camera_metering where identifier=$photo_tech[camera_metering]");
|
|
print "<tr>".emit_td($strings['generic_camera_metering']);
|
|
print "<td>$camera_metering[0]</td></tr>\n";
|
|
}
|
|
if ($photo_tech['camera_program']!="") {
|
|
$camera_program = get_generic_row_query($database, "select value from camera_program where identifier=$photo_tech[camera_program]");
|
|
print "<tr>".emit_td($strings['generic_camera_program']);
|
|
print "<td>$camera_program[0]</td></tr>\n";
|
|
}
|
|
if ($photo_tech['film']!="") {
|
|
$film = get_generic_row_query($database, "select name, model, iso, format from view_film where identifier=$photo_tech[film]");
|
|
print "<tr>".emit_td($strings['generic_film']);
|
|
print "<td>$film[0] $film[1]";
|
|
if ($film[2]!="") {
|
|
print " ISO $film[2]";
|
|
}
|
|
if ($film[3]!="") print ", $film[3]";
|
|
print "</td></tr>\n";
|
|
if ($photo_tech['iso_override']!="") {
|
|
print "<tr>";
|
|
print emit_td($strings['generic_iso_override']);
|
|
print emit_td($photo_tech['iso_override']);
|
|
print "</tr>";
|
|
}
|
|
} else if ($photo_tech['iso_override']!="") {
|
|
print "<tr>";
|
|
print emit_td($strings['generic_iso']);
|
|
print emit_td($photo_tech['iso_override']);
|
|
print "</tr>";
|
|
}
|
|
if ($photo_tech['aperture']!="") {
|
|
print "<tr>".emit_td($strings['generic_aperture']);
|
|
print "<td>$photo_tech[aperture]</td></tr>\n";
|
|
}
|
|
if ($photo_tech['shutter']!="") {
|
|
$shutter = get_generic_row_query($database, "select value from shutter where identifier=$photo_tech[shutter]");
|
|
print "<tr>".emit_td($strings['generic_shutter']);
|
|
print "<td>$shutter[0]s</td></tr>\n";
|
|
}
|
|
if ($photo_tech['exposure_comp']) {
|
|
$exposure_comp = get_generic_row_query($database, "select value from ev_comp where identifier=$photo_tech[exposure_comp]");
|
|
if ($exposure_comp[0]) {
|
|
print "<tr>".emit_td($strings['generic_exp_comp']);
|
|
print "<td>$exposure_comp[0]</td></tr>\n";
|
|
}
|
|
}
|
|
if ($photo_tech['ev_difference']) {
|
|
$ev_difference = get_generic_row_query($database, "select value from ev_comp where identifier=$photo_tech[ev_difference]");
|
|
|
|
if ($ev_difference[0]) {
|
|
print "<tr>".emit_td($strings['generic_exp_diff']);
|
|
print "<td>$ev_difference[0]</td></tr>\n";
|
|
}
|
|
}
|
|
if ($photo_tech['flash_mode']!="") {
|
|
$flash_mode = get_generic_row_query($database, "select value from flash_mode where identifier=$photo_tech[flash_mode]");
|
|
print "<tr>".emit_td($strings['generic_flash_mode']);
|
|
print "<td>$flash_mode[0]</td></tr>\n";
|
|
}
|
|
if ($photo_tech['flash_comp']) {
|
|
$flash_comp = get_generic_row_query($database, "select value from ev_comp where identifier=$photo_tech[flash_comp]");
|
|
|
|
if ($flash_comp[0]) {
|
|
print "<tr>".emit_td($strings['generic_flash_comp']);
|
|
print "<td>$flash_comp[0]</td></tr>\n";
|
|
}
|
|
}
|
|
|
|
if ($photo_tech['scan_resolution']!="") {
|
|
print "<tr>".emit_td($strings['generic_scan_parameters']);
|
|
print "<td>";
|
|
if ($photo_tech['scan_resolution']) print " $photo_tech[scan_resolution] ".$strings['generic_dpi'] ." \n";
|
|
if ($photo_tech['scan_bitdepth']) print " $photo_tech[scan_bitdepth] ". $strings['generic_bits'] ." ";
|
|
if ($photo_tech['scan_multiscan']) print " $photo_tech[scan_multiscan] " .$strings['generic_passes'];
|
|
print "</td></tr>\n";
|
|
}
|
|
|
|
/* colorspace data */
|
|
if ($photo_data['colorspace']!="") {
|
|
global $icc_profiles;
|
|
$photo_data['colorspace'] = $icc_profiles[$photo_data['colorspace']]['name'];
|
|
print "<tr>".emit_td($strings['generic_colorspace']);
|
|
print "<td>$photo_data[colorspace]</td></tr>\n";
|
|
}
|
|
|
|
/* orientation data */
|
|
if ($photo_data['orientation'] != "") {
|
|
$photo_data['orientation'] = orientation_to_name($database, $photo_data['orientation']);
|
|
print "<tr>".emit_td($strings['generic_rotation']);
|
|
print "<td>$photo_data[orientation]</td></tr>\n";
|
|
}
|
|
|
|
/* GPS Data */
|
|
if ($photo_tech['latitude'] || $photo_tech['longitude']) {
|
|
$latitude = latitude_dms($photo_tech['latitude'], "latitude");
|
|
$longitude = latitude_dms($photo_tech['longitude'], "longitude");
|
|
print "<tr>".emit_td($strings['photo_geolocation']);
|
|
$foo = $strings['photo_latitude'] . ": $latitude<br/>".$strings['photo_longitude'] .": $longitude<br/> ".$strings['photo_altitude'].": $photo_tech[altitude] m" . ($photo_tech['img_direction'] ? ($strings['photo_direction'] .": $photo_tech[img_direction]") : "");
|
|
print emit_td(emit_a("http://maps.google.com/maps?q=$photo_tech[latitude]+$photo_tech[longitude]&t=h" ,$foo, "target=\"_new\""));
|
|
print "</td></tr>\n";
|
|
}
|
|
|
|
if (($po_user['id'] == $owner_id) || ($po_user['type'] == PO_USER_TYPE_ADMIN)) {
|
|
if ($photo_tech) {
|
|
print "<tr>".emit_td(emit_a(generate_link('photo', $photo_id, array('ver'=>$version, 'detail_info'=>98,'album'=>$album_id)), $strings['photo_full_exif']));
|
|
print "<td> </td></tr>\n";
|
|
}
|
|
|
|
print "<tr>".emit_td(emit_a(generate_link('photo', $photo_id, array('ver'=>$version, 'detail_info'=>99,'album'=>$album_id)), $strings['photo_full_exif_dump']));
|
|
print "<td> </td></tr>\n";
|
|
}
|
|
|
|
print "</table>\n";
|
|
break;
|
|
case 98:
|
|
$photo_tech = get_generic_assoc_query($database, "
|
|
select exif, iptc, rdf
|
|
from photo_tech
|
|
where photo=$photo_id");
|
|
|
|
print "<table class=\"listing\">\n";
|
|
|
|
/* custom exif data */
|
|
if ($photo_tech['exif']!="") {
|
|
$trans = array("<key>" => "<tr><td><i>",
|
|
"</key><value>" => "</i></td><td>",
|
|
"</value>" => "</td></tr>\n");
|
|
print "<tr><td><strong>EXIF</strong></td><td></td></tr>";
|
|
print strtr($photo_tech['exif'], $trans);
|
|
}
|
|
/* iptc data */
|
|
if ($photo_tech['iptc']!="") {
|
|
$trans = array("<key>" => "<tr><td><i>",
|
|
"</key><value>" => "</i></td><td>",
|
|
"</value>" => "</td></tr>\n");
|
|
print "<tr><td><strong>IPTC</strong></td><td></td></tr>";
|
|
print strtr($photo_tech['iptc'], $trans);
|
|
}
|
|
/* xmp/rdf data */
|
|
if ($photo_tech['rdf']!="") {
|
|
$trans = array("<key>" => "<tr><td><i>",
|
|
"</key><value>" => "</i></td><td>",
|
|
"</value>" => "</td></tr>\n");
|
|
print "<tr><td><strong>XMP/RDF</strong></td><td></td></tr>";
|
|
print strtr($photo_tech['rdf'], $trans);
|
|
}
|
|
print "<tr>".emit_td(emit_a(generate_link('photo', $photo_id, array('ver'=>$version, 'detail_info'=>99,'album'=>$album_id)), $strings['photo_full_exif_dump']));
|
|
print "<td> </td></tr>\n";
|
|
print "</table>\n";
|
|
break;
|
|
case 99:
|
|
$image_path = $image_repository_path . "/" . $photo_data['original_path'];
|
|
|
|
print "<table class=\"listing\">\n";
|
|
|
|
if (is_executable($sys_exiftool)) {
|
|
$handle = popen("$sys_exiftool $image_path", "r");
|
|
if ($handle) {
|
|
while (!feof($handle)) {
|
|
$line = fgets($handle);
|
|
$parts = explode(":", $line, 2);
|
|
$parts[0] = trim($parts[0]);
|
|
if (!isset($parts[1])) continue;
|
|
$parts[1] = trim($parts[1]);
|
|
if ($parts[0] == "File Name") continue;
|
|
if ($parts[0] == "Directory") continue;
|
|
if (substr($parts[1], 2, 6) == "Binary") continue;
|
|
print "<tr><td><i>$parts[0]</i></td><td>$parts[1]</td></tr>\n";
|
|
}
|
|
pclose($handle);
|
|
}
|
|
} else {
|
|
include('include/exif.php');
|
|
|
|
$exif2 = read_exif_data_raw($image_path, 0);
|
|
|
|
foreach ($exif2 as $key => $section) {
|
|
if (is_array($section)) {
|
|
foreach ($section as $name => $val) {
|
|
if (!(strpos($name, 'unknown') === false)) continue;
|
|
if (!(strpos($name, 'RAWDATA') === false)) continue;
|
|
if (is_array($val)) {
|
|
foreach ($val as $name2 => $val2) {
|
|
if (!(strpos($name2, 'unknown') === false)) continue;
|
|
if (!(strpos($name2, 'RAWDATA') === false)) continue;
|
|
if (is_array($val2)) {
|
|
foreach ($val2 as $name3 => $val3) {
|
|
if (!(strpos($name3, 'unknown') === false)) continue;
|
|
if (!(strpos($name3, 'RAWDATA') === false)) continue;
|
|
print "<tr><td>$key.$name.$name2.$name3</td>";
|
|
print "<td>$val3</td></tr>\n";
|
|
}
|
|
} else {
|
|
print "<tr><td>$key.$name.$name2</td>";
|
|
print "<td>$val2</td></tr>\n";
|
|
}
|
|
}
|
|
} else {
|
|
print "<tr><td>$key.$name</td>";
|
|
print "<td>$val</td></tr>\n";
|
|
}
|
|
}
|
|
} else {
|
|
print "<tr><td>$key</td>";
|
|
print "<td>$section</td></tr>\n";
|
|
}
|
|
}
|
|
}
|
|
print "</table>\n";
|
|
|
|
|
|
break;
|
|
case 5:
|
|
$photo_versions = get_generic_query_all($database, "
|
|
select photo_version.identifier, key, date_of_creation, comment,
|
|
original_image_name,
|
|
date_changed, master, path, x_res, y_res, filesize
|
|
from photo_version, files
|
|
where photo=$photo_id
|
|
and files.version = photo_version.identifier
|
|
and files.size = 0
|
|
order by master desc, key asc", "versions.$photo_id");
|
|
|
|
print "<table class=\"folder\">\n";
|
|
print "<tr class=\"header\">\n";
|
|
print emit_th($strings['generic_version'], "width=\"5%\"");
|
|
print emit_th($strings['generic_created'], "width=\"10%\"");
|
|
print emit_th($strings['generic_changed'], "width=\"10%\"");
|
|
print emit_th($strings['generic_master'], "width=\"5%\"");
|
|
print emit_th($strings['generic_remark'], "width=\"40%\"");
|
|
print emit_th($strings['generic_orig_file'], "width=\"10%\"");
|
|
print emit_th($strings['photo_dimensions'], "width=\"6%\"");
|
|
print emit_th($strings['generic_size'], "width=\"5%\"");
|
|
|
|
if (($po_user['id'] == $owner_id) || ($po_user['type'] == PO_USER_TYPE_ADMIN)) {
|
|
print "<th width=\"10%\" colspan=\"2\"><a href=\"photo.version.php?action=add&photo=$photo_id&album=$album_id\">".$strings['photo_add_version']."</a></th>\n";
|
|
}
|
|
print "</tr>\n";
|
|
|
|
for ($i=0; $i < sizeof($photo_versions); $i++) {
|
|
$photo_version = $photo_versions[$i];
|
|
$row_cls = $photo_version['identifier'] == $version ? "class=\"emphasis\"" : "";
|
|
print "<tr $row_cls>\n";
|
|
print "<td>";
|
|
print "<div class=\"hide_tooltip\" id=\"ver_tip_$i\">";
|
|
print "<img src=\"".generate_link('image', $photo_id, array('ver'=>$photo_version['identifier'], 'size'=>1))."\" alt=\"$photo_id:$photo_version[identifier]\" />";
|
|
print "</div>\n";
|
|
$on_mouse_over ="TagToTip('ver_tip_$i', OFFSETX, 12);";
|
|
print emit_a(generate_link('photo', $photo_id, array('ver'=>$photo_version['identifier'],'detail_info'=>5,'album'=>$album_id)), "$photo_id-V$photo_version[key]", " onmouseover=\"$on_mouse_over\" onmouseout=\"UnTip();\"");
|
|
print "</td>";
|
|
print "<td>".emit_date_html($photo_version['date_of_creation'], 'date')."</td>";
|
|
print "<td>".emit_date_html($photo_version['date_changed'], 'date')."</td>";
|
|
print "<td>".emit_yes_no_text($photo_version['master'])."</td>";
|
|
print "<td>$photo_version[comment]</td>";
|
|
print "<td>$photo_version[original_image_name]</td>";
|
|
|
|
$image_size = $photo_version['filesize'] / 1024;
|
|
if ($image_size < 1024) {
|
|
$image_size = round($image_size);
|
|
$image_size_string = "$image_size KB";
|
|
} else {
|
|
$image_size /=1024;
|
|
$image_size = round($image_size);
|
|
$image_size_string = "$image_size MB";
|
|
}
|
|
|
|
print "<td>$photo_version[x_res]x$photo_version[y_res]</td>";
|
|
print "<td>$image_size_string</td>";
|
|
|
|
if (($po_user['id'] == $owner_id) || ($po_user['type'] == PO_USER_TYPE_ADMIN)) {
|
|
print "<td width=\"5%\">";
|
|
print "<a href=\"photo.version.php?action=edit&photo=$photo_id&version=$photo_version[identifier]&album=$album_id\">".$strings['generic_edit']."</a>";
|
|
print "</td>\n";
|
|
print "<td width=\"5%\">";
|
|
if ($photo_version['master'] != 't') {
|
|
print "<a href=\"photo.version.php?action=delete&photo=$photo_id&version=$photo_version[identifier]&album=$album_id\">".$strings['generic_delete']."</a>\n";
|
|
}
|
|
print "</td>\n";
|
|
}
|
|
print "</tr>\n";
|
|
}
|
|
print "</table>\n";
|
|
break;
|
|
case 6:
|
|
$average_rating = pg_fetch_row(pg_query($database, "select avg(value) from rating where photo=$photo_id"));
|
|
if ($average_rating[0] == "") {
|
|
$average_rating = "";
|
|
} else {
|
|
$average_rating = round($average_rating[0], 2);
|
|
}
|
|
print "<table class=\"folder\">\n";
|
|
print "<tr class=\"header\">\n";
|
|
print "<th width=\"10%\">".$strings['generic_rating'];
|
|
if ($average_rating != "")
|
|
print ": <b>$average_rating</b>";
|
|
print "</th>";
|
|
print emit_th($strings['generic_version'], "width=\"10%\"");
|
|
print emit_th($strings['generic_remark'], "width=\"40%\"");
|
|
print emit_th($strings['generic_user'], "width=\"15%\"");
|
|
print emit_th($strings['generic_created'], "width=\"15%\"");
|
|
print emit_th($po_user['id'] ? "<a href=\"photo.rating.php?action=add&photo=$photo_id&version=$version&album=$album_id\">".$strings['generic_rate']."</a>\n" : "", "width=\"10%\" colspan=\"2\"");
|
|
print "</tr>\n";
|
|
|
|
$all_ratings = pg_fetch_all(pg_query($database, "
|
|
select identifier, users, date_of_creation, value, first_name, last_name, comment, version
|
|
from view_rating
|
|
where photo=$photo_id
|
|
order by date_of_creation"));
|
|
if ($all_ratings) {
|
|
for ($i=0; $i < sizeof($all_ratings); $i++) {
|
|
$rating = $all_ratings[$i];
|
|
print "<tr>\n";
|
|
print emit_td($rating['value']);
|
|
print "<td>";
|
|
print "<div class=\"hide_tooltip\" id=\"rate_tip_$i\">";
|
|
print "<img src=\"".generate_link('image', $photo_id, array('ver'=>$rating['version'], 'size'=>1))."\" alt=\"$photo_id:$rating[version]\" />";
|
|
print "</div>\n";
|
|
$on_mouse_over ="TagToTip('rate_tip_$i', OFFSETX, 12);";
|
|
print emit_a(generate_link('photo', $photo_id, array('ver'=>$rating['version'],'detail_info'=>5,'album'=>$album_id)), "$photo_id-V$rating[version]", " onmouseover=\"$on_mouse_over\" onmouseout=\"UnTip();\"");
|
|
print "</td>";
|
|
print emit_td($rating['comment']);
|
|
if ($po_user['id'] == $rating['users']) {
|
|
print emit_td(emit_a(generate_link('user', $po_user['id']), $strings['photo_myself']));
|
|
} else {
|
|
print emit_td(emit_a(generate_link('user', $rating['users']),
|
|
"$rating[first_name] $rating[last_name]"));
|
|
}
|
|
print emit_td(emit_date_html($rating['date_of_creation'], 'date'));
|
|
if (($po_user['id'] == $rating['users']) ||
|
|
($po_user['type'] == PO_USER_TYPE_ADMIN)) {
|
|
print emit_td("<a href=\"photo.rating.php?action=edit&rating=$rating[identifier]&album=$album_id\">".$strings['generic_edit']."</a>");
|
|
print emit_td("<a href=\"photo.rating.php?action=delete&rating=$rating[identifier]&album=$album_id\">".$strings['generic_delete']."</a>");
|
|
} else {
|
|
print emit_td('');
|
|
print emit_td('');
|
|
}
|
|
print "</tr>\n";
|
|
}
|
|
}
|
|
print "</table>\n";
|
|
break;
|
|
}
|
|
|
|
/************************* Now for the page footer *************************/
|
|
|
|
|
|
print "<div class=\"actions\">";
|
|
print "<form method=\"post\" action=\"photo.move.php\" accept-charset=\"".$strings['formats_encoding']."\">\n";
|
|
print "<input type=\"hidden\" name=\"source_folder\" value=\"$photo_data[folder]\" />\n";
|
|
print "<input type=\"hidden\" name=\"photo_id\" value=\"$photo_id\" />\n";
|
|
print "<input type=\"hidden\" name=\"version\" value=\"$version\" />\n";
|
|
print "<input type=\"hidden\" name=\"owner_id\" value=\"$owner_id\" />\n";
|
|
if ($album_id) {
|
|
print "<input type=\"hidden\" name=\"source_album\" value=\"$album_id\" />\n";
|
|
print "<input type=\"hidden\" name=\"album\" value=\"$album_id\" />\n";
|
|
}
|
|
print "<input type=\"hidden\" name=\"detail_info\" value=\"$detail_info\" />";
|
|
|
|
display_order_by_combo_with_button($order_by);
|
|
|
|
if ($po_user['id'] == $owner_id || $po_user['type'] == PO_USER_TYPE_ADMIN) {
|
|
print emit_transform_actions();
|
|
}
|
|
|
|
print "<span>";
|
|
if ($po_user['id'] == $owner_id || $po_user['type'] == PO_USER_TYPE_ADMIN) {
|
|
print sprintf($thm_elem['button.edit'], "photo.edit.php?photo=$photo_id&album=$album_id");
|
|
|
|
if ($photo_data['folder'] != $po_user['trash_folder'])
|
|
print $thm_elem['button.delete_s'];
|
|
|
|
print $thm_elem['button.set.thumb.f'];
|
|
|
|
if ($album_id)
|
|
print $thm_elem['button.set.thumb.a'];
|
|
}
|
|
|
|
if ($po_user['type'] > PO_USER_TYPE_CLIENT) {
|
|
print $thm_elem['button.set.as.watermark'];
|
|
}
|
|
|
|
if ($po_user['type'] >= PO_USER_TYPE_CLIENT) {
|
|
print $thm_elem['button.add.to.spool'];
|
|
}
|
|
|
|
if ($po_user['type'] >= PO_USER_TYPE_CLIENT) {
|
|
print emit_printtoprinter();
|
|
}
|
|
|
|
print "</span>\n";
|
|
|
|
if ($po_user['id'] == $owner_id || $po_user['type'] == PO_USER_TYPE_ADMIN) {
|
|
$folder_all = get_users_folder($database);
|
|
print emit_folder_actions($folder_all, $photo_data['folder']);
|
|
}
|
|
|
|
if ($po_user['type'] >= PO_USER_TYPE_CLIENT) {
|
|
$album_all = get_users_album($database);
|
|
if (count($album_all)) {
|
|
print emit_album_actions($album_all, $album_id);
|
|
}
|
|
print "</form>\n";
|
|
|
|
// print emit_spool_actions($database, $po_user['id']);
|
|
// print emit_import_actions($database, $po_user['id']);
|
|
// print emit_print_actions($database, $po_user['id']);
|
|
}
|
|
|
|
print "</div>";
|
|
|
|
|
|
print "</div>";
|
|
|
|
if (($po_user['id'] != $owner_id) && ($photo_data['access_rights'] == $access['public']) && $misc_script) {
|
|
print $misc_script;
|
|
}
|
|
|
|
site_footer($database);
|
|
site_epilog($database);
|
|
?>
|