function IntegraterApp()
 {
     parent::__construct();
     Lang::load(version_data('common.lang.php'));
     if (file_exists(LOCK_FILE)) {
         $this->show_message('integrate_locked');
         return;
     }
 }
Exemplo n.º 2
0
 function InstallerApp()
 {
     $this->_define_lang();
     Lang::load(version_data('common.lang.php'));
     if (file_exists(LOCK_FILE)) {
         header('Content-Type:text/html;charset=' . CHARSET);
         die(Lang::get('install_locked'));
     }
     parent::__construct();
 }
Exemplo n.º 3
0
 /**
  *    完成安装
  *
  *    @author    Garbin
  *    @return    void
  */
 function install_done()
 {
     extract($_POST);
     /* 无实际用途 */
     $_code = rand(10000, 99999);
     setcookie('__INTECODE__', $_code, 0, '/');
     /* 连接数据库 */
     $con = mysql_connect($db_host . ':' . $db_port, $db_user, $db_pass);
     if (!$con) {
         show_process(r(get_lang('connect_db'), false), 'parent.show_warning("' . get_lang('connect_db_error') . '")');
         return false;
     }
     show_process(r(get_lang('connect_db'), true));
     $version = mysql_get_server_info();
     $charset = str_replace('-', '', CHARSET);
     if ($version > '4.1') {
         if ($charset != 'latin1') {
             mysql_query("SET character_set_connection={$charset}, character_set_results={$charset}, character_set_client=binary", $con);
         }
         if ($version > '5.0.1') {
             mysql_query("SET sql_mode=''", $con);
         }
     }
     /* 选择数据库 */
     $selected_db = mysql_select_db($db_name, $con);
     if (!$selected_db) {
         show_process(r(get_lang('selecte_db'), false), 'parent.show_warning("' . get_lang('selecte_db_error') . '");');
         return false;
     }
     /* 建立数据库结构 */
     show_process(r(get_lang('start_setup_db'), true));
     $sqls = get_sql(version_data('structure.sql'));
     foreach ($sqls as $sql) {
         $sql = replace_prefix('ecm_', $db_prefix, $sql);
         if (substr($sql, 0, 12) == 'CREATE TABLE') {
             $name = preg_replace("/CREATE TABLE `{$db_prefix}([a-z0-9_]+)` .*/is", "\\1", $sql);
             mysql_query(create_table($sql));
             show_process(r(sprintf(get_lang('create_table'), $name), true, 1));
         } else {
             mysql_query($sql, $con);
         }
     }
     /* 安装初始数据 TODO 暂时不完整 */
     $sqls = get_sql(version_data('initdata.sql'));
     //$password = md5($admin_pass);//不加密密码
     $password = md5($admin_name . md5($admin_pass));
     // $sqls[] = "INSERT INTO `ecm_member`(user_name, email, password, reg_time) VALUES('{$admin_name}', '{$admin_email}', '{$password}', " . gmtime() . ")";
     $sqls[] = "INSERT INTO `ecm_user` (`username`, `password`, `grade`, `name`, `gender`, `mobile`, `email`, `url`, `remark`) VALUES\r\n('{$admin_name}', '{$password}', 1, NULL, NULL, NULL, '{$admin_email}', NULL, NULL)";
     foreach ($sqls as $sql) {
         $rzt = mysql_query(replace_prefix('ecm_', $db_prefix, $sql), $con);
         if (!$rzt) {
             show_process(r(get_lang('install_initdata'), false), 'parent.show_warning("' . mysql_error() . '");');
             return false;
         }
     }
     if (mysql_errno()) {
         echo mysql_error();
     }
     show_process(r(get_lang('install_initdata'), true));
     /* 安装初始配置 */
     $db_config = "mysql://{$db_user}:{$db_pass}@{$db_host}:{$db_port}/{$db_name}";
     //$ecm_key   = get_ecm_key();
     //$mall_site_id = product_id();
     /*        save_config_file(array(
                 'SITE_URL'  => $site_url,
                 'DB_CONFIG'  => $db_config,
                 'DB_PREFIX'  => $db_prefix,
                 'LANG'  => LANG,
                 'COOKIE_DOMAIN'  => '',
                 'COOKIE_PATH'  => '/',
                 'ECM_KEY'  => $ecm_key,
                 'MALL_SITE_ID'  => $mall_site_id,
                 'ENABLED_GZIP'  => 0,
                 'DEBUG_MODE'  => 0,
                 'CACHE_SERVER'  => 'default',
                 'MEMBER_TYPE'  => 'default',
                 'ENABLED_SUBDOMAIN' => 0,
                 'SUBDOMAIN_SUFFIX'  => '',
             ));*/
     save_config_file(array('autoload_enable' => true, 'autoload_path' => '@modules', 'framework_function' => 'front::main', 'framework_enable' => true, 'framework_module' => '[go]!(self)|welcome', 'framework_action' => '[do]|index', 'template_path' => '@templates/', 'connect_server' => $db_host, 'connect_username' => $db_user, 'connect_password' => $db_pass, 'connect_dbname' => $db_name, 'connect_port' => $db_port, 'connect_charset' => 'UTF8', 'prefix_search' => $db_prefix, 'prefix_replace' => $db_prefix, 'extension_path' => '@includes', 'extension_enable' => 'myfunction', 'debug_enable' => false, 'sql_format' => false, 'debug_file' => '', 'front_action' => '', 'front_online' => 'online', 'front_class' => 'user', 'front_table' => $db_prefix . 'user', 'front_fuzzy' => '', 'front_username' => '', 'front_password' => '', 'front_redirect' => 'index.php'));
     /* 写入系统信息 */
     // save_system_info(array(
     //     'version'   => VERSION,
     //     'release'   => RELEASE,
     // ));
     show_process(r(get_lang('setup_config'), true));
     /* 锁定安装程序 */
     touch(LOCK_FILE);
     show_process(r(get_lang('lock_install'), true));
     /* 安装完成 */
     show_process(r(get_lang('install_done'), true), 'parent.install_successed();');
     return false;
 }
