Полезные материалы "; readfile("materialy/index.htm"); require 'inc/tail_page.htm'; require 'inc/tail.htm'; } else { //material page $fname="materialy/".$article.".htm"; $article_id = $article; $article = "materialy_".$article; if(!file_exists($fname)) { if($article == "materialy_osobennosti_") { header("HTTP/1.1 301 Moved Permanently"); header('Location: http://stimul.kiev.ua/materialy.htm?a=osobennosti_ustanovki_1s77_windows_7'); die(); } if($article == 'materialy_osobennosti_ustano') { header("HTTP/1.1 301 Moved Permanently"); header('Location: http://stimul.kiev.ua/materialy.htm?a=osobennosti_ustanovki_1s77_windows_7'); die(); } if($article == 'materialy_podklyuchenie_i_nastroyka_ska') { header("HTTP/1.1 301 Moved Permanently"); header('Location: http://stimul.kiev.ua/materialy.htm?a=podklyuchenie_i_nastroyka_skanera_tipovye_oshibki_i_problemy'); die(); } if($article == 'materialy_metodika') { header("HTTP/1.1 301 Moved Permanently"); header('Location: http://stimul.kiev.ua/kursy_buhgalterskie.htm'); die(); } if($article == 'materialy_v_dokumente_postuplenie_tovarov_iz_pererabotki_na_zakladke_ne_ukazyvay') { header("HTTP/1.1 301 Moved Permanently"); header('Location: http://stimul.kiev.ua/materialy.htm?a=v_dokumente_postuplenie_tovarov_iz_pererabotki_na_zakladke_materialy_ne_ukazyvay'); die(); } // try... $sql = "SELECT `articles`.`article_id` \n" . "FROM `articles` \n" . "INNER JOIN `folders` ON `folders`.`id` = `articles`.`folder` \n" . "WHERE (`articles`.`article_id` LIKE '". str_replace('...','%',mysql_real_escape_string($article)) ."') \n" . " AND(`folders`.`name` = 'info')"; $result = mysql_query($sql) or die("Invalid query: " .$sql.': '. mysql_error()); if ($row = mysql_fetch_assoc($result)) { header("HTTP/1.1 301 Moved Permanently"); header('Location: http://stimul.kiev.ua/materialy.htm?a='.str_replace('materialy_','',$row["article_id"])); die(); } error404('materialy.htm/a',$article_id); }; $sql = "SELECT `articles`.`id`, `articles`.`article_id` \n" . ", `articles`.`name` as article_name \n" . ", `articles`.`descr` as description \n" . ", `articles`.`keywords` as keywords \n" . ", `articles`.`footer` as footer \n" . ", UNIX_TIMESTAMP(`articles`.`pub_date`) as pub_date \n" . ", CONCAT_WS(' / ',`p4`.`name`,`p3`.`name`,`p2`.`name`,`p1`.`name`) as paragraph \n" . ", `images`.`image` as image \n" . "FROM `articles` \n" . "LEFT JOIN `images` ON `images`.`article_id` = `articles`.`id` \n" . "INNER JOIN `folders` ON `folders`.`id` = `articles`.`folder` \n" . "LEFT JOIN `paragraphs` AS `p1` ON `articles`.`paragraph` = `p1`.`id` \n" . "LEFT JOIN `paragraphs` AS `p2` ON `p1`.`parentid` = `p2`.`id` \n" . "LEFT JOIN `paragraphs` AS `p3` ON `p2`.`parentid` = `p3`.`id` \n" . "LEFT JOIN `paragraphs` AS `p4` ON `p3`.`parentid` = `p4`.`id` \n" . "WHERE (`articles`.`article_id` = '". mysql_real_escape_string($article) ."') \n" . " AND(`folders`.`name` = 'info')"; $result = mysql_query($sql) or die("Invalid query: " .$sql.': '. mysql_error()); $xart_info = array(); while ($row = mysql_fetch_assoc($result)) { $xart_info[$row["article_id"]] = $row; } mysql_free_result($result); $xart_info_keys = array_keys($xart_info); for($i=0;$imktime()) { error404('materialy.htm/a/date',$article_id); }; $art_paragraph = $b_info["paragraph"]; $subparagraph2 = $art_paragraph; $subparagraph2_url = "tags.php?t=".urlencode($art_paragraph)."&f=info"; $extra_head = ' '; if($img_file!='') { $extra_head = $extra_head.' '; } $extra_html = ' itemscope="" itemtype="http://schema.org/Article"'; // find index of this article $lctag = $art_paragraph; $pos = strrpos($lctag,'/'); if($pos != FALSE) { $lctag = trim(substr($lctag,0,$pos-1)); // parent $my_cat = filter_by_tag_sql($lctag, "NONE", 1, "*", "info"," and (`articles`.`article_id` LIKE 'materialy_index%')"); foreach($my_cat as $finfo_name) { $new_url = str_replace(".txt","",$finfo_name); $new_url = str_replace("info/materialy_","",$new_url); $sql = "SELECT CONCAT_WS(' / ',`p4`.`name`,`p3`.`name`,`p2`.`name`,`p1`.`name`) as paragraph \n" . "FROM `articles` \n" . "INNER JOIN `folders` ON `folders`.`id` = `articles`.`folder` \n" . "LEFT JOIN `paragraphs` AS `p1` ON `articles`.`paragraph` = `p1`.`id` \n" . "LEFT JOIN `paragraphs` AS `p2` ON `p1`.`parentid` = `p2`.`id` \n" . "LEFT JOIN `paragraphs` AS `p3` ON `p2`.`parentid` = `p3`.`id` \n" . "LEFT JOIN `paragraphs` AS `p4` ON `p3`.`parentid` = `p4`.`id` \n" . "WHERE (`articles`.`pub_date` <= NOW()) AND (`articles`.`article_id` = '". mysql_real_escape_string('materialy_'.$new_url) ."') \n" . " AND(`folders`.`name` = 'info')"; $result = mysql_query($sql) or die("Invalid query: " .$sql.': '. mysql_error()); $mp = ""; if ($row = mysql_fetch_assoc($result)) { $mp = $row["paragraph"]; } mysql_free_result($result); if(strtolower($lctag) == strtolower($mp)) { $index_id = $new_url; break; } } } } require 'inc/head.htm'; require 'inc/menu.htm'; require 'inc/head_page.htm'; if(isset($art_paragraph)) { // print paragraph navigation $lctag = $art_paragraph; $lcname = $lctag; $pos = strrpos($lctag,'/'); if($pos!==false) { $lcname = trim(substr($lctag,$pos+1)); } echo "

