?php /* ===================================================== Назначение: Главная страница ===================================================== */ //define("DEV_MODE", 1); $startIndexScritpTime = microtime(true); //ini_set("display_errors",1); //error_reporting(E_ALL); mb_internal_encoding ( "UTF-8" ); // Timphenix Development Begin $cleanUri = preg_replace("#[/]{2,}#i", '/', $_SERVER['REQUEST_URI']); $cleanUri = preg_replace("#\.html[/]{1,}#i", '.html', $cleanUri); if ($cleanUri != $_SERVER['REQUEST_URI']) { Header('HTTP/1.1 301 Moved Permanently'); header('Location: http://'.$_SERVER['HTTP_HOST'].$cleanUri); } if (stristr($_SERVER['REQUEST_URI'], 'index.php') ) { Header('HTTP/1.1 301 Moved Permanently'); header('Location: /'); } if (mb_substr($_SERVER['HTTP_HOST'], 0, 4) == 'www.') { Header('HTTP/1.1 301 Moved Permanently'); header('Location: http://'.str_replace('www.', '', $_SERVER['HTTP_HOST']).$_SERVER['REQUEST_URI']); } // Timphenix Development Begin @ob_start (); @ob_implicit_flush ( 0 ); @error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE ); @ini_set ( 'display_errors', true ); @ini_set ( 'html_errors', false ); @ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE ); $member_id = FALSE; $is_logged = FALSE; define ( 'ROOT_DIR', dirname ( __FILE__ ) ); @require_once ROOT_DIR . '/config/config.php'; @require_once ROOT_DIR . "/config/defines.php"; require_once ENGINE_DIR . '/init.php'; // modified define ( 'THEME_URL', $config['http_home_url'] . 'themes/' . $config['skin'] ); // modified if (clean_url ( $_SERVER['HTTP_HOST'] ) != clean_url ( $config['http_home_url'] )) { $replace_url = array (); $replace_url[0] = clean_url ( $config['http_home_url'] ); $replace_url[1] = clean_url ( $_SERVER['HTTP_HOST'] ); } else $replace_url = false; $tpl->load_template ( 'main.tpl' ); $tpl->set ( '{calendar}', $tpl->result['calendar'] ); $tpl->set ( '{archives}', $tpl->result['archive'] ); $tpl->set ( '{tags}', $tpl->result['tags_widget'] ); $tpl->set ( '{cat-widget}', $tpl->result['cats_widget'] ); $tpl->set ( '{cat-full}', $tpl->result['cats_full'] ); $tpl->set ( '{vote}', $tpl->result['vote'] ); $tpl->set ( '{topnews}', $tpl->result['topnews'] ); $tpl->set ( '{login}', $tpl->result['login_panel'] ); $tpl->set ( '{info}', $tpl->result['info'] ); $tpl->set ( '{speedbar}', $tpl->result['speedbar'] ); if ($config['allow_skin_change'] == "yes") $tpl->set ( '{changeskin}', ChangeSkin ( THEME_DIR, $config['skin'] ) ); if (count ( $banners ) and $config['allow_banner']) { foreach ( $banners as $name => $value ) { $tpl->copy_template = str_replace ( "{banner_" . $name . "}", $value, $tpl->copy_template ); if ( $value ) { $tpl->copy_template = str_replace ( "[banner_" . $name . "]", "", $tpl->copy_template ); $tpl->copy_template = str_replace ( "[/banner_" . $name . "]", "", $tpl->copy_template ); } } } $tpl->set_block ( "'{banner_(.*?)}'si", "" ); $tpl->set_block ( "'\\[banner_(.*?)\\](.*?)\\[/banner_(.*?)\\]'si", "" ); if (count ( $informers ) and $config['rss_informer']) { foreach ( $informers as $name => $value ) { $tpl->copy_template = str_replace ( "{inform_" . $name . "}", $value, $tpl->copy_template ); } } if ($allow_active_news AND $news_found AND $config['allow_change_sort'] AND $do != "userinfo") { $tpl->set ( '[sort]', "" ); $tpl->set ( '{sort}', news_sort ( $do ) ); $tpl->set ( '[/sort]', "" ); } else { $tpl->set_block ( "'\\[sort\\](.*?)\\[/sort\\]'si", "" ); } if (stripos ( $tpl->copy_template, "[category=" ) !== false) { $tpl->copy_template = preg_replace_callback ( "#\\[category=(.+?)\\](.*?)\\[/category\\]#is", function ($m) use ($category_id) { return check_category($m[1], $m[2], $category_id); }, $tpl->copy_template ); } if (stripos ( $tpl->copy_template, "[not-category=" ) !== false) { $tpl->copy_template = preg_replace_callback ( "#\\[not-category=(.+?)\\](.*?)\\[/not-category\\]#is", function ($m) use ($category_id) { return check_category($m[1], $m[2], $category_id, false); }, $tpl->copy_template ); } if (stripos ( $tpl->copy_template, "[static=" ) !== false) { $tpl->copy_template = preg_replace_callback ( "#\\[static=(.+?)\\](.*?)\\[/static\\]#is", function ($m) { return check_static($m[1], $m[2]); }, $tpl->copy_template ); } if (stripos ( $tpl->copy_template, "[not-static=" ) !== false) { $tpl->copy_template = preg_replace_callback ( "#\\[not-static=(.+?)\\](.*?)\\[/not-static\\]#is", function ($m) { return check_static($m[1], $m[2], false); }, $tpl->copy_template ); } if (stripos ( $tpl->copy_template, "{custom" ) !== false) { $tpl->copy_template = preg_replace_callback ( "#\\{custom(.+?)\\}#i", "custom_print", $tpl->copy_template ); } $config['http_home_url'] = explode ( "index.php", strtolower ( $_SERVER['PHP_SELF'] ) ); $config['http_home_url'] = reset ( $config['http_home_url'] ); // modified - убрать код длешного аякса со страниц if (! $user_group[$member_id['user_group']]['allow_admin']) $config['admin_path'] = ""; $ajax .= <<
{$lang['ajax_info']}
{$pm_alert}
HTML; /* if (strpos ( $tpl->result['content'], "hs.expand" ) !== false or strpos ( $tpl->copy_template, "hs.expand" ) !== false) { if ($config['thumb_dimming']) $dimming = "hs.dimmingOpacity = 0.60;"; else $dimming = ""; if ($config['thumb_gallery'] AND ($dle_module == "showfull" OR $dle_module == "static") ) { $gallery = " hs.align = 'center'; hs.transitions = ['expand', 'crossfade']; hs.addSlideshow({ interval: 4000, repeat: false, useControls: true, fixedControls: 'fit', overlayOptions: { opacity: .75, position: 'bottom center', hideOnMouseOut: true } });"; } else { $gallery = ""; } $js_array[] = "core/assets/plugins/highslide/highslide.js"; switch ( $config['outlinetype'] ) { case 1 : $type = "hs.wrapperClassName = 'wide-border';"; break; case 2 : $type = "hs.wrapperClassName = 'borderless';"; break; case 3 : $type = "hs.wrapperClassName = 'less';\nhs.outlineType = null;"; break; default : $type = "hs.outlineType = 'rounded-white';"; break; } $ajax .= <<
HTML; } */ $js_array = build_js($js_array, $config); if ($allow_comments_ajax AND ($config['allow_comments_wysiwyg'] OR $config['allow_quick_wysiwyg'])) { $lang['wysiwyg_language'] = totranslit( $lang['wysiwyg_language'], false, false ); if ( $config['allow_quick_wysiwyg'] == "2" OR $config['allow_comments_wysiwyg'] == "2" ) { $js_array .="\n
"; } if ( $config['allow_quick_wysiwyg'] == "1" OR $config['allow_comments_wysiwyg'] == "1" ) { $js_array .="\n
"; $js_array .="\n
"; } } if ($config['allow_admin_wysiwyg'] == "1" OR $config['allow_site_wysiwyg'] == "1" OR $config['allow_static_wysiwyg'] == "1") { $js_array .="\n
"; $js_array .="\n
"; $js_array .="\n
"; } if (strpos ( $tpl->result['content'], ""; $js_array .="\n
"; } $tpl->set ( '{AJAX}', $ajax ); $tpl->set ( '{headers}', $js_array ); $tpl->set ( '{metatags}', $metatags ); $tpl->set ( '{content_title}', $content_title ); // modified - Новый тег $tpl->set ( '{content_descr}', $content_descr ); // modified - Новый тег $tpl->set ( '{title}', $meta_title ); // modified - Новый тег $tpl->set ( '{content}', $tpl->result['content'] ); // modified - убран тег дле-контент. $tpl->set ( '{pagination}', $tpl->result['pagination'] ); // modified - убран тег дле-контент. if ($smartphone_detected) { $tpl->set_block ( "'\\[mobile\\](.*?)\\[/mobile\\]'si", "$1" ); $tpl->set_block ( "'\\[not-mobile\\](.*?)\\[/not-mobile\\]'si", "" ); } else { $tpl->set_block ( "'\\[mobile\\](.*?)\\[/mobile\\]'si", "" ); $tpl->set_block ( "'\\[not-mobile\\](.*?)\\[/not-mobile\\]'si", "$1" ); } $tpl->compile ( 'main' ); $tpl->result['main'] = str_ireplace( '{THEME}', THEME_URL, $tpl->result['main'] ); if ($replace_url) $tpl->result['main'] = str_replace ( $replace_url[0]."/", $replace_url[1]."/", $tpl->result['main'] ); $tpl->result['main'] = str_replace ( 'result['main'] ); echo $tpl->result['main']; /*echo "
";
var_dump($_SESSION);
echo "
";*/ $tpl->global_clear (); $db->close (); if (defined("DEV_MODE")) { $time = microtime(true) - $startIndexScritpTime; $time = round($time, 4) . "\n"; $fp = fopen(_LOG_DIR_ . '/index.log', 'a'); fwrite($fp, $time); fclose($fp); } GzipOut(); ?>