$_POST['thumbnail'] = $_POST['photo'][0]['photo']; } else { $_POST['thumbnail'] = $_POST['photo']; } $objWebInit->saveInfo($_POST, 0); if ($arrGWeb['file_static']) { //生成静态页面 $intID = $objWebInit->getMaxID() - 1; $strDir = ceil($intID / $arrGCache['cache_filenum']); $objCache = new cache($arrGCache['cache_root'] . '-' . $strDir . '/' . $intID . $arrGWeb['file_suffix'], $arrGCache['cache_time']); $objCache->cache_start(); $strContents = @file_get_contents('http://' . $_SERVER["HTTP_HOST"] . '/' . $arrGWeb['module_id'] . '/detail.php?id=' . $intID); if ($strContents) { echo $strContents; } $objCache->cache_end(false); } check::WindowLocation('index.php', 'page=' . $_GET['page']); } if (!is_array($arrMType) || empty($arrMType)) { $arrMType = $objWebInit->getTypeList(); $arrMType = $objWebInit->formatTypeList(0, $arrMType); } $_SESSION['submitpasskey'] = md5(md5(time())); //print_r($arrMType); // 输出到模板 $arrMOutput["smarty_assign"]['arrType'] = $arrMType; $arrMOutput["smarty_assign"]['FileCallPath'] = $arrGPic['FileCallPath']; $arrMOutput["smarty_assign"]['FileListPicSize'] = $arrGPic['FileListPicSize']; $arrMOutput["smarty_assign"]['MAIN'] = $arrGSmarty['adminu_main_dir'] . 'submit.htm'; $objWebInit->output($arrMOutput);
/** * 更新页面缓存(纯静态和smarty缓存) * @author 肖飞 * @param int $id 记录ID数或者单页数组的KEY * @param int $type_id 栏目类型ID 便于清除列表页的缓存 * @param array $arrMOutput 输出到smartyd的数组 * @return void */ public function updateCache($id, $type_id = 1, $arrMOutput = array()) { global $arrGWeb, $arrGCache; if ($arrGWeb['file_static']) { //生成静态页面 $intID = intval($id); $strDir = ceil($intID / $arrGCache['cache_filenum']); if (empty($intID)) { //单页栏目 $intID = $id; $strCacheFile = $arrGCache['cache_root'] . '/' . $id . $arrGWeb['file_suffix']; @unlink($arrGCache['cache_root'] . '/' . $id . 'tw' . $arrGWeb['file_suffix']); } else { //其他栏目 $strCacheFile = $arrGCache['cache_root'] . '-' . $strDir . '/' . $intID . $arrGWeb['file_suffix']; @unlink($arrGCache['cache_root'] . '-' . $strDir . '/' . $intID . 'tw' . $arrGWeb['file_suffix']); } $objCache = new cache($strCacheFile, $arrGCache['cache_time']); $objCache->cache_start(); $strContents = @file_get_contents('http://' . $_SERVER["HTTP_HOST"] . $arrGWeb['WEB_ROOT_pre'] . '/' . $arrGWeb['module_id'] . '/detail.php?id=' . $intID); if ($strContents) { echo $strContents; } $objCache->cache_end(false); } if ($arrGWeb['URL_static']) { //更新smarty缓存 $objSmarty = new SmartyTpl(); if (empty($arrMOutput['template_dir'])) { $objSmarty->setTemplateDir($this->arrGSmarty['template_dir']); } else { $objSmarty->setTemplateDir($arrMOutput['template_dir']); } $objSmarty->setCompileDir($this->arrGSmarty['compile_dir']); $objSmarty->setCacheDir($this->arrGSmarty['cache_dir']); $objSmarty->plugins_dir = $this->arrGSmarty['plugins_dir']; $arrMOutput['smarty_debug'] = ''; $arrMOutput['smarty_debug'] ? $objSmarty->compile_check = true : ''; $arrMOutput['smarty_debug'] ? $objSmarty->debugging = true : ''; $objSmarty->caching = $this->arrGSmarty['caching']; if ($objSmarty->caching) { $objSmarty->cache_lifetime = isset($this->arrGSmarty['cache_lifetime']) ? $this->arrGSmarty['cache_lifetime'] : 3600; $objSmarty->cache_modified_check = isset($this->arrGSmarty['cache_modified_check']) ? $this->arrGSmarty['cache_modified_check'] : false; } if (!empty($arrMOutput['smarty_assign'])) { while (list($key, $value) = each($arrMOutput['smarty_assign'])) { $objSmarty->assign($key, $value); } } if ($_SESSION['langset'] == 'zh_tw') { $objSmarty->autoload_filters = array('output' => array('langset')); } $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/'); $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/index.php'); $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/' . $arrGWeb['module_id'] . '/'); $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/' . $arrGWeb['module_id'] . '/index.php'); $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/' . $arrGWeb['module_id'] . '/list/'); $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/' . $arrGWeb['module_id'] . '/list.php'); $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/' . $arrGWeb['module_id'] . '/list/type_id-' . $type_id . $arrGWeb['file_suffix']); $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/' . $arrGWeb['module_id'] . '/list.php/type_id-' . $type_id . $arrGWeb['file_suffix']); $objSmarty->clearCache($arrMOutput['template_file'], $_SESSION['langset'] . '/' . $arrGWeb['module_id'] . '/list.php?type_id=' . $type_id); } if ($arrGWeb['PDO_CACHE']) { if (!empty($this->arrGPdoDB['PDO_CACHE_ROOT'])) { check::delTreeDirs($this->arrGPdoDB['PDO_CACHE_ROOT']); } } }
} } } } header("HTTP/1.1 200 OK"); $objCache = new cache($strDir); $objCache->cache_start(true); if ($arrTemp[2] == 'archives') { $strContents = file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/' . $arrTemp[2] . '/detail.php?name=' . $intID); } else { $strContents = file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/' . $arrTemp[2] . '/detail.php?id=' . $intID); } if ($strContents) { echo $strContents; } $objCache->cache_end(); //header("location:../../".$arrTemp[2]."/detail.php?id=".$arrTemp[4]); } else { foreach ($arrGMeta as $k => $v) { if ($k == $arrTemp[1]) { $arrModule = explode('-', $arrTemp[2]); if (count($arrModule) < 2) { break; } $strMyUrl = str_replace($arrModule[0] . '-', $arrModule[0] . '/', $strMyUrl); $strContents = file_get_contents('http://' . $_SERVER['HTTP_HOST'] . $strMyUrl); header("HTTP/1.1 200 OK"); echo $strContents; $boolCache = true; break; }