function block_batch($param) { global $_SGLOBAL, $_SBLOCK, $_SCONFIG; $cachekey = smd5($param); $paramarr = parseparameter($param); if (empty($_SCONFIG['allowcache'])) { $paramarr['cachetime'] = 0; //关闭 cache } else { $paramarr['cachetime'] = intval($paramarr['cachetime']); } if (!empty($paramarr['perpage'])) { // pagination $_GET['page'] = empty($_GET['page']) ? 1 : intval($_GET['page']); if ($_GET['page'] < 1) { $_GET['page'] = 1; } if ($_GET['page'] > 1 && $paramarr['cachetime']) { $cachekey = smd5($param . $_GET['page']); //key改变 } } //获取 cache if ($paramarr['cachetime']) { $caches = block_get($cachekey); } else { $caches = array(); } if (!empty($caches['mtime']) && $_SGLOBAL['timestamp'] - $caches['mtime'] <= $paramarr['cachetime']) { //使用 cache $_SBLOCK[$paramarr['cachename']] = $caches['values']; $_SBLOCK[$paramarr['cachename'] . '_multipage'] = $caches['multi']; } else { //查询数据 $blockarr = array(); $results = getparamsql($paramarr); if ($results['count']) { $query = $_SGLOBAL['db']->query($results['sql']); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $blockarr[] = $value; } } $_SBLOCK[$paramarr['cachename']] = $blockarr; $_SBLOCK[$paramarr['cachename'] . '_multipage'] = $results['multi']; // update cache if ($paramarr['cachetime']) { $blockarr['multipage'] = $results['multi']; // cache pagination block_set($cachekey, $blockarr); } } }
include_once S_ROOT . './function/admin.func.php'; //创新园地统计发邮件 if (isset($_GET['tongji']) && $_GET['tongji'] == '1') { include './tongji_sendmail.php'; exit; } //获取变量 if ($_SCONFIG['urltype'] == '2' || $_SCONFIG['urltype'] == '5') { $parsegetvar = empty($_SERVER['PATH_INFO']) ? empty($_SERVER['ORIG_PATH_INFO']) ? '' : substr($_SERVER['ORIG_PATH_INFO'], 1) : substr($_SERVER['PATH_INFO'], 1); } if (empty($parsegetvar)) { $parsegetvar = empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING']; } if (!empty($parsegetvar)) { $parsegetvar = addslashes($parsegetvar); $_SGET = parseparameter(str_replace(array('-', '_'), '/', $parsegetvar)); } //变量处理 if (!empty($_SGET['viewnews'])) { $_SGET['action'] = 'viewnews'; $_SGET['itemid'] = intval($_SGET['viewnews']); } elseif (!empty($_SGET['category'])) { $_SGET['action'] = 'category'; $_SGET['catid'] = intval($_SGET['category']); } elseif (!empty($_SGET['viewthread'])) { $_SGET['action'] = 'viewthread'; $_SGET['tid'] = intval($_SGET['viewthread']); } elseif (empty($_SGET['action']) && !empty($_SGET['uid'])) { $spacegetvar = 'uid=' . $_SGET['uid']; unset($_SGET['uid']); foreach ($_SGET as $k => $v) {
if (empty($modelsinfoarr['allowcomment'])) { showmessage('not_found', S_URL); } if (submitcheck('submitcomm', 1)) { $itemid = empty($_POST['itemid']) ? 0 : intval($_POST['itemid']); if (empty($itemid)) { showmessage('not_found', S_URL); } if (empty($_SGLOBAL['supe_uid'])) { if (empty($_SCONFIG['allowguest'])) { $referarr = array(); $referquery = empty($_SERVER['HTTP_REFERER']) ? '' : parse_url($_SERVER['HTTP_REFERER']); $referquery = empty($referquery['query']) ? '' : $referquery['query']; if (!empty($referquery)) { $referquery = addslashes($referquery); $referarr = parseparameter(str_replace(array('-', '_'), '/', $referquery)); } if (!empty($referarr['action']) && $referarr['action'] == 'model') { setcookie('_refer', rawurlencode(geturl('action/model/name/' . $modelname . '/itemid/' . $itemid, 1))); } else { setcookie('_refer', rawurlencode(geturl('action/modelcomment/name/' . $modelname . '/itemid/' . $itemid, 1))); } showmessage('no_login', geturl('action/login')); } } if ($_SGLOBAL['supe_uid']) { updatetable('members', array('updatetime' => $_SGLOBAL['timestamp']), array('uid' => $_SGLOBAL['supe_uid'])); } $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($modelname . 'items') . ' WHERE itemid=\'' . $itemid . '\' AND allowreply=\'1\''); if (!($item = $_SGLOBAL['db']->fetch_array($query))) { showmessage('no_permission', S_URL);
function block($thekey, $param) { global $_SGLOBAL, $_SBLOCK, $_SCONFIG, $_SGET, $lang; $_SBLOCK[$thekey] = array(); $havethekey = false; $needcache = 0; //»º´ækey $cachekey = smd5($thekey . $param); $paramarr = parseparameter($param, 0); if (!empty($paramarr['uid'])) { $uid = $paramarr['uid']; } elseif (!empty($paramarr['authorid'])) { $uid = $paramarr['authorid']; } else { $uid = 0; } if (!empty($paramarr['cachetime'])) { if (!empty($paramarr['perpage']) && !empty($_SGET['page'])) { //·ÖÒ³ $cachekey = smd5($thekey . $param . $_SGET['page']); } $cacheupdatetime = $paramarr['cachetime']; } else { $cacheupdatetime = 0; $needcache = 3; //DO NOT CACHE } if ($cacheupdatetime) { //»ñÈ¡»º´æ $tablename = $thekey == 'spacetag' ? 'tagcache' : 'cache'; getcache($cachekey, $tablename); if (!isset($_SBLOCK[$cachekey])) { $needcache = 1; //ûÓлº´æ } else { //´´½¨Ï´θüÐÂʱ¼ä if (!empty($_SBLOCK[$cachekey]['filemtime'])) { $_SBLOCK[$cachekey]['updatetime'] = $_SBLOCK[$cachekey]['filemtime'] + $cacheupdatetime; } if ($_SBLOCK[$cachekey]['updatetime'] < $_SGLOBAL['timestamp']) { $needcache = 2; //ÐèÒª¸üР} } } if ($needcache) { $theblockarr = array(); include_once S_ROOT . './function/block.func.php'; $block_func = 'block_' . $thekey; $theblockarr = $block_func($paramarr); $_SBLOCK[$thekey] = $theblockarr; $havethekey = true; $_SBLOCK[$cachekey]['value'] = serialize($theblockarr); $_SBLOCK[$cachekey]['updatetime'] = $_SGLOBAL['timestamp'] + $cacheupdatetime; if ($needcache == 1 || $needcache == 2) { //INSERT-UPDATE $_SGLOBAL['tpl_blockvalue'][] = array('cachekey' => $cachekey, 'uid' => $uid, 'cachename' => $thekey, 'value' => $_SBLOCK[$cachekey]['value'], 'updatetime' => $_SBLOCK[$cachekey]['updatetime']); } } if (!$havethekey) { if (!empty($_SBLOCK[$cachekey]['value'])) { $_SBLOCK[$thekey] = unserialize($_SBLOCK[$cachekey]['value']); } else { $_SBLOCK[$thekey] = array(); } } $iarr = $_SBLOCK[$thekey]; if (!empty($paramarr['cachename'])) { if (empty($_SBLOCK[$thekey]['multipage'])) { $_SBLOCK[$paramarr['cachename'] . '_multipage'] = ''; } else { $_SBLOCK[$paramarr['cachename'] . '_multipage'] = $_SBLOCK[$thekey]['multipage']; } $_SBLOCK[$paramarr['cachename']] = $_SBLOCK[$thekey]; unset($_SBLOCK[$paramarr['cachename']]['multipage']); } if (!empty($paramarr['tpl']) && $paramarr['tpl'] != 'data') { $paramarr['tpl'] = 'styles/' . $paramarr['tpl'] . '.html.php'; include template($paramarr['tpl'], 1); } }
if (!file_exists($cachefile)) { showmessage('freshhtml_cache_error', $theurl . '&op=channel'); } include_once $cachefile; //缓存文件 $perpage = 10; $page = empty($_GET['page']) && intval($_GET['page']) < 1 ? 1 : intval($_GET['page']); if (!empty($makecache['ele'])) { for ($i = 0; $i < $perpage; $i++) { if (empty($makecache['ele'])) { break; } $total = count($makecache['ele']); $ele = array(); $ele = array_shift($makecache['ele']); $qarr = parseparameter($ele); $_SGET = $qarr; $_SGET['page'] = empty($_SGET['page']) || intval($_SGET['page']) < 1 ? 1 : intval($_SGET['page']); if ($qarr['action'] == 'model') { $qarr['action'] = 'modelview'; } if (empty($channels['menus'][$qarr['action']]['upnameid']) && $channels['menus'][$qarr['action']]['upnameid'] != 'news') { $rs = createhtml(S_ROOT . "./{$qarr['action']}.php", $ele); } else { $rs = createhtml(S_ROOT . "./news.php", $ele); } if ($rs != true) { showmessage($rs); } } $cachetext = '$makecache=' . arrayeval($makecache);