po/src/photo.add.php

176 lines
6.4 KiB
PHP

<?php
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2013 Solomon Peachy (pizza@shaftnet.org)
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
include_once "include/config.php";
include_once "include/common.php";
include_once "include/site.php";
include_once "include/import.php";
include_once "include/color.php";
$database = site_prolog(PO_USER_TYPE_USER);
$current_folder = pg_escape_string($database, $_REQUEST['folder']);
$folder = pg_fetch_row(pg_query($database, "select caption from folder where identifier='$current_folder'"));
site_header($strings['import_import_photos']);
site_navigator(5);
$path_to_folder = get_path_to_folder($database, $current_folder);
$user_display_string = disp_user_string($database, $po_user['id']);
site_navigator_status("$user_display_string $path_to_folder : " .$strings['import_import_photos'], "");
print "<div align=\"center\" >\n";
if ($po_options['quota_count'] > 0) {
$num_of_photo_versions = pg_fetch_row(pg_query($database, "select count_photo_versions_by_user($po_user[id])"));
$num_of_photo_versions++;
if ($po_options['quota_count'] <= $num_of_photo_versions[0]) {
print err_str($strings['errors_quota_count_full'] . " ($po_options[quota_count] ".$strings['generic_files'] .")");
print $strings['import_no_more_uploads'];
print "</div>\n";
site_footer($database);
site_epilog($database);
exit();
}
}
if ($po_options['quota_size'] > 0) {
$used_storage_space = count_storage_space_by_user($database, $po_user['id']);
if ($po_options['quota_size'] <= $used_storage_space) {
$storage_quota = round($po_options['quota_size']/1048576, 2);
print err_str($strings['errors_quota_space_full'] . " ($po_options[quota_size] MB)");
print $strings['import_no_more_uploads'];
print "</div>\n";
site_footer($database);
site_epilog($database);
exit();
}
}
if (!ini_get("file_uploads")) {
print err_str($strings['errors_file_upload_disabled']);
print "</div>\n";
site_footer($database);
site_epilog($database);
}
print "<br/>\n";
print "<form name=\"photoAdd\" method=\"post\" action=\"photo.add.2.php\" enctype=\"multipart/form-data\" accept-charset=\"".$strings['formats_encoding']."\">\n";
print "<table class=\"listing\">\n";
print "<tr class=\"folder_top\"><td colspan=\"2\">".$strings['import_file_selector']."</td></tr>\n";
print "<tr><td width=\"25%\">".$strings['import_file']."</td>";
print "<td>";
//print "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".ini_get_size('upload_max_filesize')."\" />";
print "<input type=\"file\" name=\"file_name[]\" alt=\"....\"/>";
if ($po_options['bulk_upload_enable'] == 'f') {
print "&nbsp;&nbsp;<b>".$strings['errors_bulk_upload_disabled']."</b>";
}
$max_size = ini_get("upload_max_filesize");
$ini_size = ini_get("post_max_size");
if ($ini_size < $max_size) {
$max_size = $ini_size;
}
print "&nbsp;&nbsp;".$strings['import_max_size'].": $max_size";
print "</td></tr>";
if ($local_bulk_upload &&
$po_options['local_bulk_upload_path']) {
print emit_tr(emit_td($strings['import_local_bulk_path']) .
emit_td(emit_checkbox_item("local_upload", "foo", "", false). $po_options['local_bulk_upload_path']));
}
print "<tr><td>".$strings['import_folder']."</td><td>";
print emit_folder_combo("folder", get_users_folder($database), $current_folder, "");
print "</td></tr>\n";
print "<tr><td>".$strings['import_metadata']."</td>";
print emit_td(emit_metadata_order_combo('import_metadata_order', $po_options['import_metadata_order']));
print "</td></tr>\n";
print "</table>\n";
print "<br/>\n";
print $thm_elem['button.add.photos'];
print $thm_elem['button.clear'];
print $thm_elem['button.cancel'];
print "<br/>\n";
print "<br/>\n";
print "<table class=\"listing\">\n";
print "<tr class=\"folder_top\"><td colspan=\"2\">".$strings['import_default_props']."</td></tr>\n";
if (!$po_options['copyright_default']) {
$po_options['copyright_default'] = $strings['generic_copyright']." &copy; " . date("Y") . " $po_user[first_name] $po_user[last_name]";
}
if (!$po_options['author_default']) {
$po_options['author_default'] = "$po_user[first_name] $po_user[last_name]";
}
$values = array('copyright' => $po_options['copyright_default'],
'web_statement' => $po_options['web_statement_default'],
'hide_original' => $po_options['hide_originals_default'],
'access_rights' => $po_options['access_default'],
'author' => $po_options['author_default']);
print emit_iptc_form($database, FALSE, $values);
print "<tr><td>".$strings['import_storage_location']."</td><td>";
print emit_storage_location_combo("storage_location_type", "");
print "<input type=\"text\" name=\"storage_location_id\" class=\"storage\" title=\"".$strings['import_storage_location_id']."\" /> -
<input type=\"text\" name=\"storage_index\" class=\"storage\" title=\"".$strings['import_storage_location_index']."\"/> :
<input type=\"text\" name=\"storage_size\" class=\"storage\" title=\"".$strings['import_storage_location_size']."\"/>";
print "</td></tr>\n";
print "</table>\n";
print "<br/>\n";
print $thm_elem['button.add.photos'];
print $thm_elem['button.clear'];
print $thm_elem['button.cancel'];
print "<br/>\n";
print "<br/>\n";
print "<table class=\"listing\">\n";
print "<tr class=\"folder_top\"><td colspan=\"2\">".$strings['import_default_data']."</td></tr>\n";
print emit_photo_tech_form($database, FALSE);
print emit_equipment_form($database, FALSE);
print "<tr><td>".$strings['generic_colorspace']."</td><td>\n";
print emit_colorspace_combo("colorspace", $po_options['colorspace']);
print "</td></tr>\n";
print "</table>\n";
print "<br/>\n";
print $thm_elem['button.add.photos'];
print $thm_elem['button.clear'];
print $thm_elem['button.cancel'];
print "<br/>\n";
print "</form>\n";
print "</div>\n";
site_footer($database);
site_epilog($database);
?>