Россия-3 >> "; $pg_months = array("Января", "Февраля", "Марта", "Апреля", "Мая", "Июня", "Июля", "Августа", "Сентября", "Октября", "Ноября", "Декабря"); $pg_countrys = array("rus" => "Россия", "ukr" => "Украина", "tur" => "Турция", "mol" => "Молдавия"); $i = 0; $CURRENT_TIMESTAMP=date("YmdHis",mktime()); $pgs_start=intval($_REQUEST['from']); $db_query = "SELECT `topic_id`, `topic_name`, `title`, `kword`, `descr`, `announce_num`, `path_lat`, `path_rus` FROM `r3_topic`" ." WHERE `type` = '0'" ." AND CONCAT(`path_lat`, `topic_name`, '/') = '".$pg_path."'" ." LIMIT 1"; $db_result=mysql_query_ext($db_query); if (!$db_result) return array(false, "

Ошибка доступа к базе: " . mysql_error()."
\n"); if (mysql_num_rows($db_result) == 1) { list($db_topic_id, $db_topic_name, $db_title, $db_kword, $db_descr, $db_announce_num, $db_path_lat, $db_path_rus) = mysql_fetch_row($db_result); if ($db_title != "") $pg_title = $db_title; if ($db_kword != "") $pg_keywords = $db_kword; if ($db_descr != "") $pg_description = $db_descr; if ($db_announce_num != "") $pg_announce_num = $db_announce_num; // цепочка навигации /* AAE Comment:Россия-3 >> Политика >> Россия >> ЮКОС*/ $name_arr = explode("/", $db_path_lat.$db_topic_name); $title_arr = explode(">>", $db_path_rus.$db_title); $title_arr = array_reverse ($title_arr); foreach ($title_arr as $num => $title) { $title_arr[$num] = "".$title.""; array_pop($name_arr); } $title_arr = array_reverse ($title_arr); $pg_nav_line .= implode(" >> ", $title_arr); } // список дочерних рубрик $db_query = "SELECT `title`, CONCAT(`path_lat`, `topic_name`, '/') FROM `r3_topic`" ." WHERE `type` = '0'" ." AND `parent_id` = '".$db_topic_id."'"; $db_result=mysql_query_ext($db_query); $pg_tp_list_tmpl = file_get_contents("inc/tmpl_topic_item.html"); if (!$db_result) echo "

Ошибка доступа к базе: " . mysql_error()."
\n"; elseif ($pg_tp_list_tmpl != false && mysql_num_rows($db_result) > 0) { while (list($pg_tp_name, $pg_tp_path) = mysql_fetch_row($db_result)) { $pg_tp_item = prepare_toeval($pg_tp_list_tmpl); eval("\$pg_tp_item = \"$pg_tp_item\";"); $pg_tp_list .= $pg_tp_item; } } else {$pg_comm2_on = "";} $db_query = "SELECT `r3_text`.`text_id`, `r3_text`.`country`, `r3_text`.`date_pub`, `r3_text`.`text_name`, `r3_text`.`title`, `r3_text`.`text`," ." `r3_text`.`pict1_ext`, `r3_text`.`pict2_ext`, `r3_text`.`pict_alt`, `r3_topic`.`topic_name`, `r3_topic`.`path_lat`," ." `r3_users`.`user_id`, `r3_users`.`login`, `r3_users`.`type`, `r3_users`.`fio` FROM `r3_topic`" ." LEFT JOIN `r3_text` ON `r3_topic`.`topic_id` = `r3_text`.`topic_id`" ." LEFT JOIN `r3_users` ON `r3_text`.`user_id` = `r3_users`.`user_id`" ." WHERE CONCAT(`r3_topic`.`path_lat`, `r3_topic`.`topic_name`, '/') LIKE '".$pg_path."%'" ." AND `r3_text`.`usr_active` = '1'" ." AND `r3_text`.`type` = '0' " ." ORDER BY `r3_text`.`date_ord` DESC" ." LIMIT $pgs_start,".$pg_announce_num; //Removed by L,120419 // ." AND `r3_text`.`date_pub` < CURRENT_TIMESTAMP" $pg_tmpl_1 = file_get_contents("inc/tmpl_start1_show.html");// шаблон share1 $pg_tmpl_20 = file_get_contents("inc/tmpl_start20_show.html");// шаблон share20 $pg_tmpl_21 = file_get_contents("inc/tmpl_start21_show.html");// шаблон share21 $pg_tmpl_22 = file_get_contents("inc/tmpl_start22_show.html");// шаблон share22 $pg_tmpl_lnx = file_get_contents("inc/tmpl_start_lnk_show.html"); if ($pg_tmpl_1 == false || $pg_tmpl_20 == false || $pg_tmpl_21 == false || $pg_tmpl_22 == false || $pg_tmpl_lnx == false) {echo "

