<?php 


/** 
***************************************************
*欢迎使用免费版SiteTeam企业建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.SiteTeam.cn 
***************************************************
**/




if(!defined('IN_SITETEAM')) { exit('Access Denied'); } define("CURSCRIPT", $mod); if (SITE_REWRITE) { if (preg_match("/^\/\?/i", $_SERVER['REQUEST_URI'])) { $page_url = "http://{$site_url}{$_SERVER['REQUEST_URI']}"; $page_url = url_rewrite($page_url, 'url'); header("HTTP/1.1 301 Moved Permanently"); header("Location:{$page_url}"); exit(); } } $category = $mod; $key = !empty($GETS[1]) ? intval($GETS[1]) : ''; foreach ($article_setting as $k => $v) { if ($k == 'seo_keywords') continue; if ($k == 'seo_description') continue; if(empty($v) && array_key_exists($k, $setting)) $article_setting[$k] = $setting[$k]; } foreach ($article_category[$category] as $k => $v) { if ($k == 'seo_keywords') continue; if ($k == 'seo_description') continue; if (empty($article_category[$category]['seo_title'])) $article_category[$category]['seo_title'] = $article_category[$category]['name'] . "，{$site_title}"; if(empty($article_category[$category][$k]) && array_key_exists($k, $article_setting)) $article_category[$category][$k] = $article_setting[$k]; if(empty($article_category[$category][$k]) && array_key_exists($k, $setting)) $article_category[$category][$k] = $setting[$k]; } extract($article_setting); extract($article_category[$category]); if (time() < 1292206261 && file_exists(SITE_ROOT . "/data/setting/{$site_url}/article/{$category}.index.txt")) { require_once "./admin/admin.inc.php"; if (check_db_structure($site_id)) { $user_article_dir = SITE_ROOT . "/data/setting/{$site_url}/article"; update_article_index($category); @unlink("{$user_article_dir}/{$category}.index.txt"); } } $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); $row = @count($db->execute("select", array('db' => dbname($site_id), 'select' => array('key'), 'table' => 'sm_article', 'where' => array('status >= 3', 'and', "category = {$category}")))); if ($row > 0) { $top_article = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'table' => 'sm_article', 'where' => array('status >= 3', 'and', "category = {$category}"), 'orderby' => array('key', 'desc'), 'limit' => array($row - 12, $row))); } else { $top_article = array(); } $first_article = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'table' => 'sm_article', 'where' => array('is_first = 8', 'and', "category = {$category}"), 'orderby' => array('key', 'desc'), 'limit' => array(0))); $banner_flv = $first_bgsound = ""; if (is_array($first_article) && count($first_article) > 0) { if (empty($key)) { $temp = array_shift($first_article); $key = $temp['key']; } $db->disconnect(); } else { if (empty($key)) { $page = empty($GET['page']) ? empty($_POST['page']) ? 1 : $_POST['page'] : $GET['page']; $limit = 25; $offset = ($page - 1) * $limit; $cache_article_list_dir = SITE_ROOT . "/data/tpl/{$site_url}"; $cache_article_list_html = "{$cache_article_list_dir}/article/" . md5($category . $page) . ".html"; if (file_exists($cache_article_list_html) && time() - filemtime($cache_article_list_html) < CACHE_TIME && IN_CACHE) { $db->disconnect(); include $cache_article_list_html; exit(); } $total_row = $db->execute("select", array('db' => dbname($site_id), 'select' => array('key'), 'where' => array("category={$category}"), 'table' => 'sm_article')); $total_row = count($total_row); $multipage = multipage($total_row, $page, $limit); $temp = $temp = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'where' => array("category = {$category}"), 'table' => 'sm_article', 'limit' => array($multipage['start_row'], $multipage['end_row']), 'orderby' => array('key', 'desc'))); $article_list = array(); if (is_array($temp) && count($temp)) { foreach ($temp as $row) { $article_list[$row['key']] = $row; } } if (isset($banner_off) && $banner_off == "1") { $banner_ad = ''; } if (empty($seo_description)) { if (is_array($article_list) && count($article_list)) { $seo_description = "{$article_category[$category]['name']} - "; $seo_description .= empty($article_setting['seo_description']) ? "{$site_description} - " : "{$article_setting['seo_description']} - "; if (strlen($seo_description) < 180) { $seo_description .= (empty($article_setting['seo_keywords']) ? implode("，", explode(',', $site_keywords)) . " - " : "{$article_setting['seo_keywords']} - "); } $seo_description .= "{$site_title}"; } else { $seo_noindex = 1; } } $db->disconnect(); ob_start(); @eval(tpl_render($skinid, "article_list")); $html = ob_get_clean(); $html = url_rewrite($html); if (CACHE_TIME > 0 && IN_CACHE) { if (!file_exists("{$cache_article_list_dir}/article")) { if (!file_exists($cache_article_list_dir)) { mkdir($cache_article_list_dir); } mkdir("{$cache_article_list_dir}/article"); } if ($fp = @fopen($cache_article_list_html, "w")) { if (@fwrite($fp, $html)) { @fclose($fp); echo $html; } else { exit(siteteam_sys_msg(3)); } } else { exit(siteteam_sys_msg(3)); } } else { echo $html; } exit(); } else { $db->disconnect(); } } if (!empty($key)) { $cache_article_list_dir = SITE_ROOT . "/data/tpl/{$site_url}"; $cache_article_html = "{$cache_article_list_dir}/article/html/" . md5($category . $key) . ".html"; if (file_exists($cache_article_html) && time() - filemtime($cache_article_html) < CACHE_TIME && IN_CACHE) { include $cache_article_html; exit(); } } $article_info = read_array_file(SITE_ROOT . "/data/setting/{$site_url}/article/{$category}/{$key}.txt"); if (!(is_array($article_info) && count($article_info))) { header("HTTP/1.0 404 Not Found"); exit(); } if (!empty($article_info['new_page'])) { if (CACHE_TIME > 0) { $stat_code = '<script language="javascript" type="text/javascript">window.location	=  "' . $article_info['new_page'] . '";</script>' . $stat_code; } else { $page_url = $article_info['new_page']; header("HTTP/1.1 301 Moved Permanently"); header("Location:{$page_url}"); exit(); } } if (empty($article_info['seo_title'])) $article_info['seo_title'] = (empty($article_info['body_name']) ? '' : "{$article_info['body_name']}，") . $article_category[$category]['name'] . "，{$site_title}"; foreach ($article_info as $k => $v) { if ($k == 'seo_keywords') continue; if ($k == 'seo_description') continue; if(empty($article_info[$k]) && array_key_exists($k, $article_category[$category])) $article_info[$k] = $article_category[$category][$k]; if(empty($article_info[$k]) && array_key_exists($k, $article_setting)) $article_info[$k] = $article_setting[$k]; if(empty($article_info[$k]) && array_key_exists($k, $setting)) $article_info[$k] = $setting[$k]; } extract($article_info); $navdir = array(); $content = preg_replace_callback("|==(.+)==|Uis", "parse_content", $content); function parse_content($matches) { global $navdir; $temp = strip_tags($matches[1]); $navdir[] = $temp; return $matches[1] . '<a name="' . rawurlencode($temp) . '"></a>'; } $recent_link=explode("\n", $recent_link); foreach($recent_link as $k=>$v){ $v = trim($v); if(empty($v)) { continue; } else { $recent_links[] = explode("|", $v); } } ubbcode($content); if (SITE_REWRITE) { $content = preg_replace('/src=(["|\']{1})attachments/is', 'src=$1' . SITE_PATH . '/attachments', $content); $content = preg_replace('/href=(["|\']{1})attachments/is', 'href=$1' . SITE_PATH . '/attachments', $content); } if (isset($banner_off) && $banner_off == "1") { $banner_ad = ''; } if (empty($seo_description)) { $seo_t_content = preg_replace("/[\s]+/", "", (strip_tags($content))); $seo_t_keywords = preg_split("/，|,|\./", preg_replace("/[\s]+/", "", $site_keywords), "-1"); $seo_description = str_sub($seo_t_content, 250, '…'); $seo_description = preg_replace("/&amp;|nbsp;/", "", $seo_description); $seo_description = preg_split("/，|。|：|！|？|,|\.|\:|\!|\?|-|_|\|/", $seo_description, "-1"); if (count($seo_description)) { foreach ($seo_description as $k => $v) { $keywords = array_pop($seo_t_keywords); if (!empty($keywords)) { $seo_description[$k] .= "，{$keywords}"; } } } $seo_description = implode("，", $seo_description); $seo_description = "{$site_title} - {$article_category[$category]['name']} - {$body_name} ：{$seo_description}"; } ob_start(); @eval(tpl_render($skinid, "article")); $html = ob_get_clean(); $html = url_rewrite($html); if (CACHE_TIME > 0 && IN_CACHE) { if (!file_exists("{$cache_article_list_dir}/article/html")) { if (!file_exists($cache_article_list_dir)) { mkdir($cache_article_list_dir); } if (!file_exists("{$cache_article_list_dir}/article")) { mkdir("{$cache_article_list_dir}/article"); } mkdir("{$cache_article_list_dir}/article/html"); } if ($fp = @fopen($cache_article_html, "w")) { if (@fwrite($fp, $html)) { @fclose($fp); echo $html; } else { exit(siteteam_sys_msg(3)); } } else { exit(siteteam_sys_msg(3)); } } else { echo $html; } ?>