''); if (is_file("./admin/.htcontrol")) $htcontrol = parse_ini_file("./admin/.htcontrol", false); switch ($htcontrol ['access']) { case "close" : SC_USER_access_denied(array("access" => "close", "type" => "site")); break; case "passwd" : SC_USER_auth(array("type" => "site"), $htcontrol); break; case "ip" : if (ip_compare($_SERVER['REMOTE_ADDR'], $htcontrol ['site_ip']) == false) { SC_USER_access_denied(array("access" => "ip", "type" => "site")); } break; break; } $IS_FULL = true; if ((@$_REQUEST['ac'] == 'chart') || (@$_REQUEST['ac'] == 'chartex') || (isset ($params ['IS_FULL']) && ($params ['IS_FULL'] == false))) { $IS_FULL = false; } if ($IS_FULL == true) { $GLOBALS['_MENU'] = SC_USER_HTML_menu_path_selected($_REQUEST['id'], $params_eid, $params_lng); $GLOBALS['_SHOW'] = SC_USER_HTML_menu_path_show($_REQUEST['id'], $params_eid, $params_lng); $GLOBALS['_PATH'] = SC_USER_HTML_menu_path($_REQUEST['id'], $params_eid, $params_lng); } SCModuleEngine::instance(); $vars = SC_USER_HTML_defaults($_REQUEST['id']); if ((!is_dir($vars ['DB_PATH'])) && (@$_REQUEST['ac'] == "")) { header("Location: show.html?http_errors=404", true, 301); //���� 302. 14.11.08 die (); } $vars = SC_USER_HTML_defaults($params_id, $params_eid, $params_lng); if (@$_REQUEST['eid'] == "") { $_REQUEST['eid'] = $vars ['eid']; } if (@$_REQUEST['lng'] == "") { $_REQUEST['lng'] = $vars ['lng']; } if ($IS_FULL == true) { $htaccess = @file_get_contents($vars ['DB_PATH'] . "/page_access"); if (($htaccess != "") || ($htaccess != "open")) switch ($htaccess) { case "page_access_close" : SC_USER_access_denied(array("id" => $params_id, "eid" => $params_eid, "lng" => $params_lng, "access" => "close", "type" => "page")); case "page_access_ip" : if (ip_compare($_SERVER['REMOTE_ADDR'], $htsetup ['page_ip']) == false) { SC_USER_access_denied(array("id" => $params_id, "eid" => $params_eid, "lng" => $params_lng, "access" => "ip", "type" => "page")); } break; case "page_access_passwd" : SC_USER_auth(array("type" => "page"), $htsetup); break; case "page_access_passwd_multi" : SC_USER_auth(array("type" => "page", "multi" => true), $htsetup); break; } } if ($IS_FULL == true) { $hthref = @file_get_contents($vars ['DB_PATH'] . "/page_use_href"); if ($hthref == "checked") { $hthref = @file_get_contents($vars ['DB_PATH'] . "/page_href"); if ($hthref != "") { Header("Location: " . $hthref, true, 301); //�������� 01.12.08 ���� ��� True � 301 die (); } } } //var_dump($_SERVER); if (($_SERVER['SCRIPT_NAME'] == "/show.html") && (is_file("./show_info.html")) && ($_REQUEST['eid'] == "catalog")) { if (SC_USER_get_type($params_id, $params_eid, $params_lng) != "SCItemMenu") { header("location: show_info.html?" . $_SERVER['QUERY_STRING']); die (); } } $html = ' '; if (@$GLOBALS['english'] == true) { $html = ' '; } if ($IS_FULL == true) { $html .= ''; if (isset ($params ['meta_title'])) { $text = trim($params ['meta_title']); } else { $file = $vars ['DB_PATH'] . "/meta_title"; $text = trim(@file_get_contents($file)); if (strlen($text) < 3) { if (trim(@file_get_contents($vars ['DB_PATH_ROOT'] . "/transparent")) == "") { $text = trim(@file_get_contents($vars ['DB_PATH_ROOT'] . "/meta_title")); } else { $text = ""; } if (strlen($text) < 3) { if (trim(@file_get_contents($vars ['DB_PATH_ROOT'] . "/transparent")) == "") { $text = trim(@file_get_contents(db_path(0, 'mnu', 'rus') . "/meta_title")); } else { $text = ""; } if ($text == "") { $text = $GLOBALS['_SERVER'] ["HTTP_HOST"]; } if (is_file($vars ['DB_PATH'] . "/head.txt")) { if (trim(@file_get_contents($vars ['DB_PATH'] . "/.auth")) != "") { $text .= " :: " . trim(@join('', @file($vars ['DB_PATH'] . "/.auth"))); } if (trim(@file_get_contents($vars ['DB_PATH'] . "/head.txt")) != "") { $text .= " :: " . trim(@join('', @file($vars ['DB_PATH'] . "/head.txt"))); } } } } } $html .= $text; $html .= ' ' . "\n"; } else { $html .= '' . "\n"; } $file = "./content/mods/SCModule_Icon/img_icon.ico"; if (is_file($file)) { $html .= ""; } if ($IS_FULL == true) { if (!@$htsetup ['popup']) $htsetup ['popup'] = 0; if (!@$htcontrol ['popup']) $htcontrol ['popup'] = 0; if (!@$htcontrol ['popup_other']) $htcontrol ['popup_other'] = 0; if (@$htcontrol ['popup_width'] < 320) $htcontrol ['popup_width'] = 320; if (@$htcontrol ['popup_height'] < 180) $htcontrol ['popup_height'] = 180; } //$html .= " "; if ($IS_FULL == true) { if ((($htsetup ['popup'] == "1") && ($htcontrol ['popup_other'] == "1")) || (($params_id == "0") && ($htcontrol ['popup'] == "1") && ($_REQUEST['ac'] == ""))) { if (($_SERVER['HTTP_USER_AGENT'] != 'ART-NAVIGATOR [onCD]') && ($_REQUEST['eid'] == 'mnu') && ($_REQUEST['ac'] != "popup")) { $html .= " "; } } } if (@$GLOBALS['http_errors'] == '404') { if (is_file("./content/rus/errors_404/0/content.html")) { header("HTTP/1.0 404 Not Found"); $html .= "\n"; $html .= "\n"; echo $html; include("./content/rus/errors_404/0/content.html"); echo "\n"; echo ""; die (); } else { header("HTTP/1.0 404 Not Found"); $html .= "\n"; $html .= "\n"; echo $html; include(SC_PATH . "templates/html/404.html"); echo "\n"; echo ""; die (); } } if (isset ($_REQUEST['ac'])) { switch ($_REQUEST['ac']) { case "catalogitem" : $_REQUEST['eid'] = "catalogitem"; break; case "catalogcat" : $_REQUEST['eid'] = "catalogcat"; break; case "news" : $_REQUEST['eid'] = "news"; break; case "news_archive" : $_REQUEST['eid'] = "news_list"; break; case "photos" : $_REQUEST['eid'] = "photos"; break; case "photocat" : $_REQUEST['eid'] = "photocat"; break; case "newscat" : $_REQUEST['eid'] = "newscat"; break; case "photos_show" : if (is_file("./show_photo.html")) { $_REQUEST['ac'] = "photos"; require_once("./show_photo.html"); die (); } else { header("Content-Type: image/jpeg; charset=windows-1251;"); readfile("./content/rus/photos/" . intval($params_id) . "/preview_big.jpg"); die (); } break; case "chart" : SCModuleEngine::instance()->module_user("SCModule_Chart", 'verify'); echo $html; SCModuleEngine::instance()->module_user("SCModule_Chart", 'default'); die (); break; case "chartex" : SCModuleEngine::instance()->module_user("SCModule_ChartEx", 'verify'); echo $html; SCModuleEngine::instance()->module_user("SCModule_ChartEx", 'default'); die (); break; case "YandexM" : //echo $html; SCModuleEngine::instance()->module_user_engine("SCModule_YandexM"); die (); break; case "EMail" : echo $html; SCModuleEngine::instance()->module_user_engine("SCModule_EMail"); die (); break; case "solutions" : echo $html; SCModuleEngine::instance()->module_user_engine("SCModule_Solutions", "", $params_id); die (); break; case "board" : echo $html; SCModuleEngine::instance()->module_user_engine("SCModule_Board", "", $params_id); die (); break; case "guestbook" : echo $html; SCModuleEngine::instance()->module_user_engine("SCModule_Guestbook", "", $params_id); die (); break; case "basket" : include("SC_8_5/php/SCBasket.php"); if ($GLOBALS['basket_in_design'] == true) { SC_Basket_run(true, false); } elseif (($GLOBALS['basket_return'] == true) && (isset ($_GET ['a']) || isset ($_GET ['i']))) { SC_Basket_run(true, false); header("location: " . $_SERVER ["HTTP_REFERER"]); die (); } elseif (($GLOBALS['basket_return'] == true)) { SC_Basket_run(true, false); } else { SC_Basket_run(); die (); } break; case "popup" : $popup = file_get_contents(db_path(0, "popup", $params_lng) . "/content.html"); $myIT = get_template_obj("popup", ""); echo $myIT->get(array("popup" => $popup), "popup"); die (); break; case "sitecat" : require_once("misc/TSiteCatalog.php"); $cat = new TSiteCatalog (); $params_id = $cat->setIdByUrl($_SERVER ['SERVER_NAME']); if (isset ($_GET ['cid'])) echo $cat->getSiteCatalogSiteParsed($_GET ['cid'], $page); else echo $cat->getSiteCatalogCatParsed($page); die (); break; default : break; } } if (@$params ['access']) { $_PATH = file($vars ['DB_PATH'] . "/path.html"); $pid = 0; if (count($_PATH) > 1) { $pid = $_PATH [1]; } if (is_array($params ['access'])) { if (array_search($pid, $params ['access']) === false) { if (isset ($params ['access_href'])) { header("location: " . $params ['access_href']); } die (); } } } if (@$params ['return_html']) { return $html; } else { $meta = new TMeta (); if (is_file($vars ['DB_PATH'] . "/content.html")) { //$meta->params['last-modified'] = gmdate("D, d M Y H:i:s", filemtime($vars['DB_PATH']."/content.html"))." GMT"; } $meta->http_header(); echo $html; } } function SC_USER_head($id, $eid = '', $lng = '', $include = true) { $db_path = db_path($id, $eid, $lng); if (is_file($db_path . "/head.txt")) { if ($include == true) { include($db_path . "/head.txt"); } else { return file_get_contents($db_path . "/head.txt"); } } } function SC_USER_name($id, $eid = '', $lng = '') { $db_path = db_path($id, $eid, $lng); if (!is_file("./engine.html")) { return "/show.html?id=" . $id; } $text = ''; if (is_file($db_path . "/name.html")) { $text = file_get_contents($db_path . "/name.html"); } else { $db_path = db_path($id, 'catalog', $lng); if (is_file($db_path . "/name.html")) { $text = file_get_contents($db_path . "/name.html"); } else { $db_path = db_path($id, 'mnu', $lng); if (is_file($db_path . "/name.html")) { $text = file_get_contents($db_path . "/name.html"); } } } return $text . "/" . intval($id) . ".html"; } function SC_USER_count($id, $eid = '', $lng = '') { $vars = SC_USER_HTML_defaults($id, $eid, $lng); if (is_file($vars ['DB_PATH'] . "/count.txt")) { return file_get_contents($vars ['DB_PATH'] . "/count.txt"); } } function SC_USER_page($_MENU, $page, $id, $eid = '', $lng = '') { $page = intval($page); $vars = SC_USER_HTML_defaults($id, $eid, $lng); if ($_MENU == "") { $_MENU = array(); } $_MENU_SHOW_ALL = @$GLOBALS['_MENU_SHOW_ALL']; if (is_file($vars ['DB_PATH'] . "/path.html")) { $_PATH = file($vars ['DB_PATH'] . "/path.html"); foreach ($_PATH as $key => $val) { $val = intval($val); if (!(@$_MENU [$val])) { $_MENU [$val] = "selected"; } } } if (is_file($vars ['DB_PATH'] . "/menu_page_" . $page . ".html")) { include($vars ['DB_PATH'] . "/menu_page_" . $page . ".html"); } } function SC_USER_page_list($id, $eid = '', $lng = '', $pid = 0) { $vars = SC_USER_HTML_defaults($id, $eid, $lng); //block changed by dimchikg if ($vars ['eid'] == "news_list") { $PAGE_HREF = "/show.html?id=" . $id . "&ac=news_archive&lng=" . $vars ['lng']; } elseif ($vars ['eid'] == "catalog") { $PAGE_HREF = "/show.html?id=" . $pid . "&ac=catalog"; } elseif ($vars ['eid'] == "solutions") { $PAGE_HREF = "show.html?id=" . $id . "&eid=solutions&lng=rus"; } else { $PAGE_HREF = "/show.html?id=" . $id . "&ac=humor"; } if (is_file($vars ['DB_PATH'] . "/page_list.html")) { include($vars ['DB_PATH'] . "/page_list.html"); } else { if (is_file($vars ['DB_PATH'] . "/menu_page_0.html")) { $cnt = 0; $d = dir($vars ['DB_PATH'] . "/"); while (false !== ($entry = $d->read())) { if (substr($entry, 0, 10) == "menu_page_") { //echo $entry."
\n"; $cnt++; } } $d->close(); echo "
"; for ($i = 0; $i < $cnt; $i++) { if ($i == $GLOBALS['page']) { echo "[" . ($i + 1) . "] "; } else { echo "[" . ($i + 1) . "] "; } } echo "
"; } } } function SC_USER_include_content($id, $eid = '', $lng = '', $ret = false, $params = array("ac" => "1")) { $vars = SC_USER_HTML_defaults($id, $eid, $lng); $eid = $vars ['eid']; $lng = $vars ['lng']; $html = ""; $save_ac = ""; if (isset($_REQUEST['ac'])) { $save_ac = $_REQUEST['ac']; } else { $_REQUEST['ac'] = ""; } if (isset($params['noac'])) { $_REQUEST['ac'] = ""; } if ($vars ['eid'] == "news_list") { if (is_file($vars ['DB_PATH'] . "/headline.html")) include($vars ['DB_PATH'] . "/headline.html"); } if ($vars ['eid'] == "catalogitem") $html = SCModuleEngine::instance()->module_user("SCModule_ProductCatalog", $ret); if ($vars ['eid'] == "catalogcat") { require_once "misc/TCatalogAdmin.php"; $Catalog = new TCatalogAdmin ($_GET ['cid'], "TCatalog", $_SERVER ["DOCUMENT_ROOT"] . "/admin/SC_9_0.conf"); $tpl = new TTemplate (array("template_file" => $_SERVER ["DOCUMENT_ROOT"] . "/templates/TCatalog.tpl")); $html = $tpl->get($vars, "TCatalog_head"); $html = $Catalog->showCategoryUser($_GET ['page'], $count); $html = $tpl->get($vars, "TCatalog_foot"); } if ((is_file($vars ['DB_PATH'] . "/content.html")) && ((($_REQUEST['ac'] == "") && (intval($id) == 0)) || (intval($id) != 0))) { $html .= file_get_contents($vars ['DB_PATH'] . "/content.html"); if (strpos($html, 'content') !== false) { $html = str_replace("../content/", "/content/", $html); $html = str_replace("./content/", "/content/", $html); } $html = str_replace("\"images", "\"/images", $html); $__is_tags_1 = false; $__is_tags_2 = false; $text = "#<!--(.*)-->#Uis"; if (preg_match_all($text, $html, $matches) > 0) { $__is_tags_1 = true; foreach ($matches [1] as $key => $val) { $val = trim($val); $text = "#(\w+)\((.+)\)#Uis"; if (preg_match_all($text, $val, $matches_2) > 0) { foreach ($matches_2 [1] as $key_2 => $val_2) { $val_2 = trim($val_2); $html_content = ''; switch ($val_2) { case 'INCLUDE_CONTENT' : $id_tmp = intval($matches_2 [2] [$key_2]); if ($id_tmp >= 0) { $db_path = db_path($id_tmp, 'mnu', $lng); } else { $path = SC_USER_HTML_menu_path($vars ['id']); $db_path = db_path($path [abs($id_tmp)], 'mnu', $lng); } if (is_file($db_path . "/content.html")) { $html_content = file_get_contents($db_path . "/content.html"); } break; case 'LINKS' : $url = $_SERVER['REQUEST_URI']; if (strpos($_SERVER['PHP_SELF'], "/engine.html") !== false) { $url = str_replace("/engine.html", "", $_SERVER['PHP_SELF']); } $var = array( 'url' => $url, 'src' => $matches_2 [2] [0] ); if ($var['src'] == ".") { $var['src'] = str_replace("www.", "", $_SERVER['HTTP_HOST']); } /* if ( isset( $GLOBALS['id']) && ( strpos($_SERVER['PHP_SELF'], "/engine.html") !== 0 ) ) $var['id'] = intval( $GLOBALS['id'] ); */ if (isset($_REQUEST['page'])) $var['page'] = intval($_REQUEST['page']); if (isset($_REQUEST['SCContentListLinks_page'])) $var['SCContentListLinks_page'] = intval($_REQUEST['SCContentListLinks_page']); echo ''; $url = 'http://links.creatiw.ru/?data=' . urlencode(serialize($var)); $html_content = iconv("utf-8", "windows-1251//IGNORE", file_get_contents($url)); break; case 'IMPORT_LIST' : $id_tmp = explode(",", $matches_2 [2] [$key_2]); // site url $id_tmp [0] = str_replace("'", "", trim($id_tmp [0])); // id $id_tmp [1] = intval($id_tmp [1]); // eid $id_tmp [2] = trim($id_tmp [2]); //count if (isset($id_tmp [3])) { $id_tmp [3] = intval($id_tmp [3]); } else { $id_tmp [3] = 0; } if (!$id_tmp [3]) { if ($id_tmp [2] == "") { $html_content = @file_get_contents("http://" . $id_tmp [0] . "/export/index.html?id=" . $id_tmp [1] . "&eid=news_list&lng=rus"); } else { $html_content = @file_get_contents("http://" . $id_tmp [0] . "/export/index.html?id=" . $id_tmp [1] . "&eid=" . $id_tmp [2] . "&lng=rus&full=1"); } } else { $html_content = @file_get_contents("http://" . $id_tmp [0] . "/export/index.html?id=" . $id_tmp [1] . "&eid=news_list&lng=rus&count=" . $id_tmp [3]); } $html_content = str_replace(" 0) { $__is_tags_2 = true; foreach ($matches [2] as $key => $val) { if (trim($matches [1] [$key]) == trim($matches [3] [$key])) { switch (trim($matches [2] [$key])) { case "CATALOG" : break; } } } } } // } //if (($_SERVER['REMOTE_ADDR'] == "80.250.228.2")&($_REQUEST['debug'])) { //} if ($__is_tags_2 == true) { $text = "/<!--PRICE_START-->�����-����-#(\d+)<!--PRICE_END-->/i"; preg_match_all($text, $html, $matches); if (is_array($matches [1])) { // var_dump ($matches[1]); foreach ($matches [1] as $key => $val) { $html_price = ""; $vars_price = SC_USER_HTML_defaults($val, 'price', $lng); if (is_file($vars_price ['DB_PATH'] . "/head.html")) { $html_price = file_get_contents($vars_price ['DB_PATH'] . "/head.html"); $html = str_replace("<!--PRICE_START-->�����-����-#" . $val . "<!--PRICE_END-->", $html_price, $html); } else { $html = str_replace("<!--PRICE_START-->�����-����-#" . $val . "<!--PRICE_END-->", '', $html); } } } //---------- mySQL Price ------------- $text = "/<!--PRICE_START-->DB-�����-����-#(\d+)<!--PRICE_END-->/i"; preg_match_all($text, $html, $matches); if (is_array($matches [1])) { foreach ($matches [1] as $key => $val) { $html_price = ""; require_once("misc/TPrice.php"); $Price = new TPrice ($val); $html_price = $Price->price($_REQUEST['page']); $html = str_replace("<!--PRICE_START-->DB-�����-����-#" . $val . "<!--PRICE_END-->", $html_price, $html); } } //--------------------------------- //---------- mySQL Catalog ------------- $text = "/<!--CATALOG_START-->������-#(.*)<!--CATALOG_END-->/i"; preg_match_all($text, $html, $matches); if (is_array($matches [1])) { foreach ($matches [1] as $key => $val) { preg_match_all("/([0-9]+)/", $val, $mtc); preg_match_all("/count=([0-9]+)/", $val, $mtch); $id = $mtc [1] [0]; $_REQUEST['cid'] = $id; ($mtch [1] [0] > 0) ? $count = $mtch [1] [0] : $count = 0; // ���������� ��������� �� �������� require_once "misc/TCatalogAdmin.php"; $Catalog = new TCatalogAdmin ($id, "TCatalog", $_SERVER ["DOCUMENT_ROOT"] . "/admin/SC_9_0.conf"); if (is_numeric($id) and $count) { $Catalog->itemsOnPage ['user'] = $count; $vars ['pageList'] = $Catalog->pageList($_GET ['page'], "user"); } $vars ['id'] = $id; $tpl = new TTemplate (array("template_file" => $_SERVER ["DOCUMENT_ROOT"] . "/templates/TCatalog.tpl")); $html_catalog = $tpl->get($vars, "TCatalog_head"); $html_catalog .= $Catalog->showCategoryUser($_GET ['page'], $count); $html_catalog .= $tpl->get($vars, "TCatalog_foot"); $html = str_replace($matches [0] [$key], $html_catalog, $html); } } //--------------------------------- //--------- Site Catalog ---------- $text = "/<!--SITECATALOG_START-->�������-#(\d+)<!--SITECATALOG_END-->/i"; preg_match_all($text, $html, $matches); if (is_array($matches [1])) { foreach ($matches [1] as $key => $val) { $html_cat = ""; require_once("misc/TSiteCatalog.php"); if (!$val) { $cat = new TSiteCatalog (); $id = $cat->setIdByUrl($_SERVER ['SERVER_NAME']); } else { $cat = new TSiteCatalog ($val); $id = $val; } if ($id) { if (isset ($_GET ['cid'])) $html_cat = $cat->getSiteCatalogSiteParsed($_GET ['cid'], $_GET ['page']); else $html_cat = $cat->getSiteCatalogCatParsed($_GET ['page']); $html = str_replace("<!--SITECATALOG_START-->�������-#" . $val . "<!--SITECATALOG_END-->", $html_cat, $html); } else $html = "
������� �� ������������!"; } } } //--------------------------------- // TeX $text = "#<tex>(.*)<\/tex>#Usi"; preg_match_all($text, $html, $matches); if (is_array($matches [1])) { foreach ($matches [1] as $key => $val) { $GIF = ""; $str = $val; $str_uniq = md5($str); if (!is_dir("./content/latex")) mkdir("./content/latex"); if (!is_file("./content/latex/" . $str_uniq . ".gif")) { $fh = fopen("./content/latex/" . $str_uniq . ".txt", "w+"); fwrite($fh, $str); fclose($fh); //$str = str_replace("\\", "\\\\", $str); $TEX = "/usr/local/bin/mimetex -d -f ./content/latex/" . $str_uniq . ".txt"; echo $TEX; $handle = popen($TEX, "r"); while (!feof($handle)) { $GIF .= fread($handle, 1024); } pclose($handle); if ($GIF != "") { $fh = fopen("./content/latex/" . $str_uniq . ".gif", "w+"); fwrite($fh, $GIF); fclose($fh); } } $html = str_replace($matches [0] [$key], "", $html); } } $vars_catalog = SC_USER_HTML_defaults(0, 'catalog', $lng); if (is_file($vars_catalog ['DB_PATH'] . "/DB.txt")) { $text = "/<!--CATALOG_START-->(.*)<!--CATALOG_END-->/Ui"; preg_match_all($text, $html, $matches); if (is_array($matches [1])) { $vars_catalog = SC_USER_HTML_defaults(0, 'catalog', $lng); $DB = @file($vars_catalog ['DB_PATH'] . "/DB.txt"); foreach ($DB as $key => $val) { list ($title, $id) = explode("||", $val); $CATALOG [$title] = $id; } foreach ($matches [1] as $key => $val) { if (substr($val, 0, 11) == "/show.html?") { preg_match_all("/show\.html\?id=([0-9]+)/", $val, $mtc); preg_match_all("/count=([0-9]+)/", $val, $mtch); $html_catalog = ""; $vars_catalog = SC_USER_HTML_defaults($mtc [1] [0], 'catalog', $lng); ($mtch [1] [0] > 0) ? $count = $mtch [1] [0] : $count = 0; // ���������� ��������� �� �������� (trim($_GET ['page']) != "") ? $page_num = $_GET ['page'] : $page_num = 1; $list = @file($vars_catalog ['DB_PATH'] . "/list.txt"); if ($count and $page_num > ceil((count($list)) / $count)) $page_num = 1; if (is_array($list)) foreach ($list as $key_2 => $val_2) { if ($count) if (($key_2 < ($page_num - 1) * $count) or ($key_2 > $page_num * $count - 1)) continue; $vars_catalog = SC_USER_HTML_defaults($val_2, 'catalog', $lng); if (file_get_contents($vars_catalog ['DB_PATH'] . "/_type") != 'SCItemMenu') { $html_catalog .= file_get_contents($vars_catalog ['DB_PATH'] . "/body.html"); } } } else { $html_catalog = ""; $arr = explode(",", $val); foreach ($arr as $key_2 => $val_2) { if (isset ($CATALOG [$val_2])) { $vars_catalog = SC_USER_HTML_defaults($CATALOG [$val_2], 'catalog', $lng); $html_catalog .= file_get_contents($vars_catalog ['DB_PATH'] . "/body.html"); } } } if ($count) { $vars ['pages'] = "| "; $link = $_SERVER ['PHP_SELF'] . "?" . $_SERVER ['QUERY_STRING']; if (!preg_match("/page=([0-9]+)/", $_SERVER ['QUERY_STRING'])) $link .= "&page=1"; for ($i = 1; $i <= ceil((count($list)) / $count); $i++) { if ($i == $page_num) $vars ['pages'] .= " " . $i . " |"; else $vars ['pages'] .= " " . $i . " |"; } } if ($html_catalog != "") { $myIT = get_template_obj("SCItemCatalog", ""); $html_catalog = $myIT->get($vars, "scitemcatalog_head") . $html_catalog; $html_catalog .= $myIT->get($vars, "scitemcatalog_foot"); } $html = str_replace($matches [0] [$key], $html_catalog, $html); } } } if (is_file("./engine.html")) { $search = "#(href|src)=\"(" . preg_quote("http://" . $_SERVER ['HTTP_HOST'], '#') . "|)/show\.html\?id=(\d+)(|&(|amp;)eid=(\w+)(|&(|amp;)lng=([^\"\#]*)))(|\#([^\"]*))\"#Uis"; preg_match_all($search, $html, $out); if ($_REQUEST ['debug']) { //var_dump(preg_quote("http://".$_SERVER['HTTP_HOST'], '#')); echo "
";
					var_dump($out);
					echo "
"; } if (count($out [0]) > 0) { foreach ($out [0] as $key => $val) { $html = str_replace($val, "href=\"" . SC_USER_name($out [3] [$key]) . $out [10] [$key] . "\"", $html); } } } $search = '#\{(.*)\}#Us'; preg_match_all($search, $html, $out, PREG_PATTERN_ORDER); if (count($out [0]) > 0) { foreach ($out [1] as $key => $val) { if (isset($GLOBALS[strtolower($val)])) { $html = str_replace($out [0] [$key], $GLOBALS[strtolower($val)], $html); } } } if ($_REQUEST['ac'] == "search") { $html = ""; } if (isset($params['noac'])) { $_REQUEST['ac'] = $save_ac; } if ($ret == false) { echo($html); if (isset($_REQUEST['noac']) && ($_REQUEST['noac'] == true)) { return ''; } } } if ($vars ['eid'] == "catalog") { $list = @file($vars ['DB_PATH'] . "/list.txt"); if ($list !== false) { $html_catalog = ""; if ($_REQUEST['catalog'] == 'recursion') { $sort_val = false; $sort_dir = false; $vars['REQUEST'] = '/show.html?id=' . ($id); if (isset($_REQUEST['sort'])) { $sort_val = strip_tags(trim(str_replace(array(".", "/", "\\"), "", @$_REQUEST['sort']))); $sort_dir = strip_tags(trim(str_replace(array(".", "/", "\\"), "", @$_REQUEST['d']))); if (isset($_REQUEST['d'])) { $vars['REQUEST'] .= "&d=" . $sort_dir; } if (is_file($vars ['DB_PATH_ROOT'] . "/DB_index_" . $sort_val . ".txt")) { $list = @file($vars ['DB_PATH'] . "/list_full_item.txt"); $cost = @file($vars ['DB_PATH_ROOT'] . "/DB_index_" . $sort_val . ".txt"); $sort = array(); foreach ($list as $key => $val) { $data = preg_grep("/^" . trim($val) . "\|\|/i", $cost); $data = reset($data); $data = explode("||", $data); $sort[trim($val)] = @$data[1]; if ($sort_val == "cost") $sort[trim($val)] = intval($sort[trim($val)]); } if (@$_REQUEST['d'] == "dsc") { asort($sort); } else { arsort($sort); } $list = array_keys($sort); } else { $list = @file($vars ['DB_PATH'] . "/list_full_item.txt"); } } else { $list = @file($vars ['DB_PATH'] . "/list_full_item.txt"); } $data = file("./content/rus/catalog/0/DB_index_availability.txt"); foreach ($data as $line) { list($nid, $val) = explode("||", $line); if (trim($val) == "checked") { $nid = array_search($nid . "\n", $list); if ($nid !== false) unset($list[$nid]); } } require_once 'Pager.php'; $params = array( 'mode' => 'Sliding', 'append' => true, 'urlVar' => 'page', 'currentPage' => intval($_REQUEST['page']), 'fileName' => $vars['REQUEST'] . '&page=%d' . (($sort_val) ? "&sort=" . $sort_val : ""), 'itemData' => array_keys($list), 'perPage' => 20 ); $pager = & Pager::factory($params); if ($sort_dir) { if ($sort_dir == "dsc") { $vars['REQUEST'] = str_replace("d=dsc", "d=asc", $vars['REQUEST']); } else { $vars['REQUEST'] = str_replace("d=asc", "d=dsc", $vars['REQUEST']); } } else { $vars['REQUEST'] .= "&d=dsc"; } $data = $pager->getPageData(); $odd = false; foreach ($data as $val) { $vars_catalog = SC_USER_HTML_defaults($list [$val], 'catalog', 'rus'); $vars_type = @file_get_contents($vars_catalog ['DB_PATH'] . "/_type"); if ($vars_type != 'SCItemMenu') { $text = @file_get_contents($vars_catalog ['DB_PATH'] . "/body.html"); if ($odd) { $text = str_replace("", "", $text); } $html_catalog .= $text; $odd = !$odd; } } $pager_links = "
" . $pager->links . "
\n"; $myIT = get_template_obj("SCItemCatalog", ""); if ($html_catalog != "") { $html_catalog = $pager_links . $myIT->get($vars, "scitemcatalog_head") . $html_catalog; $html_catalog .= $myIT->get($vars, "scitemcatalog_foot") . $pager_links; } } else { foreach ($list as $key_2 => $val_2) { $vars_catalog = SC_USER_HTML_defaults($val_2, 'catalog', $lng); if (@file_get_contents($vars_catalog ['DB_PATH'] . "/_type") != 'SCItemMenu') { $html_catalog .= @file_get_contents($vars_catalog ['DB_PATH'] . "/body.html"); } else { } } $myIT = get_template_obj("SCItemCatalog", ""); if ($html_catalog != "") { $html_catalog = $myIT->get($vars, "scitemcatalog_head") . $html_catalog; $html_catalog .= $myIT->get($vars, "scitemcatalog_foot"); } } echo $html_catalog; } $type = @file_get_contents($vars ['DB_PATH'] . "/_type"); if (trim($type) == "SCItemCatalog") { if (is_file("./templates/show_SCItemCatalog.inc")) { include("./templates/show_SCItemCatalog.inc"); } } } if ($vars ['eid'] == "news_list") { if (is_file($vars ['DB_PATH'] . "/footline.html")) include($vars ['DB_PATH'] . "/footline.html"); } if ($params ['ac'] == "1") { if (isset($_REQUEST['ac'])) { switch ($_REQUEST['ac']) { case "search" : SC_USER_include_search(); break; case "map" : SC_USER_include_map(); break; case "humor" : SC_USER_page("", intval($_REQUEST['page']), $_REQUEST['id'], 'humor'); if (is_array($GLOBALS['_HUMOR'])) { foreach ($GLOBALS['_HUMOR'] as $key => $val) { echo "
" . $val . "
\n"; } echo "
"; SC_USER_page_list($GLOBALS['id'], 'humor'); echo "
"; } break; case "news_archive" : if ($GLOBALS['news_table'] == "true") { ?>
"; SC_USER_page_list($_REQUEST['id'], 'news_list'); echo ""; break; case "photos" : SCModuleEngine::instance()->module_user("SCModule_Photo"); break; case "basket" : SC_Basket_run(false, true); break; case "photocat" : SCModuleEngine::instance()->module_user("SCModule_PhotoCatalog"); break; case "newscat" : SCModuleEngine::instance()->module_user("SCModule_NewsCatalog"); break; case "searchtxt" : SCModuleEngine::instance()->module_user_engine("SCModule_SearchTxt"); break; } } } if (is_file($vars ['DB_PATH'] . "/mods_email")) { if (file_get_contents($vars ['DB_PATH'] . "/mods_email") == 'checked') { SCModuleEngine::instance()->module_user_engine("SCModule_EMail"); } } if ($ret == true) return ($html); } function SC_USER_hasChildren($id, $eid = '', $lng = '') { $PATH = SC_USER_HTML_defaults($id, $eid, $lng); if (is_file($PATH ['DB_PATH'] . "/list_menu.txt")) { if (file_get_contents($PATH ['DB_PATH'] . "/list_menu.txt") != "") { return true; } } return false; } function SC_USER_COUNT_allChildren($id, $eid = '', $lng = '') { $PATH = SC_USER_HTML_defaults($id, $eid, $lng); if (is_file($PATH ['DB_PATH'] . "/list_full.txt")) return count(file($PATH ['DB_PATH'] . "/list_full.txt")); return 0; } function SC_USER_COUNT_allChildrenItem($id, $eid = '', $lng = '') { $PATH = SC_USER_HTML_defaults($id, $eid, $lng); if (is_file($PATH ['DB_PATH'] . "/list_full_item.txt")) return count(file($PATH ['DB_PATH'] . "/list_full_item.txt")); return 0; } function SC_USER_menu_list($id, $eid = '', $lng = '') { $PATH = SC_USER_HTML_defaults($id, $eid, $lng); $arr = @file($PATH ['DB_PATH'] . "/list_menu.txt"); if (!is_array($arr)) $arr = array(); return $arr; } function SC_USER_is_child($id, $pid, $is_true = '', $is_false = '', $eid = '', $lng = '') { $PATH = SC_USER_HTML_menu_path($id, $eid, $lng); if ($id == $pid) { if ($is_true != '') { return $is_true; } else { return true; } } if (is_array($PATH)) foreach ($PATH as $key => $val) { if ($val == $pid) { if ($is_true != '') { return $is_true; } else { return true; } } } if ($is_true != '') { return $is_false; } else { return false; } } function SC_USER_get_var($var_name, $id = '', $eid = '', $lng = '', $html = false) { $vars = SC_USER_HTML_defaults($id, $eid, $lng); $fn = ""; if (is_file($vars ['DB_PATH'] . "/." . $var_name)) { $fn = $vars ['DB_PATH'] . "/." . $var_name; } else { if (is_file($vars ['DB_PATH'] . "/" . $var_name)) { $fn = $vars ['DB_PATH'] . "/" . $var_name; } } if ($fn != "") { if ($html == false) { $html = htmlspecialchars(@file_get_contents($fn)); echo $html; } else { $html = @file_get_contents($fn); return $html; } } } // �������� � ������ ���� � ������ $fn, ��� ������� ($id, $eid, $lng), function SC_USER_get_file($fn, $id = '', $eid = '', $lng = '', $return = false) { $db_path = db_path($id, $eid, $lng); if (is_file($db_path . "/" . $fn)) { if ($return) { return trim(file_get_contents($db_path . "/" . $fn)); } else { include($db_path . "/" . $fn); } } } // ���������� ���� � �������� � ������ $fn, ��� ������� ($id, $eid, $lng), // ���� ������ �������� �����������, ���������� ������ �� ������ �������� (���� ������� �� ;��������) function SC_USER_get_file_path($fn, $id = '', $eid = '', $lng = '') { $db_path = db_path($id, $eid, $lng); if (is_file($db_path . "/" . $fn)) { return ($db_path . "/" . $fn); } else { return "/editor/images/spacer.gif"; } } function SC_USER_get_icon_path($id = '', $eid = '', $lng = '') { $icon = SC_USER_get_file_path('img_page_icon.jpg', $id, $eid, $lng); if ($icon == "/editor/images/spacer.gif") { $icon = SC_USER_get_file_path('img_page_icon.gif', $id, $eid, $lng); } return $icon; } function SC_USER_menu($_SHOW, $_MENU, $id, $eid = 'mnu', $lng = 'rus', $_COUNT_MAX = 0) { $_COUNT = 1; $level_count = 32; $vars = SC_USER_HTML_defaults($id, $eid, $lng); $vars_2 = ""; if ($_SHOW == "") $_SHOW = array(); if ($_MENU == "") $_MENU = array(); $_MENU_SHOW_MAP = @$GLOBALS['_MENU_SHOW_MAP']; $_MENU_SHOW_ALL = @$GLOBALS['_MENU_SHOW_ALL']; if (is_file($vars['DB_PATH'] . "/path.html")) { $_PATH = file($vars['DB_PATH'] . "/path.html"); foreach ($_PATH as $key => $val) { $val = intval($val); if (!(@$_MENU[$val])) { $_MENU[$val] = "selected"; } if ($level_count != "") { if ((count($_PATH) - $level_count - 1) == $key) { $vars_2 = SC_USER_HTML_defaults($val, $eid, $lng); $id_2 = $val; } } } } if (is_file($vars['DB_PATH'] . "/menu.html")) { include($vars['DB_PATH'] . "/menu.html"); } } function SC_USER_menu_item($_SHOW, $_MENU, $id, $eid = 'mnu', $lng = 'rus', $_COUNT_MAX = 0) { $vars = SC_USER_HTML_defaults($id, $eid, $lng); $_MENU_SHOW_MAP = @$GLOBALS['_MENU_SHOW_MAP']; $_MENU_SHOW_ALL = @$GLOBALS['_MENU_SHOW_ALL']; if (is_file($vars['DB_PATH'] . "/html.html")) { include($vars['DB_PATH'] . "/html.html"); } } // ���������� ���� � ��������� ������ �������� ������� function db_path($id, $eid = "", $lng = "") { if ($eid == "") $eid = "mnu"; if ($lng == "") $lng = "rus"; if (@$_REQUEST['export'] == true) { return $_SERVER["DOCUMENT_ROOT"] . "/content/" . $lng . "/" . $eid . "/" . $id; } else { if (@$_REQUEST['sc_path'] != "") { return $_REQUEST['sc_path'] . "content/" . $lng . "/" . $eid . "/" . intval($id); } else { return "./content/" . $lng . "/" . $eid . "/" . intval($id); } } // } } function ip_compare($IP_REMOTE, $IP_ARRAY) { $IP_REMOTE = explode(".", $IP_REMOTE); $IP_ARRAY = explode(",", $IP_ARRAY); $equals = false; foreach ($IP_ARRAY as $val) { $IP = explode(".", $val); $equals = true; for ($i = 0; $i < 4; $i++) { if ($IP[$i] != "*") { if (trim($IP[$i]) != trim($IP_REMOTE[$i])) { $equals = false; } } } if ($equals == true) { break; } } return $equals; } function SC_USER_HTML_menu_path_selected($id, $eid = '', $lng = '') { $db_path = db_path($id, $eid, $lng); $MENU = ""; if (is_file($db_path . "/path.html")) { $_PATH = file($db_path . "/path.html"); foreach ($_PATH as $val) { $val = intval($val); $MENU[$val] = "selected"; } } return $MENU; } function SC_USER_HTML_menu_path_show($id, $eid = '', $lng = '') { $db_path = db_path($id, $eid, $lng); $MENU = ""; if (is_file($db_path . "/path.html")) { $_PATH = file($db_path . "/path.html"); foreach ($_PATH as $val) { $val = intval($val); $MENU[$val] = "show"; } } return $MENU; } function SC_USER_HTML_menu_path($id, $eid = '', $lng = '') { $db_path = db_path($id, $eid, $lng); $MENU = ""; if (is_file($db_path . "/path.html")) { $_PATH = file($db_path . "/path.html"); $_PATH = array_reverse($_PATH); foreach ($_PATH as $key => $val) { $val = intval($val); $MENU[$key] = $val; } } return $MENU; } function SC_USER_parent($id, $eid = '', $lng = '') { $db_path = db_path($id, $eid, $lng); if (is_file($db_path . "/path.html")) { $_PATH = file($db_path . "/path.html"); return $_PATH[1]; } return ''; } function SC_USER_item(&$_COUNT, $_COUNT_MAX, $_SHOW, $_MENU, $_MENU_SHOW_ALL, $_MENU_SHOW_MAP, $id, $db_path, $html_item, $html_item_end, $html_selected, $html_selected_end, $html_map, $html_item_subs = false, $html_item_subs_end = false, $html_selected_subs = false, $html_selected_subs_end = false) { global $_MENU_SHOW_TYPE; if (($_COUNT > $_COUNT_MAX) && ($_COUNT_MAX > 0)) { return ""; } $_COUNT++; if (isset($_REQUEST['export'])) { if ($_REQUEST['export'] == true) { $search = '#("|\')(/|)show\.html\?id=([0-9]+)((&|&)eid=(\w+?\w*)|)((&|&)lng=(\w+)\#(\w+)|)("|\')#Us'; preg_match_all($search, $html_item, $out, PREG_PATTERN_ORDER); if (count($out[0]) > 0) { foreach ($out[0] as $key => $val) { $html_item = str_replace($val, "\"http://" . $_SERVER["HTTP_HOST"] . "/" . substr($val, 1, strlen($val) - 1), $html_item); } } $search = '#("|\')/([\w\/]+)([0-9]+)\.html#Uis'; preg_match_all($search, $html_item, $out, PREG_PATTERN_ORDER); if (count($out[0]) > 0) { foreach ($out[0] as $key => $val) { $val = preg_replace('#^("|\')#', "", $val); $val = preg_replace('#("|\')$#', "", $val); $html_item = str_replace($val, "http://" . $_SERVER["HTTP_HOST"] . $val, $html_item); } } } } //echo ($db_path."/menu.html"); if (@filesize($db_path . "/menu.html") > 0) { $IS_SUBS = true; } else { $IS_SUBS = false; } $type = @file_get_contents($db_path . "/_type"); if ((@$_SHOW[$id]) || (@$_MENU[$id]) || (@$_MENU_SHOW_ALL == true) || (@$_MENU_SHOW_MAP == true)) { if (@$_MENU[$id] == "selected") { if (($IS_SUBS == true) && ($html_selected_subs !== false) && (trim($html_selected_subs) !== "")) { echo $html_selected_subs; } else { echo $html_selected; } if (($IS_SUBS == true) && ($html_selected_subs !== false) && (trim($html_selected_subs) !== "")) { $html_item_end_tmp = $html_selected_subs_end; } else { $html_item_end_tmp = $html_selected_end; } if (@$_SHOW[$id] == "show") { @include($db_path . "/menu.html"); } echo $html_item_end_tmp; } else { if (@$_MENU_SHOW_MAP == true) { echo $html_map; } else { echo $html_item; } $html_item_end_tmp = $html_item_end; if ((@$_SHOW[$id] == "show") || (@$_MENU_SHOW_ALL == true)) { @include($db_path . "/menu.html"); } if (@$_MENU_SHOW_MAP != true) { echo $html_item_end_tmp; } } } else { if ((@$_MENU_SHOW_TYPE != "") && (@$_MENU_SHOW_TYPE != $type)) { } else { echo $html_item; echo $html_item_end; } } if (isset($GLOBALS['_MENU_TO_VAR'])) { if ($GLOBALS['_MENU_TO_VAR'] == true) { if ((@$_SHOW[$id]) || (@$_MENU[$id]) || (@$_MENU_SHOW_ALL == true) || (@$_MENU_SHOW_MAP == true)) { if (@$_MENU[$id] == "selected") { if (($IS_SUBS == true) && ($html_selected_subs !== false) && ($html_selected_subs != "")) { $GLOBALS['_MENU_TO_VAR_HTML'] .= $html_selected_subs; } else { $GLOBALS['_MENU_TO_VAR_HTML'] .= $html_selected; } if (($IS_SUBS == true) && ($html_selected_subs !== false)) { $html_item_end_tmp = $html_selected_subs_end; } else { $html_item_end_tmp = $html_selected_end; } if (@$_SHOW[$id] == "show") { @include($db_path . "/menu.html"); } $GLOBALS['_MENU_TO_VAR_HTML'] .= $html_item_end_tmp; } else { if (@$_MENU_SHOW_MAP == true) { $GLOBALS['_MENU_TO_VAR_HTML'] .= $html_map; } else { $GLOBALS['_MENU_TO_VAR_HTML'] .= $html_item; } $html_item_end_tmp = $html_item_end; if ((@$_SHOW[$id] == "show") || (@$_MENU_SHOW_ALL == true)) { @include($db_path . "/menu.html"); } if (@$_MENU_SHOW_MAP != true) { $GLOBALS['_MENU_TO_VAR_HTML'] .= $html_item_end_tmp; } } } else { $GLOBALS['_MENU_TO_VAR_HTML'] .= $html_item; $GLOBALS['_MENU_TO_VAR_HTML'] .= $html_item_end; } } } if ($_COUNT_MAX < 0) { if ((abs($_COUNT) % abs($_COUNT_MAX)) == 1) { SC_USER_columns(); } } } // �������� ����� �����, � �������� �������� ������������� ��� ������ show.hmtl?ac=map function SC_USER_include_map($eid = '', $lng = '') { $db_path = db_path($id, $eid, $lng); $_MENU[] = ""; ?>

����� �����

branch($arr [$i], $eid, $lng); } } SC_USER_branch($params, $arr [$i], $eid, $lng); } } } function SC_USER_branch_items($id, $eid, $lng) { $html_catalog = array(); $dir = db_path($id, $eid, $lng); if (is_file($dir . "/list.txt")) { $arr = file($dir . "/list.txt"); foreach ($arr as $val_2) { $dir_val = db_path($val_2, $eid, $lng); if (@file_get_contents($dir_val . "/_type") == 'SCItemMenu') { $html_catalog = $html_catalog + SC_USER_branch_items($val_2, $eid, $lng); } } } return $html_catalog; } function SC_USER_list($id, $eid, $lng) { $arr = array(); $dir = db_path($id, $eid, $lng); if (is_file($dir . "/list.txt")) { $arr = file($dir . "/list.txt"); $cnt = count($arr); for ($i = 0; $i < $cnt; $i++) { $arr [$i] = intval(trim($arr [$i])); } } return $arr; } function getCurrency() { if (!is_file("/tmp/.currency")) return array(); $fh = file("/tmp/.currency"); $CUR = array(); foreach ($fh as $val) { $arr = explode("=", $val); $CUR [trim($arr [0])] = trim(str_replace(",", ".", $arr [1])); } return $CUR; } function SC_USER_include_search() { /** $udm_agent = udm_alloc_agent("mysql://mnogosearch:cBALVZ8zsVnGbFZV@localhost/projects_mnogosearch/?DBMode=blob"); $query = trim(urldecode($_REQUEST['q'])); Udm_Add_Search_Limit($udm_agent, UDM_LIMIT_URL, $_SERVER ['HTTP_HOST']); Udm_Set_Agent_Param($udm_agent, UDM_PARAM_CHARSET, "cp1251"); Udm_Set_Agent_Param($udm_agent, UDM_PARAM_LOCAL_CHARSET, "cp1251"); Udm_Set_Agent_Param($udm_agent, UDM_PARAM_BROWSER_CHARSET, "cp1251"); if (@intval($_REQUEST['page']) > 0) { Udm_Set_Agent_Param($udm_agent, UDM_PARAM_PAGE_NUM, intval($_REQUEST['page']) - 1); } if ($query != "") { Udm_Set_Agent_Param($udm_agent, UDM_PARAM_SEARCH_MODE, UDM_MODE_ANY); Udm_Set_Agent_Param($udm_agent, UDM_PARAM_QUERY, $query); $res = Udm_Find($udm_agent, $query); } else { $res = Udm_Find($udm_agent, "www|show|index|"); } //echo ( udm_error ( $udm_agent ) ); if ($res !== false) { $found = Udm_Get_Res_Param($res, UDM_PARAM_FOUND); $rows = Udm_Get_Res_Param($res, UDM_PARAM_NUM_ROWS); } else { $found = 0; $rows = 0; } if ($found > 0) { echo "

������� ����������: " . $found . "

"; $firstRow = udm_get_res_param($res, UDM_PARAM_FIRST_DOC); $lastRow = udm_get_res_param($res, UDM_PARAM_LAST_DOC); $row = $firstRow; for ($i = 0; $i <= ($lastRow - $firstRow); $i++) { $url = udm_get_res_field($res, $i, UDM_FIELD_URL); $head = udm_get_res_field($res, $i, UDM_FIELD_TITLE); $head = str_replace(array(chr(2), chr(3)), "", $head); $text = udm_get_res_field($res, $i, UDM_FIELD_TEXT); $text = str_replace(array(chr(2), chr(3)), "", $text); $text = html_entity_decode($text, ENT_QUOTES, 'cp1251'); echo "
" . $row . ". \n"; echo $head; echo "
\n"; echo "\n"; echo $text; echo "
\n"; echo "
$url
"; echo "
\n"; $row++; } require_once 'Pager.php'; $params = array( 'mode' => 'Sliding', 'append' => true, 'urlVar' => 'page', 'currentPage' => intval($_REQUEST['page']), 'totalItems' => $found, 'perPage' => 10 ); $pager = & Pager::factory($params); echo "
" . $pager->links . "
\n"; } else { echo "

� ���������, �� ������ ������� [" . $query . "] ������ �� �������.

"; } if ($res !== false) { udm_free_res($res); } udm_free_agent($udm_agent); **/ } function show_banner($pid) { $code = @file('./content/rus/news_list/' . $pid . '/list.txt'); if (!empty($code)) { $bid = intval(trim($code [rand(0, count($code) - 1)])); $code = trim(@join('', @file('./content/rus/news_list/' . $bid . '/.abstract'))); if ($code == "") { $code = trim(@join('', @file('./content/rus/news_list/' . $bid . '/body.html'))); echo $code; } else { echo $code; } } } function SC_USER_get_rand($id, $eid, $lng) { $db_path = db_path($id, $eid, $lng); $dat = -1; if (is_file($db_path . "/DB.txt")) { $data = file($db_path . "/DB.txt"); $line = $data [rand(0, count($data) - 1)]; list (, $dat) = explode("||", $line); } else { if (is_file($db_path . "/list.txt")) { $data = file($db_path . "/list.txt"); $line = $data [rand(0, count($data) - 1)]; $dat = intval($line); } } return $dat; } function SC_USER_get_numb($id, $eid, $lng, $numb) { $db_path = db_path($id, $eid, $lng); $dat = -1; if (is_file($db_path . "/DB.txt")) { $data = file($db_path . "/DB.txt"); $line = $data [$numb]; list (, $dat) = explode("||", $line); } else { if (is_file($db_path . "/list.txt")) { $data = file($db_path . "/list.txt"); $line = $data [$numb]; $dat = intval($line); } } return $dat; } function SC_USER_get_type($id, $eid = '', $lng = '') { $vars = SC_USER_HTML_defaults($id, $eid, $lng); $path = $vars ['DB_PATH'] . "/_type"; if (is_file($path)) { return file_get_contents($path); } return ""; } function SC_BASKET_count() { $text = @file_get_contents("./content/basket/_" . $_REQUEST['UID_cookie']); $_COOKIE['BASKET_cookie'] = unserialize($text); if (is_array($_COOKIE['BASKET_cookie'])) { $ret = 0; foreach ($_COOKIE['BASKET_cookie'] as $key => $val) { $ret = $ret + $val ['value']; } return $ret; } return 0; } function SC_BASKET_count_item() { $text = @file_get_contents("./content/basket/_" . $_REQUEST['UID_cookie']); $_COOKIE['BASKET_cookie'] = unserialize($text); if (is_array($_COOKIE['BASKET_cookie'])) { $ret = 0; foreach ($_COOKIE['BASKET_cookie'] as $key => $val) { if ($val ['value'] > 0) $ret++; } return $ret; } return 0; } function SC_getDbh($database) { require_once 'MDB2.php'; $dbh =& MDB2::factory("mysqli://db_user:zy4qCUXs@localhost/$database", array()); if (PEAR::isError($dbh)) { die($dbh->getMessage()); } $dbh->exec("SET NAMES cp1251"); return $dbh; } function SC_declension($digit, $forms) { $remainder = (int)$digit; if ($remainder > 20) { $remainder %= 10; } if ($remainder == 1) { $form = $forms[0]; } elseif ($remainder > 1 && $remainder < 5) { $form = $forms[1]; } else { $form = $forms[2]; } return $digit . " " . $form; } function SC_PAGE_modify_time($id, $eid = '', $lng = '') { $id = intval($id); $time = array( @filemtime('./content/' . $lng . '/' . $eid . '/' . intval($id) . '/MODIFY'), @filemtime('./content/' . $lng . '/' . $eid . '/' . intval($id) . '/menu.html'), ); if ($id == 0) { $time[] = @filemtime('./content/' . $lng . '/' . $eid . '/' . intval($id) . '/DB.txt'); } return max($time); } }