$conf) { if ($conf["block"]=="0") { $catalogs[$n]["title"]=$conf["caption"]; $catalogs[$n]["address"]=$conf["address"]; $catalogs[$n]["key"]=$key; $n++; } } } else { die("Каталог не подключен к единой админке!"); } } else { if (isset($_SESSION["auth"])) { includeOneAdmin(); if (!empty($config["ftpserver"])) { include($config["base_tmp"]); } else { include($config["ftppath"]); } if (isset($_SESSION["onehost"])) { if (isset($_REQUEST["cat_host"])) { if (isset($baseconfig[$_REQUEST["cat_host"]])) { $changepass=true; $_SESSION["onehost"]=$_REQUEST["cat_host"]; } } } else { $_SESSION["onehost"]=retHostEx(); } $n=0; foreach ($baseconfig as $key=>$conf) { if ($conf["block"]=="0") { $catalogs[$n]["title"]=$conf["caption"]; $catalogs[$n]["address"]=$conf["address"]; $catalogs[$n]["key"]=$key; $n++; } } if (isset($baseconfig[$_SESSION["onehost"]])) { $thiscatalog=$baseconfig[$_SESSION["onehost"]]; $config["db"]["prefix"]=$baseconfig[$_SESSION["onehost"]]["prefix"]; $config["db"]["user"]=$baseconfig[$_SESSION["onehost"]]["user"]; $config["db"]["password"]=$baseconfig[$_SESSION["onehost"]]["password"]; $config["db"]["host"]=$baseconfig[$_SESSION["onehost"]]["host"]; $config["db"]["dbname"]=$baseconfig[$_SESSION["onehost"]]["dbname"]; $config["secretkey"]=$baseconfig[$_SESSION["onehost"]]["secretkey"]; if (isset($baseconfig[$_SESSION["onehost"]]["serial"])) { if (!empty($baseconfig[$_SESSION["onehost"]]["serial"])) { $config["serial"]=$baseconfig[$_SESSION["onehost"]]["serial"]; } } if (!isset($othercatalog)) $is_remote=false; } else { $is_remote=true; } } } //подключаемся к базе данных if (!is_file($config["modules"]["db"])) die("not found database"); require($config["modules"]["db"]); $db=new Db($is_remote); $db->config=$config; $db->SQLConnect(); $db->setPrefix(); initializeSmarty($smarty); $smarty->assign("root",$httproot); $smarty->assign("imgpath",$imgpath); $smarty->assign("host",$host); $smarty->assign("version",$config["version"]); $smarty->assign("catalogs",@$catalogs); $smarty->assign("thiscatalog",@$thiscatalog); $smarty->assign("fckpath",$_SESSION["fckpath"]); require($config["modules"]["structure"]); $settings=getSettings(); $structure=new structure(trim($config["serial"]),trim($settings["mailadmin"]),$is_remote); $structure->config=$config; $structure->db=$db; $structure->smarty=$smarty; $_SESSION["use_xss"]=$config["use_xss"]; $cats=@$_REQUEST["cats"]; $keys=@$_REQUEST["keys"]; //подключаем языковые файлы if (!is_file($config["lang_path"].$settings["theme"]."/".$config["lang"]["user"])) die("couldn't find user lang file"); if (!is_file($config["lang_path"].$settings["theme"]."/".$config["lang"]["admin"])) die("couldn't find admin lang file"); include($config["lang_path"].$settings["theme"]."/".$config["lang"]["user"]); include($config["lang_path"].$settings["theme"]."/".$config["lang"]["admin"]); $settings["day"]=date("d"); $settings["month"]=date("m"); $settings["year"]=date("Y"); $settings["hour"]=date("H"); $settings["minute"]=date("i"); $settings["second"]=date("s"); $settings["root"]=$root; $settings["httproot"]=$httproot; if (isset($thiscatalog)) { $settings["real_httproot"]=@$thiscatalog["address"]; } else { $settings["real_httproot"]=$httproot; } $mailsend=explode("@",$settings["mailsend"]); $smarty->assign("mailsend",$mailsend); if ($changepass) { $_SESSION["login"]=$settings["login"]; $_SESSION["password"]=$settings["password"]; } $structure->settings=$settings; $metatags=@$settings["metatags"]; $metakeywords=@$settings["metakeywords"]; $titletag=@$settings["titletag"]; /*авторизация пользователя*/ $catuser=$structure->authorizeMe(); /*конец авторизации пользователя*/ /*проверка на бан*/ if ($structure->checkIpToBan(getIp(),@$settings["ban_users"])) die("Your IP address is banned by catalogue administrator!"); /*конец проверки на бан*/ $smarty->assign("metatags",$metatags); $smarty->assign("titletag",$titletag); $smarty->assign("settings",$settings); $smarty->assign("userlang",$userlang); $smarty->assign("lang",$lang); $smarty->assign("config",$config); $content_pth="themes/".$settings["theme"]; $smarty->Assign("content_pth",$content_pth); if ($settings["nostatistic"]==0) { $linksinfo=$structure->getLinksInformation(); $smarty->assign("linksinfo",$linksinfo); $statsinfo=$structure->getStatsInformation(); $smarty->assign("statsinfo",$statsinfo); $commentsinfo=$structure->getCommentsInformation(); $smarty->assign("commentsinfo",$commentsinfo); $postsinfo=$structure->getPostsInformation(); $smarty->assign("postsinfo",$postsinfo); $firmsinfo=$structure->getFirmsInformation(); $smarty->assign("firmsinfo",$firmsinfo); } $content_pth.="/"; $id=@$_REQUEST["id"]; $id=str_replace("/","",$id); if (empty($id)) $rubr="index"; if (!eregi("^[a-zA-Z0-9]{1,}$",$id)) { $rubr="index"; if ($settings["showdefault"]==1) $id="stat"; if ($settings["showdefault"]==2) $id="posters"; if ($settings["showdefault"]==3) $id="firms"; if ($settings["showdefault"]==4) $id="page"; } /*themes*/ if ($id!="admin") { if (is_file($config["smarty"]["templatedir"]."themes/".$settings["theme"]."/description.mod.php")) { include($config["smarty"]["templatedir"]."themes/".$settings["theme"]."/description.mod.php"); $config["mainpage"]=$main_page; $config["vote"]=$vote; } else { $config["mainpage"]="Главная страница"; $config["vote"]="Ваш голос учтен!"; } } /*themes*/ switch ($id) { case "admin": $rubr="admin"; break; case "export": $rubr="export"; $id2=@$_REQUEST["id2"]; header("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT"); header ('Content-Type: text/xml; charset=windows-1251'); echo "\n"; echo " ".$settings["title"]." $httproot $httproot ".date("r").""; switch ($id2) { case "last_posts": $objects_xml=$structure->getLastPosts($settings["showpostsnum"],false); $xml_type="posts"; break; case "last_firms": $objects_xml=$structure->getLastFirms($settings["showfirmsnum"],false); $xml_type="firms"; break; case "posts": $id_cat=@$_REQUEST["id_cat"]; if (eregi("^[0-9]{1,}$",$id_cat)) { $objects_xml=$structure->getPostsByCat($id_cat); $xml_type="posts"; } break; case "firms": $id_cat=@$_REQUEST["id_cat"]; if (eregi("^[0-9]{1,}$",$id_cat)) { $objects_xml=$structure->getFirmsByCat($id_cat); $xml_type="firms"; } break; case "stats": $id_cat=@$_REQUEST["id_cat"]; if (eregi("^[0-9]{1,}$",$id_cat)) { $objects_xml=$structure->getAllStatsByCat($id_cat,1,"not"); $xml_type="stats"; } break; case "top_posts": $topType=@$_REQUEST["topType"]; switch ($topType) { case 1: $objects_xml=$structure->getTopPosts(100,1); break; case 2: $objects_xml=$structure->getTopPosts(100,2); break; case 3: $objects_xml=$structure->getTopPosts(100,3); break; case 4: $objects_xml=$structure->getTopPosts(100,4); break; default: $objects_xml=$structure->getTopPosts(100,1); } $xml_type="posts"; break; case "top_stats": $topType=@$_REQUEST["topType"]; switch ($topType) { case 21: $objects_xml=$structure->getTopStats(100); break; case 22: $objects_xml=$structure->getTopStats(100,2); break; case 23: $objects_xml=$structure->getTopStats(100,3); break; case 24: $objects_xml=$structure->getTopStats(100,4); break; case 25: $objects_xml=$structure->getTopStats(100,5); break; default: $objects_xml=$structure->getTopStats(100); } $xml_type="stats"; break; case "top_links": $topType=@$_REQUEST["topType"]; switch ($topType) { case 1: $objects_xml=$structure->getTopHrefs(100); break; case 2: $objects_xml=$structure->getTopHrefs(100,2); break; case 3: $objects_xml=$structure->getTopSites(100,1); break; case 4: $objects_xml=$structure->getTopSites(100,2); break; case 5: $objects_xml=$structure->getTopHrefs(100,3); break; case 6: $objects_xml=$structure->getTopHrefs(100,4); break; case 7: $objects_xml=$structure->getTopHrefs(100,5); break; case 8: $objects_xml=$structure->getTopHrefs(100,6); break; case 9: $objects_xml=$structure->getTopHrefs(100,7); break; case 10: $objects_xml=$structure->getTopHrefs(100,8); break; default: $objects_xml=$structure->getTopHrefs(100); } $xml_type="links"; break; case "last_news": $objects_xml=$structure->getLastNews($settings["shownewsnum"]); $xml_type="news"; break; case "last_links": $objects_xml=$structure->getLastHrefs($settings["showhrefsnum"],false); $xml_type="links"; break; case "last_stats": $objects_xml=$structure->getLastStats($settings["showstatnum"]); $xml_type="stats"; break; case "links": $id_cat=@$_REQUEST["id_cat"]; if (eregi("^[0-9]{1,}$",$id_cat)) { $objects_xml=$structure->getLinksByCat($id_cat,0,0,false,"date",true); $xml_type="links"; } break; } switch ($xml_type) { case "posts": if (is_array($objects_xml)) foreach ($objects_xml as $xml) { echo ""; echo "".entity_decode($xml["caption"])." ".$xml["price"]." ".$xml["valute"].""; echo "".$xml["opis_url"].""; echo "".entity_decode($xml["content2"]).""; echo "".date("r",strtotime($xml["add_date"])).""; echo "".$xml["opis_url"].""; echo ""; } break; case "firms": if (is_array($objects_xml)) foreach ($objects_xml as $xml) { echo ""; echo "".entity_decode($xml["caption"]).""; echo "".$xml["opis_url"].""; echo "".entity_decode($xml["content2"]).""; echo "".date("r",strtotime($xml["add_date"])).""; echo "".$xml["opis_url"].""; echo ""; } break; case "links": if (is_array($objects_xml)) foreach ($objects_xml as $xml) { echo ""; echo "".entity_decode($xml["title"]).""; echo "".$xml["opis_url"].""; echo "".entity_decode($xml["description"]).""; echo "".date("r",strtotime($xml["create"])).""; echo "".$xml["opis_url"].""; echo ""; } break; case "stats": if (is_array($objects_xml)) foreach ($objects_xml as $xml) { echo ""; echo "".entity_decode($xml["caption"]).""; echo "".$xml["link"].""; echo "".entity_decode($xml["content2"]).""; echo "".date("r",strtotime($xml["upd"])).""; echo "".$xml["link"].""; echo ""; } break; case "news": if (is_array($objects_xml)) foreach ($objects_xml as $xml) { echo ""; echo "".entity_decode($xml["title"]).""; echo "".$httproot."news"; echo "".entity_decode($xml["content"]).""; echo "".date("r",strtotime($xml["date"])).""; echo "".$httproot."news"; echo ""; } break; } echo ""; die(); break; case "integration": $rubr="integration"; $id2=@$_REQUEST["id2"]; $count=@$_REQUEST["count"]; if (!eregi("^[0-9]{1,}$",$count)) $count=100; switch ($id2) { case "last_posts": $objects_xml=$structure->getLastPosts($settings["showpostsnum"],false); $xml_type="posts"; break; case "last_firms": $objects_xml=$structure->getLastFirms($settings["showfirmsnum"],false); $xml_type="firms"; break; case "posts": $id_cat=@$_REQUEST["id_cat"]; if (eregi("^[0-9]{1,}$",$id_cat)) { $objects_xml=$structure->getPostsByCat($id_cat); $xml_type="posts"; } break; case "firms": $id_cat=@$_REQUEST["id_cat"]; if (eregi("^[0-9]{1,}$",$id_cat)) { $objects_xml=$structure->getFirmsByCat($id_cat); $xml_type="firms"; } break; case "stats": $id_cat=@$_REQUEST["id_cat"]; if (eregi("^[0-9]{1,}$",$id_cat)) { $objects_xml=$structure->getAllStatsByCat($id_cat,1,"not"); $xml_type="stats"; } break; case "top_posts": $topType=@$_REQUEST["topType"]; switch ($topType) { case 1: $objects_xml=$structure->getTopPosts($count,1); break; case 2: $objects_xml=$structure->getTopPosts($count,2); break; case 3: $objects_xml=$structure->getTopPosts($count,3); break; case 4: $objects_xml=$structure->getTopPosts($count,4); break; default: $objects_xml=$structure->getTopPosts($count,1); } $xml_type="posts"; break; case "top_stats": $topType=@$_REQUEST["topType"]; switch ($topType) { case 21: $objects_xml=$structure->getTopStats($count); break; case 22: $objects_xml=$structure->getTopStats($count,2); break; case 23: $objects_xml=$structure->getTopStats($count,3); break; case 24: $objects_xml=$structure->getTopStats($count,4); break; case 25: $objects_xml=$structure->getTopStats($count,5); break; default: $objects_xml=$structure->getTopStats($count); } $xml_type="stats"; break; case "top_links": $topType=@$_REQUEST["topType"]; switch ($topType) { case 1: $objects_xml=$structure->getTopHrefs($count); break; case 2: $objects_xml=$structure->getTopHrefs($count,2); break; case 3: $objects_xml=$structure->getTopSites($count,1); break; case 4: $objects_xml=$structure->getTopSites($count,2); break; case 5: $objects_xml=$structure->getTopHrefs($count,3); break; case 6: $objects_xml=$structure->getTopHrefs($count,4); break; case 7: $objects_xml=$structure->getTopHrefs($count,5); break; case 8: $objects_xml=$structure->getTopHrefs($count,6); break; case 9: $objects_xml=$structure->getTopHrefs($count,7); break; case 10: $objects_xml=$structure->getTopHrefs($count,8); break; default: $objects_xml=$structure->getTopHrefs($count); } $xml_type="links"; break; case "last_news": $objects_xml=$structure->getLastNews($settings["shownewsnum"]); $xml_type="news"; break; case "last_links": $objects_xml=$structure->getLastHrefs($settings["showhrefsnum"],false); $xml_type="links"; break; case "last_stats": $objects_xml=$structure->getLastStats($settings["showstatnum"]); $xml_type="stats"; break; case "links": $id_cat=@$_REQUEST["id_cat"]; if (eregi("^[0-9]{1,}$",$id_cat)) { $objects_xml=$structure->getLinksByCat($id_cat,0,0,false,"date",true); $xml_type="links"; } break; } $smarty->assign("objects",$objects_xml); $smarty->assign("type",$xml_type); $content_tpl=$content_pth."content/integration.content.tpl"; $content=$smarty->fetch($content_tpl); echo $content; $for_stat="Пользователь просматривал страницу интеграции"; die(); break; case "sitemap": $rubr="sitemap"; //получаем рубрики каталога $rubrics=$structure->getRubricsTree(0,1,array(),false,0,0,true,1); $smarty->Assign("rubrics",$rubrics); //получаем рубрики статей $rubrics2=$structure->getRubricsTree(0,1,array(),false,0,0,true,2); $smarty->Assign("rubrics2",$rubrics2); //получаем рубрики объявлений $rubrics3=$structure->getRubricsTree(0,1,array(),false,0,0,true,3); $smarty->Assign("rubrics3",$rubrics3); //получаем рубрики фирм $rubrics4=$structure->getRubricsTree(0,1,array(),false,0,0,true,4); $smarty->Assign("rubrics4",$rubrics4); $all_rss=$structure->getAllRSS(" where showmain=1 or showcat=1"); $smarty->assign("allrss",$all_rss); $allnews=$structure->getAllNews(); $smarty->assign("allnews",$allnews); $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); $content_tpl=$content_pth."content/sitemap.content.tpl"; $for_stat="Пользователь просматривал карту сайта"; break; case "googlemap": $rubr="googlemap"; //получаем рубрики каталога header("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT"); header ('Content-Type: text/xml; charset=UTF-8'); $rubrics=$structure->getRubricsTree(0,1,array(),false,0,0,true,1); $smarty->Assign("rubrics",$rubrics); //получаем рубрики статей $rubrics2=$structure->getRubricsTree(0,1,array(),false,0,0,true,2); $smarty->Assign("rubrics2",$rubrics2); //получаем рубрики объявлений $rubrics3=$structure->getRubricsTree(0,1,array(),false,0,0,true,3); $smarty->Assign("rubrics3",$rubrics3); //получаем рубрики фирм $rubrics4=$structure->getRubricsTree(0,1,array(),false,0,0,true,4); $smarty->Assign("rubrics4",$rubrics4); $all_rss=$structure->getAllRSS(" where showmain=1 or showcat=1"); $smarty->assign("allrss",$all_rss); $allnews=$structure->getAllNews(); $smarty->assign("allnews",$allnews); echo ' '; if (isset($rubrics[0])) { foreach ($rubrics[0] as $rubr) { echo ' '.$rubr["link"].' weekly 0.9 '; if (isset($rubrics[$rubr["id_cat"]])) { foreach ($rubrics[$rubr["id_cat"]] as $rubr2) { echo ' '.$rubr2["link"].' weekly 0.7 '; } } } } if (isset($rubrics2[0])) { foreach ($rubrics2[0] as $rubr) { echo ' '.$rubr["statlink"].' weekly 0.9 '; if (isset($rubrics2[$rubr["id_cat"]])) { foreach ($rubrics2[$rubr["id_cat"]] as $rubr2) { echo ' '.$rubr2["statlink"].' weekly 0.7 '; } } } } if (isset($rubrics3[0])) { foreach ($rubrics3[0] as $rubr) { echo ' '.$rubr["postslink"].' weekly 0.9 '; if (isset($rubrics3[$rubr["id_cat"]])) { foreach ($rubrics3[$rubr["id_cat"]] as $rubr2) { echo ' '.$rubr2["postslink"].' weekly 0.7 '; } } } } if (isset($rubrics4[0])) { foreach ($rubrics4[0] as $rubr) { echo ' '.$rubr["firmslink"].' weekly 0.9 '; if (isset($rubrics4[$rubr["id_cat"]])) { foreach ($rubrics4[$rubr["id_cat"]] as $rubr2) { echo ' '.$rubr2["firmslink"].' weekly 0.7 '; } } } } echo ''; die(); $content_tpl=$content_pth."content/sitemap.content.tpl"; $for_stat="Пользователь просматривал карту сайта"; break; case "rules": $rubr="rules"; $content_tpl=$content_pth."content/rules.content.tpl"; if (is_file($root."rules.htm")) { $rules=@file_get_contents($root."rules.htm"); } else { $rules=""; } $for_stat="Пользователь просматривал правила каталога"; $smarty->Assign("rules",$rules); break; case "search": $rubr="search"; $content_tpl=$content_pth."content/search.content.tpl"; $str=@$_REQUEST["str"]; $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); if (eregi("^[[:space:]]{1,}$",$str)) $str=''; if (isset($_REQUEST["sAction"])) { $sAction=$_REQUEST["sAction"]; } else { $sAction="insite"; } switch ($sAction) { case "insite": $results=$structure->searchLinks($str,true); $results2=$structure->searchStats($str); $results3=$structure->searchPosts($str); $results4=$structure->searchFirms($str); $results5=$structure->searchPages($str); $for_stat="Пользователь искал на сайте \"$str\""; $smarty->assign("res_count",sizeof($results)); $smarty->assign("res_count2",sizeof($results2)); $smarty->assign("res_count3",sizeof($results3)); $smarty->assign("res_count4",sizeof($results4)); $smarty->assign("res_count5",sizeof($results5)); $smarty->assign("results",$results); $smarty->assign("results2",$results2); $smarty->assign("results3",$results3); $smarty->assign("results4",$results4); $smarty->assign("results5",$results5); break; case "inexternal": if (phpversion() > '5.0') { $results=$structure->searchYandexXML($str); if (is_array($results)) { $smarty->assign("results",$results); $smarty->assign("res_count",sizeof($results)); } $for_stat="Пользователь искал в интернете \"$str\""; } else { $smarty->assign("phperr",true); } break; } $smarty->assign("sAction",$sAction); $smarty->assign("str",str_replace("\"","",$str)); break; case "rss": $rubr="rss"; $content_tpl=$content_pth."content/rss.content.tpl"; $for_stat="Пользователь просматривал ленту новостей"; $all_rss=$structure->getAllRSS(" where showmain=1 or showcat=1"); $smarty->assign("allrss",$all_rss); if (isset($_REQUEST["id2"])) { $id2=@$_REQUEST["id2"]; if (eregi("^[0-9]{1,}$",$id2)) { $rss=$structure->getRssByID($id2); if (is_array($rss)) { $rs=$structure->getRSS($rss["address"],$rss["number"]); $smarty->assign("url",$rss["address"]); $smarty->assign("rsscont",$rs); } $smarty->assign("rss",$rss); } } break; case $settings["href_prefix"]: case "href": $rubr="href"; $content_tpl=$content_pth."content/href.content.tpl"; if ($settings["catoff"]==0) { $for_stat="Пользователь просматривал ссылку"; if (isset($_REQUEST["id2"])) { $id2=@$_REQUEST["id2"]; if (eregi("^[0-9]{1,}$",$id2)) { $link=$structure->getLinkByID($id2); if (isset($link["title"])) { /*голосовалка*/ $ajax_httpdir=$_SESSION["fckpath"]."modules/xajax/"; require ($config["modules"]["ajax"]); $xajax = new xajax(); $xajax->debugOff(); $xajax->registerFunction("vote"); $xajax->processRequests(); $smarty->assign("ajax",$xajax->getJavascript($ajax_httpdir)); /*голосовалка*/ /*комментарии*/ if ($settings["comments_off"]==0) { $comment_count=0; $comments=$structure->getComments($link["id_link"],"link",$comment_count); $smarty->assign("comments",$comments); $smarty->assign("comments_count",$comment_count); $commentMode="link"; include ($config["modules_path"]."addcomment.inc.php"); } /*комментарии*/ $rubric=$structure->getRubricByID($link["id_cat"]); $rubric=removeMagicQuotes(@$rubric); $rubric_path=$structure->getPath($rubric["id_cat"]); $smarty->assign("rubric_path",$rubric_path); if ($rubric["titletag"]!='') $smarty->assign("titletag",$rubric["titletag"]); if ($rubric["metatags"]!='') $smarty->assign("metatags",$rubric["metatags"]); if ($rubric["metakeywords"]!='') $smarty->assign("metakeywords",$rubric["metakeywords"]); $smarty->assign("rubric",$rubric); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readCatRss(true,$link["id_cat"]); } else { $rss=$structure->readCatRss(false,$link["id_cat"]); } if (is_array($rss)) $smarty->assign("rssnews",$rss); if ($settings["rsslimit"]) { $rss_main=$structure->readMainRss(true); } else { $rss_main=$structure->readMainRss(false); } if (is_array($rss_main)) $smarty->assign("rssnews_main",$rss_main); } if ($settings["viewsub"]) { if ($settings["ogrsub"]) { $subrubrics=$structure->getRubricsTree($link["id_cat"],1,array(),true,$settings["viewsubnum"],0,false,2); } else { $subrubrics=$structure->getRubricsTree($link["id_cat"],1,array(),false,0,0,false,2); } if (is_array($subrubrics)) $smarty->assign("subrubrics",$subrubrics); } if ($structure->existBannerCat($link["id_cat"])) { $banner=$structure->getBannerByCat($link["id_cat"]); } else { $banner=$structure->getDefaultBanner(); } $banner=removeMagicQuotes(@$banner); $for_stat="Пользователь просматривал ссылку ".$link["title"]." в разделе ".$link["rubric"]["caption"]; $smarty->assign("banner",$banner); $smarty->assign("link",$link); if ($settings["showviphrefs"]) { if ($settings["showvipinhref"]) { $viphrefs=$structure->getLinksByCat($rubric["id_cat"],1,10,true); $smarty->assign("viphrefs",@$viphrefs); } } $allstats=$structure->getAllStatsByCat($link["id_cat"],1,0,5,true,true); $smarty->assign("stats",$allstats); $allposts=$structure->getPostsByCat($link["id_cat"],0,10); $smarty->assign("allposts",$allposts); $db->query("UPDATE %LINKS% set views=views+1 where id_link=".$link["id_link"]); $topviews=$structure->getTopHrefsByCat($link["id_cat"],10); $topvisitors=$structure->getTopHrefsByCat($link["id_cat"],10,2); $smarty->assign("topviews",$topviews); $smarty->assign("topvisitors",$topvisitors); } else { $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); } } else { $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); } } else { $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); } } break; case "random": $rubr="random"; $randomType=@$_REQUEST["randomType"]; if ($randomType==1) { $random=$structure->getRandomLinks(); } else { $random=$structure->getRandomStats(); } $smarty->assign("random",$random); $smarty->assign("randomType",$randomType); $content_tpl=$content_pth."content/random.content.tpl"; $tpl=$config["user"]["page"]; break; case "page": $rubr="page"; $content_tpl=$content_pth."content/page.content.tpl"; $tpl=$config["user"]["page"]; $for_stat="Просмотр неопределенной страницы каталога"; if ($settings["rsslimit"]) { $rss_main=$structure->readMainRss(true); } else { $rss_main=$structure->readMainRss(false); } if (is_array($rss_main)) $smarty->assign("rssnews_main",$rss_main); if (isset($_REQUEST["id2"])) { $id2=@$_REQUEST["id2"]; if (eregi("^[0-9]{1,}$",$id2)) { $page=$structure->getPageByID($id2); $page_path=$structure->getPagePath($page["id_page"]); $subrubrics=$structure->getSubPages($id2); $smarty->assign("subrubrics",$subrubrics); $smarty->assign("rubric_path",$page_path); $for_stat="Пользователь просматривал страницу ".$page["caption"]; $smarty->assign("page",$page); } } else { $page=$structure->getMainPage(); $page_path=$structure->getPagePath($page["id_page"]); $subrubrics=$structure->getSubPages($page["id_page"]); $smarty->assign("subrubrics",$subrubrics); $smarty->assign("rubric_path",$page_path); $for_stat="Пользователь просматривал страницу ".$page["caption"]; $smarty->assign("page",$page); } break; case $settings["posters_prefix"]: case "posters": $rubr="posts"; $content_tpl=$content_pth."content/posters.content.tpl"; if ($settings["postersoff"]==0) { if (!isset($_REQUEST["id2"])) { $rubric=false; } else { $id2=@$_REQUEST["id2"]; if (eregi("^[-a-zA-Z_]{1,}$",$id2)) { $rubric=$structure->getRubricByIdent($id2); } else { if (eregi("^[0-9]{1,}$",$id2)) { $rubric=$structure->getRubricByID($id2); } } } if (is_Array(@$rubric)) { //список объяв $sql_dop=""; $content_tpl=$content_pth."content/posters.content.tpl"; $smarty->assign("main_page",false); $rubric_path=$structure->getPath($rubric["id_cat"]); $smarty->assign("rubric_path",$rubric_path); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readCatRss(true,$rubric["id_cat"]); $rss_main=$structure->readMainRss(true); } else { $rss=$structure->readCatRss(false,$rubric["id_cat"]); $rss_main=$structure->readMainRss(false); } if (is_array($rss)) $smarty->assign("rssnews",$rss); if (is_array($rss_main)) $smarty->assign("rssnews_main",$rss_main); } if ($settings["viewsub"]) { if ($settings["ogrsub"]) { $subrubrics=$structure->getRubricsTree($rubric["id_cat"],1,array(),true,$settings["viewsubnum"],0,false,3); } else { $subrubrics=$structure->getRubricsTree($rubric["id_cat"],1,array(),false,0,0,false,3); } if (is_array($subrubrics)) $smarty->assign("subrubrics",$subrubrics); if ($rubric["id_child_cat"]==0) { if (isset($subrubrics[$rubric["id_cat"]])) { foreach($subrubrics[$rubric["id_cat"]] as $rubr2) { $sql_dop.=" or id_cat=".$rubr2["id_cat"]; if (isset($subrubrics[$rubr2["id_cat"]])) foreach($subrubrics[$rubr2["id_cat"]] as $rubr3) { $sql_dop.=" or id_cat=".$rubr3["id_cat"]; } } } } } if ($rubric["titletag"]!='') $smarty->assign("titletag",$rubric["titletag"]); if ($rubric["metatags"]!='') $smarty->assign("metatags",$rubric["metatags"]); if ($rubric["metakeywords"]!='') $smarty->assign("metakeywords",$rubric["metakeywords"]); $for_stat="Пользователь просматривал рубрику объявлений ".$rubric["caption"]; if ($structure->existBannerCat($rubric["id_cat"])) { $banner=$structure->getBannerByCat($rubric["id_cat"]); } else { $banner=$structure->getDefaultBanner(); } $smarty->assign("banner",$banner); $smarty->assign("id_cat",$rubric["id_cat"]); $allstats=$structure->getAllStatsByCat($rubric["id_cat"],1,0,5,true,true); $smarty->assign("stats",$allstats); /*получение объявлений*/ if (isset($_REQUEST["city_id"])) { if (eregi("^[0-9]{1,}$",$_REQUEST["city_id"])) { $city_id=$_REQUEST["city_id"]; $smarty->assign("cit","&city_id=".$city_id); } else { $city_id="nocity"; $smarty->assign("cit",""); } } else { $city_id="nocity"; $smarty->assign("cit",""); } $cnt=$structure->getCountPostsEx($rubric["id_cat"],$city_id,$sql_dop); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($_REQUEST["order"])) { $order=$_REQUEST["order"]; } else { $order="add_date"; $_REQUEST["desc"]=true; } if (isset($_REQUEST["desc"])) { $desc=true; $smarty->assign("desc","&desc=yes"); } else { $desc=false; $smarty->assign("desc",""); } $smarty->assign("city_id",$city_id); $smarty->assign("order",$order); $posts=$structure->getPostsByCat($rubric["id_cat"],$page,$settings["onpage"],$city_id,$order,$desc,$sql_dop); if ($settings["showviphrefs"]) { $viphrefs=$structure->getLinksByCat($rubric["id_cat"],$page,$settings["onpage"],true); $smarty->assign("viphrefs",@$viphrefs); } $cities=$structure->getAllCitiesForm(); $smarty->assign("cities",$cities); /*конец получения объявлений*/ if (isset($pages_arr)) $smarty->assign("pages",$pages_arr); $smarty->assign("page",$page); $smarty->assign("rubric",$rubric); $smarty->assign("posts",$posts); } else { //главная $content_tpl=$content_pth."content/posters_index.content.tpl"; $smarty->assign("main_page",true); $allnews=$structure->getAllNews(); if (@$allnews) { $smarty->assign("news",$allnews); } $rubric["metatags"]=$settings["metatags"]; $rubric["metakeywords"]=$settings["metakeywords"]; $countcatalogs=$structure->getCountCatalogs(); $smarty->assign("countcatalogs",$countcatalogs); @$rubric["title"]=@$settings["title"]; if ($settings["ogrmain"]) { $rubrics=$structure->getRubricsTree(0,1,array(),true,$settings["ogrmainnum"],0,true,3); } else { $rubrics=$structure->getRubricsTree(0,1,array(),false,0,0,true,3); } $smarty->assign("rubrics",$rubrics); $banner=$structure->getDefaultBanner(); $for_stat="Просмотр главной страницы каталога объявлений"; $smarty->assign("banner",$banner); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readMainRss(true); } else { $rss=$structure->readMainRss(false); } $smarty->assign("rssnews",$rss); } if ($settings["index_posts"]) { //получаем объявления на главной /*получение объявлений*/ if (isset($_REQUEST["city_id"])) { if (eregi("^[0-9]{1,}$",$_REQUEST["city_id"])) { $city_id=$_REQUEST["city_id"]; $smarty->assign("cit","&city_id=".$city_id); } else { $city_id="nocity"; $smarty->assign("cit",""); } } else { $city_id="nocity"; $smarty->assign("cit",""); } $cnt=$structure->getCountPostsIndex($city_id); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($_REQUEST["order"])) { $order=$_REQUEST["order"]; } else { $order="add_date"; $_REQUEST["desc"]=true; } if (isset($_REQUEST["desc"])) { $desc=true; $smarty->assign("desc","&desc=yes"); } else { $desc=false; $smarty->assign("desc",""); } $smarty->assign("city_id",$city_id); $smarty->assign("order",$order); $posts=$structure->getPostsByIndex($page,$settings["onpage"],$city_id,$order,$desc); $cities=$structure->getAllCitiesForm(); $smarty->assign("cities",$cities); /*конец получения объявлений*/ if (isset($pages_arr)) $smarty->assign("pages",$pages_arr); $smarty->assign("page",$page); $smarty->assign("rubric",$rubric); $smarty->assign("posts",$posts); } } } break; case "postersfull": $rubr="postsfull"; $content_tpl=$content_pth."content/posters_full.content.tpl"; if (isset($_REQUEST["id2"])) { $id2=$_REQUEST["id2"]; if (eregi("^[0-9]{1,}",$id2)) { $post=$structure->getPostByID($id2); $smarty->assign("post",$post); $rubric=$structure->getRubricByID($post["id_cat"]); $rubric_path=$structure->getPath($post["id_cat"]); $smarty->assign("rubric_path",$rubric_path); $smarty->assign("rubric",$rubric); $rubric["metatags"]=$settings["metatags"]; $rubric["metakeywords"]=$settings["metakeywords"]; $countcatalogs=$structure->getCountCatalogs(); $smarty->assign("countcatalogs",$countcatalogs); $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); @$rubric["title"]=@$settings["title"]; if ($settings["ogrmain"]) { $rubrics=$structure->getRubricsTree(0,1,array(),true,$settings["ogrmainnum"],0,true,3); } else { $rubrics=$structure->getRubricsTree(0,1,array(),false,0,0,true,3); } $smarty->assign("rubrics",$rubrics); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readCatRss(true,$post["id_cat"]); $rss_main=$structure->readMainRss(true); } else { $rss=$structure->readCatRss(false,$post["id_cat"]); $rss_main=$structure->readMainRss(false); } if (is_array($rss)) $smarty->assign("rssnews",$rss); if (is_array($rss_main)) $smarty->assign("rssnews_main",$rss_main); } /*комментарии*/ if ($settings["comments_off"]==0) { $comment_count=0; $comments=$structure->getComments($post["id_post"],"post",$comment_count); $smarty->assign("comments",$comments); $smarty->assign("comments_count",$comment_count); $commentMode="post"; include ($config["modules_path"]."addcomment.inc.php"); } /*комментарии*/ } } break; /*фирмы*/ case $settings["firms_prefix"]: case "firms": $rubr="firms"; $content_tpl=$content_pth."content/firms.content.tpl"; if ($settings["firmsoff"]==0) { if (!isset($_REQUEST["id2"])) { $rubric=false; } else { $id2=@$_REQUEST["id2"]; if (eregi("^[-a-zA-Z_]{1,}$",$id2)) { $rubric=$structure->getRubricByIdent($id2); } else { if (eregi("^[0-9]{1,}$",$id2)) { $rubric=$structure->getRubricByID($id2); } } } if (is_Array(@$rubric)) { //список фирм $sql_dop=""; $content_tpl=$content_pth."content/firms.content.tpl"; $smarty->assign("main_page",false); $rubric_path=$structure->getPath($rubric["id_cat"]); $smarty->assign("rubric_path",$rubric_path); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readCatRss(true,$rubric["id_cat"]); $rss_main=$structure->readMainRss(true); } else { $rss=$structure->readCatRss(false,$rubric["id_cat"]); $rss_main=$structure->readMainRss(false); } if (is_array($rss)) $smarty->assign("rssnews",$rss); if (is_array($rss_main)) $smarty->assign("rssnews_main",$rss_main); } if ($settings["viewsub"]) { if ($settings["ogrsub"]) { $subrubrics=$structure->getRubricsTree($rubric["id_cat"],1,array(),true,$settings["viewsubnum"],0,false,4); } else { $subrubrics=$structure->getRubricsTree($rubric["id_cat"],1,array(),false,0,0,false,4); } if (is_array($subrubrics)) $smarty->assign("subrubrics",$subrubrics); if ($rubric["id_child_cat"]==0) { if (isset($subrubrics[$rubric["id_cat"]])) { foreach($subrubrics[$rubric["id_cat"]] as $rubr2) { $sql_dop.=" or id_cat=".$rubr2["id_cat"]; if (isset($subrubrics[$rubr2["id_cat"]])) foreach($subrubrics[$rubr2["id_cat"]] as $rubr3) { $sql_dop.=" or id_cat=".$rubr3["id_cat"]; } } } } } if ($rubric["titletag"]!='') $smarty->assign("titletag",$rubric["titletag"]); if ($rubric["metatags"]!='') $smarty->assign("metatags",$rubric["metatags"]); if ($rubric["metakeywords"]!='') $smarty->assign("metakeywords",$rubric["metakeywords"]); $for_stat="Пользователь просматривал рубрику фирм ".$rubric["caption"]; if ($structure->existBannerCat($rubric["id_cat"])) { $banner=$structure->getBannerByCat($rubric["id_cat"]); } else { $banner=$structure->getDefaultBanner(); } $smarty->assign("banner",$banner); $smarty->assign("id_cat",$rubric["id_cat"]); $allstats=$structure->getAllStatsByCat($rubric["id_cat"],1,0,5,true,true); $smarty->assign("stats",$allstats); /*получение фирм*/ if (isset($_REQUEST["city_id"])) { if (eregi("^[0-9]{1,}$",$_REQUEST["city_id"])) { $city_id=$_REQUEST["city_id"]; $smarty->assign("cit","&city_id=".$city_id); } else { $city_id="nocity"; $smarty->assign("cit",""); } } else { $city_id="nocity"; $smarty->assign("cit",""); } $cnt=$structure->getCountFirmsEx($rubric["id_cat"],$city_id,$sql_dop); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($_REQUEST["order"])) { $order=$_REQUEST["order"]; } else { $order="add_date"; $_REQUEST["desc"]=true; } if (isset($_REQUEST["desc"])) { $desc=true; $smarty->assign("desc","&desc=yes"); } else { $desc=false; $smarty->assign("desc",""); } $smarty->assign("city_id",$city_id); $smarty->assign("order",$order); $firms=$structure->getFirmsByCat($rubric["id_cat"],$page,$settings["onpage"],$city_id,$order,$desc,$sql_dop); if ($settings["showviphrefs"]) { $viphrefs=$structure->getLinksByCat($rubric["id_cat"],$page,$settings["onpage"],true); $smarty->assign("viphrefs",@$viphrefs); } $cities=$structure->getAllCitiesForm(); $smarty->assign("cities",$cities); /*конец получения объявлений*/ if (isset($pages_arr)) $smarty->assign("pages",$pages_arr); $smarty->assign("page",$page); $smarty->assign("rubric",$rubric); $smarty->assign("firms",$firms); } else { //главная $content_tpl=$content_pth."content/firms_index.content.tpl"; $smarty->assign("main_page",true); $allnews=$structure->getAllNews(); if (@$allnews) { $smarty->assign("news",$allnews); } $rubric["metatags"]=$settings["metatags"]; $rubric["metakeywords"]=$settings["metakeywords"]; $countcatalogs=$structure->getCountCatalogs(); $smarty->assign("countcatalogs",$countcatalogs); @$rubric["title"]=@$settings["title"]; if ($settings["ogrmain"]) { $rubrics=$structure->getRubricsTree(0,1,array(),true,$settings["ogrmainnum"],0,true,4); } else { $rubrics=$structure->getRubricsTree(0,1,array(),false,0,0,true,4); } $smarty->assign("rubrics",$rubrics); $banner=$structure->getDefaultBanner(); $for_stat="Просмотр главной страницы каталога фирм"; $smarty->assign("banner",$banner); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readMainRss(true); } else { $rss=$structure->readMainRss(false); } $smarty->assign("rssnews",$rss); } if ($settings["index_firms"]) { //получаем фирмы на главной /*получение фирм*/ if (isset($_REQUEST["city_id"])) { if (eregi("^[0-9]{1,}$",$_REQUEST["city_id"])) { $city_id=$_REQUEST["city_id"]; $smarty->assign("cit","&city_id=".$city_id); } else { $city_id="nocity"; $smarty->assign("cit",""); } } else { $city_id="nocity"; $smarty->assign("cit",""); } $cnt=$structure->getCountFirmsIndex($city_id); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($_REQUEST["order"])) { $order=$_REQUEST["order"]; } else { $order="add_date"; $_REQUEST["desc"]=true; } if (isset($_REQUEST["desc"])) { $desc=true; $smarty->assign("desc","&desc=yes"); } else { $desc=false; $smarty->assign("desc",""); } $smarty->assign("city_id",$city_id); $smarty->assign("order",$order); $firms=$structure->getFirmsByIndex($page,$settings["onpage"],$city_id,$order,$desc); $cities=$structure->getAllCitiesForm(); $smarty->assign("cities",$cities); /*конец получения объявлений*/ if (isset($pages_arr)) $smarty->assign("pages",$pages_arr); $smarty->assign("page",$page); $smarty->assign("rubric",$rubric); $smarty->assign("firms",$firms); } } } break; case "firmsfull": $rubr="firmsfull"; $content_tpl=$content_pth."content/firms_full.content.tpl"; if (isset($_REQUEST["id2"])) { $id2=$_REQUEST["id2"]; if (eregi("^[0-9]{1,}",$id2)) { $firm=$structure->getFirmByID($id2); $smarty->assign("firm",$firm); $rubric=$structure->getRubricByID($firm["id_cat"]); $rubric_path=$structure->getPath($firm["id_cat"]); $smarty->assign("rubric_path",$rubric_path); $smarty->assign("rubric",$rubric); $rubric["metatags"]=$settings["metatags"]; $rubric["metakeywords"]=$settings["metakeywords"]; $countcatalogs=$structure->getCountCatalogs(); $smarty->assign("countcatalogs",$countcatalogs); $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); @$rubric["title"]=@$settings["title"]; if ($settings["ogrmain"]) { $rubrics=$structure->getRubricsTree(0,1,array(),true,$settings["ogrmainnum"],0,true,4); } else { $rubrics=$structure->getRubricsTree(0,1,array(),false,0,0,true,4); } $smarty->assign("rubrics",$rubrics); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readCatRss(true,$firm["id_cat"]); $rss_main=$structure->readMainRss(true); } else { $rss=$structure->readCatRss(false,$post["id_cat"]); $rss_main=$structure->readMainRss(false); } if (isset($rss)) $smarty->assign("rssnews",$rss); if (isset($rss_main)) $smarty->assign("rssnews_main",$rss_main); } /*комментарии*/ if ($settings["comments_off"]==0) { $comment_count=0; $comments=$structure->getComments($firm["id_firm"],"firm",$comment_count); $smarty->assign("comments",$comments); $smarty->assign("comments_count",$comment_count); $commentMode="firm"; include ($config["modules_path"]."addcomment.inc.php"); } /*комментарии*/ } } break; /*конец фирм*/ case $settings["cat_prefix"]: case "cat": $rubr="cat"; $content_tpl=$content_pth."content/catalog.content.tpl"; if ($settings["catoff"]==0) { $for_stat="Пользователь просматривал список рубрик каталога"; if (isset($_REQUEST["id2"])) { $id2=@$_REQUEST["id2"]; if (eregi("^[-a-zA-Z0-9_]{1,}$",$id2)) { $rubric=$structure->getRubricByIdent($id2); } else { if (eregi("^[0-9]{1,}$",$id2)) { $rubric=$structure->getRubricByID($id2); } } if (!is_Array(@$rubric)) { if (eregi("^[0-9]{1,}$",$id2)) { $rubric=$structure->getRubricByID($id2); } } if (is_array(@$rubric)) { //все есть $sql_dop=""; $rubric_path=$structure->getPath($rubric["id_cat"]); $smarty->assign("rubric_path",$rubric_path); $topviews=$structure->getTopHrefsByCat($rubric["id_cat"],10); $topvisitors=$structure->getTopHrefsByCat($rubric["id_cat"],10,2); $smarty->assign("topviews",$topviews); $smarty->assign("topvisitors",$topvisitors); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readCatRss(true,$rubric["id_cat"]); $rss_main=$structure->readMainRss(true); } else { $rss=$structure->readCatRss(false,$rubric["id_cat"]); $rss_main=$structure->readMainRss(false); } if (is_array($rss)) $smarty->assign("rssnews",$rss); if (is_array($rss_main)) $smarty->assign("rssnews_main",$rss_main); } if ($settings["viewsub"]) { if ($settings["ogrsub"]) { $subrubrics=$structure->getRubricsTree($rubric["id_cat"],1,array(),true,$settings["viewsubnum"],0,false,1); } else { $subrubrics=$structure->getRubricsTree($rubric["id_cat"],1,array(),false,0,0,false,1); } if (is_array($subrubrics)) $smarty->assign("subrubrics",$subrubrics); if ($rubric["id_child_cat"]==0) { $sql_dop=$structure->doSQLDop($rubric,$subrubrics); } } if ($rubric["titletag"]!='') $smarty->assign("titletag",$rubric["titletag"]); if ($rubric["metatags"]!='') $smarty->assign("metatags",$rubric["metatags"]); if ($rubric["metakeywords"]!='') $smarty->assign("metakeywords",$rubric["metakeywords"]); $for_stat="Пользователь просматривал рубрику ".$rubric["caption"]; if ($structure->existBannerCat($rubric["id_cat"])) { $banner=$structure->getBannerByCat($rubric["id_cat"]); } else { $banner=$structure->getDefaultBanner(); } $smarty->assign("banner",$banner); $cnt=$structure->getCountLinksEx($rubric["id_cat"],$sql_dop); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($_REQUEST["order"])) { $order=$_REQUEST["order"]; } else { $order="otsenka"; $_REQUEST["desc"]=true; } if (isset($_REQUEST["desc"])) { $desc=true; $smarty->assign("desc","&desc=yes"); } else { $desc=false; $smarty->assign("desc",""); } $smarty->assign("order",$order); $hrefs=$structure->getLinksByCat($rubric["id_cat"],$page,$settings["onpage"],false,$order,$desc,$sql_dop); if ($settings["showviphrefs"]) { $viphrefs=$structure->getLinksByCat($rubric["id_cat"],$page,$settings["onpage"],true); $smarty->assign("viphrefs",@$viphrefs); } $smarty->assign("id_cat",$rubric["id_cat"]); $allstats=$structure->getAllStatsByCat($rubric["id_cat"],1,0,5,true,true); $smarty->assign("stats",$allstats); $allposts=$structure->getPostsByCat($rubric["id_cat"],0,10); $smarty->assign("allposts",$allposts); $smarty->assign("pages",@$pages_arr); $smarty->assign("cnt_links",$cnt); $smarty->assign("page",$page); $smarty->assign("hrefs",$hrefs); $smarty->assign("rubric",$rubric); } else { $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); $rubr="index"; } } else { $rubr="index"; } } break; case "top100": $rubr="top100"; $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); $content_tpl=$content_pth."content/top100.content.tpl"; if (!isset($_REQUEST["viewby"])) { $viewby=20; } else { $viewby=$_REQUEST["viewby"]; if (!eregi("^[0-9]{1,}",$viewby)) { $viewby=20; } } if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss_main=$structure->readMainRss(true); } else { $rss_main=$structure->readMainRss(false); } if (is_array($rss_main)) $smarty->assign("rssnews_main",$rss_main); } $smarty->assign("viewby",$viewby); $topType=@$_REQUEST["topType"]; switch ($topType) { case 1: //просмотры $topviews=$structure->getTopHrefs($viewby); $smarty->assign("top",$topviews); break; case 2: //переходы $topvisitors=$structure->getTopHrefs($viewby,2); $smarty->assign("top",$topvisitors); break; case 3: //хосты $topsites=$structure->getTopSites($viewby,1); $smarty->assign("top",$topsites); break; case 4: //хиты $topsites=$structure->getTopSites($viewby,2); $smarty->assign("top",$topsites); break; case 5: //тИЦ $toptic=$structure->getTopHrefs($viewby,3); $smarty->assign("top",$toptic); break; case 6: //PageRank $toppr=$structure->getTopHrefs($viewby,4); $smarty->assign("top",$toppr); break; case 7: //оценка $topots=$structure->getTopHrefs($viewby,5); $smarty->assign("top",$topots); break; case 8: //количество голосов $topvoters=$structure->getTopHrefs($viewby,6); $smarty->assign("top",$topvoters); break; case 9: //самые новые $topadd=$structure->getTopHrefs($viewby,7); $smarty->assign("top",$topadd); break; case 10: //самые старые $topadd=$structure->getTopHrefs($viewby,8); $smarty->assign("top",$topadd); break; case 21: //просмотры статей $topviews=$structure->getTopStats($viewby); $smarty->assign("top",$topviews); break; case 22: //оценка статей $topots=$structure->getTopStats($viewby,2); $smarty->assign("top",$topots); break; case 23: //количество голосов статей $topvoters=$structure->getTopStats($viewby,3); $smarty->assign("top",$topvoters); break; case 24: //количество голосов статей $topadd=$structure->getTopStats($viewby,4); $smarty->assign("top",$topadd); break; case 25: //количество голосов статей $topadd=$structure->getTopStats($viewby,5); $smarty->assign("top",$topadd); break; case 31: //самые дешевые $topposts=$structure->getTopPosts($viewby); $smarty->assign("top",$topposts); break; case 32: //самые дорогие $topposts=$structure->getTopPosts($viewby,2); $smarty->assign("top",$topposts); break; case 33: //самые старый $topposts=$structure->getTopPosts($viewby,3); $smarty->assign("top",$topposts); break; case 34: //самые новые $topposts=$structure->getTopPosts($viewby,4); $smarty->assign("top",$topposts); break; default: $topType=1; $topsites=$structure->getTopHrefs($viewby); $smarty->assign("top",$topsites); } $smarty->assign("topType",$topType); break; case "pay": $rubr="pay"; $content_tpl=$content_pth."content/pay.content.tpl"; $for_stat="Попытка оплаты ссылки или статьи"; //проверка корректности платежа $str=$settings["wmz"]; $str.=@$_REQUEST["LMI_PAYMENT_AMOUNT"]; $str.=@$_REQUEST["LMI_PAYMENT_NO"]; $str.=@$_REQUEST["LMI_MODE"]; $str.=@$_REQUEST["LMI_SYS_INVS_NO"]; $str.=@$_REQUEST["LMI_SYS_TRANS_NO"]; $str.=@$_REQUEST["LMI_SYS_TRANS_DATE"]; $str.=@$_REQUEST["LMI_PAYER_PURSE"]; $str.=@$_REQUEST["LMI_PAYER_WM"]; $hash=@$_REQUEST["LMI_HASH"]; $type=@$_REQUEST["type"]; $key=@$_REQUEST["key"]; if (@$_REQUEST["white"]==1) { $white=1; } else { $white=0; } $smarty->assign("white",$white); if (isset($_REQUEST["success"])) { switch ($type) { case "link": $for_stat="Сообщение об оплаченной ссылке"; $id_link=@$_REQUEST["id_link"]; if (eregi("^[0-9]{1,}$",$id_link)) { $link=$structure->getLinkByID($id_link); if (is_array($link)) { $smarty->assign("err","Ссылка ".$link["title"]." оплачена успешно"); } } break; case "article": $id_stat=@$_REQUEST["id_stat"]; $for_stat="Сообщение об оплаченной статье"; if (eregi("^[0-9]{1,}$",$id_stat)) { $stat=$structure->getStatByID($id_stat); if (is_array($stat)) { $smarty->assign("err","Статья ".$stat["link"]." оплачена успешно"); } } break; } } else { if (strtolower(md5($str))==strtolower($hash)) { //оплачен switch ($type) { case "link": //оплата ссылки $for_stat="Успешная оплата ссылки"; $id_link=@$_REQUEST["id_link"]; if (eregi("^[0-9]{1,}$",$id_link)) { $link=$structure->getLinkByID($id_link); if (is_array($link)) { $for_stat="Попытка оплаты ссылки ".$link["opis_url"]; if ($key==md5(md5($config["secretkey"]*100)."Оплата ссылки ".$link["id_link"]." стоимость ".$settings["price_link"].md5($config["secretkey"]-1))) { if ($link["pay"]==1) { $smarty->assign("err","Ссылка ".$link["title"]." уже была оплачена"); } else { $smarty->assign("err","Ссылка ".$link["title"]." оплачена"); $for_stat="Успешная оплата ссылки ".$link["opis_url"]; $vip_opl=""; $norobot_opl=""; if ($settings["vip_opl"]==1) $vip_opl=",vip=1"; if ($settings["norobot_opl"]==1) $norobot_opl=",norobot=1"; $db->query("update %LINKS% set pay=1 $vip_opl $norobot_opl where id_link=".$link["id_link"]); } $smarty->assign("link",$link); } } else { $smarty->assign("err","Ссылки не существует"); } } else { $smarty->assign("err","Неправильно указан идентификатор ссылки"); } break; case "article": //оплата статьи $for_stat="Успешная оплата статьи"; $id_stat=@$_REQUEST["id_stat"]; if (eregi("^[0-9]{1,}$",$id_stat)) { $stat=$structure->getStatByID($id_stat); if (is_array($stat)) { $srok=@$_REQUEST["srok"]; switch ($srok) { case 1: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок бессрочно".md5($config["secretkey"]-1)); $sr=0; $sr_txt="на бессрочный срок"; break; case 2: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок 7 дней".md5($config["secretkey"]-1)); $sr=7; $sr_txt="сроком на 7 дней"; break; case 3: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок 15 дней".md5($config["secretkey"]-1)); $sr=15; $sr_txt="сроком на 15 дней"; break; case 4: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок 30 дней".md5($config["secretkey"]-1)); $sr=30; $sr_txt="сроком на 30 дней"; break; case 5: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок 60 дней".md5($config["secretkey"]-1)); $sr=60; $sr_txt="сроком на 60 дней"; break; case 6: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок полгода".md5($config["secretkey"]-1)); $sr=182; $sr_txt="сроком на полгода"; break; case 7: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок год".md5($config["secretkey"]-1)); $sr=365; $sr_txt="сроком на год"; break; } $key=@$_REQUEST["key"]; if ($key==$skey) { if (isset($sr)) { if ($stat["pay"]==0) { $for_stat="Не оплачена статья ".$stat["link"]; if ($db->query("update %STAT% set pay=1 , `stat_type`=$sr , ban=0, visible=1 where id_stat=$id_stat")) { $smarty->assign("err","Статья ".$stat["link"]." оплачена $sr_txt"); $for_stat="Успешная оплата статьи ".$stat["link"]." $sr_txt"; } else { $for_stat="Ошибка выполнения SQL запроса для статьи ".$stat["link"]; $smarty->assign("err","Ошибка выполнения SQL запроса!"); } } else { $smarty->assign("err","Статья уже была оплачена!"); } } else { $for_stat="Не оплачена статья ".$stat["link"]; $smarty->assign("err","Ошибка при оплате"); } } else { $smarty->assign("err","Некорректный код проверки"); } } else { $smarty->assign("err","Статьи не существует"); } } else { $smarty->assign("err","Неправильно указан идентификатор статьи"); } break; } } else { //не оплачен switch ($type) { case "link": $for_stat="Неуспешная оплата ссылки [технический заход]"; $id_link=@$_REQUEST["id_link"]; if (eregi("^[0-9]{1,}$",$id_link)) { $link=$structure->getLinkByID($id_link); if (is_array($link)) { if (isset($_REQUEST["failed"])) { $for_stat="Не оплачена ссылка ".$link["opis_url"]; if ($settings["delete_no_opl"]==1) { $for_stat="Ссылка удалена за неоплату (".$link["url"].")"; $db->query("DELETE from %LINKS% where id_link=$id_link"); $smarty->assign("err","Ссылка ".$link["url"]." была удалена за неоплату"); } else { $for_stat="Ссылка ".$link["url"]." не оплачена"; $smarty->assign("err","Ссылка ".$link["url"]." не оплачена"); } $smarty->assign("link",$link); } } else { $smarty->assign("err","Ссылки не существует"); } } else { $smarty->assign("err","Неправильно указан идентификатор ссылки"); } break; case "article": $id_stat=@$_REQUEST["id_stat"]; $for_stat="Неуспешная оплата статьи [технический заход]"; if (eregi("^[0-9]{1,}$",$id_stat)) { $stat=$structure->getStatByID($id_stat); if (is_array($stat)) { if (isset($_REQUEST["failed"])) { $srok=@$_REQUEST["srok"]; switch ($srok) { case 1: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок бессрочно".md5($config["secretkey"]-1)); $sr=0; $sr_txt="на бессрочный срок"; break; case 2: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок 7 дней".md5($config["secretkey"]-1)); $sr=7; $sr_txt="сроком на 7 дней"; break; case 3: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок 15 дней".md5($config["secretkey"]-1)); $sr=15; $sr_txt="сроком на 15 дней"; break; case 4: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок 30 дней".md5($config["secretkey"]-1)); $sr=30; $sr_txt="сроком на 30 дней"; break; case 5: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок 60 дней".md5($config["secretkey"]-1)); $sr=60; $sr_txt="сроком на 60 дней"; break; case 6: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок полгода".md5($config["secretkey"]-1)); $sr=182; $sr_txt="сроком на полгода"; break; case 7: $skey=md5(md5($config["secretkey"]*100)."Оплата размещения статьи ".$stat["id_stat"]." , на срок год".md5($config["secretkey"]-1)); $sr=365; $sr_txt="сроком на год"; break; } $key=@$_REQUEST["key"]; if ($key==$skey) { if (isset($sr)) { $for_stat="Не оплачена статья ".$stat["link"]; $smarty->assign("err","Статья ".$stat["link"]." не оплачена $sr_txt"); if ($settings["delete_no_opl_stat"]) { if ($db->query("DELETE from %STAT% where id_stat=$id_stat")) { $smarty->assign("err","Статья ".$stat["caption"]." не оплачена $sr_txt и удалена"); $for_stat="Неуспешная оплата статьи ".$stat["caption"]." $sr_txt , статья удалена"; } } else { $smarty->assign("err","Неуспешная оплата статьи ".$stat["caption"]." $sr_txt"); } } else { $for_stat="Не оплачена статья ".$stat["link"]; $smarty->assign("err","Ошибка при оплате"); } } else { $smarty->assign("err","Некорректный код проверки"); } } } else { $smarty->assign("err","Статьи не существует"); } } else { $smarty->assign("err","Неправильно указан идентификатор статьи"); } break; } } } $smarty->assign("type",$type); break; case "news": $rubr="news"; $content_tpl=$content_pth."content/news.content.tpl"; $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); $for_stat="Пользователь просматривал список новостей"; $open_news=false; if (isset($_REQUEST["id2"])) { $id2=@$_REQUEST["id2"]; if (eregi("^[0-9]{1,}$",$id2)) { $news=$structure->getNewsByID($id2); if (is_array($news)) { $open_news=true; $for_stat="Пользователь просматривал новость [".$news["title"]."]"; $smarty->assign("news",$news); } } } if ($open_news) { $allnews=$structure->getAllNews($id2); $rubric=$news; } else { $cnt=$structure->getCountNews(); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($pages_arr)) $smarty->assign("pages",$pages_arr); $smarty->assign("page",$page); $allnews=$structure->getAllNews(0,$page); } $smarty->assign("open_news",$open_news); $smarty->assign("allnews",$allnews); break; case $settings["add_prefix"].$config["secretkey"]: $rubr="add_hide"; $content_tpl=$content_pth."content/add_link_hide.content.tpl"; //добавление ссылки $rubric["title"]="Добавление ссылки"; $white=0; $smarty->assign("white",$white); include ($config["modules_path"]."add_client_hide.mod.php"); break; case $settings["addstat_prefix"].$config["secretkey"]: $rubr="addstat_hide"; $content_tpl=$content_pth."content/add_stat_hide.content.tpl"; //добавление статьи $rubric["title"]="Добавление статьи"; $white=0; $smarty->assign("white",$white); include ($config["modules_path"]."add_stat_hide.client.mod.php"); break; case "register": $rubr="register"; $content_tpl=$content_pth."content/register.content.tpl"; //регистрация пользователя $rubric["title"]="Регистрация пользователя"; if (is_file($config["modules_path"].$settings["theme"]."/register.mod.php")) { include ($config["modules_path"].$settings["theme"]."/register.mod.php"); } else { echo "couldn't find file ".$config["modules_path"].$settings["theme"]."/register.mod.php"; } break; case $settings["addfirm_prefix"]: $rubr="addfirm"; $content_tpl=$content_pth."content/add_firm.content.tpl"; if ($settings["addfirmoff"]==0) { //добавление объявления $rubric["title"]="Добавление фирмы"; if (@$_REQUEST["white"]==1) { $white=1; } else { $white=0; } $smarty->assign("white",$white); if (is_file($config["modules_path"].$settings["theme"]."/add_firm.mod.php")) { include ($config["modules_path"].$settings["theme"]."/add_firm.mod.php"); } else { echo "couldn't find file ".$config["modules_path"].$settings["theme"]."/add_firm.mod.php"; } } break; case "my": $rubr="my"; $content_tpl=$content_pth."content/my.content.tpl"; $rubric["title"]="Личный кабинет"; if (is_file($config["modules_path"].$settings["theme"]."/my.mod.php")) { include ($config["modules_path"].$settings["theme"]."/my.mod.php"); } else { echo "couldn't find file ".$config["modules_path"].$settings["theme"]."/my.mod.php"; } break; case $settings["post_prefix"]: $rubr="post"; $content_tpl=$content_pth."content/post.content.tpl"; if ($settings["postoff"]==0) { //добавление объявления $rubric["title"]="Добавление объявления"; if (@$_REQUEST["white"]==1) { $white=1; } else { $white=0; } $smarty->assign("white",$white); if (is_file($config["modules_path"].$settings["theme"]."/post_client.mod.php")) { include ($config["modules_path"].$settings["theme"]."/post_client.mod.php"); } else { echo "couldn't find file ".$config["modules_path"].$settings["theme"]."/post_client.mod.php"; } } break; case $settings["add_prefix"]: $rubr="add"; $content_tpl=$content_pth."content/add_link.content.tpl"; if ($settings["addoff"]==0) { //добавление ссылки $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); $rubric["title"]="Добавление ссылки"; if (@$_REQUEST["white"]==1) { $white=1; } else { $white=0; } $smarty->assign("white",$white); if (is_file($config["modules_path"].$settings["theme"]."/add_client.mod.php")) { include ($config["modules_path"].$settings["theme"]."/add_client.mod.php"); } else { echo "couldn't find file ".$config["modules_path"].$settings["theme"]."/add_client.mod.php"; } } break; case $settings["addstat_prefix"]: $rubr="addstat"; $content_tpl=$content_pth."content/add_stat.content.tpl"; if ($settings["addstatoff"]==0) { //добавление статьи $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); $rubric["title"]="Добавление пользователем статьи"; if (@$_REQUEST["white"]==1) { $white=1; } else { $white=0; } $smarty->assign("white",$white); if (is_file($config["modules_path"].$settings["theme"]."/add_stat.client.mod.php")) { include ($config["modules_path"].$settings["theme"]."/add_stat.client.mod.php"); } else { echo "couldn't find file ".$config["modules_path"].$settings["theme"]."/add_stat.client.mod.php"; } } break; case $settings["stat_prefix"]: case "stat": $rubr="stat"; $content_tpl=$content_pth."content/stat.content.tpl"; if ($settings["statoff"]==0) { $open_stat=false; if (isset($_REQUEST["id_child"])) { $id_child=$_REQUEST["id_child"]; if (eregi("^[0-9]{1,}$",$id_child)) { if (!$structure->existRubric($id_child)) { $id_child=0; } } else { if (eregi("^[-a-zA-Z0-9_]{1,}$",$id_child)) { $rubric=$structure->getRubricByIdent($id_child); $id_child=$rubric["id_cat"]; unset($rubric); } else { $id_child=0; } } } else { $id_child=0; if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readMainRss(true); } else { $rss=$structure->readMainRss(false); } $smarty->assign("rssnews",$rss); } } $sql_dop=""; if ($id_child!=0) { $rubric=$structure->getRubricByID($id_child); $hrefs=$structure->getLinksByCat($rubric["id_cat"],0,10); $smarty->assign("hrefs",$hrefs); $allposts=$structure->getPostsByCat($rubric["id_cat"],0,10); $smarty->assign("allposts",$allposts); $smarty->assign("rubric",$rubric); if ($settings["viewsub"]) { if ($settings["ogrsub"]) { $subrubrics=$structure->getRubricsTree($id_child,1,array(),true,$settings["viewsubnum"],0,false,2); } else { $subrubrics=$structure->getRubricsTree($id_child,1,array(),false,0,0,false,2); } if (is_array($subrubrics)) $smarty->assign("subrubrics",$subrubrics); if ($rubric["id_child_cat"]==0) { if (isset($subrubrics[$rubric["id_cat"]])) { foreach($subrubrics[$rubric["id_cat"]] as $rubr2) { $sql_dop.=" or id_cat=".$rubr2["id_cat"]; if (isset($subrubrics[$rubr2["id_cat"]])) foreach($subrubrics[$rubr2["id_cat"]] as $rubr3) { $sql_dop.=" or id_cat=".$rubr3["id_cat"]; } } } } } } else { if ($settings["ogrmain"]) { $rubrics=$structure->getRubricsTree($id_child,1,array(),true,$settings["ogrmainnum"],0,false,2); } else { $rubrics=$structure->getRubricsTree($id_child,1,array(),false,0,0,false,2); } $smarty->assign("rubrics",$rubrics); } $rubric_path=$structure->getPath($id_child); $smarty->assign("rubric_path",$rubric_path); $smarty->assign("id_child",$id_child); $banner=$structure->getDefaultBanner(); $smarty->assign("banner",$banner); if (isset($_REQUEST["id2"])) { $id2=@$_REQUEST["id2"]; if (eregi("^[0-9]{1,}$",$id2)) { $stat=$structure->getStatByID($id2,true); $rubric=$structure->getRubricByID($stat["id_cat"]); $rubric_path=$structure->getPath($stat["id_cat"]); $smarty->assign("rubric_path",$rubric_path); if (is_array($stat)) { $ajax_httpdir=$_SESSION["fckpath"]."modules/xajax/"; require ($config["modules"]["ajax"]); $xajax = new xajax(); $xajax->debugOff(); $xajax->registerFunction("votestat"); $xajax->processRequests(); $smarty->assign("ajax",$xajax->getJavascript($ajax_httpdir)); $allposts=$structure->getPostsByCat($rubric["id_cat"],0,10); $smarty->assign("allposts",$allposts); /*комментарии*/ if ($settings["comments_off"]==0) { $comment_count=0; $comments=$structure->getComments($stat["id_stat"],"stat",$comment_count); $smarty->assign("comments",$comments); $smarty->assign("comments_count",$comment_count); $commentMode="stat"; include ($config["modules_path"]."addcomment.inc.php"); } /*комментарии*/ if ($settings["viewsub"]) { if ($settings["ogrsub"]) { $subrubrics=$structure->getRubricsTree($stat["id_cat"],1,array(),true,$settings["viewsubnum"],0,false,2); } else { $subrubrics=$structure->getRubricsTree($stat["id_cat"],1,array(),false,0,0,false,2); } if (is_array($subrubrics)) $smarty->assign("subrubrics",$subrubrics); } $open_stat=true; $for_stat="Пользователь просматривал статью [".$stat["caption"]."]"; //$rubric=$stat; $hrefs=$structure->getLinksByCat($stat["id_cat"],0,10); $smarty->assign("hrefs",$hrefs); $smarty->assign("id_child",$stat["id_cat"]); $smarty->assign("rubric",$rubric); $smarty->assign("stat",$stat); $db->query("update %STAT% set views=views+1 where id_stat=".$stat["id_stat"]); $topstats=$structure->getTopStatsByCat($stat["id_cat"],10); $smarty->assign("topstats",$topstats); } } } if ($settings["showrss"]) { if (isset($rubric)) { if ($settings["rsslimit"]) { $rss=$structure->readCatRss(true,$rubric["id_cat"]); $rss_main=$structure->readMainRss(true); } else { $rss=$structure->readCatRss(false,$rubric["id_cat"]); $rss_main=$structure->readMainRss(false); } if (is_array($rss)) $smarty->assign("rssnews",$rss); if (is_array($rss_main)) $smarty->assign("rssnews_main",$rss_main); } if ($settings["showviphrefs"]) { if ($settings["showvipinstats"]) { $viphrefs=$structure->getLinksByCat(@$rubric["id_cat"],1,10,true); $smarty->assign("viphrefs",@$viphrefs); } } } if (!$open_stat) { if (isset($rubric)) { $cnt=$structure->getCountStatsEx($rubric["id_cat"],$sql_dop); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($_REQUEST["order"])) { $order=$_REQUEST["order"]; } else { $order="sort"; $_REQUEST["desc"]=true; } $smarty->assign("order",$order); if (isset($_REQUEST["desc"])) { $desc=true; $smarty->assign("desc","&desc=yes"); } else { $desc=false; $smarty->assign("desc",""); } $allstats=$structure->getAllStatsByCat($id_child,1,$page,$settings["onpage"],true,true,$order,$desc,$sql_dop); $topstats=$structure->getTopStatsByCat($rubric["id_cat"],10); $smarty->assign("topstats",$topstats); $smarty->assign("stats",$allstats); $smarty->assign("pages",@$pages_arr); $smarty->assign("cnt_links",$cnt); $smarty->assign("page",$page); $smarty->assign("id_cat",$rubric["id_cat"]); } else { $cnt=$structure->getCountStatsIndex($sql_dop); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($_REQUEST["order"])) { $order=$_REQUEST["order"]; } else { $order="stat_date"; $_REQUEST["desc"]=true; } $smarty->assign("order",$order); if (isset($_REQUEST["desc"])) { $desc=true; $smarty->assign("desc","&desc=yes"); } else { $desc=false; $smarty->assign("desc",""); } $allstats=$structure->getAllStatsIndex(1,$page,$settings["onpage"],true,true,$order,$desc,$sql_dop); $smarty->assign("stats",$allstats); $smarty->assign("pages",@$pages_arr); $smarty->assign("cnt_links",$cnt); $smarty->assign("page",$page); } } if (!$open_stat) { $for_stat="Просмотр статей"; } else { $for_stat="Просмотр статьи ".$stat["caption"]; } if ($id_child!=0) { if (empty($rubric["metatags"])) $rubric["metatags"]=$settings["metatags"]; if (empty($rubric["metakeywords"])) $rubric["metakeywords"]=$settings["metakeywords"]; } else { $rubric["titletag"]=$settings["titletag"]; $rubric["metatags"]=$settings["metatags"]; $rubric["metakeywords"]=$settings["metakeywords"]; } $smarty->assign("open_stat",$open_stat); } break; case "to": $url=@$_REQUEST["url"]; $db->query("update %LINKS% set visitors=visitors+1 where url='".getDomainEx($url)."'"); if (eregi("^(http|https)+(:\/\/)+[a-z0-9_-]+\.+[a-z0-9_-]",$url)) { ?> fetch($content_tpl); } else { $content="not loaded $content_tpl : file not exists"; } $smarty->assign("content",$content); } $smarty->assign("rubr",$rubr); if ($rubr!="admin") { //var_dump($rubric_path); if (!isset($rubric_path)) $rubric_path=array(); if ($settings["ogrmain"]) { $rubrics=$structure->getRubricsTree(0,1,$rubric_path,true,$settings["ogrmainnum"],0,true,1); } else { $rubrics=$structure->getRubricsTree(0,1,$rubric_path,false,0,0,true,1); } //var_dump($rubrics); $smarty->assign("rubrics",$rubrics); } switch ($rubr) { case "admin": if (serial($config["serial"])) { $tpl="admin/admin.tpl.html"; if (!@$_SESSION["auth"]) { $for_stat="Вход в административный интерфейс"; $login=@$_REQUEST["login"]; $password=@$_REQUEST["password"]; $user=array(); if (auth($login,md5($password.$config["secretkey"]),$user)) { $_SESSION["auth"]=true; $_SESSION["login"]=$login; $_SESSION["password"]=md5($password.$config["secretkey"]); $user["access"]="root"; $smarty->assign("auth",true); $smarty->assign("entered",true); $countcatalogs=$structure->getCountCatalogs(); $smarty->assign("countcatalogs",$countcatalogs); } else { if (auth2($login,md5($config["secretkey"].$password),$user)) { $user["access"]="user"; $_SESSION["auth"]=true; $_SESSION["login"]=$login; $_SESSION["password"]=md5($config["secretkey"].$password); $smarty->assign("auth",true); $smarty->assign("entered",true); $countcatalogs=$structure->getCountCatalogs(); $smarty->assign("countcatalogs",$countcatalogs); } else { if ($login!='') $for_stat="Неверный вход в административный интерфейс [логин: $login, пароль: $password]"; $stat_warn=true; if ((!empty($login)) || (!empty($password))) $error="Неверный логин и\или пароль!"; } } } else { $countcatalogs=$structure->getCountCatalogs(); $smarty->assign("countcatalogs",$countcatalogs); $smarty->assign("entered",false); $user1=array(); $user=array(); $user["access"]=""; if ((auth($_SESSION["login"],$_SESSION["password"],$user1)) || ($is_remote)) { $user=$user1; if ($is_remote) { $user["access"]="root"; } $user["viewhrefs"]=1; $user["viewstats"]=1; $user["viewnews"]=1; $user["viewbanners"]=1; $user["viewrss"]=1; $user["viewbackhrefs"]=1; } if ((auth2($_SESSION["login"],$_SESSION["password"],$user1))) { $user=$user1; } if ((is_array(@$user)) || ($is_remote==true)) { $smarty->assign("auth",true); $module=@$_REQUEST["module"]; $denied=true; switch ($module) { case "add": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; if (is_file($config["modules_dir"]."add.mod.php")) { include($config["modules_dir"]."add.mod.php"); } } break; case "counters": if ($user["access"]=="root") { $denied=false; $rubric["title"]=$lang["counters"]; $rubric["ident"]="counters"; if (is_file($config["modules_dir"]."counters.mod.php")) { include($config["modules_dir"]."counters.mod.php"); } } break; case "autorss": if ($user["access"]=="root") { $denied=false; $rubric["title"]=$lang["autorss"]; $rubric["ident"]="autorss"; if (is_file($config["modules_dir"]."autorss.mod.php")) { include($config["modules_dir"]."autorss.mod.php"); } } break; case "addmulti": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; if (is_file($config["modules_dir"]."addmulti.mod.php")) { include($config["modules_dir"]."addmulti.mod.php"); } } break; case "addmulti2": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; if (is_file($config["modules_dir"]."addmulti2.mod.php")) { include($config["modules_dir"]."addmulti2.mod.php"); } } break; case "catalogs": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["catalogs"]; $rubric["ident"]="catalogs"; if (is_file($config["modules_dir"]."catalogs.mod.php")) { include($config["modules_dir"]."catalogs.mod.php"); } } break; case "pages": if (($user["access"]=="root") || (@$user["viewhrefs"]) || ($user["viewstats"])) { $denied=false; $rubric["title"]=$lang["pages"]; $rubric["ident"]="pages"; if (is_file($config["modules_dir"]."pages.mod.php")) { include($config["modules_dir"]."pages.mod.php"); } } break; case "catalog": if (($user["access"]=="root") || (@$user["viewhrefs"]) || ($user["viewstats"])) { $denied=false; $rubric["title"]=$lang["catalog"]; $rubric["ident"]="catalog"; if (is_file($config["modules_dir"]."catalog.mod.php")) { include($config["modules_dir"]."catalog.mod.php"); } } break; case "image_catalog": if (($user["access"]=="root") || (@$user["viewhrefs"]) || ($user["viewstats"])) { $denied=false; $rubric["title"]=$lang["image_catalog"]; $rubric["ident"]="image_catalog"; $for_stat="Попытка изменения иконки каталога \ просмотр иконки"; if (is_file($config["modules_dir"]."image_catalog.mod.php")) { include($config["modules_dir"]."image_catalog.mod.php"); } } break; case "autoinstall": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["autoinstall"]; $rubric["ident"]="autoinstall"; $for_stat="Вход в автоустановку каталогов"; if (is_file($config["modules_dir"]."autoinstall.mod.php")) { include($config["modules_dir"]."autoinstall.mod.php"); } } break; case "export": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["export"]; $rubric["ident"]="export"; if (is_file($config["modules_dir"]."export.mod.php")) { include($config["modules_dir"]."export.mod.php"); } } break; case "integration": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["integration"]; $rubric["ident"]="integration"; if (is_file($config["modules_dir"]."integration.mod.php")) { include($config["modules_dir"]."integration.mod.php"); } } break; case "comments": if (($user["access"]=="root") || (@$user["viewhrefs"]) || ($user["viewstats"])) { $denied=false; $rubric["title"]=$lang["comments"]; $rubric["ident"]="comments"; if (is_file($config["modules_dir"]."comments.mod.php")) { include($config["modules_dir"]."comments.mod.php"); } } break; case "support": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["support"]; $rubric["ident"]="support"; if (is_file($config["modules_dir"]."support.mod.php")) { include($config["modules_dir"]."support.mod.php"); } } break; case "users": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["users"]; $rubric["ident"]="users"; $for_stat="Просмотр списка пользователей"; if (is_file($config["modules_dir"]."users.mod.php")) { include($config["modules_dir"]."users.mod.php"); } } break; case "catalogusers": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["catalogusers"]; $rubric["ident"]="catalogusers"; $for_stat="Просмотр списка пользователей"; if (is_file($config["modules_dir"]."catalogusers.mod.php")) { include($config["modules_dir"]."catalogusers.mod.php"); } } break; case "add_user": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["add_user"]; $rubric["ident"]="add_user"; if (is_file($config["modules_dir"]."add_user.mod.php")) { include($config["modules_dir"]."add_user.mod.php"); } } break; case "mailsettings": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["mailsettings"]; $rubric["ident"]="mailsettings"; $for_stat="Просмотр писем"; if (is_file($config["modules_dir"]."mailsettings.mod.php")) { include($config["modules_dir"]."mailsettings.mod.php"); } } break; case "adversting": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["adversting"]; $rubric["ident"]="adversting"; $for_stat="Просмотр рекламных дополнений"; if (is_file($config["modules_dir"]."adversting.mod.php")) { include($config["modules_dir"]."adversting.mod.php"); } } break; case "sitetemplate": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["sitetemplate"]; $rubric["ident"]="sitetemplate"; $for_stat="Просмотр шаблонов каталога"; if (is_file($config["modules_dir"]."sitetemplate.mod.php")) { include($config["modules_dir"]."sitetemplate.mod.php"); } } break; case "vip": if (($user["access"]=="root") || (@$user["viewbanners"])) { $denied=false; $rubric["title"]=$lang["vip"]; $rubric["ident"]="vip"; if (is_file($config["modules_dir"]."vip.mod.php")) { include($config["modules_dir"]."vip.mod.php"); } } break; case "settings": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["settings"]; $rubric["ident"]="settings"; if (is_file($config["modules_dir"]."settings.mod.php")) { include($config["modules_dir"]."settings.mod.php"); } } break; case "add_post": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["add_post"]; $rubric["ident"]="add_post"; if (is_file($config["modules_dir"]."add_post.mod.php")) { include($config["modules_dir"]."add_post.mod.php"); } } break; case "add_firm": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["add_firm"]; $rubric["ident"]="add_firm"; if (is_file($config["modules_dir"]."add_firm.mod.php")) { include($config["modules_dir"]."add_firm.mod.php"); } } break; case "firms": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["firms"]; $rubric["ident"]="firms"; if (is_file($config["modules_dir"]."firms.mod.php")) { include($config["modules_dir"]."firms.mod.php"); } } break; case "posts": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["posts"]; $rubric["ident"]="posts"; if (is_file($config["modules_dir"]."posts.mod.php")) { include($config["modules_dir"]."posts.mod.php"); } } break; case "links": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["links"]; $rubric["ident"]="links"; if (is_file($config["modules_dir"]."links.mod.php")) { include($config["modules_dir"]."links.mod.php"); } } break; case "delete_catalog": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["delete_catalog"]; $rubric["ident"]="catalog"; if (is_file($config["modules_dir"]."delete_catalog.mod.php")) { include($config["modules_dir"]."delete_catalog.mod.php"); } } break; case "changepassword": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["changepassword"]; $rubric["ident"]="changepassword"; if (is_file($config["modules_dir"]."changepassword.mod.php")) { include($config["modules_dir"]."changepassword.mod.php"); } } break; case "edit_catalog": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["edit_catalog"]; $rubric["ident"]="catalog"; if (is_file($config["modules_dir"]."edit_catalog.mod.php")) { include($config["modules_dir"]."edit_catalog.mod.php"); } } break; case "robot": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["robot"]; $rubric["ident"]="robot"; $for_stat="Просмотр результатов робота"; if (is_file($config["modules_dir"]."robot.mod.php")) { include($config["modules_dir"]."robot.mod.php"); } } break; case "rss": if (($user["access"]=="root") || (@$user["viewrss"])) { $denied=false; $rubric["title"]=$lang["rss"]; $rubric["ident"]="rss"; $for_stat="Настройка rss каналов"; if (is_file($config["modules_dir"]."rss.mod.php")) { include($config["modules_dir"]."rss.mod.php"); } } break; case "backhrefs": if (($user["access"]=="root") || (@$user["viewbackhrefs"])) { $denied=false; $rubric["title"]=$lang["backhrefs"]; $rubric["ident"]="backhrefs"; $for_stat="Управление обратными ссылками"; if (is_file($config["modules_dir"]."backhrefs.mod.php")) { include($config["modules_dir"]."backhrefs.mod.php"); } } break; case "add_catalog": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["add_catalog"]; $rubric["ident"]="catalog"; if (is_file($config["modules_dir"]."add_catalog.mod.php")) { include($config["modules_dir"]."add_catalog.mod.php"); } } break; case "add_link": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["add_link"]; $rubric["ident"]="add_link"; if (is_file($config["modules_dir"]."add_link.mod.php")) { include($config["modules_dir"]."add_link.mod.php"); } } break; case "edit_link": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["edit_link"]; $rubric["ident"]="catalog"; if (is_file($config["modules_dir"]."edit_link.mod.php")) { include($config["modules_dir"]."edit_link.mod.php"); } } break; case "delete_link": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["delete_link"]; $rubric["ident"]="catalog"; if (is_file($config["modules_dir"]."delete_link.mod.php")) { include($config["modules_dir"]."delete_link.mod.php"); } } break; case "ban": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["ban"]; $rubric["ident"]="ban"; if (is_file($config["modules_dir"]."ban.mod.php")) { include($config["modules_dir"]."ban.mod.php"); } } break; case "last_links": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["last_links"]; $rubric["ident"]="last_links"; $for_stat="Просмотр последних ссылок [адм.]"; if (is_file($config["modules_dir"]."last_links.mod.php")) { include($config["modules_dir"]."last_links.mod.php"); } } break; case "news": if (($user["access"]=="root") || (@$user["viewnews"])) { $denied=false; $rubric["title"]=$lang["news"]; $rubric["ident"]="news"; $for_stat="Просмотр списка новостей [адм.]"; if (is_file($config["modules_dir"]."news.mod.php")) { include($config["modules_dir"]."news.mod.php"); } } break; case "add_news": if (($user["access"]=="root") || (@$user["viewnews"])) { $denied=false; $rubric["title"]=$lang["add_news"]; $rubric["ident"]="news"; if (is_file($config["modules_dir"]."add_news.mod.php")) { include($config["modules_dir"]."add_news.mod.php"); } } break; case "edit_news": if (($user["access"]=="root") || (@$user["viewnews"])) { $denied=false; $rubric["title"]=$lang["edit_news"]; $rubric["ident"]="news"; if (is_file($config["modules_dir"]."edit_news.mod.php")) { include($config["modules_dir"]."edit_news.mod.php"); } } break; case "delete_news": if (($user["access"]=="root") || (@$user["viewnews"])) { $denied=false; $rubric["title"]=$lang["delete_news"]; $rubric["ident"]="news"; if (is_file($config["modules_dir"]."delete_news.mod.php")) { include($config["modules_dir"]."delete_news.mod.php"); } } break; case "stat": if (($user["access"]=="root") || (@$user["viewstats"])) { $denied=false; $rubric["title"]=$lang["stat"]; $rubric["ident"]="stat"; $for_stat="Просмотр списка статей [адм.]"; if (is_file($config["modules_dir"]."stats.mod.php")) { include($config["modules_dir"]."stats.mod.php"); } } break; case "add_stat": if (($user["access"]=="root") || (@$user["viewstats"])) { $denied=false; $rubric["title"]=$lang["add_stat"]; $rubric["ident"]="add_stat"; if (is_file($config["modules_dir"]."add_stat.mod.php")) { include($config["modules_dir"]."add_stat.mod.php"); } } break; case "edit_stat": if (($user["access"]=="root") || (@$user["viewstats"])) { $denied=false; $rubric["title"]=$lang["edit_stat"]; $rubric["ident"]="stat"; if (is_file($config["modules_dir"]."edit_stat.mod.php")) { include($config["modules_dir"]."edit_stat.mod.php"); } } break; case "delete_stat": if (($user["access"]=="root") || (@$user["viewstats"])) { $denied=false; $rubric["title"]=$lang["delete_stat"]; $rubric["ident"]="stat"; if (is_file($config["modules_dir"]."delete_stat.mod.php")) { include($config["modules_dir"]."delete_stat.mod.php"); } } break; case "save_structure": if (($user["access"]=="root") || (@$user["viewhrefs"])) { $denied=false; $rubric["title"]=$lang["save_structure"]; $rubric["ident"]="catalog"; $for_stat="Сортировка рубрик"; if (is_file($config["modules_dir"]."save_structure.mod.php")) { include($config["modules_dir"]."save_structure.mod.php"); } } break; case "search": $rubric["title"]=$lang["search"]; $rubric["ident"]="search"; $denied=false; $for_stat="Поиск ссылки"; if (is_file($config["modules_dir"]."search.mod.php")) { include($config["modules_dir"]."search.mod.php"); } break; case "mailbase": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["mailbase"]; $rubric["ident"]="mailbase"; $for_stat="Составление рассылки"; if (is_file($config["modules_dir"]."mailbase.mod.php")) { include($config["modules_dir"]."mailbase.mod.php"); } } break; case "statistic": if (($user["access"]=="root")) { $denied=false; $rubric["title"]=$lang["statistic"]; $rubric["ident"]="statistic"; $for_stat="Просмотр статистики"; if (is_file($config["modules_dir"]."statistic.mod.php")) { include($config["modules_dir"]."statistic.mod.php"); } } break; case "update": $denied=false; $rubric["title"]=$lang["update"]; $rubric["ident"]="update"; $for_stat="Просмотр обновлений"; if (is_file($config["modules_dir"]."update.mod.php")) { include($config["modules_dir"]."update.mod.php"); } break; case "exit": $denied=false; $for_stat="Выход из административного интерфейса"; $smarty->assign("entered",false); $_SESSION["auth"]=false; unset($_SESSION["login"]); unset($_SESSION["password"]); $smarty->assign("auth",false); break; default: $denied=false; $rubric["title"]=$lang["adm"]; $for_stat="Просмотр главной страницы административного интерфейса"; if (is_file($config["modules_dir"]."adm.mod.php")) { include($config["modules_dir"]."adm.mod.php"); } break; } $smarty->assign("denied",$denied); } else { $for_stat="Неудачная попытка авторизации в адм. области"; $stat_warn=1; $smarty->assign("auth",false); $_SESSION["auth"]=false; } } } else { die("Введен некорректный серийный номер программы!"); } break; case "index": if ($settings["index_links"]) { $cnt=$structure->getCountLinksIndex(); $pages=ceil($cnt/$settings["onpage"]); for ($x=0;$x<=$pages-1;$x++) $pages_arr[]=$x; if (isset($_REQUEST["page"])) { $page=@$_REQUEST["page"]; if (!eregi("^[0-9]{1,}$",$page)) $page=0; if ($page>$pages) $page=0; if ($page<0) $page=0; } else { $page=0; } if (isset($_REQUEST["order"])) { $order=$_REQUEST["order"]; } else { $order="otsenka"; $_REQUEST["desc"]=true; } if (isset($_REQUEST["desc"])) { $desc=true; $smarty->assign("desc","&desc=yes"); } else { $desc=false; $smarty->assign("desc",""); } $smarty->assign("order",$order); $hrefs=$structure->getLinksByIndex($page,$settings["onpage"],false,$order,$desc); $smarty->assign("pages",@$pages_arr); $smarty->assign("cnt_links",$cnt); $smarty->assign("page",$page); $smarty->assign("hrefs",$hrefs); } $rubric["metatags"]=$settings["metatags"]; $rubric["metakeywords"]=$settings["metakeywords"]; $countcatalogs=$structure->getCountCatalogs(); $smarty->assign("countcatalogs",$countcatalogs); @$rubric["title"]=@$settings["title"]; $content_tpl=$content_pth."content/index.content.tpl"; $content=$smarty->fetch($content_tpl); $smarty->assign("content",$content); $banner=$structure->getDefaultBanner(); $for_stat="Просмотр главной страницы"; $smarty->assign("banner",$banner); if ($settings["showrss"]) { if ($settings["rsslimit"]) { $rss=$structure->readMainRss(true); } else { $rss=$structure->readMainRss(false); } $smarty->assign("rssnews",$rss); } $tpl=$config["user"]["index"]; break; case "stat": if ($id_child>0 || $open_stat) { $tpl=$config["user"]["page"]; } else { $tpl=$config["user"]["index"]; } break; default: $tpl=$config["user"]["page"]; break; } if (isset($rubric)) $smarty->assign("rubric",$rubric); $smarty->assign("rubr",$rubr); $rootpages=$structure->getSubPages(0); $smarty->assign("rootpages",$rootpages); if ($rubr!="admin") { if ($settings["showstat"]) { $laststats=$structure->getLastStats($settings["showstatnum"]); $smarty->assign("laststats",$laststats); } if ($settings["shownews"]) { $lastnews=$structure->getLastNews($settings["shownewsnum"]); $smarty->assign("lastnews",$lastnews); } if ($settings["showhrefs"]) { $lasthrefs=$structure->getLastHrefs($settings["showhrefsnum"],false); $smarty->assign("lasthrefs",$lasthrefs); } if ($settings["showposts"]) { $lastposts=$structure->getLastPosts($settings["showpostsnum"],false); $smarty->assign("lastposts",$lastposts); } if ($settings["showfirms"]) { $lastfirms=$structure->getLastFirms($settings["showfirmsnum"],false); $smarty->assign("lastfirms",$lastfirms); } } if ($settings["nostatistic"]==0) { writeStatistic(); $stat_info=$structure->getVariousStatistic($settings["year"],$settings["month"],$settings["day"]); $smarty->assign("stat_info",$stat_info); } if (isset($rubric)) $smarty->assign("rubric",$rubric); $smarty->assign("error",$error); //проверяем показать панельку или нет /* if ($rubr!='admin') { if (isset($_SESSION["auth"])) { $login=@$_SESSION["login"]; $password=@$_SESSION["password"]; $user=array(); if (auth($login,$password,$user)) { //показываем панельку админа switch ($rubr) { case "news": $countnews=$structure->getCountNews(); $smarty->assign("countnews",$countnews); } $smarty->display("admin/panel.tpl.html"); } } } */ if ($rubr!="admin") { if (is_dir($config["smarty"]["templatedir"]."themes/")) { if (is_dir($config["smarty"]["templatedir"]."themes/".$settings["theme"])) { $pth="themes/".$settings["theme"]."/"; } else { $pth="themes/default/"; } } else { die("Не найдена директория с шаблонами!"); } $smarty->assign("pth",noSlash($pth)); if (is_file($config["css"].$settings["theme"]."/style.css")) { $css=$smarty->fetch($config["css"].$settings["theme"]."/style.css"); } else { $css=""; } $smarty->assign("css",$css); $footer=$smarty->fetch($pth.$config["user"]["footer"]); $header=$smarty->fetch($pth.$config["user"]["header"]); $smarty->assign("footer",$footer); $smarty->assign("header",$header); $smarty->display($pth.$tpl); } else { $smarty->display($tpl); } if ($rubr!="admin") { if (date("Y-m-d")!=$settings["date_check"]) { $db->query("update %SETTINGS% set date_check='".$settings["year"]."-".$settings["month"]."-".$settings["day"]."'"); $db->query("delete from %SITESSTAT%"); } /*проверка роботом ссылок*/ if ($settings["robot_on"]) { $vip=""; if ($settings["robotcheckvip"]) { $vip=" and vip=0"; } $chck=true; if ($settings["robotonlyindex"]) { if (($rubr!="index") && ($rubr!="stat")) { $chck=false; } } if ($chck) { flush(); $r=$db->query("select * from %LINKS% where viewrobot=0 and norobot=0 $vip order by `update` DESC LIMIT 0,".$settings["robotchecknum"].""); if (mysql_num_rows($r)==0) { if (date("Y-m-d")!=$settings["date_check"]) { $db->query("update %SETTINGS% set date_check='".$settings["year"]."-".$settings["month"]."-".$settings["day"]."'"); $db->query("update %LINKS% set viewrobot=0 where viewrobot=1 and norobot=0 $vip"); $r=$db->query("select * from %LINKS% where viewrobot=0 and norobot=0 $vip LIMIT 0,".$settings["robotchecknum"]." order by `update` DESC"); } } if (date("Y-m-d")!=$settings["date_check"]) { while ($l=@mysql_fetch_array($r)) { $link=$l; $description=""; $action=$structure->checkRoboLink($link,$description); $structure->doRoboLink($link,$action,$description); } } else { $r=$db->query("select * from %LINKS% where viewrobot=0 and norobot=0 $vip and new=1 order by `update` DESC LIMIT 0,".$settings["robotchecknum"].""); while ($l=@mysql_fetch_array($r)) { $link=$l; $description=""; $action=$structure->checkRoboLink($link,$description); $structure->doRoboLink($link,$action,$description); } } } } } } else { header("location:install.php"); } ?>