Beispiel #1
0
 function domanage()
 {
     if ($_FILES['Filedata']) {
         require_once iPATH . 'include/upload.class.php';
         $this->iCMS->config['iswatermark'] = false;
         $this->iCMS->config['isthumb'] = false;
         $ext = FS::getExt($_FILES['Filedata']['name']);
         $F = iUpload::FILES("Filedata", 0, '', 'avatar', 'tmp_' . member::$uId . '.' . strtolower($ext), 'avatar');
         //            echo FS::fp($F["FilePath"],'+http');
         echo '../' . $this->iCMS->config['uploadfiledir'] . '/' . $F["FilePath"];
     } else {
         $_dir = ceil(member::$uId / 500);
         $data = file_get_contents("php://input");
         $length = strlen($data);
         $lastIndex = 0;
         $sizeIndex = 0;
         $sizeArray = array(120, 48, 24);
         //同时上传3个尺寸的头像。 分割数据
         while ($lastIndex < $length) {
             $a = unpack('L', $data[$lastIndex + 3] . $data[$lastIndex + 2] . $data[$lastIndex + 1] . $data[$lastIndex]);
             $lastIndex += 4;
             $avatarData = substr($data, $lastIndex, $a[1]);
             $lastIndex += $a[1];
             $avatar = 'avatar/' . $_dir . '/' . member::$uId . '_' . $sizeArray[$sizeIndex] . '.gif';
             $fp = FS::fp($avatar, '+iPATH');
             @FS::mkdir(dirname($fp));
             @FS::write($fp, $avatarData);
             $sizeIndex++;
         }
         $rootpf = FS::fp('avatar/tmp_' . member::$uId, '+iPATH');
         foreach (glob($rootpf . "*") as $_fp) {
             file_exists($_fp) && FS::del($_fp);
         }
     }
 }
Beispiel #2
0
 function doSave()
 {
     strpos($_POST['tplpath'], '..') !== false && javascript::alert("文件路径不能带有..");
     preg_match("/\\.([a-zA-Z0-9]{2,4})\$/", $_POST['tplpath'], $exts);
     $FileExt = strtolower($exts[1]);
     strstr($FileExt, 'ph') && javascript::alert("文件格式错误!");
     in_array($FileExt, array('cer', 'htr', 'cdx', 'asa', 'asp', 'jsp', 'aspx', 'cgi')) && javascript::alert("文件格式错误!");
     $FileData = stripslashes($_POST['html']);
     FS::write(iPATH . 'templates' . $_POST['tplpath'], $FileData);
     javascript::dialog('保存成功!', 'url:' . __SELF__ . $_POST['REFERER']);
 }
Beispiel #3
0
 function add($key, $val, $exp = 0)
 {
     $this->_file = $this->get_file($key, 'add');
     $value = array("Time" => time(), "Expires" => $exp, "Data" => $val);
     $data = serialize($value);
     $this->_cache_sock = '<?php exit;?>';
     if ($this->_have_zlib && $this->_compress_enable) {
         $this->_cache_sock .= gzcompress($data, 9);
     } else {
         $this->_cache_sock .= $data;
     }
     return FS::write($this->_file, $this->_cache_sock);
 }
