$v) { if (is_int($k) && $prefix != null) $k = urlencode($prefix . $k); if (!empty($key)) $k = $key.'['.urlencode($k).']'; if (is_array($v) || is_object($v)) array_push($ret, http_build_query($v, '', $sep, $k)); else array_push($ret, $k.'='.urlencode($v)); } if (empty($sep)) $sep = ini_get('arg_separator.output'); return implode($sep, $ret); } } function getPageParam (/* array */$param, /*array*/$avoid_key = null) { if (is_array($param)) { if (!empty($avoid_key)) { foreach ((array)$avoid_key as $v) { unset($param[$v]); } } return http_build_query($param); } return false; } function getBoolean($type) { if ($type === 'true') { return true; }elseif ($type === 'false') { return false; }else { return $type; } } //取得URL数据变量 list($filename, $query) = explode("?", $_SERVER['REQUEST_URI']); parse_str($query, $output); $nodeid = getValue(mysql_escape_string($_GET['nodeid']), $output['nodeid'], mysql_escape_string($_GET['defalutNodeid']), null); if (empty($nodeid)) { echo '参数错误'; exit; } $avoid_search_nid = getValue(array_map('mysql_escape_string', (array)$_GET['a_s_n']), array_map('mysql_escape_string', (array)$output['a_s_n']), array()); $config_shownum = getValue(mysql_escape_string($_GET['c_s']), $output['c_s'], $shownum); $config_colnum = getValue(mysql_escape_string($_GET['c_c']), $output['c_c'], $colnum); $config_template = getValue(mysql_escape_string($_GET['c_t']), $output['c_t'], null); //分页时用的uri $config_uri = getValue(mysql_escape_string($_GET['c_u']), $output['c_u'], null); require_once(dirname(__FILE__)."/../config.dy"); require_once(dirname(__FILE__)."/../include/special.dy"); require_once(dirname(__FILE__)."/../lib_function.dy"); if (($template_path = getTemplatePath($templatedir, rtrim($templatedir, '/').'/'.$config_template)) === false) { die('模板路径不正确'); } if (!file_exists($template_path)) { die('模板不存在'); } $p = (int) getValue(mysql_escape_string($_GET['p']), $output['p'], 1); $p = $p > 0 ? $p : 1; $where = array(); $where['title'] = getValue(mysql_escape_string($_GET['s_t']), $output['s_t'], null); $where['prehead'] = getValue(mysql_escape_string($_GET['s_p']), $output['s_p'], null); $where['subhead'] = getValue(mysql_escape_string($_GET['s_s']), $output['s_s'], null); $where['docket'] = getValue(mysql_escape_string($_GET['s_d']), $output['s_d'], null); $where['keyword'] = getValue(mysql_escape_string($_GET['s_k']), $output['s_k'], null); $where['content'] = getValue(mysql_escape_string($_GET['s_c']), $output['s_c'], null); $whereCondition = ''; //搜索的模式,true时为模糊查找 $useLike = false; if (getValue(mysql_escape_string($_GET['searchType']), $output['searchType'], null) == 'wildcard') { $useLike = true; } foreach ($where as $k => $v) { if (!is_null($v)) $whereCondition .= getWhereSearch($k, $v, $useLike).' AND '; } //时间选定 $start_posttime = getValue(mysql_escape_string($_GET['pt_start']), $output['pt_start'], null); $end_posttime = getValue(mysql_escape_string($_GET['pt_end']), $output['pt_end'], null); if (!is_null($start_posttime)) { $whereCondition .= "$tbpublish.`publishdate` >= ".intval($start_posttime).' AND '; } if (!is_null($end_posttime)) { $whereCondition .= "$tbpublish.`publishdate` <= ".intval($end_posttime).' AND '; } $whereCondition = rtrim($whereCondition, ' AND '); $whereCondition = empty($whereCondition)?'1':$whereCondition; $condition_titleimage = getBoolean(getValue(mysql_escape_string($_GET['con_img']), $output['con_img'], null)); $condition_docket = getBoolean(getValue(mysql_escape_string($_GET['con_docket']), $output['con_docket'], null)); if ($condition_titleimage === true) { $timg = "$tbcontent.`titleimage` <> ''"; }elseif ($condition_titleimage === false) { $timg = "$tbcontent.`titleimage` = ''"; }else { $timg = "1"; } if ($condition_docket === true) { $dk = "$tbcontent.`docket` <> ''"; }elseif ($condition_docket === false) { $dk = "$tbcontent.`docket` = ''"; }else { $dk = "1"; } //默认页数 if ($p == "") { $p = 1; } //显示 $pageInfo = array( 'nextImg' => getValue($_GET['c_nextImg'], '下一页'), 'altNext' => getValue($_GET['c_altNext'], '下一页'), 'prevImg' => getValue($_GET['c_prevImg'], '上一页'), 'altPrev' => getValue($_GET['c_altPrev'], '上一页'), 'firstPageText' => getValue($_GET['c_firstPageText'], '第一页'), 'lastPageText' => getValue($_GET['c_lastPageText'], '最后一页'), 'linkClass' => getValue($_GET['c_linkClass'], ''), 'curPageLinkClassName' => getValue($_GET['c_curPageLinkClassName'], ''), ); $cache = array( $nodeid, $config_colnum, $config_shownum, $config_template, $avoid_search_nid, $condition_titleimage, $condition_docket, $whereCondition, $p ); $cache = array_merge($cache, $pageInfo); //是否使用缓存 $config_cache = intval(getValue($_GET['c_cache'], 1)); //缓存时间,默认1个钟 $config_cacheLife = floatval(getValue($_GET['c_cacheLife'], 1)); //限制显示页数 $config_pagelimit = intval(getValue($_GET['c_pagelimit'], 100)); //页数缓存时间比例 //$config_quotiety = floatval(getValue($_GET['c_quotiety'], 1)); //缓存时间(分钟) $config_cacheLife = $p <= 10 ? $config_cacheLife * (9 + $p) / 10 : $config_cacheLife * $p / 4; //缓存目录,默认/tmp/,这个应该在cms.inc.dy里设定 $CMS_Cache_Path = getValue($CMS_Cache_Path, '/tmp/'); require_once "Cache/Lite/Output.php"; $options = array( 'cacheDir' => rtrim($CMS_Cache_Path, '/').'/', 'lifeTime' => 3600*$config_cacheLife, //秒 'hashedDirectoryLevel' => 2 ); $cache_lite = new Cache_Lite_Output($options); if (!$config_cache || !($cache_lite->start(crc32(serialize($cache)), 'more_nested'))) { list($nodeid, $parent_id, $types, $nodename ,$node_ename) = mysql_fetch_row(cmsDbQuery("SELECT id, parent_id, types, name, ename FROM $tbnode WHERE id = '$nodeid'")); list($p_nodeid, $p_parent_id, $p_nodename ,$p_node_ename) = mysql_fetch_row(cmsDbQuery("SELECT id, parent_id, name, ename FROM $tbnode WHERE id = '$parent_id'")); $nodeids = nodeIdArray(intval($nodeid)); //去除不要搜索的id $nodeids = array_diff($nodeids,(array)$avoid_search_nid); //取出节点总数 $sql = "SELECT COUNT(*) FROM $tbpublish, $tbcontent WHERE `$tbpublish`.nodeid IN (".implode(',', array_map('intval', $nodeids)).") AND `$tbpublish`.visible = '1' AND $tbpublish.contentid = $tbcontent.id AND ($timg) AND ($dk) AND ($whereCondition);"; list($total) = mysql_fetch_row(cmsDbQuery($sql)); //检查是否超过最大页数 $total = $total < $config_shownum * $config_pagelimit ? $total : $config_shownum * $config_pagelimit; $params = array( 'totalItems' => intval($total), 'perPage' => intval($config_shownum), 'delta' => 10, 'path' => '/', 'append' => false, 'mode' => 'Jumping', 'fileName' => (empty($config_uri)?$_SERVER['DOCUMENT_URI']:$config_uri).'?nodeid='.$nodeid.'&p=%d'.(($pageParam = getPageParam($output, array('nodeid', 'p'))) == ''?'':'&'.$pageParam), ); $params = array_merge($params, $pageInfo); include_once("Pager/Pager.php"); $Pager = Pager::factory($params); $page_link = $Pager -> getLinks($p); //取模板 $tpl = @file_get_contents($template_path); if (!empty($tpl)) { $info = array_merge(array('NODENAME' => $nodename, 'P_NODENAME' => $p_nodename, 'PAGE_BACK' => $page_link['back'], 'PAGE_NEXT' => $page_link['next'], 'PAGE_ALL' => $page_link['all'], 'PAGE_FIRST' => $page_link['first'], 'PAGE_LAST' => $page_link['last'], 'PAGES' => $Pager -> numPages(), 'TOTAL' => $total), array_change_key_case(array_map('htmlspecialchars', (array)$output), CASE_UPPER)); if ($total == 0) { include_once("HTML/Template/ITX.php"); $HTML_Template_ITX = new HTML_Template_ITX(); //PEAR::setErrorHandling(PEAR_ERROR_PRINT); $HTML_Template_ITX -> setTemplate($tpl, true, true); $HTML_Template_ITX -> touchBlock('none'); $HTML_Template_ITX -> setVariable($info); echo $HTML_Template_ITX -> get(); } else { echo special($nodeids, $config_shownum, $config_colnum, $tpl, $condition_titleimage, $condition_docket, (($p -1) * $config_shownum), $whereCondition, $info); } } if ($config_cache) { $cache_lite -> end(); } } ?>
[公告栏]
    302 Found

    302 Found


    nginx/1.14.0
[今日头条]
    302 Found

    302 Found


    nginx/1.14.0