Exemplo n.º 4
0
 /**
  *    默认的数据库更改
  *
  *    @author    Garbin
  *    @return    void
  */
 function _dbchange()
 {
     $common_db_change = APP_ROOT . '/data/dbchange.sql';
     $version_db_change = version_data('dbchange.sql');
     if (is_file($common_db_change)) {
         if (!$this->_run_sql($common_db_change)) {
             return false;
         }
     }
     if (is_file($version_db_change)) {
         if (!$this->_run_sql($version_db_change)) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 5
0
 /**
  *    完成安装
  *
  *    @author    Garbin
  *    @return    void
  */
 function install_done()
 {
     extract($_POST);
     /* 无实际用途 */
     $_code = rand(10000, 99999);
     setcookie('__INTECODE__', $_code, 0, '/');
     /* 连接数据库 */
     $con = mysql_connect($db_host . ':' . $db_port, $db_user, $db_pass);
     if (!$con) {
         show_process(r(Lang::get('connect_db'), false), 'parent.show_warning("' . Lang::get('connect_db_error') . '")');
         return false;
     }
     show_process(r(Lang::get('connect_db'), true));
     $version = mysql_get_server_info();
     $charset = str_replace('-', '', CHARSET);
     if ($version > '4.1') {
         if ($charset != 'latin1') {
             mysql_query("SET character_set_connection={$charset}, character_set_results={$charset}, character_set_client=binary", $con);
         }
         if ($version > '5.0.1') {
             mysql_query("SET sql_mode=''", $con);
         }
     }
     /* 选择数据库 */
     $selected_db = mysql_select_db($db_name, $con);
     if (!$selected_db) {
         show_process(r(Lang::get('selecte_db'), false), 'parent.show_warning("' . Lang::get('selecte_db_error') . '");');
         return false;
     }
     /* 建立数据库结构 */
     show_process(r(Lang::get('start_setup_db'), true));
     $sqls = get_sql(version_data('structure.sql'));
     foreach ($sqls as $sql) {
         $sql = replace_prefix('ecm_', $db_prefix, $sql);
         if (substr($sql, 0, 12) == 'CREATE TABLE') {
             $name = preg_replace("/CREATE TABLE `{$db_prefix}([a-z0-9_]+)` .*/is", "\\1", $sql);
             mysql_query(create_table($sql));
             show_process(r(sprintf(Lang::get('create_table'), $name), true, 1));
         } else {
             mysql_query($sql, $con);
         }
     }
     /* 安装初始数据 TODO 暂时不完整 */
     $sqls = get_sql(version_data('initdata.sql'));
     $password = md5($admin_pass);
     $sqls[] = "INSERT INTO `ecm_member`(user_name, email, password, reg_time) VALUES('{$admin_name}', '{$admin_email}', '{$password}', " . gmtime() . ")";
     foreach ($sqls as $sql) {
         $rzt = mysql_query(replace_prefix('ecm_', $db_prefix, $sql), $con);
         if (!$rzt) {
             show_process(r(Lang::get('install_initdata'), false), 'parent.show_warning("' . mysql_error() . '");');
             return false;
         }
     }
     if (mysql_errno()) {
         echo mysql_error();
     }
     show_process(r(Lang::get('install_initdata'), true));
     /* 安装初始配置 */
     $db_config = "mysql://{$db_user}:{$db_pass}@{$db_host}:{$db_port}/{$db_name}";
     $ecm_key = get_ecm_key();
     $mall_site_id = product_id();
     save_config_file(array('SITE_URL' => $site_url, 'DB_CONFIG' => $db_config, 'DB_PREFIX' => $db_prefix, 'LANG' => LANG, 'COOKIE_DOMAIN' => '', 'COOKIE_PATH' => '/', 'ECM_KEY' => $ecm_key, 'MALL_SITE_ID' => $mall_site_id, 'ENABLED_GZIP' => 0, 'DEBUG_MODE' => 0, 'CACHE_SERVER' => 'default', 'MEMBER_TYPE' => 'default', 'ENABLED_SUBDOMAIN' => 0, 'SUBDOMAIN_SUFFIX' => ''));
     /* 写入系统信息 */
     save_system_info(array('version' => VERSION, 'release' => RELEASE));
     show_process(r(Lang::get('setup_config'), true));
     /* 锁定安装程序 */
     touch(LOCK_FILE);
     show_process(r(Lang::get('lock_install'), true));
     if (is_file(ROOT_PATH . '/integrate/index.php')) {
         /* 跳至整合程序 */
         show_process(r(Lang::get('install_done'), true), 'parent.goon_install("' . $site_url . '/integrate/index.php", "' . $_code . '");');
     } else {
         /* 安装完成 */
         show_process(r(Lang::get('install_done'), true), 'parent.install_successed();');
         return false;
     }
 }
Exemplo n.º 6
0
 /**
  *    选择需要整合的应用
  *
  *    @author    Garbin
  *    @return    array
  */
 function index()
 {
     Lang::load(version_data('common.lang.php'));
     $this->display('index.html');
 }