63 lines
2.5 KiB
PHP
63 lines
2.5 KiB
PHP
<?php
|
|
|
|
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
|
|
// Copyright (C) 2005-2019 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";
|
|
|
|
function add_film($database, $user_id, $film_type_id, $film_manufacturer_id,
|
|
$film_model, $film_iso, $film_format_id, $film_access_rights) {
|
|
$film_model = pg_escape_string($database, $film_model);
|
|
$result = TRUE;
|
|
|
|
pg_query($database, "begin");
|
|
|
|
if ($film_type_id=='custom') {
|
|
$new_film_type_id = pg_fetch_row(pg_query($database, "select nextval('film_type_id_sequence')"));
|
|
$film_type_id = $new_film_type_id[0];
|
|
$result = pg_query($database, "insert into film_type (identifier, manufacturer, model, iso, format, last_modified_date, last_modifying_users)
|
|
values ('$film_type_id', '$film_manufacturer_id', '$film_model', '$film_iso', '$film_format_id', now(), $user_id)");
|
|
}
|
|
|
|
$result = pg_query($database, "insert into film (identifier, type, users, access_rights)
|
|
values (nextval('film_id_sequence'), '$film_type_id', '$user_id', '$film_access_rights')");
|
|
|
|
if ($result) {
|
|
pg_query($database, "commit");
|
|
} else {
|
|
site_push_error($strings['errors_db_insert_failed']);
|
|
}
|
|
}
|
|
|
|
$database = site_prolog(PO_USER_TYPE_USER);
|
|
|
|
add_film($database,
|
|
$po_user['id'],
|
|
pg_escape_string($database, $_REQUEST['film_type_id']),
|
|
pg_escape_string($database, $_REQUEST['film_manufacturer_id']),
|
|
pg_escape_string($database, $_REQUEST['film_model']),
|
|
pg_escape_string($database, $_REQUEST['film_iso']),
|
|
pg_escape_string($database, $_REQUEST['film_format_id']),
|
|
pg_escape_string($database, $_REQUEST['film_access_rights']));
|
|
|
|
site_epilog($database);
|
|
header("Location: my.profile.php?selector=".$profile_data['film']['idx']);
|
|
?>
|