|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
帝国cms生成模板变量缓存插件
- <?php
- define('EmpireCMSAdmin','1');
- require("../../class/connect.php");
- require("../../class/db_sql.php");
- require("../../class/functions.php");
- $link=db_connect();
- $empire=new mysqlquery();
- $editor=1;
- //验证用户
- $lur=is_login();
- $logininid=$lur['userid'];
- $loginin=$lur['username'];
- $loginrnd=$lur['rnd'];
- $loginlevel=$lur['groupid'];
- $loginadminstyleid=$lur['adminstyleid'];
- include "../".LoadLang("pub/fun.php");
- //ehash
- $ecms_hashur=function_exists('hReturnEcmsHashStrAll')?hReturnEcmsHashStrAll():'';
- $tempsql=$empire->query("select varid,myvar from {$dbtbpre}enewstempvar");
- $url="<a href=index.php{$ecms_hashur['whhref']}>管理生成缓存</a>";
- if($_POST['var']){
- foreach ($_POST['var'] as $val) {
- $sqlin.=(int)$val.',';
- }
- $sqlin=$sqlin?substr($sqlin,0,-1):0;
- $filepath=ECMS_PATH.'d/Cache/tempvar/';
- if(!is_dir($filepath)){
- printerror2("请建立缓存目录!");
- }
- $head="<?php if(!defined('InEmpireCMS')){exit();}?>".PHP_EOL;
- $scsql=$empire->query("select * from {$dbtbpre}enewstempvar where varid in ($sqlin)");
- while ($r = $empire->fetch($scsql)) {
- $text=RepBq(DoRepEcmsLoopBq(ReplaceTempvar(stripSlashes($r['varvalue']))));
- $text= str_replace('[!--news.url--]', '<?=$public_r[newsurl]?>', $text);
- file_put_contents($filepath.$r['varid'].'.php', $head.$text);
- }
- printerror2("生成缓存成功!");
- }
- ?>
- <!doctype html>
- <html lang="zh-cn">
- <head>
- <meta charset="utf-8">
- <title>管理生成缓存</title>
- </head>
- <body>
- <form action="index.php" method="post">
- <?=$ecms_hashur['form']?>
- <?
- while ($row = $empire->fetch($tempsql)) {
- ?>
- <input type="checkbox" name="var[]" value="<?=$row['varid']?>" /><?=$row['myvar']?><br />
- <?
- }
- ?>
- <input type="submit" value="提交">
- </form>
- 备注:生成位置在:/d/Cache/tempvar。
- </body>
- </html>
- <?
- db_close();
- $empire=null;
- ?>
复制代码
帝国cms生成模板变量缓存插件.zip
(4.03 KB, 下载次数: 0)
|
|