<?php
/***************************************/
/* Maps Manager by gotcha version 1.1 */
/* Copyright 2005 http://nukecoder.com */
/* You MAY NOT copy in whole or in part*/
/* or redistribute map manager without */
/* written consent from the author. */
/* Contact and support can be found at */
/* http://nukecoder.com */
/***************************************/
/* if ( !defined('MODULE_FILE') )
{
die("You can't access this file directly...");
} */
if(!stristr($_SERVER['PHP_SELF'], "modules.php") && !stristr($_SERVER['SCRIPT_NAME'], "modules.php")) {
die ("You can't access this file directly...");
}
@require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
if (!isset($_GET['id'])){
$id = "0";
$cat = _MAIN;
}else{
$id = intval($_GET['id']);
}
$cat = check_html(stripslashes(ereg_replace("_", " ", $cat)), nohtml);
$pagetitle = "- $module_name - $cat";
@include("header.php");
@include("modules/$module_name/functions.php");
//title("$sitename - ". _MAPS);
nav();
if ($id != 0){
$catheadtitle = getparentlink($id, $cat);
title($catheadtitle);
}
$result = $db->sql_query("SELECT * FROM ".$prefix."_mapcat where mainid='$id'");
$num = $db->sql_numrows($result);
if ($num > 0) {
$cr1 = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='c_img'");
list($catimagedir) = $db->sql_fetchrow($cr1);
$cr1a = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='c_thumbw'");
list($cattw) = $db->sql_fetchrow($cr1a);
$cr1b = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='c_thumbh'");
list($catth) = $db->sql_fetchrow($cr1b);
opentable();
echo "\n<!--show categorys -->\n\n"
."<table width='100%' cellpadding='4'>\n";
$i = 0;
while($row = $db->sql_fetchrow($result)) {
$catid = intval($row['id']);
$cattitle = stripslashes($row['title']);
$catdtl = stripslashes($row['details']);
$catimage = stripslashes($row['image']);
$mainid = intval($row['mainid']);
$cattitlett = ereg_replace(" ", "_", $cattitle);
$mapsincat = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_mapmap where cat='$catid'"));
if ($i == 0) {
echo "<tr>\n";
}
echo "<td valign='top' width='50%'>\n"
."<center>\n"
."<a href='modules.php?name=$module_name&cat=$cattitlett&id=$catid'>\n"
."<img src='$catimagedir/$catimage' alt='$cattitle' width='$cattw' height='$catth' border='0'><br>\n"
."$cattitle</a> ($mapsincat)<br><br>\n"
."$catdtl<br><br>\n"
."</center>\n"
."</td>\n";
$i++;
if ($i == 2) {
echo "</tr>\n";
$i = 0;
}
}
if ($i == 1) {
echo "<td> ;;</td>\n"
."</tr>\n";
}
echo "</table>\n";
echo "\n<!--end show categorys -->\n\n";
closetable();
echo "<br>";
}
$page = $_GET['page'];
if(!isset($page)){
$page = 1;
}
$cr2 = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='m_page'");
list($maps_page) = $db->sql_fetchrow($cr2);
$page = intval($page);
$maps_page = trim($maps_page);
$from = intval(($page * $maps_page) - $maps_page);
$result2 = $db->sql_query("SELECT * FROM ".$prefix."_mapmap where cat='$id' ORDER BY 'title' ASC LIMIT $from, $maps_page");
$num2 = $db->sql_numrows($result2);
if ($num2 > 0) {
$cr3 = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='m_img'");
list($mapimagedir) = $db->sql_fetchrow($cr3);
$cr3a = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='m_thumbw'");
list($maptw) = $db->sql_fetchrow($cr3a);
$cr3b = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='m_thumbh'");
list($mapth) = $db->sql_fetchrow($cr3b);
$cr3c = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='a_rate'");
list($allowratings) = $db->sql_fetchrow($cr3c);
$cr3d = $db->sql_query("SELECT mval FROM ".$prefix."_mapconfig where mname='d_limit'");
list($desclimit) = $db->sql_fetchrow($cr3d);
opentable();
echo "<!--show maps-->\n";
echo "<table width='100%' cellpadding='4'>\n";
$n = 0;
while ($row2 = $db->sql_fetchrow($result2)){
$mapid = intval($row2['mapid']);
$maptitle = stripslashes($row2['title']);
$mapdtl = stripslashes($row2['details']);
$mapimage = stripslashes($row2['image']);
$mapfile = stripslashes($row2['mapfile']);
$maphits = intval($row2['hits']);
$filesize = getfilesize(intval($row2['filesize']));
$maptitlett = ereg_replace(" ", "_", $maptitle);
if (strlen($mapdtl) > $desclimit){
$mapdtls = substr($mapdtl, 0, $desclimit)."<br>... ( <a href='modules.php?name=$module_name&file=viewmap&title=$maptitlett&id=$mapid'>"._MORE."</a> )\n";
}else{
$mapdtls = "$mapdtl";
}
if ($mapdtls == ""){
$mapdtls = " ;;";
}
$result = $db->sql_query("SELECT * FROM ".$prefix."_mapvotes where mapid='$mapid'");
$row = $db->sql_fetchrow($result);
$rating = $row['rating'];
$totalvotes = $row['totalvotes'];
if ($n == 0) {
echo "<tr>\n";
}
echo "<td valign='top' width='50%'>\n";
echo "<table width='100%' cellpadding='4' cellspacing='2'>\n"
."<tr>\n"
."<td rowspan='2' width='25%' align='center' valign='top'>\n";
if (!isurl($mapimage)){
echo "<a href='#' title='$maptitle' onClick=\"winname=window.open('$mapimagedir/$mapimage','winname','width=800,height=600,top=50,left=50,status,scrollbars,resizable');\">\n"
."<img src='$mapimagedir/thumb/$mapimage' alt='$maptitle' width='$maptw' height='$mapth' border='0'></a>\n";
}else{
echo "<a href='#' title='$maptitle' onClick=\"winname=window.open('$mapimage','winname','width=800,height=600,top=50,left=50,status,scrollbars,resizable');\">\n"
." <img src='$mapimage' alt='$maptitle' width='$maptw' height='$mapth' border='0'></a>\n";
}
echo "</td>\n"
."<td colspan='2' width='75%' height='10%' valign='top'>\n"
."<font class='title'>»</font> <a href='modules.php?name=$module_name&file=viewmap&title=$maptitlett&id=$mapid' title='"._VIEW." $maptitle'><font class='title'>$maptitle</font></a>\n"
."</td>\n"
."</tr>\n"
."<tr>\n"
."<td colspan='2' width='75%' valign='top'>"
."<blockquote>\n"
."<font class='content'>".ereg_replace("\n", "<br>", $mapdtls)."</font>\n"
."</blockquote>\n"
."</td>\n"
."</tr>\n"
."<tr>\n"
."<td width='25%' align='center' valign='top'>\n";
if ($allowratings == 1){
ratingimg($rating);
if ($totalvotes > 0){
echo "<br>"._TOTALVOTES." -» <strong>$totalvotes</strong>";
}
}else{
echo " ;;";
}
echo "</td>\n"
."<td valign='top'>\n"
.""._FILESIZE." -» <b>$filesize</b><br>\n"
.""._DOWNLOADS." -» <b>$maphits</b>\n"
."</td>\n"
."<td width='40%'>\n";
if (is_admin($admin)){
echo "<form action='".$admin_file.".php' method='post'>\n"
."<input type='hidden' name='op' value='editmap'>\n"
."<input type='hidden' name='id' value='$mapid'>\n"
."<input type='image' src='modules/$module_name/images/minimap.gif' title='"._EDIT." $maptitle' border='0'>\n"
."</form>\n";
}else{
echo " ;;";
}
echo "</td>\n"
."</tr>\n"
."</table>\n"
."<form action='modules.php?name=$module_name&file=downloadmap' method='post'>\n"
."<input type='hidden' name='id' value='$mapid'>\n"
."<center><input type='submit' value='"._DOWNLOAD." $maptitle'></center>\n"
."<br>\n"
."</form>\n"
."<hr noshade color='$bgcolor2'>\n"
."</td>\n";
$n++;
if ($n == 2) {
echo "</tr>\n";
$n = 0;
}
}
if ($n == 1) {
echo "<td>& nbsp;</td>\n"
."</tr>\n";
}
echo "</table>\n";
echo "<!--end show maps-->\n\n";
$result = $db->sql_query("SELECT * FROM ".$prefix."_mapmap where cat='$id'");
$total_results = $db->sql_numrows($result);
$total_pages = ceil($total_results / $maps_page);
if ($total_pages != 1){
echo "<!--page numbering-->\n\n";
echo "<table align='center'>\n"
."<tr>\n";
if($page > 1){
$prev = ($page - 1);
echo "<td valign='top'>\n"
."<a href='modules.php?name=$module_name&cat=".ereg_replace(" ", "_", $cat)."&id=$id&page=$prev'>\n"
."<img src='modules/$module_name/images/left.gif' alt='"._PREV."' border='0'></a> ;; ;;\n"
."</td>\n";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "<td valign='top'>\n"
."<b><i>$i</i></b>\n"
."</td>\n";
}else{
echo "<td valign='top'>\n"
."<a href='modules.php?name=$module_name&cat=".ereg_replace(" ", "_", $cat)."&id=$id&page=$i'><b>$i</b> </a>\n"
."</td>\n";
}
}
if($page < $total_pages){
$next = ($page + 1);
echo "<td valign='top'> ;; ;;\n"
."<a href='modules.php?name=$module_name&cat=".ereg_replace(" ", "_", $cat)."&id=$id&page=$next'>\n"
."<img src='modules/$module_name/images/right.gif' alt='"._NEXT."' border='0'></a>\n"
."</td>\n";
}
echo "</tr>\n"
."</table>\n"
."<!--end page numbering-->\n\n";
}
closetable();
}
if ($num == 0 && $num2 == 0) {
opentable();
echo "<center>"._NOCATDATA."<br><br>"._GOBACK."<center>\n";
closetable();
}
@include("footer.php");
?> |