"; $lstr = ''.$lcname.''; while($pos!==false) { $lctag = trim(substr($lctag,0,$pos-1)); $lcname = $lctag; $pos = strrpos($lctag,'/'); if($pos!==false) { $lcname = trim(substr($lctag,$pos+1)); } $lstr = ''.$lcname.' /
' . $lstr; } echo $lstr; echo '

'; if($index_id != "") { echo '

'.'Оглавление'.'

'; } // echo "

" . $art_paragraph . "

"; }; echo "

$article_name

"; $index_name = "materialy/".$article_id.".txt"; if(file_exists($index_name)) { //catalog $filename = "_cache/".$article_id.".dat"; if(file_exists($filename)) $ftime = filemtime($filename); else $ftime = FALSE; if($ftime + (7*24*3600) < mktime()) { $ftime = FALSE; } if($ftime == FALSE) { $load = sys_getloadavg(); if($load[0]>1.0) { $ftime = TRUE; }; } if($ftime != FALSE) { if(!file_exists($filename)) { $ftime = FALSE; } elseif(!filesize($filename)) { $ftime = FALSE; } } if($ftime == FALSE) { $before_output = ob_get_clean(); ob_start(); //make all... readfile('materialy/'.$article_id.'.htm'); $info_descr = file_get_contents("materialy/".$article_id.".txt"); $a_info = preg_split('/\n|\r\n?/', $info_descr); $info_catalog_name = $a_info[0]; for($i=1;$i0) { echo "

$one_info

"; show_articles_by_array_sql($in_this_cat,0,0, "info"); echo "

 

Читать далее: "; $lctag = $full_name; $lcname = $lctag; $pos = strrpos($lctag,'/'); if($pos!==false) { $lcname = trim(substr($lcname,$pos+1)); } $r_href = " ".$lcname.""; $pos = strrpos($lctag,'/'); while($pos!==false) { $lctag = trim(substr($lctag,0,$pos-1)); $lcname = $lctag; $pos = strrpos($lctag,'/'); if($pos!==false) { $lcname = trim(substr($lcname,$pos+1)); } $r_href = " ".$lcname."" . ' / ' . $r_href; $pos = strrpos($lctag,'/'); } echo $r_href."