Ошибка доступа к файлам шаблона.
\n"; echo ""; exit;} $db_result = mysql_query_ext($db_query); if (!$db_result) {echo "

Ошибка доступа к базе: " . mysql_error()."
\n"; echo ""; exit;} $pg_announce_num = mysql_num_rows($db_result); //echo $pg_announce_num, "
\n"; while (list($pg_text_id, $pg_country, $pg_date_pub, $pg_text_name, $pg_text_title, $pg_text, $pg_pict1_ext, $pg_pict2_ext, $pg_pict_alt, $pg_tp_topic_name, $pg_tp_path_lat, $pg_us_user_id, $pg_us_login, $pg_us_type, $pg_us_fio) = mysql_fetch_row($db_result)) { $pg_editor_link = ""; $pg_user_link = ""; if ($pg_us_user_id !== NULL && $pg_us_type > 2) { // оформляем пользуна $pg_user_link = "".$pg_us_fio.""; } // страна $pg_country_name = $pg_countrys[$pg_country]; // дата if (preg_match("/^([12][0-9]{3})(?:(1[012])|0([1-9]))(?:([123][0-9])|0([1-9]))/", $pg_date_pub, $matches)) { $pg_date_pub = $matches[4].$matches[5]." ".$pg_months[intval($matches[2].$matches[3])-1]." ".$matches[1]; $pg_date_pub2 = $matches[4].$matches[5]." ".$pg_months[intval($matches[2].$matches[3])-1]; } else $pg_date_pub = ""; // оформляем путь if ($pg_tp_topic_name === NULL) {$pg_tp_path_lat = ""; $pg_tp_topic_name = "";} $pg_text_path = $pg_tp_path_lat.$pg_tp_topic_name."/".$pg_text_name; // оформляем ссылку "Редактировать" if (($pg_us_user_id !== NULL && isset($_SESSION["us_id"]) && $pg_us_user_id == $_SESSION["us_id"]) || (isset($_SESSION["us_type"]) && 3 > $_SESSION["us_type"])) $pg_editor_link = "

Редактировать статью

"; else $pg_editor_link = " "; // оформляем ссылку "Комментировать" if (($pg_us_user_id !== NULL && isset($_SESSION["us_id"]) && $pg_us_user_id == $_SESSION["us_id"]) || (isset($_SESSION["us_type"]) && 5 > $_SESSION["us_type"])) $pg_quote_link = "

Комментировать статью(".GetQuotesCount($pg_text_id).")

