Пример #1
0
 function doUpdate()
 {
     foreach ($_POST as $key => $value) {
         updateConfig(dhtmlspecialchars($value), $key);
     }
     CreateConfigFile();
     javascript::dialog('配置已更新!');
 }
Пример #2
0
 function doUpdate()
 {
     include_once iPATH . 'include/forum.class.php';
     if ($_POST['forum']) {
         $forum = new forum();
         $forum->cache();
     }
     if ($_POST['adm']) {
         include_once iPATH . 'admin/advertise.mo.php';
         $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__advertise`", OBJECT);
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             adm($rs[$i]);
         }
     }
     $_POST['tpl'] && $this->iCMS->clear_compiled_tpl();
     $_POST['iCMS_list'] && FS::rmdir(iPATH . 'cache/list');
     $_POST['iCMS_forum'] && FS::rmdir(iPATH . 'cache/forum');
     $_POST['iCMS_tag'] && FS::rmdir(iPATH . 'cache/tags');
     if ($_POST['iCMS_ALL']) {
         FS::rmdir(iPATH . 'cache/list');
         FS::rmdir(iPATH . 'cache/forum');
         FS::rmdir(iPATH . 'cache/tags');
     }
     $_POST['keywords'] && keywords_cache();
     $_POST['tags'] && tags_cache();
     if ($_POST['model']) {
         include iPATH . 'include/model.class.php';
         model::cache();
     }
     $_POST['field'] && field_cache();
     $_POST['config'] && CreateConfigFile();
     if ($_POST['Re-Article-Count']) {
         $rs = iCMS_DB::getArray("SELECT fid FROM `#iCMS@__forum`");
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             $c = iCMS_DB::getValue("SELECT count(*) FROM #iCMS@__article where `fid`='" . $rs[$i]['fid'] . "' LIMIT 1 ");
             iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` ='{$c}' WHERE `fid` ='" . $rs[$i]['fid'] . "' LIMIT 1 ");
         }
     }
     if ($_POST['Re-Tag-Count']) {
         include_once iPATH . 'include/forum.class.php';
         $rs = iCMS_DB::getArray("SELECT id FROM `#iCMS@__tags`");
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             $_count = iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__taglist` WHERE `tid`='" . $rs[$i]['id'] . "'");
             iCMS_DB::query("UPDATE `#iCMS@__tags` SET `count` = '{$_count}'  WHERE `id` ='" . $rs[$i]['id'] . "'");
             tags_cache($rs[$i]['id']);
         }
     }
     javascript::dialog("执行完毕!", 'url:1');
 }
Пример #3
0
 function doCreateIndex()
 {
     $isA = $this->isAll();
     if ($isA) {
         $_POST['indexTPL'] = $this->iCMS->config['indexTPL'];
         $_POST['indexname'] = $this->iCMS->config['indexname'];
     } else {
         updateConfig($_POST['indexTPL'], 'indexTPL');
         updateConfig($_POST['indexname'], 'indexname');
         CreateConfigFile();
     }
     iHtml::Index($_POST['indexTPL'], $_POST['indexname']);
     if ($isA) {
         javascript::dialog("全站更新完成!", 'url:' . __SELF__ . '?mo=html&do=all');
     } else {
         javascript::dialog("网站首页更新完成!");
     }
 }
Пример #4
0
 function doCreateIndex()
 {
     $isA = $this->isAll();
     !$_POST['indexTPL'] && ($_POST['indexTPL'] = $this->iCMS->config['indexTPL']);
     !$_POST['indexname'] && ($_POST['indexname'] = $this->iCMS->config['indexname']);
     if ($_POST['indexTPL'] != $this->iCMS->config['indexTPL'] || $_POST['indexname'] != $this->iCMS->config['indexname']) {
         updateConfig($_POST['indexTPL'], 'indexTPL');
         updateConfig($_POST['indexname'], 'indexname');
         CreateConfigFile();
     }
     $cpage = $_GET['cpage'] ? $_GET['cpage'] : 1;
     $loop = $_GET['loop'] ? $_GET['loop'] : 0;
     $c = iHtml::Index($_POST['indexTPL'], $_POST['indexname'], $cpage, $loop);
     if ($isA) {
         javascript::dialog("全站更新完成!", 'url:' . __SELF__ . '?mo=html&do=all');
     } else {
         if ($c['loop'] > 0 && $c['page'] <= $c['pagesize']) {
             javascript::dialog($c['name'] . "共" . $c['pagesize'] . "页,{$text}已生成" . $c['page'] . "页", 'src:' . __SELF__ . '?mo=html&do=CreateIndex&cpage=' . $c['page'] . '&loop=' . ($c['loop'] - 1) . $isA, 'ok', $this->cTime);
         } else {
             javascript::dialog("网站首页更新完成!");
         }
     }
 }
