", i18n::translate('Page only for Administrators');
echo "
\n";
echo "
\n";
print_simple_footer();
exit;
}
?>
name values, starting with the Top Level
// e.g. array(0=>"Top Level", 16=>"England", 19=>"London", 217=>"Westminster");
// NB This function exists in both places.php and places_edit.php
function place_id_to_hierarchy($id) {
global $TBLPREFIX;
$statement=
WT_DB::prepare("SELECT pl_parent_id, pl_place FROM {$TBLPREFIX}placelocation WHERE pl_id=?");
$arr=array();
while ($id!=0) {
$row=$statement->execute(array($id))->fetchOneRow();
$arr=array($id=>$row->pl_place)+$arr;
$id=$row->pl_parent_id;
}
return $arr;
}
// NB This function exists in both places.php and places_edit.php
function getHighestIndex() {
global $TBLPREFIX;
return (int)WT_DB::prepare("SELECT MAX(pl_id) FROM {$TBLPREFIX}placelocation")->fetchOne();
}
$where_am_i=place_id_to_hierarchy($placeid);
$level=count($where_am_i);
if ($action=='addrecord' && WT_USER_IS_ADMIN) {
$statement=
WT_DB::prepare("INSERT INTO {$TBLPREFIX}placelocation (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
if (($_POST['LONG_CONTROL'] == '') || ($_POST['NEW_PLACE_LONG'] == '') || ($_POST['NEW_PLACE_LATI'] == '')) {
$statement->execute(array(getHighestIndex()+1, $placeid, $level, stripLRMRLM($_POST['NEW_PLACE_NAME']), null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
} else {
$statement->execute(array(getHighestIndex()+1, $placeid, $level, stripLRMRLM($_POST['NEW_PLACE_NAME']), $_POST['LONG_CONTROL'][3].$_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3].$_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
}
if ($EDIT_AUTOCLOSE && !WT_DEBUG) {
echo "\n";
}
echo "