function __construct() { if (ADMIN_DIR!=config::get('admin_dir')) { config::modify(array('admin_dir'=>ADMIN_DIR)); front::flash('后台目录更改成功!'); } front::$rewrite=false; parent::__construct(); $servip = gethostbyname($_SERVER['SERVER_NAME']); //if($this instanceof file_admin && in_array(front::get('act'), array('updialog','upfile','upfilesave','netfile','netfilesave','swfsave'))) return; if($servip==front::ip()&&front::get('ishtml')==1) return; $this->check_admin(); }
private function install() { set_time_limit(0); if ($this->instalsqltype) { $sqlquery = file_get_contents(ROOT . '/install/data/install_testdb.sql'); } else { $sqlquery = file_get_contents(ROOT . '/install/data/install.sql'); } $smods = ''; if (!empty($this->smodarr)) { $smods = implode(',', $this->smodarr); foreach ($this->smodarr as $val) { $modsqlquery.=file_get_contents(ROOT . '/install/data/install_' . $val . '.sql'); if (!$modsqlquery) exit('模块数据库文件不存在!'); config::modifymod(front::$post, $val); config::modifymod(array('url' => front::post('site_url') . $val), $val); config::modifymod(array('username' => front::post('user')), $val); config::modifymod(array('host' => front::post('hostname')), $val); } } config::modify(array('mods' => $smods)); if (!$sqlquery) exit('数据库文件不存在!'); $sqlquery = $sqlquery . $modsqlquery; $sqlquery = str_replace('cmseasy_', config::get('database', 'prefix'), $sqlquery); $sqlquery = str_replace('\'admin\'', '\'' . front::post('admin_username') . '\'', $sqlquery); $sqlquery = str_replace('\'21232f297a57a5a743894a0e4a801fc3\'', '\'' . md5(front::post('admin_password')) . '\'', $sqlquery); $mysql = new user; $sqlquery = str_replace("\r", "", $sqlquery); $sqls = preg_split("/;[ \t]{0,}\n/", $sqlquery); $nerrCode = ""; $i = 0; foreach ($sqls as $q) { $q = trim($q); if ($q == "") { continue; } if ($mysql->query($q)) { usleep(100); $i++; } else { $nerrCode .= "执行: <font color='blue'>$q</font> 出错!</font><br>"; } } $user = new user(); $this->gather(); if (is_array($user->getrow("username='******'admin_username') . "'"))) $this->view->install = true; }
<?php if (!defined('ROOT')) exit('Can\'t Access !'); class config_admin extends admin { function init() {