Esempio n. 1
0
function dir_clear($dir_name)
{
    if (is_dir($dir_name) == false) {
        return false;
    }
    $dir_handle = opendir($dir_name);
    while (($file = readdir($dir_handle)) !== false) {
        if ($file != '.' and $file != "..") {
            if (is_dir($dir_name . '/' . $file)) {
                dir_clear($dir_name . '/' . $file);
            }
            if (is_file($dir_name . '/' . $file)) {
                @unlink($dir_name . '/' . $file);
            }
        }
    }
    closedir($dir_handle);
    return true;
}
Esempio n. 2
0
function cleardir($dir)
{
    global $lang;
    showjsmessage(lang('clear_dir') . ' ' . str_replace(ROOTDIR, '', $dir));
    dir_clear($dir);
}
Esempio n. 3
0
?action=db">please click here to start upgrade</a></p>

<?php 
    showfooter();
} elseif ($action == 'db') {
    showheader();
    echo "<h4>Table structure update</h4>";
    @touch(UC_ROOT . './data/install.lock');
    //vot	@unlink(UC_ROOT.'./install/index.php');
    $db = new ucserver_db();
    $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
    runquery($sql);
    dir_clear(UC_ROOT . './data/view');
    dir_clear(UC_ROOT . './data/cache');
    if (is_dir(UC_ROOT . './plugin/setting')) {
        dir_clear(UC_ROOT . './plugin/setting');
        @unlink(UC_ROOT . './plugin/setting/index.htm');
        @rmdir(UC_ROOT . './plugin/setting');
    }
    echo "Processing the short message data";
    $url_forward = "upgrade_1.5.2_1.6.0.php?action=pm&forward=" . urlencode($forward);
    echo "<br /><br /><br /><a href=\"{$url_forward}\">Browser will automatically reload the page, without human intervention. If your browser does not redirect for a long time, please click here</a>";
    echo "<script>setTimeout(\"redirect('{$url_forward}');\", 1250);</script>";
    showfooter();
} elseif ($action == 'pm') {
    showheader();
    echo "<h4>Processing the short message data</h4>";
    $db = new ucserver_db();
    $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
    $total = getgpc('total');
    $start = getgpc('start') ? getgpc('start') : 0;
Esempio n. 4
0
 $num = $num ? intval($num) : 1;
 $random = getgpc('random');
 if (empty($random)) {
     $dir = UC_ROOT . './data/upgsecques';
     $directory = dir($dir);
     while ($entry = $directory->read()) {
         if (preg_match('/^secques_(\\w+)_\\d+/', $entry, $match)) {
             break;
         }
     }
     $random = $match[1];
 }
 $dump_file = UC_ROOT . './data/upgsecques/secques_' . $random . '_' . $num . '.sql';
 if (!file_exists($dump_file)) {
     @touch($lock_file);
     dir_clear(UC_ROOT . './data/upgsecques');
     setcookie('uc_authcode', '');
     showheader();
     echo '安全提问升级完成,感谢您使用本程序';
 } else {
     showheader();
     $sql = file_get_contents($dump_file);
     $db = new db();
     $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
     runquery($sql);
     $num++;
     echo "安全提问正在导入";
     $url_forward = "upgrade2.php?action=upgsecques&num={$num}&random={$random}";
     echo "<br /><br /><br /><a href=\"{$url_forward}\">浏览器会自动跳转页面,无需人工干预。除非当您的浏览器长时间没有自动跳转时,请点击这里</a>";
     echo "<script>setTimeout(\"redirect('{$url_forward}');\", 1250);</script>";
 }
Esempio n. 5
0
 function clear_cache()
 {
     need_login('ajax_page');
     dir_clear(ROOTDIR . 'cache/data');
     dir_clear(ROOTDIR . 'cache/templates');
     dir_clear(ROOTDIR . 'cache/tmp');
     //清除缩略图片缓存
     $files = glob(ROOTDIR . 'cache/dimgs/[a-zA-Z0-9][a-zA-Z0-9]/*.php');
     //用glob通过通配符搜索所有缓存文件
     if ($files) {
         foreach ($files as $file) {
             @unlink($file);
         }
     }
     ajax_box(lang('clear_cache_success'), null, 0.5, $_SERVER['HTTP_REFERER']);
 }
Esempio n. 6
0
function pick_download()
{
    $client_info = get_client_info();
    $version_md5total = $_GET['md5_total'];
    $new_version_md5total = $_GET['new_md5_total'];
    $key = $_GET['key'];
    $version = $_GET['version'];
    $version_dateline = $_GET['version_dateline'];
    $i = intval($_GET['i']);
    if (!$client_info) {
        cpmsg_error(milu_lang('lan_upgrage'));
    }
    $p = intval($_GET['p']);
    $count = $_GET['count'];
    $file_md5 = $_GET['file_md5'];
    $tmpdir = DISCUZ_ROOT . './data/download/dxc_temp';
    pload('C:cache');
    $md5s = array();
    $str = $_SERVER['QUERY_STRING'];
    if ($p == 0) {
        dir_clear($tmpdir);
        dmkdir($tmpdir, 0777, false);
        cpmsg(milu_lang('diff_upgrade_file'), PICK_GO . 'pick_info&ac=pick_download&key=' . $key . '&p=1', 'loading', '', false);
    } else {
        if ($p == 1) {
            $url = GET_URL . 'plugin.php?id=pick_user:upgrade&myac=download_file&php_version=' . phpversion() . '&tpl=no&domain=' . urlencode($client_info['domain']) . '&key=' . $key . '&file_md5=' . $file_md5;
            $data = get_contents($url, array('cache' => -1));
            if (!$data || $data == '-1') {
                cpmsg_error(milu_lang('no_normal_get'));
            }
            $msg_arr = (array) json_decode(base64_decode($data));
            if (!$_GET['file_md5']) {
                $download_file_data = upgrade_file_diff($msg_arr['md5']);
                $md5_temp_arr = array_keys($download_file_data);
                $version_md5total = md5(implode('', $md5_temp_arr));
                $count = count($download_file_data);
                $version = $version ? $version : $msg_arr['Version'];
                $version_dateline = $version_dateline ? $version_dateline : $msg_arr['version_dateline'];
            } else {
                $download_file_data = load_cache('download_file_data');
                $filename = $tmpdir . '/' . $msg_arr['file'] . '._addons_';
                $dirname = dirname($filename);
                dmkdir($dirname, 0777, false);
                $fp = fopen($filename, 'w');
                if (!$fp) {
                    cpmsg('cloudaddons_download_write_error', '', 'error');
                }
                fwrite($fp, gzuncompress(base64_decode($msg_arr['text'])));
                fclose($fp);
                if ($msg_arr['MD5']) {
                    $new_version_md5total .= $msg_arr['MD5'];
                    if ($msg_arr['MD5'] != md5_file($filename)) {
                        dir_clear($tmpdir);
                        cpmsg(milu_lang('cloudaddons_download_error'), '', 'error');
                        //数据下载错误
                    }
                }
            }
            $file_md5_arr = array_keys($download_file_data);
            $file_md5 = $file_md5_arr[$i];
            $file = $download_file_data[$file_md5];
            $p = $i == $count ? 2 : 1;
            $percent = $i / $count;
            $percent = sprintf("%01.0f", $percent * 100) . '%';
            cache_data('download_file_data', $download_file_data);
            cpmsg(milu_lang('pick_upgrade_downloading_file', array('file' => $file, 'percent' => $percent)), PICK_GO . 'pick_info&ac=pick_download&i=' . ($i + 1) . '&md5_total=' . $version_md5total . '&new_md5_total=' . $new_version_md5total . '&key=' . $key . '&p=' . $p . '&version=' . $version . '&version_dateline=' . $version_dateline . '&count=' . $count . '&file_md5=' . $file_md5, 'loading', '', false);
        } else {
            if ($p == 2) {
                if ($new_version_md5total !== '' && md5($new_version_md5total) !== $version_md5total) {
                    dir_clear($tmpdir);
                    cpmsg(milu_lang('cloudaddons_download_error'), '', 'error');
                    //数据下载错误
                }
                cpmsg(milu_lang('DXC_installing'), PICK_GO . 'pick_info&ac=pick_install&version=' . $version . '&version_dateline=' . $version_dateline, 'loading', '', false);
            }
        }
    }
}
Esempio n. 7
0
    require_once libfile('function/admincp');
    require_once libfile('function/importdata');
    $dir = DB::result_first("SELECT t.directory FROM " . DB::table('common_style') . " s LEFT JOIN " . DB::table('common_template') . " t ON t.templateid=s.templateid WHERE s.styleid='1'");
    import_styles(1, $dir, 1, 0);
    DB::update('common_setting', array('svalue' => 1), "skey='styleid'");
    show_msg(lang('update', 'default_style_restored'), "{$theurl}?step=cache");
} elseif ($_GET['step'] == 'cache') {
    if (!$devmode && @($fp = fopen($lockfile, 'w'))) {
        fwrite($fp, ' ');
        fclose($fp);
    }
    dir_clear(ROOT_PATH . './data/template');
    dir_clear(ROOT_PATH . './data/cache');
    dir_clear(ROOT_PATH . './data/threadcache');
    dir_clear(ROOT_PATH . './uc_client/data');
    dir_clear(ROOT_PATH . './uc_client/data/cache');
    show_msg(lang('update', 'database_updated') . '<iframe src="../misc.php?mod=initsys" style="display:none;"></iframe>');
}
function has_another_special_table($tablename, $key)
{
    if (!$key) {
        return $tablename;
    }
    $tables_array = get_special_tables_array($tablename);
    if ($key > count($tables_array)) {
        return FALSE;
    } else {
        return TRUE;
    }
}
function get_special_tables_array($tablename)
Esempio n. 8
0
        config_edit();
        require TIPASK_ROOT . './lib/db.class.php';
        $db = new db($dbhost, $dbuser, $dbpw, $dbname, DBCHARSET);
        $sql = file_get_contents($sqlfile);
        $sql = str_replace("\r\n", "\n", $sql);
        if (!VIEW_OFF) {
            show_header();
            show_install();
        }
        runquery($sql);
        //add default user
        $db->query("INSERT INTO `" . $tablepre . "user` SET `username`='" . $admininfo['ucadminname'] . "', `password`='" . md5(trim($admininfo['ucfounderpw'])) . "',`email`='" . $admininfo['ucadminemail'] . "',`groupid`=1,`credits`=200,`credit1`=100,`credit2`=100,`regip`='" . $_SERVER["REMOTE_ADDR"] . "'");
        $db->query("INSERT INTO `" . $tablepre . "setting` SET `k`='auth_key',`v`='" . generate_key() . "'");
        $db->query("INSERT INTO `" . $tablepre . "setting` SET `k`='admin_email',`v`='" . $admininfo['ucadminemail'] . "'");
        $db->query("INSERT INTO `" . $tablepre . "setting` SET `k`='admin_email',`v`='" . $admininfo['ucadminemail'] . "'");
        dir_clear(TIPASK_ROOT . './data/cache');
        //clear up the old data cathe
        VIEW_OFF && show_msg('initdbresult_succ');
        if (!VIEW_OFF) {
            echo '<script type="text/javascript">document.getElementById("step3").disabled=false;document.getElementById("step3").value = \'' . lang('install_succeed') . '\';</script>' . "\r\n";
            show_footer();
        }
    }
    if (VIEW_OFF) {
        show_msg('missing_parameter', '', 0);
    } else {
        show_form($form_db_init_items, $error_msg);
    }
} elseif ($method == 'post_siteinfo') {
    $infoarr = array('site_url' => $site_url, 'domain' => $_SERVER['HTTP_HOST'], 'version' => TIPASK_VERSION);
    $info = urlencode(base64_encode(serialize($infoarr)));
Esempio n. 9
0
    echo "          <td><b><font color=\"#FF0000\">&gt;</font><font color=\"#000000\"> {$lang['create_table']}</font></b></td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    $extrasql = <<<EOT
INSERT INTO bra_users (username,`password`,groupid) VALUES ('{$username}','{$brpswd}','9');
EOT;
    runquery($sql);
    runquery($extrasql);
    loginit('adminlog');
    loginit('newsinfo');
    dir_clear('./gamedata/bak');
    //dir_clear('./gamedata/log');
    //dir_clear('./gamedata/mapitem');
    //dir_clear('./gamedata/shopitem');
    dir_clear('./gamedata/templates');
    echo $lang['init_game'];
    $adminmsg = setconfig($_POST['adminmsg']);
    $startmode = (int) $_POST['startmode'];
    $iplimit = (int) $_POST['iplimit'];
    if ($startmode == 1) {
        $starthour = 10;
    } elseif ($startmode == 2) {
        $starthour = 1;
    } else {
        $starthour = 0;
    }
    $fp = fopen('./gamedata/system.php', 'r');
    $systemfile = fread($fp, filesize('./gamedata/system.php'));
    fclose($fp);
    $systemfile = preg_replace("/[\$]adminmsg\\s*\\=\\s*[\"'].*?[\"'];/is", "\$adminmsg = '{$adminmsg}';", $systemfile);
Esempio n. 10
0
<?php

header('content-type:text/html;charset=utf-8');
//unlink()只能删除文件而不能删除目录
//$filename='abc/readme.txt';
//unlink($filename);
//删除指定目录下的所有文件
$dir = 'abc/b';
//删除b文件夹下的所有文件,不能删除文件夹
function dir_clear($dir)
{
    $directory = dir($dir);
    //创建一个dir类(Php手册上这么说的),用来读取目录中的每一个文件
    while ($entry = $directory->read()) {
        //循环每一个文件,并取得文件名$entry
        $filename = $dir . '/' . $entry;
        //取得完整的文件名,带路径的
        if (is_file($filename)) {
            //如果是文件,则执行删除操作
            @unlink($filename);
        }
    }
    $directory->close();
    //关闭读取目录文件的类
}
dir_clear($dir);
Esempio n. 11
0
    echo "          <td>\n";
    echo "            <hr noshade align=\"center\" width=\"100%\" size=\"1\">\n";
    echo "          </td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td><b><font color=\"#FF0000\">&gt;</font><font color=\"#000000\"> {$lang['init_file']}</font></b></td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    loginit('adminlog');
    loginit('errorlog');
    if (@($fp = fopen($lockfile, 'w'))) {
        fwrite($fp, 'Cyask 3.2');
        fclose($fp);
    }
    dir_clear(CYASK_ROOT . './askdata/templates');
    ?>
          </td>
        </tr>
        <tr>
          <td>
            <hr noshade align="center" width="100%" size="1">
          </td>
        </tr>
        <tr>
          <td align="center">
            <font color="#FF0000"><b><?php 
    echo $lang['install_succeed'];
    ?>
</font><br>
            <?php 
Esempio n. 12
0
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('authkey', '{$authkey}')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('siteuniqueid', '{$siteuniqueid}')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('backupdir', '" . $backupdir . "')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('extcredits', '" . addslashes(serialize($extcredits)) . "')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('attachdir', '{$attachdir}')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('attachurl', '{$attachurl}')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('videoinfo', '" . addslashes(serialize($videoinfo)) . "')");
    $db->query("DELETE FROM {$tablepre}members");
    $db->query("DELETE FROM {$tablepre}memberfields");
    $db->query("INSERT INTO {$tablepre}members (uid, username, password, secques, adminid, groupid, regip, regdate, lastvisit, lastpost, email, dateformat, timeformat, showemail, newsletter, timeoffset) VALUES ('1', '{$username}', '{$password}', '', '1', '1', 'hidden', '" . time() . "', '" . time() . "', '" . time() . "', '{$email}', '', '0', '1', '1', '9999');");
    $db->query("INSERT INTO {$tablepre}memberfields (uid, bio, sightml, ignorepm, groupterms) VALUES ('1', '', '', '', '')");
    $db->query("UPDATE {$tablepre}crons SET lastrun='0', nextrun='" . ($timestamp + 3600) . "'");
    foreach ($optionlist as $optionid => $option) {
        $db->query("INSERT INTO {$tablepre}typeoptions VALUES ('{$optionid}', '{$option['classid']}', '{$option['displayorder']}', '{$option['title']}', '', '{$option['identifier']}', '{$option['type']}', '" . addslashes(serialize($option['rules'])) . "');");
    }
    $db->query("ALTER TABLE {$tablepre}typeoptions AUTO_INCREMENT=3001");
    $yearmonth = date('Ym_', time());
    loginit($yearmonth . 'ratelog');
    loginit($yearmonth . 'illegallog');
    loginit($yearmonth . 'modslog');
    loginit($yearmonth . 'cplog');
    loginit($yearmonth . 'errorlog');
    loginit($yearmonth . 'banlog');
    dir_clear('./forumdata/templates');
    dir_clear('./forumdata/cache');
    dir_clear('./forumdata/threadcaches');
    @touch(DISCUZ_ROOT . $lockfile);
    echo '<script type="text/javascript">document.getElementById("laststep").disabled = false; </script>' . "\r\n";
    echo '<script type="text/javascript">document.getElementById("laststep").value = \'' . $lang['install_succeed'] . '\'; </script>' . "\r\n";
    echo '<iframe width="0" height="0" src="index.php"></iframe>';
}
Esempio n. 13
0
    echo "          </td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    echo "            <hr noshade align=\"center\" width=\"100%\" size=\"1\">\n";
    echo "          </td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td><b><font color=\"#FF0000\">&gt;</font><font color=\"#000000\"> {$lang['init_file']}</font></b></td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    loginit('adminlog');
    loginit('errorlog');
    dir_clear('./askdata/templates');
    dir_clear('./askdata/cache');
    @touch($lockfile);
    ?>
          </td>
        </tr>
        <tr>
          <td>
            <hr noshade align="center" width="100%" size="1">
          </td>
        </tr>
        <tr>
          <td align="center">
            <font color="#FF0000"><b><?php 
    echo $lang['install_succeed'];
    ?>