Beispiel #4
0
 function doSaveBackup()
 {
     $bak = "# iCMS Backup SQL File\n# Version:" . iCMS_VER . "\n# Time: " . get_date('', "Y-m-d H:i:s") . "\n# iCMS: http://www.iDreamSoft.com\n# --------------------------------------------------------\n\n\n";
     iCMS_DB::query("SET SQL_QUOTE_SHOW_CREATE = 0");
     $tabledb = $_POST['tabledb'];
     $sizelimit = isset($_POST['sizelimit']) ? (int) $_POST['sizelimit'] : (int) $_GET['sizelimit'];
     $start = (int) $_GET['start'];
     $tableid = (int) $_GET['tableid'];
     $step = (int) $_GET['step'];
     $tablesel = $_GET['tablesel'];
     $aaa = $_GET['aaa'];
     $rows = $_GET['rows'];
     !$tabledb && !$tablesel && javascript::alert('没有选择操作对象');
     !$tabledb && ($tabledb = explode("|", $tablesel));
     !$step && ($sizelimit /= 2);
     $bakupdata = $this->bakupdata($tabledb, $start);
     if (!$step) {
         !$tabledb && javascript::alert('没有选择操作对象');
         $tablesel = implode("|", $tabledb);
         $step = 1;
         $aaa = $this->num_rand(10);
         $start = 0;
         $bakuptable = $this->bakuptable($tabledb);
     }
     $f_num = ceil($step / 2);
     $filename = 'iCMS_' . get_date('', "md") . '_' . $aaa . '_' . $f_num . '.sql';
     $step++;
     $writedata = $bakuptable ? $bakuptable . $bakupdata : $bakupdata;
     $t_name = $tabledb[$tableid - 1];
     $c_n = $startfrom;
     if ($stop == 1) {
         $files = $step - 1;
         trim($writedata) && FS::write(iPATH . 'admin/backup/' . $filename, $bak . $writedata, true, 'ab');
         javascript::dialog("正在备份数据库表{$t_name}: 共{$rows}条记录<br />已经备份至{$c_n}条记录,已生成{$f_num}个备份文件,<br />程序将自动备份余下部分", 'src:' . __SELF__ . "?mo=database&do=savebackup&start={$startfrom}&tableid={$tableid}&sizelimit={$sizelimit}&step={$step}&aaa={$aaa}&tablesel={$tablesel}&rows={$rows}", 'ok', 2);
     } else {
         trim($writedata) && FS::write(iPATH . 'admin/backup/' . $filename, $bak . $writedata, true, 'ab');
         if ($step > 1) {
             for ($i = 1; $i <= $f_num; $i++) {
                 $temp = substr($filename, 0, 19) . $i . ".sql";
                 if (file_exists("backup/{$temp}")) {
                     $bakfile .= '<a href="backup/' . $temp . '">' . $temp . '</a><br />';
                 }
             }
         }
         javascript::dialog("已全部备份完成,备份文件保存在backup目录下", 'url:' . __SELF__ . "?mo=database&do=recover");
     }
 }
Beispiel #5
0
 function Content($mid, $id)
 {
     global $iCMS;
     if (empty($id) || !$iCMS->config['ishtm'] || strstr($iCMS->config['aRule'], '{PHP}')) {
         return false;
     }
     $iCMS->mode = 'CreateHtml';
     $iCMS->htmlConf = array('enable' => true, 'ext' => $rs['htmlext'] ? $rs['htmlext'] : $iCMS->config['htmlext']);
     $html = $iCMS->content($mid, $id);
     FS::mkdir($iCMS->result->iurl->dir);
     FS::write($iCMS->result->iurl->path, $html, false);
     return true;
 }
