2005-11-20 08:16:55 +00:00
< ? /*
2008-04-06 19:45:09 +00:00
LibreSSL - CAcert web application
Copyright ( C ) 2004 - 2008 CAcert Inc .
2005-11-20 08:16:55 +00:00
2008-04-06 19:45:09 +00:00
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 .
2005-11-20 08:16:55 +00:00
2008-04-06 19:45:09 +00:00
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 .
2005-11-20 08:16:55 +00:00
2008-04-06 19:45:09 +00:00
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
2005-11-20 08:16:55 +00:00
*/ ?>
< ?
2008-09-19 18:59:35 +00:00
$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 ;
2005-11-20 08:16:55 +00:00
$limit = 25 ;
echo " <div id='listshow'><ul class='top'> \n <li> " ;
echo " <a href='account.php?id=53'> " . _ ( " Home " ) . " </a> \n " ;
$display = " " ;
2006-03-05 11:18:16 +00:00
if ( $regid > 0 )
2005-11-20 08:16:55 +00:00
{
2006-03-05 11:18:16 +00:00
$reg = mysql_fetch_assoc ( mysql_query ( " select * from `regions` where `id`=' $regid ' " ));
2005-11-20 08:16:55 +00:00
$display = " <ul class='top'> \n <li> \n " .
2008-11-23 20:46:54 +00:00
" <a href='account.php?id=53&regid= $regid '> " . sanitizeHTML ( $reg [ name ]) . " </a> - <a href='account.php?action=add&id=54&regid= $regid '> " . _ ( " Add " ) . " </a> \n " .
2005-11-20 08:16:55 +00:00
$display ;
2008-09-03 17:43:31 +00:00
$ccid = $_REQUEST [ 'ccid' ] = intval ( $reg [ 'ccid' ]);
2005-11-20 08:16:55 +00:00
}
2006-03-05 11:18:16 +00:00
if ( $ccid > 0 )
2005-11-20 08:16:55 +00:00
{
2006-03-05 11:18:16 +00:00
$cnt = mysql_fetch_assoc ( mysql_query ( " select * from `countries` where `id`=' $ccid ' " ));
2005-11-20 08:16:55 +00:00
$display = " <ul class='top'> \n <li> \n " .
2008-11-23 20:46:54 +00:00
" <a href='account.php?id=53&ccid= $ccid '> " . sanitizeHTML ( $cnt [ name ]) . " </a> - <a href='account.php?action=add&id=54&ccid= $ccid '> " . _ ( " Add " ) . " </a> \n " .
2005-11-20 08:16:55 +00:00
$display ;
}
if ( $display )
echo $display ;
2006-03-05 11:18:16 +00:00
if ( $ccid <= 0 )
2005-11-20 08:16:55 +00:00
{
echo " <ul> \n " ;
$query = " select * from `countries` order by `name` " ;
$res = mysql_query ( $query );
while ( $row = mysql_fetch_assoc ( $res ))
2008-09-04 11:23:06 +00:00
echo " <li><a href='account.php?id=53&ccid= " . intval ( $row [ 'id' ]) . " '> " . sanitizeHTML ( $row [ 'name' ]) . " </a></li> \n " ;
2005-11-20 08:16:55 +00:00
echo " </ul> \n </li> \n </ul></div> \n <br> \n " ;
2006-03-05 11:18:16 +00:00
} elseif ( $regid <= 0 ) {
2005-11-20 08:16:55 +00:00
echo " <ul> \n " ;
2006-03-05 11:18:16 +00:00
$query = " select * from `regions` where `ccid`=' $ccid ' order by `name` " ;
2005-11-20 08:16:55 +00:00
$res = mysql_query ( $query );
while ( $row = mysql_fetch_assoc ( $res ))
2005-12-04 21:04:05 +00:00
{
2008-11-23 20:46:54 +00:00
echo " <li>( <a href='account.php?action=edit&id=54®id= " . intval ( $row [ 'id' ]) . " '> " . _ ( " edit " ) . " </a> | " ;
2008-09-03 17:43:31 +00:00
echo " <a href='account.php?action=delete&id=53®id= " . intval ( $row [ 'id' ]) . " ' " ;
2008-11-23 20:46:54 +00:00
echo " onclick= \" return confirm(' " . _ ( " Are you sure you want to delete this region and all connected locations? " ) . " '); \" > " . _ ( " delete " ) . " </a> ) " ;
2008-09-03 17:43:31 +00:00
echo " <a href='account.php?id=53&regid= " . intval ( $row [ 'id' ]) . " '> " . sanitizeHTML ( $row [ 'name' ]) . " </a></li> \n " ;
2005-12-04 21:04:05 +00:00
}
2005-11-20 08:16:55 +00:00
echo " </ul> \n </li> \n </ul> \n </li> \n </ul></div> \n <br> \n " ;
2008-09-19 22:39:12 +00:00
} elseif ( intval ( array_key_exists ( 'locid' , $_REQUEST ) ? $_REQUEST [ 'locid' ] : 0 ) <= 0 ) {
2005-11-20 08:16:55 +00:00
echo " <ul> \n " ;
if ( $town != " " )
{
2006-03-05 11:18:16 +00:00
$query = " select * from `locations` where `regid`=' $regid ' and `name` < ' $town ' " ;
2005-11-20 08:16:55 +00:00
$start = mysql_num_rows ( mysql_query ( $query ));
}
2006-03-05 11:18:16 +00:00
$query = " select * from `locations` where `regid`=' $regid ' order by `name` limit $start , $limit " ;
2005-11-20 08:16:55 +00:00
$res = mysql_query ( $query );
while ( $row = mysql_fetch_assoc ( $res ))
2005-12-04 21:04:05 +00:00
{
2008-11-23 20:46:54 +00:00
echo " <li>( <a href='account.php?action=move&id=54&locid= " . intval ( $row [ 'id' ]) . " '> " . _ ( " move " ) . " </a> | " ;
echo " <a href='account.php?action=aliases&id=54&locid= " . intval ( $row [ 'id' ]) . " '> " . _ ( " aliases " ) . " </a> | " ;
echo " <a href='account.php?action=edit&id=54&locid= " . intval ( $row [ 'id' ]) . " '> " . _ ( " edit " ) . " </a> | " ;
2008-09-03 17:43:31 +00:00
echo " <a href='account.php?action=delete&id=53&locid= " . intval ( $row [ 'id' ]) . " ' " ;
2008-11-23 20:46:54 +00:00
echo " onclick= \" return confirm('Are you sure you want to delete this location?'); \" > " . _ ( " delete " ) . " </a> ) " . sanitizeHTML ( $row [ 'name' ]) . " ( " . sanitizeHTML ( $row [ 'lat' ]) . " , " . sanitizeHTML ( $row [ 'long' ]) . " )</li> \n " ;
2005-12-04 21:04:05 +00:00
}
2005-11-20 08:16:55 +00:00
echo " </ul> \n </li> \n </ul> \n </li> \n </ul></div> \n <br> \n " ;
2008-09-19 22:39:12 +00:00
$st = " " ; $prev = " " ; $end = " " ; $next = " " ;
2006-03-05 11:18:16 +00:00
$rc = mysql_num_rows ( mysql_query ( " select * from `locations` where `regid`=' $regid ' " ));
2005-11-20 08:16:55 +00:00
if ( $start > 0 )
{
$prev = $start - $limit ;
if ( $prev < 0 )
$prev = 0 ;
2008-11-23 20:46:54 +00:00
$st = " [ <a href='account.php?id=53&regid= $regid '><< " . _ ( " Start " ) . " </a> ] " ;
$prev = " [ <a href='account.php?id=53&regid= $regid &start= $prev '>< " . _ ( " Previous " ) . " $limit </a> ] " ;
2005-11-20 08:16:55 +00:00
}
if ( $start < $rc - $limit )
{
$next = $start + $limit ;
$last = $rc - $limit ;
2008-11-23 20:46:54 +00:00
$next = " [ <a href='account.php?id=53&regid= $regid &start= $next '> " . _ ( " Next " ) . " $limit ></a> ] " ;
$end = " [ <a href='account.php?id=53&regid= $regid &start= $last '> " . _ ( " End " ) . " >></a> ] " ;
2005-11-20 08:16:55 +00:00
}
echo " <div id='search1'> $st </div><div id='search3'> $end </div> \n " ;
echo " <div id='search2'> $prev </div><div id='search4'> $next </div> \n " ;
2005-12-04 21:04:05 +00:00
}
2005-11-20 08:16:55 +00:00
?>