"; } } //end make all $my_output = ob_get_clean(); file_put_contents($filename, $my_output); ob_start(); echo $before_output; echo $my_output; } else { readfile($filename); } } else { //material //readfile($fname); $cache_filename = "_cache/materialy_".$article_id.".dat"; if(file_exists($cache_filename)) { $ftime = filemtime($cache_filename); if($ftime + (30*24*3600) < mktime()) { $ftime = FALSE; } } else { $ftime = FALSE; }; if($ftime == FALSE) { $load = sys_getloadavg(); if($load[0]>1.0) { $ftime = TRUE; }; } if($ftime != FALSE) { if(!file_exists($cache_filename)) { $ftime = FALSE; } elseif(!filesize($cache_filename)) { $ftime = FALSE; } } if($ftime == FALSE) { $string = file_get_contents('materialy/'.$article_id.'.htm'); $string = get_smart_tags($string,'info'); file_put_contents($cache_filename, gzcompress($string)); echo $string; } else { echo gzuncompress(file_get_contents($cache_filename)); } } $filename = "_cache/materialy_".$article_id."_footer.dat"; if(file_exists($filename)) $ftime = filemtime($filename); else { $ftime = FALSE; $pingURL = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; rpc_ping($pingURL); } if($ftime + (14*24*3600) < mktime()) { $ftime = FALSE; } if($ftime == FALSE) { $load = sys_getloadavg(); if($load[0]>1.2) { $ftime = TRUE; }; } if($ftime != FALSE) { if(!file_exists($filename)) { $ftime = FALSE; } elseif(!filesize($filename)) { $ftime = FALSE; } } if($ftime == FALSE) { $before_output = ob_get_clean(); ob_start(); //make all... if(isset($xart_info[$article])) { $b_info = $xart_info[$article]; $tags = $b_info["tags"]; $art_paragraph = $b_info["paragraph"]; $bans = bans_by_tags($tags); if(sizeof($bans)>0) { $str_text = "

"; foreach ($bans as $one_ban) { $str_text = $str_text . "" . $one_ban[0] . "
"; } $str_text = $str_text . "

"; echo $str_text; } if(sizeof($tags)>0) { $tags_sql = ""; foreach ($tags as $one_tag) { $tags_sql = $tags_sql . ",'" . mysql_real_escape_string($one_tag) . "'"; } $tags_sql = substr($tags_sql, 1); $tag_array = &build_tag_array_sql("info"," and (`tags`.`keyword` in (".$tags_sql."))",0); foreach ($tags as $one_tag) { $sort_idx1_arr[] = $tag_array[lcase($one_tag)]; } array_multisort($sort_idx1_arr, SORT_ASC, $tags); $max_tag_array = max($sort_idx1_arr); $str_text = "

Другие материалы по теме:
"; foreach ($tags as $one_tag) { $cnt = $tag_array[lcase($one_tag)]; if($cnt>1) { if ($cnt <= 0.025*$max_tag_array) { $font_size = 1; } elseif ($cnt <= 0.05*$max_tag_array) { $font_size = 2; } elseif ($cnt <= 0.1*$max_tag_array) { $font_size = 2; } elseif ($cnt <= 0.2*$max_tag_array) { $font_size = 3; } elseif ($cnt <= 0.4*$max_tag_array) { $font_size = 4; } elseif ($cnt <= 0.8*$max_tag_array) { $font_size = 5; } else { $font_size = 6; } $str_text = $str_text . "" . $one_tag . ", "; } } $str_text = substr($str_text,0,-2); $str_text = $str_text . "

 

"; $str_text = $str_text . "

Материалы из раздела: " . $art_paragraph . "

"; $my_name = $article; $a_by_first_tag = intersect_by_tags_sql($tags, $my_name, "info", 5); if(sizeof($a_by_first_tag)>0) { echo $str_text . "

 

Другие материалы по теме:

"; show_articles_by_array_sql($a_by_first_tag,0,0, "info"); } echo "
"; } } //end make all $my_output = ob_get_clean(); file_put_contents($filename, $my_output); ob_start(); echo $before_output; echo $my_output; } else { readfile($filename); } require 'inc/tail_page.htm'; require 'inc/tail.htm'; } ?>