Beispiel #6
0
function CreateConfigFile()
{
    global $iCMS;
    $tmp = iCMS_DB::getArray("SELECT * FROM `#iCMS@__config`");
    $config_data = "<?php\n\t\$config=array(\n";
    for ($i = 0; $i < count($tmp); $i++) {
        $_config .= "\t\t\"" . $tmp[$i]['name'] . "\"=>\"" . $tmp[$i]['value'] . "\",\n";
    }
    $config_data .= substr($_config, 0, -2);
    $config_data .= "\t\n);?>";
    FS::write(iPATH . 'include/site.config.php', $config_data);
}
Beispiel #7
0
        iCMS_DB::query("INSERT INTO `#iCMS@__members` (`groupid`, `username`, `password`, `nickname`, `gender`, `info`, `power`, `cpower`, `regtime`, `lastip`, `lastlogintime`, `logintimes`, `post`, `type`, `status`) VALUES ('1', '{$admin}', '" . md5($password) . "', '管理员', '0', '', '', '', '" . time() . "', '', '0', '0', '0', '1', '1');");
        iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$setupURL}' WHERE `name` ='setupURL'");
        iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$publicURL}' WHERE `name` ='publicURL'");
        iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$htmlURL}' WHERE `name` ='htmlURL'");
        iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$uploadURL}' WHERE `name` ='uploadURL'");
        iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$setupURL}' WHERE `name` ='tagURL'");
        iCMS_DB::query("UPDATE `#iCMS@__config` SET `value` = '{$usercpURL}' WHERE `name` ='usercpURL'");
        $tmp = iCMS_DB::getArray("SELECT * FROM `#iCMS@__config`");
        $config_data = "<?php\n\t\$config=array(\n";
        for ($i = 0; $i < count($tmp); $i++) {
            $_config .= "\t\t\"" . $tmp[$i]['name'] . "\"=>\"" . $tmp[$i]['value'] . "\",\n";
        }
        $config_data .= substr($_config, 0, -2);
        $config_data .= "\t\n);?>";
        FS::write(iPATH . 'include/site.config.php', $config_data);
        FS::write($lockfile, 'iCMS');
        ?>
    </p>
    <p>共创建了<?php 
        echo $tablenum;
        ?>
个数据表.</p>
    <hr size="1" noshade="noshade" />
    <p>安装程序已经顺利执行完毕,请尽快删除整个 install 目录,以免被他人恶意利用。</p>
    <p>&nbsp;</p>
    <p><a href="../">点击这里进入首页</a><br />
      <a href="../admincp.php">点击这里进入后台</a></p>
    <hr size="1" noshade="noshade" />
    <p align="right"><a href="http://www.idreamsoft.com" target="_blank">Welcome to iDreamSoft</a></p>
    <?php 
    }
