query("select * from $doc_type where topic_id='$folder_id' and visible>='{$QUSER['show_visible']}' and publicated>='{$QUSER['show_publicated']}' and deleted='0'{$query} order by sort"); if($db->num_rows()>0) { $content.=''; while($db->next_record()) { $pr_count++; unset($pr_cities); $pr_id=$db->Record["id"]; $pr_title=$db->Record["title"]; $pr_header=$db->Record["header"]; $pr_id=$db->Record["id"]; $pr_visible=$db->Record["visible"]; if($pr_visible=="0") $pr_title="[invisible] ".$pr_title; $pr_publicated=$db->Record["publicated"]; if($pr_publicated=="0") $pr_title="[not publicated] ".$pr_title; $pr_title="$pr_title"; $content.=""; } $content.='
$pr_title
$pr_header
'; } } $doc_type="texts"; if(isset($mat_id) && MatExists($doc_type, $mat_id)) { $db->query("select * from $doc_type where id='$mat_id'"); $db->next_record(); $mat_title=$db->Record["title"]; $db->query("select * from content where mat_table='$doc_type' and mat_id='$mat_id' and visible>='{$QUSER['show_visible']}' and publicated>='{$QUSER['show_publicated']}' and deleted='0' order by sort"); if($db->num_rows()==1 && !isset($page_id)) { $db->next_record(); $page_id=$db->Record["id"]; } else while($db->next_record()) { $pages_id=$db->Record["id"]; $pages_title=$db->Record["title"]; $pages_header=$db->Record["header"]; $content.="

$pages_title"; if($pages_header!="") $content.="
$pages_header"; } } else { $db->query("select count(*) as count from $doc_type where topic_id='$folder_id' and visible>='{$QUSER['show_visible']}' and publicated>='{$QUSER['show_publicated']}' and deleted='0'"); $db->next_record(); if($db->Record["count"]==1) { $db->query("select id from $doc_type where topic_id='$folder_id' and visible>='{$QUSER['show_visible']}' and publicated>='{$QUSER['show_publicated']}' and deleted='0'"); $db->next_record(); Header("Location: $doc_type.php?folder_id=$folder_id&mat_id=".$db->Record["id"]."&L=".$L."&S=".$S."&ss=".$ss); exit; } else { $db->query("select * from topics where pid='$folder_id' and visible='1' order by sort"); if($db->next_record()) { Header("Location: $doc_type.php?folder_id=".$db->Record["id"]); exit; } } /* if($db->Record["count"]>0) { $db->query("select id, title from rubrics where topic_id='$folder_id' order by sort"); if($db->num_rows()>0) { $db2 = new DB; while($db->next_record()) { $rubrics_list[$db->Record["id"]]=$db->Record["title"]; $db2->query("SELECT text_id FROM rubrics_links WHERE rubric_id='".$db->Record["id"]."'"); while($db2->next_record()) { $text_ids[$db->Record["id"]][]=$db2->Record["text_id"]; } if(sizeof($text_ids[$db->Record["id"]])>0) $text_id_list[$db->Record["id"]]=implode(', ',$text_ids[$db->Record["id"]]); } reset($rubrics_list); $text_id_all_rubrics=implode(', ', $text_id_list); ShowTexts('NOT IN ('.$text_id_all_rubrics.')'); while(list($rubric_id, $rubric_title) = each($rubrics_list)) { if(sizeof($text_ids[$rubric_id])>0) { $content.="

".$rubric_title."

"; ShowTexts('IN ('.$text_id_list[$rubric_id].')'); } } } else { ShowTexts(''); } } else if(strlen($content)<20) $content="Раздел не содержит документов...";*/ } include("rus_template.html"); exit; ?>