예제 #1
0
 function onsetting()
 {
     if (isset($this->post['submit'])) {
         $this->setting['cms_open'] = intval($this->post['cms_open']);
         $config = "<?php \r\n";
         if ($this->post['cms_db_config']) {
             $config .= trim($this->post['cms_db_config']) . "\r\n";
         }
         if ($this->post['cms_db_article']) {
             $config .= trim($this->post['cms_db_article']);
         }
         writetofile(TIPASK_ROOT . '/data/cms.config.inc', tstripslashes($config));
         $message = 'cms²ÎÊýÅäÖÃÍê³É£¡';
         $_ENV['setting']->update($this->setting);
     }
     include template("cms_setting", "admin");
 }
예제 #2
0
function tstripslashes($string)
{
    if (empty($string)) {
        return $string;
    }
    if (is_array($string)) {
        foreach ($string as $key => $val) {
            $string[$key] = tstripslashes($val);
        }
    } else {
        $string = stripslashes($string);
    }
    return $string;
}
예제 #3
0
ALTER TABLE ask_answer DROP tag;
EOT;
if (!$action) {
    echo '<meta http-equiv=Content-Type content="text/html;charset=' . TIPASK_CHARSET . '">';
    echo "本程序仅用于升级 Tipask2.5beta 到 Tipask2.5正式版,请确认之前已经顺利安装Tipask2.5beta版本!<br><br><br>";
    echo "<b><font color=\"red\">运行本升级程序之前,请确认已经上传 Tipask2.5正式版的全部文件和目录</font></b><br><br>";
    echo "<b><font color=\"red\">本程序只能从Tipask2.5beta版到 Tipask2.5正式版,切勿使用本程序从其他版本升级,否则可能会破坏掉数据库资料.<br><br>强烈建议您升级之前备份数据库资料!</font></b><br><br>";
    echo "正确的升级方法为:<br>1. 上传 Tipask2.5正式版的全部文件和目录,覆盖服务器上的Tipask2.5beta版;<br>2. 上传本程序(2.5betato2.5.php)到 Tipask目录中;<br>3. 运行本程序,直到出现升级完成的提示;<br>4. 登录Tipask后台,更新缓存,升级完成。<br><br>";
    echo "<a href=\"{$PHP_SELF}?action=upgrade\">如果您已确认完成上面的步骤,请点这里升级</a>";
} else {
    $db = new db(DB_HOST, DB_USER, DB_PW, DB_NAME, DB_CHARSET, DB_CONNECT);
    runquery($upgrade);
    $query = $db->query("SELECT * FROM " . DB_TABLEPRE . "answer WHERE tag<>''");
    while ($answer = $db->fetch_array($query)) {
        $question = $db->fetch_first("SELECT * FROM " . DB_TABLEPRE . "question WHERE `id`=" . $answer['qid']);
        $taglist = tstripslashes(unserialize($answer['tag']));
        $stime = $answer['time'];
        foreach ($taglist as $index => $tag) {
            $stime += rand(60, 7200);
            $tag = '<p>' . strip_tags($tag) . '</p>';
            if ($index % 2 == 0) {
                $db->query("INSERT INTO " . DB_TABLEPRE . "answer_append(appendanswerid,answerid,author,authorid,content,time) VALUES (NULL," . $answer['id'] . ",'" . $question['author'] . "'," . $question['authorid'] . ",'{$tag}',{$stime})");
            } else {
                $db->query("INSERT INTO " . DB_TABLEPRE . "answer_append(appendanswerid,answerid,author,authorid,content,time) VALUES (NULL," . $answer['id'] . ",'" . $answer['author'] . "'," . $answer['authorid'] . ",'{$tag}',{$stime})");
            }
        }
    }
    runquery($extend);
    $config = "<?php \r\ndefine('DB_HOST',  '" . DB_HOST . "');\r\n";
    $config .= "define('DB_USER',  '" . DB_USER . "');\r\n";
    $config .= "define('DB_PW',  '" . DB_PW . "');\r\n";
예제 #4
0
 function onad()
 {
     if (isset($this->post['submit'])) {
         $this->setting['ads'] = taddslashes(serialize($this->post['ad']), 1);
         $_ENV['setting']->update($this->setting);
         $type = 'correctmsg';
         $message = '广告修改成功!';
         $this->setting = $this->cache->load('setting');
     }
     $adlist = tstripslashes(unserialize($this->setting['ads']));
     include template('setting_ad', 'admin');
 }