This commit is contained in:
Solomon Peachy 2008-08-17 10:57:06 -04:00
parent e961c5cf4e
commit 25be5d6e9e
225 changed files with 5724 additions and 7944 deletions

85
CHANGES
View File

@ -25,7 +25,90 @@ For further information about Photo Organizer, see its web site at:
==========================================================================
2.32a (October 19, 2006)
2.33 (December 10, 2006)
[fix] SQL error when viewing user page anonymously.
[fix] SQL error on the image display page that prevented stats updates.
2.33-rc4 (December 4, 2006)
[security] Don't display the existing user password on the "update
password" form.
[fix] Error when creating a top-level folder or album when you aren't
an admin.
[fix] Error when moving photos into a different folder when you're not
an admin.
[fix] Increment 'views' counter on the image.display page, not
the photo info page. Only count the full and preview images.
[fix] Allow colorspace to be modified on a per-image-version basis.
[fix] HTML error on the photo listing display.
[fix] Cancel buttons on folder & album edit pages weren't
returning to the correct place.
[fix] Photo edit page wasn't setting keywords properly.
[fix] Random photo function not working due to SQL error.
[misc] Never use compressed output on the bulk upload or photo add
pages, as it can take a long time before you see output.
2.33-rc3 (November 27, 2006)
[fix] Fix the "invalid login" when we haven't tried to log in.
[fix] Don't display the memory limit warning if PHP wasn't built with
memory limits enabled.
[fix] Installer was checking the $install_enabled setting before we
read the configuration files.
2.33-rc2 (November 26, 2006)
[fix] Filter view was broken.
[fix] User was unable to log out.
[fix] Bulk update should not default to "All Folders."
[misc] HTML Validation improvements
[misc] Add a robots.txt that excludes image.display.php
2.33-rc1 (November 26, 2006)
[security] User permissions/ownerships weren't checked on many operations.
[security] PO vulnerable to SQL injection attacks.
[add] Display thumbnail of next/previous photo.
[add] XML file now can include hour:min:sec in the timestamps.
[add] Allow for private locations now. If a location is not marked
private, all users can use it, but only the owner can modify it.
[add] Allow freeform database connection strings. This allows things like
SSL and local UNIX sockets.
[add] ExifTool can extract preview images from some RAW types. This
can be used in lieu of dcraw when working with RAW images.
[add] Allow admin users to search across all users' photos.
[add] Move keyword data into its own table. Bulk update now takes
lists of keywords to add and clear, instead of a wholesale set.
[add] Store full IPTC/EXIF dumps in database using a generic format.
[add] Internal Exifer code is now deprecated. Please use ExifTool.
[add] Additional focal lengths (65,95,100,115,125,130,140,145)
[fix] Display proper image dimensions on the photo version pages.
[fix] Bulk update failing when updating copyright statements.
[fix] Default index page should call site_prolog()
[fix] Bug preventing account creation.
[fix] ExifTool EXIF import code wasn't properly handling colorspaces
and embedded ICC profiles.
[fix] Include a proper Content-Length header when downloading an image.
[fix] Exports now deal with large files sanely.
[fix] Eliminated an accidental (partial) backport of the new spool code.
[misc] Consolidated many of the profile pages to use common code.
[misc] Added a "report a bug" link.
[misc] Complain loudly if administrator has not changed default admin
account or password.
[misc] Centralized the session lookup/userid fetch code.
[misc] Return a proper 404 code when the requested album/folder does
not exist.
[misc] Return proper error codes (eg 404 Not Found or 403 Forbidden)
when fail to download, export, or print an image.
[misc] Cleaned up a lot of the generated HTML.
[misc] Turn off the 'display_errors' option if it's enabled.
[misc] Explicitly set a default logging level (All but NOTICEs)
2.32b (October 19, 2006)
- Installer wasn't creating the repository directory properly
2.32a (October 12, 2006)

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,25 +21,13 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/admin.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
include_once "include/import.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "
select identifier, type
from users
where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
@ -66,7 +54,7 @@ error_reporting(0);
$version = pg_fetch_assoc(pg_query($database, "select major,minor,variation from version"));
site_header($page_width, "Administrator Interface");
site_navigator(9, $my_user_id[1], $user_type);
site_navigator(9);
site_navigator_status("Administrator Interface", "PHP v" . version() . " DB v$version[major].$version[minor].$version[variation]");
@ -82,7 +70,7 @@ switch ($selector) {
display_new_user_properties($database, $system_preferences);
break;
case $admin_data['users_n_clients']['idx']:
display_users_and_clients($database, $my_user_id[0]);
display_users_and_clients($database, $po_user['id']);
break;
case $admin_data['front_page']['idx']:
display_front_page_editor("index.php");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,34 +23,28 @@ include_once "include/admin.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
$user_type = $_REQUEST['new_user_type'];
$bulk_upload_enable = $_REQUEST['new_user_bulk_upload_enable'];
$shop_enable = $_REQUEST['new_user_shop_enable'];
$shared = $_REQUEST['new_user_shared'];
$quota_size = $_REQUEST['new_user_quota_size'];
$quota_count = $_REQUEST['new_user_quota_count'];
$paper = $_REQUEST['new_user_paper'];
$label = $_REQUEST['new_user_label'];
$new_user_type = pg_escape_string($_REQUEST['new_user_type']);
$bulk_upload_enable = pg_escape_string($_REQUEST['new_user_bulk_upload_enable']);
$shop_enable = pg_escape_string($_REQUEST['new_user_shop_enable']);
$shared = pg_escape_string($_REQUEST['new_user_shared']);
$quota_size = pg_escape_string($_REQUEST['new_user_quota_size']);
$quota_count = pg_escape_string($_REQUEST['new_user_quota_count']);
$paper = pg_escape_string($_REQUEST['new_user_paper']);
$label = pg_escape_string($_REQUEST['new_user_label']);
$quota_size = $quota_size * 1048576;
pg_query($database, "
update system_preferences
set new_user_type='$user_type',
set new_user_type='$new_user_type',
new_user_bulk_upload_enable='$bulk_upload_enable',
new_user_shop_enable='$shop_enable',
new_user_shared='$shared',

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,19 +22,11 @@ include_once "include/config.php";
include_once "include/admin.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
@ -62,7 +54,7 @@ $all_labels = pg_query($database, "
error_reporting(0);
site_header($page_width, "Administrator Interface : Edit System Preferences");
site_navigator(9, $my_user_id[1], $user_type);
site_navigator(9);
site_navigator_status("<a href=\"admin.php\">Adminstrator Interface</a> : Edit System Preferences ", "");
print "&nbsp;<br/>";
@ -99,10 +91,10 @@ print "<td align=\"center\" bgcolor=\"$color[table_body]\" >\n";
display_yes_no_combo("new_user_shared", $system_preferences[7]);
print "</td>\n";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" >\n";
print "<input align=\"right\" type=\"text\" name=\"new_user_quota_size\" value=\"$system_preferences[5]\" size=\"7\"> Mb";
print "<input align=\"right\" type=\"text\" name=\"new_user_quota_size\" value=\"$system_preferences[5]\" size=\"7\"/> Mb";
print "</td>\n";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" >\n";
print "<input align=\"right\" type=\"text\" name=\"new_user_quota_count\" value=\"$system_preferences[6]\" size=\"7\">";
print "<input align=\"right\" type=\"text\" name=\"new_user_quota_count\" value=\"$system_preferences[6]\" size=\"7\"/>";
print "</td>\n";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" >";
display_combo("new_user_paper", $all_papers, $system_preferences[2], ", ", 1);
@ -114,8 +106,8 @@ print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">";
print "<a class=\"nodecor\" href=\"admin.php?selector=".$admin_data['new_user']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>";
print "<a class=\"nodecor\" href=\"admin.php?selector=".$admin_data['new_user']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</center>\n";
print "</form>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,25 +22,17 @@ include_once "include/config.php";
include_once "$theme/theme.php";
include_once "include/site.php";
include_once "include/admin.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
$user_id = $_REQUEST['user'];
$user_id = pg_escape_string($_REQUEST['user']);
$photos_to_be_removed = pg_query($database, "
select small_image_path, medium_image_path, large_image_path
@ -215,7 +207,7 @@ if (!$result) {
exit();
}
$result = pg_query($database, "update location set last_modifying_users='$my_user_id[0]' where last_modifying_users='$user_id'");
$result = pg_query($database, "update location set users='$po_user[id]' where users='$user_id'");
if (!$result) {
pg_query($database, "rollback");
site_epilog($database);
@ -319,7 +311,7 @@ if (!$result) {
exit();
}
$result = pg_query($database, "update shop_item set users='$my_user_id[0]' where users='$user_id'");
$result = pg_query($database, "update shop_item set users='$po_user[id]' where users='$user_id'");
if (!$result) {
pg_query($database, "rollback");
site_epilog($database);
@ -327,7 +319,7 @@ if (!$result) {
exit();
}
$result = pg_query($database, "update shop_category set users='$my_user_id[0]' where users='$user_id'");
$result = pg_query($database, "update shop_category set users='$po_user[id]' where users='$user_id'");
if (!$result) {
pg_query($database, "rollback");
site_epilog($database);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,26 +22,18 @@ include_once "include/config.php";
include_once "include/admin.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
site_header($page_width, "Adminstrator Interface : Delete User");
site_navigator(9, $my_user_id[1]);
site_navigator(9);
site_navigator_status("<a href=\"admin.php\">Adminstrator Interface</a> : Delete User", "");
print "&nbsp;<br/>";
@ -75,16 +67,16 @@ print "<td align=\"center\" bgcolor=\"$color[table_body]\" width=\"8%\">$folder
print "<td align=\"center\" bgcolor=\"$color[table_body]\" width=\"8%\">$albums_by_user[0]</td>";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" width=\"8%\">"; display_enable_disable_text($user_preferences[0]); print"</td>";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" width=\"8%\">"; display_enable_disable_text($user_preferences[1]); print"</td>";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" width=\"20%\">".generate_date_html($user_data[3], 'date', $my_user[0] == "" ? 0 : 1). "</td>";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" width=\"20%\">".generate_date_html($user_data[3], 'date', 1). "</td>";
print "</tr>";
print "</table>\n";
print "&nbsp;<br/>";
print "<form method=\"post\" action=\"admin.user.del.2.php\">";
print "<input type=\"hidden\" name=\"user\" value=\"$user_id\"><p>";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\">";
print "<a class=\"nodecor\" href=\"admin.php?selector=".$admin_data['users_n_clients']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"hidden\" name=\"user\" value=\"$user_id\"/><p>";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\"/>";
print "<a class=\"nodecor\" href=\"admin.php?selector=".$admin_data['users_n_clients']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</form>";
display_navigator_box_bottom("100%");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,31 +23,23 @@ include_once "$theme/theme.php";
include_once "include/mail.php";
include_once "include/site.php";
include_once "include/admin.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
$user_id = $_REQUEST['user'];
$type = $_REQUEST['type'];
$bulk_upload_enable = $_REQUEST['bulk_upload_enable'];
$shop_enable = $_REQUEST['shop_enable'];
$shared = $_REQUEST['shared'];
$quota_size = $_REQUEST['quota_size'];
$quota_count = $_REQUEST['quota_count'];
$user_id = pg_escape_string($_REQUEST['user']);
$type = pg_escape_string($_REQUEST['type']);
$bulk_upload_enable = pg_escape_string($_REQUEST['bulk_upload_enable']);
$shop_enable = pg_escape_string($_REQUEST['shop_enable']);
$shared = pg_escape_string($_REQUEST['shared']);
$quota_size = pg_escape_string($_REQUEST['quota_size']);
$quota_count = pg_escape_string($_REQUEST['quota_count']);
$quota_size = $quota_size * 1048576;

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,26 +22,18 @@ include_once "include/config.php";
include_once "include/admin.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
site_header($page_width, "Adminstrator Interface : Edit Member Type");
site_navigator(9, $my_user_id[1]);
site_navigator(9);
site_navigator_status("<a href=\"admin.php\">Adminstrator Interface</a> : Edit Member Type", "");
print "&nbsp;<br/>";
@ -86,7 +78,7 @@ print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<a href=\"user.php?user=$user_data[0]\">$user_data[1], $user_data[2]</a></td>";
print "<td align=\"center\" valign=\"middle\" bgcolor=\"".$color['table_body']."\" >";
if ($my_user_id[0] == $user_data[0]) {
if ($po_user['id'] == $user_data[0]) {
print "administrator";
print "<input type=\"hidden\" name=\"type\" value=\"$user_type[administrator]\"/><p>";
} else {
@ -103,18 +95,18 @@ print "<td align=\"center\" bgcolor=\"$color[table_body]\" >";
display_yes_no_combo("shared", $user_data[6]);
print "</td>";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" >";
print "<input align=\"right\" type=\"text\" name=\"quota_size\" value=\"$user_preferences[2]\" size=\"7\"> Mb";
print "<input align=\"right\" type=\"text\" name=\"quota_size\" value=\"$user_preferences[2]\" size=\"7\"/> Mb";
print "</td>";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" >";
print "<input align=\"right\" type=\"text\" name=\"quota_count\" value=\"$user_preferences[3]\" size=\"7\">";
print "<input align=\"right\" type=\"text\" name=\"quota_count\" value=\"$user_preferences[3]\" size=\"7\"/>";
print "</td>";
print "</tr>";
print "</table>\n";
print "&nbsp;<br/>";
print "<input type=\"hidden\" name=\"user\" value=\"$user_id\"><p>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">";
print "<a class=\"nodecor\" href=\"admin.php?selector=".$admin_data['users_n_clients']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"hidden\" name=\"user\" value=\"$user_id\"/><p>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>";
print "<a class=\"nodecor\" href=\"admin.php?selector=".$admin_data['users_n_clients']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</form>";
display_navigator_box_bottom("100%");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,30 +23,24 @@ include_once "include/admin.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
$database = site_prolog();
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
$volume = $_REQUEST['volume'];
$new_volume = $_REQUEST['new_volume'];
$current = $_REQUEST['current'];
$volume_max_size = $_REQUEST['volume_max_size'];
$volume = pg_escape_string($_REQUEST['volume']);
$new_volume = pg_escape_string($_REQUEST['new_volume']);
$current = pg_escape_string($_REQUEST['current']);
$volume_max_size = pg_escape_string($_REQUEST['volume_max_size']);
if (($handle = opendir($image_repository_path . "/" . $volume)) == FALSE) {
header("location: admin.php?selector=".$admin_data['repository']['idx']);
}
closedir($handle);
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
error_reporting(0);
pg_query($database, "begin");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,16 +22,16 @@ include_once "include/config.php";
include_once "include/admin.php";
include_once "include/site.php";
include_once "$theme/theme.php";
include_once "include/common.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
$database = site_prolog();
if ($po_user['type'] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$volume = $_REQUEST['volume'];
if (($handle = opendir($image_repository_path . "/" . $volume)) == FALSE) {
@ -40,18 +40,10 @@ if (($handle = opendir($image_repository_path . "/" . $volume)) == FALSE) {
closedir($handle);
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['administrator']) {
site_epilog($database);
header("location: login.php");
exit();
}
$system_preferences = pg_fetch_row(pg_query($database, "select current_volume, volume_max_size from system_preferences"));
site_header($page_width, "Adminstrator Interface : Edit Image Repository Volume");
site_navigator(9, $my_user_id[1], $user_type);
site_navigator(9);
site_navigator_status("<a href=\"admin.php\">Adminstrator Interface</a> : Edit Image Repository Volume ", "");
print "&nbsp;<br/>";
@ -59,7 +51,7 @@ display_navigator_box_top($admin_data['repository']['idx'], $admin_data, "100%")
print "&nbsp;<br/>";
print "<form action=\"admin.volume.edit.2.php\" method=\"POST\">\n";
print "<input type=\"hidden\" name=\"volume\" value=\"$volume\">\n";
print "<input type=\"hidden\" name=\"volume\" value=\"$volume\"/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"60%\">Volume</td>\n";
@ -68,18 +60,18 @@ print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\">Max Si
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"new_volume\" value=\"$volume\" size=\"50\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"new_volume\" value=\"$volume\" size=\"50\"/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_yes_no_combo("current", $system_preferences[0] == $volume ? 't' : 'f');
print "</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"volume_max_size\" value=\"$system_preferences[1]\" size=\"6\">Mb</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"volume_max_size\" value=\"$system_preferences[1]\" size=\"6\"/>Mb</td>";
print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">";
print "<a class=\"nodecor\" href=\"admin.php?selector=".$admin_data['repository']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>";
print "<a class=\"nodecor\" href=\"admin.php?selector=".$admin_data['repository']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</form>\n";
display_navigator_box_bottom("100%");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,14 +22,9 @@ include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
$database = site_prolog();
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
@ -37,26 +32,37 @@ if ($my_user_id[0] == "") {
$album_caption = pg_escape_string($_REQUEST['album_caption']);
$album_description = pg_escape_string($_REQUEST['album_description']);
$album_access_rights = $_REQUEST['album_access_rights'];
$album_parent = $_REQUEST['parent'];
$album_access_rights = pg_escape_string($_REQUEST['album_access_rights']);
$album_parent = pg_escape_string($_REQUEST['parent']);
if ($album_parent != "null") {
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_query($database, "select identifier from album where identifier=$album_parent and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
}
global $default_order_by;
if ($album_caption != "") {
$album_type = $my_user_id[1] > $user_type['client'] ? "u" : "c";
$album_type = $po_user['type'] > $user_type['client'] ? "u" : "c";
$result = pg_query($database, "insert into album (identifier, users, caption, description, date_of_creation, access_rights, type, orderby, parent_album)
values (nextval('album_id_sequence'),
'$my_user_id[0]', '$album_caption', '$album_description', now(), '$album_access_rights', '$album_type', $default_order_by, $album_parent)");
'$po_user[id]', '$album_caption', '$album_description', now(), '$album_access_rights', '$album_type', $default_order_by, $album_parent)");
if (!$result) {
print "Failed to create new album: $album_caption";
// print "Failed to create new album: $album_caption";
exit();
}
}
site_epilog($database);
if ($album_parent == "null") {
header("location: my.folder.php");
}
else {
} else {
header("location: album.php?album=$album_parent");
}
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,36 +21,28 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "include/common.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$database = site_prolog();
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['client']) {
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
}
if ($my_user_id[1] > $user_type['client']) {
if ($po_user['type'] > $user_type['client']) {
$navi_path = "My Folders and Albums";
}
else {
} else {
$navi_path = "My Albums";
}
$parent = $_REQUEST['parent'];
$parent = pg_escape_string($_REQUEST['parent']);
$album_all = pg_query($database, "select identifier, caption, parent_album from album
where users=$my_user_id[0] order by date_of_creation desc");
where users=$po_user[id] order by date_of_creation desc");
site_header($page_width, "Add Album");
site_navigator(5, $my_user_id[1]);
site_navigator(5);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.folder.php\">$navi_path</a> : Add Album ", "");
print "&nbsp;<br/>\n";
@ -59,22 +51,21 @@ print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\"
print "<tr>";
print "<td bgcolor=\"$color[table_header]\" width=\"60%\">Album Name</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\">Parent</td>";
if ($my_user_id[1] > $user_type['client']) {
if ($po_user['type'] > $user_type['client']) {
print "<td bgcolor=\"$color[table_header]\" width=\"20%\">Access</td>";
}
print "</tr>";
print "<tr>";
print "<td bgcolor=\"$color[table_body]\" >";
print "<input id=\"template_editor\" type=\"text\" name=\"album_caption\"></td>";
print "<input id=\"template_editor\" type=\"text\" name=\"album_caption\"/></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_folder_combo("parent", $album_all, $parent, "null");
print "</td>\n";
if ($my_user_id[1] > $user_type['client']) {
if ($po_user['type'] > $user_type['client']) {
print "<td bgcolor=\"$color[table_body]\" >";
display_access_combo("album_access_rights", "t", ""); print "</td>\n";
}
else {
print "<input type=\"hidden\" name=\"album_access_rights\" value=\"$access[private]\"></td>";
} else {
print "<input type=\"hidden\" name=\"album_access_rights\" value=\"$access[private]\"/></td>";
}
print "</tr>";
print "</table>";
@ -95,8 +86,8 @@ print "</table>";
print "&nbsp;<br/>\n";
print "<center>\n";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Album\">";
print "<a class=\"nodecor\" href=\"my.folder.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Album\"/>";
print "<a class=\"nodecor\" href=\"my.folder.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</form>";
print "</center>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,16 +22,68 @@ include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$album_id = $_REQUEST['album'];
$album_id = pg_escape_string($_REQUEST['album']);
$database = site_prolog();
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
}
/* Ensure mere users don't erase an album that isn't theirs! */
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_query($database, "select identifier from album where identifier='$album_id' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
/* XXX Don't forget sub-albums! */
if ($album_id!="") {
$result = pg_query($database, "delete from album_content where album='$album_id'");
$result = pg_query($database, "delete from album where identifier='$album_id'");
if (!$result) {
print "Failed to delete album: $album_id";
$result = pg_query($database, "begin");
if ($result) {
/* Find all albums with us as their parent... */
$result = pg_query($database, "select parent_album from album where identifier='$album_id'");
if (pg_num_rows($result)) {
$parent_album = pg_fetch_row($result);
if ($parent_album[0] = "")
$parent_album[0] = FALSE;
} else {
$parent_album = array(FALSE);
}
}
if ($parent_album[0] != FALSE && $result) {
/* And make them ours! */
$result = pg_query($database, "update album set parent_album = $parent_album[0] where parent_album = $album_id");
}
print "update album set parent_album = $parent_album[0] where parent_album = $album_id";
if ($result) {
$result = pg_query($database, "delete from album_content where album='$album_id'");
}
if ($result) {
$result = pg_query($database, "delete from album where identifier='$album_id'");
}
if ($result) {
pg_query($database, "commit");
} else {
pg_query($database, "abort");
}
}
site_epilog($database);
header("location: my.folder.php");
if ($parent_album[0] == FALSE) {
header("location: my.folder.php");
} else {
header("location: album.php?album=$parent_album[0]");
}
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,41 +21,42 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['client']) {
$database = site_prolog();
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
}
$album_id = $_REQUEST['album'];
$photos_in_album = pg_fetch_row(pg_query($database, "select count_photos_by_album($album_id)"));
$subalbums_in_album = pg_fetch_row(pg_query($database, "select count_subalbums_by_album($album_id)"));
$album_id = pg_escape_string($_REQUEST['album']);
$album_data = pg_fetch_row(pg_query($database, "
select album.identifier, caption, date_of_creation, value
select album.identifier, caption, date_of_creation, value, users, parent_album
from album, access_type
where access_type.identifier=album.access_rights
and album.identifier='$album_id'"));
if (($album_data[4] != $po_user['id']) &&
($po_user['type'] != $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
$photos_in_album = pg_fetch_row(pg_query($database, "select count_photos_by_album($album_id)"));
$subalbums_in_album = pg_fetch_row(pg_query($database, "select count_subalbums_by_album($album_id)"));
$path_to_album = get_path_to_album($database, $album_id);
site_header($page_width, "Delete Album");
site_navigator(5, $my_user_id[1]);
site_navigator(5);
if ($my_user_id[1] > $user_type['client']) {
if ($po_user['type'] > $user_type['client']) {
$navi_path = "My Folders and Albums";
}
else {
} else {
$navi_path = "My Albums";
}
@ -88,7 +89,7 @@ print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"55%\">Album
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Subalbums</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Photos</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"15%\">Created</td>\n";
if ($my_user_id[1] > $user_type['client']) {
if ($po_user['type'] > $user_type['client']) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Access</td>\n";
}
print "</tr>";
@ -96,8 +97,8 @@ print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"album.php?album=$album_data[0]\">$album_data[1]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$photos_in_album[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$subalbums_in_album[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($album_data[2], 'date', $my_user_id[0] == "" ? 0 : 1)."</td>";
if ($my_user_id[1] > $user_type['client']) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($album_data[2], 'date', 1)."</td>";
if ($po_user['type'] > $user_type['client']) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$album_data[3]</td>\n";
}
print "</tr>";
@ -106,13 +107,14 @@ print "</table>";
print "&nbsp;<br/>\n";
print "<center>\n";
if ($subalbums_in_album[0] > 0) {
print "<a class=\"nodecor\" href=\"album.php?album=$album_id\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"></a>\n";
print "<a class=\"nodecor\" href=\"album.php?album=$album_id\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"/></a>\n";
}
else {
print "<form method=\"post\" action=\"album.del.2.php\">";
print "<input type=\"hidden\" name=\"album\" value=\"$album_id\"><p>";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\">";
print "<a class=\"nodecor\" href=\"my.folder.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"hidden\" name=\"album\" value=\"$album_id\"/><p>";
print "<input type=\"hidden\" name=\"parent\" value=\"$album_data[5]\"/><p>";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\"/>";
print "<a class=\"nodecor\" href=\"my.folder.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</form>";
}
print "</center>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,13 +22,30 @@ include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$album_id = $_REQUEST['album'];
$album_id = pg_escape_string($_REQUEST['album']);
$album_name = pg_escape_string($_REQUEST['album_caption']);
$album_description = pg_escape_string($_REQUEST['album_description']);
$album_access_rights = $_REQUEST['album_access_rights'];
$album_parent = $_REQUEST['parent'];
$album_access_rights = pg_escape_string($_REQUEST['album_access_rights']);
$album_parent = pg_escape_string($_REQUEST['parent']);
$database = site_prolog();
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
}
/* Ensure mere users don't edit an album that isn't theirs! */
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_query($database, "select identifier from album where identifier='$album_id' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
if (($album_id!="") && ($album_name!="")) {
$result = pg_query($database, "
update album
@ -37,10 +54,13 @@ if (($album_id!="") && ($album_name!="")) {
access_rights='$album_access_rights',
parent_album=$album_parent
where identifier='$album_id'");
if (!$result) {
print "Failed to edit album: $album_name";
}
}
}
site_epilog($database);
header("location: my.folder.php");
if ($album_parent == "null") {
header("location: my.folder.php");
} else {
header("location: album.php?album=$parent");
}
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,44 +21,45 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['client']) {
$database = site_prolog();
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
}
if ($my_user_id[1] > $user_type['client']) {
$navi_path = "My Folders and Albums";
$album_id = pg_escape_string($_REQUEST['album']);
$album_data = pg_fetch_row(pg_query($database, "select caption, date_of_creation, access_rights, description, parent_album, users from album where identifier='$album_id'"));
/* Ensure mere users don't edit an folder that isn't theirs! */
if (($po_user['id'] != $album_data[5]) &&
($po_user['type'] < $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
else {
if ($po_user['type'] > $user_type['client']) {
$navi_path = "My Folders and Albums";
} else {
$navi_path = "My Albums";
}
$album_id = $_REQUEST['album'];
$album_all = pg_query($database, "select identifier, caption, parent_album from album where users=$my_user_id[0] order by date_of_creation desc");
$album_all = pg_query($database, "select identifier, caption, parent_album from album where users=$po_user[id] order by date_of_creation desc");
$photos_in_album = pg_fetch_row(pg_query($database, "select count_photos_by_album($album_id)"));
$subalbums_in_album = pg_fetch_row(pg_query($database, "select count_subalbums_by_album($album_id)"));
$path_to_album = get_path_to_album($database, $album_id);
site_header($page_width, "Edit Album");
site_navigator(5, $my_user_id[1]);
site_navigator(5);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.folder.php\">$navi_path</a>$path_to_folder : Edit album <a href=\"album.php?album=$album_id\">$album_data[0]</a>", "");
print "&nbsp;<br/>\n";
$album_data = pg_fetch_row(pg_query($database, "select caption, date_of_creation, access_rights, description, parent_album from album where identifier='$album_id'"));
$photos_in_album = pg_fetch_row(pg_query($database, "select count_photos_by_album($album_id)"));
print "<form method=\"post\" action=\"album.edit.2.php\">";
@ -69,25 +70,25 @@ print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"27%\">Parent
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Subalbums</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Photos</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"15%\">Created</td>\n";
if ($my_user_id[1] > $user_type['client']) {
if ($po_user['type'] > $user_type['client']) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Access</td>\n";
}
print "</tr>";
print "<tr>";
print "<td bgcolor=\"$color[table_body]\" >";
print "<input id=\"template_editor\" type=\"text\" name=\"album_caption\" value=\"$album_data[0]\" size=\"50%\"></td>";
print "<input id=\"template_editor\" type=\"text\" name=\"album_caption\" value=\"$album_data[0]\" size=\"50%\"/></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_folder_combo("parent", $album_all, $album_data[4], "null");
print "</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$photos_in_album[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$subalbums_in_album[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($album_data[1], 'date', $my_user_id[0] == "" ? 0 : 1)."</td>";
if ($my_user_id[1] > $user_type['client']) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($album_data[1], 'date', 1)."</td>";
if ($po_user['type'] > $user_type['client']) {
print "<td bgcolor=\"$color[table_body]\" >";
display_access_combo("album_access_rights", $album_data[2], ""); print "</td>\n";
}
else {
print "<input type=\"hidden\" name=\"album_access_rights\" value=\"$access[private]\"></td>";
print "<input type=\"hidden\" name=\"album_access_rights\" value=\"$access[private]\"/></td>";
}
print "</tr>";
print "</table>";
@ -108,9 +109,13 @@ print "</table>";
print "&nbsp;<br/>\n";
print "<center>\n";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">";
print "<a class=\"nodecor\" href=\"my.folder.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"hidden\" name=\"album\" value=\"$album_id\"><p>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>";
if (!$album_data[4]) {
print "<a class=\"nodecor\" href=\"my.folder.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
} else {
print "<a class=\"nodecor\" href=\"album.php?album=$album_data[4]\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
}
print "<input type=\"hidden\" name=\"album\" value=\"$album_id\"/><p>";
print "</form>";
print "</center>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -25,17 +25,17 @@ include_once "include/orderby.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
$album_id = $_REQUEST['album'];
$view = $_REQUEST['view'];
$order_by = $_REQUEST['order_by'];
$album_id = pg_escape_string($_REQUEST['album']);
$view = pg_escape_string($_REQUEST['view']);
$order_by = pg_escape_string($_REQUEST['order_by']);
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if (!$album_id) {
header("HTTP/1.1 404 Not found");
site_header($page_width, "Display Album");
site_navigator(5, $my_user_id[1]);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$my_user_id[0]\">My Folders and Albums</a> : No album specified", "");
site_navigator(5);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$po_user[id]\">My Folders and Albums</a> : No album specified", "");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
@ -44,9 +44,10 @@ if (!$album_id) {
$album = pg_fetch_row(pg_query($database, "select caption, access_rights, users, orderby, description, users.type from album, users where album.identifier='$album_id' and users.identifier = album.users"));
if (!$album) {
header("HTTP/1.1 404 Not found");
site_header($page_width, "Display Album");
site_navigator(5, $my_user_id[1]);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$my_user_id[0]\">My Folders and Albums</a> : No such album", "");
site_navigator(5);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$po_user[type]\">My Folders and Albums</a> : No such album", "");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
@ -57,61 +58,71 @@ if ($view != "") {
$arguments = $arguments . "&amp;view=$view";
}
$album_name = $album[0];
$owner_id = $album[2];
if (!$order_by) {
/* get the last value from the database */
$order_by = $album[3];
}
else if ($order_by != $album[3]){
/* if different, set the database, and use the new value */
pg_query($database, "update album set orderby='$order_by' where identifier=$album_id");
} else if ($order_by != $album[3]) {
if ($po_user['id'] == $owner_id) {
/* if different, set the database, and use the new value */
pg_query($database, "update album set orderby='$order_by' where identifier=$album_id");
}
}
$arguments = $arguments . "&amp;order_by=$order_by";
$sql_query_order_by_string = $order_by_string[$order_by][0];
$album_name = $album[0];
$album_user_id = $album[2];
$client = FALSE;
if ($album_user_id != "" && $my_user_id[0] != "") {
$client = pg_fetch_row(pg_query($database, "select identifier from client where users='$album_user_id' and client='$my_user_id[0]' and status=2"));
if (($owner_id != "") &&
($po_user['type'] > $user_type['disabled'])) {
$client = pg_fetch_row(pg_query($database, "select identifier from client where users='$owner_id' and client='$po_user[id]' and status=2"));
}
if ($my_user_id[0] != $album_user_id && $folder[1] == "f" && $my_user_id[1] != $user_type['administrator']) {
if (($po_user['id'] != $owner_id) &&
($album[1] == "f") &&
($po_user['type'] < $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
if ($my_user_id[0] != $album_user_id && $album[1] == "p" && $client == "" && $my_user_id[1] != $user_type['administrator']) {
if (($po_user['id'] != $owner_id) &&
($album[1] == "p") &&
($client == FALSE) &&
($po_user['type'] < $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
if ($my_user_id[0] == $album_user_id || $my_user_id[1] == $user_type['administrator']) {
if (($po_user['id'] == $owner_id) ||
($po_user['type'] == $user_type['administrator'])) {
$sql_query_access_rights_string = "";
}
else {
if ($client == "")
} else {
if ($client == FALSE) {
$sql_query_access_rights_string = "and photo.access_rights = $access[public]";
else
} else {
$sql_query_access_rights_string = "and photo.access_rights < $access[private]";
}
}
$user_data = pg_fetch_row(pg_query($database, "
select first_name, last_name, users.identifier, shop_enable
from users, preferences
where users.preferences=preferences.identifier
and users.identifier=$album_user_id"));
and users.identifier=$owner_id"));
site_header($page_width, "Display Album");
if ($my_user_id[0] != "") {
if ($po_user['type'] > $user_type['disabled']) {
$my_data = pg_fetch_row(pg_query($database, "
select num_of_rows, num_of_columns, folder_view, num_of_rows_l, popup_enable, popup_delay
from users, preferences
where preferences.identifier=users.preferences
and users.identifier=$my_user_id[0]"));
and users.identifier=$po_user[id]"));
$num_of_rows = $my_data[0];
$num_of_columns = $my_data[1];
if ($view=="")
@ -119,8 +130,7 @@ if ($my_user_id[0] != "") {
$num_of_rows_l = $my_data[3];
$popup_enable = $my_data[4];
$popup_delay = $my_data[5];
}
else {
} else {
$view = "slide";
$num_of_rows_l = $default_num_of_rows_in_list_view;
$num_of_rows = $default_num_of_rows_in_slide_view;
@ -129,14 +139,14 @@ else {
$popup_delay = $default_popup_delay;
}
if ($my_user_id[0] == $album_user_id) {
site_navigator(5, $my_user_id[1]);
if ($po_user['id'] == $owner_id) {
site_navigator(5);
$user_display_string="My Folders and Albums";
$my_data = pg_fetch_row(pg_query($database, "
select num_of_rows, num_of_columns, folder_view, num_of_rows_l, popup_enable, popup_delay
from users, preferences
where preferences.identifier=users.preferences
and users.identifier=$my_user_id[0]"));
and users.identifier=$po_user[id]"));
$num_of_rows = $my_data[0];
$num_of_columns = $my_data[1];
if ($view=="")
@ -144,9 +154,8 @@ if ($my_user_id[0] == $album_user_id) {
$num_of_rows_l = $my_data[3];
$popup_enable = $my_data[4];
$popup_delay = $my_data[5];
}
else {
site_navigator(1, $my_user_id[1]);
} else {
site_navigator(1);
$user_display_string = sprintf("%s, %s", $user_data[1], $user_data[0]);
}
@ -158,7 +167,7 @@ $num_of_photos_a = pg_fetch_row(pg_query($database, "
$sql_query_access_rights_string"));
$num_of_photos = $num_of_photos_a[0];
$offset = $_REQUEST['offset'];
$offset = pg_escape_string($_REQUEST['offset']);
if (!$offset) {
$offset = 0;
}
@ -180,7 +189,7 @@ $album_photo = pg_query($database,
11 - (select avg(rating.value) from rating where rating.photo = photo.identifier) as rating,
views,
(select is_photo_for_sale(photo.identifier)) as for_sale,
photo.title, photo.author, photo.keyword,
photo.title, photo.author, '' as keyword,
photo_version.original_image_name, photo.users,
view_location.place, view_location.country, view_location.city, view_location.state
from album, album_content, photo, photo_dupe, photo_version, view_location
@ -188,7 +197,7 @@ $album_photo = pg_query($database,
and album_content.album = album.identifier
and photo.identifier = photo_version.photo
and photo.identifier = photo_dupe.photo
and album.users = $album_user_id
and album.users = $owner_id
and album.identifier = $album_id
and photo_dupe.key = 1
and photo_version.master = 't'
@ -209,13 +218,12 @@ if ($num_of_photos == 0) {
}
print "&nbsp;<br/>";
display_albums($database, "$album_id", $my_user_id[0], $my_user_id[1], $album[2], $album[5], "with_header");
display_albums($database, "$album_id", $po_user['id'], $po_user['type'], $album[2], $album[5], "with_header");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
exit;
}
else {
} else {
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$user_data[2]\">$user_display_string</a>$path_to_album : $album[0]", "Displaying photos " . display_photo_index_status($offset, $limit, $num_of_photos));
}
@ -225,16 +233,16 @@ if ($album[4]) {
}
print "&nbsp;<br/>";
display_albums($database, "$album_id", $my_user_id[0], $my_user_id[1], $album[2], $album[5], "with_header");
display_albums($database, "$album_id", $po_user['id'], $po_user['type'], $album[2], $album[5], "with_header");
print "<script language=\"JavaScript\" type=\"text/javascript\" src=\"javascript/select.js\"></script>";
print "<script language=\"JavaScript\" type=\"text/javascript\" src=\"javascript/util.js\"></script>";
print "&nbsp;<br/>\n";
print "<form name=\"photoList\" method=\"post\" action=\"folder.content.php\">";
print "<input type=\"hidden\" name=\"user\" value=\"$album_user_id\">";
print "<input type=\"hidden\" name=\"return\" value=\"album.php?album=$album_id$arguments&offset=$offset\">";
print "<input type=\"hidden\" name=\"view\" value=\"$view\">";
print "<input type=\"hidden\" name=\"source_album\" value=\"$album_id\">";
print "<input type=\"hidden\" name=\"user\" value=\"$owner_id\"/>";
print "<input type=\"hidden\" name=\"return\" value=\"album.php?album=$album_id$arguments&amp;offset=$offset\"/>";
print "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
print "<input type=\"hidden\" name=\"source_album\" value=\"$album_id\"/>";
if (($offset + $limit) > $num_of_photos) {
$items = $num_of_photos - $offset;
@ -243,31 +251,29 @@ else {
$items = $limit;
}
display_photo_navigator("album", $arguments, $album_user_id, $album_id, $offset, $limit, $num_of_photos);
display_photo_navigator("album", $arguments, $owner_id, $album_id, $offset, $limit, $num_of_photos);
if ($view=="slide") {
display_photo_slides("album", $my_user_id[0], $my_user_id[1], $album_id, $album_photo, $items, $num_of_columns, $popup_enable, $popup_delay, $user_data[3], true, $order_by);
display_photo_slides("album", $po_user['id'], $po_user['type'], $album_id, $album_photo, $items, $num_of_columns, $popup_enable, $popup_delay, $user_data[3], true, $order_by);
}
else {
print "&nbsp;<br/>\n";
display_photo_list("album", $my_user_id[0], $my_user_id[1], $album_id, $album_photo, $items, $user_data[3], $order_by);
display_photo_list("album", $po_user['id'], $po_user['type'], $album_id, $album_photo, $items, $user_data[3], $order_by);
print "&nbsp;<br/>\n";
}
display_photo_navigator("album", $arguments, $album_user_id, $album_id, $offset, $limit, $num_of_photos);
display_photo_navigator("album", $arguments, $owner_id, $album_id, $offset, $limit, $num_of_photos);
print "&nbsp;<br/>\n";
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$user_data[2]\">$user_display_string</a>$path_to_album : $album[0]", "Displaying photos " . display_photo_index_status($offset, $limit, $num_of_photos));
if ($my_user_id[0] == $album_user_id || $my_user_id[1] == $user_type['administrator']) {
print "<input type=\"hidden\" name=\"source_album\" value=\"$album_id\">\n";
if (($po_user['id'] == $owner_id) ||
($po_user['type'] == $user_type['administrator'])) {
print "<table align=\"left\" valign=\"middle\" cellpadding=\"0\" border=\"0\">";
print "<tr>";
print "<td align=\"left\" valign=\"middle\">";
if ($order_by != "") {
$order_by_argument = "&order_by=$order_by";
}
else {
$order_by_argument = "&amp;order_by=$order_by";
} else {
$order_by_argument = "";
}
display_order_by_combo_with_button($order_by);
@ -278,8 +284,7 @@ if ($my_user_id[0] == $album_user_id || $my_user_id[1] == $user_type['administra
$album_all = pg_query($database, "
select identifier, caption, parent_album
from album
where users=$album_user_id
and album.identifier!=$album_id
where users=$owner_id
order by date_of_creation desc");
display_moveto_album($album_all, $album_id);
print "</td>";
@ -287,46 +292,48 @@ if ($my_user_id[0] == $album_user_id || $my_user_id[1] == $user_type['administra
/* Display printto/exportto */
print "<td align=\"left\" valign=\"middle\">";
display_printto();
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
print "<td align=\"left\" valign=\"middle\">";
display_export();
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
if ($po_user['id'] == $owner_id || $po_user['type'] == $user_type['administrator']) {
print "<td align=\"left\" valign=\"middle\">";
display_printto();
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
print "<td align=\"left\" valign=\"middle\">";
display_export();
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
}
print "<td align=\"left\" valign=\"middle\">";
if ($view=="slide")
print "<a class=\"nodecor\" href=\"album.php?album=$album_id$order_by_argument&amp;view=list&amp;offset=$offset\"><img src=\"$theme/button.list.view.gif\" alt=\"List View\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" href=\"album.php?album=$album_id$order_by_argument&amp;view=list&amp;offset=$offset\"><img src=\"$theme/button.list.view.gif\" alt=\"List View\" border=\"0\"/></a>\n";
else
print "<a class=\"nodecor\" href=\"album.php?album=$album_id$order_by_argument&amp;view=slide&amp;offset=$offset\"><img src=\"$theme/button.slide.view.gif\" alt=\"Slide View\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" href=\"album.php?album=$album_id$order_by_argument&amp;view=slide&amp;offset=$offset\"><img src=\"$theme/button.slide.view.gif\" alt=\"Slide View\" border=\"0\"/></a>\n";
print "</td>";
print "<td align=\"left\" valign=\"middle\">";
print "<a class=\"nodecor\" href=\"javascript:setChecked('photocb'); changeImage('selectButton', '$theme/button.deselect.all.gif', '$theme/button.select.all.gif')\"><img name=\"selectButton\" src=\"$theme/button.select.all.gif\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" onclick=\"setChecked('photocb'); changeImage('selectButton', '$theme/button.deselect.all.gif', '$theme/button.select.all.gif')\"><img name=\"selectButton\" src=\"$theme/button.select.all.gif\" border=\"0\"/></a>\n";
print "</td>";
print "</tr>";
print "</table>";
}
elseif ($my_user_id[1] >= $user_type['client']) {
elseif ($po_user['type'] >= $user_type['client']) {
print "<table align=\"left\" valign=\"middle\" cellpadding=\"0\" border=\"0\">";
print "<tr>";
print "<td align=\"left\" valign=\"middle\">";
print "<input type=\"hidden\" name=\"basket\" value=\"yes\">";
print "<a class=\"nodecor\" href=\"javascript:setChecked('photocb'); changeImage('selectButton', '$theme/button.deselect.all.gif', '$theme/button.select.all.gif')\"><img name=\"selectButton\" src=\"$theme/button.select.all.gif\" border=\"0\"></a>\n";
print "<input type=\"hidden\" name=\"basket\" value=\"yes\"/>";
print "<a class=\"nodecor\" onclick=\"setChecked('photocb'); changeImage('selectButton', '$theme/button.deselect.all.gif', '$theme/button.select.all.gif')\"><img name=\"selectButton\" src=\"$theme/button.select.all.gif\" border=\"0\"/></a>\n";
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
print "<input type=\"image\" src=\"$theme/button.put.selection.to.basket.gif\" alt=\"Put Selection to Basket\">\n";
print "<a class=\"nodecor\" href=\"basket.php\"><img src=\"$theme/button.view.basket.gif\" alt=\"View Basket\" border=\"0\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.put.selection.to.basket.gif\" alt=\"Put Selection to Basket\"/>\n";
print "<a class=\"nodecor\" href=\"basket.php\"><img src=\"$theme/button.view.basket.gif\" alt=\"View Basket\" border=\"0\"/></a>\n";
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
$album_all = pg_query($database, "select identifier, caption, parent_album from album where users=$my_user_id[0] and type='c' order by date_of_creation desc");
$album_all = pg_query($database, "select identifier, caption, parent_album from album where users=$po_user[id] and type='c' order by date_of_creation desc");
if (pg_num_rows($album_all) > 0) {
display_linkto_album($album_all, $album_id);
}

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,37 +23,30 @@ include_once "include/site.php";
include_once "include/mail.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
}
if ($my_user_id[1] == $user_type['administrator']) {
$user_id = $_REQUEST['user'];
}
if (!$user_id) {
$user_id = $my_user_id[0];
if ($po_user['type'] == $user_type['administrator']) {
$user_id = pg_escape_string($_REQUEST['user']);
} if (!$user_id) {
$user_id = $po_user['id'];
}
$operation = $_REQUEST['operation'];
$operation = pg_escape_string($_REQUEST['operation']);
if ($operation == "del") {
/* delete the order if it's owned by the user and if it's status is SELECTED */
$item = $_REQUEST['item'];
$item = pg_escape_string($_REQUEST['item']);
pg_query($database, "delete from shop_order where identifier=$item and client=$user_id and transaction is null");
}
elseif ($operation == "confirm") {
} elseif ($operation == "confirm") {
/* save changes and set order to ORDERED */
$transaction_id = pg_fetch_row(pg_query($database, "select nextval('shop_transaction_id_sequence')"));
$remark = $_REQUEST['remark'];
$remark = pg_escape_string($_REQUEST['remark']);
pg_query($database, "
insert into shop_transaction (identifier, status, remark, date_of_creation, date_of_last_edit)
@ -81,10 +74,10 @@ elseif ($operation == "confirm") {
and transaction is null
and client=$user_id");
$option = "?thanks=yes&transaction=$transaction_id[0]";
$option = "?thanks=yes&amp;transaction=$transaction_id[0]";
}
/* send_po_order_notification($database, $user_id, $my_user_id[0]); */
/* send_po_order_notification($database, $user_id, $po_user['id']); */
}
site_epilog($database);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,31 +21,26 @@
include_once "include/vars.php";
include_once "include/config.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
include_once "include/contacts.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
/* administrator cannot have a basket since it "owns" all photos of the system */
/* and so it would be increasingly difficult to add shop controls for the administrator */
if ($my_user_id[1] < $user_type['client'] || $my_user_id[1] > $user_type['user']) {
/* Administrators cannot have a basket since it "owns" all photos of the
system and so it would be increasingly difficult to add shop controls
for the administrator
*/
if (($po_user['type'] < $user_type['client']) ||
($po_user['type'] > $user_type['user'])) {
site_epilog($database);
header("location: login.php");
exit();
}
site_header($page_width, "Basket");
site_navigator(11, $my_user_id[1]);
site_navigator(11);
site_navigator_status("<a href=\"user.php\">Users</a> : My Basket", "");
print "&nbsp;<br/>\n";
@ -68,28 +63,28 @@ $photos_in_basket = pg_query($database, "
(select last_name from photo, photo_item, users where photo.users = users.identifier and photo.identifier=photo_item.photo and photo_item.identifier=shop_order.item),
(select shop_item.category from shop_item, photo_item where photo_item.shop_item=shop_item.identifier and photo_item.identifier=shop_order.item) as shop_item_category
from shop_order
where shop_order.client=$my_user_id[0]
where shop_order.client=$po_user[id]
and transaction is null
order by date_of_creation");
if (pg_num_rows($photos_in_basket) == 0) {
if ($_REQUEST['thanks'] == "yes") {
if (pg_escape_string($_REQUEST['thanks']) == "yes") {
$transaction_id = str_pad($_REQUEST['transaction'], 6, "0", STR_PAD_LEFT);
print "<div align=\"center\" >Thanks for shopping with us.<p>
The transaction identifier for your purchase is <b>$transaction_id</b>.<br/>
Please save this number for future reference of your order.</div>";
}
else
} else {
print "<div align=\"center\" >There are no photos in your basket.</div>";
}
site_footer($database);
site_epilog($database);
exit();
}
print "<form method=\"post\" action=\"basket.content.php\">";
print "<input type=\"hidden\" name=\"user\" value=\"$my_user_id[0]\">";
print "<input type=\"hidden\" name=\"operation\" value=\"confirm\">";
print "<input type=\"hidden\" name=\"user\" value=\"$po_user[id]\"/>";
print "<input type=\"hidden\" name=\"operation\" value=\"confirm\"/>";
print "<table width=\"100%\" border=\"0\">";
for ($i = 0; $i < pg_num_rows($photos_in_basket); $i++) {
@ -97,7 +92,7 @@ for ($i = 0; $i < pg_num_rows($photos_in_basket); $i++) {
print "<tr><td align=\"right\" width=\"$cell_size\">";
display_frame_top($cell_size, $cell_size, 10, "#E7E7E7", $theme);
print "<a class=\"nodecor\" href=\"photo.php?photo=$photo[1]&detail_info=8\" border=\"1\"><img src=\"image.display.php?image=$photo[1]&size=1\" border=\"1\"></a>\n";
print "<a class=\"nodecor\" href=\"photo.php?photo=$photo[1]&detail_info=8\" border=\"1\"><img src=\"image.display.php?image=$photo[1]&size=1\" border=\"1\"/></a>\n";
display_frame_bottom($cell_size, $cell_size, 10, $theme);
print "</td><td align=\"left\" >";
print "<table bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" width=\"100%\">\n";
@ -135,7 +130,7 @@ for ($i = 0; $i < pg_num_rows($photos_in_basket); $i++) {
and shop_item.identifier = photo_item.shop_item
and photo_item.photo=$photo[1]");
$tmp_shop_category = $_REQUEST["shop_category".$photo[0]];
$tmp_shop_category = pg_escape_string($_REQUEST["shop_category".$photo[0]]);
if (!$tmp_shop_category)
$tmp_shop_category = $photo[13];
elseif ($tmp_shop_category != $photo[13]) {
@ -166,10 +161,10 @@ for ($i = 0; $i < pg_num_rows($photos_in_basket); $i++) {
(select last_name from photo, photo_item, users where photo.users = users.identifier and photo.identifier=photo_item.photo and photo_item.identifier=shop_order.item),
(select shop_item.category from shop_item, photo_item where photo_item.shop_item=shop_item.identifier and photo_item.identifier=shop_order.item) as shop_item_category
from shop_order
where shop_order.client=$my_user_id[0]
where shop_order.client=$po_user[id]
and identifier = $photo[0]"));
}
print "<input type=\"hidden\" name=\"shop_category".$photo[0]."\" value=\"$tmp_shop_category\">";
print "<input type=\"hidden\" name=\"shop_category".$photo[0]."\" value=\"$tmp_shop_category\"/>";
print "<select onchange=\"location = this.options[this.selectedIndex].value;\">";
for ($f=0; $f < pg_num_rows($all_shop_categories_of_this_photo); $f++) {
$shop_category_single = pg_fetch_row($all_shop_categories_of_this_photo, $f);
@ -189,7 +184,7 @@ for ($i = 0; $i < pg_num_rows($photos_in_basket); $i++) {
and photo_item.photo=$photo[1]
and shop_item.category=$tmp_shop_category");
$tmp_shop_item = $_REQUEST["shop_item".$photo[0]];
$tmp_shop_item = pg_escape_string($_REQUEST["shop_item".$photo[0]]);
if (!$tmp_shop_item)
$tmp_shop_item = $photo[7];
elseif ($tmp_shop_item != $photo[7]) {
@ -218,10 +213,10 @@ for ($i = 0; $i < pg_num_rows($photos_in_basket); $i++) {
(select last_name from photo, photo_item, users where photo.users = users.identifier and photo.identifier=photo_item.photo and photo_item.identifier=shop_order.item),
(select shop_item.category from shop_item, photo_item where photo_item.shop_item=shop_item.identifier and photo_item.identifier=shop_order.item) as shop_item_category
from shop_order
where shop_order.client=$my_user_id[0]
where shop_order.client=$po_user[id]
and identifier = $photo[0]"));
}
print "<input type=\"hidden\" name=\"shop_item".$photo[0]."\" value=\"$tmp_shop_item\">";
print "<input type=\"hidden\" name=\"shop_item".$photo[0]."\" value=\"$tmp_shop_item\"/>";
print "<select onchange=\"location = this.options[this.selectedIndex].value;\">";
for ($f=0; $f < pg_num_rows($all_shop_items_of_this_photo); $f++) {
$shop_item_single = pg_fetch_row($all_shop_items_of_this_photo, $f);
@ -239,7 +234,7 @@ for ($i = 0; $i < pg_num_rows($photos_in_basket); $i++) {
print "<td align=\"right\" bgcolor=\"$color[table_top]\" width=\"10%\">Pieces</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" width=\"90%\">";
$tmp_pcs = $_REQUEST["pcs".$photo[0]];
$tmp_pcs = pg_escape_string($_REQUEST["pcs".$photo[0]]);
if (!$tmp_pcs)
$tmp_pcs = $photo[2];
elseif ($tmp_pcs != $photo[2])
@ -290,7 +285,7 @@ print "&nbsp;<br/>\n";
print "<textarea wrap=\"hard\" name=\"remark\" rows=\"5\" style=\"width: 100%;\"></textarea>\n";
print "<br/>&nbsp;<br/>\n";
print "<input type=\"image\" src=\"$theme/button.confirm.purchase.gif\" alt=\"Confirm Purchase\">\n";
print "<input type=\"image\" src=\"$theme/button.confirm.purchase.gif\" alt=\"Confirm Purchase\"/>\n";
print "</center>";
print "</form>";
print "&nbsp;<br/>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,20 +22,18 @@ include_once "include/config.php";
include_once "include/tools.php";
include_once "include/mime.php";
include_once "$theme/theme.php";
include_once "include/common.php";
include_once "include/site.php";
include_once "include/import.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$operator = $_REQUEST['operator'];
$select_folder = $_REQUEST['select_folder'];
$select_album = $_REQUEST['select_album'];
$spool_album = $_REQUEST['spool_album'];
$selection = $_REQUEST['selection'];
$select_folder = pg_escape_string($_REQUEST['select_folder']);
$select_album = pg_escape_string($_REQUEST['select_album']);
$spool_album = pg_escape_string($_REQUEST['spool_album']);
$selection = pg_escape_string($_REQUEST['selection']);
$to_update = $_REQUEST['to_update'];
$compress_pages = false; /* Explicitly disable it here */
if (!$selection) {
/* return if no search criteria exists */
header("location: my.tools.php?selector=1");
@ -46,13 +44,9 @@ if (!$to_update) {
header("location: my.tools.php?selector=1");
}
include_once "include/common.php";
include_once "include/site.php";
include_once "include/import.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
@ -61,7 +55,7 @@ if ($my_user_id[1] < $user_type['user']) {
$set_generate_images = $_REQUEST['set_generate_images'];
site_header($page_width, "Display Tools");
site_navigator(10, $my_user_id[1]);
site_navigator(10);
site_navigator_status("<a href=\"user.php\">Users</a> : My Tools", "");
print "&nbsp;<br/>";
@ -70,6 +64,9 @@ display_navigator_box_top($tools_data['bulkupdate']['idx'], $tools_data, "100%")
$update_photo_sql = "";
$update_photo_tech_sql = "";
$set_keyword = "";
$clear_keyword = "";
foreach ($to_update as $field) {
switch ($field) {
case 'set_title':
@ -81,8 +78,10 @@ foreach ($to_update as $field) {
$update_photo_sql .= " author = '$set_author', ";
break;
case 'set_keyword':
$set_keyword = pg_escape_string($_REQUEST['set_keyword']);
$update_photo_sql .= " keyword = '$set_keyword', ";
$set_keyword = $_REQUEST['set_keyword'];
break;
case 'clear_keyword':
$clear_keyword = $_REQUEST['clear_keyword'];
break;
case 'set_headline':
$set_headline = pg_escape_string($_REQUEST['set_headline']);
@ -110,7 +109,7 @@ foreach ($to_update as $field) {
break;
case 'set_copyright':
$set_copyright = pg_escape_string($_REQUEST['set_copyright']);
$update_photo_sql .= " copyright = '$set_copyright', ";
$update_photo_sql .= " copyright_statement = '$set_copyright', ";
break;
case 'set_web_statement':
$set_web_statement = pg_escape_string($_REQUEST['set_web_statement']);
@ -133,93 +132,107 @@ foreach ($to_update as $field) {
$update_photo_sql .= " date_of_exposure= $set_date_of_exposure, ";
break;
case 'set_location':
$set_location = $_REQUEST['set_location'];
$set_location = pg_escape_string($_REQUEST['set_location']);
$update_photo_sql .= " location = $set_location, ";
break;
case 'set_access_rights':
$set_access_rights = $_REQUEST['set_access_rights'];
$set_access_rights = pg_escape_string($_REQUEST['set_access_rights']);
$update_photo_sql .= " access_rights = $set_access_rights, ";
break;
case 'set_hide_original':
$set_hide_original = $_REQUEST['set_hide_original'];
$set_hide_original = pg_escape_string($_REQUEST['set_hide_original']);
$update_photo_sql .= " hide_original = $set_hide_original, ";
break;
case 'set_camera':
$set_camera = $_REQUEST['set_camera'];
$set_camera = pg_escape_string($_REQUEST['set_camera']);
$update_photo_tech_sql .= " camera = $set_camera, ";
break;
case 'set_camera_metering':
$set_camera_metering = $_REQUEST['set_camera_metering'];
$set_camera_metering = pg_escape_string($_REQUEST['set_camera_metering']);
$update_photo_tech_sql .= " camera_metering = $set_camera_metering, ";
break;
case 'set_camera_program':
$set_camera_program = $_REQUEST['set_camera_program'];
$set_camera_program = pg_escape_string($_REQUEST['set_camera_program']);
$update_photo_tech_sql .= " camera_program = $set_camera_program, ";
break;
case 'set_lens':
$set_lens = $_REQUEST['set_lens'];
$set_lens = pg_escape_string($_REQUEST['set_lens']);
$update_photo_tech_sql .= " lens = $set_lens, ";
break;
case 'set_focal_length':
$set_focal_length = $_REQUEST['set_focal_length'];
$set_focal_length = pg_escape_string($_REQUEST['set_focal_length']);
$update_photo_tech_sql .= " focal_length = $set_focal_length, ";
break;
case 'set_filter':
$set_filter = $_REQUEST['set_filter'];
$set_filter = pg_escape_string($_REQUEST['set_filter']);
$update_photo_tech_sql .= " filter = $set_filter, ";
break;
case 'set_film':
$set_film = $_REQUEST['set_film'];
$set_film = pg_escape_string($_REQUEST['set_film']);
$update_photo_tech_sql .= " film = $set_film, ";
break;
case 'set_iso_override':
$set_iso_override = $_REQUEST['set_iso_override'];
$set_iso_override = pg_escape_string($_REQUEST['set_iso_override']);
$update_photo_tech_sql .= " iso_override = $set_iso_override, ";
break;
case 'set_aperture':
$set_aperture = $_REQUEST['set_aperture'];
$set_aperture = pg_escape_string($_REQUEST['set_aperture']);
$update_photo_tech_sql .= " aperture = $set_aperture, ";
break;
case 'set_shutter':
$set_shutter = $_REQUEST['set_shutter'];
$set_shutter = pg_escape_string($_REQUEST['set_shutter']);
$update_photo_tech_sql .= " shutter = $set_shutter, ";
break;
case 'set_exp_comp':
$set_exp_comp = $_REQUEST['set_exp_comp'];
$set_exp_comp = pg_escape_string($_REQUEST['set_exp_comp']);
$update_photo_tech_sql .= " exposure_comp = $set_exp_comp, ";
break;
case 'set_exp_diff':
$set_exp_diff = $_REQUEST['set_exp_diff'];
$set_exp_diff = pg_escape_string($_REQUEST['set_exp_diff']);
$update_photo_tech_sql .= " ev_difference = $set_exp_diff, ";
break;
case 'set_flash':
$set_flash = $_REQUEST['set_flash'];
$set_flash = pg_escape_string($_REQUEST['set_flash']);
$update_photo_tech_sql .= " flash = $set_flash, ";
break;
case 'set_flash_mode':
$set_flash_mode = $_REQUEST['set_flash_mode'];
$set_flash_mode = pg_escape_string($_REQUEST['set_flash_mode']);
$update_photo_tech_sql .= " flash_mode = $set_flash_mode, ";
break;
case 'set_flash_comp':
$set_flash_comp = $_REQUEST['set_flash_comp'];
$set_flash_comp = pg_escape_string($_REQUEST['set_flash_comp']);
$update_photo_tech_sql .= " flash_comp = $set_flash_comp, ";
break;
case 'set_scanner':
$set_scanner = $_REQUEST['set_scanner'];
$set_scanner = pg_escape_string($_REQUEST['set_scanner']);
$update_photo_tech_sql .= " scanner = $set_scanner, ";
break;
case 'set_scan_params':
$param = $_REQUEST['set_scan_resolution'];
$param = pg_escape_string($_REQUEST['set_scan_resolution']);
$update_photo_tech_sql .= " scan_resolution = $param, ";
$param = $_REQUEST['set_scan_bitdepth'];
$param = pg_escape_string($_REQUEST['set_scan_bitdepth']);
$update_photo_tech_sql .= " scan_bitdepth = $param, ";
$param = $_REQUEST['set_scan_multiscan'];
$param = pg_escape_string($_REQUEST['set_scan_multiscan']);
$update_photo_tech_sql .= " scan_multiscan = $param, ";
break;
case 'set_support':
$set_support = $_REQUEST['set_support'];
$set_support = pg_escape_string($_REQUEST['set_support']);
$update_photo_tech_sql .= " support = $set_support, ";
break;
case 'set_geo_location':
$pos = pg_escape_string($_REQUEST['latitude']);
if ($pos == "") $pos = "null";
$update_photo_tech_sql .= " latitude = $pos, ";
$pos = pg_escape_string($_REQUEST['longitude']);
if ($pos == "") $pos = "null";
$update_photo_tech_sql .= " longitude = $pos, ";
$pos = pg_escape_string($_REQUEST['altitude']);
if ($pos == "") $pos = "null";
$update_photo_tech_sql .= " altitude = $pos, ";
$pos = pg_escape_string($_REQUEST['direction']);
if ($pos == "") $pos = "null";
$update_photo_tech_sql .= " direction = $pos, ";
break;
default:
# XXXX we should never get here!
break;
@ -229,7 +242,7 @@ foreach ($to_update as $field) {
switch ($selection) {
case 'folder':
if ($select_folder == "all")
$sql_selector = " users = $my_user_id[0] ";
$sql_selector = " users = $po_user[id] ";
else
$sql_selector = " folder = $select_folder ";
break;
@ -245,6 +258,11 @@ switch ($selection) {
break;
}
/* Ensure users only update files they own */
if ($po_user['type'] != $user_type['administrator']) {
$sql_selector = " users = $po_user[id] AND $sql_selector ";
}
$num_of_updates = pg_fetch_row(pg_query($database, "
select count(identifier) from photo
where $sql_selector"));
@ -252,8 +270,8 @@ $num_of_updates = pg_fetch_row(pg_query($database, "
if ($update_photo_sql != "") {
$update_photo_sql = substr($update_photo_sql, 0, strlen($update_photo_sql) - 2);
print "<li>$update_photo_sql</li>";
print "<li>$sql_selector</li>";
// print "<li>$update_photo_sql</li>";
// print "<li>$sql_selector</li>";
$result = pg_query($database, "
update photo set
@ -264,8 +282,8 @@ if ($update_photo_sql != "") {
if ($update_photo_tech_sql != "") {
$update_photo_tech_sql = substr($update_photo_tech_sql, 0, strlen($update_photo_tech_sql) - 2);
print "<li>$update_photo_tech_sql</li>";
print "<li>$sql_selector</li>";
// print "<li>$update_photo_tech_sql</li>";
// print "<li>$sql_selector</li>";
$result = pg_query($database, "
update photo_tech set
@ -273,12 +291,48 @@ if ($update_photo_tech_sql != "") {
where photo in (select identifier from photo where $sql_selector)");
}
if ($set_keyword != "") {
if (strstr($set_keyword, ";"))
$keywords = semi_string_to_array($set_keyword);
else
$keywords = space_string_to_array($set_keyword);
foreach ($keywords as $keyword) {
$keyword = strtolower(trim($keyword));
$keyword = trim($keyword, ','); /* Trailing commas */
$keyword = trim($keyword);
if ($keyword == "") continue;
$keyword = pg_escape_string($keyword);
pg_query($database, "insert into photo_keywords (photo, keyword)
select p.identifier, '$keyword' from photo p where $sql_selector and not exists (select k.photo from photo_keywords k where k.photo = p.identifier and k.keyword = '$keyword')");
}
}
if ($clear_keyword != "") {
if (strstr($set_keyword, ";"))
$keywords = semi_string_to_array($set_keyword);
else
$keywords = space_string_to_array($set_keyword);
foreach ($keywords as $keyword) {
$keyword = strtolower(trim($keyword));
$keyword = trim($keyword, ','); /* Trailing commas */
$keyword = trim($keyword);
if ($keyword == "") continue;
$keyword = pg_escape_string($keyword);
pg_query($database, "delete from photo_keywords where keyword = $keyword and $sql_selector");
}
}
print "<p align=\"left\">Updated $num_of_updates[0] photos.</p>";
if (($set_generate_images == 't')) {
$im_options = get_im_options($database, $my_user_id[0]);
$my_im_composite_options = get_im_composite_options($database, $my_user_id[0]);
$dcraw_options = get_dcraw_options($database, $my_user_id[0]);
$im_options = get_im_options($database, $po_user['id']);
$my_im_composite_options = get_im_composite_options($database, $po_user['id']);
$dcraw_options = get_dcraw_options($database, $po_user['id']);
print "<div align=\"left\">";
@ -286,7 +340,7 @@ if (($set_generate_images == 't')) {
$offset = 0;
while (1) {
$photo = pg_query($database, "
select small_image_path, medium_image_path, large_image_path, title, photo.identifier, colorspace, orientation, photo.identifier
select small_image_path, medium_image_path, large_image_path, title, photo.identifier, colorspace, orientation
from photo, photo_version
where photo.identifier = photo_version.photo
and $sql_selector
@ -304,7 +358,7 @@ if (($set_generate_images == 't')) {
$camera_profile = pg_fetch_row(pg_query($database, "
select raw_icc_profile
from photo_tech, camera, camera_type
where photo_tech.photo = $photo_data[7]
where photo_tech.photo = $photo_data[4]
and photo_tech.camera = camera.identifier
and camera.type = camera_type.identifier"));
@ -319,9 +373,10 @@ if (($set_generate_images == 't')) {
print "Regenerating thumbnail and preview for <a href=\"photo.php?photo=$photo_data[4]\">$photo_data[3]</a>.<ul>";
$temporary_ppm_file = import_raw_decode($original, $dcraw_options, $decoder, $camera_profile[0], TRUE);
$image_data = array();
$temporary_ppm_file = import_raw_decode($original_name, $dcraw_options, $decoder, TRUE, $camera_profile[0], $image_data);
if ($temporary_ppm_file) {
$original = $temporary_ppm_file;
$original_name = $temporary_ppm_file;
}
import_generate_preview($original_name, $image_name, TRUE, $im_options, $my_im_composite_options, $multi_page_parameter, $orientation, $photo_data[5]);
@ -340,7 +395,7 @@ if (($set_generate_images == 't')) {
}
print "<p>";
print "<a class=\"nodecor\" href=\"my.tools.php?selector=1\"><img src=\"$theme/button.back.gif\" border=\"0\"></a>";
print "<a class=\"nodecor\" href=\"my.tools.php?selector=1\"><img src=\"$theme/button.back.gif\" border=\"0\"/></a>";
print "</p>";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -24,8 +24,6 @@ include_once "include/calendar.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
function add_camera($database, $user_id,
$camera_type_id, $camera_manufacturer_id, $camera_model, $camera_variation,
$camera_serial_number, $camera_purchase_timestamp,
@ -43,37 +41,39 @@ function add_camera($database, $user_id,
$result = pg_query($database, "insert into camera_type (identifier, manufacturer, model, variation, last_modified_date, last_modifying_users, raw_icc_profile)
values ($camera_type_id, $camera_manufacturer_id, '$camera_model', '$camera_variation', now(), $user_id, $camera_icc_profile)");
if (!$result) {
print "Failed to create new camera type";
return;
// print "Failed to create new camera type";
return FALSE;
}
}
$result = pg_query($database, "insert into camera (identifier, type, users, serial_number, date_of_purchase, purchased_new, access_rights)
values (nextval('camera_id_sequence'), '$camera_type_id', '$user_id', '$camera_serial_number', $camera_date_of_purchase, '$camera_purchased_new', '$camera_access_rights')");
if (!$result) {
print "Failed to create new camera";
//print "Failed to create new camera";
return FALSE;
}
return TRUE;
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
add_camera($database, $my_user_id[0],
$_REQUEST['camera_type_id'],
$_REQUEST['camera_manufacturer_id'],
$_REQUEST['camera_model'],
$_REQUEST['camera_variation'],
$_REQUEST['camera_serial_number'],
$_REQUEST['camera_purchase_timestamp'],
$_REQUEST['camera_purchased_new'],
$_REQUEST['camera_access_rights'],
$_REQUEST['camera_icc_profile']);
add_camera($database, $po_user['id'],
pg_escape_string($_REQUEST['camera_type_id']),
pg_escape_string($_REQUEST['camera_manufacturer_id']),
pg_escape_string($_REQUEST['camera_model']),
pg_escape_string($_REQUEST['camera_variation']),
pg_escape_string($_REQUEST['camera_serial_number']),
pg_escape_string($_REQUEST['camera_purchase_timestamp']),
pg_escape_string($_REQUEST['camera_purchased_new']),
pg_escape_string($_REQUEST['camera_access_rights']),
pg_escape_string($_REQUEST['camera_icc_profile']));
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['camera']['idx']);
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -20,27 +20,19 @@
include_once "include/vars.php";
include_once "include/config.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
include_once "include/profile.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$manufacturer_filter = $_REQUEST['filter'];
$manufacturer_filter = pg_escape_string($_REQUEST['filter']);
$all_manufacturers = pg_query($database, "select identifier, name from manufacturer order by name");
switch ($manufacturer_filter) {
@ -53,7 +45,7 @@ switch ($manufacturer_filter) {
}
site_header($page_width, "Add Camera");
site_navigator(6, $my_user_id[1]);
site_navigator(6);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Add new camera", "");
print "&nbsp;<br/>";
@ -65,7 +57,7 @@ if (pg_num_rows($all_manufacturers) == 0) {
print "<tr><td align=\"center\" >\n";
print "You must add manufacturers, before adding cameras";
print "</td></tr><tr><td>&nbsp;<td></tr><tr><td align=\"center\"><p>\n";
print "<a href=\"manufacturer.add.php\"><img src=\"$theme/button.add.manufacturer.gif\" border=\"0\" alt=\"Add manufacturer\"></a>\n";
print "<a href=\"manufacturer.add.php\"><img src=\"$theme/button.add.manufacturer.gif\" border=\"0\" alt=\"Add manufacturer\"/></a>\n";
print "</td></tr>\n";
print "</table>\n";
display_navigator_box_bottom("100%");
@ -114,7 +106,7 @@ if ($num_of_camera_types > 0) {
$camera = pg_fetch_row($camera_type, $i);
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"radio\" name=\"camera_type_id\" value=\"$camera[0]\"></td>\n";
print "<input type=\"radio\" name=\"camera_type_id\" value=\"$camera[0]\"/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$camera[4]\">$camera[1]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera[2]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera[3]</td>\n";
@ -143,7 +135,7 @@ print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\">";
print "<input type=\"radio\" name=\"camera_type_id\" value=\"custom\" checked></td>\n";
print "<input type=\"radio\" name=\"camera_type_id\" value=\"custom\" checked/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<select name=\"camera_manufacturer_id\">\n";
$num_of_manufacturers = pg_num_rows($all_manufacturers);
@ -153,9 +145,9 @@ for ($i=0; $i < $num_of_manufacturers; $i++) {
}
print "</select></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"camera_model\"></td>\n";
print "<input type=\"text\" name=\"camera_model\"/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"camera_variation\"></td>\n";
print "<input type=\"text\" name=\"camera_variation\"/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_icc_profiles_combo("camera_icc_profile", "");
print "</td>\n";
@ -176,7 +168,7 @@ print "</tr>\n";
print "<tr>\n";
print "<td bgcolor=\"$color[table_body]\" >\n";
print "<input type=\"text\" name=\"camera_serial_number\"></td>\n";
print "<input type=\"text\" name=\"camera_serial_number\"/></td>\n";
print "<td bgcolor=\"$color[table_body]\" >\n";
display_date_input_form("camera_purchase_timestamp", "");
print "</td>\n";
@ -190,8 +182,8 @@ print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Camera\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['camera']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Camera\"/>\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['camera']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>\n";
print "</form>\n";
display_navigator_box_bottom("100%");

View File

@ -1,57 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
function delete_camera($database, $camera_id) {
if (camera_id!="") {
pg_query($database, "begin");
$number_of_cameraes_of_same_type = pg_fetch_row(pg_query($database, "select count(identifier) from camera where type=(select type from camera where identifier='$camera_id')"));
if ($number_of_cameraes_of_same_type[0] == 1) {
$camera_type_to_remove = pg_fetch_row(pg_query($database, "select type from camera where identifier='$camera_id'"));
}
$result = pg_query($database, "delete from camera where identifier='$camera_id'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete camera: $camera_id";
return;
}
if ($number_of_cameraes_of_same_type[0] == 1) {
$result = pg_query($database, "delete from camera_type where identifier='$camera_type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete camera type: $camera_type_to_remove";
return;
}
}
pg_query($database, "commit");
}
}
$database = site_prolog();
delete_camera($database, $_REQUEST['item_id']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['camera']['idx']);
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,29 +22,31 @@ include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$camera_id = $_REQUEST['item'];
$camera_id = pg_escape_string($_REQUEST['item']);
$number_of_references = pg_fetch_row(pg_query($database, "select number_of_camera_references($camera_id)"));
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from camera where identifier=$camera_id and users=$po_user[id]"));
if ($result[0] == 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
site_header($page_width, "Delete Camera");
site_navigator(6, $my_user_id[1]);
site_navigator(6);
switch ($number_of_references[0]) {
case 0:
@ -61,7 +63,7 @@ print "&nbsp;<br/>";
display_navigator_box_top($profile_data['camera']['idx'], $profile_data, "100%");
print "&nbsp;<br/>";
print "<form method=\"post\" action=\"camera.del.2.php?&item_id=$camera_id\">";
print "<form method=\"post\" action=\"profile.del.2.php?item_id=$camera_id&amp;type=camera\">";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"7\"><font class=\"tabletop\">Remove Camera</font></td>\n";
@ -85,7 +87,7 @@ print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$camera_to_be_removed[6]\">$camera_to_be_removed[0]</a></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera_to_be_removed[1] $camera_to_be_removed[2]";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera_to_be_removed[3] </td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($camera_to_be_removed[4], 'short_date', $my_user_id[0] == "" ? 0 : 1)."</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($camera_to_be_removed[4], 'short_date', 1)."</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($camera_to_be_removed[5]); print "</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera_to_be_removed[7]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$number_of_references[0]</td>\n";
@ -95,11 +97,11 @@ print "</table>";
print "&nbsp;<br/>";
if ($number_of_references[0]==0) {
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['camera']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\"/>\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['camera']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>\n";
}
else {
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['camera']['idx']."\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"></a>\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['camera']['idx']."\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"/></a>\n";
}
print "</form>";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,18 +21,11 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/calendar.php";
function update_camera($database, $user_id, $camera_id, $camera_type_id, $camera_manufacturer_id, $camera_model, $camera_variation,
$camera_serial_number, $camera_purchase_timestamp, $camera_purchased_new, $camera_access_rights, $camera_icc_profile) {
global $po_user;
$camera_date_of_purchase = check_date_validity($camera_purchase_timestamp);
@ -40,6 +33,14 @@ function update_camera($database, $user_id, $camera_id, $camera_type_id, $camera
$camera_variation = pg_escape_string($camera_variation);
$camera_serial_number = pg_escape_string($camera_serial_number);
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from camera where identifier=$camera_id and users=$po_user[id]"));
if ($result[0] == 0) {
return FALSE;
}
}
pg_query($database, "begin");
if ($camera_type_id=='custom') {
/* camera type has changed */
@ -56,8 +57,8 @@ function update_camera($database, $user_id, $camera_id, $camera_type_id, $camera
values ($camera_type_id, $camera_manufacturer_id, '$camera_model', '$camera_variation', now(), $user_id, $camera_icc_profile)");
if (!$result) {
pg_query($database, "rollback");
print "Failed to create new camera type";
return;
// print "Failed to create new camera type";
return FALSE;
}
}
@ -72,8 +73,8 @@ function update_camera($database, $user_id, $camera_id, $camera_type_id, $camera
where identifier='$camera_id'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to create new camera";
return;
// print "Failed to create new camera";
return FALSE;
}
/* remove old type */
@ -81,32 +82,33 @@ function update_camera($database, $user_id, $camera_id, $camera_type_id, $camera
$result = pg_query($database, "delete from camera_type where identifier='$camera_type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete camera type: $camera_type";
return;
// print "Failed to delete camera type: $camera_type";
return FALSE;
}
}
pg_query($database, "commit");
return TRUE;
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
update_camera($database, $my_user_id[0],
$_REQUEST['item_id'],
$_REQUEST['camera_type_id'],
$_REQUEST['camera_manufacturer_id'],
$_REQUEST['camera_model'],
$_REQUEST['camera_variation'],
$_REQUEST['camera_serial_number'],
$_REQUEST['camera_purchase_timestamp'],
$_REQUEST['camera_purchased_new'],
$_REQUEST['camera_access_rights'],
$_REQUEST['camera_icc_profile']);
update_camera($database, $po_user['id'],
pg_escape_string($_REQUEST['item_id']),
pg_escape_string($_REQUEST['camera_type_id']),
pg_escape_string($_REQUEST['camera_manufacturer_id']),
pg_escape_string($_REQUEST['camera_model']),
pg_escape_string($_REQUEST['camera_variation']),
pg_escape_string($_REQUEST['camera_serial_number']),
pg_escape_string($_REQUEST['camera_purchase_timestamp']),
pg_escape_string($_REQUEST['camera_purchased_new']),
pg_escape_string($_REQUEST['camera_access_rights']),
pg_escape_string($_REQUEST['camera_icc_profile']));
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['camera']['idx']);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,29 +22,30 @@ include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$manufacturer_filter = $_REQUEST['filter'];
$camera_id = $_REQUEST['item'];
$manufacturer_filter = pg_escape_string($_REQUEST['filter']);
$camera_id = pg_escape_string(array_key_exists('item', $_REQUEST) ? $_REQUEST['item'] : 0);
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
$database = site_prolog();
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$camera_current_value = pg_fetch_row(pg_query($database, "select name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights, raw_icc_profile
$camera_current_value = pg_fetch_row(pg_query($database, "select name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights, raw_icc_profile, users
from view_camera where identifier='$camera_id'"));
/* Ensure the user owns it !*/
if (($po_user['id'] != $camera_current_value[9]) &&
($po_user['type'] < $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
$camera_type_current_value = pg_fetch_row(pg_query($database, "select type from camera where identifier='$camera_id'"));
$all_manufacturers = pg_query($database, "select identifier, name from manufacturer order by name");
@ -60,7 +61,7 @@ switch ($manufacturer_filter) {
}
site_header($page_width, "Edit Camera");
site_navigator(6, $my_user_id[1]);
site_navigator(6);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Edit camera", "");
print "&nbsp;<br/>";
@ -69,7 +70,7 @@ display_navigator_box_top($profile_data['camera']['idx'], $profile_data, "100%")
print "&nbsp;<br/>";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>";
print "<td align=\"left\" bgcolor=$color[table_top] colspan=\"5\">\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"5\">\n";
print "<table width=\"100%\">\n<tr>\n";
print "<td align=\"left\"><font class=\"tabletop\">Camera Types</font></td>\n";
print "<td align=\"right\">\n";
@ -104,9 +105,9 @@ if ($num_of_camera_types > 0) {
$camera_type = pg_fetch_row($all_camera_types, $i);
print "<tr>";
if ($camera_type_current_value[0] == $camera_type[0])
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=radio name=\"camera_type_id\" value=\"$camera_type[0]\" checked></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=radio name=\"camera_type_id\" value=\"$camera_type[0]\" checked/></td>";
else
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=radio name=\"camera_type_id\" value=\"$camera_type[0]\"></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=radio name=\"camera_type_id\" value=\"$camera_type[0]\"/></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$camera_type[12]\">$camera_type[1]</a></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera_type[2]</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera_type[3]</td>";
@ -137,7 +138,7 @@ print "</tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"radio\" name=\"camera_type_id\" value=\"custom\">";
print "<input type=\"radio\" name=\"camera_type_id\" value=\"custom\"/>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<select name=camera_manufacturer_id>";
@ -153,10 +154,10 @@ print "</select>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"camera_model\" value=\"$camera_current_value[1]\">";
print "<input type=\"text\" name=\"camera_model\" value=\"$camera_current_value[1]\"/>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"camera_variation\" value=\"$camera_current_value[2]\">";
print "<input type=\"text\" name=\"camera_variation\" value=\"$camera_current_value[2]\"/>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_icc_profiles_combo("camera_icc_profile", $camera_current_value[8]);
@ -166,7 +167,7 @@ print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr><td align=\"left\" bgcolor=$color[table_top] colspan=\"6\"><font class=\"tabletop\">Camera Specific Data</font></td></tr>";
print "<tr><td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"6\"><font class=\"tabletop\">Camera Specific Data</font></td></tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Serial Number</td>";
@ -177,7 +178,7 @@ print "</tr>";
print "<tr>";
print "<td bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"camera_serial_number\" value=\"$camera_current_value[3]\"></td>";
print "<input type=\"text\" name=\"camera_serial_number\" value=\"$camera_current_value[3]\"/></td>";
$date_of_purchase= substr($camera_current_value[4], 0, 10);
print "<td bgcolor=\"$color[table_body]\" >\n";
display_date_input_form("camera_purchase_timestamp", "$date_of_purchase");
@ -192,8 +193,8 @@ print "</tr>";
print "</table>";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['camera']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=Cancel></a>\n";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['camera']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=Cancel/></a>\n";
print "</form>";
display_navigator_box_bottom("100%");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,21 +22,26 @@ include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$client_id = $_REQUEST['client'];
$client_id = pg_escape_string($_REQUEST['client']);
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from client where identifier=$client_id and users=$po_user[id]"));
if ($result[0] == 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
$result = pg_query($database, "delete from client where identifier='$client_id'");
site_epilog($database);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,37 +21,39 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$client_id=$_REQUEST['client'];
$result = pg_fetch_row(pg_query($database, "select identifier, client, last_name, first_name, date_of_creation, value from view_client where users=$my_user_id[0] and identifier=$client_id"));
$client_id = pg_escape_string($_REQUEST['client']);
$result = pg_fetch_row(pg_query($database, "select identifier, client, last_name, first_name, date_of_creation, value, users from view_client where users=$po_user[id] and identifier=$client_id"));
/* Ensure the user owns it !*/
if (($po_user['id'] != $result[7]) &&
($po_user['type'] < $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
$number_of_references = pg_fetch_row(pg_query($database, "select count(submission.identifier)
from client, photo_dupe, photo
where photo_dupe.photo = photo.identifier
and photo_dupe.identifier = submission.photo_dupe
and photo.users = $my_user_id[0]
and photo.users = $po_user[id]
and submission.users = $result[1]"));
site_header($page_width, "Delete Client");
site_navigator(8, $my_user_id[1]);
site_navigator(8);
switch ($number_of_references[0]) {
case 0:
@ -68,7 +70,7 @@ print "&nbsp;<br/>\n";
print "<form method=\"post\" action=\"client.del.2.php\">";
print "<table width=\"100%\">\n";
print "<tr><td align=\"center\">";
print "<input type=\"hidden\" name=\"client\" value=\"$result[0]\">";
print "<input type=\"hidden\" name=\"client\" value=\"$result[0]\"/>";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr bgcolor=\"$color[table_top]\">\n";
@ -82,7 +84,7 @@ print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<a href=\"user.php?user=$result[1]\">$result[2], $result[3]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($result[4], 'date', $my_user_id[0] == "" ? 0 : 1)."</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($result[4], 'date', 1)."</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$result[5]</td>\n";
print "</tr>\n";
print "</table>\n";
@ -90,11 +92,11 @@ print "</table>\n";
print "</td></tr>";
print "<tr><td align=\"center\">&nbsp;<br/>";
if ($number_of_references[0] == 0) {
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\">\n";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\"/>\n";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
}
else {
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"></a>\n";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"/></a>\n";
}
print "</td></tr>";
print "</table>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,30 +23,34 @@ include_once "include/mail.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$client_id = $_REQUEST['client'];
$status = $_REQUEST['status'];
$trusted = $_REQUEST['trusted'];
$client_id = pg_escape_string($_REQUEST['client']);
$status = pg_escape_string($_REQUEST['status']);
$trusted = pg_escape_string($_REQUEST['trusted']);
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from client where identifier=$client_id and users=$po_user[id]"));
if ($result[0] == 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
$error = 0;
$result = pg_query($database, "update client set status='$status', trusted='$trusted' where identifier='$client_id'");
$my_client_id = pg_fetch_row(pg_query($database, "select client from client where identifier='$client_id'"));
send_client_account_change_notification($database, $my_user_id[0], $my_client_id[0]);
send_client_account_change_notification($database, $po_user['id'], $my_client_id[0]);
site_epilog($database);
header("location: my.datebook.php");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,39 +21,41 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$client_id = $_REQUEST['client'];
$result = pg_fetch_row(pg_query($database, " select identifier, client, last_name, first_name, date_of_creation, value, trusted from view_client where users=$my_user_id[0] and identifier=$client_id"));
$client_id = pg_escape_string($_REQUEST['client']);
$result = pg_fetch_row(pg_query($database, " select identifier, client, last_name, first_name, date_of_creation, value, trusted, users from view_client where users=$po_user[id] and identifier=$client_id"));
/* Ensure the user owns it !*/
if (($po_user['id'] != $result[7]) &&
($po_user['type'] < $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
$all_client_states = pg_query($database, " select identifier, value from client_status where identifier!=4");
site_header($page_width, "Edit Client");
site_navigator(8, $my_user_id[1]);
site_navigator(8);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.datebook.php\">My Date Book</a> : Edit client status", "");
print "&nbsp;<br/>\n";
print "<form method=\"post\" action=\"client.edit.2.php\">";
print "<table width=\"100%\">\n";
print "<tr><td align=\"center\">";
print "<input type=\"hidden\" name=\"client\" value=\"$result[0]\">";
print "<input type=\"hidden\" name=\"client\" value=\"$result[0]\"/>";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr bgcolor=$color[table_top]>\n";
print "<tr bgcolor=\"$color[table_top]\">\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\"><font class=\"tabletop\">Edit Client Status</font></td>\n";
print "</tr>\n";
print "<tr>\n";
@ -65,7 +67,7 @@ print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<a href=\"user.php?user=$result[1]\">$result[2], $result[3]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($result[4], 'date', $my_user_id[0] == "" ? 0 : 1)."</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($result[4], 'date', $po_user['id'] == "" ? 0 : 1)."</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<select name=\"status\">";
@ -88,8 +90,8 @@ print "</table>\n";
print "</td></tr>";
print "<tr><td align=\"center\">&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</td></tr>";
print "</table>\n";
print "</form>";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,14 +22,18 @@ include_once "include/config.php";
include_once "include/tools.php";
include_once "include/mime.php";
include_once "$theme/theme.php";
include_once "include/common.php";
include_once "include/site.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
$database = site_prolog();
if ($po_user['id'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$select_folder = $_REQUEST['select_folder'];
$select_folder = pg_escape_string($_REQUEST['select_folder']);
if (!$select_folder) {
/* return if no search criteria exists */
header("location: my.tools.php?selector=2&rule=$rule_identifier");
@ -44,33 +48,24 @@ switch ($type) {
$index_algorithm = "ar_index_histogram:0.1.0";
}
include_once "include/common.php";
include_once "include/site.php";
include_once "include/import.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
site_header($page_width, "Display Tools");
site_navigator(10, $my_user_id[1]);
site_navigator(10);
site_navigator_status("<a href=\"user.php\">Users</a> : My Tools", "");
print "&nbsp;<br/>";
display_navigator_box_top($tools_data['content_indexer']['idx'], $tools_data, "100%");
if ($select_folder == "all") {
$sql_selector = " users = $my_user_id[0] ";
}
else {
$sql_selector = " folder = $select_folder ";
if ($po_user['type'] < $user_type['administrator']) {
$user_sel = " and users = $po_user[id]";
} else {
$user_sel = "";
}
if ($select_folder == "all") {
$sql_selector = " users = $po_user[id] ";
} else {
$sql_selector = " folder = $select_folder $user_sel";
}
$all_photos = pg_query($database, "
select identifier from photo
@ -80,13 +75,13 @@ $all_photos = pg_query($database, "
$num_of_updates = pg_num_rows($all_photos);
for ($i=0; $i < $num_of_updates; $i++) {
$photo = pg_fetch_row($all_photos, $i);
submit_photo($database, $photo[0], $session_id, $index_algorithm);
submit_photo($database, $photo[0], $po_user['session'], $index_algorithm);
}
print "<p align=\"left\">Indexed $num_of_updates photos.</p>";
print "<p>";
print "<a class=\"nodecor\" href=\"my.tools.php?selector=5&rule=$rule_identifier\"><img src=\"$theme/button.back.gif\" border=\"0\"></a>";
print "<a class=\"nodecor\" href=\"my.tools.php?selector=5&rule=$rule_identifier\"><img src=\"$theme/button.back.gif\" border=\"0\"/></a>";
print "</p>";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,20 +21,12 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/common.php";
include_once "include/site.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
$user_id = $_REQUEST['user'];
if ($user_id == "") {
$user_id = $my_user_id[0];
}
site_header($page_width, "Copyright");
site_navigator(4, $my_user_id[1]);
site_header($page_width, "Copyright & License");
site_navigator(4);
site_navigator_status("<a href=help.php>Help</a> : License", "");
print "<table width=\"100%\">";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,15 +22,9 @@ include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
@ -53,14 +47,14 @@ if (($start_hour == $end_hour) && ($start_minute == $end_minute)) {
$end_minute = $start_minute;
}
$remark = $_REQUEST['remark'];
$remark = pg_escape_string($_REQUEST['remark']);
$start_date = "$year-$month-$day $start_hour:$start_minute:00";
$end_date = "$year-$month-$day $end_hour:$end_minute:00";
$start_date = pg_escape_string("$year-$month-$day $start_hour:$start_minute:00");
$end_date = pg_escape_string("$year-$month-$day $end_hour:$end_minute:00");
pg_query($database, "insert into calendar (identifier, users, start_date, end_date, date_of_creation, remark)
values (nextval('calendar_id_sequence'), '$my_user_id[0]', '$start_date', '$end_date', now(), '$remark')");
values (nextval('calendar_id_sequence'), '$po_user[id]', '$start_date', '$end_date', now(), '$remark')");
site_epilog($database);
header("location: my.datebook.php?view=1&year=$year&month=$month&day=$day");
header("location: my.datebook.php?view=1year=$year&month=$month&day=$day");
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,19 +21,11 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
@ -54,16 +46,16 @@ $date = getdate($timestamp);
$dayNameIndex = $date["wday"];
site_header($page_width, "Add Event");
site_navigator(8, $my_user_id[1]);
site_navigator(8);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.datebook.php\">My Date Book</a> : Create new event", "");
print "&nbsp;<br/>\n";
print "<form method=\"post\" action=\"event.add.2.php\">\n";
print "<input type=\"hidden\" name=\"year\" value=\"$year\">\n";
print "<input type=\"hidden\" name=\"month\" value=\"$month\">\n";
print "<input type=\"hidden\" name=\"day\" value=\"$day\">\n";
print "<input type=\"hidden\" name=\"year\" value=\"$year\"/>\n";
print "<input type=\"hidden\" name=\"month\" value=\"$month\"/>\n";
print "<input type=\"hidden\" name=\"day\" value=\"$day\"/>\n";
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"$color[table_background]\" width=\"100%\">\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Date</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><a href=\"my.datebook.php?view=1&year=$year&month=$month&day=$day\">$dayNames[$dayNameIndex], $monthNames[$month] $day, $year</a></td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Date</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><a href=\"my.datebook.php?view=1&amp;year=$year&amp;month=$month&amp;day=$day\">$dayNames[$dayNameIndex], $monthNames[$month] $day, $year</a></td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Start</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">"; display_hour_combo("start_hour", "", "display_null"); print ":&nbsp;"; display_minute_combo("start_minute", ""); print "</td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>End</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">"; display_hour_combo("end_hour", "", "display_null"); print ":&nbsp;"; display_minute_combo("end_minute", ""); print "</td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Remark</td><td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><textarea id=\"template_editor\" wrap=\"hard\" name=\"remark\" rows=\"7\" cols=\"60\"></textarea></td></tr>\n";
@ -71,8 +63,8 @@ print "</table>\n";
print "&nbsp;<br/>\n";
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\"><tr><td align=\"center\">\n";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Event\">\n";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Event\"/>\n";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>\n";
print "</td></tr></table>\n";
print "</form>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,30 +21,31 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$event = pg_escape_string($_REQUEST['event']);
$current = pg_fetch_row(pg_query($database, "select users from calendar where identifier = $event"));
if ($po_user['id'] != $current[0]) {
site_epilog($database);
header("location: login.php");
exit();
}
$event = (int)$_REQUEST['event'];
$year = (int)$_REQUEST['year'];
$month = (int)$_REQUEST['month'];
$day = (int)$_REQUEST['day'];
pg_query($database, "delete from calendar where users=$my_user_id[0] and identifier=$event");
pg_query($database, "delete from calendar where identifier=$event");
site_epilog($database);
header("location: my.datebook.php?view=1&year=$year&month=$month&day=$day");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,31 +21,29 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$event = $_REQUEST['event'];
$event = pg_escape_string($_REQUEST['event']);
$event_data = pg_fetch_row(pg_query($database, "select start_date, end_date, remark from calendar where users=$my_user_id[0] and identifier=$event"));
$event_data = pg_fetch_row(pg_query($database, "select start_date, end_date, remark, users from calendar where identifier=$event"));
$year = (int)substr($event_data[0], 0, 4);
$month = (int)substr($event_data[0], 5, 2);
$day = (int)substr($event_data[0], 8, 2);
if ($po_user['id'] != $event_data[3]) {
site_epilog($database);
header("location: login.php");
exit();
}
$CR = chr(13);
$event_data[2] = str_replace("$CR$CR", "<p>", "$event_data[2]");
$event_data[2] = str_replace("$CR", "<br/>", "$event_data[2]");
@ -55,25 +53,25 @@ $date = getdate($timestamp);
$dayNameIndex = $date["wday"];
site_header($page_width, "Delete Event");
site_navigator(8, $my_user_id[1]);
site_navigator(8);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.datebook.php\">My Date Book</a> : Delete event on $dayNames[$dayNameIndex], $monthNames[$month] $day, $year", "");
print "&nbsp;<br/>\n";
print "<form method=post action=event.del.2.php>\n";
print "<input type=\"hidden\" name=\"event\" value=\"$event\">\n";
print "<input type=\"hidden\" name=\"year\" value=\"$year\">\n";
print "<input type=\"hidden\" name=\"month\" value=\"$month\">\n";
print "<input type=\"hidden\" name=\"day\" value=\"$day\">\n";
print "<input type=\"hidden\" name=\"event\" value=\"$event\"/>\n";
print "<input type=\"hidden\" name=\"year\" value=\"$year\"/>\n";
print "<input type=\"hidden\" name=\"month\" value=\"$month\"/>\n";
print "<input type=\"hidden\" name=\"day\" value=\"$day\"/>\n";
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"$color[table_background]\" width=\"100%\">\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Date</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><a href=\"my.datebook.php?view=1&year=$year&month=$month&day=$day\">$dayNames[$dayNameIndex], $monthNames[$month] $day, $year</a></td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Date</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><a href=\"my.datebook.php?view=1&amp;year=$year&amp;month=$month&amp;day=$day\">$dayNames[$dayNameIndex], $monthNames[$month] $day, $year</a></td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Time</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">".generate_date_html($event_data[0], "time", 0)."-".generate_date_html($event_data[1], "time", 0)."</td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Remark</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">$event_data[2]</td></tr>\n";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\"><tr><td align=\"center\">\n";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\">\n";
print "<a class=\"nodecor\" href=\"my.datebook.php?view=1&year=$year&month=$month&day=$day\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\"/>\n";
print "<a class=\"nodecor\" href=\"my.datebook.php?view=1&amp;year=$year&amp;month=$month&amp;day=$day\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>\n";
print "</td></tr></table>\n";
print "</form>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,16 +21,24 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$database = site_prolog();
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
$event = pg_escape_string($_REQUEST['event']);
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$database = site_prolog();
$current = pg_fetch_row(pg_query($database, "select users from calendar where identifier = $event"));
if ($po_user['id'] != $current[0]) {
site_epilog($database);
header("location: login.php");
exit();
}
$event = $_REQUEST['event'];
$year = (int)$_REQUEST['year'];
$month = (int)$_REQUEST['month'];
$day = (int)$_REQUEST['day'];
@ -48,10 +56,10 @@ if (($start_hour == $end_hour) && ($start_minute == $end_minute)) {
$end_minute = $start_minute;
}
$remark = $_REQUEST['remark'];
$remark = pg_escape_string($_REQUEST['remark']);
$start_date = "$year-$month-$day $start_hour:$start_minute:00";
$end_date = "$year-$month-$day $end_hour:$end_minute:00";
$start_date = pg_escape_string("$year-$month-$day $start_hour:$start_minute:00");
$end_date = pg_escape_string("$year-$month-$day $end_hour:$end_minute:00");
pg_query($database, "update calendar set start_date='$start_date', end_date='$end_date', remark='$remark' where identifier=$event");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,30 +21,29 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$event = $_REQUEST['event'];
$event_data = pg_fetch_row(pg_query($database, "select start_date, end_date, remark from calendar where users=$my_user_id[0] and identifier=$event"));
$event = pg_escape_string($_REQUEST['event']);
$event_data = pg_fetch_row(pg_query($database, "select start_date, end_date, remark, users from calendar where identifier=$event"));
$year = (int)substr($event_data[0], 0, 4);
$month = (int)substr($event_data[0], 5, 2);
$day = (int)substr($event_data[0], 8, 2);
if ($po_user['id'] != $event_data[3]) {
site_epilog($database);
header("location: login.php");
exit();
}
$start_hour = (int)substr($event_data[0], 11, 2);
$start_minute = (int)substr($event_data[0], 14, 2);
@ -56,17 +55,17 @@ $date = getdate($timestamp);
$dayNameIndex = $date["wday"];
site_header($page_width, "Edit Event");
site_navigator(8, $my_user_id[1]);
site_navigator(8);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.datebook.php\">My Date Book</a> : Edit event", "");
print "&nbsp;<br/>\n";
print "<form method=\"post\" action=\"event.edit.2.php\">\n";
print "<input type=\"hidden\" name=\"event\" value=\"$event\">\n";
print "<input type=\"hidden\" name=\"year\" value=\"$year\">\n";
print "<input type=\"hidden\" name=\"month\" value=\"$month\">\n";
print "<input type=\"hidden\" name=\"day\" value=\"$day\">\n";
print "<input type=\"hidden\" name=\"event\" value=\"$event\"/>\n";
print "<input type=\"hidden\" name=\"year\" value=\"$year\"/>\n";
print "<input type=\"hidden\" name=\"month\" value=\"$month\"/>\n";
print "<input type=\"hidden\" name=\"day\" value=\"$day\"/>\n";
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"$color[table_background]\" width=\"100%\">\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Date</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><a href=\"my.datebook.php?view=1&year=$year&month=$month&day=$day\">$dayNames[$dayNameIndex], $monthNames[$month] $day, $year</a></td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Date</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><a href=\"my.datebook.php?view=1&amp;year=$year&amp;month=$month&amp;day=$day\">$dayNames[$dayNameIndex], $monthNames[$month] $day, $year</a></td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Start</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">"; display_hour_combo("start_hour", $start_hour, "display_null"); print ":&nbsp;"; display_minute_combo("start_minute", $start_minute); print "</td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>End</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">"; display_hour_combo("end_hour", $end_hour, "display_null"); print ":&nbsp;"; display_minute_combo("end_minute", $end_minute); print "</td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Remark</td><td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><textarea id=\"template_editor\" wrap=\"hard\" name=\"remark\" rows=\"7\" cols=\"60\">$event_data[2]</textarea></td></tr>\n";
@ -74,8 +73,8 @@ print "</table>\n";
print "&nbsp;<br/>\n";
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\"><tr><td align=\"center\">\n";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">\n";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>\n";
print "<a class=\"nodecor\" href=\"my.datebook.php\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>\n";
print "</td></tr></table>\n";
print "</form>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,26 +21,18 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$event = $_REQUEST['event'];
$event_data = pg_fetch_row(pg_query($database, "select start_date, end_date, remark from calendar where users='$my_user_id[0]' and identifier='$event'"));
$event = pg_escape_string($_REQUEST['event']);
$event_data = pg_fetch_row(pg_query($database, "select start_date, end_date, remark from calendar where users='$po_user[id]' and identifier='$event'"));
$year = (int)substr($event_data[0], 0, 4);
$month = (int)substr($event_data[0], 5, 2);
$day = (int)substr($event_data[0], 8, 2);
@ -56,21 +48,21 @@ $event_data[2] = str_replace("$CR$CR", "<p>", "$event_data[2]");
$event_data[2] = str_replace("$CR", "<br/>", "$event_data[2]");
site_header($page_width, "Display Event");
site_navigator(8, $my_user_id[1]);
site_navigator(8);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.datebook.php\">My Date Book</a> : Event details", "");
print "&nbsp;<br/>";
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"$color[table_background]\" width=\"100%\">\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Date</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><a href=my.datebook.php?view=1&year=$year&month=$month&day=$day>$dayNames[$dayNameIndex], $monthNames[$month] $day, $year</a></td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Date</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\"><a href=my.datebook.php?view=1&amp;year=$year&amp;month=$month&amp;day=$day>$dayNames[$dayNameIndex], $monthNames[$month] $day, $year</a></td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Time</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">".generate_date_html($event_data[0], "time", 0)."-".generate_date_html($event_data[1], "time", 0)."</td></tr>\n";
print "<tr><td align=\"right\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"25%\" nowrap>Remark</td> <td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">$event_data[2]</td></tr>\n";
print "</table>\n";
print "&nbsp;<br/>";
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\"><tr><td align=\"center\">\n";
print "<a class=\"nodecor\" href=\"my.datebook.php?year=$year&month=$month&day=$day&view=$calendar_view\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"></a>\n";
print "<a class=\"nodecor\" href=\"event.edit.php?event=$event\"><img src=\"$theme/button.edit.gif\" border=\"0\" alt=\"Edit\"></a>\n";
print "<a class=\"nodecor\" href=\"event.del.php?event=$event\"><img src=\"$theme/button.delete.gif\" border=\"0\" alt=\"Delete\"></a>\n";
print "<a class=\"nodecor\" href=\"my.datebook.php?year=$year&amp;month=$month&amp;day=$day&view=$calendar_view\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"/></a>\n";
print "<a class=\"nodecor\" href=\"event.edit.php?event=$event\"><img src=\"$theme/button.edit.gif\" border=\"0\" alt=\"Edit\"/></a>\n";
print "<a class=\"nodecor\" href=\"event.del.php?event=$event\"><img src=\"$theme/button.delete.gif\" border=\"0\" alt=\"Delete\"/></a>\n";
print "</td></tr></table>\n";
print "&nbsp;<br/>";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -19,26 +19,42 @@
include_once "include/vars.php";
include_once "include/config.php";
include_once "include/common.php";
include_once "include/site.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
$database = site_prolog();
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
include_once "include/common.php";
$export_id = $_REQUEST['export_id'];
$file_name = $tmp_volume_path . "/po.export." . $export_id . ".tar";
$file = fopen($file_name , "r");
$contents = fread ($file, filesize($file_name));
$file = fopen($file_name , "rb");
if ($file == false) {
header("HTTP/1.1 404 Not found");
exit();
}
$stats = stat($file_name);
header("Content-Length: $stats[7]");
header("Content-Type: application/tar");
header("Content-Disposition: filename=po.export." . $export_id . ".tar");
/* read 1M chunks */
while (!feof($file)) {
echo fread($file, 1*(1024*1024));
}
fclose($file);
unlink($file_name);
header("Content-type: application/tar");
header("Content-Disposition: filename=po.export." . $export_id . ".tar");
print "$contents";
exit;
site_epilog($database);
exit();
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -20,31 +20,23 @@
include_once "include/vars.php";
include_once "include/config.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/mime.php";
include_once "include/common.php";
include_once "include/site.php";
include_once "include/export.php";
include_once "include/orderby.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type, preferences from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$source_photo_id = $_REQUEST['source_photo'];
$source_folder_id = $_REQUEST['source_folder'];
$source_album_id = $_REQUEST['source_album'];
$source_photo_id = pg_escape_string($_REQUEST['source_photo']);
$source_folder_id = pg_escape_string($_REQUEST['source_folder']);
$source_album_id = pg_escape_string($_REQUEST['source_album']);
$export_type = $_REQUEST['export_type'];
if ($source_photo_id != "") {
@ -52,25 +44,25 @@ if ($source_photo_id != "") {
$photo_data_single[2] = makeZanza($photo_data_single[3] ? $photo_data_single[3] : $photo_data_single[2], "No Title");
$container_name = pg_fetch_row(pg_query($database, "select caption from folder where identifier=$photo_data_single[1]"));
$container_name[0] = makeZanza($container_name[0], "No Caption");
$navigator_status_message = "<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$my_user_id[0]\">My folders and albums</a> : <a href=\"folder.php?folder=$photo_data_single[1]\">$container_name[0]</a> : <a href=\"photo.php?photo=$source_photo_id\">$photo_data_single[2]</a> : Exporting Photos";
$navigator_status_message = "<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$po_user[id]\">My folders and albums</a> : <a href=\"folder.php?folder=$photo_data_single[1]\">$container_name[0]</a> : <a href=\"photo.php?photo=$source_photo_id\">$photo_data_single[2]</a> : Exporting Photos";
} elseif ($source_album_id != "") {
$container_name = pg_fetch_row(pg_query($database, "select caption from album where identifier='$source_album_id'"));
$container_name[0] = makeZanza($container_name[0], "No Caption");
$navigator_status_message = "<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$my_user_id[0]\">My folders and albums</a> : <a href=\"album.php?album=$source_album_id\">$container_name[0]</a> : Exporting Photos";
$navigator_status_message = "<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$po_user[id]\">My folders and albums</a> : <a href=\"album.php?album=$source_album_id\">$container_name[0]</a> : Exporting Photos";
} elseif ($source_folder_id != "") {
$container_name = pg_fetch_row(pg_query($database, "select caption from folder where identifier='$source_folder_id'"));
$container_name[0] = makeZanza($container_name[0], "No Caption");
$navigator_status_message = "<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$my_user_id[0]\">My folders and albums</a> : <a href=\"folder.php?folder=$source_folder_id\">$container_name[0]</a> : Exporting Photos";
$navigator_status_message = "<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$po_user[id]\">My folders and albums</a> : <a href=\"folder.php?folder=$source_folder_id\">$container_name[0]</a> : Exporting Photos";
}
$photos_in_spooler = pg_query($database, "
select photo.identifier
from photo_spooler, photo
where photo.identifier = photo_spooler.photo
and photo_spooler.users = $my_user_id[0]");
and photo_spooler.users = $po_user[id]");
site_header($page_width, "Export Photos");
site_navigator(5, $my_user_id[1]);
site_navigator(5);
site_navigator_status($navigator_status_message, "");
print "<div align=\"left\">";
@ -88,23 +80,21 @@ print "Creating temporary directory <b>$temporary_directory</b> ... ";
$old_mask = umask(0000);
if (!mkdir($temporary_directory)) {
print "<font color=\"red\">failed</font> [mkdir $temporary_directory]<br/>";
}
else {
} else {
print "done.<br/>";
}
switch($export_type) {
case photo:
case photo_xml_iptc:
case photo_iptc:
case "photo":
case "photo_xml_iptc":
case "photo_iptc":
default:
break;
case photo_xml:
case "photo_xml":
print "Creating XML photo description file <b>$temporary_directory/data.xml</b> ... ";
if (($xml_file_desciptor = fopen ($temporary_directory."/data.xml", "w+")) == FALSE) {
print "<font color=\"red\">failed</font> [fopen $temporary_directory/data.xml]<br/>";
}
else {
} else {
print "done.<br/>";
}
@ -121,11 +111,11 @@ for ($photos = 0; $photos < pg_num_rows($photos_in_spooler); $photos++) {
/* optimize query, by excluding fields that are not used when not exporting shooting data */
switch($export_type) {
case photo_xml_iptc:
case photo_iptc:
case photo_xml:
case "photo_xml_iptc":
case "photo_iptc":
case "photo_xml":
$photo_data = pg_fetch_row(pg_query($database, "
select folder, author, title, keyword, caption, copyright_statement, date_of_exposure,
select folder, author, title, '' as keyword, caption, copyright_statement, date_of_exposure,
location, storage_location, storage_index,
access_rights, hide_original,
camera, lens, filter, film, flash, scanner, focal_length, aperture, shutter,
@ -137,8 +127,17 @@ for ($photos = 0; $photos < pg_num_rows($photos_in_spooler); $photos++) {
and photo.identifier = photo_tech.photo
and photo.identifier = $photo_identifier[0]
and photo_dupe.key = 1"));
/* Get any keywords for the photo... */
$res = pg_query($database, "select keyword from photo_keywords where photo=$photo_identifier[identifier]");
$keywords = FALSE;
for ($i=0; $i < pg_num_rows($res); $i++) {
$dat = pg_fetch_assoc($res);
$keywords[$i] = $dat['keyword'];
}
break;
case photo:
case "photo":
default:
$photo_data = pg_fetch_row(pg_query($database, "
select photo_version.large_image_path, photo_version.original_image_name
@ -185,15 +184,15 @@ for ($photos = 0; $photos < pg_num_rows($photos_in_spooler); $photos++) {
/* export shooting data */
switch($export_type) {
case photo:
case "photo":
default:
break;
case photo_xml:
case "photo_xml":
$image_data = array ("file" => array(0 => array("name" => "", "remark" => "", "master" => "")),
"folder" => $photo_data[0],
"author" => $photo_data[1],
"title" => $photo_data[2],
"keyword" => $photo_data[3],
"keywords" => $keywords,
"caption" => $photo_data[4],
"copyright" => $photo_data[5],
"date_of_exposure" => $photo_data[6],
@ -236,8 +235,8 @@ for ($photos = 0; $photos < pg_num_rows($photos_in_spooler); $photos++) {
fwrite($xml_file_desciptor, create_xml_folder_footer());
print "<li>Appending XML data to <b>$temporary_directory/data.xml</b>.</li>";
break;
case photo_xml_iptc:
case photo_iptc:
case "photo_xml_iptc":
case "photo_iptc":
print "&nbsp;<br/>\n";
print "<font color=\"red\">IPTC embedding is not yet implemented.</font></p>";
}
@ -280,11 +279,11 @@ for ($photos = 0; $photos < pg_num_rows($photos_in_spooler); $photos++) {
switch($export_type) {
case photo:
case photo_xml_iptc:
case photo_iptc:
case "photo_xml_iptc":
case "photo_iptc":
default:
break;
case photo_xml:
case "photo_xml":
print "Closing XML description file<br/>";
fwrite($xml_file_desciptor, create_xml_bulkupload_footer());
fclose($xml_file_desciptor);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,12 +23,6 @@ include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
function add_film($database, $user_id, $film_type_id, $film_manufacturer_id,
$film_model, $film_iso, $film_format_id, $film_access_rights) {
@ -54,15 +48,22 @@ function add_film($database, $user_id, $film_type_id, $film_manufacturer_id,
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
}
add_film($database,
$po_user['id'],
pg_escape_string($_REQUEST['film_type_id']),
pg_escape_string($_REQUEST['film_manufacturer_id']),
pg_escape_string($_REQUEST['film_model']),
pg_escape_string($_REQUEST['film_iso']),
pg_escape_string($_REQUEST['film_format_id']),
pg_escape_string($_REQUEST['film_access_rights']));
add_film($database, $my_user_id[0], $_REQUEST['film_type_id'], $_REQUEST['film_manufacturer_id'],
$_REQUEST['film_model'], $_REQUEST['film_iso'], $_REQUEST['film_format_id'], $_REQUEST['film_access_rights']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['film']['idx']);
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,25 +22,17 @@ include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$manufacturer_filter = $_REQUEST['filter'];
$manufacturer_filter = pg_escape_string($_REQUEST['filter']);
$all_manufacturer = pg_query($database, "select identifier, name from manufacturer order by name");
switch ($manufacturer_filter) {
@ -53,7 +45,7 @@ switch ($manufacturer_filter) {
}
site_header($page_width, "Add Film");
site_navigator(6, $my_user_id[1]);
site_navigator(6);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Add new film", "");
print "&nbsp;<br/>";
@ -65,7 +57,7 @@ if (pg_num_rows($all_manufacturer) == 0) {
print "<tr><td align=\"center\" >\n";
print "You must add manufacturers, before adding films";
print "</td></tr><tr><td>&nbsp;<td></tr><tr><td align=\"center\"><p>\n";
print "<a href=\"manufacturer.add.php\"><img src=\"$theme/button.add.manufacturer.gif\" border=\"0\" alt=\"Add manufacturer\"></a>\n";
print "<a href=\"manufacturer.add.php\"><img src=\"$theme/button.add.manufacturer.gif\" border=\"0\" alt=\"Add manufacturer\"/></a>\n";
print "</td></tr>\n";
print "</table>\n";
display_navigator_box_bottom("100%");
@ -113,7 +105,7 @@ if ($num_of_film_types > 0) {
for ($i=0; $i < $num_of_film_types; $i++) {
$film_type = pg_fetch_row($all_film_types, $i);
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"radio\" name=\"film_type_id\" value=\"$film_type[0]\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"radio\" name=\"film_type_id\" value=\"$film_type[0]\"/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$film_type[5]\">$film_type[1]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$film_type[2]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$film_type[3]</td>\n";
@ -139,7 +131,7 @@ print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"16%\">Format
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"film_type_id\" value=\"custom\" checked></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"film_type_id\" value=\"custom\" checked/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><select name=\"film_manufacturer_id\">\n";
$num_of_manufacturers = pg_num_rows($all_manufacturer);
for ($i=0; $i < $num_of_manufacturers; $i++) {
@ -147,7 +139,7 @@ for ($i=0; $i < $num_of_manufacturers; $i++) {
print "<option value=\"$manufacturer[0]\">$manufacturer[1]";
}
print "</select></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"film_model\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"film_model\"/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >\n";
$all_film_iso = pg_query($database, "select identifier, value from film_iso order by value");
$num_of_film_iso = pg_num_rows($all_film_iso);
@ -183,8 +175,8 @@ print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Film\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['film']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Film\"/>\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['film']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>\n";
print "</form>\n";
display_navigator_box_bottom("100%");

View File

@ -1,57 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
function delete_film($database, $film_id) {
if (film_id!="") {
pg_query($database, "begin");
$number_of_filmes_of_same_type = pg_fetch_row(pg_query($database, "select count(identifier) from film where type=(select type from film where identifier='$film_id')"));
if ($number_of_filmes_of_same_type[0] == 1) {
$film_type_to_remove = pg_fetch_row(pg_query($database, "select type from film where identifier='$film_id'"));
}
$result = pg_query($database, "delete from film where identifier='$film_id'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete film: $film_id";
return;
}
if ($number_of_filmes_of_same_type[0] == 1) {
$result = pg_query($database, "delete from film_type where identifier='$film_type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete film type: $film_type_to_remove";
return;
}
}
pg_query($database, "commit");
}
}
$database = site_prolog();
delete_film($database, $_REQUEST['item_id']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['film']['idx']);
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,29 +22,31 @@ include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$film_id = $_REQUEST['item'];
$film_id = pg_escape_string($_REQUEST['item']);
$number_of_references = pg_fetch_row(pg_query($database, "select number_of_film_references($film_id)"));
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from film where identifier=$film_id and users=$po_user[id]"));
if ($result[0] == 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
site_header($page_width, "Delete Film");
site_navigator(6, $my_user_id[1]);
site_navigator(6);
switch ($number_of_references[0]) {
case 0:
@ -61,7 +63,7 @@ print "&nbsp;<br/>";
display_navigator_box_top($profile_data['film']['idx'], $profile_data, "100%");
print "&nbsp;<br/>";
print "<form method=\"post\" action=\"film.del.2.php?&item_id=$film_id\">";
print "<form method=\"post\" action=\"profile.del.2.php?item_id=$film_id&amp;type=film\">";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"5\"><font class=\"tabletop\">Remove Film</font></td>\n";
@ -88,11 +90,11 @@ print "</table>";
print "&nbsp;<br/>";
if ($number_of_references[0]==0) {
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['film']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\"/>\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['film']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>\n";
}
else {
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['film']['idx']."\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"></a>\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['film']['idx']."\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"/></a>\n";
}
print "</form>";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,17 +23,9 @@ include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
function update_film($database, $user_id, $film_id, $film_type_id, $film_manufacturer_id,
$film_model, $film_iso, $film_format, $film_access_rights) {
$film_model = pg_escape_string($film_model);
pg_query($database, "begin");
if ($film_type_id=='custom') {
/* film type has changed */
@ -75,15 +67,31 @@ function update_film($database, $user_id, $film_id, $film_type_id, $film_manufac
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
update_film($database, $my_user_id[0], $_REQUEST['item_id'], $_REQUEST['film_type_id'], $_REQUEST['film_manufacturer_id'],
$_REQUEST['film_model'], $_REQUEST['film_iso'], $_REQUEST['film_format_id'], $_REQUEST['film_access_rights']);
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from film where identifier=$film_id and users=$po_user[id]"));
if ($result[0] == 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
update_film($database, $po_user['id'],
pg_escape_string($_REQUEST['item_id']),
pg_escape_string($_REQUEST['film_type_id']),
pg_escape_string($_REQUEST['film_manufacturer_id']),
pg_escape_string($_REQUEST['film_model']),
pg_escape_string($_REQUEST['film_iso']),
pg_escape_string($_REQUEST['film_format_id']),
pg_escape_string($_REQUEST['film_access_rights']));
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['film']['idx']);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,26 +22,28 @@ include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$manufacturer_filter = $_REQUEST['filter'];
$film_id = $_REQUEST['item'];
$manufacturer_filter = pg_escape_string($_REQUEST['filter']);
$film_id = pg_escape_string($_REQUEST['item']);
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from film where identifier=$film_id and users=$po_user[id]"));
if ($result[0] == 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
$film_current_value = pg_fetch_row(pg_query($database, "select name, model, iso, format, access_rights from view_film where identifier='$film_id'"));
$film_type_current_value = pg_fetch_row(pg_query($database, "select type from film where identifier='$film_id'"));
@ -56,7 +58,7 @@ switch ($manufacturer_filter) {
}
site_header($page_width, "Edit Film");
site_navigator(6, $my_user_id[1]);
site_navigator(6);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Edit film", "");
print "&nbsp;<br/>";
@ -102,9 +104,9 @@ if ($num_of_film_types > 0) {
$film_type = pg_fetch_row($all_film_types, $i);
print "<tr>";
if ($film_type_current_value[0] == $film_type[0])
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"film_type_id\" value=\"$film_type[0]\" checked></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"film_type_id\" value=\"$film_type[0]\" checked/></td>";
else
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"film_type_id\" value=\"$film_type[0]\"></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"film_type_id\" value=\"$film_type[0]\"/></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$film_type[5]\">$film_type[1]</a></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$film_type[2]</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$film_type[3]</td>";
@ -133,7 +135,7 @@ print "</tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"radio\" name=\"film_type_id\" value=\"custom\">";
print "<input type=\"radio\" name=\"film_type_id\" value=\"custom\"/>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<select name=film_manufacturer_id>";
@ -148,7 +150,7 @@ print "</select>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"film_model\" value=\"$film_current_value[1]\">";
print "<input type=\"text\" name=\"film_model\" value=\"$film_current_value[1]\"/>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >\n";
print "<select name=\"film_iso\">";
@ -191,8 +193,8 @@ print "</tr>";
print "</table>";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['film']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['film']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>\n";
print "</form>";
display_navigator_box_bottom("100%");

View File

@ -1,74 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/calendar.php";
function add_filter($database, $user_id,
$filter_type_id, $filter_manufacturer_id, $filter_model,
$filter_variation, $filter_date_of_purchase, $filter_purchased_new, $filter_access_rights) {
$filter_date_of_purchase = check_date_validity($filter_purchase_timestamp);
$filter_model = pg_escape_string($filter_model);
$filter_variation = pg_escape_string($filter_variation);
if ($filter_type_id=='custom') {
$new_filter_type_id = pg_fetch_row(pg_query($database, "select nextval('filter_type_id_sequence')"));
$filter_type_id = $new_filter_type_id[0];
$result = pg_query($database, "insert into filter_type (identifier, manufacturer, model, variation, last_modified_date, last_modifying_users)
values ($filter_type_id, $filter_manufacturer_id, '$filter_model', '$filter_variation', now(), $user_id)");
if (!$result) {
print "Failed to create new filter type";
return;
}
}
$result = pg_query($database, "insert into filter (identifier, type, users, date_of_purchase, purchased_new, access_rights)
values (nextval('filter_id_sequence'), '$filter_type_id', '$user_id', $filter_date_of_purchase, '$filter_purchased_new', '$filter_access_rights')");
if (!$result) {
print "Failed to create new filter";
}
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
site_epilog($database);
header("location: login.php");
exit();
}
add_filter($database, $my_user_id[0], $_REQUEST['filter_type_id'], $_REQUEST['filter_manufacturer_id'],
$_REQUEST['filter_model'], $_REQUEST['filter_variation'],
$_REQUEST['filter_purchase_timestamp'], $_REQUEST['filter_purchased_new'], $_REQUEST['filter_access_rights']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['filter']['idx']);
?>

View File

@ -1,182 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$manufacturer_filter = $_REQUEST['filter'];
switch ($manufacturer_filter) {
case 'All':
case '':
$all_filter_type = pg_query($database, "select identifier, name, model, variation, url from view_filter_type order by name");
break;
default:
$all_filter_type = pg_query($database, "select identifier, name, model, variation, url from view_filter_type where view_filter_type.name='$manufacturer_filter' order by name");
}
site_header($page_width, "Add Filter");
site_navigator(6, $my_user_id[1]);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Add new filter", "");
print "&nbsp;<br/>";
display_navigator_box_top($profile_data['filter']['idx'], $profile_data, "100%");
print "&nbsp;<br/>";
$all_manufacturer = pg_query($database, "select identifier, name from manufacturer order by name");
$num_of_manufacturers = pg_num_rows($all_manufacturer);
if ($num_of_manufacturers == 0) {
print "<table border=\"0\" width=\"100%\">\n";
print "<tr><td align=\"center\" >\n";
print "You must add manufacturers, before adding filters";
print "</td></tr><tr><td>&nbsp;<td></tr><tr><td align=\"center\"><p>\n";
print "<a href=\"manufacturer.add.php\"><img src=\"$theme/button.add.manufacturer.gif\" border=\"0\" alt=\"Add manufacturer\"></a>\n";
print "</td></tr>\n";
print "</table>\n";
display_navigator_box_bottom("100%");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
exit;
}
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\">\n";
print "<table width=\"100%\">\n<tr>\n";
print "<td align=\"left\"><font class=\"tabletop\">Filter Types</font></td>\n";
print "<td align=\"right\">\n";
print "<form>\n";
print "<select onchange=\"location = this.options[this.selectedIndex].value;\">\n";
print "<option value=\"filter.add.php\">All";
for ($i=0; $i < $num_of_manufacturers; $i++) {
$manufacturer = pg_fetch_row($all_manufacturer, $i);
if ($manufacturer[1]==$manufacturer_filter)
print "<option value=\"filter.add.php?filter=$manufacturer[1]\" selected>$manufacturer[1]";
else
print "<option value=\"filter.add.php?filter=$manufacturer[1]\">$manufacturer[1]";
}
print "</select>";
print "</form>\n";
print "</td></tr>\n</table>\n";
print "</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"4%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Manufacturer</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"21%\">Variation</td>\n";
print "</tr>\n";
print "<form method=\"post\" action=\"filter.add.2.php\">\n";
$num_of_filters = pg_num_rows($all_filter_type);
if ($num_of_filters > 0) {
for ($i=0; $i < $num_of_filters; $i++) {
$filter = pg_fetch_row($all_filter_type, $i);
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"radio\" name=\"filter_type_id\" value=\"$filter[0]\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$filter[4]\">$filter[1]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$filter[2]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$filter[3]</td>\n";
print "</tr>\n";
}
}
else
print "<tr><td colspan=\"4\" align=\"left\" bgcolor=\"$color[table_body]\" >No filter types found.</td></tr>\n";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\"><font class=\"tabletop\">New Filter Type</font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"4%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Manufacturer</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"21%\">Variation</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=radio name=\"filter_type_id\" value=custom checked></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><select name=\"filter_manufacturer_id\">\n";
for ($i=0; $i < $num_of_manufacturers; $i++) {
$manufacturer = pg_fetch_row($all_manufacturer, $i);
print "<option value=$manufacturer[0]>$manufacturer[1]";
}
print "</select></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"filter_model\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"filter_variation\"></td>\n";
print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr><td colspan=\"4\" bgcolor=\"$color[table_top]\"><font class=\"tabletop\">Filter Specific Data</font></td></tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Purchase Date</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >New</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Access</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td bgcolor=\"$color[table_body]\" >\n";
display_date_input_form("filter_purchase_timestamp", "");
print "</td>\n";
print "<td bgcolor=\"$color[table_body]\" >\n"; display_yes_no_combo("filter_purchased_new", "t"); print "</td>\n";
print "<td bgcolor=\"$color[table_body]\" >\n"; display_access_combo("filter_access_rights", "t", ""); print "</td>\n";
print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Filter\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['filter']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "</form>\n";
display_navigator_box_bottom("100%");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
?>

View File

@ -1,57 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
function delete_filter($database, $filter_id) {
if (filter_id!="") {
pg_query($database, "begin");
$number_of_filteres_of_same_type = pg_fetch_row(pg_query($database, "select count(identifier) from filter where type=(select type from filter where identifier='$filter_id')"));
if ($number_of_filteres_of_same_type[0] == 1) {
$filter_type_to_remove = pg_fetch_row(pg_query($database, "select type from filter where identifier='$filter_id'"));
}
$result = pg_query($database, "delete from filter where identifier='$filter_id'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete filter: $filter_id";
return;
}
if ($number_of_filteres_of_same_type[0] == 1) {
$result = pg_query($database, "delete from filter_type where identifier='$filter_type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete filter type: $filter_type_to_remove";
return;
}
}
pg_query($database, "commit");
}
}
$database = site_prolog();
delete_filter($database, $_REQUEST['item_id']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['filter']['idx']);
?>

View File

@ -1,95 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/calendar.php";
function update_filter($database, $user_id, $filter_id, $filter_type_id, $filter_manufacturer_id,
$filter_model, $filter_variation, $filter_date_of_purchase, $filter_purchased_new, $filter_access_rights) {
$filter_date_of_purchase = check_date_validity($filter_purchase_timestamp);
$filter_model = pg_escape_string($filter_model);
$filter_variation = pg_escape_string($filter_variation);
pg_query($database, "begin");
if ($filter_type_id=='custom') {
/* filter type has changed */
$number_of_filteres_of_same_type = pg_fetch_row(pg_query($database, "select count(identifier) from filter where type=(select type from filter where identifier='$filter_id')"));
if ($number_of_filteres_of_same_type[0] == 1) {
/* there was only one filter of this kind, so we have to remove it */
$filter_type_to_remove = pg_fetch_row(pg_query($database, "select type from filter where identifier='$filter_id'"));
}
/* create new type */
$new_filter_type_id = pg_fetch_row(pg_query($database, "select nextval('filter_type_id_sequence')"));
$filter_type_id = $new_filter_type_id[0];
$result = pg_query($database, "insert into filter_type (identifier, manufacturer, model, variation, last_modified_date, last_modifying_users)
values ($filter_type_id, $filter_manufacturer_id, '$filter_model', '$filter_variation', now(), $user_id)");
if (!$result) {
pg_query($database, "rollback");
print "Failed to create new filter type";
return;
}
}
/* add filter */
$result = pg_query($database, "update filter set type=$filter_type_id, date_of_purchase=$filter_date_of_purchase, purchased_new='$filter_purchased_new', access_rights='$filter_access_rights' where identifier='$filter_id'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to create new filter";
return;
}
/* remove old type */
if ($filter_type_to_remove) {
$result = pg_query($database, "delete from filter_type where identifier='$filter_type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete filter type: $filter_type";
return;
}
}
pg_query($database, "commit");
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
site_epilog($database);
header("location: login.php");
exit();
}
update_filter($database, $my_user_id[0], $_REQUEST['item_id'], $_REQUEST['filter_type_id'], $_REQUEST['filter_manufacturer_id'],
$_REQUEST['filter_model'], $_REQUEST['filter_variation'],
$_REQUEST['filter_purchase_timestamp'], $_REQUEST['filter_purchased_new'], $_REQUEST['filter_access_rights']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['filter']['idx']);
?>

View File

@ -1,186 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$manufacturer_filter = $_REQUEST['filter'];
$filter_id = $_REQUEST['item'];
$filter_current_value = pg_fetch_row(pg_query($database, "select name, model, variation, date_of_purchase, purchased_new, access_rights from view_filter where identifier='$filter_id'"));
$filter_type_current_value = pg_fetch_row(pg_query($database, "select type from filter where identifier='$filter_id'"));
$all_manufacturer = pg_query($database, "select identifier, name from manufacturer order by name");
$num_of_manufacturers = pg_num_rows($all_manufacturer);
switch ($manufacturer_filter) {
case 'All':
case '':
$all_filter_type = pg_query($database, "select identifier, name, model, variation, url from view_filter_type order by name");
break;
default:
$all_filter_type = pg_query($database, "select identifier, name, model, variation, url from view_filter_type where name='$manufacturer_filter' or identifier='$filter_type_current_value[0]' order by name");
}
site_header($page_width, "Edit Filter");
site_navigator(6, $my_user_id[1]);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Edit filter", "");
print "&nbsp;<br/>";
display_navigator_box_top($profile_data['filter']['idx'], $profile_data, "100%");
print "&nbsp;<br/>";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\">\n";
print "<table width=\"100%\">\n<tr>\n";
print "<td align=\"left\"><font class=\"tabletop\">Filter Types</font></td>\n";
print "<td align=\"right\">\n";
print "<form>\n";
print "<select onchange=\"location = this.options[this.selectedIndex].value;\">\n";
print "<option value=\"filter.edit.php\">All";
for ($i=0; $i < $num_of_manufacturers; $i++) {
$manufactrurer = pg_fetch_row($all_manufacturer, $i);
if ($manufactrurer[1]==$manufacturer_filter)
print "<option value=\"filter.add.php?filter=$manufactrurer[1]\" selected>$manufactrurer[1]";
else
print "<option value=\"filter.add.php?filter=$manufactrurer[1]\">$manufactrurer[1]";
}
print "</select>";
print "</form>\n";
print "</td></tr>\n</table>\n";
print "</td>";
print "</tr>";
print "<form method=\"post\" action=\"filter.edit.2.php?item_id=$filter_id\">";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"4%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Manufacturer</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"21%\">Variation</td>\n";
print "</tr>\n";
$num_of_filters = pg_num_rows($all_filter_type);
if ($num_of_filters > 0) {
for ($i=0; $i < $num_of_filters; $i++) {
$filter = pg_fetch_row($all_filter_type, $i);
print "<tr>";
if ($filter_type_current_value[0] == $filter[0])
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"filter_type_id\" value=\"$filter[0]\" checked></td>";
else
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"filter_type_id\" value=\"$filter[0]\"></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$filter[4]\">$filter[1]</a></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$filter[2]</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$filter[3]</td>";
print "</tr>";
}
}
else
print "<tr><td colspan=6 align=\"left\" bgcolor=\"$color[table_body]\" >No filter types found.</td></tr>";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"6\"><font class=\"tabletop\">Edit Filter Type</font></td>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"4%\"></td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Manufacturer</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Model</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"21%\">Variation</td>";
print "</tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"radio\" name=\"filter_type_id\" value=\"custom\">";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<select name=\"filter_manufacturer_id\">";
for ($i=0; $i < $num_of_manufacturers; $i++) {
$manufacturer = pg_fetch_row($all_manufacturer, $i);
if ($filter_current_value[0]==$manufacturer[1])
print "<option value=\"$manufacturer[0]\" selected>$manufacturer[1]";
else
print "<option value=\"$manufacturer[0]\">$manufacturer[1]";
}
print "</select>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"filter_model\" value=\"$filter_current_value[1]\">";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"filter_variation\" value=\"$filter_current_value[2]\">";
print "</td>";
print "</tr>";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr><td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"6\"><font class=\"tabletop\">Filter Specific Data</font></td></tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Purchase Date</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Purchased New</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Access</td>";
print "</tr>";
print "<tr>";
$date_of_purchase= substr($filter_current_value[3], 0, 10);
print "<td bgcolor=\"$color[table_body]\" >";
display_date_input_form("filter_purchase_timestamp", "$date_of_purchase");
print "</td>\n";
print "<td bgcolor=\"$color[table_body]\" >"; display_yes_no_combo("filter_purchased_new", $filter_current_value[4]); print "</td>\n";
print "<td bgcolor=\"$color[table_body]\" >"; display_access_combo("filter_access_rights", $filter_current_value[5], ""); print "</td>\n";
print "</tr>";
print "</table>";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['filter']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "</form>";
display_navigator_box_bottom("100%");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
?>

View File

@ -1,76 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/calendar.php";
function add_flash($database, $user_id,
$flash_type_id, $flash_manufacturer_id, $flash_model, $flash_variation,
$flash_serial_number, $flash_purchase_timestamp,
$flash_purchased_new, $flash_access_rights) {
$flash_date_of_purchase = check_date_validity($flash_purchase_timestamp);
$flash_model = pg_escape_string($flash_model);
$flash_variation = pg_escape_string($flash_variation);
$flash_serial_number = pg_escape_string($flash_serial_number);
if ($flash_type_id=='custom') {
$new_flash_type_id = pg_fetch_row(pg_query($database, "select nextval('flash_type_id_sequence')"));
$flash_type_id = $new_flash_type_id[0];
$result = pg_query($database, "insert into flash_type (identifier, manufacturer, model, variation, last_modified_date, last_modifying_users)
values ($flash_type_id, $flash_manufacturer_id, '$flash_model', '$flash_variation', now(), $user_id)");
if (!$result) {
print "Failed to create new flash type";
return;
}
}
$result = pg_query($database, "insert into flash (identifier, type, users, serial_number, date_of_purchase, purchased_new, access_rights)
values (nextval('flash_id_sequence'), '$flash_type_id', '$user_id', '$flash_serial_number', $flash_date_of_purchase, '$flash_purchased_new', '$flash_access_rights')");
if (!$result) {
print "Failed to create new flash";
}
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
site_epilog($database);
header("location: login.php");
exit();
}
add_flash($database, $my_user_id[0], $_REQUEST['flash_type_id'], $_REQUEST['flash_manufacturer_id'], $_REQUEST['flash_model'], $_REQUEST['flash_variation'],
$_REQUEST['flash_serial_number'], $_REQUEST['flash_purchase_timestamp'], $_REQUEST['flash_purchased_new'], $_REQUEST['flash_access_rights']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['flash']['idx']);
?>

View File

@ -1,184 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$manufacturer_filter = $_REQUEST['filter'];
$manufacturer = pg_query($database, "select identifier, name from manufacturer order by name");
switch ($manufacturer_filter) {
case 'All':
case '':
$flash_type = pg_query($database, "select identifier, name, model, variation, url from view_flash_type order by name");
break;
default:
$flash_type = pg_query($database, "select identifier, name, model, variation, url from view_flash_type where view_flash_type.name='$manufacturer_filter' order by name");
}
site_header($page_width, "Add Flash");
site_navigator(6, $my_user_id[1]);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Add new flash", "");
print "&nbsp;<br/>";
display_navigator_box_top($profile_data['flash']['idx'], $profile_data, "100%");
print "&nbsp;<br/>";
if (pg_num_rows($manufacturer) == 0) {
print "<table border=\"0\" width=\"100%\">\n";
print "<tr><td align=\"center\" >\n";
print "You must add manufacturers, before adding flashes";
print "</td></tr><tr><td>&nbsp;<td></tr><tr><td align=\"center\"><p>\n";
print "<a href=\"manufacturer.add.php\"><img src=\"$theme/button.add.manufacturer.gif\" border=\"0\" alt=\"Add manufacturer\"></a>\n";
print "</td></tr>\n";
print "</table>\n";
display_navigator_box_bottom("100%");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
exit;
}
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\">\n";
print "<table width=\"100%\">\n<tr>\n";
print "<td align=\"left\"><font class=\"tabletop\">Flash Types</font></td>\n";
print "<td align=\"right\">\n";
print "<form>\n";
print "<select onchange=\"location = this.options[this.selectedIndex].value;\">\n";
print "<option value=\"flash.add.php\">All";
for ($i=0; $i < pg_num_rows($manufacturer); $i++) {
$r = pg_fetch_row($manufacturer, $i);
if ($r[1]==$manufacturer_filter)
print "<option value=\"flash.add.php?filter=$r[1]\" selected>$r[1]";
else
print "<option value=\"flash.add.php?filter=$r[1]\">$r[1]";
}
print "</select>";
print "</form>\n";
print "</td></tr>\n</table>\n";
print "</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"4%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Manufacturer</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"21%\">Variation</td>\n";
print "</tr>\n";
print "<form method=post action=flash.add.2.php>\n";
$num = pg_num_rows($flash_type);
if ($num > 0) {
for ($i=0; $i < $num; $i++) {
$r = pg_fetch_row($flash_type, $i);
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=radio name=\"flash_type_id\" value=$r[0]></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$r[4]\">$r[1]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$r[2]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$r[3]</td>\n";
print "</tr>\n";
}
}
else
print "<tr><td colspan=\"4\" align=\"left\" bgcolor=\"$color[table_body]\" >No flash types found.</td></tr>\n";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\"><font class=\"tabletop\">New Flash Type</font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"4%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Manufacturer</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"21%\">Variation</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=radio name=\"flash_type_id\" value=custom checked></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><select name=\"flash_manufacturer_id\">\n";
$num = pg_num_rows($manufacturer);
for ($i=0; $i < $num; $i++) {
$r = pg_fetch_row($manufacturer, $i);
print "<option value=\"$r[0]\">$r[1]";
}
print "</select></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"flash_model\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"flash_variation\"></td>\n";
print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr><td colspan=\"4\" bgcolor=\"$color[table_top]\"><font class=\"tabletop\">Flash Specific Data</font></td></tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Serial Number</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Purchase Date</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >New</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Access</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"flash_serial_number\"></td>\n";
print "<td bgcolor=\"$color[table_body]\" >\n";
display_date_input_form("flash_purchase_timestamp", "");
print "</td>\n";
print "<td bgcolor=\"$color[table_body]\" >\n"; display_yes_no_combo("flash_purchased_new", "t"); print "</td>\n";
print "<td bgcolor=\"$color[table_body]\" >\n"; display_access_combo("flash_access_rights", "t", ""); print "</td>\n";
print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Flash\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['flash']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "</form>\n";
display_navigator_box_bottom("100%");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
?>

View File

@ -1,57 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
function delete_flash($database, $flash_id) {
if (flash_id!="") {
pg_query($database, "begin");
$number_of_flashes_of_same_type = pg_fetch_row(pg_query($database, "select count(identifier) from flash where type=(select type from flash where identifier='$flash_id')"));
if ($number_of_flashes_of_same_type[0] == 1) {
$flash_type_to_remove = pg_fetch_row(pg_query($database, "select type from flash where identifier='$flash_id'"));
}
$result = pg_query($database, "delete from flash where identifier='$flash_id'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete flash: $flash_id";
return;
}
if ($number_of_flashes_of_same_type[0] == 1) {
$result = pg_query($database, "delete from flash_type where identifier='$flash_type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete flash type: $flash_type_to_remove";
return;
}
}
pg_query($database, "commit");
}
}
$database = site_prolog();
delete_flash($database, $_REQUEST['item_id']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['flash']['idx']);
?>

View File

@ -1,106 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$flash_id=$_REQUEST['item'];
$number_of_references = pg_fetch_row(pg_query($database, "select number_of_flash_references($flash_id)"));
site_header($page_width, "Delete Flash");
site_navigator(6, $my_user_id[1]);
switch ($number_of_references[0]) {
case 0:
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Delete flash", "");
break;
case 1:
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : There is 1 reference to this flash. Cannot remove.", "");
break;
default:
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : There are $number_of_references[0] references to this flash. Cannot remove.", "");
}
print "&nbsp;<br/>";
display_navigator_box_top($profile_data['flash']['idx'], $profile_data, "100%");
print "&nbsp;<br/>";
print "<form method=\"post\" action=\"flash.del.2.php?&item_id=$flash_id\">";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"6\"><font class=\"tabletop\">Remove Flash</font></td>\n";
print "</td>\n";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Manufacturer</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Model</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Serial Number</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Purchase Date</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Purchased New</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Access</td>";
print "</tr>";
$flash_to_be_removed = pg_fetch_row(pg_query($database, "select name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_flash where identifier='$flash_id'"));
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$flash_to_be_removed[6]\">$flash_to_be_removed[0]</a></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$flash_to_be_removed[1] $flash_to_be_removed[2]";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$flash_to_be_removed[3] </td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($flash_to_be_removed[4], 'short_date', $my_user_id[0] == "" ? 0 : 1). "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($flash_to_be_removed[5]); print "</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$flash_to_be_removed[7]</td>\n";
print "</tr>";
print "</table>";
print "&nbsp;<br/>";
if ($number_of_references[0]==0) {
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['flash']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
}
else {
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['flash']['idx']."\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"></a>\n";
}
print "</form>";
display_navigator_box_bottom("100%");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
?>

View File

@ -1,96 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/calendar.php";
function update_flash($database, $user_id, $flash_id, $flash_type_id, $flash_manufacturer_id, $flash_model, $flash_variation,
$flash_serial_number, $flash_purchase_timestamp, $flash_purchased_new, $flash_access_rights) {
$flash_date_of_purchase = check_date_validity($flash_purchase_timestamp);
$flash_model = pg_escape_string($flash_model);
$flash_variation = pg_escape_string($flash_variation);
$flash_serial_number = pg_escape_string($flash_serial_number);
pg_query($database, "begin");
if ($flash_type_id=='custom') {
/* flash type has changed */
$number_of_flashes_of_same_type = pg_fetch_row(pg_query($database, "select count(identifier) from flash where type=(select type from flash where identifier='$flash_id')"));
if ($number_of_flashes_of_same_type[0] == 1) {
/* there was only one flash of this kind, so we have to remove it */
$flash_type_to_remove = pg_fetch_row(pg_query($database, "select type from flash where identifier='$flash_id'"));
}
/* create new type */
$new_flash_type_id = pg_fetch_row(pg_query($database, "select nextval('flash_type_id_sequence')"));
$flash_type_id = $new_flash_type_id[0];
$result = pg_query($database, "insert into flash_type (identifier, manufacturer, model, variation, last_modified_date, last_modifying_users)
values ($flash_type_id, $flash_manufacturer_id, '$flash_model', '$flash_variation', now(), $user_id)");
if (!$result) {
pg_query($database, "rollback");
print "Failed to create new flash type";
return;
}
}
/* add flash */
$result = pg_query($database, "update flash set type=$flash_type_id, serial_number='$flash_serial_number', date_of_purchase=$flash_date_of_purchase, purchased_new='$flash_purchased_new', access_rights='$flash_access_rights' where identifier='$flash_id'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to create new flash";
return;
}
/* remove old type */
if ($flash_type_to_remove) {
$result = pg_query($database, "delete from flash_type where identifier='$flash_type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete flash type: $flash_type";
return;
}
}
pg_query($database, "commit");
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
site_epilog($database);
header("location: login.php");
exit();
}
update_flash($database, $my_user_id[0], $_REQUEST['item_id'], $_REQUEST['flash_type_id'], $_REQUEST['flash_manufacturer_id'], $_REQUEST['flash_model'], $_REQUEST['flash_variation'],
$_REQUEST['flash_serial_number'], $_REQUEST['flash_purchase_timestamp'], $_REQUEST['flash_purchased_new'], $_REQUEST['flash_access_rights']);
site_epilog($database);
header("location: my.profile.php?selector=".$profile_data['flash']['idx']);
?>

View File

@ -1,193 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.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 2 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/vars.php";
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$manufacturer_filter = $_REQUEST['filter'];
$flash_id = $_REQUEST['item'];
$flash_current_value = pg_fetch_row(pg_query($database, "select name, model, variation, serial_number,
date_of_purchase, purchased_new, access_rights
from view_flash where identifier='$flash_id'"));
$flash_type_current_value = pg_fetch_row(pg_query($database, "select type from flash where identifier='$flash_id'"));
$all_manufacturer = pg_query($database, "select identifier, name from manufacturer order by name");
$num_of_manufacturers = pg_num_rows($all_manufacturer);
$manufacturer = pg_query($database, "select identifier, name from manufacturer order by name");
switch ($manufacturer_filter) {
case 'All':
case '':
$all_flash_type = pg_query($database, "select identifier, name, model, variation, url from view_flash_type order by name");
break;
default:
$all_flash_type = pg_query($database, "select identifier, name, model, variation, url from view_flash_type where name='$manufacturer_filter' or identifier='$flash_type_current_value[0]' order by name");
}
site_header($page_width, "Edit Flash");
site_navigator(6, $my_user_id[1]);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php\">My Profile</a> : Edit flash", "");
print "&nbsp;<br/>";
display_navigator_box_top($profile_data['flash']['idx'], $profile_data, "100%");
print "&nbsp;<br/>";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\">\n";
print "<table width=\"100%\">\n<tr>\n";
print "<td align=\"left\"><font class=\"tabletop\">Flash Types</font></td>\n";
print "<td align=\"right\">\n";
print "<form>\n";
print "<select onchange=\"location = this.options[this.selectedIndex].value;\">\n";
print "<option value=\"flash.edit.php\">All";
for ($i=0; $i < $num_of_manufacturers; $i++) {
$manufactrurer = pg_fetch_row($all_manufacturer, $i);
if ($manufactrurer[1]==$manufacturer_filter)
print "<option value=\"flash.add.php?filter=$manufactrurer[1]\" selected>$manufactrurer[1]";
else
print "<option value=\"flash.add.php?filter=$manufactrurer[1]\">$manufactrurer[1]";
}
print "</select>";
print "</form>\n";
print "</td></tr>\n</table>\n";
print "</td>";
print "</tr>";
print "<form method=\"post\" action=\"flash.edit.2.php?item_id=$flash_id\">";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"4%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Manufacturer</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"21%\">Variation</td>\n";
print "</tr>\n";
$num_of_flashes = pg_num_rows($all_flash_type);
if ($num_of_flashes > 0) {
for ($i=0; $i < $num_of_flashes; $i++) {
$flash = pg_fetch_row($all_flash_type, $i);
print "<tr>";
if ($flash_type_current_value[0] == $flash[0])
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"flash_type_id\" value=\"$flash[0]\" checked></td>";
else
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"radio\" name=\"flash_type_id\" value=\"$flash[0]\"></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$flash[4]\">$flash[1]</a></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$flash[2]</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$flash[3]</td>";
print "</tr>";
}
}
else
print "<tr><td colspan=6 align=\"left\" bgcolor=\"$color[table_body]\" >No flash types found.</td></tr>";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"6\"><font class=\"tabletop\">Edit Flash Type</font></td>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"4%\"></td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Manufacturer</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Model</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"21%\">Variation</td>";
print "</tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"radio\" name=\"flash_type_id\" value=\"custom\">";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
$num = pg_num_rows($manufacturer);
print "<select name=\"flash_manufacturer_id\">";
for ($i=0; $i < $num; $i++) {
$r = pg_fetch_row($manufacturer, $i);
if ($flash_current_value[0]==$r[1])
print "<option value=\"$r[0]\" selected>$r[1]";
else
print "<option value=\"$r[0]\">$r[1]";
}
print "</select>";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"flash_model\" value=\"$flash_current_value[1]\">";
print "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"flash_variation\" value=\"$flash_current_value[2]\">";
print "</td>";
print "</tr>";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr><td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"6\"><font class=\"tabletop\">Flash Specific Data</font></td></tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Serial Number</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Purchase Date</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Purchased New</td>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" >Access</td>";
print "</tr>";
print "<tr>";
print "<td bgcolor=\"$color[table_body]\" ><input type=\"text\" name=\"flash_serial_number\" value=\"$flash_current_value[3]\"></td>";
$date_of_purchase= substr($flash_current_value[4], 0, 10);
print "<td bgcolor=\"$color[table_body]\" >\n";
display_date_input_form("flash_purchase_timestamp", "$date_of_purchase");
print "</td>\n";
print "<td bgcolor=\"$color[table_body]\" >"; display_yes_no_combo("flash_purchased_new", $flash_current_value[5]); print "</td>\n";
print "<td bgcolor=\"$color[table_body]\" >"; display_access_combo("flash_access_rights", $flash_current_value[6], ""); print "</td>\n";
print "</tr>";
print "</table>";
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">\n";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['flash']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>\n";
print "</form>";
display_navigator_box_bottom("100%");
print "&nbsp;<br/>";
site_footer($database);
site_epilog($database);
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,17 +22,11 @@ include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$return_path = $_REQUEST['return'];
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
@ -40,12 +34,19 @@ if ($my_user_id[0] == "") {
$folder_name = pg_escape_string($_REQUEST['folder_caption']);
$folder_description = pg_escape_string($_REQUEST['folder_description']);
$folder_access_rights = $_REQUEST['folder_access_rights'];
$folder_parent = $_REQUEST['parent'];
if (!$folder_parent) {
$folder_parent = "null";
}
$folder_access_rights = pg_escape_string($_REQUEST['folder_access_rights']);
$folder_parent = pg_escape_string($_REQUEST['parent']);
if ($folder_parent != "null") {
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_query($database, "select identifier from folder where identifier=$folder_parent and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
}
global $default_order_by;
@ -54,17 +55,17 @@ if (($folder_name != "") &&
($folder_name != "Orphanage")) {
$result = pg_query($database, "insert into folder (identifier, parent_folder, users, caption, description, date_of_creation, access_rights, orderby)
values (nextval('folder_id_sequence'), $folder_parent,
'$my_user_id[0]', '$folder_name', '$folder_description', now(), $folder_access_rights, $default_order_by)");
'$po_user[id]', '$folder_name', '$folder_description', now(), $folder_access_rights, $default_order_by)");
if (!$result) {
print "Failed to create new folder: $folder_name";
// print "Failed to create new folder: $folder_name";
exit();
}
}
site_epilog($database);
if ($folder_parent == "null") {
header("location: my.folder.php");
}
else {
} else {
header("location: folder.php?folder=$folder_parent");
}
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -24,24 +24,18 @@ include_once "include/common.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$return_path = $_REQUEST['return'];
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$folder_parent = $_REQUEST['parent'];
$folder_all = pg_query($database, "select identifier, caption, parent_folder from folder where users=$my_user_id[0] and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$folder_parent = pg_escape_string($_REQUEST['parent']);
$folder_all = pg_query($database, "select identifier, caption, parent_folder from folder where users=$po_user[id] and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
if ($folder_parent) {
$folder_data = pg_fetch_row(pg_query($database, "select caption from folder where identifier='$folder_parent'"));
$path_to_folder = get_path_to_folder($database, $folder_parent);
@ -49,11 +43,11 @@ if ($folder_parent) {
}
site_header($page_width, "Add Folder");
site_navigator(5, $my_user_id[1]);
site_navigator(5);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.folder.php\">My Folders and Albums</a>$path_to_folder : Add Folder ", "");
print "&nbsp;<br/>\n";
print "<form method=\"post\" action=\"folder.add.2.php\">";
print "<input type=\"hidden\" name=\"return\" value=\"$return_path\">";
print "<input type=\"hidden\" name=\"return\" value=\"$return_path\"/>";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"45%\">Folder Name</td>";
@ -61,7 +55,7 @@ print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"43%\">Parent
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"12%\">Access</td>";
print "</tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input id=\"template_editor\" type=\"text\" name=\"folder_caption\" size=\"40%\" tabindex=\"1\"></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input id=\"template_editor\" type=\"text\" name=\"folder_caption\" size=\"40%\" tabindex=\"1\"/></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_folder_combo("parent", $folder_all, $folder_parent, "null");
print "</td>\n";
@ -85,7 +79,7 @@ print "</table>";
print "&nbsp;<br/>\n";
print "<center>\n";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Folder\">";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Folder\"/>";
print "<a class=\"nodecor\" href=\"";
if (!$folder_parent) {
print "my.folder.php";
@ -93,7 +87,7 @@ if (!$folder_parent) {
else {
print "folder.php?folder=$folder_parent";
}
print "\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</center>\n";
print "</form>";
site_footer($database);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,26 +23,19 @@ include_once "include/search.2.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
/* this will enable administrators to empty anybody's trash */
if ($my_user_id[1] == $user_type['administrator']) {
$user_id = $_REQUEST['user'];
}
if (!$user_id) {
$user_id = $my_user_id[0];
if ($po_user['type'] == $user_type['administrator']) {
$user_id = $_REQUEST['user'];
} else {
$user_id = $po_user['id'];
}
$destination_basket = $_REQUEST['basket'];
@ -85,7 +78,7 @@ if ($destination_basket == "yes" && $destination_album == "") {
$user_id = $_REQUEST['user'];
$num_of_photos = $_REQUEST['num_of_checkboxes'];
for ($counter = 0; $counter < $num_of_photos; $counter++) {
$photo_identifier = $_REQUEST[cb.$counter];
$photo_identifier = $_REQUEST['cb'.$counter];
if ($photo_identifier) {
/* this is quick and dirty but we avoid using plpgsql */
$num_of_items = pg_fetch_row(pg_query($database, "
@ -93,12 +86,12 @@ if ($destination_basket == "yes" && $destination_album == "") {
from shop_order
where item=(select min(identifier) from photo_item where photo=$photo_identifier)
and transaction = null
and client=$my_user_id[0]"));
and client=$po_user[id]"));
if ($num_of_items[0] == 0) {
pg_query($database, "
insert into shop_order (identifier, client, transaction, pieces, date_of_creation, date_of_last_edit, item)
values (nextval('shop_order_id_sequence'), $my_user_id[0], null, 1, now(), now(), (select min(identifier) from photo_item where photo=$photo_identifier))");
values (nextval('shop_order_id_sequence'), $po_user[id], null, 1, now(), now(), (select min(identifier) from photo_item where photo=$photo_identifier))");
}
}
}
@ -113,8 +106,19 @@ if ($export_type != "") {
$num_of_photos = $_REQUEST['num_of_checkboxes'];
for ($counter = 0; $counter < $num_of_photos; $counter++) {
$photo_identifier = $_REQUEST[cb.$counter];
$photo_identifier = $_REQUEST['cb'.$counter];
if ($photo_identifier) {
if ($po_user['type'] < $user_type['administrator']) {
/* Ensure mere users don't move/mangle a photo that isn't theirs! */
$result = pg_query($database, "select identifier from photo where identifier='$photo_identifier' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php?reason=1");
exit();
}
}
$photos_in_spooler++;
pg_query($database, "insert into photo_spooler (identifier, users, photo)
values (nextval('photo_spooler_id_sequence'), $user_id, $photo_identifier)");
@ -144,8 +148,20 @@ if ($print_type != "") {
$num_of_photos = $_REQUEST['num_of_checkboxes'];
for ($counter = 0; $counter < $num_of_photos; $counter++) {
$photo_identifier = $_REQUEST[cb.$counter];
$photo_identifier = $_REQUEST['cb'.$counter];
if ($photo_identifier) {
if ($po_user['type'] < $user_type['administrator']) {
/* Ensure mere users don't move/mangle a photo that isn't theirs! */
$result = pg_query($database, "select identifier from photo where identifier='$photo_identifier' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php?reason=1");
exit();
}
}
$photos_in_spooler++;
pg_query($database, "insert into photo_spooler (identifier, users, photo)
values (nextval('photo_spooler_id_sequence'), $user_id, $photo_identifier)");
@ -174,8 +190,19 @@ if ($print_type != "") {
if ($access_rights != "") {
$num_of_photos = $_REQUEST['num_of_checkboxes'];
for ($counter = 0; $counter < $num_of_photos; $counter++) {
$photo_identifier = $_REQUEST["cb".$counter];
$photo_identifier = $_REQUEST['cb'.$counter];
if ($photo_identifier) {
if ($po_user['type'] < $user_type['administrator']) {
/* Ensure mere users don't move/mangle a photo that isn't theirs! */
$result = pg_query($database, "select identifier from photo where identifier='$photo_identifier' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php?reason=1");
exit();
}
}
pg_query($database, "update photo set access_rights=$access_rights where identifier=$photo_identifier");
}
}
@ -186,10 +213,44 @@ if ($access_rights != "") {
$trash_id = pg_fetch_row(pg_query($database, "select identifier from folder where caption='Trash' and users=$user_id"));
$orphanage_id = pg_fetch_row(pg_query($database, "select identifier from folder where caption='Orphanage' and users=$user_id"));
if ($po_user['type'] < $user_type['administrator']) {
/* ...to an album that isn't theirs! */
if ($destination_album != "") {
$result = pg_query($database, "select identifier from album where identifier='$destination_album' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php?reason=2");
exit();
}
}
/* ...to a folder that isn't theirs! */
if ($destination_folder != "") {
$result = pg_query($database, "select identifier from folder where identifier='$destination_folder' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php?reason=3");
exit();
}
}
}
$num_of_photos = $_REQUEST['num_of_checkboxes'];
for ($counter = 0; $counter < $num_of_photos; $counter++) {
$photo_identifier = $_REQUEST[cb.$counter];
$photo_identifier = $_REQUEST['cb'.$counter];
if ($photo_identifier) {
if ($po_user['type'] < $user_type['administrator']) {
/* Ensure mere users don't move/mangle a photo that isn't theirs! */
$result = pg_query($database, "select identifier from photo where identifier='$photo_identifier' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php?reason=1");
exit();
}
}
if ($destination_folder != "") {
if ($destination_folder == $trash_id[0]) {
/* do not remove photos that were involved in a shop transaction */
@ -209,8 +270,7 @@ for ($counter = 0; $counter < $num_of_photos; $counter++) {
/* in case the same photo apperars twice in an album, */
/* we do the min() hack to remove only one of them */
pg_query($database, "delete from album_content where identifier=(select min(identifier) from album_content where photo=$photo_identifier)");
}
else {
} else {
pg_query($database, "begin");
if ($source_album != "") {
$result = pg_query($database, "delete from album_content where album=$source_album and identifier=(select min(identifier) from album_content where photo=$photo_identifier)");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,22 +22,39 @@ include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$folder_id = $_REQUEST['folder'];
$folder_id = pg_escape_string($_REQUEST['folder']);
$parent_folder = $_REQUEST['parent'];
$database = site_prolog();
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
}
/* Ensure mere users don't erase an album that isn't theirs! */
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_query($database, "select identifier from album where identifier='$album_id' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
if ($folder_id!="") {
$result = pg_query($database, "delete from folder where identifier='$folder_id'");
if (!$result) {
print "Failed to delete folder: $folder_id";
// print "Failed to delete folder: $folder_id";
}
}
site_epilog($database);
if ($parent_folder == "") {
header("location: my.folder.php");
}
else {
} else {
header("location: folder.php?folder=$parent_folder");
}
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -20,35 +20,35 @@
include_once "include/vars.php";
include_once "include/config.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$folder_id=$_REQUEST['folder'];
$folder_id = pg_escape_string($_REQUEST['folder']);
site_header($page_width, "Delete Folder");
site_navigator(5, $my_user_id[1]);
$folder_data = pg_fetch_row(pg_query($database, "select caption, date_of_creation, value, parent_folder, users from folder, access_type where access_type.identifier=folder.access_rights and folder.identifier='$folder_id'"));
if (($folder_data[4] != $po_user['id']) &&
($po_user['type'] != $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
$folder_data = pg_fetch_row(pg_query($database, "select caption, date_of_creation, value, parent_folder from folder, access_type where access_type.identifier=folder.access_rights and folder.identifier='$folder_id'"));
$photos_in_folder = pg_fetch_row(pg_query($database, "select count_photos_by_folder($folder_id)"));
$subfolders_in_folder = pg_fetch_row(pg_query($database, "select count_subfolders_by_folder($folder_id)"));
$path_to_folder = get_path_to_folder($database, $folder_id);
site_header($page_width, "Delete Folder");
site_navigator(5);
switch ($photos_in_folder[0]) {
case 0:
switch ($subfolders_in_folder[0]) {
@ -82,7 +82,7 @@ print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"folder.php?folder=$folder_id\">$folder_data[0]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$subfolders_in_folder[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$photos_in_folder[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($folder_data[1], 'date', $my_user_id[0] == "" ? 0 : 1). "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($folder_data[1], 'date', 1). "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$folder_data[2]</td>\n";
print "</tr>";
print "</table>";
@ -90,14 +90,14 @@ print "&nbsp;<br/>\n";
print "<center>\n";
if (($photos_in_folder[0] > 0) || ($subfolders_in_folder[0] > 0)) {
print "<a class=\"nodecor\" href=\"folder.php?folder=$folder_id\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"></a>\n";
print "<a class=\"nodecor\" href=\"folder.php?folder=$folder_id\"><img src=\"$theme/button.back.gif\" border=\"0\" alt=\"Back\"/></a>\n";
}
else {
print "<form method=\"post\" action=\"folder.del.2.php\">";
print "<input type=\"hidden\" name=\"folder\" value=\"$folder_id\"><p>";
print "<input type=\"hidden\" name=\"parent\" value=\"$folder_data[3]\"><p>";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\">";
print "<a class=\"nodecor\" href=\"folder.php?folder=$folder_data[3]\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"hidden\" name=\"folder\" value=\"$folder_id\"/><p>";
print "<input type=\"hidden\" name=\"parent\" value=\"$folder_data[3]\"/><p>";
print "<input type=\"image\" src=\"$theme/button.confirm.delete.gif\" border=\"0\" value=\"Confirm Delete\"/>";
print "<a class=\"nodecor\" href=\"folder.php?folder=$folder_data[3]\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</form>";
}
print "</center>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,22 +22,39 @@ include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$folder_id = $_REQUEST['folder'];
$folder_id = pg_escape_string($_REQUEST['folder']);
$folder_name = pg_escape_string($_REQUEST['folder_caption']);
$folder_description = pg_escape_string($_REQUEST['folder_description']);
$folder_access_rights = $_REQUEST['folder_access_rights'];
$parent_folder = $_REQUEST['parent'];
$folder_access_rights = pg_escape_string($_REQUEST['folder_access_rights']);
$parent_folder = pg_escape_string($_REQUEST['parent']);
$database = site_prolog();
if ($po_user['type'] < $user_type['client']) {
site_epilog($database);
header("location: login.php");
exit();
}
/* Ensure mere users don't edit an folder that isn't theirs! */
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_query($database, "select identifier from folder where identifier='$folder_id' and users = $po_user[id]");
if (pg_num_rows($result) <= 0) {
site_epilog($database);
header("location: login.php");
exit();
}
}
if (($folder_id!="") && ($folder_name!="")) {
$result = pg_query($database, "update folder set caption='$folder_name', description='$folder_description', access_rights=$folder_access_rights, parent_folder=$parent_folder where identifier='$folder_id'");
}
site_epilog($database);
if ($parent_folder == "null") {
header("location: my.folder.php");
}
else {
} else {
header("location: folder.php?folder=$parent_folder");
}
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,37 +21,42 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$folder_id=$_REQUEST['folder'];
$folder_data = pg_fetch_row(pg_query($database, "select caption, date_of_creation, access_rights, parent_folder, description from folder where identifier='$folder_id'"));
$folder_all = pg_query($database, "select identifier, caption, parent_folder from folder where users=$my_user_id[0] and identifier!=$folder_id and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$folder_id = pg_escape_string($_REQUEST['folder']);
$folder_data = pg_fetch_row(pg_query($database, "select caption, date_of_creation, access_rights, parent_folder, description, users from folder where identifier='$folder_id'"));
/* Ensure mere users don't edit an folder that isn't theirs! */
if (($po_user['id'] != $folder_data[5]) &&
($po_user['type'] < $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
$folder_all = pg_query($database, "select identifier, caption, parent_folder from folder where users=$po_user[id] and identifier!=$folder_id and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$photos_in_folder = pg_fetch_row(pg_query($database, "select count_photos_by_folder($folder_id)"));
$subfolders_in_folder = pg_fetch_row(pg_query($database, "select count_subfolders_by_folder($folder_id)"));
$path_to_folder = get_path_to_folder($database, $folder_id);
site_header($page_width, "Edit Folder");
site_navigator(5, $my_user_id[1]);
site_navigator(5);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.folder.php\">My Folders and Albums</a>$path_to_folder : Edit folder <a href=\"folder.php?folder=$folder_id\">$folder_data[0]</a>", "");
print "&nbsp;<br/>\n";
print "<form method=\"post\" action=\"folder.edit.2.php\">";
print "<input type=\"hidden\" name=\"folder\" value=\"$folder_id\"><p>";
print "<input type=\"hidden\" name=\"folder\" value=\"$folder_id\"/><p>";
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"28%\">Folder Name</td>\n";
@ -62,13 +67,13 @@ print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"15%\">Create
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Access</td>\n";
print "</tr>";
print "<tr>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input id=\"template_editor\" type=\"text\" name=\"folder_caption\" value=\"$folder_data[0]\"></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><input id=\"template_editor\" type=\"text\" name=\"folder_caption\" value=\"$folder_data[0]\"/></td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_folder_combo("parent", $folder_all, $folder_data[3], "null");
print "</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$subfolders_in_folder[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$photos_in_folder[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($folder_data[1], 'date', $my_user_id[0] == "" ? 0 : 1). "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($folder_data[1], 'date', 1). "</td>";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_access_combo("folder_access_rights", $folder_data[2], ""); print "</td>\n";
print "</tr>";
print "</table>";
@ -88,15 +93,14 @@ print "</table>";
print "&nbsp;<br/>\n";
print "<center>\n";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\">";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" border=\"0\" value=\"Save Changes\"/>";
print "<a class=\"nodecor\" href=\"";
if (!$folder_parent) {
if (!$folder_data[3]) {
print "my.folder.php";
} else {
print "folder.php?folder=$folder_data[3]";
}
else {
print "folder.php?folder=$folder_parent";
}
print "\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</form>";
print "</center>\n";
site_footer($database);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,24 +23,22 @@ include_once "include/common.php";
include_once "include/site.php";
include_once "include/orderby.php";
include_once "include/search.2.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$folder_id = $_REQUEST['folder'];
$folder_id = pg_escape_string($_REQUEST['folder']);
$order_by = pg_escape_string($_REQUEST['order_by']);
$view = $_REQUEST['view'];
$order_by = $_REQUEST['order_by'];
$session_id = $_COOKIE[$po_cookie];
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
$arguments="";
$client="";
$client=FALSE;
if (!$folder_id) {
header("HTTP/1.1 404 Not found");
site_header($page_width, "Display Folder");
site_navigator(5, $my_user_id[1]);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$my_user_id[0]\">My Folders and Albums</a> : No folder specified", "");
site_navigator(5);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$po_user[id]\">My Folders and Albums</a> : No folder specified", "");
site_footer($database);
site_epilog($database);
exit();
@ -48,9 +46,10 @@ if (!$folder_id) {
$folder = pg_fetch_row(pg_query($database, "select caption, access_rights, users, orderby, description from folder where identifier='$folder_id'"));
if (!$folder) {
header("HTTP/1.1 404 Not found");
site_header($page_width, "Display Folder");
site_navigator(5, $my_user_id[1]);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$my_user_id[0]\">My Folders and Albums</a> : No such folder", "");
site_navigator(5);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$po_user[id]\">My Folders and Albums</a> : No such folder", "");
site_footer($database);
site_epilog($database);
exit();
@ -60,43 +59,50 @@ if ($view != "") {
$arguments = $arguments . "&amp;view=$view";
}
$folder_name = $folder[0];
$owner_id = $folder[2];
if (!$order_by) {
/* get the last value from the database */
$order_by = $folder[3];
}
else if ($order_by != $folder[3]){
/* if different, set the database, and use the new value */
pg_query($database, "update folder set orderby='$order_by' where identifier=$folder_id");
} else if ($po_options['order_by'] != $folder[3]) {
if ($po_user['id'] == $owner_id) {
/* if different, set the database, and use the new value */
pg_query($database, "update folder set orderby='$order_by' where identifier=$folder_id");
}
}
$arguments = $arguments . "&amp;order_by=$order_by";
$sql_query_order_by_string = $order_by_string[$order_by][0];
$folder_name = $folder[0];
$user_id = $folder[2];
if ($user_id != "" && $my_user_id[0] != "") {
$client = pg_fetch_row(pg_query($database, "select identifier from client where users='$user_id' and client='$my_user_id[0]' and status=2"));
if (($owner_id != "") &&
($po_user['type'] > $user_type['disabled'])) {
$client = pg_fetch_row(pg_query($database, "select identifier from client where users='$owner_id' and client='$po_user[id]' and status=2"));
}
if ($my_user_id[0] != $user_id && $folder[1] == $access['private'] && $my_user_id[1] != $user_type['administrator']) {
if (($po_user['id'] != $owner_id) &&
($folder[1] == $access['private']) &&
($po_user['type'] != $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
if ($my_user_id[0] != $user_id && $folder[1] == $access['protected'] && $client == "" && $my_user_id[1] != $user_type['administrator']) {
if (($po_user['id'] != $owner_id) &&
($folder[1] == $access['protected']) &&
($client == FALSE) &&
($po_user['type'] != $user_type['administrator'])) {
site_epilog($database);
header("location: login.php");
exit();
}
$user_data = pg_fetch_row(pg_query($database, "select first_name, last_name, users.identifier, shop_enable from users, preferences where users.preferences=preferences.identifier and users.identifier=$user_id"));
$user_data = pg_fetch_row(pg_query($database, "select first_name, last_name, users.identifier, shop_enable from users, preferences where users.preferences=preferences.identifier and users.identifier=$owner_id"));
site_header($page_width, "Display Folder");
if ($my_user_id[0] != "") {
$my_data = pg_fetch_row(pg_query($database, "select num_of_rows, num_of_columns, folder_view, num_of_rows_l, popup_enable, popup_delay from users, preferences where preferences.identifier=users.preferences and users.identifier=$my_user_id[0]"));
if ($po_user['type'] > $user_type['disabled']) {
$my_data = pg_fetch_row(pg_query($database, "select num_of_rows, num_of_columns, folder_view, num_of_rows_l, popup_enable, popup_delay from users, preferences where preferences.identifier=users.preferences and users.identifier=$po_user[id]"));
$num_of_rows = $my_data[0];
$num_of_columns = $my_data[1];
if ($view=="")
@ -104,8 +110,7 @@ if ($my_user_id[0] != "") {
$num_of_rows_l = $my_data[3];
$popup_enable = $my_data[4];
$popup_delay = $my_data[5];
}
else {
} else {
$view = "slide";
$num_of_rows_l = $default_num_of_rows_in_list_view;
$num_of_rows = $default_num_of_rows_in_slide_view;
@ -114,10 +119,10 @@ else {
$popup_delay = $default_popup_delay;
}
if ($my_user_id[0] == $user_id) {
site_navigator(5, $my_user_id[1]);
if ($po_user['id'] == $owner_id) {
site_navigator(5);
$user_display_string="My Folders and Albums";
$my_data = pg_fetch_row(pg_query($database, "select num_of_rows, num_of_columns, folder_view, num_of_rows_l, popup_enable, popup_delay from users, preferences where preferences.identifier=users.preferences and users.identifier=$my_user_id[0]"));
$my_data = pg_fetch_row(pg_query($database, "select num_of_rows, num_of_columns, folder_view, num_of_rows_l, popup_enable, popup_delay from users, preferences where preferences.identifier=users.preferences and users.identifier=$po_user[id]"));
$num_of_rows = $my_data[0];
$num_of_columns = $my_data[1];
if ($view=="")
@ -125,21 +130,18 @@ if ($my_user_id[0] == $user_id) {
$num_of_rows_l = $my_data[3];
$popup_enable = $my_data[4];
$popup_delay = $my_data[5];
}
else {
site_navigator(1, $my_user_id[1]);
} else {
site_navigator(1);
$user_display_string = sprintf("%s, %s", $user_data[1], $user_data[0]);
}
if ($my_user_id[0] == $user_id || $my_user_id[1] == $user_type['administrator']) {
if (($po_user['id'] == $owner_id) ||
($po_user['type'] == $user_type['administrator'])) {
$sql_query_photo_access_rights_string = "";
}
else {
if ($client == "") {
} else {
if ($client == FALSE) {
$sql_query_photo_access_rights_string = "and photo.access_rights = $access[public]";
}
else {
} else {
$sql_query_photo_access_rights_string = "and photo.access_rights < $access[private]";
}
}
@ -151,15 +153,14 @@ $num_of_photos_a = pg_fetch_row(pg_query($database, "
$sql_query_photo_access_rights_string"));
$num_of_photos = $num_of_photos_a[0];
$offset = $_REQUEST['offset'];
$offset = pg_escape_string($_REQUEST['offset']);
if (!$offset) {
$offset = 0;
}
if ($view == "slide") {
$limit = $num_of_rows * $num_of_columns;
}
else {
} else {
$limit = $num_of_rows_l;
}
@ -173,7 +174,7 @@ $folder_photo = pg_query($database,
11 - (select avg(rating.value) from rating where rating.photo=photo.identifier) as rating,
views,
(select is_photo_for_sale(photo.identifier)) as for_sale,
photo.title, photo.author, photo.keyword,
photo.title, photo.author, '' as keyword,
photo_version.original_image_name, photo.users,
view_location.place, view_location.country, view_location.city, view_location.state
from photo, photo_dupe, photo_version, view_location
@ -200,22 +201,21 @@ if ($num_of_photos == 0) {
if (($folder[0] != "Trash") && ($folder[0] != "Orphanage")) {
print "&nbsp;<br/>";
display_folders($database, "$folder_id", $my_user_id[0], $my_user_id[1], $user_id, "with_header");
display_folders($database, "$folder_id", $po_user['id'], $po_user['type'], $owner_id, "with_header");
}
print "&nbsp;<br/>";
if (($my_user_id[0] == $user_id) &&
if (($po_user['id'] == $owner_id) &&
($folder[0]!="Trash") &&
($folder[0]!="Orphanage")) {
print "<table align=\"left\" valign=\"middle\" cellpadding=\"0\" border=\"0\">";
print "<tr><td align=\"left\" valign=\"middle\">";
print "<a class=\"nodecor\" href=\"photo.add.php?folder=$folder_id\"><img src=\"$theme/button.add.photos.gif\" alt=\"Add Photo\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" href=\"photo.add.php?folder=$folder_id\"><img src=\"$theme/button.add.photos.gif\" alt=\"Add Photo\" border=\"0\"/></a>\n";
print "</td></tr></table>";
}
site_footer($database);
site_epilog($database);
exit;
}
else {
exit();
} else {
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$user_data[2]\">$user_display_string</a>$path_to_folder : $folder[0]", "Displaying photos " . display_photo_index_status($offset, $limit, $num_of_photos));
}
@ -225,40 +225,39 @@ if ($folder[4] != "") {
if (($folder[0] != "Trash") && ($folder[0] != "Orphanage")) {
print "&nbsp;<br/>";
display_folders($database, "$folder_id", $my_user_id[0], $my_user_id[1], $user_id, "with_header");
display_folders($database, "$folder_id", $po_user['id'], $po_user['type'], $owner_id, "with_header");
}
print "<script language=\"JavaScript\" type=\"text/javascript\" src=\"javascript/select.js\"></script>";
print "<script language=\"JavaScript\" type=\"text/javascript\" src=\"javascript/util.js\"></script>";
print "&nbsp;<br/>";
print "<form name=\"photoList\" method=\"post\" action=\"folder.content.php\">";
print "<input type=\"hidden\" name=\"user\" value=\"$user_id\">";
print "<input type=\"hidden\" name=\"view\" value=\"$view\">";
print "<input type=\"hidden\" name=\"return\" value=\"folder.php?folder=$folder_id$arguments&offset=$offset\">";
print "<input type=\"hidden\" name=\"source_folder\" value=\"$folder_id\">\n";
print "<input type=\"hidden\" name=\"user\" value=\"$owner_id\"/>";
print "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
print "<input type=\"hidden\" name=\"return\" value=\"folder.php?folder=$folder_id$arguments&amp;offset=$offset\"/>";
print "<input type=\"hidden\" name=\"source_folder\" value=\"$folder_id\"/>\n";
if (($offset + $limit) > $num_of_photos) {
$items = $num_of_photos - $offset;
}
else {
} else {
$items = $limit;
}
display_photo_navigator("folder", $arguments, $user_id, $folder_id, $offset, $limit, $num_of_photos);
display_photo_navigator("folder", $arguments, $owner_id, $folder_id, $offset, $limit, $num_of_photos);
if ($view=="slide") {
display_photo_slides("folder", $my_user_id[0], $my_user_id[1], $folder_id, $folder_photo, $items, $num_of_columns, $popup_enable, $popup_delay, $user_data[3], true, $order_by);
}
else {
display_photo_slides("folder", $po_user['id'], $po_user['type'], $folder_id, $folder_photo, $items, $num_of_columns, $popup_enable, $popup_delay, $user_data[3], true, $order_by);
} else {
print "&nbsp;<br/>\n";
display_photo_list("folder", $my_user_id[0], $my_user_id[1], $folder_id, $folder_photo, $items, $user_data[3], $order_by);
display_photo_list("folder", $po_user['id'], $po_user['type'], $folder_id, $folder_photo, $items, $user_data[3], $order_by);
print "&nbsp;<br/>\n";
}
display_photo_navigator("folder", $arguments, $user_id, $folder_id, $offset, $limit, $num_of_photos);
display_photo_navigator("folder", $arguments, $owner_id, $folder_id, $offset, $limit, $num_of_photos);
print "&nbsp;<br/>\n";
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"user.php?user=$user_data[2]\">$user_display_string</a>$path_to_folder : $folder[0]", "Displaying photos " . display_photo_index_status($offset, $limit, $num_of_photos));
if ($my_user_id[0] == $user_id || $my_user_id[1] == $user_type['administrator']) {
if (($po_user['id'] == $owner_id) ||
($po_user['type'] == $user_type['administrator'])) {
print "<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td>";
print "<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
@ -266,8 +265,7 @@ if ($my_user_id[0] == $user_id || $my_user_id[1] == $user_type['administrator'])
print "<td align=\"left\" valign=\"middle\">";
if ($order_by != "") {
$order_by_argument = "&amp;order_by=$order_by";
}
else {
} else {
$order_by_argument = "";
}
display_order_by_combo_with_button($order_by);
@ -277,16 +275,16 @@ if ($my_user_id[0] == $user_id || $my_user_id[1] == $user_type['administrator'])
case "Trash":
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
print "<td align=\"left\" valign=\"middle\">";
print "<a class=\"nodecor\" href=\"trash.empty.php\"><img src=\"$theme/button.empty.trash.gif\" alt=\"Empty Trash\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" href=\"trash.empty.php\"><img src=\"$theme/button.empty.trash.gif\" alt=\"Empty Trash\" border=\"0\"/></a>\n";
print "</td>";
break;
case "Orphanage":
break;
default:
if ($my_user_id[0] == $user_id) {
if ($po_user['id'] == $owner_id) {
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
print "<td align=\"left\" valign=\"middle\">";
print "<a class=\"nodecor\" href=\"photo.add.php?folder=$folder_id\"><img src=\"$theme/button.add.photos.gif\" alt=\"Add Photos\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" href=\"photo.add.php?folder=$folder_id\"><img src=\"$theme/button.add.photos.gif\" alt=\"Add Photos\" border=\"0\"/></a>\n";
print "</td>";
}
}
@ -295,18 +293,18 @@ if ($my_user_id[0] == $user_id || $my_user_id[1] == $user_type['administrator'])
print "<td align=\"left\" valign=\"middle\">";
if ($view=="slide")
print "<a class=\"nodecor\" href=\"folder.php?folder=$folder_id$order_by_argument&amp;view=list&amp;offset=$offset\"><img src=\"$theme/button.list.view.gif\" alt=\"List View\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" href=\"folder.php?folder=$folder_id$order_by_argument&amp;view=list&amp;offset=$offset\"><img src=\"$theme/button.list.view.gif\" alt=\"List View\" border=\"0\"/></a>\n";
else
print "<a class=\"nodecor\" href=\"folder.php?folder=$folder_id$order_by_argument&amp;view=slide&amp;offset=$offset\"><img src=\"$theme/button.slide.view.gif\" alt=\"Slide View\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" href=\"folder.php?folder=$folder_id$order_by_argument&amp;view=slide&amp;offset=$offset\"><img src=\"$theme/button.slide.view.gif\" alt=\"Slide View\" border=\"0\"/></a>\n";
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
print "<td align=\"left\" valign=\"middle\">";
print "<a class=\"nodecor\" href=\"javascript:setChecked(); changeImage('selectButton', '$theme/button.deselect.all.gif', '$theme/button.select.all.gif')\"><img name=\"selectButton\" src=\"$theme/button.select.all.gif\" border=\"0\" alt=\"\"></a>\n";
print "<a class=\"nodecor\" onclick=\"setChecked(); changeImage('selectButton', '$theme/button.deselect.all.gif', '$theme/button.select.all.gif')\"><img name=\"selectButton\" src=\"$theme/button.select.all.gif\" border=\"0\" alt=\"\"/></a>\n";
print "</td>";
if (($folder[0]!="Trash") && ($folder[0]!="Orphanage")) {
if ($my_user_id[0] == $user_id) {
if ($po_user['id'] == $owner_id || $po_user['type'] == $user_type['administrator']) {
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
print "<td align=\"left\" valign=\"middle\">";
display_printto();
@ -330,14 +328,14 @@ if ($my_user_id[0] == $user_id || $my_user_id[1] == $user_type['administrator'])
if ($folder[0] == "Orphanage")
$sql_exclude_trash = " and caption!='Trash'";
$folder_all = pg_query($database, "select identifier, caption, parent_folder from folder where users=$user_id and caption!='Orphanage' $sql_exclude_trash order by date_of_creation desc");
$folder_all = pg_query($database, "select identifier, caption, parent_folder from folder where users=$owner_id and caption!='Orphanage' $sql_exclude_trash order by date_of_creation desc");
print "<td align=\"left\" valign=\"middle\">";
display_moveto_folder($folder_all, $folder_id, "goto");
print "</td>";
print "<td align=\"left\" valign=\"middle\">";
display_moveto_folder($folder_all, $folder_id, "moveto");
print "</td>";
$album_all = pg_query($database, "select identifier, caption, parent_album from album where users=$user_id and type='u' order by date_of_creation desc");
$album_all = pg_query($database, "select identifier, caption, parent_album from album where users=$owner_id and type='u' order by date_of_creation desc");
if (pg_num_rows($album_all) > 0) {
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
display_linkto_album($album_all, $album_id);
@ -348,26 +346,26 @@ if ($my_user_id[0] == $user_id || $my_user_id[1] == $user_type['administrator'])
print "</table>";
print "</td></tr></table>";
}
elseif ($my_user_id[1] >= $user_type['client'] && $user_data[3] == 't') {
} elseif ($po_user['type'] >= $user_type['client'] &&
$user_data[3] == 't') {
print "<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
print "<tr>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
print "<input type=\"image\" src=\"$theme/button.put.selection.to.basket.gif\" alt=\"Put Selection to Basket\">\n";
print "<input type=\"image\" src=\"$theme/button.put.selection.to.basket.gif\" alt=\"Put Selection to Basket\"/>\n";
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
print "<a class=\"nodecor\" href=\"basket.php\"><img src=\"$theme/button.view.basket.gif\" alt=\"View Basket\" border=\"0\"></a>\n";
print "<a class=\"nodecor\" href=\"basket.php\"><img src=\"$theme/button.view.basket.gif\" alt=\"View Basket\" border=\"0\"/></a>\n";
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
print "<input type=\"hidden\" name=\"basket\" value=\"yes\">";
print "<a class=\"nodecor\" href=\"javascript:setChecked('photocb'); changeImage('selectButton', '$theme/button.deselect.all.gif', '$theme/button.select.all.gif')\"><img name=\"selectButton\" src=\"$theme/button.select.all.gif\" border=\"0\" alt=\"\"></a>\n";
print "<input type=\"hidden\" name=\"basket\" value=\"yes\"/>";
print "<a class=\"nodecor\" onclick=\"setChecked('photocb'); changeImage('selectButton', '$theme/button.deselect.all.gif', '$theme/button.select.all.gif')\"><img name=\"selectButton\" src=\"$theme/button.select.all.gif\" border=\"0\" alt=\"\"/></a>\n";
print "</td>";
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
$album_all = pg_query($database, "select identifier, caption, parent_album from album where users=$my_user_id[0] and type='c' order by date_of_creation desc");
$album_all = pg_query($database, "select identifier, caption, parent_album from album where users=$po_user[id] and type='c' order by date_of_creation desc");
if (pg_num_rows($album_all) > 0) {
display_linkto_album($album_all, $album_id);
}

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -21,7 +21,6 @@ include_once "include/vars.php";
include_once "include/config.php";
include_once "include/common.php";
include_once "include/site.php";
include_once "include/site.php";
include_once "$theme/theme.php";
function display_help_navigator($num_of_pages, $index, $helpfiles, $theme) {
@ -44,11 +43,11 @@ function display_help_navigator($num_of_pages, $index, $helpfiles, $theme) {
print "<tr>\n";
print "<td align=\"center\" valign=\"top\">\n";
print "<a class=\"nodecor\" href=\"help.php?help=$first_page_index\">";
print "<img src=\"$theme/button.first.gif\" border=\"0\" title=\"$first_page_title\" alt=\"$first_page_title\"></a>";
print "<img src=\"$theme/button.first.gif\" border=\"0\" title=\"$first_page_title\" alt=\"$first_page_title\"/></a>";
print "</td>\n";
print "<td align=\"center\" valign=\"top\">\n";
print "<a class=\"nodecor\" href=\"help.php?help=$previous_page_index\">";
print "<img src=\"$theme/button.previous.gif\" border=\"0\" title=\"$previous_page_title\" alt=\"$previous_page_title\"></a>\n";
print "<img src=\"$theme/button.previous.gif\" border=\"0\" title=\"$previous_page_title\" alt=\"$previous_page_title\"/></a>\n";
print "</td>\n";
print "<td>&nbsp;</td>\n";
print "<td align=\"center\" valign=\"middle\">\n";
@ -61,9 +60,9 @@ function display_help_navigator($num_of_pages, $index, $helpfiles, $theme) {
print "<td align=\"center\" valign=\"middle\">\n";
print "<a class=\"nodecor\" href=\"help.php?help=$i\">";
if ($index == $i)
print "<img src=\"$theme/button.option.a.gif\" border=\"0\" alt=\"*\" title=\"$current_page_title\"></a>\n";
print "<img src=\"$theme/button.option.a.gif\" border=\"0\" alt=\"*\" title=\"$current_page_title\"/></a>\n";
else
print "<img src=\"$theme/button.option.gif\" border=\"0\" alt=\"o\" title=\"$current_page_title\"></a>\n";
print "<img src=\"$theme/button.option.gif\" border=\"0\" alt=\"o\" title=\"$current_page_title\"/></a>\n";
print "</td>\n";
$button_counter++;
if ($button_counter == 25) {
@ -77,19 +76,17 @@ function display_help_navigator($num_of_pages, $index, $helpfiles, $theme) {
print "<td>&nbsp;</td>\n";
print "<td align=\"center\" valign=\"top\">\n";
print "<a class=\"nodecor\" href=\"help.php?help=$next_page_index\">";
print "<img src=\"$theme/button.next.gif\" border=\"0\" title=\"$next_page_title\" alt=\"$next_page_title\"></a>\n";
print "<img src=\"$theme/button.next.gif\" border=\"0\" title=\"$next_page_title\" alt=\"$next_page_title\"/></a>\n";
print "</td>\n";
print "<td align=\"center\" valign=\"top\">\n";
print "<a class=\"nodecor\" href=\"help.php?help=$last_page_index\">";
print "<img src=\"$theme/button.last.gif\" border=\"0\" title=\"$last_page_title\" alt=\"$last_page_title\"></a>\n";
print "<img src=\"$theme/button.last.gif\" border=\"0\" title=\"$last_page_title\" alt=\"$last_page_title\"/></a>\n";
print "</td>\n";
print "</tr>\n";
print "</table>\n";
}
$database = site_prolog();
$session_id = $_COOKIE[$po_cookie];
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
$help_id = $_REQUEST['help'];
if ($help_id == "") {
@ -112,12 +109,14 @@ $helpfiles = array (array("Content", "content.html"),
array("Administrator", "admin.html"));
site_header($page_width, "Help");
site_navigator(4, $my_user_id[1]);
site_navigator(4);
$little_hack = $helpfiles[$help_id][0];
site_navigator_status("<a href=\"help.php\">Help</a> : $little_hack", "");
print "&nbsp;<br/>\n";
display_help_navigator(14, $help_id, $helpfiles, $theme);
print "&nbsp;<br/>\n";
print "<h3>Please note that this documentation is outdated.</h3><h3>Visit the <a href=\"http://po.shaftnet.org/podoc:start\">Photo Organizer Wiki</a> for current documentation. This will be fixed in a future release.</h3>\n";
print "<table width=\"100%\">";
print "<tr><td >";
print "&nbsp;<br/>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -24,16 +24,17 @@ include_once "include/calendar.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
$photo_id = $_REQUEST['image'];
$image_size = $_REQUEST['size'];
$version = $_REQUEST['ver'];
$photo_id = pg_escape_string($_REQUEST['image']);
$image_size = pg_escape_string($_REQUEST['size']);
$version = pg_escape_string(array_key_exists('ver', $_REQUEST) ? $_REQUEST['ver'] : FALSE);
if (!$photo_id) {
header("HTTP/1.1 404 Not found");
exit();
}
$database = site_prolog();
$version_selector = $version ? "photo_version.identifier=$version" : "photo_version.master='t'";
$photo_data = pg_fetch_row(pg_query($database, "
@ -44,39 +45,39 @@ $photo_data = pg_fetch_row(pg_query($database, "
where $version_selector
and photo.identifier = '$photo_id'"));
if (!$photo_data) {
header("HTTP/1.1 404 Not found");
site_epilog($database);
exit();
}
$my_user_id = pg_fetch_row(pg_query($database, "
select identifier, type
from users
where session_id='$session_id'"));
$client = "";
$owner_user_id = $photo_data[0];
if ($owner_user_id != "" && $my_user_id[0] != "") {
if (($owner_user_id != $po_user['id']) &&
($po_user['type'] > $user_type['disabled'])) {
$client = pg_fetch_row(pg_query($database, "
select identifier
from client
where users='$owner_user_id'
and client='$my_user_id[0]'
and client='$po_user[id]'
and status=$client_status[accepted]"));
}
if ($image_size == 3) {
if (!$my_user_id[0])
$my_user_id[0] = "null";
if ($po_user['type'] == $user_type['disabled']) {
$po_user['id'] = "null";
}
$all_photo_items_for_sale = pg_query($database, "
select (select max(download_counter) from shop_order where item=photo_item.identifier and shop_order.client = $my_user_id[0] and transaction is not null) as counter,
(select max(download_expiry_date) from shop_order where item=photo_item.identifier and shop_order.client = $my_user_id[0] and transaction is not null) as expiry_date,
select (select max(download_counter) from shop_order where item=photo_item.identifier and shop_order.client = $po_user[id] and transaction is not null) as counter,
(select max(download_expiry_date) from shop_order where item=photo_item.identifier and shop_order.client = $po_user[id] and transaction is not null) as expiry_date,
(select max(shop_order.identifier) from shop_order, shop_transaction, client where shop_order.transaction=shop_transaction.identifier and shop_order.client = client.client and (client.trusted = 't' or shop_transaction.status = '2')) as purchase_confirmed
from photo_item, shop_item
where photo_item.shop_item = shop_item.identifier
and photo=$photo_id");
}
/* check if the original is hidden or bought */
if ($image_size == 3) {
/* check if the original is hidden or bought */
$number_of_photos_for_sale = pg_num_rows($all_photo_items_for_sale);
$photo_on_client_order = false;
for ($i=0; $i < $number_of_photos_for_sale; $i++) {
@ -95,28 +96,31 @@ if ($image_size == 3) {
if (!$photo_on_client_order &&
($photo_data[6] == "t") &&
($my_user_id[0] != $owner_user_id) &&
($my_user_id[1] != $user_type['administrator'])) {
($po_user['id'] != $owner_user_id) &&
($po_user['type'] != $user_type['administrator'])) {
site_epilog($database);
header("HTTP/1.1 403 Permission Denied");
exit();
}
}
site_epilog($database);
/* if the photo is private and isn't mine return */
/* if the photo is private and isn't mine, return */
if (($photo_data[5] == $access['private']) &&
($my_user_id[0] != $owner_user_id) &&
($my_user_id[1] != $user_type['administrator'])) {
exit();
($po_user['id'] != $owner_user_id) &&
($po_user['type'] != $user_type['administrator'])) {
header("HTTP/1.1 403 Permission Denied");
site_epilog($database);
exit();
}
/* if the photo is protected and I am not a customer or this user, and the photo isn't mine than return */
/* if the photo is protected and I am not a customer or this user, and the photo isn't mine, return */
if (($photo_data[5] == $access['protected']) &&
($my_user_id[0] != $owner_user_id) &&
($my_user_id[1] != $user_type['administrator']) &&
($po_user['id'] != $owner_user_id) &&
($po_user['type'] != $user_type['administrator']) &&
($client == "")) {
exit();
header("HTTP/1.1 403 Permission Denied");
site_epilog($database);
exit();
}
switch ($image_size) {
@ -126,14 +130,25 @@ switch ($image_size) {
$disposition = "inline";
break;
case 2:
/* Update view counter if it's not viewed by its owner. */
if ($po_user['id'] != $owner_user_id) {
pg_query($database, "update photo set views=views+1 where identifier=$photo_id");
}
$image_path = $photo_data[3];
$disposition = "inline";
break;
case 3:
/* Update view counter if it's not viewed by its owner. */
if ($po_user['id'] != $owner_user_id) {
pg_query($database, "update photo set views=views+1 where identifier=$photo_id");
}
$image_path = $photo_data[4];
$disposition = "attachment; ";
break;
}
site_epilog($database);
$image_type = substr(strtolower(strrchr ($image_path, ".")), 1);
$mime = $mime_type[$image_type]['type'];
@ -170,8 +185,11 @@ if (is_file($image_repository_path . "/" . $image_path)) {
/* - We handle the If-Modified-Since header for compliant browsers. */
$time_of_last_modification = time();
if ($stat = stat($file_name))
$file_length = 0;
if ($stat = stat($file_name)) {
$time_of_last_modification = $stat[9];
$file_length = $stat[7];
}
$if_modified_time = -1;
$all_headers = getallheaders();
@ -200,8 +218,13 @@ if (strpos($browser, "MSIE 5")) {
header("Cache-Control: pre-check=" . $expire);
}
if ($file_length) {
header("Content-Length: $file_length");
}
$file_descriptor = fopen($file_name, 'rb');
if ($file_descriptor === false) {
header("HTTP/1.1 500 Internal Server Error");
exit(0);
}

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -128,7 +128,7 @@ function display_users_and_clients($database, $my_user_id) {
$user_list = pg_query($database, "
select users.identifier, last_name, first_name, member_since, value, user_type.identifier, bulk_upload_enable, shop_enable,
quota_size, quota_count, shared
quota_size, quota_count, shared, username
from users, user_type, preferences
where users.type=user_type.identifier
and users.preferences=preferences.identifier
@ -163,7 +163,7 @@ function display_users_and_clients($database, $my_user_id) {
$photo_versions_by_user[0] -= $photos_by_user[0];
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"user.php?user=$user[0]\">$user[1], $user[2]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"user.php?user=$user[0]\">$user[1], $user[2]</a> ($user[11])</td>\n";
print "<td align=\"center\" bgcolor=\"$color[table_body]\" >$photos_by_user[0]";
if ($photo_versions_by_user[0] > 0)
print ", $photo_versions_by_user[0]";
@ -195,7 +195,7 @@ function display_users_and_clients($database, $my_user_id) {
}
print "</div>\n";
print "&nbsp;<br/>\n";
print "<div align=\"center\"><a class=\"nodecor\" href=\"register.php\"><img src=\"$theme/button.register.gif\" border=\"0\" alt=\"Register\"></a></div>";
print "<div align=\"center\"><a class=\"nodecor\" href=\"register.php\"><img src=\"$theme/button.register.gif\" border=\"0\" alt=\"Register\"/></a></div>";
}
function display_front_page_editor($file_name) {
@ -212,7 +212,7 @@ function display_front_page_editor($file_name) {
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" value=\"Save Changes\">\n";
print "<input type=\"image\" src=\"$theme/button.save.changes.gif\" value=\"Save Changes\"/>\n";
print "</form>\n";
}

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -181,14 +181,14 @@ function generate_date_html($timestamp, $format, $link) {
switch ($format) {
case 'full':
if ($link)
$html_string .= "<a href=\"my.datebook.php?view=1&year=$year&month=$month&day=$day\">$current_month_string $day, $year</a> at $time";
$html_string .= "<a href=\"my.datebook.php?view=1&amp;year=$year&amp;month=$month&amp;day=$day\">$current_month_string $day, $year</a> at $time";
else
$html_string .= "$current_month_string $day, $year at $time";
break;
case 'date':
case 'short_date':
if ($link)
$html_string .= "<a href=\"my.datebook.php?view=1&year=$year&month=$month&day=$day\">$current_month_string $day, $year</a>";
$html_string .= "<a href=\"my.datebook.php?view=1&amp;year=$year&amp;month=$month&amp;day=$day\">$current_month_string $day, $year</a>";
else
$html_string .= "$current_month_string $day, $year";
break;

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -444,19 +444,19 @@ function display_im_watermark_mask_location($identifier, $current_value) {
print "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\">\n";
print "<tr>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"northwest\" $northwest_checked>North West</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"north\" $north_checked>North</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"northeast\" $northeast_checked>North East</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"northwest\" $northwest_checked/>North West</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"north\" $north_checked/>North</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"northeast\" $northeast_checked/>North East</td>";
print "</tr>\n";
print "<tr>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"west\" $west_checked>West</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"center\" $center_checked>Center</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"east\" $east_checked>East</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"west\" $west_checked/>West</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"center\" $center_checked/>Center</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"east\" $east_checked/>East</td>";
print "</tr>\n";
print "<tr>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"southwest\" $southwest_checked>South West</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"south\" $south_checked>South</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"southeast\" $southeast_checked>South East</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"southwest\" $southwest_checked/>South West</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"south\" $south_checked/>South</td>";
print "<td align=\"left\"><input type=\"radio\" name=\"$identifier\" value=\"southeast\" $southeast_checked/>South East</td>";
print "</tr>\n";
print "</table>\n";
}

File diff suppressed because it is too large Load Diff

View File

@ -33,12 +33,18 @@ $site_title = "My Photo Organizer";
// Default sorting order
$default_order_by = 7;
// database connection details:
$db_host = "127.0.0.1";
$db_port = "5432";
$db_name = "po_dev_db";
$db_user = "po_dev_user";
$db_password = "none";
/* Database connection details */
// Use a local database via UNIX socket (fast and secure, default)
$db_dsn = "dbname=po_db user=po_user password=po_password";
// Use a local database via IP (slower)
// $db_dsn = "host=127.0.0.1 port=5432 dbname=po_db user=po_user password=po_password";
// Use an external database via IP
// $db_dsn = "host=218.61.15.251 port=5432 dbname=po_db user=po_user password=po_password";
/* End Database details */
// content based image retrieval server connection details:
$cbir_host = "";
@ -71,6 +77,9 @@ $sys_dcraw = "/usr/local/bin/dcraw";
// exiftool utility
$sys_exiftool = "/usr/bin/exiftool";
/* Raw decoders, in order of prescedence */
$raw_decoder = "dcraw,exiftool";
// PS2PDF - converts PS documents into PDF ones
$sys_ps2pdf = "/usr/bin/ps2pdf";
@ -154,7 +163,11 @@ $forbidden_keywords = array("a", "b", "c", "d", "e", "f", "g", "h",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
"on", "in", "the", "of", "to", "at", "an", "as");
/* Do NOT remove the below line */
/* Default error reporting level */
error_reporting(E_ALL ^ E_NOTICE);
/* Do NOT remove the below lines */
$install_enabled=0;
include_once "config_site.php"
?>

View File

@ -7,12 +7,13 @@
$site_url = "http://localhost/po"; // This site's url
$site_title = "My Photo Organizer"; // Appears in the titlebar on every page.
$db_host = "127.0.0.1";
$db_port = "5432";
$db_name = "po_dev_db";
$db_user = "po_dev_user";
$db_password = "none";
// For additional database configuration examples, see config.php
// Use a local database via UNIX socket (fast and secure, default)
$db_dsn = "dbname=po_db user=po_user password=po_password";
$image_repository_path = "/export/po_dev_image_repository";
// set this to 0 once your installation is finished.
$install_enabled = 1;
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -27,11 +27,11 @@ function display_clients($database, $my_user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"6\"><font class=\"tabletop\">My Clients</font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"50%\">Client Name</td>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"15%\">Status</td>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"10%\">Trusted</td>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"15%\">Registration Date</td>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"10%\" colspan=\"2\">&nbsp;</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">Client Name</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"15%\">Status</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Trusted</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"15%\">Registration Date</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\">&nbsp;</td>\n";
print "</tr>\n";
$all_clients = pg_query($database, "select identifier, client, last_name, first_name, date_of_creation, value, type, trusted
@ -70,10 +70,10 @@ function display_protected_photographers($database, $my_user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\"><font class=\"tabletop\">I am the client of the following users</font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"50%\">User</td>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"20%\">Status</td>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"20%\">Registration Date</td>\n";
print "<td align=\"left\" bgcolor=$color[table_header] width=\"10%\">&nbsp;</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\">User</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\">Status</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\">Registration Date</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">&nbsp;</td>\n";
print "</tr>\n";
$all_subscribed_users = pg_query($database, " select identifier, users, last_name, first_name, date_of_creation, value from view_users_subscribed_to where client='$my_user_id' and status!='4'");

View File

@ -17,13 +17,24 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
$db_connection = "host=" . $db_host . " port=" . $db_port . " dbname=" . $db_name . " user=" . $db_user . " password=" . $db_password;
/* Simple database connection wrapper */
function po_dbconnect() {
global $db_connection;
// return pg_connect($db_connection); /* Normal */
return pg_pconnect($db_connection); /* Persistent */
global $db_dsn;
{ // Compatibility code...
global $db_host;
global $db_port;
global $db_name;
global $db_user;
global $db_password;
if (isset($db_host)) {
$db_dsn = "host=" . $db_host . " port=" . $db_port . " dbname=" . $db_name . " user=" . $db_user . " password=" . $db_password;
}
}
// return pg_connect($db_dsn); /* Normal */
return pg_pconnect($db_dsn); /* Persistent */
}
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,7 +22,7 @@ $datebook_data = array("clients" => array("idx" => 1, "active_img" => "$theme/
"shipments" => array("idx" => 3, "active_img" => "$theme/navigator.db.shipments.a.gif", "img" => "$theme/navigator.db.shipments.gif", link => "my.datebook.php?selector=3", "alt" => " Shipments "));
function displayMerchandiserTransaction($database, $my_user_id, $transaction_status) {
function displayMerchandiserTransaction($database, $user_id, $transaction_status) {
global $style;
global $color;
@ -38,7 +38,7 @@ function displayMerchandiserTransaction($database, $my_user_id, $transaction_sta
where shop_order.client=users.identifier
and shop_order.item=photo_item.identifier
and photo_item.photo=photo.identifier
and photo.users=$my_user_id[0]
and photo.users=$user_id
and shop_transaction.status=$transaction_status
and shop_transaction.identifier=shop_order.transaction
order by shop_transaction.identifier desc");
@ -74,7 +74,7 @@ function displayMerchandiserTransaction($database, $my_user_id, $transaction_sta
}
function displayClientTransaction($database, $my_user_id, $transaction_status) {
function displayClientTransaction($database, $user_id, $transaction_status) {
global $style;
global $color;
@ -90,7 +90,7 @@ function displayClientTransaction($database, $my_user_id, $transaction_status) {
where shop_order.client=users.identifier
and shop_order.item=photo_item.identifier
and photo_item.photo=photo.identifier
and shop_order.client=$my_user_id[0]
and shop_order.client=$user_id
and shop_transaction.status=$transaction_status
and shop_transaction.identifier=shop_order.transaction
order by shop_transaction.identifier desc");
@ -206,7 +206,7 @@ function displayDayHTML($database, $user_id, $year, $month, $day, $cal_start_hou
for ($i = $cal_start_hour; $i <= $cal_end_hour; $i ++)
print "<td align=\"left\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"$cell_width%\">$i</td>\n";
print "<td align=\"left\" valign=\"middle\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\">";
print "<a href=\"event.add.php?year=$year&month=$month&day=$day\">Add</a></td>\n";
print "<a href=\"event.add.php?year=$year&amp;month=$month&amp;day=$day\">Add</a></td>\n";
print "</tr>\n";
for ($event = 0; $event < $num_of_events; $event++) {
@ -222,15 +222,15 @@ function displayDayHTML($database, $user_id, $year, $month, $day, $cal_start_hou
if ($end_minute != 0)
$event_cells++;
print "<td align=\"center\" valign=\"top\" bgcolor=$color[selected] colspan=\"$event_cells\">";
print "<td align=\"center\" valign=\"top\" bgcolor=\"$color[selected]\" colspan=\"$event_cells\">";
displayDayEventHTML($event_data[0], $event_data[3], $event_data[1], $event_data[2], $view, $color[selected]);
print "</td>\n";
for ($i = $end_hour; $i < $cal_end_hour; $i ++)
print "<td align=\"center\" valign=\"top\" bgcolor=$color[highlight] >&nbsp;</td>\n";
print "<td align=\"center\" valign=\"top\" bgcolor=\"$color[highlight]\" >&nbsp;</td>\n";
if (($end_hour != $start_hour) && ($end_minute == 0))
print "<td align=\"center\" valign=\"top\" bgcolor=$color[highlight] >&nbsp;</td>\n";
print "<td align=\"center\" valign=\"top\" bgcolor=\"$color[highlight]\" >&nbsp;</td>\n";
print "<td align=\"center\" valign=\"top\" bgcolor=\"$color[table_body]\" ><a href=event.edit.php?event=$event_data[0]>Edit</a></td>\n";
print "<td align=\"center\" valign=\"top\" bgcolor=\"$color[table_body]\" ><a href=event.del.php?event=$event_data[0]>Delete</a></td>\n";
@ -256,7 +256,7 @@ function displayWeekHTML($database, $user_id, $year, $week, $dayNames, $startDay
print "<tr>\n";
for ($dayIncrement = 0; $dayIncrement < 7; $dayIncrement++) {
$curDate = adjustDay($firstDayOfWeek[0], $firstDayOfWeek[1], $firstDayOfWeek[2] + $dayIncrement);
print "<td align=\"center\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"14%\"><a href=\"my.datebook.php?view=1&year=$curDate[0]&month=$curDate[1]&day=$curDate[2]\"><b>" . $dayNames[($startDay+$dayIncrement)%7] . ", $curDate[2]</b></a></td>\n";
print "<td align=\"center\" valign=\"top\" bgcolor=\"$color[table_header]\" width=\"14%\"><a href=\"my.datebook.php?view=1&amp;year=$curDate[0]&amp;month=$curDate[1]&amp;day=$curDate[2]\"><b>" . $dayNames[($startDay+$dayIncrement)%7] . ", $curDate[2]</b></a></td>\n";
}
print "</tr>";
print "<tr>\n";
@ -316,7 +316,7 @@ function displayMonthHTML($database, $user_id, $year, $month, $dayNames, $startD
$curDate = adjustDay($year, $month, $day);
$weekNumber=getWeekNumber($curDate[0], $curDate[1], $curDate[2], $startDay);
print "<td align=\"center\" valign=\"top\" bgcolor=\"$color[table_body]\" >";
print "<a href=\"my.datebook.php?view=2&year=$year&month=$curDate[1]&day=$curDate[2]\">$weekNumber</a></td>\n";
print "<a href=\"my.datebook.php?view=2&amp;year=$year&amp;month=$curDate[1]&amp;day=$curDate[2]\">$weekNumber</a></td>\n";
for ($i = 0; $i < 7; $i++) {
$curDate = adjustDay($year, $month, $day);
$bgcolor = $color[highlight];
@ -326,7 +326,7 @@ function displayMonthHTML($database, $user_id, $year, $month, $dayNames, $startD
$bgcolor = $color[selected];
print "<td align=\"left\" valign=\"top\" bgcolor=\"$bgcolor\" >";
print "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td align=\"left\" valign=\"top\" >";
print "<a href=\"my.datebook.php?view=1&year=$curDate[0]&month=$curDate[1]&day=$curDate[2]\">$curDate[2]</a>&nbsp;";
print "<a href=\"my.datebook.php?view=1&amp;year=$curDate[0]&amp;month=$curDate[1]&amp;day=$curDate[2]\">$curDate[2]</a>&nbsp;";
print "</td><td align=\"right\" valign=\"top\" bgcolor=\"$bgcolor\" >";
$date = sprintf("%04d-%02d-%02d", $curDate[0], $curDate[1], $curDate[2]);
$result = pg_query($database, "select identifier, start_date, end_date from calendar where users=$user_id and (start_date ~* '$date' or end_date ~* '$date') order by start_date");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -252,13 +252,14 @@ function photo_parse_exif($database, $index, $user_id, $image_data) {
$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 "<li>key: $parts[0] value: $parts[1]";
// $image_data["exif"] = $image_data["exif"] . "$line";
$image_data["exif"] = $image_data["exif"] . "<tr><td>$parts[0]</td><td>$parts[1]</td></tr>";
$image_data["exif"] .= "<key>$parts[0]</key><value>$parts[1]</value>";
$exif_data[$parts[0]] = $parts[1];
}
pclose($handle);
@ -266,21 +267,32 @@ function photo_parse_exif($database, $index, $user_id, $image_data) {
$image_data["exif"] = ""; // XXX don't store exif data.
/* Now we parse the data */
exif_string_helper($image_data, $exif_data, "author", "Artist");
exif_string_helper($image_data, $exif_data, "copyright", "Copyright");
if (isset($exif_data["Artist"]))
exif_string_helper($image_data, $exif_data, "author", "Artist");
if (isset($exif_data["Copyright"]))
exif_string_helper($image_data, $exif_data, "copyright", "Copyright");
if (!$image_data['IgnoreExifUserComment'])
exif_string_helper($image_data, $exif_data, "title", "User Comment");
$image_data["date_of_exposure"] = convert_exif2sql_timestamp($exif_data["Date/Time Original"]);
if ($image_data["date_of_exposure"] == "")
$image_data["date_of_exposure"] = convert_exif2sql_timestamp($exif_data["Create Date"]);
if (isset($exif_data["Date/Time Original"]))
$image_data["date_of_exposure"] = convert_exif2sql_timestamp($exif_data["Date/Time Original"]);
$image_data["camera"] = convert_exif_camera($database, $user_id, validate_exif_string($exif_data["Make"]), validate_exif_string($exif_data["Camera Model Name"]));
$image_data["camera_input_profile"] = convert_exif_camera_profile($database, $user_id, validate_exif_string($exif_data["Make"]), validate_exif_string($exif_data["Camera Model Name"]));
if (isset($exif_data["Create Date"]))
if ($image_data["date_of_exposure"] == "")
$image_data["date_of_exposure"] = convert_exif2sql_timestamp($exif_data["Create Date"]);
$image_data["film"] = convert_exif_iso_film($database, $user_id, $exif_data["ISO"]);
if (isset($exif_data["Camera Model Name"])) {
$image_data["camera"] = convert_exif_camera($database, $user_id, validate_exif_string($exif_data["Make"]), validate_exif_string($exif_data["Camera Model Name"]));
$image_data["camera_input_profile"] = convert_exif_camera_profile($database, $user_id, validate_exif_string($exif_data["Make"]), validate_exif_string($exif_data["Camera Model Name"]));
}
if (isset($exif_data["ISO"]))
$image_data["film"] = convert_exif_iso_film($database, $user_id, $exif_data["ISO"]);
$image_data["flash_comp"] = convert_exif_ev_comp($database, $exif_data["Flash Exposure Compensation"]);
if (isset($exif_data["Flash Exposure Compensation"]))
$image_data["flash_comp"] = convert_exif_ev_comp($database, $exif_data["Flash Exposure Compensation"]);
$tmp = $exif_data["Focal Length"];
$tmp = substr($tmp, 0, strpos($tmp, 'mm'));
@ -294,22 +306,29 @@ function photo_parse_exif($database, $index, $user_id, $image_data) {
}
}
$image_data["focal_length"] = convert_exif_focal_length($database, $tmp);
if (isset($exif_data["Focal Length"]))
$image_data["focal_length"] = convert_exif_focal_length($database, $tmp);
$image_data["exp_comp"] = convert_exif_ev_comp($database, $exif_data["Exposure Compensation"]);
$image_data["exp_diff"] = convert_exif_ev_comp($database, $exif_data["Exposure Difference"]);
$image_data["aperture"] = convert_exif_aperture($database, $exif_data["F Number"]);
$image_data["shutter"] = convert_exif_shutter($database, $exif_data["Shutter Speed"]);
if (isset($exif_data["Exposure Compensation"]))
$image_data["exp_comp"] = convert_exif_ev_comp($database, $exif_data["Exposure Compensation"]);
if (isset($exif_data["Exposure Difference"]))
$image_data["exp_diff"] = convert_exif_ev_comp($database, $exif_data["Exposure Difference"]);
if (isset($exif_data["F Number"]))
$image_data["aperture"] = convert_exif_aperture($database, $exif_data["F Number"]);
if (isset($exif_data["Shutter Speed"]))
$image_data["shutter"] = convert_exif_shutter($database, $exif_data["Shutter Speed"]);
/* Color Spaces! */
if ($image_data["ICC Profile"])
if (isset($exif_data["ICC Profile"]))
$image_data["colorspace"] = 99; /* Embedded Profile */
else if (isset($exif_data["Profile Class"]))
$image_data["colorspace"] = 99; /* Embedded Profile */
else if ($image_data["Profile Class"])
$image_data["colorspace"]; /* Embedded Profile */
else if (substr_compare($image_data['file'][$index]['original_name'], "_", 0, 1) == 0)
$image_data["colorspace"]; /* Adobe RGB */
else if ($exif_data["Color Space"]) {
else if (isset($exif_data["Color Space"])) {
$image_data["colorspace"] = 1; /* Default to sRGB */
if ($exif_data["Color Space"] == "Adobe RGB")
$image_data["colorspace"] = 2; /* Adobe RGB */
@ -455,184 +474,6 @@ function photo_parse_exif($database, $index, $user_id, $image_data) {
$image_data["orientation"] = $exif["IFD1"]["Orientation"];
$image_data["exif"] = "";
if (($exif_string = validate_exif_string($exif["GPS"]["GeodeticSurveyData"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Geodetic Survey Data</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["GPS"]["Latitude Reference"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Latitude Reference</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["GPS"]["Latitude"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Latitude</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["GPS"]["Longitude Reference"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Longitude Reference</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["GPS"]["Longitude"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Longitude</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["GPS"]["NumTags"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Number of tags</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["GPS"]["Time"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Time</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["GPS"]["Version"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Version</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["ACDComment"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>ACD Comment</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["HostComputer"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Host Computer</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["ImageDescription"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Image Description</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["ImageType"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Image Type</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["PhotometricInterpret"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Photometric Interpretation</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["PhotoshopSettings"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Photoshop Settings</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["PlanarConfig"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Planar Configuration</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["PrimaryChromaticities"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Primary Chromaticities</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["ReferenceBlackWhite"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Reference Black and White</td><td>".$exif_string."</td></tr>";
if (($exif_resolution_unit = validate_exif_string($exif["IFD0"]["ResolutionUnit"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Resolution Unit</td><td>".$exif_resolution_unit."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["SamplePerPixel"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Sample Per Pixel</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["Software"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Software</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["WhitePoint"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>White Point</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["YCbCrCoefficients"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>YCbCr Coefficients</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["YCbCrPositioning"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>YCbCr Positioning</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD0"]["xResolution"]))) {
$exif_string = replace_resolution_unit($exif_string, $exif_resolution_unit);
$image_data["exif"] = $image_data["exif"] . "<tr><td>X Resolution</td><td>".$exif_string."</td></tr>";
}
if (($exif_string = validate_exif_string($exif["IFD0"]["yResolution"]))) {
$exif_string = replace_resolution_unit($exif_string, $exif_resolution_unit);
$image_data["exif"] = $image_data["exif"] . "<tr><td>Y Resolution</td><td>".$exif_string."</td></tr>";
}
if (($exif_string = validate_exif_string($exif["IFD1"]["BitsPerSample"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Bits Per Sample</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["Compression"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Compression</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["ImageLength"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Image Length</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["ImageWidth"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Image Width</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["JpegIFByteCount"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>JPEG IF Byte Count</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["JpegIFOffset"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>JPEG IF Offset</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["PhotometricInterpretation"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Photometric Interpretation</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["PlanarConfiguration"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Planar Configuration</td><td>".$exif_string."</td></tr>";
if (($exif_resolution_unit = validate_exif_string($exif["IFD1"]["ResolutionUnit"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Resolution Unit</td><td>".$exif_resolution_unit."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["RowsPerStrip"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Rows Per Strip</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["SamplesPerPixel"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Sample Per Pixel</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["StripByteCounts"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Strip Byte Counts</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["StripOffsets"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Strip Offset</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["ThumbnailDescription"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Thumbnail Description</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["ThumbnailMake"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Thumbnail Make</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["ThumbnailModel"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Thumbnail Model</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["ThumbnailOrientation"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Thumbnail Orientation</td><td>".$exif_string."</td></tr>";
if (($exif_resolution_unit = validate_exif_string($exif["IFD1"]["ThumbnailResolutionUnit"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Thumbnail ResolutionUnit</td><td>".$exif_resolution_unit."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["ThumbnailXResolution"]))) {
$exif_string = replace_resolution_unit($exif_string, $exif_resolution_unit);
$image_data["exif"] = $image_data["exif"] . "<tr><td>Thumbnail X Resolution</td><td>".$exif_string."</td></tr>";
}
if (($exif_string = validate_exif_string($exif["IFD1"]["ThumbnailYResolution"]))) {
$exif_string = replace_resolution_unit($exif_string, $exif_resolution_unit);
$image_data["exif"] = $image_data["exif"] . "<tr><td>Thumbnail Y Resolution</td><td>".$exif_string."</td></tr>";
}
if (($exif_string = validate_exif_string($exif["IFD1"]["YCbCrSubSampling"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>YCbCr Sub Sampling</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["IFD1"]["xResolution"]))) {
$exif_string = replace_resolution_unit($exif_string, $exif_resolution_unit);
$image_data["exif"] = $image_data["exif"] . "<tr><td>X Resolution</td><td>".$exif_string."</td></tr>";
}
if (($exif_string = validate_exif_string($exif["IFD1"]["yResolution"]))) {
$exif_string = replace_resolution_unit($exif_string, $exif_resolution_unit);
$image_data["exif"] = $image_data["exif"] . "<tr><td>Y Resolution</td><td>".$exif_string."</td></tr>";
}
if (($exif_string = validate_exif_string($exif["InteroperabilityIFD"]["InteroperabilityIndex"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Interoperability Index</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["InteroperabilityIFD"]["InteroperabilityVersion"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Interoperability Version</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["InteroperabilityIFD"]["RelatedImageFileFormat"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Related Image File Format</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["InteroperabilityIFD"]["RelatedImageLength"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Related Image Length</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["InteroperabilityIFD"]["RelatedImageWidth"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Related Image Width</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["BrightnessValue"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Brightness Value</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["CFAPattern"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>CFA Pattern</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ColorSpace"]))) {
$image_data['colorspace'] = 1; // default to sRGB
@ -647,237 +488,7 @@ function photo_parse_exif($database, $index, $user_id, $image_data) {
$image_data['colorspace'] = 1; // anything other than '1' is "undefined"
// but we have to treat it as sRGB for consistency's sake.
}
$image_data["exif"] = $image_data["exif"] . "<tr><td>Color Space</td><td>".$exif_string."</td></tr>";
}
if (($exif_string = validate_exif_string($exif["SubIFD"]["ComponentsConfiguration"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Components Configuration</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["CompressedBitsPerPixel"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Compressed Bits Per Pixel</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["Contrast"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Contrast</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["CustomerRender"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Customer Render</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["DigitalZoomRatio"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Digital Zoom Ratio</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ExifImageHeight"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>EXIF Image Height</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ExifImageWidth"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>EXIF Image Width</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ExifInteroperabilityOffset"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>EXIF Interoperability Offset</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ExifVersion"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>EXIF Version</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ExposureIndex"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Exposure Index</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ExposureMode"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Exposure Mode</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ExposureProgram"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Exposure Program</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["FileSource"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>File Source</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["Flash"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Flash</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["FlashEnergy"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Flash Energy</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["FlashPixVersion"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Flash Pix Version</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["GainControl"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Gain Control</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["ImageHistory"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Image History</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["KnownMaker"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Known Maker</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["LightSource"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Light Souce</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["CameraID"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Identifier</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["CameraSerialNumber"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Serial Number</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["CustomFunctions"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Custom Functions</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["DigiZoom"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Digital Zoom</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["FirmwareVersion"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Firmware Version</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["ImageNumber"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Image Number</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["ImageType"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Image Type</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["JpegQual"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera JPEG Quality</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Macro"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Macro</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["OwnerName"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Owner Name</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["AFPointSelected"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Auto Focus Point</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["Bytes"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Bytes</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["Contrast"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Contrast</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["DigitalZoom"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Digital Zoom</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["DriveMode"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Driver Mode</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["EasyShooting"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Easy Shooting</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["ExposureMode"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Exposure Mode</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["Flash"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Flash</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["FlashActivity"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Flash Activity</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["FlashDetails"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Flash Details</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["FocalUnits"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Focal Units</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["FocusMode"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Focus Mode</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["FocusType"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Focus Type</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["ImageSize"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Image Size</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["LongFocalLength"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Long Focal Length</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["Macro"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Macro</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["MeteringMode"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Metering Mode</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["Quality"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Quality</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["Saturation"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Saturation</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["SelfTimer"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Self Timer</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["Sharpness"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Sharpness</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 1"]["ShortFocalLength"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Short Focal Length</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 4"]["AFPointUsed"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Auto Focus Point Used</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 4"]["Bytes"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Bytes</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 4"]["SequenceNumber"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Sequence Number</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 4"]["SubjectDistance"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Subject Distance</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["Settings 4"]["WhiteBalance"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera White Balance</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["SoftwareRelease"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Software Release</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MakerNote"]["SpecialMode"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Camera Special Mode</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MaxApertureValue"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Maximum Aperture Value</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["MeteringMode"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Metering Mode</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["RelatedSoundFile"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Related Sound File</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["Saturation"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Saturation</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SceneCaptureMode"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Scene Capture Mode</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SceneType"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Scene Type</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SensingMethod"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Sensing Method</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["Sharpness"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Sharpness</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SpacialFreqResponse"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Spacial Frequency Response</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SpectralSensitivity"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Spectral Sensitivity</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SubjectDistance"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Subject Distance</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SubjectLocation"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Subject Location</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SubsecTimeDigitized"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Subsec Time Digitiezed</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["SubsecTimeOriginal"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>Subsec Time Original</td><td>".$exif_string."</td></tr>";
if (($exif_string = validate_exif_string($exif["SubIFD"]["WhiteBalance"])))
$image_data["exif"] = $image_data["exif"] . "<tr><td>White Balance</td><td>".$exif_string."</td></tr>";
// I don't want any of this crap stored.
$image_data["exif"] = "";
print "done</li>";
return $image_data;

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -278,7 +278,7 @@ function convert_xml2html($string) {
function create_xml_header() {
$xml_string = "<?xml version='1.0'?>\n";
$xml_string = $xml_string . "<!DOCTYPE BULKUPLOAD SYSTEM \"http://www.k-i-s.net/sw/po/demo/po.dtd\">\n";
$xml_string .= "<!DOCTYPE BULKUPLOAD SYSTEM \"http://www.k-i-s.net/sw/po/demo/po.dtd\">\n";
return $xml_string;
}
@ -301,66 +301,77 @@ function create_xml_bulkupload_footer() {
function create_xml_photo($image_data) {
$xml_string = "<photo";
if ($image_data['title'])
$xml_string = $xml_string . " title=\"".$image_data['title']."\"";
$xml_string = $xml_string . ">\n";
$xml_string .= " title=\"".$image_data['title']."\"";
$xml_string .= ">\n";
if ($image_data['caption'])
$xml_string = $xml_string . "<caption>".$image_data['caption']."</caption>\n";
if ($image_data['keyword'])
$xml_string = $xml_string . "<keyword>".$image_data['keyword']."</keyword>\n";
$xml_string .= "<caption>".$image_data['caption']."</caption>\n";
if ($image_data['keywords'])
foreach ($image_data['keywords'] as $keyword) {
$xml_string .= "<keyword>".$keyword."</keyword>\n";
}
if ($image_data['copyright'])
$xml_string = $xml_string . "<copyright>".$image_data['copyright']."</copyright>\n";
$xml_string .= "<copyright>".$image_data['copyright']."</copyright>\n";
if ($image_data['author'])
$xml_string = $xml_string . "<author>".$image_data['author']."</author>\n";
$xml_string .= "<author>".$image_data['author']."</author>\n";
foreach($image_data['file'] as $version) {
$xml_string = $xml_string . "<file name=\"".$version['name']."\"";
$xml_string .= "<file name=\"".$version['name']."\"";
if ($version['remark'])
$xml_string = $xml_string . " remark=\"".$version['remark']."\"";
$xml_string .= " remark=\"".$version['remark']."\"";
if ($version['master'] == 't')
$xml_string = $xml_string . " master=\"yes\"";
$xml_string = $xml_string . "/>\n";
$xml_string .= " master=\"yes\"";
$xml_string .= "/>\n";
}
$exposure_year = substr($image_data['date_of_exposure'], 0, 4);
$exposure_month = substr($image_data['date_of_exposure'], 5, 2);
$exposure_day = substr($image_data['date_of_exposure'], 8, 2);
$exposure_hour = substr($image_data['date_of_exposure'], 11, 2);
$exposure_min = substr($image_data['date_of_exposure'], 14, 2);
$exposure_sec = substr($image_data['date_of_exposure'], 17, 2);
if ($exposure_year || $exposure_month || $exposure_day) {
$xml_string = $xml_string . "<expdate";
$xml_string .= "<expdate";
if ($exposure_year)
$xml_string = $xml_string . " year=\"$exposure_year\"";
$xml_string .= " year=\"$exposure_year\"";
if ($exposure_month)
$xml_string = $xml_string . " month=\"$exposure_month\"";
$xml_string .= " month=\"$exposure_month\"";
if ($exposure_day)
$xml_string = $xml_string . " day=\"$exposure_day\"";
$xml_string = $xml_string . " />\n";
$xml_string .= " day=\"$exposure_day\"";
if ($exposure_hour)
$xml_string .= " hours=\"$exposure_hour\"";
if ($exposure_min)
$xml_string .= " minutes=\"$exposure_min\"";
if ($exposure_sec)
$xml_string .= " seconds=\"$exposure_sec\"";
$xml_string .= " />\n";
}
if ($image_data['location'] && $image_data['location'] != "null")
$xml_string = $xml_string . "<location id=\"".$image_data['location']."\" />\n";
$xml_string .= "<location id=\"".$image_data['location']."\" />\n";
if (($image_data['storage_location_type'] && $image_data['storage_location_type'] != null) ||
($image_data['storage_location_id'] && $image_data['storage_location_id'] != null) ||
($image_data['storage_index'] && $image_data['storage_index'] != null)) {
$xml_string = $xml_string . "<storage";
$xml_string .= "<storage";
if ($image_data['storage_location_type'])
$xml_string = $xml_string . " type=\"".$image_data['storage_location_type']."\"";
$xml_string .= " type=\"".$image_data['storage_location_type']."\"";
if ($image_data['storage_location_id'])
$xml_string = $xml_string . " id=\"".$image_data['storage_location_id']."\"";
$xml_string .= " id=\"".$image_data['storage_location_id']."\"";
if ($image_data['storage_index'])
$xml_string = $xml_string . " idx=\"".$image_data['storage_index']."\"";
$xml_string = $xml_string . " />\n";
$xml_string .= " idx=\"".$image_data['storage_index']."\"";
$xml_string .= " />\n";
}
if (($image_data['access_rights'] && $image_data['access_rights'] != "null") ||
($image_data['hide_original'] && $image_data['hide_original'] != "null")) {
$xml_string = $xml_string . "<access";
$xml_string .= "<access";
if (($image_data['access_rights'] && $image_data['access_rights'] != "null"))
$xml_string = $xml_string . " type=\"".$image_data['access_rights']."\"";
$xml_string .= " type=\"".$image_data['access_rights']."\"";
if (($image_data['hide_original'] && $image_data['hide_original'] != "null"))
$xml_string = $xml_string . " original=\"".$image_data['hide_original']."\"";
$xml_string = $xml_string . " />\n";
$xml_string .= " original=\"".$image_data['hide_original']."\"";
$xml_string .= " />\n";
}
if (($image_data['camera'] && $image_data['camera'] != "null") ||
@ -369,81 +380,81 @@ function create_xml_photo($image_data) {
($image_data['shutter'] && $image_data['shutter'] != "null") ||
($image_data['exp_comp'] && $image_data['exp_comp'] != "null" && $image_data['exp_comp'] != "0.0") ||
($image_data['exp_diff'] && $image_data['exp_diff'] != "null" && $image_data['exp_diff'] != "0.0")) {
$xml_string = $xml_string . "<camera";
$xml_string .= "<camera";
if ($image_data['camera'] && $image_data['camera'] != "null")
$xml_string = $xml_string . " id=\"".$image_data['camera']."\"";
$xml_string .= " id=\"".$image_data['camera']."\"";
if ($image_data['camera_metering'] && $image_data['camera_metering'] != "null")
$xml_string = $xml_string . " meter=\"".$image_data['camera_metering']."\"";
$xml_string .= " meter=\"".$image_data['camera_metering']."\"";
if ($image_data['camera_program'] && $image_data['camera_program'] != "null")
$xml_string = $xml_string . " prog=\"".$image_data['camera_program']."\"";
$xml_string .= " prog=\"".$image_data['camera_program']."\"";
if ($image_data['shutter'] && $image_data['shutter'] != "null")
$xml_string = $xml_string . " speed=\"".$image_data['shutter']."\"";
$xml_string .= " speed=\"".$image_data['shutter']."\"";
if ($image_data['exp_comp'] && $image_data['exp_comp'] != "null" && $image_data['exp_comp'] != "0.0")
$xml_string = $xml_string . " comp=\"".$image_data['exp_comp']."\"";
$xml_string .= " comp=\"".$image_data['exp_comp']."\"";
if ($image_data['exp_diff'] && $image_data['exp_diff'] != "null" && $image_data['exp_diff'] != "0.0")
$xml_string = $xml_string . " diff=\"".$image_data['exp_diff']."\"";
$xml_string = $xml_string . " />\n";
$xml_string .= " diff=\"".$image_data['exp_diff']."\"";
$xml_string .= " />\n";
}
if (($image_data['lens'] && $image_data['lens'] != "null") ||
($image_data['focal_length'] && $image_data['focal_length'] != "null") ||
($image_data['aperture'] && $image_data['aperture'] != "null")) {
$xml_string = $xml_string . "<lens";
$xml_string .= "<lens";
if ($image_data['lens'] && $image_data['lens'] != "null")
$xml_string = $xml_string . " id=\"".$image_data['lens']."\"";
$xml_string .= " id=\"".$image_data['lens']."\"";
if ($image_data['focal_length'] && $image_data['focal_length'] != "null")
$xml_string = $xml_string . " focal=\"".$image_data['focal_length']."\"";
$xml_string .= " focal=\"".$image_data['focal_length']."\"";
if ($image_data['aperture'] && $image_data['aperture'] != "null")
$xml_string = $xml_string . " apert=\"".$image_data['aperture']."\"";
$xml_string = $xml_string . " />\n";
$xml_string .= " apert=\"".$image_data['aperture']."\"";
$xml_string .= " />\n";
}
if ($image_data['filter'] && $image_data['filter'] != "null")
$xml_string = $xml_string . "<filter id=\"".$image_data['filter']."\" />\n";
$xml_string .= "<filter id=\"".$image_data['filter']."\" />\n";
if (($image_data['film'] && $image_data['film'] != "null") ||
($image_data['iso_override'] && $image_data['iso_override'] != "null")) {
$xml_string = $xml_string . "<film";
$xml_string .= "<film";
if ($image_data['film'] && $image_data['film'] != "null")
$xml_string = $xml_string . " id=\"".$image_data['film']."\"";
$xml_string .= " id=\"".$image_data['film']."\"";
if ($image_data['iso_override'] && $image_data['iso_override'] != "null")
$xml_string = $xml_string . " override=\"".$image_data['iso_override']."\"";
$xml_string = $xml_string . " />\n";
$xml_string .= " override=\"".$image_data['iso_override']."\"";
$xml_string .= " />\n";
}
if (($image_data['flash'] && $image_data['flash'] != "null") ||
($image_data['flash_mode'] && $image_data['flash_mode'] != "null") ||
($image_data['flash_comp'] && $image_data['flash_comp'] != "null" && $image_data['flash_comp'] != "0.0")) {
$xml_string = $xml_string . "<flash";
$xml_string .= "<flash";
if ($image_data['flash'] && $image_data['flash'] != "null")
$xml_string = $xml_string . " id=\"".$image_data['flash']."\"";
$xml_string .= " id=\"".$image_data['flash']."\"";
if ($image_data['flash_mode'] && $image_data['flash_mode'] != "null")
$xml_string = $xml_string . " mode=\"".$image_data['flash_mode']."\"";
$xml_string .= " mode=\"".$image_data['flash_mode']."\"";
if ($image_data['flash_comp'] && $image_data['flash_comp'] != "null" && $image_data['flash_comp'] != "0.0")
$xml_string = $xml_string . " comp=\"".$image_data['flash_comp']."\"";
$xml_string = $xml_string . " />\n";
$xml_string .= " comp=\"".$image_data['flash_comp']."\"";
$xml_string .= " />\n";
}
if (($image_data['scanner'] && $image_data['scanner'] != "null") ||
($image_data['scan_resolution'] && $image_data['scan_resolution'] != "null") ||
($image_data['scan_bitdepth'] && $image_data['scan_bitdepth'] != "null") ||
($image_data['scan_multiscan'] && $image_data['scan_multiscan'] != "null")) {
$xml_string = $xml_string . "<scanner";
$xml_string .= "<scanner";
if ($image_data['scanner'] && $image_data['scanner'] != "null")
$xml_string = $xml_string . " id=\"".$image_data['scanner']."\"";
$xml_string .= " id=\"".$image_data['scanner']."\"";
if ($image_data['scan_resolution'] && $image_data['scan_resolution'] != "null")
$xml_string = $xml_string . " dpi=\"".$image_data['scan_resolution']."\"";
$xml_string .= " dpi=\"".$image_data['scan_resolution']."\"";
if ($image_data['scan_bitdepth'] && $image_data['scan_bitdepth'] != "null")
$xml_string = $xml_string . " bitdepth=\"".$image_data['scan_bitdepth']."\"";
$xml_string .= " bitdepth=\"".$image_data['scan_bitdepth']."\"";
if ($image_data['scan_multiscan'] && $image_data['scan_multiscan'] != "null")
$xml_string = $xml_string . " pass=\"".$image_data['scan_multiscan']."\"";
$xml_string = $xml_string . " />\n";
$xml_string .= " pass=\"".$image_data['scan_multiscan']."\"";
$xml_string .= " />\n";
}
if ($image_data['support'] && $image_data['support'] != "null")
$xml_string = $xml_string . "<support id=\"".$image_data['support']."\" />\n";
$xml_string .= "<support id=\"".$image_data['support']."\" />\n";
$xml_string = $xml_string . "</photo>\n";
$xml_string .= "</photo>\n";
return $xml_string;
}

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -33,7 +33,7 @@ function count_storage_space_by_user($database, $user_id) {
and photo.users = $user_id");
$num_of_photos = pg_num_rows($all_photos_of_user);
$result = array(size => 0, files => 0, directories => 0);
$result = array('size' => 0, 'files' => 0, 'directories' => 0);
$result = 0;
@ -122,7 +122,7 @@ function get_current_volume($database, $image_file) {
return $new_volume;
}
function photo_import($database, $index, $im_options, $my_im_composite_options, $dcraw_options, $my_user_id, $default_folder_id, $image_data) {
function photo_import($database, $index, $im_options, $my_im_composite_options, $dcraw_options, $user_id, $default_folder_id, $image_data) {
global $image_repository_path;
global $mime_type;
@ -160,7 +160,7 @@ function photo_import($database, $index, $im_options, $my_im_composite_options,
print "&nbsp;<br/>\n";
$target_folder = pg_fetch_row(pg_query($database, "select caption, users from folder where identifier = '$image_data[folder]'"));
if ($target_folder[1] != $my_user_id[0]) {
if ($target_folder[1] != $user_id) {
print "<font color=\"red\">You do not own the destination folder <a href=folder.php?folder=$image_data[folder]><b>$target_folder[0]</b></a></font>.";
$image_data['folder'] = $default_folder_id;
$target_folder = pg_fetch_row(pg_query($database, "select caption from folder where identifier = '$image_data[folder]'"));
@ -173,10 +173,10 @@ function photo_import($database, $index, $im_options, $my_im_composite_options,
select quota_size, quota_count
from users, preferences
where preferences.identifier=users.preferences
and users.identifier=$my_user_id[0]"));
and users.identifier=$user_id"));
if ($preferences[0] > 0) {
$used_storage_space = count_storage_space_by_user($database, $my_user_id[0]);
$used_storage_space = count_storage_space_by_user($database, $user_id);
$used_storage_space += filesize($image_data['file'][$index]['name_tmp']);
if ($preferences[0] <= $used_storage_space) {
pg_query($database, "rollback");
@ -192,7 +192,7 @@ function photo_import($database, $index, $im_options, $my_im_composite_options,
}
if ($preferences[1] > 0) {
$num_of_photo_versions = pg_fetch_row(pg_query($database, "select count_photo_versions_by_user($my_user_id[0])"));
$num_of_photo_versions = pg_fetch_row(pg_query($database, "select count_photo_versions_by_user($user_id)"));
$num_of_photo_versions++;
if ($preferences[1] <= $num_of_photo_versions[0]) {
pg_query($database, "rollback");
@ -208,38 +208,30 @@ function photo_import($database, $index, $im_options, $my_im_composite_options,
if ($image_data['decode_exif'] == 1)
$image_data = photo_parse_exif($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_exif($database, $index, $user_id, $image_data);
if ($image_data['decode_iptc'] == 1)
$image_data = photo_parse_iptc($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_iptc($database, $index, $user_id, $image_data);
if ($image_data['decode_rdf'] == 1)
$image_data = photo_parse_rdf($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_rdf($database, $index, $user_id, $image_data);
if ($image_data['decode_exif'] == 2)
$image_data = photo_parse_exif($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_exif($database, $index, $user_id, $image_data);
if ($image_data['decode_iptc'] == 2)
$image_data = photo_parse_iptc($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_iptc($database, $index, $user_id, $image_data);
if ($image_data['decode_rdf'] == 2)
$image_data = photo_parse_rdf($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_rdf($database, $index, $user_id, $image_data);
if ($image_data['decode_exif'] == 3)
$image_data = photo_parse_exif($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_exif($database, $index, $user_id, $image_data);
if ($image_data['decode_iptc'] == 3)
$image_data = photo_parse_iptc($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_iptc($database, $index, $user_id, $image_data);
if ($image_data['decode_rdf'] == 3)
$image_data = photo_parse_rdf($database, $index, $my_user_id[0], $image_data);
$image_data = photo_parse_rdf($database, $index, $user_id, $image_data);
/* DCRAW automatically rotates images! */
if ($decoder == "dcraw") {
$image_data["orientation"] = "Normal (O deg)";
}
if (!$image_data['caption'])
$image_data['caption'] = "No Caption";
$orientation = orientation_id_from_string($database, $image_data[orientation]);
$image_data[orientation_xform] = orientation_to_xform($database, $orientation);
if (!$image_data[caption])
$image_data[caption] = "No Caption";
if (!file_upload($image_data, $index, $im_options, $my_im_composite_options, $dcraw_options, $hires_name, $image_name, $thumb_name, $multi_page_parameter, $decoder)) {
if (!file_upload($image_data, $index, $im_options, $my_im_composite_options, $dcraw_options, $hires_name, $image_name, $thumb_name, $multi_page_parameter, $decoder, $database)) {
pg_query($database, "rollback");
error_reporting(0);
print "<li>Cleaning up the mess.</li>";
@ -256,13 +248,13 @@ function photo_import($database, $index, $im_options, $my_im_composite_options,
$query = "insert into photo
(identifier, users, folder, location,
caption, date_of_exposure, access_rights, copyright_statement,
views, hide_original, author, title, keyword,
views, hide_original, author, title,
caption_writer, category, credit, source,
headline, instructions, transmission_reference,
supplemental_category, web_statement)
values ($next_index[0], '$my_user_id[0]', '$image_data[folder]', $image_data[location],
values ($next_index[0], '$user_id', '$image_data[folder]', $image_data[location],
'$image_data[caption]', $image_data[date_of_exposure], '$image_data[access_rights]', '$image_data[copyright]',
0, '$image_data[hide_original]', '$image_data[author]', '$image_data[title]', '$image_data[keyword]',
0, '$image_data[hide_original]', '$image_data[author]', '$image_data[title]',
'$image_data[caption_writer]', '$image_data[category]', '$image_data[credit]', '$image_data[source]',
'$image_data[headline]', '$image_data[instructions]', '$image_data[transmission_reference]',
'$image_data[supplemental_category]', '$image_data[web_statement]')";
@ -282,6 +274,31 @@ function photo_import($database, $index, $im_options, $my_im_composite_options,
return FALSE;
}
/* Now for the keywords */
foreach ($image_data['keywords'] as $keyword) {
$keyword = strtolower(trim($keyword));
$keyword = trim($keyword, ','); /* Trailing commas */
$keyword = trim($keyword);
if ($keyword == "") continue;
$keyword = pg_escape_string($keyword);
$result = pg_query($database, "insert into photo_keywords (photo, keyword) values ($next_index[0], '$keyword')");
if (!$result) {
pg_query($database, "rollback");
print "<li><font color=\"red\">Failed to insert keyword data.</font></li>";
print "<ul><font color=\"red\">$query</font></ul>";
error_reporting(0);
print "<li>Cleaning up the mess.</li>";
unlink($image_repository_path."/".$hires_name);
unlink($image_repository_path."/".$image_name);
unlink($image_repository_path."/".$thumb_name);
error_reporting(1);
print "</ul>";
return FALSE;
}
}
$comment = $image_data['file'][$index]['remark'];
$orientation = orientation_id_from_string($database, $image_data['orientation']);
@ -371,7 +388,7 @@ function photo_import($database, $index, $im_options, $my_im_composite_options,
return $next_index[0];
}
function photo_version_import($database, $index, $im_options, $my_im_composite_options, $dcraw_options, $my_user_id, $photo_id, $image_data) {
function photo_version_import($database, $index, $im_options, $my_im_composite_options, $dcraw_options, $user_id, $photo_id, $image_data) {
global $image_repository_path;
global $mime_type;
@ -379,10 +396,10 @@ function photo_version_import($database, $index, $im_options, $my_im_composite_o
select quota_size, quota_count
from users, preferences
where preferences.identifier=users.preferences
and users.identifier=$my_user_id[0]"));
and users.identifier=$user_id"));
if ($preferences[0] > 0) {
$used_storage_space = count_storage_space_by_user($database, $my_user_id[0]);
$used_storage_space = count_storage_space_by_user($database, $user_id);
$used_storage_space += filesize($image_data['file'][$index]['name_tmp']);
if ($preferences[0] <= $used_storage_space) {
print "<li>Your account have reached the storage space quota of $preferences[0] Mb, imposed by your PO adminstrator.<br/>";
@ -395,7 +412,7 @@ function photo_version_import($database, $index, $im_options, $my_im_composite_o
}
if ($preferences[1] > 0) {
$num_of_photo_versions = pg_fetch_row(pg_query($database, "select count_photo_versions_by_user($my_user_id[0])"));
$num_of_photo_versions = pg_fetch_row(pg_query($database, "select count_photo_versions_by_user($user_idy)"));
$num_of_photo_versions++;
if ($preferences[1] <= $num_of_photo_versions[0]) {
print "<li>Your account have reached the photo quota of $preferences[1] photos including photo versions, imposed by your PO adminstrator.<br/>";
@ -447,7 +464,7 @@ function photo_version_import($database, $index, $im_options, $my_im_composite_o
print "<ul>";
$master = $image_data['file'][$index]['master'];
if (!file_upload($image_data, $index, $im_options, $my_im_composite_options, $dcraw_options, $hires_name, $image_name, $thumb_name, $multi_page_parameter, $decoder)) {
if (!file_upload($image_data, $index, $im_options, $my_im_composite_options, $dcraw_options, $hires_name, $image_name, $thumb_name, $multi_page_parameter, $decoder, $database)) {
error_reporting(0);
print "<li>Cleaning up the mess.</li>";
unlink($image_repository_path ."/" .$hires_name);
@ -519,22 +536,59 @@ function photo_version_import($database, $index, $im_options, $my_im_composite_o
return TRUE;
}
function import_raw_decode($input_file_name, $dcraw_options, $decoder, $verbose) {
global $sys_dcraw;
function import_raw_decode_exiftool($input_file_name, $ufraw_options, $camera_input_profile, $verbose, $image_data) {
global $sys_exiftool;
global $tmp_volume_path;
if ($decoder != "dcraw")
if (!is_executable($sys_exiftool))
return FALSE;
$temporary_file_name = tempnam($tmp_volume_path, "po");
unlink($temporary_file_name);
$temporary_file_name = $temporary_file_name . ".jpg";
$options = " -b -JpgFromRaw > " . escapeshellarg($temporary_file_name);
if ($verbose) {
print "<li>Decoding raw image using <i>ExifTool</i>...";
}
system("$sys_exiftool " . escapeshellarg($input_file_name) . " $options " , $retval_decoding);
if ($retval_decoding) {
if ($verbose) {
print "<font color=\"red\"> failed. -- $sys_exiftool $options</font></li>";
}
return FALSE;
}
if ($verbose) {
print " done.</li>";
}
flush();
return $temporary_file_name;
}
function import_raw_decode_dcraw($input_file_name, $dcraw_options, $camera_input_profile, $verbose, &$image_data) {
global $sys_dcraw;
global $tmp_volume_path;
$temporary_file_name = tempnam($tmp_volume_path, "po");
unlink($temporary_file_name);
$temporary_file_name = $temporary_file_name . ".ppm";
if (!is_executable($sys_dcraw))
return FALSE;
if ($verbose) {
print "<li>Decoding raw image ...";
print "<li>Decoding raw image using <i>dcraw</i>...";
}
// Gamma ($raw_options [0]) is gone completely!
$options = " -o 1 -q 3 -b $dcraw_options[1] ";
// $options = " -q 3 -b $dcraw_options[1]";
$options = " -q 3";
// $options = " $options -B 2 4"
switch ($dcraw_options[2]) {
case "automatic":
$options = $options . " -a";
@ -544,31 +598,70 @@ function import_raw_decode($input_file_name, $dcraw_options, $decoder, $verbose)
}
switch ($dcraw_options[3]) {
case 24:
// dcraw 8.28 does aways with this and it's now default.
// $options = $options . " -2";
// dcraw 8.28 defaults to "-2" of old.
// $options = $options . " -2";
break;
case 48:
$options = $options . " -4";
}
$options = $options . " -o 1"; // output to sRGB colorspace
if ($camera_input_profile != FALSE) {
if ($camera_input_profile == "") $camera_input_profile = "embed";
$options = $options . " -p $camera_input_profile";
}
system("$sys_dcraw $options -c " . escapeshellarg($input_file_name) . " > $temporary_file_name ", $retval_decoding);
if ($retval_decoding) {
if ($verbose) {
print "<font color=\"red\"> failed. ($sys_dcraw $options $input_file_name $retval_decoding) </font></li>";
}
return FALSE;
if ($verbose) {
print "<font color=\"red\"> failed. -- $sys_dcraw $options</font></li>";
}
return FALSE;
}
/* dcraw automatically rotates images */
if ($image_data != NULL)
$image_data["orientation"] = "Normal (O deg)";
if ($verbose) {
print " done.</li>";
flush();
print " done.</li>";
}
flush();
/* the decoder generates ppm files so transform the file name */
return $temporary_file_name;
}
function import_raw_decode($input_file_name, $dcraw_options, $decoder, $verbose, $camera_input_profile, &$image_data) {
global $icc_profiles;
if (($camera_input_profile == FALSE) ||
($camera_input_profile == null) ||
($camera_input_profile == "") ||
($camera_input_profile == "None")) {
$camera_input_profile = FALSE;
} else {
$camera_input_profile = $icc_profiles[$camera_input_profile]['file'];
}
$res = FALSE;
$decoders = split(",", $decoder);
foreach ($decoders as $decoder) {
$decoder = trim($decoder);
if ($decoder == "dcraw") {
$res = import_raw_decode_dcraw($input_file_name, $raw_options, $camera_input_profile, $verbose, $image_data);
} else if ($decoder == "exiftool") {
$res = import_raw_decode_exiftool($input_file_name, $raw_options, $camera_input_profile, $verbose, $image_data);
} else {
$res = FALSE;
}
if ($res != FALSE) break;
}
return $res;
}
function import_generate_thumbnail($input_file_name, $thumb_name, $verbose, $im_options, $multi_page_parameter, $orientation, $colorspace)
{
global $image_repository_path;
@ -581,24 +674,25 @@ function import_generate_thumbnail($input_file_name, $thumb_name, $verbose, $im_
else
$im_framing_option = "";
$im_profile_a = $im_profile_b = "";
if ($colorspace != "" && $colorspace > "1") {
$im_profile_option = "-profile " . $icc_profiles[1]['file'] . " +profile icm";
$im_profile_b = " -profile " . $icc_profiles[1]['file'] . " +profile icm";
if ($colorspace != "99") {
$im_profile_option = "+profile icm -profile " . $icc_profiles[$colorspace]['file'] . " $im_profile_option";
$im_profile_a = " +profile icm -profile " . $icc_profiles[$colorspace]['file'];
}
} else {
$im_profile_option = "";
}
/* generate thumbnail */
$cmdline = "$sys_convert".
$im_profile_a .
" -geometry " . escapeshellarg($thumb_max_size ."x". $thumb_max_size) ."\> ".
" -unsharp ". escapeshellarg($im_options[11] ."x". $im_options[12] ."+". $im_options[18] ."+". $im_options[19]) ." ".
" -mattecolor " . escapeshellarg("#".$im_options[15]) ." ".
$im_framing_option ." ".
$orientation ." ".
$im_profile_option ." ".
$im_profile_b .
" -colorspace " . escapeshellarg($im_options[9]) ." ".
" -gamma " . escapeshellarg($im_options[10]) ." ".
" -quality " . escapeshellarg($im_options[8]) ." ".
@ -607,7 +701,6 @@ function import_generate_thumbnail($input_file_name, $thumb_name, $verbose, $im_
system($cmdline, $retval_thumb_scaling);
if ($retval_thumb_scaling) {
if ($verbose) {
print "<li><font color=\"red\">Thumbnail generation failed.</font></li>";
@ -637,24 +730,25 @@ function import_generate_preview($input_file_name, $image_name, $verbose, $im_op
else
$im_framing_option = "";
$im_profile_a = $im_profile_b = "";
if ($colorspace != "" && $colorspace > "1") {
$im_profile_option = "-profile " . $icc_profiles[1]['file'] . " +profile icm";
$im_profile_b = " -profile " . $icc_profiles[1]['file'] . " +profile icm";
if ($colorspace != "99") {
$im_profile_option = "+profile icm -profile " . $icc_profiles[$colorspace]['file'] . " $im_profile_option";
$im_profile_a = " +profile icm -profile " . $icc_profiles[$colorspace]['file'];
}
} else {
$im_profile_option = "";
}
/* generate preview */
$cmdline = "$sys_convert".
$im_profile_a .
" -geometry " . escapeshellarg($image_max_size ."x". $image_max_size) ."\> ".
" -unsharp " . escapeshellarg($im_options[3] ."x". $im_options[4] ."+". $im_options[16] ."+". $im_options[17] ) ." ".
" -mattecolor " . escapeshellarg("#".$im_options[7]) ." ".
$im_framing_option ." ".
$orientation ." ".
$im_profile_option ." ".
$im_profile_b .
" -colorspace " . escapeshellarg($im_options[1]) ." ".
" -gamma " . escapeshellarg($im_options[2]) ." ".
" -quality " . escapeshellarg($im_options[0]) ." ".
@ -699,7 +793,7 @@ function import_generate_preview($input_file_name, $image_name, $verbose, $im_op
return TRUE;
}
function file_upload($image_data, $index, $im_options, $my_im_composite_options, $dcraw_options, $hires_name, $image_name, $thumb_name, $multi_page_parameter, $decoder) {
function file_upload(&$image_data, $index, $im_options, $my_im_composite_options, $dcraw_options, $hires_name, $image_name, $thumb_name, $multi_page_parameter, $decoder, $database) {
global $image_repository_path;
$success = TRUE;
@ -713,12 +807,16 @@ function file_upload($image_data, $index, $im_options, $my_im_composite_options,
}
flush();
$temporary_ppm_file = import_raw_decode($image_data['file'][$index]['name_tmp'], $dcraw_options, $decoder, TRUE);
$temporary_ppm_file = import_raw_decode($image_data['file'][$index]['name_tmp'], $dcraw_options, $decoder, TRUE, $image_data['camera_input_profile'], $image_data);
if ($temporary_ppm_file) {
unlink($image_data['file'][$index]['name_tmp']);
$image_data['file'][$index]['name_tmp'] = $temporary_ppm_file;
}
/* raw decode can alter orientation */
$orientation = orientation_id_from_string($database, $image_data["orientation"]);
$image_data["orientation_xform"] = orientation_to_xform($database, $orientation);
$return_value = import_generate_preview($image_data['file'][$index]['name_tmp'], $image_repository_path ."/". $image_name, TRUE, $im_options, $my_im_composite_options, $multi_page_parameter, $image_data["orientation_xform"], $image_data['colorspace']);
if (!$return_value) {
$success = false;

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -57,11 +57,11 @@ function human_readable_iptc($iptc_string) {
$new_iptc_string = "";
do {
$key_start_position = strpos($iptc_string, "<tr><td>", $key_start_position) + 8;
$key_end_position = strpos($iptc_string, "</td><td>", $key_start_position);
$key_start_position = strpos($iptc_string, "<key>", $key_start_position) + 8;
$key_end_position = strpos($iptc_string, "</key><value>", $key_start_position);
$value_start_position = $key_end_position + 9;
$value_end_position = strpos($iptc_string, "</td></tr>", $value_start_position);
$value_end_position = strpos($iptc_string, "</value>", $value_start_position);
$key = substr($iptc_string, $key_start_position, $key_end_position - $key_start_position);
$key = trim(substr($key, 0, strpos($key, ".")));
@ -71,7 +71,7 @@ function human_readable_iptc($iptc_string) {
$tail = substr($iptc_string, $value_end_position + 10);
if ($iptc_field_names[$key])
$new_iptc_string = $new_iptc_string ."<tr><td>". $iptc_field_names[$key] ."</td><td>".$value ."</td></tr>";
$new_iptc_string .= "<key>". $iptc_field_names[$key] ."</key><value>".$value ."</value>";
} while ($tail != "");
return $new_iptc_string;
@ -308,7 +308,6 @@ function photo_parse_iptc($database, $index, $user_id, $image_data) {
print "<li>Extracting IPTC data ... ";
$image_data['keyword'] = "";
$image_data['title'] = "";
$image_data['author'] = "";
$image_data['caption'] = "";
@ -319,8 +318,9 @@ function photo_parse_iptc($database, $index, $user_id, $image_data) {
$key = substr($key, strrpos($key, "#") + 1);
foreach ($section as $name=>$val) {
$val = validate_iptc_string($val);
if ($val != "") {
$image_data['iptc'] .= "<key>$key.$name</key><value>$val</value>";
switch ($key) {
case 5:
if ($image_data['title'] == "")
@ -338,10 +338,7 @@ function photo_parse_iptc($database, $index, $user_id, $image_data) {
$image_data['supplemental_category'] .= ", $val";
break;
case 25:
if ($image_data['keyword'] == "")
$image_data['keyword'] = $val;
else
$image_data['keyword'] .= "; $val";
$image_data['keywords'][] = $val;
break;
case 40:
if ($image_data['instructions'] == "")
@ -413,7 +410,7 @@ function photo_parse_iptc($database, $index, $user_id, $image_data) {
$image_data['caption_writer'] .= ", $val";
break;
default:
$image_data['iptc'] .= "<tr><td>$key.$name</td><td>$val</td></tr>";
break;
}
}
}

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,7 +23,7 @@
// You can specify for each format apart in which format you prefer
// for the preview or the thumbnail by setting the "out" parameter
$raw_decoder = "dcraw";
include_once "include/config.php";
$mime_type = array (
// FILE MIME IMAGICK MULTI THUMBNAIL AND RAW

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -44,7 +44,7 @@ function display_order_by_combo($order_by) {
for ($i = 1; $i <= count($order_by_string); $i++) {
$string = $order_by_string[$i][1];
if ($i == $order_by)
print "<option value=\"$i\" selected>$string</option>\n";
print "<option value=\"$i\" selected=\"selected\">$string</option>\n";
else
print "<option value=\"$i\" >$string</option>\n";
}
@ -57,7 +57,7 @@ function display_order_by_combo_with_button($order_by) {
global $order_by_string;
print "<table>\n<tr>\n<td align=\"left\" valign=\"middle\" >\n";
print "<input type=\"image\" src=\"$theme/button.order.by.gif\" value=\"Order by\">\n";
print "<input type=\"image\" src=\"$theme/button.order.by.gif\" value=\"Order by\"/>\n";
print "</td>\n<td align=\"left\" valign=\"middle\" >\n";
display_order_by_combo($order_by);
print "</td></tr>";
@ -81,7 +81,7 @@ function display_order_by_combo_for_photo($order_by, $album_id, $previous, $curr
print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n<tr>\n";
if ($current != $previous) {
print "<td align=\"left\" valign=\"middle\">\n";
print "<a class=\"nodecor\" href=\"photo.php?photo=$previous&amp;order_by=$order_by&amp;detail_info=$detail_info$option\"><img src=\"$theme/button.previous.gif\" border=\"0\" title=\"Previous photo\"></a>\n";
print "<a class=\"nodecor\" href=\"photo.php?photo=$previous&amp;order_by=$order_by&amp;detail_info=$detail_info$option\"><img src=\"$theme/button.previous.gif\" border=\"0\" title=\"Previous photo\"/></a>\n";
print "</td>\n";
}
print "<td align=\"left\" valign=\"middle\">\n";
@ -89,15 +89,15 @@ function display_order_by_combo_for_photo($order_by, $album_id, $previous, $curr
for ($i = 1; $i <= count($order_by_string); $i++) {
$string = $order_by_string[$i][1];
if ($i == $order_by)
print "<option value=\"photo.php?photo=$current&amp;order_by=$i$option\" selected>$string";
print "<option value=\"photo.php?photo=$current&amp;order_by=$i$option\" selected>$string</option>";
else
print "<option value=\"photo.php?photo=$current&amp;order_by=$i$option\">$string";
print "<option value=\"photo.php?photo=$current&amp;order_by=$i$option\">$string</option>";
}
print "</select>";
print "</td>";
if ($current != $next) {
print "<td align=\"left\" valign=\"middle\">\n";
print "<a class=\"nodecor\" href=\"photo.php?photo=$next&amp;order_by=$order_by&amp;detail_info=$detail_info$option\"><img src=\"$theme/button.next.gif\" border=\"0\" title=\"Next photo\"></a>\n";
print "<a class=\"nodecor\" href=\"photo.php?photo=$next&amp;order_by=$order_by&amp;detail_info=$detail_info$option\"><img src=\"$theme/button.next.gif\" border=\"0\" title=\"Next photo\"/></a>\n";
print "</td>\n";
}
print "</tr>\n</table>";

View File

@ -1,7 +1,7 @@
/<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -17,40 +17,40 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
$profile_data = array("lens" => array("idx" => 1, "active_img" => "$theme/navigator.eq.lens.a.gif", "img" => "$theme/navigator.eq.lens.gif", link => "my.profile.php?selector=1", "alt" => " Lenses "),
"camera" => array("idx" => 2, "active_img" => "$theme/navigator.eq.camera.a.gif", "img" => "$theme/navigator.eq.camera.gif", link => "my.profile.php?selector=2", "alt" => " Cameras "),
"flash" => array("idx" => 3, "active_img" => "$theme/navigator.eq.flash.a.gif", "img" => "$theme/navigator.eq.flash.gif", link => "my.profile.php?selector=3", "alt" => " Flashes "),
"scanner" => array("idx" => 4, "active_img" => "$theme/navigator.eq.scanner.a.gif", "img" => "$theme/navigator.eq.scanner.gif", link => "my.profile.php?selector=4", "alt" => " Scanners "),
"filter" => array("idx" => 5, "active_img" => "$theme/navigator.eq.filter.a.gif", "img" => "$theme/navigator.eq.filter.gif", link => "my.profile.php?selector=5", "alt" => " Filters "),
"film" => array("idx" => 6, "active_img" => "$theme/navigator.eq.film.a.gif", "img" => "$theme/navigator.eq.film.gif", link => "my.profile.php?selector=6", "alt" => " Films "),
"support" => array("idx" => 7, "active_img" => "$theme/navigator.eq.support.a.gif", "img" => "$theme/navigator.eq.support.gif", link => "my.profile.php?selector=7", "alt" => " Supports "),
"manufacturer" => array("idx" => 8, "active_img" => "$theme/navigator.eq.manufacturer.a.gif", "img" => "$theme/navigator.eq.manufacturer.gif", link => "my.profile.php?selector=8", "alt" => " Manufacturers "),
"label" => array("idx" => 9, "active_img" => "$theme/navigator.eq.label.a.gif", "img" => "$theme/navigator.eq.label.gif", link => "my.profile.php?selector=9", "alt" => " Labels "),
"shop" => array("idx" => 10,"active_img" => "$theme/navigator.eq.shop.a.gif", "img" => "$theme/navigator.eq.shop.gif", link => "my.profile.php?selector=10", "alt" => " Shop "),
"location" => array("idx" => 11,"active_img" => "$theme/navigator.eq.location.a.gif", "img" => "$theme/navigator.eq.location.gif", link => "my.profile.php?selector=11", "alt" => " Locations "));
$profile_data = array("lens" => array("idx" => 1, "active_img" => "$theme/navigator.eq.lens.a.gif", "img" => "$theme/navigator.eq.lens.gif", 'link' => "my.profile.php?selector=1", "alt" => " Lenses "),
"camera" => array("idx" => 2, "active_img" => "$theme/navigator.eq.camera.a.gif", "img" => "$theme/navigator.eq.camera.gif", 'link' => "my.profile.php?selector=2", "alt" => " Cameras "),
"flash" => array("idx" => 3, "active_img" => "$theme/navigator.eq.flash.a.gif", "img" => "$theme/navigator.eq.flash.gif", 'link' => "my.profile.php?selector=3", "alt" => " Flashes "),
"scanner" => array("idx" => 4, "active_img" => "$theme/navigator.eq.scanner.a.gif", "img" => "$theme/navigator.eq.scanner.gif", 'link' => "my.profile.php?selector=4", "alt" => " Scanners "),
"filter" => array("idx" => 5, "active_img" => "$theme/navigator.eq.filter.a.gif", "img" => "$theme/navigator.eq.filter.gif", 'link' => "my.profile.php?selector=5", "alt" => " Filters "),
"film" => array("idx" => 6, "active_img" => "$theme/navigator.eq.film.a.gif", "img" => "$theme/navigator.eq.film.gif", 'link' => "my.profile.php?selector=6", "alt" => " Films "),
"support" => array("idx" => 7, "active_img" => "$theme/navigator.eq.support.a.gif", "img" => "$theme/navigator.eq.support.gif", 'link' => "my.profile.php?selector=7", "alt" => " Supports "),
"manufacturer" => array("idx" => 8, "active_img" => "$theme/navigator.eq.manufacturer.a.gif", "img" => "$theme/navigator.eq.manufacturer.gif", 'link' => "my.profile.php?selector=8", "alt" => " Manufacturers "),
"label" => array("idx" => 9, "active_img" => "$theme/navigator.eq.label.a.gif", "img" => "$theme/navigator.eq.label.gif", 'link' => "my.profile.php?selector=9", "alt" => " Labels "),
"shop" => array("idx" => 10,"active_img" => "$theme/navigator.eq.shop.a.gif", "img" => "$theme/navigator.eq.shop.gif", 'link' => "my.profile.php?selector=10", "alt" => " Shop "),
"location" => array("idx" => 11,"active_img" => "$theme/navigator.eq.location.a.gif", "img" => "$theme/navigator.eq.location.gif", 'link' => "my.profile.php?selector=11", "alt" => " Locations "));
function display_lens($database, $my_user_id, $user_id) {
function display_lens($database, $viewer_id, $owner_id) {
global $color;
global $style;
global $access;
if ($my_user_id==$user_id) {
if ($viewer_id==$owner_id) {
$all_lenses = pg_query($database, "select identifier, name, model, variation, s_min_aperture, s_max_aperture, s_min_focal_length, s_max_focal_length, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_lens where users=$user_id order by name");
}
else {
if ($user_id != "" && $my_user_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$user_id' and client='$my_user_id' and status=2"));
if ($client =="")
from view_lens where users=$owner_id order by name");
} else {
$client = FALSE;
if ($owner_id != "" && $viewer_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$owner_id' and client='$viewer_id' and status=2"));
if ($client == FALSE)
$all_lenses = pg_query($database, "select identifier, name, model, variation, s_min_aperture, s_max_aperture, s_min_focal_length, s_max_focal_length, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_lens where users=$user_id and access_rights=$access[public] order by name");
from view_lens where users=$owner_id and access_rights=$access[public] order by name");
else
$all_lenses = pg_query($database, "select identifier, name, model, variation, s_min_aperture, s_max_aperture, s_min_focal_length, s_max_focal_length, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_lens where users=$user_id and access_rights<=$access[protected] order by name");
from view_lens where users=$owner_id and access_rights<=$access[protected] order by name");
}
$num_of_lenses = pg_num_rows($all_lenses);
if ($my_user_id != $user_id && $num_of_lenses == 0)
if ($viewer_id != $owner_id && $num_of_lenses == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
@ -60,7 +60,7 @@ function display_lens($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"13%\">Serial Number</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"7%\">New</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Purchase Date</td>\n";
if ($my_user_id==$user_id) {
if ($viewer_id==$owner_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Access</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"lens.add.php\">Add</a></td>\n";
}
@ -75,8 +75,8 @@ function display_lens($database, $my_user_id, $user_id) {
print "</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$lens[8]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($lens[10]); print"</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($lens[9], 'date', $my_user_id == "" ? 0 : 1). "</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($lens[9], 'date', $viewer_id == "" ? 0 : 1). "</td>\n";
if ($viewer_id==$owner_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$lens[12]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"lens.edit.php?item=$lens[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"lens.del.php?item=$lens[0]\">Delete</a></td>\n";
@ -86,29 +86,29 @@ function display_lens($database, $my_user_id, $user_id) {
print "</table>\n";
}
function display_camera($database, $my_user_id, $user_id) {
function display_camera($database, $viewer_id, $owner_id) {
global $color;
global $style;
global $access;
global $icc_profiles;
if ($my_user_id==$user_id) {
if ($viewer_id==$owner_id) {
$all_cameras = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights, raw_icc_profile
from view_camera where users=$user_id order by name");
}
else {
if ($user_id != "" && $my_user_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$user_id' and client='$my_user_id' and status=2"));
if ($client =="")
from view_camera where users=$owner_id order by name");
} else {
$client = FALSE;
if ($owner_id != "" && $viewer_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$owner_id' and client='$viewer_id' and status=2"));
if ($client == FALSE)
$all_cameras = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights, raw_icc_profile
from view_camera where users=$user_id and access_rights=$access[public] order by name");
from view_camera where users=$owner_id and access_rights=$access[public] order by name");
else
$all_cameras = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights, raw_icc_profile
from view_camera where users=$user_id and access_rights<=$access[protected] order by name");
from view_camera where users=$owner_id and access_rights<=$access[protected] order by name");
}
$num_of_cameras = pg_num_rows($all_cameras);
if ($my_user_id!=$user_id && $num_of_cameras == 0)
if ($viewer_id!=$owner_id && $num_of_cameras == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
@ -118,7 +118,7 @@ function display_camera($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"13%\">Serial Number</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"7%\">New</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Purchase Date</td>\n";
if ($my_user_id==$user_id) {
if ($viewer_id==$owner_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" >Access</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" >ICC Profile</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"camera.add.php\">Add</a></td>\n";
@ -132,11 +132,12 @@ function display_camera($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$camera[7]\">$camera[1]</a> $camera[2] $camera[3]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera[4]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($camera[6]); print"</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($camera[5], 'date', $my_user_id == "" ? 0 : 1). "</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($camera[5], 'date', $viewer_id == "" ? 0 : 1). "</td>\n";
if ($viewer_id==$owner_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$camera[8]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
print $icc_profiles[$camera[9]]['name'];
if ($camera[9] != "")
print $icc_profiles[$camera[9]]['name'];
print "</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"camera.edit.php?item=$camera[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"camera.del.php?item=$camera[0]\">Delete</a></td>\n";
@ -146,28 +147,28 @@ function display_camera($database, $my_user_id, $user_id) {
print "</table>\n";
}
function display_flash($database, $my_user_id, $user_id) {
function display_profile($database, $type, $viewer_id, $owner_id) {
global $color;
global $style;
global $access;
if ($my_user_id==$user_id) {
$all_flashes = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_flash where users=$user_id order by name");
}
else {
if ($user_id != "" && $my_user_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$user_id' and client='$my_user_id' and status=2"));
if ($client =="")
$all_flashes = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_flash where users=$user_id and access_rights=$access[public] order by name");
if ($viewer_id==$owner_id) {
$all = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_$type where users=$owner_id order by name");
} else {
$client = FALSE;
if ($owner_id != "" && $viewer_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$owner_id' and client='$viewer_id' and status=2"));
if ($client == FALSE)
$all = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_$type where users=$owner_id and access_rights=$access[public] order by name");
else
$all_flashes = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_flash where users=$user_id and access_rights<=$access[protected] order by name");
$all = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_$type where users=$owner_id and access_rights<=$access[protected] order by name");
}
$num_of_flashes = pg_num_rows($all_flashes);
if ($my_user_id!=$user_id && $num_of_flashes == 0)
$num_of = pg_num_rows($all);
if ($viewer_id!=$owner_id && $num_of == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
@ -177,219 +178,52 @@ function display_flash($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"13%\">Serial Number</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"7%\">New</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Purchase Date</td>\n";
if ($my_user_id==$user_id) {
if ($viewer_id==$owner_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" >Access</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"flash.add.php\">Add</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"profile.add.php?type=$type\">Add</a></td>\n";
}
print "</tr>\n";
for ($i=0; $i < $num_of_flashes; $i++) {
$flash = pg_fetch_row($all_flashes, $i);
for ($i=0; $i < $num_of; $i++) {
$row = pg_fetch_row($all, $i);
print "<tr color=$color[table_body]>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$flash[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$flash[7]\">$flash[1]</a> $flash[2] $flash[3]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$flash[4]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($flash[6]); print"</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($flash[5], 'date', $my_user_id == "" ? 0 : 1). "</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$flash[8]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"flash.edit.php?item=$flash[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"flash.del.php?item=$flash[0]\">Delete</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$row[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$row[7]\">$row[1]</a> $row[2] $row[3]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$row[4]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($row[6]); print"</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($row[5], 'date', $viewer_id == "" ? 0 : 1). "</td>\n";
if ($viewer_id==$owner_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$row[8]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"profile.edit.php?item=$row[0]&amp;type=$type\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"profile.del.php?item=$row[0]&amp;type=$type\">Delete</a></td>\n";
}
print "</tr>\n";
}
print "</table>\n";
}
function display_scanner($database, $my_user_id, $user_id) {
function display_film($database, $viewer_id, $owner_id) {
global $color;
global $style;
global $access;
global $access;
if ($my_user_id==$user_id) {
$all_scanners = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_scanner where users=$user_id order by name");
}
else {
if ($user_id != "" && $my_user_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$user_id' and client='$my_user_id' and status=2"));
if ($client =="")
$all_scanners = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_scanner where users=$user_id and access_rights=$access[public] order by name");
else
$all_scanners = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_scanner where users=$user_id and access_rights<=$access[protected] order by name");
}
$num_of_scanners = pg_num_rows($all_scanners);
if ($my_user_id!=$user_id && $num_of_scanners == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"5%\">Id</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"35%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"13%\">Serial Number</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"7%\">New</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Purchase Date</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" >Access</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"scanner.add.php\">Add</a></td>\n";
}
print "</tr>\n";
for ($i=0; $i < $num_of_scanners; $i++) {
$scanner = pg_fetch_row($all_scanners, $i);
print "<tr color=$color[table_body]>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$scanner[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$scanner[7]\">$scanner[1]</a> $scanner[2] $scanner[3]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$scanner[4]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($scanner[6]); print"</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($scanner[5], 'date', $my_user_id == "" ? 0 : 1)."</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$scanner[8]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"scanner.edit.php?item=$scanner[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"scanner.del.php?item=$scanner[0]\">Delete</a></td>\n";
}
print "</tr>\n";
}
print "</table>\n";
}
function display_support($database, $my_user_id, $user_id) {
global $color;
global $style;
global $access;
if ($my_user_id==$user_id) {
$all_supports = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_support where users=$user_id order by name");
}
else {
if ($user_id != "" && $my_user_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$user_id' and client='$my_user_id' and status=2"));
if ($client =="")
$all_supports = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_support where users=$user_id and access_rights=$access[public] order by name");
else
$all_supports = pg_query($database, "select identifier, name, model, variation, serial_number, date_of_purchase, purchased_new, url, access_rights
from view_support where users=$user_id and access_rights<=$access[protected] order by name");
}
$num_of_supports = pg_num_rows($all_supports);
if ($my_user_id!=$user_id && $num_of_supports == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"5%\">Id</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"35%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"13%\">Serial Number</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"7%\">New</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Purchase Date</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" >Access</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"support.add.php\">Add</a></td>\n";
}
print "</tr>\n";
for ($i=0; $i < $num_of_supports; $i++) {
$support = pg_fetch_row($all_supports, $i);
print "<tr color=$color[table_body]>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$support[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$support[7]\">$support[1]</a> $support[2] $support[3]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$support[4]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($support[6]); print"</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($support[5], 'date', $my_user_id == "" ? 0 : 1). "</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$support[8]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"support.edit.php?item=$support[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"support.del.php?item=$support[0]\">Delete</a></td>\n";
}
print "</tr>\n";
}
print "</table>\n";
}
function display_filter($database, $my_user_id, $user_id) {
global $color;
global $style;
global $access;
if ($my_user_id==$user_id) {
$all_filters = pg_query($database, "select identifier, name, model, variation, date_of_purchase, purchased_new, url, access_rights
from view_filter where users=$user_id order by name");
}
else {
if ($user_id != "" && $my_user_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$user_id' and client='$my_user_id' and status=2"));
if ($client =="")
$all_filters = pg_query($database, "select identifier, name, model, variation, date_of_purchase, purchased_new, url, access_rights
from view_filter where users=$user_id and access_rights=$access[public] order by name");
else
$all_filters = pg_query($database, "select identifier, name, model, variation, date_of_purchase, purchased_new, url, access_rights
from view_filter where users=$user_id and access_rights<=$access[protected] order by name");
}
$num_of_filters = pg_num_rows($all_filters);
if ($my_user_id!=$user_id && $num_of_filters == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"5%\">Id</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"35%\">Model</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"13%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"7%\">New</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Purchase Date</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" >Access</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"filter.add.php\">Add</a></td>\n";
}
print "</tr>\n";
for ($i=0; $i < $num_of_filters; $i++) {
$filter = pg_fetch_row($all_filters, $i);
print "<tr color=$color[table_body]>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$filter[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$filter[8]\">$filter[1]</a> $filter[2] $filter[3]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >"; display_yes_no_text($filter[5]); print"</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($filter[4], 'date', $my_user_id == "" ? 0 : 1)."</td>\n";
if ($my_user_id==$user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$filter[7]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"filter.edit.php?item=$filter[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"filter.del.php?item=$filter[0]\">Delete</a></td>\n";
}
print "</tr>\n";
}
print "</table>\n";
}
function display_film($database, $my_user_id, $user_id) {
global $color;
global $style;
global $access;
if ($my_user_id==$user_id) {
if ($viewer_id==$owner_id) {
$all_films = pg_query($database, "select identifier, name, model, iso, format, url, access_rights
from view_film where users=$user_id order by name");
}
else {
if ($user_id != "" && $my_user_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$user_id' and client='$my_user_id' and status=2"));
if ($client =="")
from view_film where users=$owner_id order by name");
} else {
$client = FALSE;
if ($owner_id != "" && $viewer_id != "")
$client = pg_fetch_row(pg_query ($database, "select identifier from client where users='$owner_id' and client='$viewer_id' and status=2"));
if ($client == FALSE)
$all_films = pg_query($database, "select identifier, name, model, iso, format, url, access_rights
from view_film where users=$user_id and access_rights=$access[public] order by name");
from view_film where users=$owner_id and access_rights=$access[public] order by name");
else
$all_films = pg_query($database, "select identifier, name, model, iso, format, url, access_rights
from view_film where users=$user_id and access_rights<=$access[protected] order by name");
from view_film where users=$owner_id and access_rights<=$access[protected] order by name");
}
$num_of_films = pg_num_rows($all_films);
if ($my_user_id!=$user_id && $num_of_films == 0)
if ($viewer_id!=$owner_id && $num_of_films == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
@ -399,7 +233,7 @@ function display_film($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"13%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"7%\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\">Format</td>\n";
if ($my_user_id==$user_id) {
if ($viewer_id==$owner_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" >Access</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"film.add.php\">Add</a></td>\n";
}
@ -413,7 +247,7 @@ function display_film($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$film[4]</td>\n";
if ($my_user_id==$user_id) {
if ($viewer_id==$owner_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$film[6]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"film.edit.php?item=$film[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"film.del.php?item=$film[0]\">Delete</a></td>\n";
@ -424,23 +258,23 @@ function display_film($database, $my_user_id, $user_id) {
}
function display_manufacturer($database, $my_user_id, $user_id) {
function display_manufacturer($database, $viewer_id, $owner_id) {
global $color;
global $style;
global $access;
if ($user_id == "*")
if ($owner_id == "*")
$all_manufacturers = pg_query($database, "select identifier, name, url, last_modified_date from manufacturer order by name");
else
$all_manufacturers = pg_query($database, "select identifier, name, url, last_modified_date
from manufacturer where last_modifying_users=$user_id order by name");
from manufacturer where last_modifying_users=$owner_id order by name");
$num_of_manufacturers = pg_num_rows($all_manufacturers);
if ($user_id == "*" && $num_of_manufacturers == 0)
if ($owner_id == "*" && $num_of_manufacturers == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
if ($user_id == "*") {
if ($owner_id == "*") {
print "<tr bgcolor=\"$color[table_top]\">\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"4\"><font class=\"header\">All Manufacturers in the System</font></td>\n";
print "</tr>\n";
@ -450,7 +284,7 @@ function display_manufacturer($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"25%\">Name</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"40%\">URL</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Created</td>\n";
if ($user_id != "*")
if ($owner_id != "*")
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"manufacturer.add.php\">Add</a></td>\n";
print "</tr>\n";
@ -460,8 +294,8 @@ function display_manufacturer($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$manufacturer[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$manufacturer[2]\">$manufacturer[1]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"$manufacturer[2]\">$manufacturer[2]</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($manufacturer[3], 'date', $my_user_id == "" ? 0 : 1). "</td>\n";
if ($user_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($manufacturer[3], 'date', $viewer_id == "" ? 0 : 1). "</td>\n";
if ($owner_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"manufacturer.edit.php?item=$manufacturer[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"manufacturer.del.php?item=$manufacturer[0]\">Delete</a></td>\n";
}
@ -470,11 +304,11 @@ function display_manufacturer($database, $my_user_id, $user_id) {
print "</table>\n";
}
function display_label($database, $my_user_id, $user_id) {
function display_label($database, $viewer_id, $owner_id) {
global $color;
global $style;
if ($user_id == "*") {
if ($owner_id == "*") {
$all_labels = pg_query($database, "
select label.identifier,
(select url from manufacturer where identifier=label.manufacturer),
@ -496,16 +330,16 @@ function display_label($database, $my_user_id, $user_id) {
columns, rows, date_of_creation
from label, paper
where label.paper=paper.identifier
and label.users=$my_user_id
and label.users=$viewer_id
order by label.identifier");
}
$num_of_labels = pg_num_rows($all_labels);
if ($user_id == "*" && $num_of_labels == 0)
if ($owner_id == "*" && $num_of_labels == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
if ($user_id == "*") {
if ($owner_id == "*") {
print "<tr bgcolor=\"$color[table_top]\">\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\"colspan=\"11\"><font class=\"header\">All Labels in the System</font></td>\n";
print "</tr>\n";
@ -522,7 +356,7 @@ function display_label($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"5%\" nowrap>Rows</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"5%\" nowrap>Colums</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Created</td>\n";
if ($user_id != "*") {
if ($owner_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"label.add.php\">Add</a></td>\n";
}
print "</tr>\n";
@ -540,8 +374,8 @@ function display_label($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$label[10]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$label[11]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$label[12]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($label[13], 'date', $my_user_id == "" ? 0 : 1). "</td>\n";
if ($user_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($label[13], 'date', $viewer_id == "" ? 0 : 1). "</td>\n";
if ($owner_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"label.edit.php?item=$label[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"label.del.php?item=$label[0]\">Delete</a></td>\n";
}
@ -550,37 +384,44 @@ function display_label($database, $my_user_id, $user_id) {
print "</table>\n";
}
function display_location($database, $my_user_id) {
function display_location($database, $viewer_id) {
global $color;
global $style;
global $po_user;
global $user_type;
if ($my_user_id == "*") {
$result = pg_query($database, "select identifier, place, city, state, country, last_modified_date, latitude, longitude
$filter = " where private is false ";
if ($po_user['type'] == $user_type['administrator'])
$filter = "";
if ($viewer_id == "*") {
$result = pg_query($database, "select identifier, place, city, state, country, last_modified_date, latitude, longitude, private
from view_location
$filter
order by country, state, city, place");
}
else {
$result = pg_query($database, "select identifier, place, city, state, country, last_modified_date, latitude, longitude
} else {
$result = pg_query($database, "select identifier, place, city, state, country, last_modified_date, latitude, longitude, private
from view_location
where last_modifying_users=$my_user_id
where users=$viewer_id
order by country, state, city, place");
}
$num = pg_num_rows($result);
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
if ($my_user_id == "*") {
if ($viewer_id == "*") {
print "<tr bgcolor=\"$color[table_top]\">\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"5\"><font class=\"nodecor\">All Locations in the System</font></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"6\"><font class=\"nodecor\">All Locations in the System</font></td>\n";
print "</tr>\n";
}
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"5%\">Id</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"45%\">Description</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"40%\">Description</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Latitude</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\">Longitude</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Created</td>\n";
if ($my_user_id != "*") {
if ($viewer_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"5%\">Private</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"location.add.php\">Add</a></td>\n";
}
print "</tr>\n";
@ -601,8 +442,11 @@ function display_location($database, $my_user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$r[1] $r[2] $r[3] $r[4]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$r[6]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$r[7]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($r[5], 'date', $my_user_id == "" ? 0 : 1)."</td>\n";
if ($my_user_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($r[5], 'date', $viewer_id == "" ? 0 : 1)."</td>\n";
if ($viewer_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_yes_no_text($r[8]);
print "</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"location.edit.php?item=$r[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"location.del.php?item=$r[0]\">Delete</a></td>\n";
}
@ -612,11 +456,11 @@ function display_location($database, $my_user_id) {
}
function display_shop_items($database, $my_user_id, $user_id) {
function display_shop_items($database, $viewer_id, $owner_id) {
global $color;
global $style;
if ($user_id == "*") {
if ($owner_id == "*") {
$all_shop_items = pg_query($database, "
select shop_item.identifier, description, shop_item.date_of_creation, caption
from shop_item, shop_category
@ -627,16 +471,16 @@ function display_shop_items($database, $my_user_id, $user_id) {
select shop_item.identifier, description, shop_item.date_of_creation, caption
from shop_item, shop_category
where shop_item.category = shop_category.identifier
and shop_item.users=$my_user_id");
and shop_item.users=$viewer_id");
}
$num_of_shop_items = pg_num_rows($all_shop_items);
if ($user_id == "*" && $num_of_shop_items == 0)
if ($owner_id == "*" && $num_of_shop_items == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr bgcolor=\"$color[table_top]\">\n";
if ($user_id == "*") {
if ($owner_id == "*") {
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"11\"><font class=\"header\">All Shop Items in the System</font></td>\n";
}
else {
@ -648,7 +492,7 @@ function display_shop_items($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"50%\" nowrap>Description</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"20%\" nowrap>Category</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"15%\" nowrap>Created</td>\n";
if ($user_id != "*") {
if ($owner_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"shop.item.add.php\">Add</a></td>\n";
}
print "</tr>\n";
@ -659,8 +503,8 @@ function display_shop_items($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$shop_item[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$shop_item[1]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$shop_item[3]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($shop_item[2], 'date', $my_user_id == "" ? 0 : 1). "</td>\n";
if ($user_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($shop_item[2], 'date', $viewer_id == "" ? 0 : 1). "</td>\n";
if ($owner_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"shop.item.edit.php?item=$shop_item[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"shop.item.del.php?item=$shop_item[0]\">Delete</a></td>\n";
}
@ -669,11 +513,11 @@ function display_shop_items($database, $my_user_id, $user_id) {
print "</table>\n";
}
function display_shop_categories($database, $my_user_id, $user_id) {
function display_shop_categories($database, $viewer_id, $owner_id) {
global $color;
global $style;
if ($user_id == "*") {
if ($owner_id == "*") {
$all_shop_categories = pg_query($database, "
select identifier, caption, date_of_creation
from shop_category");
@ -682,16 +526,16 @@ function display_shop_categories($database, $my_user_id, $user_id) {
$all_shop_categories = pg_query($database, "
select identifier, caption, date_of_creation
from shop_category
where users=$my_user_id");
where users=$viewer_id");
}
$num_of_shop_categories = pg_num_rows($all_shop_categories);
if ($user_id == "*" && $num_of_shop_categories == 0)
if ($owner_id == "*" && $num_of_shop_categories == 0)
return;
print "<table align=\"center\" bgcolor=\"$color[table_background]\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">\n";
print "<tr bgcolor=\"$color[table_top]\">\n";
if ($user_id == "*") {
if ($owner_id == "*") {
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"11\"><font class=\"header\">All Shop Categories in the System</font></td>\n";
}
else {
@ -702,7 +546,7 @@ function display_shop_categories($database, $my_user_id, $user_id) {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"5%\" nowrap>Id</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"70%\" nowrap>Description</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"15%\" nowrap>Created</td>\n";
if ($user_id != "*") {
if ($owner_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"10%\" colspan=\"2\"><a href=\"shop.category.add.php\">Add</a></td>\n";
}
print "</tr>\n";
@ -712,8 +556,8 @@ function display_shop_categories($database, $my_user_id, $user_id) {
print "<tr color=$color[table_body]>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$shop_category[0]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >$shop_category[1]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($shop_category[2], 'date', $my_user_id == "" ? 0 : 1). "</td>\n";
if ($user_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" >".generate_date_html($shop_category[2], 'date', $viewer_id == "" ? 0 : 1). "</td>\n";
if ($owner_id != "*") {
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"shop.category.edit.php?item=$shop_category[0]\">Edit</a></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" ><a href=\"shop.category.del.php?item=$shop_category[0]\">Delete</a></td>\n";
}
@ -722,4 +566,130 @@ function display_shop_categories($database, $my_user_id, $user_id) {
print "</table>\n";
}
/* type is: flash filter camera film support scanner lens */
function profile_del_item ($database, $type, $identifier)
{
global $po_user;
global $user_type;
$type = pg_escape_string($type);
$identifer = pg_escape_string($identifier);
$type_to_remove = FALSE;
if ($identifier != "") {
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from $type where identifier=$identifier and users=$po_user[id]"));
if ($result[0] == 0) {
return FALSE;
}
}
pg_query($database, "begin");
$number_of_same_type = pg_fetch_row(pg_query($database, "select count(identifier) from $type where type=(select type from $type where identifier='$identifier')"));
if ($number_of_same_type[0] == 1) {
$type_to_remove = pg_fetch_row(pg_query($database, "select type from $type where identifier='$identifier'"));
}
$result = pg_query($database, "delete from $type where identifier='$identifier'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete $type: $identifier";
return FALSE;
}
if ($number_of_same_type[0] == 1) {
$result = pg_query($database, "delete from ".$type."_type where identifier='$type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete $type type: $type_to_remove";
return FALSE;
}
}
pg_query($database, "commit");
}
return TRUE;
}
/* type = flash, filter, scanner, support [lens film camera won't work] */
function profile_update_item($database, $identifier, $user_id, $type,
$type_id, $manufacturer_id,
$model, $variation, $serial,
$date_of_purchase, $purchased_new,
$access_rights)
{
global $po_user;
global $user_type;
$user_id = pg_escape_string($user_id);
$type = pg_escape_string($type);
$identifier = pg_escape_string($identifier);
$model = pg_escape_string($model);
$variation = pg_escape_string($variation);
$serial = pg_escape_string($serial);
$date_of_purchase = check_date_validity($date_of_purchase);
$purcahsed_new = pg_escape_string($purchased_new);
$access_rights = pg_escape_string($access_rights);
$type_to_remove = FALSE;
/* Ensure the user owns it !*/
if ($po_user['type'] < $user_type['administrator']) {
$result = pg_fetch_row(pg_query($database, "select count(identifier) from $type where identifier=$identifier and users=$user_id"));
if ($result[0] == 0) {
return FALSE;
}
}
pg_query($database, "begin");
if ($type_id=='custom') {
/* type has changed */
$number_of_same_type = pg_fetch_row(pg_query($database, "select count(identifier) from $type where type=(select type from $type where identifier='$identifier')"));
if ($number_of_same_type[0] == 1) {
/* there was only one of this kind, so we have to remove it */
$type_to_remove = pg_fetch_row(pg_query($database, "select type from $type where identifier='$identifier'"));
}
/* create new type */
$new_type_id = pg_fetch_row(pg_query($database, "select nextval('".$type."_type_id_sequence')"));
$type_id = $new_type_id[0];
$result = pg_query($database, "insert into ".$type."_type (identifier, manufacturer, model, variation, last_modified_date, last_modifying_users)
values ($type_id, $manufacturer_id, '$model', '$variation', now(), $user_id)");
if (!$result) {
pg_query($database, "rollback");
print "Failed to create new type";
return FALSE;
}
}
/* add item */
$result = pg_query($database, "update $type set type=$type_id, serial_number='$serial', date_of_purchase=$date_of_purchase, purchased_new='$purchased_new', access_rights='$access_rights' where identifier='$identifier'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to create new item";
print "update $type set type=$type_id, serial_number='$serial', date_of_purchase=$date_of_purchase, purchased_new='$purchased_new', access_rights='$access_rights' where identifier='$identifier'";
return FALSE;
}
/* remove old type */
if ($type_to_remove) {
$result = pg_query($database, "delete from ".$type."_type where identifier='$type_to_remove[0]'");
if (!$result) {
pg_query($database, "rollback");
print "Failed to delete type: $type";
return FALSE;
}
}
pg_query($database, "commit");
return TRUE;
}
?>

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -24,7 +24,7 @@ include_once "exif.php";
$current_rdf_tag = "not_implemented";
$rdf_image_data = array ("author" => "",
"title" => "",
"keyword" => "",
"keywords" => NULL,
"caption" => "",
"copyright" => "",
"web_statement" => "",
@ -112,19 +112,6 @@ function rdf_concat($string, $word) {
return $string;
}
function rdf_concat_keyword($string, $word) {
if ($string == "")
$string = $word;
else {
/* FIX FOR BUGGY XML PARSER */
if (ord($word[0]) > 127)
$string .= $word;
else
$string .= "; ".$word;
}
return $string;
}
function convert_into_float($string) {
$num_first = substr($string, 0, strpos($string, "/"));
$num_second = substr($string, strpos($string, "/")+1);
@ -149,7 +136,7 @@ function photo_parse_rdf($database, $index, $user_id, $image_data) {
$rdf_image_data["author"] = "";
$rdf_image_data["title"] = "";
$rdf_image_data["keyword"] = "";
$rdf_image_data["keywords"] = NULL;
$rdf_image_data["caption"] = "";
$rdf_image_data["copyright"] = "";
$rdf_image_data["web_statement"] = "";
@ -216,8 +203,8 @@ function photo_parse_rdf($database, $index, $user_id, $image_data) {
if ($rdf_image_data['title'] != "")
$image_data['title'] = $rdf_image_data['title'];
if ($rdf_image_data['keyword'] != "")
$image_data['keyword'] = $rdf_image_data['keyword'];
if ($rdf_image_data['keywords'] != NULL)
$image_data['keywords'] = $rdf_image_data['keywords'];
if ($rdf_image_data['caption'] != "")
$image_data['caption'] = $rdf_image_data['caption'];
@ -343,10 +330,7 @@ function RDF_CharacterData($parser, $data) {
$rdf_image_data['author'] = rdf_concat($rdf_image_data['author'], $data);
break;
case "keyword":
if (!$rdf_image_data['keyword'])
$rdf_image_data['keyword'] = rdf_concat($rdf_image_data['keyword'], $data);
else
$rdf_image_data['keyword'] = rdf_concat_keyword($rdf_image_data['keyword'], $data);
$rdf_image_data['keywords'][] = $data;
break;
case "caption_writer":
$rdf_image_data['caption_writer'] = rdf_concat($rdf_image_data['caption_writer'], $data);

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -261,9 +261,9 @@ function display_effective_content_search($session_id, $photo_id) {
print "<form method=\"post\" action=\"search.image.php\">\n";
print "<table><tr><td align=\"left\" valign=\"middle\">";
print "<input type=\"image\" src=\"$theme/button.search.gif\" border=\"0\" value=\"Search\">\n";
print "<input type=\"image\" src=\"$theme/button.search.gif\" border=\"0\" value=\"Search\"/>\n";
print "</td><td align=\"left\" valign=\"middle\">";
print "<input type=\"hidden\" name=\"photo_id\" value=\"$photo_id\">\n";
print "<input type=\"hidden\" name=\"photo_id\" value=\"$photo_id\"/>\n";
print "<select name=\"type\">";
print "<option value=\"layout\">for photos with similar layout";
print "<option value=\"color\">for photos with similar colors";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -40,15 +40,12 @@ function build_itemized_search_string($search_string, $identifier, $arguments) {
while ($token) {
if (strncmp($token, "AND", 3) == 0) {
$itemized_search_string = $itemized_search_string . "AND ";
}
elseif (strncmp($token, "NOT", 3) == 0) {
} elseif (strncmp($token, "NOT", 3) == 0) {
$itemized_search_string = $itemized_search_string . "NOT ";
}
elseif (strncmp($token, "OR", 2) == 0) {
} elseif (strncmp($token, "OR", 2) == 0) {
$itemized_search_string = $itemized_search_string . "OR ";
}
else {
$itemized_search_string = $itemized_search_string . "<a href=\"search.text.general.php?$arguments".$identifier."=$token\">$token<a> ";
} else {
$itemized_search_string = $itemized_search_string . "<a href=\"search.text.general.php?$arguments".$identifier."=$token\">$token</a> ";
}
$token = strtok("+ \n\t");
}
@ -235,14 +232,14 @@ function generate_html_users_combo($identifier, $database, $current_user_id, $st
$user_list = pg_query($database, "select identifier, last_name, first_name, member_since from users where users.type > $user_type[client] order by last_name, first_name");
$html_string .= "<select name=\"$identifier\" $style title=\"Search for photos or folders belonging to a specified user.\">";
$html_string .= "<option value=\"all\">All Users";
$html_string .= "<option value=\"all\">All Users</option>";
for ($i=0; $i < pg_num_rows($user_list); $i++) {
$user = pg_fetch_row($user_list, $i);
if ($user[0] == $current_user_id) {
$html_string .= "<option value=\"$user[0]\" selected>$user[1], $user[2]";
$html_string .= "<option value=\"$user[0]\" selected>$user[1], $user[2]</option>";
}
else {
$html_string .= "<option value=\"$user[0]\">$user[1], $user[2]";
$html_string .= "<option value=\"$user[0]\">$user[1], $user[2]</option>";
}
}
$html_string .= "</select>";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -23,28 +23,57 @@ include_once "vars.php";
include_once "database.php";
function site_prolog() {
$sybase = FALSE;
// if magic quotes is enabled
if ( get_magic_quotes_gpc () )
{
// workaround because magic_quotes does not change $_SERVER['argv']
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : NULL;
global $po_cookie;
global $po_user;
// fix all affected arrays
foreach ( array ('_ENV', '_REQUEST', '_GET', '_POST', '_COOKIE', '_SERVER') as $var )
{
$GLOBALS[$var] = fix_magic_quotes ($GLOBALS[$var], $sybase);
}
$_SERVER['argv'] = $argv;
$sybase = FALSE;
// if magic quotes is enabled
if ( get_magic_quotes_gpc () ) {
// workaround because magic_quotes does not change $_SERVER['argv']
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : NULL;
// fix all affected arrays
foreach ( array ('_ENV', '_REQUEST', '_GET', '_POST', '_COOKIE', '_SERVER') as $var ) {
$GLOBALS[$var] = fix_magic_quotes ($GLOBALS[$var], $sybase);
}
$_SERVER['argv'] = $argv;
// turn off magic quotes, this is so scripts which
// are sensitive to the setting will work correctly
ini_set ('magic_quotes_gpc', 0);
}
set_magic_quotes_runtime(0);
/* Turn off error display */
ini_set ('display_errors', 0);
/* Establish DB Connection */
$dbh = po_dbconnect();
if ($dbh == FALSE) return FALSE;
// turn off magic quotes, this is so scripts which
// are sensitive to the setting will work correctly
ini_set ('magic_quotes_gpc', 0);
}
/* See if user is logged in; Set up session data.. */
if (isset($_COOKIE[$po_cookie])) {
$session_id = pg_escape_string($_COOKIE[$po_cookie]);
$res = pg_query($dbh, "SELECT identifier, type, preferences, username, first_name, last_name, password
FROM users
WHERE session_id='$session_id'");
if (($res != FALSE) && pg_num_rows($res)) {
$row = pg_fetch_assoc($res);
$po_user['id'] = $row['identifier'];
$po_user['type'] = $row['type'];
$po_user['session'] = $session_id;
$po_user['prefs'] = $row['preferences'];
$po_user['username'] = $row['username'];
$po_user['first_name'] = $row['first_name'];
$po_user['last_name'] = $row['last_name'];
$po_user['password'] = $row['password'];
}
}
set_magic_quotes_runtime(0);
return po_dbconnect();
return $dbh;
}
function site_epilog($database) {
@ -71,7 +100,7 @@ function site_credit($align, $show_version, $framed) {
$php_version = version();
print "Powered by <a class=\"nodecor\" href=\"http://po.shaftnet.org/\">Photo Organizer</a> v$php_version<br/>\n"; }
print "<a class=\"nodecor\" href=\"copyright.php\">Copyright</a> &copy; 2002-2006 <a class=\"nodecor\" href=\"http://www.k-i-s.net\">Balint Kis</a>, 2005-2006 <a class=\"nodecor\" href=\"http://www.shaftnet.org/users/pizza\">Solomon Peachy</a>.\n";
print "Copyright &copy; 2002-2006 <a class=\"nodecor\" href=\"http://www.k-i-s.net\">Balint Kis</a>, &copy; 2005-2006 <a class=\"nodecor\" href=\"http://www.shaftnet.org/users/pizza\">Solomon Peachy</a>, and is available under the terms of the <a class=\"nodecor\" href=\"copyright.php\">GNU GPL</a>.\n";
print "</div>\n";
if ($framed) {
@ -114,11 +143,26 @@ function site_head($page_title) {
function site_header($page_width, $page_title) {
global $color;
global $po_user;
global $user_type;
global $install_enabled;
site_head($page_title);
print "<body text=\"$color[foreground]\" bgcolor=\"$color[background]\" link=\"$color[link]\" vlink=\"$color[v_link]\" alink=\"$color[a_link]\">\n";
if (($po_user['type'] == $user_type['administrator']) &&
($po_user['username'] == 'admin') &&
($po_user['password'] == 'admin')) {
print "<h2><font color=\"red\">You are using the default admin account and
have not changed the default password. This is a major security risk!</font></h2>\n";
}
if ($install_enabled) {
print "<h2><font color=\"red\">You have the installer script enabled. Please set \$install_enabled=0 in your config_site.php to disable the installer. Continuing with it enabled is a security risk!</font></h2>\n";
}
print "<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"$page_width\">\n";
print "<tr>\n<td align=\"left\" valign=\"top\">\n";
site_logo("left");
@ -160,17 +204,16 @@ function site_navigator_status($left_string, $right_string) {
}
function site_navigator_stand_alone($database, $sub_menu) {
global $po_cookie;
$session_id = $_COOKIE[$po_cookie];
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
site_navigator($sub_menu, $my_user_id[1]);
site_navigator($sub_menu);
}
function site_navigator($sub_menu, $type) {
function site_navigator($sub_menu) {
global $theme;
global $user_type;
global $po_user;
$type = $po_user['type'];
print "<!-- Navigator Begin -->\n";
print "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n";
@ -182,68 +225,68 @@ function site_navigator($sub_menu, $type) {
if ($type >= $user_type['user']) {
print "<td>";
print "<a class=\"nodecor\" href=\"my.folder.php\"><img src=\"$theme/notebook.myfolders.gif\" alt=\"My Folders\" border=\"0\"></a>";
print "<a class=\"nodecor\" href=\"my.folder.php\"><img src=\"$theme/notebook.myfolders.gif\" alt=\"My Folders\" border=\"0\"/></a>";
print "</td>\n";
} else if ($type == $user_type['client']) {
print "<td><a class=\"nodecor\" href=\"my.folder.php\">";
if ($sub_menu==5)
print "<img src=\"$theme/notebook.myalbums.a.gif\" alt=\"My Albums\" border=\"0\">";
print "<img src=\"$theme/notebook.myalbums.a.gif\" alt=\"My Albums\" border=\"0\"/>";
else
print "<img src=\"$theme/notebook.myalbums.gif\" alt=\"My Folders\" border=\"0\">";
print "<img src=\"$theme/notebook.myalbums.gif\" alt=\"My Folders\" border=\"0\"/>";
print "</a></td>\n";
}
if ($type >= $user_type['client']) {
print "<td><a class=\"nodecor\" href=\"my.datebook.php\">";
if ($sub_menu==8)
print "<img src=\"$theme/notebook.mydatebook.a.gif\" alt=\"My DateBook\" border=\"0\">";
print "<img src=\"$theme/notebook.mydatebook.a.gif\" alt=\"My DateBook\" border=\"0\"/>";
else
print "<img src=\"$theme/notebook.mydatebook.gif\" alt=\"My DateBook\" border=\"0\">";
print "<img src=\"$theme/notebook.mydatebook.gif\" alt=\"My DateBook\" border=\"0\"/>";
print "</a></td>\n";
}
if ($type >= $user_type['user']) {
print "<td><a class=\"nodecor\" href=\"my.profile.php\">";
if ($sub_menu==6)
print "<img src=\"$theme/notebook.myprofile.a.gif\" alt=\"My Profile\" border=\"0\">";
print "<img src=\"$theme/notebook.myprofile.a.gif\" alt=\"My Profile\" border=\"0\"/>";
else
print "<img src=\"$theme/notebook.myprofile.gif\" alt=\"My Profile\" border=\"0\">";
print "<img src=\"$theme/notebook.myprofile.gif\" alt=\"My Profile\" border=\"0\"/>";
print "</a></td>\n";
}
if ($type >= $user_type['client']) {
print "<td><a class=\"nodecor\" href=\"my.settings.php\">";
if ($sub_menu==7)
print "<img src=\"$theme/notebook.mysettings.a.gif\" alt=\"My Settings\" border=\"0\">";
print "<img src=\"$theme/notebook.mysettings.a.gif\" alt=\"My Settings\" border=\"0\"/>";
else
print "<img src=\"$theme/notebook.mysettings.gif\" alt=\"My Settings\" border=\"0\">";
print "<img src=\"$theme/notebook.mysettings.gif\" alt=\"My Settings\" border=\"0\"/>";
print "</a></td>\n";
}
if ($type >= $user_type['user']) {
print "<td><a class=\"nodecor\" href=\"my.tools.php\">";
if ($sub_menu==10)
print "<img src=\"$theme/notebook.mytools.a.gif\" alt=\"My Tools\" border=\"0\">";
print "<img src=\"$theme/notebook.mytools.a.gif\" alt=\"My Tools\" border=\"0\"/>";
else
print "<img src=\"$theme/notebook.mytools.gif\" alt=\"My Tools\" border=\"0\">";
print "<img src=\"$theme/notebook.mytools.gif\" alt=\"My Tools\" border=\"0\"/>";
print "</a></td>\n";
}
if ($user_type['disabled'] < $type && $type < $user_type['administrator']) {
print "<td><a class=\"nodecor\" href=\"basket.php\">";
if ($sub_menu==11)
print "<img src=\"$theme/notebook.mybasket.a.gif\" alt=\"My Basket\" border=\"0\">";
print "<img src=\"$theme/notebook.mybasket.a.gif\" alt=\"My Basket\" border=\"0\"/>";
else
print "<img src=\"$theme/notebook.mybasket.gif\" alt=\"My Basket\" border=\"0\">";
print "<img src=\"$theme/notebook.mybasket.gif\" alt=\"My Basket\" border=\"0\"/>";
print "</a></td>\n";
}
if ($type == $user_type['administrator']) {
print "<td><a class=\"nodecor\" href=\"admin.php\">";
if ($sub_menu==9)
print "<img src=\"$theme/notebook.admin.a.gif\" alt=\"Admin\" border=\"0\">";
print "<img src=\"$theme/notebook.admin.a.gif\" alt=\"Admin\" border=\"0\"/>";
else
print "<img src=\"$theme/notebook.admin.gif\" alt=\"Admin\" border=\"0\">";
print "<img src=\"$theme/notebook.admin.gif\" alt=\"Admin\" border=\"0\"/>";
print "</a></td>\n";
}
@ -272,7 +315,7 @@ function site_navigator($sub_menu, $type) {
print "</a></td>\n";
print "<td><a class=\"nodecor\" href=\"login.php\">";
if ($type == "") {
if ($type == "" || $type == $user_type['disabled']) {
if ($sub_menu==3)
print "<img src=\"$theme/notebook.login.a.gif\" alt=\"Login\" border=\"0\"/>";
else
@ -294,7 +337,7 @@ function site_navigator($sub_menu, $type) {
print "</a></td>\n";
print "</tr>\n";
print "</table>\n";
print "</td>\n";
print "</tr>\n";
print "</table>\n";
print "<!-- Navigator End -->\n";
@ -306,41 +349,38 @@ function site_search_entry($align, $size) {
print "<form action=\"search.text.general.php\" method=\"post\">";
print "<table align=\"center\" border=\"0\">";
print "<tr><td align=\"center\">";
print "<input type=\"text\" name=\"search_string\" value=\"$search_string\" size=\"$size\">";
print "<input type=\"text\" name=\"search_string\" value=\"$search_string\" size=\"$size\"/>";
print "</td><td align=\"center\">";
print "<input type=\"image\" src=\"$theme/button.search.gif\" border=\"0\" value=\"Search\">\n";
print "<input type=\"image\" src=\"$theme/button.search.gif\" border=\"0\" value=\"Search\"/>\n";
print "</td></tr>";
print "</table>";
print "</form>";
}
function site_display_photo($database, $identifier, $framed) {
global $theme;
global $po_cookie;
global $default_popup_enable;
global $default_popup_delay;
global $user_type;
global $access;
global $po_user;
$session_id = $_COOKIE[$po_cookie];
$my_user_id = pg_fetch_row(pg_query($database, "select users.identifier, type, popup_enable, popup_delay from users, preferences where session_id='$session_id' and users.preferences=preferences.identifier"));
if ($my_user_id[0] == "") {
$my_data[2] = $default_popup_enable;
$my_data[3] = $default_popup_delay;
if ($po_user['type'] == $user_type['disabled']) {
$my_data[0] = $default_popup_enable;
$my_data[1] = $default_popup_delay;
} else {
$my_data = pg_fetch_row(pg_query($database, "select popup_enable, popup_delay from users, preferences where users.identifier=$po_user[id] and users.preferences=preferences.identifier"));
}
$photo_owner_data = pg_fetch_row(pg_query($database, "select users from photo where photo.identifier=$identifier"));
if ($my_user_id[0] == $photo_owner_data[0] || $my_user_id[1] == $user_type['administrator']) {
if (($po_user['id'] == $photo_owner_data[0]) ||
($po_user['type'] == $user_type['administrator'])) {
$sql_query_photo_access_rights_string = "";
}
else {
$client = pg_fetch_row(pg_query($database, "select identifier from client where users='$photo_owner_data[0]' and client='$my_user_id[0]' and status=2"));
} else {
$client = pg_fetch_row(pg_query($database, "select identifier from client where users=$photo_owner_data[0] and client=$po_user[id] and status=2"));
if ($client == "") {
$sql_query_photo_access_rights_string = "and photo.access_rights = $access[public]";
}
else {
} else {
$sql_query_photo_access_rights_string = "and photo.access_rights < $access[private]";
}
}
@ -351,7 +391,7 @@ function site_display_photo($database, $identifier, $framed) {
11 - (select avg(rating.value) from rating where rating.photo=photo.identifier) as rating,
views,
(select is_photo_for_sale(photo.identifier)) as for_sale,
photo.title, photo.author, photo.keyword
photo.title, photo.author, '' as keyword
from photo, photo_dupe, photo_version
where photo.identifier = '$identifier'
and photo.identifier = photo_version.photo
@ -363,13 +403,12 @@ function site_display_photo($database, $identifier, $framed) {
if (pg_num_rows($photo_data) < 1)
return;
/* replace the first 0, 1, 2 with $my_user_id[0], $my_user_id[1], $photo_owner_data[0] to display the checkbox */
display_photo_slides("folder", 0, 1, "", $photo_data, 1, 1, $my_data[2], $my_data[3], false, $framed, "");
display_photo_slides("folder", 0, 1, "", $photo_data, 1, 1, $my_data[0], $my_data[1], false, $framed, "");
}
function site_display_random_photos($database, $type, $identifier, $rows, $columns, $framed) {
global $theme;
global $po_cookie;
global $po_user;
global $default_popup_enable;
global $default_popup_delay;
global $user_type;
@ -377,12 +416,11 @@ function site_display_random_photos($database, $type, $identifier, $rows, $colum
$num_of_photos = $rows * $columns;
$session_id = $_COOKIE[$po_cookie];
$my_user_id = pg_fetch_row(pg_query($database, "select users.identifier, type, popup_enable, popup_delay from users, preferences where session_id='$session_id' and users.preferences=preferences.identifier"));
if ($my_user_id[0] == "") {
$my_data[2] = $default_popup_enable;
$my_data[3] = $default_popup_delay;
if ($po_user['type'] == $user_type['disabled']) {
$my_data[0] = $default_popup_enable;
$my_data[1] = $default_popup_delay;
} else {
$my_data = pg_fetch_row(pg_query($database, "select popup_enable, popup_delay from users, preferences where users.identifier=$po_user[id] and users.preferences=preferences.identifier"));
}
switch ($type) {
@ -407,18 +445,16 @@ function site_display_random_photos($database, $type, $identifier, $rows, $colum
break;
}
if ($my_user_id[0] == $owner_data[0] || $my_user_id[1] == $user_type['administrator']) {
if (($po_user['id'] == $photo_owner_data[0]) ||
($po_user['type'] == $user_type['administrator'])) {
$sql_query_photo_access_rights_string = "";
}
else {
if ($owner_data[0] != "" && $my_user_id[0] != "")
$client = pg_fetch_row(pg_query($database, "select identifier from client where users='$owner_data[0]' and client='$my_user_id[0]' and status=2"));
} else {
if ($owner_data[0] != "" && $po_user['type'] > $user_type['disabled'])
$client = pg_fetch_row(pg_query($database, "select identifier from client where users='$owner_data[0]' and client='$po_user[id]' and status=2"));
if ($client == "") {
$sql_query_photo_access_rights_string = "and photo.access_rights = $access[public]";
}
else {
} else {
$sql_query_photo_access_rights_string = "and photo.access_rights < $access[private]";
}
}
@ -429,7 +465,7 @@ function site_display_random_photos($database, $type, $identifier, $rows, $colum
11 - (select avg(rating.value) from rating where rating.photo=photo.identifier) as rating,
views,
(select is_photo_for_sale(photo.identifier)) as for_sale,
photo.title, photo.author, photo.keyword
photo.title, photo.author, '' as keyword
from photo, photo_dupe, photo_version $sql_extra_tables
where $sql_photo_selector
and photo.identifier = photo_version.photo
@ -441,15 +477,14 @@ function site_display_random_photos($database, $type, $identifier, $rows, $colum
limit $num_of_photos");
$num_of_photos = pg_num_rows($photo_data);
/* replace the first 0, 1, 2 with $my_user_id[0], $my_user_id[1], $photo_owner_data[0] to display the checkbox */
display_photo_slides($display_type, 0, 1, $identifier, $photo_data, $num_of_photos, $columns, $my_data[2], $my_data[3], false, $framed, "");
display_photo_slides($display_type, 0, 1, $identifier, $photo_data, $num_of_photos, $rows, $my_data[0], $my_data[1], false, $framed, "");
}
function site_display_user_name($database, $identifier, $link) {
$user_name = pg_fetch_row(pg_query($database, "select first_name, last_name from users where identifier = $identifier"));
if ($link)
print "<a href=user.php?user=$identifier>$user_name[0] $user_name[1]</a>";
print "<a href=\"user.php?user=$identifier\">$user_name[0] $user_name[1]</a>";
else
print "$user_name[0] $user_name[1]";
}

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -26,20 +26,20 @@ $tools_data = array("bulkupdate" => array("idx" => 1, "active_img" => "$the
"converter" => array("idx" => 4, "active_img" => "$theme/navigator.tl.xmlconv.a.gif", "img" => "$theme/navigator.tl.xmlconv.gif", 'link' => "my.tools.php?selector=4", "alt" => " XML Converter "),
"content_indexer" => array("idx" => 5, "active_img" => "$theme/navigator.tl.content.indexer.a.gif", "img" => "$theme/navigator.tl.content.indexer.gif", 'link' => "my.tools.php?selector=5", "alt" => " Content Indexer "));
function display_xml_template_generator($database, $my_user_id) {
function display_xml_template_generator($database, $user_id) {
global $style;
global $color;
global $theme;
$users_location = pg_query($database, "select identifier, country, state, city, place from view_location order by country, state, city, place");
$users_folder = pg_query($database, "select identifier, caption, parent_folder from folder where users=$my_user_id[0] and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$users_camera = pg_query($database, "select identifier, name, model, variation from view_camera where users=$my_user_id[0]");
$users_lens = pg_query($database, "select identifier, name, model, variation, s_min_aperture, s_max_aperture, s_min_focal_length, s_max_focal_length from view_lens where users=$my_user_id[0]");
$users_film = pg_query($database, "select identifier, name, model, iso from view_film where users=$my_user_id[0]");
$users_flash = pg_query($database, "select identifier, name, model, variation from view_flash where users=$my_user_id[0]");
$users_scanner = pg_query($database, "select identifier, name, model, variation from view_scanner where users=$my_user_id[0]");
$users_filter = pg_query($database, "select identifier, name, model, variation from view_filter where users=$my_user_id[0]");
$users_support = pg_query($database, "select identifier, name, model, variation from view_support where users=$my_user_id[0]");
$users_folder = pg_query($database, "select identifier, caption, parent_folder from folder where users=$user_id and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$users_camera = pg_query($database, "select identifier, name, model, variation from view_camera where users=$user_id");
$users_lens = pg_query($database, "select identifier, name, model, variation, s_min_aperture, s_max_aperture, s_min_focal_length, s_max_focal_length from view_lens where users=$user_id");
$users_film = pg_query($database, "select identifier, name, model, iso from view_film where users=$user_id");
$users_flash = pg_query($database, "select identifier, name, model, variation from view_flash where users=$user_id");
$users_scanner = pg_query($database, "select identifier, name, model, variation from view_scanner where users=$user_id");
$users_filter = pg_query($database, "select identifier, name, model, variation from view_filter where users=$user_id");
$users_support = pg_query($database, "select identifier, name, model, variation from view_support where users=$user_id");
$aperture = pg_query($database, "select identifier, value from aperture");
$focal_length = pg_query($database, "select identifier, value from focal_length");
@ -63,32 +63,32 @@ function display_xml_template_generator($database, $my_user_id) {
print "</tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Image file name</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">";
print "<input type=\"text\" name=\"file_name\" value=\"$file_name\" title=\"Root of the file name - the part which is constant\">";
print "<input type=\"text\" name=\"file_name\" value=\"$file_name\" title=\"Root of the file name - the part which is constant\"/>";
print "<select name=\"file_number_digits\" title=\"Number of digits in the file name including 0. For 00234 this number is 5\">";
for ($i=1; $i < 11; $i++) {
print "<option value=$i>$i";
}
print "</select>";
print " . <input type=\"text\" name=\"file_format\" value=\"$file_format\" size=\"5\" title=\"File format, ex: jpg, gif, ...\">";
print " . <input type=\"text\" name=\"file_format\" value=\"$file_format\" size=\"5\" title=\"File format, ex: jpg, gif, ...\"/>";
print"</td>\n</tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Start number</td>\n<td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">";
print "<input type=\"text\" name=\"file_number_start\" value=\"$file_number_start\" size=\"10\" title=\"File start number - the number of the first photo\">";
print "<input type=\"text\" name=\"file_number_start\" value=\"$file_number_start\" size=\"10\" title=\"File start number - the number of the first photo\"/>";
print "</td>\n</tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Number of frames</td>\n<td align=\"left\" bgcolor=\"$color[table_body]\" width=\"75%\">";
print "<input type=\"text\" name=\"frame_number\" value=\"$frame_number\" size=\"10\" title=\"For how many photos you want to generate the XML file\">";
print "<input type=\"text\" name=\"frame_number\" value=\"$frame_number\" size=\"10\" title=\"For how many photos you want to generate the XML file\"/>";
print "</td>\n</tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Folder</td> <td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_folder_combo("folder", $users_folder, $current_folder, "");
print "</td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Title</td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"title\" size=\"60\" title=\"The title of the Photo\"></td></tr>\n";
print "<input type=\"text\" name=\"title\" size=\"60\" title=\"The title of the Photo\"/></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Author</td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"author\" size=\"60\" title=\"Photographer's Name\"></td></tr>\n";
print "<input type=\"text\" name=\"author\" size=\"60\" title=\"Photographer's Name\"/></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Keywords</td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<textarea wrap=\"hard\" name=\"keyword\" rows=3 cols=\"60\"></textarea></td></tr>\n";
print "<textarea wrap=\"hard\" name=\"keywords\" title=\"Keywords, separated by semicolons\" rows=3 cols=\"60\"></textarea></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Caption</td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<textarea wrap=\"hard\" name=\"caption\" rows=\"7\" cols=\"60\"></textarea></td></tr>\n";
@ -100,9 +100,9 @@ function display_xml_template_generator($database, $my_user_id) {
print "</td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Storage Location</td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_storage_location_combo("storage_location_type", "");
print "<input type=\"text\" name=\"storage_location_id\" size=\"10\" title=\"Storage location identifier - this will be incremented when the index wraps around\"> -
<input type=\"text\" name=\"storage_index\" size=\"4\" title=\"Storage location index - this must be a number and will be incremented for each photo\"> :
<input type=\"text\" name=\"storage_size\" size=\"4\" title=\"Storage location size - the storage index will wrap around when reaches this limit\">";
print "<input type=\"text\" name=\"storage_location_id\" size=\"10\" title=\"Storage location identifier - this will be incremented when the index wraps around\"/> -
<input type=\"text\" name=\"storage_index\" size=\"4\" title=\"Storage location index - this must be a number and will be incremented for each photo\"/> :
<input type=\"text\" name=\"storage_size\" size=\"4\" title=\"Storage location size - the storage index will wrap around when reaches this limit\"/>";
print "</td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Access</td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_access_combo("access_rights", "t", "");
@ -178,23 +178,23 @@ function display_xml_template_generator($database, $my_user_id) {
print "</td></tr>\n";
print "</table>\n";
print "&nbsp;<br />";
print "<input type=\"image\" src=\"$theme/button.submit.gif\" border=\"0\" value=\"submit\">";
print "<input type=\"image\" src=\"$theme/button.submit.gif\" border=\"0\" value=\"submit\"/>";
print "</form>\n";
}
function display_bulk_update($database, $my_user_id, $url, $rule_identifier) {
function display_bulk_update($database, $user_id, $url, $rule_identifier) {
global $style;
global $color;
global $theme;
$users_location = pg_query($database, "select identifier, country, state, city, place from view_location order by country, state, city, place");
$users_camera = pg_query($database, "select identifier, name, model, variation from view_camera where users=$my_user_id[0]");
$users_lens = pg_query($database, "select identifier, name, model, variation, s_min_aperture, s_max_aperture, s_min_focal_length, s_max_focal_length from view_lens where users=$my_user_id[0]");
$users_film = pg_query($database, "select identifier, name, model, iso from view_film where users=$my_user_id[0]");
$users_flash = pg_query($database, "select identifier, name, model, variation from view_flash where users=$my_user_id[0]");
$users_scanner = pg_query($database, "select identifier, name, model, variation from view_scanner where users=$my_user_id[0]");
$users_filter = pg_query($database, "select identifier, name, model, variation from view_filter where users=$my_user_id[0]");
$users_support = pg_query($database, "select identifier, name, model, variation from view_support where users=$my_user_id[0]");
$users_camera = pg_query($database, "select identifier, name, model, variation from view_camera where users=$user_id");
$users_lens = pg_query($database, "select identifier, name, model, variation, s_min_aperture, s_max_aperture, s_min_focal_length, s_max_focal_length from view_lens where users=$user_id");
$users_film = pg_query($database, "select identifier, name, model, iso from view_film where users=$user_id");
$users_flash = pg_query($database, "select identifier, name, model, variation from view_flash where users=$user_id");
$users_scanner = pg_query($database, "select identifier, name, model, variation from view_scanner where users=$user_id");
$users_filter = pg_query($database, "select identifier, name, model, variation from view_filter where users=$user_id");
$users_support = pg_query($database, "select identifier, name, model, variation from view_support where users=$user_id");
$aperture = pg_query($database, "select identifier, value from aperture");
$focal_length = pg_query($database, "select identifier, value from focal_length");
@ -208,13 +208,15 @@ function display_bulk_update($database, $my_user_id, $url, $rule_identifier) {
$scan_multiscan = pg_query($database, "select identifier, value from scan_multiscan");
$iso_override = pg_query($database, "select identifier, value from film_iso");
$users_folder = pg_query($database, "select identifier, caption, parent_folder from folder where users=$my_user_id[0] and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$users_album = pg_query($database, "select identifier, caption, parent_album from album where users=$my_user_id[0] and caption!='Spool' order by date_of_creation desc");
$users_folder = pg_query($database, "select identifier, caption, parent_folder from folder where users=$user_id and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$users_album = pg_query($database, "select identifier, caption, parent_album from album where users=$user_id and caption!='Spool' order by date_of_creation desc");
$users_spool = pg_query($database, "select album.identifier from album where caption = 'Spool' and users = $my_user_id[0]");
/* New spool code, disabled for now
$users_spool = pg_query($database, "select album.identifier from album where caption = 'Spool' and users = $user_id");
$spool_album=pg_fetch_row($users_spool);
$photos_in_spooler = pg_query($database, "select photo from album_content where album = $spool_album[0] group by photo order by photo");
$num_photos = pg_num_rows($photos_in_spooler);
*/
print "<form method=\"post\" action=\"bulk.update.php\" enctype=\"multipart/form-data\">\n";
@ -224,18 +226,22 @@ function display_bulk_update($database, $my_user_id, $url, $rule_identifier) {
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_top]\" colspan=\"2\">Search Criteria</td>\n";
print "</tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Folder<input type=\"radio\" name=\"selection\" value=\"folder\" checked /></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Folder<input type=\"radio\" name=\"selection\" value=\"folder\" /></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_folder_combo("select_folder", $users_folder, $current_folder, "all");
print "</td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Album<input type=\"radio\" name=\"selection\" value=\"album\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
display_album_combo("select_album", $users_album, $current_album, "");
print "</td></tr>\n";
/* New spool code, disabled for now
if ($num_photos > 0) {
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Spool<input type=\"radio\" name=\"selection\" value=\"spool\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "Photos in spool: $num_photos";
print "<input type=\"hidden\" value=\"$spool_album[0]\"/>";
print "</td></tr>\n";
}
*/
print "</table>\n";
print "<p>&nbsp;<p>";
@ -254,8 +260,11 @@ function display_bulk_update($database, $my_user_id, $url, $rule_identifier) {
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Author<input type=\"checkbox\" name=\"to_update[]\" value=\"set_author\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<textarea wrap=\"soft\" name=\"set_author\" rows=\"2\"></textarea></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Keywords<input type=\"checkbox\" name=\"to_update[]\" value=\"set_keyword\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<textarea wrap=\"soft\" name=\"set_keyword\" rows=\"3\"></textarea></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Set Keywords<input type=\"checkbox\" name=\"to_update[]\" value=\"set_keyword\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<textarea wrap=\"soft\" name=\"set_keyword\" title=\"Keywords, separated by semicolons\" rows=\"3\"></textarea></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Clear Keywords<input type=\"checkbox\" name=\"to_update[]\" value=\"clear_keyword\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<textarea wrap=\"soft\" name=\"clear_keyword\" title=\"Keywords, separated by semicolons\" rows=\"3\"></textarea></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Headline<input type=\"checkbox\" name=\"to_update[]\" value=\"set_headline\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<textarea wrap=\"soft\" name=\"set_headline\" rows=\"2\"></textarea></td></tr>\n";
@ -267,7 +276,7 @@ function display_bulk_update($database, $my_user_id, $url, $rule_identifier) {
print "<textarea wrap=\"soft\" name=\"set_caption\" rows=\"7\"></textarea></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Category<input type=\"checkbox\" name=\"to_update[]\" value=\"set_category\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<input type=\"text\" name=\"set_category\" size=\"3\" title=\"Category\" value=\"\"></td></tr>\n";
print "<input type=\"text\" name=\"set_category\" size=\"3\" title=\"Category\" value=\"\"/></td></tr>\n";
print "<tr><td align=\"right\" bgcolor=\"$color[table_header]\" width=\"25%\">Supplemental Category<input type=\"checkbox\" name=\"to_update[]\" value=\"set_supplemental_category\"/></td><td align=\"left\" bgcolor=\"$color[table_body]\" >";
print "<textarea wrap=\"soft\" name=\"set_supplemental_category\" rows=\"7\"></textarea></td></tr>\n";
@ -391,23 +400,23 @@ function display_bulk_update($database, $my_user_id, $url, $rule_identifier) {
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.submit.gif\" name=\"operator\" value=\"submit\">";
print "<input type=\"image\" src=\"$theme/button.submit.gif\" name=\"operator\" value=\"submit\"/>";
print "</form>\n";
}
function display_shop_item_generator($database, $my_user_id) {
function display_shop_item_generator($database, $user_id) {
global $style;
global $color;
global $theme;
print "<script language=\"JavaScript\" type=\"text/javascript\" src=\"javascript/select.js\"></script>";
$users_folder = pg_query($database, "select identifier, caption, parent_folder from folder where users=$my_user_id[0] and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$users_folder = pg_query($database, "select identifier, caption, parent_folder from folder where users=$user_id and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$all_user_rules = pg_query($database, "
select identifier, shop_category, shop_item, currency, price, comment, date_of_creation, date_of_last_edit
from view_shop_item_generator_rule
where users=$my_user_id[0]");
where users=$user_id");
print "&nbsp;<br />";
@ -439,7 +448,7 @@ function display_shop_item_generator($database, $my_user_id) {
for ($f=0; $f < pg_num_rows($all_user_rules); $f++) {
$rules = pg_fetch_row($all_user_rules, $f);
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"checkbox\" name=\"rule$rules[0]\" value=\"$rules[0]\" onClick=\"sig_uncheck_del();\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\"><input type=\"checkbox\" name=\"rule$rules[0]\" value=\"$rules[0]\" onClick=\"sig_uncheck_del();\"/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\">$rules[1]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\">$rules[2]</td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_body]\">$rules[3]</td>\n";
@ -450,24 +459,24 @@ function display_shop_item_generator($database, $my_user_id) {
print "</tr>\n";
}
print "<tr>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\"><input type=\"checkbox\" name=\"delete_all\" value=\"yes\" onClick=\"sig_uncheck_create();\"></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\"><input type=\"checkbox\" name=\"delete_all\" value=\"yes\" onClick=\"sig_uncheck_create();\"/></td>\n";
print "<td align=\"left\" bgcolor=\"$color[table_header]\" colspan=\"7\">Remove all shop items in the specified folder.</td>\n";
print "</tr>\n";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<input type=\"image\" src=\"$theme/button.submit.gif\" border=\"0\" name=\"operator\" value=\"submit\">\n";
print "<input type=\"image\" src=\"$theme/button.submit.gif\" border=\"0\" name=\"operator\" value=\"submit\"/>\n";
print "</form>\n";
print "&nbsp;<br/>\n";
}
function display_content_indexer($database, $my_user_id, $url, $session_id) {
function display_content_indexer($database, $user_id, $url, $session_id) {
global $style;
global $color;
global $theme;
$users_folder = pg_query($database, "select identifier, caption, parent_folder from folder where users=$my_user_id[0] and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
$users_folder = pg_query($database, "select identifier, caption, parent_folder from folder where users=$user_id and caption!='Trash' and caption!='Orphanage' order by date_of_creation desc");
print "&nbsp;<br />";
@ -489,7 +498,7 @@ function display_content_indexer($database, $my_user_id, $url, $session_id) {
print "</td></tr>";
print "</table>\n";
print "&nbsp;<br/>\n";
print "<input type=\"image\" src=\"$theme/button.submit.gif\" border=\"0\" name=\"operator\" value=\"submit\">\n";
print "<input type=\"image\" src=\"$theme/button.submit.gif\" border=\"0\" name=\"operator\" value=\"submit\"/>\n";
print "</form>\n";
print "&nbsp;<br/>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -35,10 +35,20 @@ $client_status = array("pending" => 1,
"accepted" => 2,
"rejectetd" => 3);
/* Initial default value for the userid array -- do not change! */
$po_user = array("id" => FALSE,
"type" => $user_type['disabled'],
"session" => FALSE,
"prefs" => FALSE,
"username" => FALSE,
"first_name" => FALSE,
"last_name" => FALSE);
/* do not change these values! */
$icc_profiles = array("1" => array("name" => "sRGB", "file" => $site_url . "/im/sRGB.icm"),
"2" => array("name" => "Adobe RGB 1998", "file" => $site_url . "/im/AdobeRGB1998.icc"),
"3" => array("name" => "Nikon Base NEF", "file" => $site_url . "/im/NKDBase_NEF.icm"),
$realpath = dirname($_SERVER['SCRIPT_FILENAME']) . "/im" ;
$icc_profiles = array("1" => array("name" => "sRGB", "file" => $realpath . "/sRGB.icm"),
"2" => array("name" => "Adobe RGB 1998", "file" => $realpath. "/AdobeRGB1998.icc"),
"3" => array("name" => "Nikon Base NEF", "file" => $realpath . "/NKDBase_NEF.icm"),
"99" => array("name" => "Embedded", "file" => ""));
if (!function_exists('substr_compare')) {

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -29,9 +29,12 @@ if (get_magic_quotes_gpc())
if (get_magic_quotes_runtime())
$rquotes = 1;
?>
$database = site_prolog();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<html>
<head profile="http://www.k-i-s.net/xmpo/1">
<title>Photo Organizer Demonstration page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
@ -52,34 +55,17 @@ if (get_magic_quotes_runtime())
<tr><td width="25%" align="left" valign="top" colspan="2">
<p>&nbsp;</p>
<h3>New features and bug fixes in the 2.32.A Release</h3>
<ul>
<li>Don't display trash and orphanage folders if they're empty.</li>
<li>Don't let EXIF data overwrite XML-specified image titles</li>
<li>We were inadvertantly striping the time (HH:MM) off of images when editing them</li>
<li>If we fail to copy an image to the repository, don't try to process it further.</li>
<li>Eliminate references to <i>jpegtran</i> as it's obselete</li>
<li>Support <i>ExifTool</i> for purposes of EXIF extraction</li>
<li>Site configuration is now kept in a separate file</li>
<li>Convert focal length and aperture to numeric types in the database</li>
<li>Properly detect Canon CR2 RAW files</li>
<li>Code cleanups in the RAW import code</li>
<li>Minor code tweaks</li>
<li>Support dcraw v8.18+</li>
<li>Bulk update overhauled, much more usable now</li>
<li>Automagically detect and try to turn off magic_quotes</li>
<li>Installer rewritten. Its now web-based, and considerably nicer and
much less brittle</li>
</ul>
<h3>Welcome to the Photo Organizer demo/test site!</h3>
</p><p>
Don't forget that the entire content of this page is customizable. You can
create your own layout with basic HTML and PHP skills. Log in as the
administrator and click on the Front Page selector in the Admin tab to visit
the <a href="admin.php?selector=4">Front Page Editor</a>.
</p><p>
The Photo Organizer PHP tags are described in the <a href="help.php?help=12">Front Page</a>'s help section.
</p>
<p>This site is running a current snapshot of the code that will make it into the <i>next</i> release of Photo Organizer.</p>
<p>As this is a moving target, if something doesn't appear to work, please file a <a href="http://bugs.shaftnet.org">bug ticket</a>.</p>
<p>For more information about Photo Orzanizer's features and releases, see the <a href="http://po.shaftnet.org/">Photo Organizer web site</a>.</p>
<p>Nearly all features are enabled. Feel free to create an account, upload some photos, and generally get a feel for how Photo Organizer works.</p>
<p>Please note that inactive accounts will be periodically deleted; this particular installation is for QA/testing, demonstration, and evaluatition only.</p>
</td></tr>
</table>

View File

@ -16,7 +16,7 @@ include_once "$theme/theme.php";
<body>
<table width="<?php echo $page_width ?>" align="center" cellspacing="0" cellpadding="0">
<tr><td><?php site_logo("left"); ?></td></tr>
<tr><td><?php site_navigator(1, 1); ?></td></tr>
<tr><td><?php site_navigator(1); ?></td></tr>
<tr><td><?php site_navigator_status("Welcome to Photo Organizer", "It's awesome"); ?></td></tr>
<tr><td>

View File

@ -112,6 +112,10 @@ $versions = array("(none)" =>
"2.31" =>
array("db_file" => "po.db.02.31.to.02.32.sql",
"dat_file" => "po.data.02.31.to.02.32.sql"),
"2.32" =>
array("db_file" => "po.db.02.32.to.02.33.sql",
"dat_file" => "po.data.02.32.to.02.33.sql",
"post" => "po231_232_upgrade"),
);
/* =============================================================== */
@ -276,6 +280,91 @@ function po215_216_createlang($dbh) {
return FALSE;
}
/* iptc and exif stuff storage updated */
function po232_iptc_exif($dbh) {
$trans = array("<tr><td>" => "<key>",
"</td><td>" => "</key><value>",
"</td></tr>\n" => "</value>");
print "<li>Translating EXIF/IPTC data to new format...";
$res = pg_query($dbh, "select identifier, exif, iptc from photo_tech where exif != '' or iptc != ''");
for ($i=0; $i < pg_num_rows($res); $i++) {
$dat = pg_fetch_assoc($res);
$exif = strtr($dat['exif'], $trans);
$iptc = strtr($dat['iptc'], $trans);
if (($exif == $dat['exif']) &&
($iptc == $dat['iptc']))
continue;
$exif = pg_escape_string($exif);
$iptc = pg_escape_string($iptc);
$res2 = pg_query($dbh, "update photo_tech set exif = '$exif', iptc = '$iptc' where identifier = $dat[identifier]");
print " $dat[identifier] ";
if ($res2 == FALSE) {
print "<font color=\"red\">FAILED (# $dat[identifier])</font></li>\n";
return FALSE;
}
}
print "<font color=\"green\">OK</font></li>\n";
return TRUE;
}
/* Migrate to new keyword table layout */
function semi_string_to_array($str){
$expr="/;(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/";
$results=preg_split($expr,trim($str));
return preg_replace("/^\"(.*)\"$/","$1",$results);
}
function space_string_to_array($str){
$expr="/ (?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/";
$results=preg_split($expr,trim($str));
return preg_replace("/^\"(.*)\"$/","$1",$results);
}
function po232_keyword_migrate($dbh) {
print "<li>Moving keyword data into a separate table...";
$res = pg_query($dbh, "select identifier, keyword from photo where keyword != ''");
for ($i=0; $i < pg_num_rows($res); $i++) {
$dat = pg_fetch_assoc($res);
$photo = $dat['identifier'];
if (strstr($dat['keyword'], ";"))
$keywords = semi_string_to_array($dat['keyword']);
else
$keywords = space_string_to_array($dat['keyword']);
foreach ($keywords as $keyword) {
$keyword = strtolower(trim($keyword));
$keyword = trim($keyword, ','); /* Trailing commas */
$keyword = trim($keyword);
if ($keyword == "") continue;
$keyword = pg_escape_string($keyword);
pg_query($dbh, "insert into photo_keywords (photo, keyword) values ($photo, '$keyword')");
}
}
print "<font color=\"green\">OK</font></li>\n";
$res = pg_query($dbh, "alter table photo drop keyword");
return TRUE;
}
function po231_232_upgrade($dbh) {
$res = po232_keyword_migrate($dbh);
if ($res)
$res = po232_iptc_exif($dbh);
return $res;
}
/* =============================================================== */
function po_process_db_file($dbh, $file) {
@ -342,23 +431,16 @@ function po_get_version($dbh) {
/* =============================================================== */
function display_db_form() {
global $db_host;
global $db_port;
global $db_user;
global $db_password;
global $db_name;
global $db_dsn;
global $image_repository_path;
global $site_url;
global $site_title;
print "<h4>Configured Settings: If any of these are incorrect, edit include/site_config.php</h4>\n";
$db_dsn = preg_replace("/password=(.*)/", "password=[hidden]", $db_dsn);
print "<h4>Configured Settings: If any of these are incorrect, edit include/config_site.php</h4>\n";
print "<form method=\"post\" action=\"install.php\">\n";
print "<table>\n";
print "<tr><td>DB Host</td><td>$db_host</td></tr>\n";
print "<tr><td>DB Port</td><td>$db_port</td></tr>\n";
print "<tr><td>DB Username</td><td>$db_user</td></tr>\n";
print "<tr><td>DB Password</td><td>********</td></tr>\n";
print "<tr><td>DB Name</td><td>$db_name</td></tr>\n";
print "<tr><td>Database Connection<br/>String</td><td>$db_dsn</td></tr>\n";
print "<tr><td>Site URL</td><td>$site_url</td></tr>\n";
print "<tr><td>Site Title</td><td>$site_title</td></tr>\n";
print "<tr><td>Image Repository</td><td>$image_repository_path</td></tr>\n";
@ -370,11 +452,8 @@ function display_db_form() {
/* =============================================================== */
$db_host = "127.0.0.1";
$db_port = "5432";
$db_name = "po_db";
$db_user = "po_user";
$db_password = "none";
$db_dsn = "host=localhost port=5432 dbname=po_db user=po_user password=password";
$image_repository_path = "/export/po_dev_image_repository";
$site_url = "http://localhost/po";
$site_title = "My Photo Organizer";
@ -398,14 +477,19 @@ print "<h3>Photo Organizer Installation/Update Utility</h3>";
/* Sanity Checks */
if (!is_readable("include/config_site.php")) {
print "<h4>Please create include/config_site.php with your site settings! (see installation instructions)</h4>\n";
print "<h4><font color=\"red\">Please copy include/config_site.php.dist to include/config_site.php and modify it with your site settings! (see installation instructions)</font></h4>\n";
$go = 0;
}
include "include/config.php"; /* Use configured defaults, if possible */
if (!$install_enabled) {
print "<h3><font color=\"red\">Install disabled. please set \$install_enabled=1 in config_site.php if you wish to run the installer.</font></h3>\n";
exit(0);
}
if (!$image_repository_path || !is_writable($image_repository_path)) {
print "<h4>Image Repository Path '$image_repository_path' not present or not writable by webserver. Please correct.</h4>\n";
print "<h4><font color\"red\">The image repository '$image_repository_path' not present or not writable by webserver. Please ensure the <i>\$image_repository_path</i> setting points to a valid directory.</font></h4>\n";
$go = 0;
}
@ -422,57 +506,80 @@ if (get_magic_quotes_runtime()) {
}
if( ini_get('safe_mode') ) {
print "<h4>PHP's <i>safe mode</i> is enabled. Photo Organzier will not currently work with safe mode enabled. Please disable it in <i>php.ini</i> before continuing.</h4>\n";
print "<h4><font color=\"red\">PHP's <i>safe mode</i> is enabled. Photo Organzier will not currently work with safe mode enabled. Please disable it in <i>php.ini</i> before continuing.</font></h4>\n";
$go = 0;
}
if( ini_get('display_errors') ) {
print "<h4><font color=\"red\">PHP's <i>display_errors</i> option is enabled. As Photo Organzier currently tends to generate a pile of log warnings, this will break many of PO's pages. Additionally, due to security reasons it is a bad idea to leave this enabled on a production site.</font></h4>\n";
$go = 0;
}
if( ! ini_get('file_uploads') ) {
print "<h4>PHP's <i>file_uploads</i> feature is disabled. As you cannot upload images with this enabled, you'll probably want to enable it in <i>php.ini</i>.</h4>\n";
print "<h4><font color=\"red\">PHP's <i>file_uploads</i> feature is disabled. As non-administrators cannot upload images with this enabled, you'll probably want to enable it in <i>php.ini</i>.</font></h4>\n";
}
$filesize = ini_get("upload_max_filesize");
$postsize = ini_get("post_max_size");
$memlimit = ini_get("memory_limit");
if ($filesize > $postsize) $filesize = $postsize;
print "<h4>Current max upload file size is $filesize. You may need to increase this.</h4>\n";
print "<h4>Note: The current maximum upload file size is $filesize. You may need to increase this. See the <i>upload_max_filesize</i> and <i>post_max_size</i> settings in your <i>php.ini</i> file.</h4>\n";
if ($memlimit != "")
print "<h4>Note: The current memory limit is $memlimit. You may need to increase this. See the <i>memory_limit</i> setting in your <i>php.ini</i> file.</h4>\n";
/* Now test for installed extensions */
if (!extension_loaded("pgsql")) {
print "<h4>PHP's PostgreSQL extension not installed or enabled. Please correct.</h4>\n";
print "<h4><font color\"red\">PHP's PostgreSQL extension is not installed or enabled. The <i>pgsql</i> extension is required.</font></h4>\n";
$go = 0;
}
if (!function_exists("bccomp")) {
print "<h4>PHP's BC Math routines not installed or enabled. Please correct.</h4>\n";
print "<h4><font color=\"red\">PHP's BC Math routines are not installed or enabled. The <i>bccomp</i> extension is required.</font></h4>\n";
$go = 0;
}
/* Test external utilities */
if (!is_executable($sys_convert)) {
print "<h4>ImageMagick <i>convert</i> utility not installed at $sys_convert. Please correct.</h4>\n";
print "<h4><font color=\"red\">ImageMagick's <i>convert</i> utility is not installed at $sys_convert. This utility is required, so please insure it is installed, and that the <i>\$sys_convert</i> setting is correct.</font></h4>\n";
$go = 0;
}
if (!is_executable($sys_composite)) {
print "<h4>ImageMagick <i>composite</i> utility not installed at $sys_composite. Please correct.</h4>\n";
print "<h4><font color=\"red\">ImageMagick's <i>composite</i> utility is not installed at $sys_composite. This utility is required, so please insure it is installed, and that the <i>\$sys_composite</i> setting is correct.</font></h4>\n";
$go = 0;
}
if (!is_executable($sys_exiftool)) {
print "<h4><i>ExifTool</i> utility not installed at $sys_exiftool. Please correct if you wish to use it for EXIF Processing.</h4>\n";
print "<h4>ExifTool's <i>exiftool</i> utility is not installed at $sys_exiftool. This tool is optional, but we recommend its use for decoding image metadata. If it is installed, please enxure the <i>\$sys_exif</i> setting is correct.</h4>\n";
}
if (!is_executable($sys_dcraw)) {
print "<h4><i>dcraw</i> utility not installed at $sys_dcraw. Please correct if you wish to work with RAW images.</h4>\n";
print "<h4>The <i>dcraw</i> utility is not installed at $sys_dcraw. This tool is required if you wish to work with RAW images, although ExifTool can be used in some circumstances. If it is installed, please ensure the <i>\$sys_dcraw</i> setting is correct.</h4>\n";
}
if (!is_executable($sys_ps2pdf)) {
print "<h4><i>ps2pdf</i> utility not installed at $sys_ps2pdf. Please correct if you wish to export to PDF.</h4>\n";
print "<h4>The <i>ps2pdf</i> utility is not installed at $sys_ps2pdf. Without this tool you cannot export to PDF. If it is installed, please ensure the <i>\$sys_ps2pdf</i> setting is correct.</h4>\n";
}
if (!is_executable($sys_tar)) {
print "<h4><i>tar</i> utility not installed at $sys_tar. Please correct if you wish to import or export .tar files.</h4>\n";
print "<h4>The <i>tar</i> utility is not installed at $sys_tar. Without this tool you cannot import .tar archives, or export images at all. If it is installed, please ensure the <i>\$sys_tar</i> setting is correct.</h4>\n";
}
if (!is_executable($sys_unzip)) {
print "<h4><i>unzip</i> utility not installed at $sys_unzip. Please correct if you wish to import .zip files.</h4>\n";
print "<h4>The <i>unzip</i> utility is not installed at $sys_unzip. Without this tool you cannot import .zip archives. If it is installed, please ensure the <i>\$sys_unzip</i> setting is correct.</h4>\n";
}
if (isset($db_host)) {
print "<h4><font color=\"red\">Photo Organizer 2.33 changed its database configuration mechanism. You will need to specify this new connection in <i>config_site.php</i> before the upgrade can continue.</font></h4>\n";
print "<blockquote>\n";
print "<h4>Please add the following line to your <i>config_site.php</i> file. For additional examples of database configuration, see <i>config.php</i> for additional examples.</h4>\n";
print "<pre>\$db_dsn = \"host=$db_host port=$db_port dbname=$db_name user=$db_user password=$db_password\";</pre>\n";
print "<h4>Additionally, you will need to erase the \$db_host, \$db_port, \$db_name, \$db_user, and \$db_password settings.</h4>\n";
print "</blockquote>\n";
$go = 0;
}
/* =============================================================== */
/* Kick things off */
@ -483,8 +590,7 @@ if (!$go) {
exit(0);
}
$db_connection = "host=" . $db_host . " port=" . $db_port . " dbname=" . $db_name . " user=" . $db_user . " password=" . $db_password;
$dbh = pg_connect($db_connection);
$dbh = pg_connect($db_dsn);
if ($dbh === FALSE) {
print "<h3>Database connection failed; Are credentials valid?</h3>";
@ -557,7 +663,7 @@ while ($res) {
}
if ($res === TRUE) {
print "<h3> Install/Upgrade to version $version complete.</h3>\n";
print "<h3> IMPORTANT: remove install.php!</h3>\n";
print "<h3><font color=\"red\" IMPORTANT: Set \$install_enabled=0 in config_site.php to disable installer.</font></h3>\n";
} else {
print "</ul>\n";
print "<h3> Correct the above errors, and try again. We will pick up where we left off.</h3>\n";

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,36 +22,27 @@ include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
if ($my_user_id[0] == "") {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
}
$label_name = pg_escape_string($_REQUEST['label_name']);
$manufacturer = $_REQUEST['manufacturer'];
$paper = $_REQUEST['paper'];
$left_margin = $_REQUEST['left_margin'];
$top_margin = $_REQUEST['top_margin'];
$x_space = $_REQUEST['x_space'];
$y_space = $_REQUEST['y_space'];
$x_size = $_REQUEST['x_size'];
$y_size = $_REQUEST['y_size'];
$columns = $_REQUEST['columns'];
$rows = $_REQUEST['rows'];
$manufacturer = pg_escape_string($_REQUEST['manufacturer']);
$paper = pg_escape_string($_REQUEST['paper']);
$left_margin = pg_escape_string($_REQUEST['left_margin']);
$top_margin = pg_escape_string($_REQUEST['top_margin']);
$x_space = pg_escape_string($_REQUEST['x_space']);
$y_space = pg_escape_string($_REQUEST['y_space']);
$x_size = pg_escape_string($_REQUEST['x_size']);
$y_size = pg_escape_string($_REQUEST['y_size']);
$columns = pg_escape_string($_REQUEST['columns']);
$rows = pg_escape_string($_REQUEST['rows']);
if ($manufacturer == "" || $label_name == "" || $paper == "" || $left_margin == "" ||
$top_margin == "" || $x_space == "" || $y_space == "" || $x_size == "" ||
@ -65,7 +56,7 @@ pg_query($database, "
insert into label (identifier, users, manufacturer, name,
space_x, space_y, size_x, size_y, offset_x, offset_y, columns, rows,
paper, date_of_creation, last_modified_date)
values (nextval('label_id_sequence'), $my_user_id[0], $manufacturer, '$label_name',
values (nextval('label_id_sequence'), $po_user[id], $manufacturer, '$label_name',
$x_space, $y_space, $x_size, $y_size, $left_margin, $top_margin, $columns, $rows,
$paper, now(), now())");

View File

@ -1,7 +1,7 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint-i-s.net)
// Copyright (C) 2005-2006 Solomon Peachy (pizza.org)
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2006 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
@ -22,20 +22,11 @@ include_once "include/config.php";
include_once "include/profile.php";
include_once "include/site.php";
include_once "$theme/theme.php";
$session_id = $_COOKIE[$po_cookie];
if ($session_id == "") {
header("location: login.php");
exit();
}
include_once "include/common.php";
include_once "include/site.php";
include_once "include/profile.php";
$database = site_prolog();
$my_user_id = pg_fetch_row(pg_query($database, "select identifier, type from users where session_id='$session_id'"));
if ($my_user_id[1] < $user_type['user']) {
if ($po_user['type'] < $user_type['user']) {
site_epilog($database);
header("location: login.php");
exit();
@ -54,7 +45,7 @@ $columns = $_REQUEST['columns'];
$rows = $_REQUEST['rows'];
site_header($page_width, "Add Label");
site_navigator(6, $my_user_id[1]);
site_navigator(6);
site_navigator_status("<a href=\"user.php\">Users</a> : <a href=\"my.profile.php?\">My Profile</a> : Add new label", "");
$all_manufacturers = pg_query($database, "select identifier, name from manufacturer order by name");
@ -75,7 +66,7 @@ print "<td align=\"left\" bgcolor=\"$color[table_header]\" width=\"30%\">Paper<
print "</tr>";
print "<tr>";
print "<td bgcolor=\"$color[table_body]\" width=\"30%\">"; display_combo("manufacturer", $all_manufacturers, $manufacturer, ", ", 0); print"</td>\n";
print "<td bgcolor=\"$color[table_body]\" width=\"40%\"><input type=\"text\" name=\"label_name\" value=\"$label_name\" size=\"40%\"></td>\n";
print "<td bgcolor=\"$color[table_body]\" width=\"40%\"><input type=\"text\" name=\"label_name\" value=\"$label_name\" size=\"40%\"/></td>\n";
print "<td bgcolor=\"$color[table_body]\" width=\"30%\">"; display_combo("paper", $all_papers, $paper, ", ", 1); print"</td>\n";
print "</tr>";
print "</table>";
@ -84,8 +75,8 @@ print "&nbsp;<br/>";
display_label_layout($left_margin, $top_margin, $x_size, $y_size, $x_space, $y_space, $columns, $rows, FALSE);
print "&nbsp;<br/>";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Label\">";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['label']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"></a>";
print "<input type=\"image\" src=\"$theme/button.add.gif\" border=\"0\" value=\"Add Label\"/>";
print "<a class=\"nodecor\" href=\"my.profile.php?selector=".$profile_data['label']['idx']."\"><img src=\"$theme/button.cancel.gif\" border=\"0\" alt=\"Cancel\"/></a>";
print "</form>";
display_navigator_box_bottom("100%");

Some files were not shown because too many files have changed in this diff Show More