po/src/spool.empty.php

47 lines
1.5 KiB
PHP

<?php
// Copyright (C) 2006-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";
$database = site_prolog(PO_USER_TYPE_CLIENT);
if (isset($_SERVER['HTTP_REFERER']))
$referer = $_SERVER['HTTP_REFERER'];
else
$referer = generate_link('user', $po_user['id'], array(), TRUE);
pg_query($database, "begin");
// remove references in spool
$result = pg_query($database, "delete from album_content where album = $po_user[spool_album]");
if (!$result) {
pg_query($database, "rollback");
site_push_error($strings['errors_db_insert_failed']);
site_epilog($database);
header("Location: $referer");
exit();
}
pg_query($database, "commit");
site_epilog($database);
header("Location: $referer");
?>