ini_set('error_reporting', E_ERROR);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$sr = dirname(dirname(__FILE__));
require($sr . '/top/config/config.inc.php');
include($sr . '/lib/banners.lib.php');
include($sr . '/lib/headers.lib.php');
require($sr . '/lib/string.lib.php');
require($sr . '/lib/mysql.lib.php');
$is_catalog_column = 1;
unset($is_rating_column);
if ($cat_id)
{
$cat_id = substr($cat_id, 0, 4);
$cat_id = intval($cat_id);
}
include('../inc/header.inc.php');
$handler_top = mysqli_connect(TOP_HOST, TOP_DBUSER, TOP_DBPASSWD, TOP_DBNAME);
mysqli_query($handler_top, "SET NAMES utf8");
if (isset($cat_id))
{
$result = mysqli_query($handler_top, "SELECT name FROM catalog WHERE id='" . $cat_id . "'");
$category = mysqli_fetch_array($result);
mysqli_free_result($result);
if (strlen($cat_id) >= 3)
{
$cat = substr($cat_id, 0, 1);
$result = mysqli_query($handler_top, "SELECT name FROM catalog WHERE id='" . $cat . "'");
$category2 = mysqli_fetch_array($result);
mysqli_free_result($result);
}
}
?>
| if ($cat_id) print ""; ?>Каталог ресурсов if ($cat_id) print ""; ?> if ($category2['name']) print " / " . $category2['name'] . ""; ?> if ($category['name']) print " / " . $category['name']; ?> |
if (!isset($cat_id)) include($sr . '/template/catalog.tmpl');
else
{
$result = mysqli_query($handler_top, "SELECT * FROM sites WHERE dir LIKE '" . $cat_id . "%'");
$num = mysqli_num_rows($result);
mysqli_free_result($result);
if ($num)
{
if (strlen($cat_id)<3)
{
$result = mysqli_query($handler_top, "SELECT * FROM catalog WHERE id LIKE '" . $cat_id . "%' AND id<>'" . $cat_id . "'");
$col = mysqli_num_rows($result);
$i=1;
print "| ";
while ($row = mysqli_fetch_array($result))
{
$result2 = mysqli_query($handler_top, "SELECT count(*) FROM sites WHERE accept='1' AND dir='" . $row['id'] . "'");
$count = mysqli_fetch_array($result2);
mysqli_free_result($result2);
print "" . $row['name'] . "";
if ($count[0]) print " (" . $count[0] . ")";
//if ($row['name'] == "прочее") print "...";
if ($i % 4 == 0 && $i) print " | ";
else print " ";
$i++;
}
mysqli_free_result($result);
print " | ";
?>
|
|
| Лучшие 10 ресурсов в данном разделе |
print "";
include($sr . '/catalog/cat.php');
}
else
{
$res1 = mysqli_query($handler_top, "SELECT count(*) FROM `sites` WHERE accept='1' AND dir='" . $cat_id . "'");
$row1 = mysqli_fetch_array($res1);
mysqli_free_result($res1);
$cnt = $row1[0];
$items_per_page = 10;
if ($page) $page--;
listPagesCat();
print " ";
showYandexDirect(1);
include($sr . '/catalog/subcat.php');
print " ";
showYandexDirect(2);
listPagesCat();
}
}
else
{
include($sr . '/template/catalog.tmpl');
}
}
?>
|
|
if (!isset($cat_id) || !$num) { ?>
| Новые сайты в каталоге |
if (!isset($cat_id)) include($sr . '/catalog/show_new.php');
if (!$num)
{
print "Данный раздел каталога не содержит ресурсов.
";
print "Добавить сайт в каталог";
}
?>
|
|
} ?>
include('../inc/footer.inc.php');
function listPagesCat()
{
global $cnt, $items_per_page, $page, $cat_id;
print "| Страницы: | ";
for ($i = 0; $i < ceil($cnt / $items_per_page); $i++)
{
if ($i == $page)
print ' ' . ($i + 1) . ' ';
else
{
if (isset($cat_id))
$csc = "&cat_id=" . $cat_id;
else
$csc = "";
print ' " . ($i + 1) . ' ';
}
}
print " |
";
}
function showYandexDirect($id)
{
?>