po/src/album.del.php

88 lines
3.2 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";
$database = site_prolog(PO_USER_TYPE_CLIENT);
$album_id = pg_escape_string($database, $_REQUEST['album']);
$album_data = pg_fetch_row(pg_query($database, "
select album.identifier, caption, date_of_creation, access_rights, users, parent_album
from album
where album.identifier='$album_id'"));
if (($album_data[4] != $po_user['id']) &&
($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"));
$path_to_album = get_path_to_album($database, $album_id);
site_header($strings['generic_delete_album']);
site_navigator(5);
site_navigator_status(disp_user_string($database, $po_user['id'])." $path_to_album : ".$strings['generic_delete_album'], "");
print "&nbsp;<br/>\n";
print "<table class=\"folder\">\n";
print "<tr>";
print emit_th($strings['generic_photos'], "width=\"5%\"");
print emit_th($strings['generic_subalbums'], "width=\"5%\"");
print emit_th($strings['generic_created'], "width=\"12%\"");
if ($po_user['type'] > PO_USER_TYPE_CLIENT) {
print emit_th($strings['generic_access'], "width=\"10%\"");
}
print "</tr>";
print "<tr>";
print emit_td($album_stats['photos']);
print emit_td($album_stats['albums']);
print emit_td(emit_date_html($album_data[2], 'date'));
if ($po_user['type'] > PO_USER_TYPE_CLIENT) {
print emit_td($strings['generic_'.$access[$album_data[3]]]);
}
print "</tr>";
print "</table>";
print "&nbsp;<br/>\n";
print "<center>\n";
if ($album_stats['albums'] > 0) {
print $thm_elem['button.back'];
} else {
print "<form method=\"post\" action=\"album.del.2.php\" accept-charset=\"".$strings['formats_encoding']."\">";
print "<input type=\"hidden\" name=\"album\" value=\"$album_id\"/>";
print "<input type=\"hidden\" name=\"parent\" value=\"$album_data[5]\"/>";
print "<input type=\"hidden\" name=\"return\" value=\"$_SERVER[HTTP_REFERER]\"/>";
print $thm_elem['button.confirm.delete'];
print $thm_elem['button.cancel'];
print "</form>";
}
print "</center>\n";
print "&nbsp;<br/>\n";
site_footer($database);
site_epilog($database);
?>