55 lines
2.4 KiB
PHP
55 lines
2.4 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";
|
|
|
|
$database = site_prolog(PO_USER_TYPE_USER);
|
|
|
|
$location_name = pg_escape_string($database, $_REQUEST['location_name']);
|
|
$location_city = pg_escape_string($database, $_REQUEST['location_city']);
|
|
$location_state = pg_escape_string($database, $_REQUEST['location_state']);
|
|
$location_country = pg_escape_string($database, $_REQUEST['location_country']);
|
|
$location_latitude = pg_escape_string($database, parse_latitude($_REQUEST['location_latitude']));
|
|
$location_longitude = pg_escape_string($database, parse_latitude($_REQUEST['location_longitude']));
|
|
$location_private = pg_escape_string($database, $_REQUEST['private']);
|
|
|
|
if ($location_latitude == '') {
|
|
$location_latitude = 'null';
|
|
} else {
|
|
$location_latitude = "'$location_latitude'";
|
|
}
|
|
if ($location_longitude == '') {
|
|
$location_longitude = 'null';
|
|
} else {
|
|
$location_longitude = "'$location_longitude'";
|
|
}
|
|
|
|
$result = pg_query($database, "insert into location (identifier, place, state, country, last_modified_date, users, city, latitude, longitude, private)
|
|
values (nextval('location_id_sequence'), '$location_name', $location_state, $location_country, now(), '$po_user[id]', '$location_city', $location_latitude, $location_longitude, '$location_private')");
|
|
if (!$result) {
|
|
site_push_error($strings['errors_db_insert_failed']);
|
|
}
|
|
|
|
site_epilog($database);
|
|
header("Location: my.profile.php?selector=".$profile_data['location']['idx']);
|
|
?>
|