コード例 #1
0
function DtNewsBq($classid, $indextext, $ecms = 0)
{
    global $empire, $dbtbpre, $public_r, $emod_r, $class_r, $class_zr, $fun_r, $navclassid, $navinfor, $class_tr, $level_r, $etable_r;
    $cachetime = $ecms == 1 ? $public_r['dtncachetime'] : $public_r['dtcachetime'];
    $file = ECMS_PATH . 'e/data/tmp/dt_temp' . $classid . '.php';
    if ($cachetime && file_exists($file)) {
        $filetime = filemtime($file);
        if (time() - $cachetime * 60 <= $filetime) {
            ob_start();
            include $file;
            $string = ob_get_contents();
            ob_end_clean();
            $string = RepExeCode($string);
            //解析代码
            return $string;
        }
    }
    $indextext = stripSlashes($indextext);
    $indextext = ReplaceTempvar($indextext);
    //替换全局模板变量
    //替换标签
    $indextext = DoRepEcmsLoopBq($indextext);
    $indextext = RepBq($indextext);
    //写文件
    WriteFiletext($file, AddCheckViewTempCode() . $indextext);
    //读取文件内容
    ob_start();
    include $file;
    $string = ob_get_contents();
    ob_end_clean();
    $string = RepExeCode($string);
    //解析代码
    return $string;
}
コード例 #2
0
ファイル: tempfun.php プロジェクト: novnan/meiju
function PreviewIndexpage($tempid, $userid, $username)
{
    global $empire, $dbtbpre, $public_r, $emod_r, $class_r, $class_zr, $fun_r, $navclassid, $navinfor, $class_tr, $level_r, $etable_r;
    //验证权限
    CheckLevel($userid, $username, $classid, "template");
    $tempid = (int) $tempid;
    if (!$tempid) {
        printerror('ErrorUrl', '');
    }
    $tempr = $empire->fetch1("select tempid,temptext from {$dbtbpre}enewsindexpage where tempid='{$tempid}'");
    if (!$tempr['tempid']) {
        printerror('ErrorUrl', '');
    }
    $indextext = stripSlashes($tempr['temptext']);
    $indextext = ReplaceTempvar($indextext);
    //替换全局模板变量
    $pr = $empire->fetch1("select sitekey,siteintro from {$dbtbpre}enewspublic limit 1");
    //页面
    $pagetitle = ehtmlspecialchars($public_r['sitename']);
    $pagekey = ehtmlspecialchars($pr['sitekey']);
    $pagedes = ehtmlspecialchars($pr['siteintro']);
    $url = "<a href=\"" . ReturnSiteIndexUrl() . "\">" . $fun_r['index'] . "</a>";
    //栏目导航
    $onclick = '';
    $file = ECMS_PATH . DASHBOARD . '/data/tmp/indexpage' . $tempid . '.php';
    $indextext = ReplaceSvars($indextext, $url, 0, $pagetitle, $pagekey, $pagedes, $add, 0);
    $indextext = str_replace("[!--page.stats--]", $onclick, $indextext);
    //替换标签
    $indextext = DoRepEcmsLoopBq($indextext);
    $indextext = RepBq($indextext);
    //写文件
    WriteFiletext($file, AddCheckViewTempCode() . $indextext);
    //读取文件内容
    ob_start();
    include $file;
    $string = ob_get_contents();
    ob_end_clean();
    $string = RepExeCode($string);
    //解析代码
    echo stripSlashes($string);
    exit;
}