Beispiel #8
0
function adm($rs)
{
    global $iCMS;
    $rs->code = stripslashes_deep(unserialize($rs->code));
    $file = FS::path(iPATH . $iCMS->config['htmldir'] . '/!adm') . '/';
    FS::mkdir($file);
    switch ($rs->load) {
        case "js":
            $file .= "{$rs->style}-{$rs->id}.js";
            $html = "/*\n广告:{$rs->varname}\n标签:<!--{iCMS:advertise name=\"{$rs->varname}\"}-->\n*/\n";
            if ($rs->status) {
                $html .= "var timestamp = Date.parse(new Date());\n";
                $html .= "var startime = Date.parse(new Date(\"" . get_date($rs->starttime, 'Y/m/d') . "\"));\n";
                $rs->endtime && ($html .= "var endtime = Date.parse(new Date(\"" . get_date($rs->endtime, 'Y/m/d') . "\"));\n");
                $html .= "if(timestamp>=startime";
                $rs->endtime && ($html .= "||timestamp<endtime");
                $html .= "){\n";
                $html .= document(getadvhtml($rs->style, $rs->code));
                $html .= "}";
            }
            break;
        case "iframe":
            $file .= "{$rs->style}-{$rs->id}.html";
            $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script type="text/javascript">function resizeFrame(){try{ var frames=parent.document.documentElement.getElementsByTagName("iframe"); for(var i=0;i<frames.length;i++){ frames[i].style.height=document.body.scrollHeight+"px"; var topPos=location.href.indexOf("#top");if(topPos>0){location.href=location.href.substring(0,topPos)+"#top1"}break;}}}catch(e){return;}}</script></head><body>' . getadvhtml($rs->style, $rs->code) . '</body><script type="text/javascript">resizeFrame();</scrip</html>';
            break;
        case "shtml":
            $file .= "{$rs->style}-{$rs->id}.shtml";
            $html = getadvhtml($rs->style, $rs->code);
            break;
    }
    $rs->src = $file;
    $iCMS->setCache('system/adm/' . md5($rs->varname), $rs, 0);
    if ($fn) {
        return $file;
    }
    $rs->load && FS::write($file, $html);
}
Beispiel #9
0
 function doSave()
 {
     $fid = (int) $_POST['fid'];
     $rootid = (int) $_POST['rootid'];
     $modelid = (int) $_POST['modelid'];
     $status = (int) $_POST['status'];
     $issend = (int) $_POST['issend'];
     $isexamine = (int) $_POST['isexamine'];
     $orderNum = (int) $_POST['orderNum'];
     $mode = (int) $_POST['mode'];
     $name = dhtmlspecialchars($_POST['name']);
     $subname = dhtmlspecialchars($_POST['subname']);
     $domain = dhtmlspecialchars($_POST['domain']);
     $htmlext = dhtmlspecialchars($_POST['htmlext']);
     $url = dhtmlspecialchars($_POST['url']);
     $password = dhtmlspecialchars($_POST['password']);
     $pic = dhtmlspecialchars($_POST['pic']);
     $dir = dhtmlspecialchars($_POST['dir']);
     $title = dhtmlspecialchars($_POST['title']);
     $keywords = dhtmlspecialchars($_POST['keywords']);
     $description = dhtmlspecialchars($_POST['description']);
     $attr = dhtmlspecialchars($_POST['attr']);
     $forumRule = dhtmlspecialchars($_POST['forumRule']);
     $contentRule = dhtmlspecialchars($_POST['contentRule']);
     $indexTPL = dhtmlspecialchars($_POST['indexTPL']);
     $listTPL = dhtmlspecialchars($_POST['listTPL']);
     $contentTPL = dhtmlspecialchars($_POST['contentTPL']);
     $fid && $fid == $rootid && javascript::dialog('不能以自身做为上级栏目');
     empty($name) && javascript::dialog('栏目名称不能为空!');
     if (empty($dir) && empty($url)) {
         include iPATH . 'include/cn.class.php';
         $dir = strtolower(CN::pinyin($name));
     }
     if ($mode == "2") {
         if (strpos($forumRule, '{FDIR}') === FALSE && strpos($forumRule, '{FID}') === FALSE) {
             javascript::dialog('伪静态模式下版块URL规则<br />必需要有<br />{FDIR}版块目录<br />或者<br />{FID}版块ID', 'js:', 'ok', 10);
         }
         if (strpos($contentRule, '{AID}') === FALSE && strpos($contentRule, '{0xID}') === FALSE && strpos($contentRule, '{LINK}') === FALSE) {
             javascript::dialog('伪静态模式下内容URL规则<br />必需要有<br />{AID}文章ID <br />或者<br />{0xID}文章ID补零<br />或者<br />{LINK}文章自定义链接', 'js:', 'ok', 10);
         }
         global $iCMS;
         $htaFile = iPATH . "/.htaccess";
         //        	if(file_exists($htaFile)){
         //        		$RewriteRule=FS::read($htaFile);
         //        	}
         //        	if(empty($RewriteRule)){
         $RewriteBase = $iCMS->config['dir'] == "/" ? '' : $iCMS->config['dir'];
         $RewriteRule = "RewriteEngine On\nRewriteBase /" . $RewriteBase . "\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\n\n";
         //        	}
         //内容
         $contentRR = RewriteRule($contentRule, "show", $htmlext, $iCMS->config['htmldir']);
         $cmd5 = md5($contentRR);
         if (strstr($RewriteRule, $cmd5) === false) {
             $RewriteRule .= "#{$cmd5}\n" . $contentRR . "#{$cmd5}\n\n\n";
         }
         //版块
         $forumRR = RewriteRule($forumRule, "forum", $htmlext, $iCMS->config['htmldir']);
         $fmd5 = md5($forumRR);
         if (strstr($RewriteRule, $fmd5) === false) {
             $RewriteRule .= "#{$fmd5}\n" . $forumRR . "#{$fmd5}\n\n\n";
         }
         FS::write($htaFile, $RewriteRule);
     }
     if (empty($fid)) {
         iCMS_DB::getValue("SELECT `dir` FROM `#iCMS@__forum` where `dir` ='{$dir}'") && empty($url) && javascript::dialog('该栏目别名/目录已经存在!请另选一个');
         iCMS_DB::query("INSERT INTO `#iCMS@__forum` (`rootid`,`modelid`,`orderNum`,`name`,`subname`,`password`,`title`,`keywords`,`description`,`dir`,`mode`,`domain`,`url`,`pic`,`htmlext`,`forumRule`,`contentRule`,`indexTPL`,`listTPL`,`contentTPL`,`attr`,`isexamine`,`issend`,`status`)\n    \t\tVALUES ('{$rootid}','{$modelid}', '{$orderNum}', '{$name}','{$subname}','{$password}','{$title}','{$keywords}', '{$description}', '{$dir}','{$mode}','{$domain}', '{$url}','{$pic}','{$htmlext}','{$forumRule}', '{$contentRule}','{$indexTPL}', '{$listTPL}', '{$contentTPL}', '{$attr}','{$isexamine}','{$issend}','{$status}')");
         $forum = new forum();
         $forum->cache();
         $msg = "栏目添加完成!";
     } else {
         Admin::CP($fid, 'Permission_Denied', __SELF__ . '?mo=forums');
         $rootid != $forum->forum[$fid]['rootid'] && Admin::CP($rootid, 'Permission_Denied', __SELF__ . '?mo=forums');
         iCMS_DB::getValue("SELECT `dir` FROM `#iCMS@__forum` where `dir` ='{$dir}' AND `fid` !='{$fid}'") && empty($url) && javascript::alert('该栏目别名/目录已经存在!请另选一个');
         iCMS_DB::query("UPDATE `#iCMS@__forum` SET `rootid` = '{$rootid}',`modelid` = '{$modelid}',`orderNum` = '{$orderNum}',`name` = '{$name}',`subname` = '{$subname}',`password`='{$password}',`title` = '{$title}',`keywords` = '{$keywords}',`description` = '{$description}',`dir` = '{$dir}',`url` = '{$url}',`mode` = '{$mode}',`domain` = '{$domain}',`pic`='{$pic}',`htmlext`='{$htmlext}',`forumRule`='{$forumRule}',`contentRule`='{$contentRule}',`indexTPL` = '{$indexTPL}',`listTPL` = '{$listTPL}',`contentTPL` = '{$contentTPL}',`attr` = '{$attr}',`isexamine`='{$isexamine}',`status`='{$status}',`issend`='{$issend}' WHERE `fid` ='{$fid}' ");
         $forum = new forum();
         $forum->cache();
         $msg = "栏目编辑完成!";
     }
     javascript::dialog($msg, 'url:' . __SELF__ . '?mo=forums');
 }