</font><br>
Esempio n. 14
0
        for ($i = 0; $i < 5; $i++) {
            showjsmessage('正在设置系统...成功!');
        }
        for ($i = 0; $i < 5; $i++) {
            showjsmessage('正在导入区划数据...');
        }
        install_districtdata();
        for ($i = 0; $i < 5; $i++) {
            showjsmessage('正在导入区划数据...成功!');
        }
        $yearmonth = date('Ym_', time());
        loginit($yearmonth . 'illegallog');
        loginit($yearmonth . 'cplog');
        loginit($yearmonth . 'errorlog');
        dir_clear(ROOT_PATH . './data/template');
        dir_clear(ROOT_PATH . './data/cache');
        foreach ($serialize_sql_setting as $k => $v) {
            $v = addslashes(serialize($v));
            $db->query("REPLACE INTO {$tablepre}setting VALUES ('{$k}', '{$v}')");
        }
        if ($runqueryerror) {
            showjsmessage('<span class="red">' . $lang['error_quit_msg'] . '</span>');
            exit;
        }
        showjsmessage('系统数据安装成功!请点击下一步设置管理员</span>');
        echo '<script type="text/javascript">function setlaststep() {document.getElementById("laststep").disabled=false;}</script><script type="text/javascript">setTimeout(function(){window.location=\'index.php?step=4\'}, 30000);setlaststep();</script>' . "\r\n";
        show_footer();
    }
    show_form($form_db_init_items, $error_msg);
} elseif ($method == 'admin_init') {
    $submit = true;
Esempio n. 15
0
    echo $installfile;
    ?>
">
<input type="hidden" name="action" value="user">
<input type="button" name="submit" value="下一步" disabled style="height: 25" onclick="window.location='installer.php?action=user'" id="laststep">
</form>
<br>
</td></tr>
<?php 
    $fp = fopen($sqlfile, 'rb');
    $sql = fread($fp, filesize($sqlfile));
    fclose($fp);
    runquery($sql);
    runquery($extrasql);
    dir_clear('./data/templates');
    dir_clear('./data/cache');
    echo '<script type="text/javascript">document.getElementById("laststep").disabled = false; </script>' . "\r\n";
    echo '<script type="text/javascript">document.getElementById("laststep").value = \'下一步\'; </script>' . "\r\n";
} elseif ($action == 'user') {
    $db = new dbstuff();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    $db->select_db($dbname);
    $query = $db->query("SELECT * FROM {$tablepre}members WHERE uid='1 Babel'");
    if (mysql_num_rows($query) > 0) {
        showjsmessage('用户已经创建,请继续安装');
    } else {
        if ($_POST['saveconfig']) {
            $username = strtolower(addslashes(trim(stripslashes($_POST['username']))));
            $email = htmlspecialchars($_POST['email']);
            $password = md5($_POST['password']);
            $db->query("INSERT INTO {$tablepre}members (username, password, adminid, groupid, regip, regdate, lastvisit, lastactivity,  email, dateformat, timeformat, timeoffset ,avatar)\r\n\t\t\t\tVALUES ('{$username}', '{$password}', '1', '1',  'hidden', '{$timestamp}', '{$timestamp}', '{$timestamp}', '{$email}',  '0000-00-00', '0', '9999', '')");
Esempio n. 16
0
function dir_clear($dir)
{
    if ($directory = @dir($dir)) {
        while ($entry = $directory->read()) {
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            $filename = $dir . '/' . $entry;
            if (is_file($filename)) {
                @unlink($filename);
            } else {
                dir_clear($filename);
            }
        }
        $directory->close();
        @rmdir($dir);
    }
}
function dir_clear($dir)
{
    if (strstr($dir, 'saekv://')) {
        clearkvfolder(substr($dir, 8));
    } elseif ($directory = @dir($dir)) {
        while ($entry = $directory->read()) {
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            $filename = $dir . '/' . $entry;
            if (is_file($filename)) {
                @unlink($filename);
            } else {
                dir_clear($filename);
            }
        }
        $directory->close();
        @rmdir($dir);
    }
}
Esempio n. 18
0
    ins_footer();
    runquery($sql);
    $backupdir = substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . substr($timestamp, 0, 4)), 8, 6);
    @mkdir('dynamic/backup_' . $backupdir, 0777);
    $hosturl = 'http://' . $_SERVER['HTTP_HOST'];
    $php_self = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
    $cmsurl = substr($php_self, 0, strrpos($php_self, '/')) . '/';
    $authkey = substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $dbhost . $dbuser . $dbpw . $dbname . $username . $password . $pconnect . substr($timestamp, 0, 6)), 8, 6) . random(10);
    $db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('authkey','{$authkey}','visit')");
    $db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('hosturl','{$hosturl}','site')");
    $db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('cmsurl','{$cmsurl}','site')");
    $db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('backupdir','{$backupdir}','')");
    $db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('dir_userfile','userfiles','upload')");
    $db->query("REPLACE INTO {$tblprefix}members (mid,mname,isfounder,password,email,checked,regdate) VALUES ('1','{$username}','1','{$password}','{$email}','1','{$timestamp}');", 'SILENT');
    $db->query("REPLACE INTO {$tblprefix}members_1 (mid) VALUES ('1')", 'SILENT');
    $db->query("REPLACE INTO {$tblprefix}members_sub (mid) VALUES ('1')", 'SILENT');
    dir_clear('./dynamic/records');
    $yearmonth = date('Ym_', time());
    loginit($yearmonth . 'adminlog');
    loginit($yearmonth . 'badlogin');
    loginit($yearmonth . 'currencylog');
    cacheinit();
    @touch(M_ROOT . $lockfile);
    @unlink(M_ROOT . 'index.htm');
    //删除首页跳转文件
    @unlink(M_ROOT . 'index.html');
    //删除首页跳转文件
    echo '<script type="text/javascript">document.getElementById("laststep").disabled = false; </script>' . "\r\n";
    echo '<script type="text/javascript">document.getElementById("laststep").value = \'OK\'; </script>' . "\r\n";
    echo '<iframe width="0" height="0" src="./install/inscache.php"></iframe>';
}
Esempio n. 19
0
function install_uc_server()
{
    global $db, $dbhost, $dbuser, $dbpw, $dbname, $tablepre, $username, $password, $email;
    $ucsql = file_get_contents(ROOT_PATH . './uc_server/install/uc.sql');
    $uctablepre = $tablepre . 'ucenter_';
    $ucsql = str_replace(' uc_', ' ' . $uctablepre, $ucsql);
    $ucsql && runucquery($ucsql, $uctablepre);
    $appauthkey = _generate_key();
    $ucdbhost = $dbhost;
    $ucdbname = $dbname;
    $ucdbuser = $dbuser;
    $ucdbpw = $dbpw;
    $ucdbcharset = DBCHARSET;
    $uccharset = CHARSET;
    $pathinfo = pathinfo($_SERVER['PHP_SELF']);
    $pathinfo['dirname'] = substr($pathinfo['dirname'], 0, -8);
    $appurl = 'http://' . preg_replace("/\\:\\d+/", '', $_SERVER['HTTP_HOST']) . ($_SERVER['SERVER_PORT'] && $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '') . $pathinfo['dirname'];
    $ucapi = $appurl . '/uc_server';
    $ucip = '';
    $app_tagtemplates = 'apptagtemplates[template]=' . urlencode('<a href="{url}" target="_blank">{subject}</a>') . '&' . 'apptagtemplates[fields][subject]=' . urlencode($lang['tagtemplates_subject']) . '&' . 'apptagtemplates[fields][uid]=' . urlencode($lang['tagtemplates_uid']) . '&' . 'apptagtemplates[fields][username]=' . urlencode($lang['tagtemplates_username']) . '&' . 'apptagtemplates[fields][dateline]=' . urlencode($lang['tagtemplates_dateline']) . '&' . 'apptagtemplates[fields][url]=' . urlencode($lang['tagtemplates_url']);
    $db->query("INSERT INTO {$uctablepre}applications SET name='Discuz! Board', url='{$appurl}', ip='{$ucip}', authkey='{$appauthkey}', synlogin='1', charset='{$charset}', dbcharset='{$dbcharset}', type='DISCUZX', recvnote='1', tagtemplates='{$apptagtemplates}'", $link);
    $appid = $db->insert_id($link);
    $db->query("ALTER TABLE {$uctablepre}notelist ADD COLUMN app{$appid} tinyint NOT NULL");
    $config = array($appauthkey, $appid, $ucdbhost, $ucdbname, $ucdbuser, $ucdbpw, $ucdbcharset, $uctablepre, $uccharset, $ucapi, $ucip);
    save_uc_config($config, ROOT_PATH . './config/config_ucenter.php');
    $salt = substr(uniqid(rand()), -6);
    $passwordmd5 = md5(md5($password) . $salt);
    $db->query("INSERT INTO {$uctablepre}members SET {$sqladd} username='{$username}', password='{$passwordmd5}', email='{$email}', regip='hidden', regdate='" . time() . "', salt='{$salt}'");
    $uid = $db->insert_id();
    $db->query("INSERT INTO {$uctablepre}memberfields SET uid='{$uid}'");
    $db->query("INSERT INTO {$uctablepre}admins SET\r\n\t\tuid='{$uid}',\r\n\t\tusername='{$username}',\r\n\t\tallowadminsetting='1',\r\n\t\tallowadminapp='1',\r\n\t\tallowadminuser='1',\r\n\t\tallowadminbadword='1',\r\n\t\tallowadmincredits='1',\r\n\t\tallowadmintag='1',\r\n\t\tallowadminpm='1',\r\n\t\tallowadmindomain='1',\r\n\t\tallowadmindb='1',\r\n\t\tallowadminnote='1',\r\n\t\tallowadmincache='1',\r\n\t\tallowadminlog='1'");
    uc_write_config($config, ROOT_PATH . './uc_server/data/config.inc.php', $password);
    //vot	@unlink(ROOT_PATH.'./uc_server/install/index.php');
    @unlink(ROOT_PATH . './uc_server/data/cache/settings.php');
    @touch(ROOT_PATH . './uc_server/data/upgrade.lock');
    @touch(ROOT_PATH . './uc_server/data/install.lock');
    dir_clear(ROOT_PATH . './uc_server/data/cache');
    dir_clear(ROOT_PATH . './uc_server/data/view');
}
Esempio n. 20
0
        if (version_compare($prev_version, '2.0', '>=') && version_compare($prev_version, '2.1', '<')) {
            $prev_version = '2.0';
        } elseif (version_compare($prev_version, '2.1', '>=') && version_compare($prev_version, '2.2', '<')) {
            $prev_version = '2.1';
        }
    }
    if (version_compare($current_version, $prev_version, '<')) {
        echo '<div class="msg fail">' . lang('could_not_degrade') . '</div>';
        exit;
    }
    if ($prev_version == '' || version_compare($prev_version, '2.0', '<')) {
        echo '<div class="msg fail">' . lang('too_old_to_update') . '</div>';
        exit;
    }
    $script_file = ROOTDIR . 'install/upgrade_' . $prev_version . '.php';
    if (file_exists($script_file)) {
        require_once $script_file;
    }
    $setting_mdl->set_conf('system.version', MPIC_VERSION);
    $setting_mdl->set_conf('update.return', 'lastest');
    //清除缓存
    //Todo 需要统一清除缓存的功能,使其兼容memcache等
    dir_clear(ROOTDIR . 'cache/data');
    dir_clear(ROOTDIR . 'cache/templates');
    dir_clear(ROOTDIR . 'cache/tmp');
    echo '<div class="msg succ">' . lang('upgrade_success') . ' <a href="' . site_link('default', 'index') . '">' . lang('click_to_jump') . '</a></div>';
}
?>
</div>
</body>
</html>
Esempio n. 21
0
            $config = preg_replace("/(.+)\\?\\>\$/", "\\1", trim($config));
            $config .= "define('UC_FOUNDERSALT', '{$ucsalt}');\r\n";
        }
        $fp = fopen(UC_CONFIG, 'w');
        fwrite($fp, $config);
        fclose($fp);
        header("Location:upgrade_1.0.0Beta_1.0.0.php?action=db");
    }
} elseif ($action == 'db') {
    showheader();
    $db = new db();
    $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
    runquery($sql);
    @mkdir(UC_ROOT . './data/tmp', 0777);
    @mkdir(UC_ROOT . './data/backup', 0777);
    dir_clear(UC_ROOT . './data/view');
    echo "The upgrade is complete. Please delete the upgrade_1.0.0Beta_1.0.0.php";
    showfooter();
}
function dir_clear($dir)
{
    $directory = dir($dir);
    while ($entry = $directory->read()) {
        $filename = $dir . '/' . $entry;
        if (is_file($filename)) {
            @unlink($filename);
        }
    }
    @touch($dir . '/index.htm');
    $directory->close();
}
Esempio n. 22
0
    }
    foreach ($optionlist as $optionid => $option) {
        $db->query("INSERT INTO {$tablepre}typeoptions VALUES ('{$optionid}', '{$option['classid']}', '{$option['displayorder']}', '{$option['title']}', '', '{$option['identifier']}', '{$option['type']}', '" . addslashes(serialize($option['rules'])) . "');");
    }
    $db->query("ALTER TABLE {$tablepre}typeoptions AUTO_INCREMENT=3001");
    $yearmonth = date('Ym_', time());
    loginit($yearmonth . 'ratelog');
    loginit($yearmonth . 'illegallog');
    loginit($yearmonth . 'modslog');
    loginit($yearmonth . 'cplog');
    loginit($yearmonth . 'errorlog');
    loginit($yearmonth . 'banlog');
    dir_clear(DISCUZ_ROOT . './forumdata/templates');
    dir_clear(DISCUZ_ROOT . './forumdata/cache');
    dir_clear(DISCUZ_ROOT . './forumdata/threadcaches');
    dir_clear(DISCUZ_ROOT . './uc_client/data/cache');
    dir_clear(DISCUZ_ROOT . './uc_server/data/cache');
    dir_clear(DISCUZ_ROOT . './uc_server/data/view');
    $step++;
    redirect("{$self}?step={$step}");
} elseif ($step == 4) {
    @touch($lockfile);
    show_tips('install_finished');
    echo '<div class="btnbox margintop marginbot"><input type="button" value="' . lang('install_succeed') . '" onclick="window.location=\'../index.php\'; return false"></div>
		<img width="0" height="0" src="../index.php" style="display:none;" />
		<img width="0" height="0" src="../uc_server/index.php" style="display:none;" />
		';
    show_footer();
} else {
    redirect('index.php');
}