/*
LibreSSL - CAcert web application
Copyright (C) 2004-2008 CAcert Inc.
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; version 2 of the License.
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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ ?>
$town = array_key_exists('town',$_REQUEST)?mysql_escape_string(stripslashes($_REQUEST['town'])):"";
$regid = array_key_exists('regid',$_REQUEST)?intval($_REQUEST['regid']):0;
$ccid = array_key_exists('ccid',$_REQUEST)?intval($_REQUEST['ccid']):0;
$start = array_key_exists('start',$_REQUEST)?intval($_REQUEST['start']):0;
$limit = 25;
echo "
\n- ";
echo ""._("Home")."\n";
$display = "";
if($regid > 0)
{
$reg = mysql_fetch_assoc(mysql_query("select * from `regions` where `id`='$regid'"));
$display = "
\n- \n".
"".sanitizeHTML($reg[name])." - "._("Add")."\n".
$display;
$ccid = $_REQUEST['ccid'] = intval($reg['ccid']);
}
if($ccid > 0)
{
$cnt = mysql_fetch_assoc(mysql_query("select * from `countries` where `id`='$ccid'"));
$display = "
\n
\n";
} elseif($regid <= 0) {
echo "\n\n\n\n\n
\n";
} elseif(intval(array_key_exists('locid',$_REQUEST)?$_REQUEST['locid']:0) <= 0) {
echo "\n";
if($town != "")
{
$query = "select * from `locations` where `regid`='$regid' and `name` < '$town'";
$start = mysql_num_rows(mysql_query($query));
}
$query = "select * from `locations` where `regid`='$regid' order by `name` limit $start, $limit";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
echo "- ( "._("move")." |";
echo " "._("aliases")." |";
echo " "._("edit")." |";
echo " "._("delete")." ) ".sanitizeHTML($row['name'])." (".sanitizeHTML($row['lat']).",".sanitizeHTML($row['long']).")
\n";
}
echo "
\n\n\n\n\n
\n";
$st="";$prev="";$end="";$next="";
$rc = mysql_num_rows(mysql_query("select * from `locations` where `regid`='$regid'"));
if($start > 0)
{
$prev = $start - $limit;
if($prev < 0)
$prev = 0;
$st = "[ << "._("Start")." ] ";
$prev = "[ < "._("Previous")." $limit ] ";
}
if($start < $rc - $limit)
{
$next = $start + $limit;
$last = $rc - $limit;
$next = "[ "._("Next")." $limit > ] ";
$end = "[ "._("End")." >> ]";
}
echo "$st
$end
\n";
echo "$prev
$next
\n";
}
?>