Beispiel #10
0
 function update($n)
 {
     @set_time_limit(0);
     // Unzip uses a lot of memory
     @ini_set('memory_limit', '256M');
     require_once iPATH . 'include/pclzip.class.php';
     $zipName = 'iCMS ' . self::$iCMSVER . '.patch.' . $n . '.zip';
     $zipFile = PATCH_DIR . '/' . $zipName;
     //临时文件
     $msg = '正在对 [' . $zipName . '] 更新包进行解压缩<icms>';
     $zip = new PclZip($zipFile);
     if (false == ($archive_files = $zip->extract(PCLZIP_OPT_EXTRACT_AS_STRING))) {
         exit("ZIP包错误");
     }
     if (0 == count($archive_files)) {
         exit("空的ZIP文件");
     }
     $msg .= '解压完成开始更新程序#<icms>';
     foreach ($archive_files as $file) {
         $folder = $file['folder'] ? $file['filename'] : dirname($file['filename']);
         $dp = iPATH . $folder;
         if (!FS::exists($dp)) {
             $msg .= '创建 [' . $dp . '] 文件夹<icms>';
             //self::mkdir($path.'/'.$folder);
         }
         if (empty($file['folder'])) {
             $fp = iPATH . $file['filename'];
             $bfp = iPATH . $n . 'bak/' . $file['filename'];
             if (FS::exists($fp)) {
                 $msg .= '备份 [' . $fp . '] 文件 到 [' . $bfp . ']<icms>';
                 FS::mkdir(dirname($bfp));
                 rename($fp, $bfp);
                 //备份旧文件
             }
             $msg .= '更新 [' . $fp . '] 文件<icms>';
             FS::write($fp, $file['content']);
             $msg .= '[' . $fp . '] 更新完成!#<icms>';
         }
     }
     $msg .= '清除临时文件!<icms>注:原文件备份在 [' . iPATH . $n . 'bak/] 目录<icms>如没有特殊用处请删除此目录!#<icms>';
     FS::rmdir(PATCH_DIR, true, 'version.txt');
     return $msg;
 }
