po/src/album.edit.php

134 lines
4.7 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/site.php";
include_once "include/common.php";
include_once "include/contacts.php";
include_once "include/orderby.php";
$database = site_prolog(PO_USER_TYPE_CLIENT);
$album_id = pg_escape_string($database, $_REQUEST['album']);
$album_data = pg_fetch_row(pg_query($database, "select caption, date_of_creation, access_rights, description, parent_album, users, password, event, thumb_ver, orderby 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'] != PO_USER_TYPE_ADMIN)) {
site_referer_error('not_owner');
site_epilog($database);
exit();
}
$album_stats = pg_fetch_assoc(pg_query($database, "select count_subalbums_by_album($album_id, $po_user[id], '{".$passwords."}') as albums, count_photos_by_album($album_id, $po_user[id], '{".$passwords."}') as photos"));
$album_all = get_users_album($database);
$path_to_album = get_path_to_album($database, $album_id);
site_header($strings['generic_edit_album']);
site_navigator(5);
site_navigator_status(disp_user_string($database, $po_user['id'])." $path_to_album : ".$strings['generic_edit_album'], "");
print "&nbsp;<br/>\n";
print "<form method=\"post\" action=\"album.edit.2.php\" accept-charset=\"".$strings['formats_encoding']."\">";
print "<input type=\"hidden\" name=\"album\" value=\"$album_id\"/>";
print "<table class=\"listing\">\n";
print "<tr>";
print emit_td($strings['generic_album_name']);
print emit_td("<input id=\"template_editor\" type=\"text\" name=\"album_caption\" value=\"$album_data[0]\"/>");
print "</tr>";
print "<tr>";
print emit_td($strings['generic_description']);
print emit_td("<textarea rows=\"4\" cols=\"80\" name=\"album_description\">$album_data[3]</textarea>");
print "</tr>";
print "<tr>";
print emit_td($strings['generic_parent']);
print "<td>";
print emit_folder_combo("parent", $album_all, $album_data[4], "null");
print "</td>\n";
print "</tr>";
if ($po_user['type'] > PO_USER_TYPE_CLIENT) {
print "<tr>";
print emit_td($strings['generic_access']);
print "<td>";
print emit_access_combo("album_access_rights", $album_data[2], "");
print "</td>\n";
print "</tr>";
} else {
print emit_td("<input type=\"hidden\" name=\"album_access_rights\" value=\"$access[private]\"/>");
}
print "<input type=\"hidden\" name=\"return\" value=\"$_SERVER[HTTP_REFERER]\"/>";
print "<tr>";
print emit_td($strings['generic_password']);
print emit_td("<input type=\"text\" name=\"password\" value=\"$album_data[6]\"/>");
print "</tr>";
print "<tr>";
print emit_td($strings['datebook_event']);
print emit_td(emit_event_combo($database, "event", $po_user['id'], $album_data[7]));
print "</tr>";
print "<tr>";
print emit_td($strings['generic_subalbums']);
print emit_td($album_stats['albums']);
print "</tr>";
print "<tr>";
print emit_td($strings['generic_photos']);
print emit_td($album_stats['photos']);
print "</tr>";
print "<tr>";
print emit_td($strings['generic_created']);
print "<td>".emit_date_html($album_data[1], 'date')."</td>";
print "</tr>";
print "<tr>";
print emit_td($strings['generic_order_by']);
print "<td>";
display_order_by_combo($album_data[9]);
print "</td>";
print "</tr>";
if ($album_data[8]) {
print "<tr>";
print emit_td($strings['generic_keep_thumb']);
print "<td>";
$img = "<img src=\"".generate_link('image', '', array('ver'=>$album_data[8], 'size'=>1)) ."\" alt=\"\" />&nbsp;";
print emit_a(generate_link('photo', '', array('ver'=>$album_data[8])),
$img);
print emit_yes_no_combo("keep_thumb", "t");
print "</td>";
print "</tr>";
} else {
print "<input type=\"hidden\" name=\"keep_thumb\" value=\"f\"/>";
}
print "</table>";
print "&nbsp;<br/>\n";
print "<div align=\"center\">\n";
print $thm_elem['button.save.changes'];
print $thm_elem['button.clear'];
print $thm_elem['button.cancel'];
print "</div>";
print "</form>";
site_footer($database);
site_epilog($database);
?>