"; else $pg_quote_link = " "; $pg_text = preg_replace("{]+>}i", " ", $pg_text); // Убираем все теги по всему тексту $pg_text = preg_replace("{^( |\s)*}si", " ", $pg_text); // В начале текста могу оказаться пробелы или " " $pg_text_cut = 500; $pg_text2_cut = 300; // Кол-во символов в строке $re_text_cut = "{[.,:;]?(\s\S{1,4})*\s\S*$}s"; // Рег. Выр. для удаления последнего солва, предлога и знаков препинания $pg_text = preg_replace($re_text_cut, " ...", substr($pg_text, 0, $pg_text_cut)); $pg_text2 = preg_replace($re_text_cut, " ...", substr($pg_text, 0, $pg_text2_cut)); // картинка if ($pg_pict2_ext !== NULL) $pg_pict2_path = "/pic/".$pg_text_id."_2.".$pg_pict2_ext; if ($pg_pict1_ext !== NULL) $pg_pict1_path = "/pic/".$pg_text_id."_1.".$pg_pict1_ext; if ($pg_pict2_ext === NULL && $pg_pict1_ext !== NULL) $pg_pict2_path = $pg_pict1_path; if ($pg_pict2_ext === NULL && $pg_pict1_ext === NULL) {$pg_pict_none = "_none"; $pg_comm_on = "";} // счётчик четности и выбор шаблона $i++; if ($i == 1 || ($i == 2 && ($pg_announce_num % 2) == 0)) { // шаблон share1 $pg_part = prepare_toeval($pg_tmpl_1); eval("\$pg_part = \"$pg_part\";"); $pg_cent_col .= $pg_part; } elseif (($pg_announce_num % 2) == 0) { if (($i%2) == 1) { // шаблон share21 //$pg_part = prepare_toeval($pg_tmpl_21); list($pg_text_path1, $pg_country1, $pg_country_name1, $pg_date_pub21, $pg_text_title1, $pg_text21, $pg_pict2_path1, $pg_pict_alt1, $pg_user_link1, $pg_editor_link1) = array($pg_text_path, $pg_country, $pg_country_name, $pg_date_pub2, $pg_text_title, $pg_text2, $pg_pict2_path, $pg_pict_alt, $pg_user_link, $pg_editor_link); unset($pg_text_path, $pg_country, $pg_country_name, $pg_date_pub2, $pg_text_title, $pg_text2, $pg_pict2_path, $pg_pict_alt, $pg_user_link, $pg_editor_link); /* AAE Comment:*/ } else { // шаблон share22 //$pg_part = prepare_toeval($pg_tmpl_22); $pg_part = prepare_toeval($pg_tmpl_20); eval("\$pg_part = \"$pg_part\";"); $pg_cent_col .= $pg_part; unset($pg_text_path1, $pg_country1, $pg_country_name1, $pg_date_pub21, $pg_text_title1, $pg_text21, $pg_pict2_path1, $pg_pict_alt1, $pg_user_link1, $pg_editor_link1, $pg_text_path, $pg_country, $pg_country_name, $pg_date_pub2, $pg_text_title, $pg_text2, $pg_pict2_path, $pg_pict_alt, $pg_user_link, $pg_editor_link); /* AAE Comment:*/ } } else { if (($i%2) == 0) { // шаблон share21 //$pg_part = prepare_toeval($pg_tmpl_21); list($pg_text_path1, $pg_country1, $pg_country_name1, $pg_date_pub21, $pg_text_title1, $pg_text21, $pg_pict2_path1, $pg_pict_alt1, $pg_user_link1, $pg_editor_link1) = array($pg_text_path, $pg_country, $pg_country_name, $pg_date_pub2, $pg_text_title, $pg_text2, $pg_pict2_path, $pg_pict_alt, $pg_user_link, $pg_editor_link); unset($pg_text_path, $pg_country, $pg_country_name, $pg_date_pub2, $pg_text_title, $pg_text2, $pg_pict2_path, $pg_pict_alt, $pg_user_link, $pg_editor_link); /* AAE Comment:*/ } else { // шаблон share22 //$pg_part = prepare_toeval($pg_tmpl_22); $pg_part = prepare_toeval($pg_tmpl_20); eval("\$pg_part = \"$pg_part\";"); $pg_cent_col .= $pg_part; unset($pg_text_path1, $pg_country1, $pg_country_name1, $pg_date_pub21, $pg_text_title1, $pg_text21, $pg_pict2_path1, $pg_pict_alt1, $pg_user_link1, $pg_editor_link1, $pg_text_path, $pg_country, $pg_country_name, $pg_date_pub2, $pg_text_title, $pg_text2, $pg_pict2_path, $pg_pict_alt, $pg_user_link, $pg_editor_link); /* AAE Comment:*/ } } //eval("\$pg_part = \"$pg_part\";"); //$pg_cent_col .= $pg_part; } // так, теперь проставим ещё 10 более старых ссылок и наладим нафигацию // $pg_announce_num=$pg_announce_saved_num; $pg_announce_num=$db_announce_num; $db_query = "SELECT `r3_text`.`text_id`, `r3_text`.`country`, `r3_text`.`date_pub`, `r3_text`.`text_name`, `r3_text`.`title`, `r3_text`.`text`," ." `r3_text`.`pict1_ext`, `r3_text`.`pict2_ext`, `r3_text`.`pict_alt`, `r3_topic`.`topic_name`, `r3_topic`.`path_lat`," ." `r3_users`.`user_id`, `r3_users`.`login`, `r3_users`.`type`, `r3_users`.`fio` FROM `r3_topic`" ." LEFT JOIN `r3_text` ON `r3_topic`.`topic_id` = `r3_text`.`topic_id`" ." LEFT JOIN `r3_users` ON `r3_text`.`user_id` = `r3_users`.`user_id`" ." WHERE CONCAT(`r3_topic`.`path_lat`, `r3_topic`.`topic_name`, '/') LIKE '".$pg_path."%'" ." AND `r3_text`.`usr_active` = '1'" ." AND `r3_text`.`type` = '0'" ." AND `r3_text`.`date_pub` < CURRENT_TIMESTAMP" ." ORDER BY `r3_text`.`date_ord` DESC" ." LIMIT ".intval($pgs_start+$pg_announce_num).",10"; $db_result = mysql_query_ext($db_query); if (!$db_result) {echo "

Ошибка доступа к базе: " . mysql_error()."
\n"; echo ""; exit;} while (list($pg_text_id, $pg_country, $pg_date_pub, $pg_text_name, $pg_text_title, $pg_text, $pg_pict1_ext, $pg_pict2_ext, $pg_pict_alt, $pg_tp_topic_name, $pg_tp_path_lat, $pg_us_user_id, $pg_us_login, $pg_us_type, $pg_us_fio) = mysql_fetch_row($db_result)) { // оформляем путь if ($pg_tp_topic_name === NULL) {$pg_tp_path_lat = ""; $pg_tp_topic_name = "";} $pg_text_path = $pg_tp_path_lat.$pg_tp_topic_name."/".$pg_text_name; // картинка if ($pg_pict2_ext !== NULL) $pg_pict2_path = "/pic/".$pg_text_id."_2.".$pg_pict2_ext; if ($pg_pict1_ext !== NULL) $pg_pict1_path = "/pic/".$pg_text_id."_1.".$pg_pict1_ext; if ($pg_pict2_ext === NULL && $pg_pict1_ext !== NULL) $pg_pict2_path = $pg_pict1_path; if ($pg_pict2_ext === NULL && $pg_pict1_ext === NULL) {$pg_pict_none = "_none"; $pg_comm_on = "";} //date if (preg_match("/^([12][0-9]{3})(?:(1[012])|0([1-9]))(?:([123][0-9])|0([1-9]))/", $pg_date_pub, $matches)) { $pg_date_pub = $matches[4].$matches[5]." ".$pg_months[intval($matches[2].$matches[3])-1]." ".$matches[1]; $pg_date_pub2 = $matches[4].$matches[5]." ".$pg_months[intval($matches[2].$matches[3])-1]; } else $pg_date_pub = ""; $pg_part = prepare_toeval($pg_tmpl_lnx); eval("\$pg_part = \"$pg_part\";"); $pg_cent_col .= $pg_part; } //pages count $db_query = "SELECT COUNT(*) as total " ." FROM `r3_topic`" ." LEFT JOIN `r3_text` ON `r3_topic`.`topic_id` = `r3_text`.`topic_id`" ." LEFT JOIN `r3_users` ON `r3_text`.`user_id` = `r3_users`.`user_id`" ." WHERE CONCAT(`r3_topic`.`path_lat`, `r3_topic`.`topic_name`, '/') LIKE '".$pg_path."%'" ." AND `r3_text`.`usr_active` = '1'" ." AND `r3_text`.`type` = '0'" ." AND `r3_text`.`date_pub` < CURRENT_TIMESTAMP"; $ra=mysql_fetch_array(mysql_query_ext($db_query)); $pg_tcount=intval($ra["total"]); if($pg_announce_num<$pg_tcount) { $pg_part="

Страницы: "; $cuco=0; $dico=0; $pg_announce_num=(($pg_announce_num==0)?1:$pg_announce_num); $ladi=intval($from/$pg_announce_num)+10; for($i=0;$i<$ladi;$i++) { $dico++; if($from==$cuco) $pg_part.="["; $pg_part.="$dico"; if($from==$cuco) $pg_part.="]"; $pg_part.=" "; $cuco+=$pg_announce_num; if($cuco>$pg_tcount) break; } $pg_part.="
"; } else $pg_part=""; $pg_cent_col .= $pg_part; // вывод $pg_tp_title = cyr_case_ch($pg_title, 1); if($pg_title[0]!=' ')$pg_title=' :: :: '.$pg_title; $pg_header = file_get_contents("inc/tmpl_topic_show.html"); $pg_header = prepare_toeval($pg_header); eval("\$pg_header = \"$pg_header\";"); $pg_cent_col = $pg_header.$pg_cent_col; ?> Нет такого материала на сайте