Beispiel #11
0
 function into($id)
 {
     $rs = iCMS_DB::getRow("SELECT a.title,ad.body FROM `#iCMS@__article` a LEFT JOIN `#iCMS@__article_data` ad ON a.id=ad.aid WHERE a.id='{$id}'");
     $img = array();
     $msg = false;
     preg_match_all("/<img.*?src\\s*=[\"|'|\\s]*(http:\\/\\/.*?\\.(gif|jpg|jpeg|bmp|png)).*?>/is", $rs->body, $img);
     $_array = array_unique($img[1]);
     foreach ($_array as $key => $value) {
         $value = uploadpath($value, '-http');
         $rootpf = uploadpath($value, '+iPATH');
         if (file_exists($rootpf)) {
             $pti = pathinfo($rootpf);
             $_FileSize = @filesize($rootpf);
             $filename = $pti['filename'];
             $frs = iCMS_DB::getRow("SELECT `id`,`aid` FROM `#iCMS@__file` WHERE `filename`='{$filename}'");
             if (empty($frs)) {
                 iCMS_DB::query("INSERT INTO `#iCMS@__file` (`aid`,`filename`,`ofilename`,`path`,`intro`,`ext`,`size` ,`time`,`type`) VALUES ('{$id}','" . $filename . "', '', '{$path}','{$rs->title}', '" . $pti['extension'] . "', '{$_FileSize}', '" . time() . "', '0')");
                 $msg .= "图片: " . $value . " 入库…<span style='color:green;'>√</span><br />";
             } else {
                 $msg .= "图片: " . $value . " 文件库中已有…<span style='color:green;'>×</span><br />";
             }
             if (empty($frs->aid)) {
                 iCMS_DB::query("UPDATE `#iCMS@__file` SET `aid`='{$id}' where `filename`='{$filename}'");
                 $msg .= "图片: " . $value . " 所属文章ID已更新…<span style='color:green;'>√</span><br />";
             }
         } else {
             $data = "AID: " . $id . " 路径: [" . $rootpf . "] 标题: " . $rs->title . "\n";
             FS::write(iPATH . "admin/logs/pic_exist_" . date('Y-m-d') . ".txt", $data, true, "a+");
         }
     }
     return $msg;
 }
Beispiel #12
0
 function output($xml)
 {
     $xml = '<?xml version="1.0"?>' . "\n" . $xml;
     $length = strlen($xml);
     header('Connection: close');
     header('Content-Length: ' . $length);
     header('Content-Type: text/xml');
     header('Date: ' . date('r'));
     echo $xml;
     FS::write("a.log", $xml);
     exit;
 }
