po/src/film.del.php

91 lines
3.5 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/profile.php";
include_once "include/site.php";
include_once "include/common.php";
$type = 'film';
$database = site_prolog(PO_USER_TYPE_USER);
$film_id = pg_escape_string($database, $_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'] != PO_USER_TYPE_ADMIN) {
$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_referer_error('not_owner');
site_epilog($database);
exit();
}
}
site_header(sprintf($strings['profile_delete'], $strings['generic_'.$type]));
site_navigator(6);
site_navigator_status(emit_a(generate_link('user', ''), $strings['generic_users'])." : ".emit_a("my.profile.php", $strings['generic_my_profile'])." : ".sprintf($strings['profile_delete'], $strings['generic_'.$type]), "");
theme_display_navigator_box_top($profile_data['film']['idx'], $profile_data, "100%");
print "<form method=\"post\" action=\"profile.del.php\" accept-charset=\"".$strings['formats_encoding']."\">";
print "<input type=\"hidden\" name=\"type\" value=\"$type\">";
print "<input type=\"hidden\" name=\"go\" value=\"old\"/>\n";
print "<input type=\"hidden\" name=\"item\" value=\"$film_id\">";
print "<table class=\"profile\">\n";
print "<tr class=\"folder_top\">\n";
print emit_td($strings['generic_delete']." ".$strings['generic_'.$type], 'colspan="6"');
print "<tr>";
print emit_th($strings['profile_manufacturer']);
print emit_th($strings['profile_model']);
print emit_th($strings['generic_iso']);
print emit_th($strings['profile_format']);
print emit_th($strings['generic_access']);
print emit_th($strings['generic_refs']);
print "</tr>";
$film_to_be_removed = pg_fetch_row(pg_query($database, "select name, model, iso, format, url, access_rights
from view_film where identifier='$film_id'"));
print "<tr>";
print "<td><a href=\"$film_to_be_removed[4]\">$film_to_be_removed[0]</a></td>";
print "<td>$film_to_be_removed[1]";
print "<td>$film_to_be_removed[2]</td>";
print "<td>$film_to_be_removed[3]</td>";
print emit_td($strings['generic_'.$access[$film_to_be_removed[5]]]);
print "<td>$number_of_references[0]</td>\n";
print "</tr>";
print "</table>";
if ($number_of_references[0]==0) {
print $thm_elem['button.confirm.delete'];
print $thm_elem['button.cancel'];
} else {
print $thm_elem['button.back'];
}
print "</form>";
theme_display_navigator_box_bottom("100%");
site_footer($database);
site_epilog($database);
?>