Пример #5
0
    $dbName = $_POST['name'];
    $user = $_POST['admin_login'];
    $md5pass = md5($_POST['admin_pass']);
    if (empty($dbUser) || empty($dbPass) || empty($dbHost) || empty($dbName) || empty($user) || empty($md5pass)) {
        $success = false;
    } else {
        define('MYSQL_HOST', $dbHost);
        define('MYSQL_LOGIN', $dbUser);
        define('MYSQL_PASSWORD', $dbPass);
        define('MYSQL_DB', $dbName);
        define('USER', $user);
        define('PASS', $md5pass);
        define('MYSQL_DEBUG', true);
        define('TIME_DEBUG', true);
        CreateDatabase();
        CreateConfigFile();
        $success = true;
    }
}
function CreateConfigFile()
{
    global $dbUser, $dbPass, $dbHost, $dbName, $user, $md5pass;
    $config = <<<DATA
<?php

define('MYSQL_HOST', '{$dbHost}');
define('MYSQL_LOGIN', '{$dbUser}');
define('MYSQL_PASSWORD', '{$dbPass}');
define('MYSQL_DB', '{$dbName}');

define('USER', '{$user}');
Пример #6
0
 */
!defined('iPATH') && exit('What are you doing?');
switch ($operation) {
    case 'post':
        if ($action == 'cache') {
            if ($_POST['catalog']) {
                include_once iPATH . 'include/catalog.class.php';
                $catalog = new catalog();
                $catalog->cache();
            }
            $_POST['tpl'] && $iCMS->clear_compiled_tpl();
            $_POST['keywords'] && keywords_cache();
            $_POST['tags'] && tags_cache();
            $_POST['model'] && model_cache();
            $_POST['field'] && field_cache();
            $_POST['config'] && CreateConfigFile();
            if ($_POST['Re-Statistics']) {
                $rs = $iCMS->db->getArray("SELECT id FROM `#iCMS@__catalog` ORDER BY `id` DESC");
                $_count = count($rs);
                for ($i = 0; $i < $_count; $i++) {
                    $c = $iCMS->db->getValue("SELECT count(*) FROM #iCMS@__article where `cid`='" . $rs[$i]['id'] . "' LIMIT 1 ");
                    $iCMS->db->query("UPDATE `#iCMS@__catalog` SET `count` ='{$c}' WHERE `id` ='" . $rs[$i]['id'] . "' LIMIT 1 ");
                }
            }
            redirect("执行完毕!", __SELF__ . '?do=cache');
        }
        break;
    default:
        $Admin->MP("menu_cache");
        include iCMS_admincp_tpl("cache");
}
Пример #7
0
function Step3()
{
    $tpl = new Template();
    $tpl->set('step', '3');
    $tpl->display('templates/header_install.tpl');
    if (CreateConfigFile($_POST['host'], $_POST['username'], $_POST['password'], $_POST['name'], $_POST['prefix'])) {
        echo 'Config file created successfully';
    } else {
        echo 'Could not create config file';
    }
    echo '<br/>';
    CreateDatabase($_POST['host'], $_POST['username'], $_POST['password'], $_POST['name'], $_POST['prefix']);
    echo 'Congratulations. You have successfully installed photobook.<br />Go <a href="../index.php">here</a> to see your site.';
    $tpl->display('templates/footer_install.tpl');
}