Beispiel #13
0
    iCMS_DB::query("ALTER TABLE `#iCMS@__comment` \n\tADD KEY `quote`(`quote`), COMMENT='';");
    iCMS_DB::query("CREATE TABLE `#iCMS@__field`(\n\t`id` int(10) unsigned NOT NULL  auto_increment , \n\t`name` varchar(255) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`field` varchar(255) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`mid` int(10) unsigned NOT NULL  DEFAULT '0' , \n\t`type` varchar(255) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`default` varchar(255) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`validate` varchar(255) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`show` tinyint(1) NOT NULL  DEFAULT '0' , \n\t`hidden` enum('0','1') COLLATE utf8_general_ci NOT NULL  DEFAULT '0' , \n\t`description` varchar(255) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`option` text COLLATE utf8_general_ci NOT NULL  , \n\tPRIMARY KEY (`id`) \n) ENGINE=MyISAM DEFAULT CHARSET='utf8';");
    iCMS_DB::query("insert  into `#iCMS@__field`(`id`,`name`,`field`,`mid`,`type`,`default`,`validate`,`show`,`hidden`,`description`,`option`) values (1,'栏目','fid',0,'number','','0',1,'0','',''),(2,'排序','orderNum',0,'number','0','N',0,'0','',''),(3,'标题','title',0,'text','','0',1,'0','',''),(4,'自定义链接','clink',0,'text','0','N',0,'0','只能由英文字母、数字或_-组成(不支持中文),留空则自动以标题拼音填充',''),(5,'标签','tags',0,'text','','N',1,'0','多个标签请用,格开',''),(6,'发布时间','pubdate',0,'calendar','0','N',0,'0','',''),(7,'点击数','hits',0,'number','0','N',0,'0','',''),(8,'回复数','comments',0,'number','0','N',0,'0','',''),(9,'属性','type',0,'number','0','N',0,'0','内容附加属性',''),(10,'虚链接','vlink',0,'text','0','N',0,'0','按住Ctrl可多选',''),(11,'置顶权重','top',0,'number','0','N',0,'0','',''),(12,'状态','status',0,'number','1','N',0,'0','1 显示 0不显示',''),(13,'编辑','editor',0,'text','','N',0,'0','',''),(14,'用户ID','userid',0,'number','','N',0,'1','用户或管理员ID',''),(15,'顶+1','good',0,'number','0','N',0,'1','',''),(16,'踩-1','bad',0,'number','0','N',0,'1','',''),(17,'发布类型','postype',0,'number','','N',0,'1','发布类型 [0:用户][1:管理员]','');");
    iCMS_DB::query("ALTER TABLE `#iCMS@__forum` \n\tADD COLUMN `metadata` mediumtext  COLLATE utf8_general_ci NOT NULL after `contentTPL`, \n\tADD COLUMN `contentAttr` mediumtext  COLLATE utf8_general_ci NOT NULL after `metadata`, \n\tCHANGE `isexamine` `isexamine` tinyint(1) unsigned   NOT NULL DEFAULT '0' after `contentAttr`, \n\tCHANGE `issend` `issend` tinyint(1) unsigned   NOT NULL DEFAULT '1' after `isexamine`, \n\tCHANGE `status` `status` tinyint(1) unsigned   NOT NULL DEFAULT '1' after `issend`, COMMENT='';");
    iCMS_DB::query("CREATE TABLE `#iCMS@__model`(\n\t`id` int(10) unsigned NOT NULL  auto_increment , \n\t`name` varchar(100) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`table` varchar(100) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`field` text COLLATE utf8_general_ci NOT NULL  , \n\t`binding` tinyint(1) unsigned NOT NULL  DEFAULT '0' , \n\t`description` varchar(200) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`position` varchar(10) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`position2` varchar(10) COLLATE utf8_general_ci NOT NULL  DEFAULT '' , \n\t`form` text COLLATE utf8_general_ci NOT NULL  , \n\t`show` tinyint(1) NOT NULL  DEFAULT '0' , \n\t`addtime` int(10) unsigned NOT NULL  DEFAULT '0' , \n\tPRIMARY KEY (`id`) \n\t) ENGINE=MyISAM DEFAULT CHARSET='utf8';");
    iCMS_DB::query("ALTER TABLE `#iCMS@__tags` \n\tCHANGE `uid` `uid` int(10) unsigned   NOT NULL DEFAULT '0' after `id`, \n\tCHANGE `sortid` `sortid` int(10) unsigned   NOT NULL DEFAULT '0' after `uid`, \n\tADD COLUMN `type` int(10) unsigned   NOT NULL DEFAULT '0' after `sortid`, \n\tCHANGE `name` `name` varchar(255)  COLLATE utf8_general_ci NOT NULL DEFAULT '' after `type`, \n\tADD COLUMN `keywords` varchar(255)  COLLATE utf8_general_ci NOT NULL DEFAULT '' after `name`, \n\tADD COLUMN `seotitle` varchar(255)  COLLATE utf8_general_ci NOT NULL DEFAULT '' after `keywords`, \n\tADD COLUMN `subtitle` varchar(255)  COLLATE utf8_general_ci NOT NULL DEFAULT '' after `seotitle`, \n\tADD COLUMN `description` text  COLLATE utf8_general_ci NOT NULL after `subtitle`, \n\tCHANGE `count` `count` int(10) unsigned   NOT NULL DEFAULT '0' after `description`, \n\tADD COLUMN `weight` smallint(6)   NOT NULL DEFAULT '0' after `count`, \n\tCHANGE `link` `link` varchar(255)  COLLATE utf8_general_ci NOT NULL DEFAULT '' after `weight`, \n\tCHANGE `tpl` `tpl` varchar(255)  COLLATE utf8_general_ci NOT NULL DEFAULT '' after `link`, \n\tCHANGE `ordernum` `ordernum` smallint(5)   NOT NULL DEFAULT '0' after `tpl`, \n\tCHANGE `updatetime` `updatetime` int(10) unsigned   NOT NULL DEFAULT '0' after `ordernum`, \n\tCHANGE `status` `status` tinyint(1) unsigned   NOT NULL DEFAULT '0' after `updatetime`, \n\tADD KEY `sortid_count`(`sortid`,`count`), COMMENT='';");
    iCMS_DB::query("CREATE TABLE `#iCMS@__stat` (\n   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n   `indexId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '内容Id',\n   `fid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '版块ID',\n   `val` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '值',\n   `d` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '日',\n   `m` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '月',\n   `y` smallint(4) unsigned NOT NULL DEFAULT '0' COMMENT '年',\n   `ymd` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '年月日',\n   `dateline` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '时间戳',\n   `type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '类型 0点击',\n   PRIMARY KEY (`id`),\n   KEY `ymd` (`fid`,`ymd`,`type`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
    //更新网站设置
    $tmp = iCMS_DB::getArray("SELECT * FROM `#iCMS@__config`");
    $config_data = "<?php\n\t\$config=array(\n";
    for ($i = 0; $i < count($tmp); $i++) {
        $_config .= "\t\t\"" . $tmp[$i]['name'] . "\"=>\"" . $tmp[$i]['value'] . "\",\n";
    }
    $config_data .= substr($_config, 0, -2);
    $config_data .= "\t\n);?>";
    FS::write(iPATH . 'include/site.config.php', $config_data);
    show_msg('网站配置更新完成,进入下一步', '?step=2');
} elseif ($_GET['step'] == 2) {
    //写log
    if (@($fp = fopen($lockfile, 'w'))) {
        fwrite($fp, 'iCMS');
        fclose($fp);
    }
    show_msg('升级完成,请到后台工具->更新缓存.为了您的数据安全,避免重复升级,请登录FTP删除本文件!');
}
function getgpc($k, $var = 'G')
{
    switch ($var) {
        case 'G':
            $var =& $_GET;
            break;
Beispiel #14
0
 function content($id, $mid, $table = NULL)
 {
     global $iCMS;
     if (empty($id) || empty($mid)) {
         return false;
     }
     $iCMS->mode = 'CreateHtml';
     $iCMS->htmlConf = array('enable' => true, 'ext' => $rs['htmlext'] ? $rs['htmlext'] : $iCMS->config['htmlext']);
     $html = $iCMS->content($id, $mid, $table);
     if (!$html) {
         return false;
     }
     FS::mkdir($iCMS->metadata->iurl->dir);
     FS::write($iCMS->metadata->iurl->path, $html, false);
     return true;
 }