function DoSave() { $dedecms = $this->Post['dedecms']; $dedecms_config_default = $dedecms_config = jconf::get('dedecms'); $dedecms_config['enable'] = $dedecms['enable'] ? 1 : 0; $dedecms_config['db_host'] = $dedecms['db_host']; $dedecms_config['db_name'] = $dedecms['db_name']; $dedecms_config['db_user'] = $dedecms['db_user']; $dedecms_config['db_pass'] = $dedecms['db_pass']; $dedecms_config['db_port'] = $dedecms['db_port']; $dedecms_config['db_pre'] = $dedecms['db_pre']; $dedecms_config['charset'] = $dedecms['charset']; $dedecms_config['db_url'] = $dedecms['db_url']; if ($dedecms_config['enable']) { include_once ROOT_PATH . './api/uc_api_db.php'; $dede_db = new JSG_UC_API_DB(); @$dede_db->connect($dedecms['db_host'], $dedecms['db_user'], $dedecms['db_pass'], $dedecms['db_name'], $dedecms['charset'], 1, $dedecms['db_pre']); if (!$dede_db->link || !$dede_db->query("SHOW COLUMNS FROM {$dedecms['db_pre']}member", 'SILENT')) { $this->Messager("无法连接DedeCMS数据库,请检查您填写的DedeCMS数据库配置信息是否正确."); exit; } } if ($dedecms_config_default != $dedecms_config) { jconf::set('dedecms', $dedecms_config); } if ($dedecms_config['enable'] != $this->Config['dedecms_enable']) { $config = array(); $config['dedecms_enable'] = $dedecms_config['enable']; jconf::update($config); } $this->Messager("修改成功"); }
function DoSave() { if (!is_file(ROOT_PATH . './api/pw_client/uc_client.php')) { $this->Messager('Phpwind的客户端文件 <b>' . ROOT_PATH . './api/pw_client/uc_client.php' . "</b> 不存在,请检查"); } if (!is_file(ROOT_PATH . 'pw_api.php')) { $this->Messager('Phpwind的api文件 <b>' . ROOT_PATH . 'pw_api.php' . "</b> 不存在,请检查"); } $phpwind = $this->Post['phpwind']; $phpwind_config_default = $phpwind_config = jconf::get('phpwind'); $phpwind_config['enable'] = $phpwind['enable'] ? 1 : 0; $phpwind_config['face'] = $phpwind['face'] ? 1 : 0; $phpwind_config['bbs'] = $phpwind['bbs'] ? 1 : 0; $phpwind_config['pw_db_host'] = $phpwind['pw_db_host']; $phpwind_config['pw_db_name'] = $phpwind['pw_db_name']; $phpwind_config['pw_db_user'] = $phpwind['pw_db_user']; $phpwind_config['pw_db_password'] = $phpwind['pw_db_password']; $phpwind_config['pw_ip'] = $phpwind['pw_ip']; $phpwind_config['pw_db_table_prefix'] = $phpwind['pw_db_table_prefix']; $phpwind_config['pw_db_charset'] = $phpwind['pw_db_charset']; $phpwind_config['pw_charset'] = $phpwind['pw_charset']; $phpwind_config['pw_pptkey'] = $phpwind['pw_pptkey']; $phpwind_config['pw_key'] = $phpwind['pw_key'] ? $phpwind['pw_key'] : ''; $phpwind_config['pw_api'] = $phpwind['pw_api']; $phpwind_config['pw_app_id'] = $phpwind['pw_app_id'] ? $phpwind['pw_app_id'] : 0; if ($phpwind_config['enable']) { include_once ROOT_PATH . './api/uc_api_db.php'; $pw_db = new JSG_UC_API_DB(); @$pw_db->connect($phpwind['pw_db_host'], $phpwind['pw_db_user'], $phpwind['pw_db_password'], $phpwind['pw_db_name'], $phpwind['pw_db_charset'], 1, $phpwind['pw_db_table_prefix']); if (!$pw_db->link || !$pw_db->query("SHOW COLUMNS FROM {$phpwind['pw_db_table_prefix']}members", 'SILENT')) { $this->Messager("无法连接PhpWind数据库,请检查您填写的PhpWind数据库配置信息是否正确."); exit; } } if ($phpwind_config_default != $phpwind_config) { jconf::set('phpwind', $phpwind_config); } if ($phpwind_config['enable'] != $this->Config['phpwind_enable'] || $phpwind_config['bbs'] != $this->Config['pwbbs_enable']) { $config = array(); $config['phpwind_enable'] = $phpwind_config['enable']; $config['pwbbs_enable'] = $phpwind_config['bbs']; if ($phpwind_config['enable'] == 1) { $config['ucenter_enable'] = 0; $config['dzbbs_enable'] = 0; } jconf::update($config); } $this->Messager("配置成功"); }
function DoSave() { $dzbbs = $this->Post['dzbbs']; $dzbbs_config_default = $dzbbs_config = jconf::get('dzbbs'); $dzbbs_config['enable'] = $dzbbs['enable'] ? 1 : 0; $dzbbs_config['db_host'] = $dzbbs['db_host']; $dzbbs_config['db_name'] = $dzbbs['db_name']; $dzbbs_config['db_user'] = $dzbbs['db_user']; $dzbbs_config['db_pass'] = $dzbbs['db_pass']; $dzbbs_config['db_port'] = $dzbbs['db_port']; $dzbbs_config['db_pre'] = $dzbbs['db_pre']; $dzbbs_config['charset'] = $dzbbs['charset']; $dzbbs_config['db_url'] = $dzbbs['db_url']; $dzbbs_config['dz_ver'] = $dzbbs['dz_ver']; if ($dzbbs_config['enable']) { $table_m = $dzbbs['dz_ver'] == 'dzx' ? $dzbbs['db_pre'] . 'common_member' : $dzbbs['db_pre'] . 'members'; include_once ROOT_PATH . './api/uc_api_db.php'; $dz_db = new JSG_UC_API_DB(); @$dz_db->connect($dzbbs['db_host'], $dzbbs['db_user'], $dzbbs['db_pass'], $dzbbs['db_name'], $dzbbs['charset'], 1, $dzbbs['db_pre']); if (!$dz_db->link || !$dz_db->query("SHOW COLUMNS FROM {$table_m}", 'SILENT')) { $this->Messager("无法连接Discuz数据库,请检查您填写的Discuz数据库配置信息是否正确."); exit; } } if ($dzbbs_config_default != $dzbbs_config) { jconf::set('dzbbs', $dzbbs_config); } if ($dzbbs_config['enable'] != $this->Config['dzbbs_enable']) { $config = array(); $config['dzbbs_enable'] = $dzbbs_config['enable']; if ($dzbbs_config['enable'] == 1) { $config['ucenter_enable'] = 1; $config['pwbbs_enable'] = 0; $config['phpwind_enable'] = 0; } jconf::update($config); } $this->Messager("修改成功"); }
function DoMerge() { $this->CheckAdminPrivs('ucenter'); $start = max(0,(int) $this->Get['start']); $limit = 500; $ucenter = ConfigHandler::get('ucenter'); if(!$ucenter['enable'] || !$this->Get['confirm'] || 'mysql' != $ucenter['uc_connect']) { $this->Messager("你的配置不正确,或者已经进行过用户数据整合了",null); } include_once(ROOT_PATH.'./api/uc_api_db.php'); $db = new JSG_UC_API_DB(); $db->connect($this->Config['db_host'],$this->Config['db_user'],$this->Config['db_pass'],$this->Config['db_name'],$this->Config['charset'],$this->Config['db_persist'],$this->Config['db_table_prefix']); $query = $db->query("select * from ".TABLE_PREFIX."system_members where ucuid=0 limit {$limit}"); if($db->num_rows($query) < 1) { $this->Messager("用户数据合并成功",null); } $uc_db = new JSG_UC_API_DB(); $uc_db->connect($ucenter['uc_db_host'],$ucenter['uc_db_user'],$ucenter['uc_db_password'],$ucenter['uc_db_name'],$ucenter['uc_db_charset'],1,$ucenter['uc_db_table_prefix']); while ($data = $db->fetch_array($query)) { $ucuid = -1; $salt = rand(100000, 999999); $password = md5($data['password'].$salt); $data['username'] = addslashes($data['username']); $uc_user = $uc_db->fetch_first("SELECT * FROM {$ucenter['uc_db_table_prefix']}members WHERE username='******'"); if(!$uc_user) { $uc_db->query("INSERT LOW_PRIORITY INTO {$ucenter['uc_db_table_prefix']}members SET username='******', password='******',email='$data[email]', regip='$data[regip]', regdate='$data[regdate]', salt='$salt'", 'SILENT'); $ucuid = $uc_db->insert_id(); $uc_db->query("INSERT LOW_PRIORITY INTO {$ucenter['uc_db_table_prefix']}memberfields SET uid='$ucuid'",'SILENT'); } else { if($uc_user['password'] == md5($data['password'].$uc_user['salt'])) { $ucuid = $uc_user['uid']; } else { $uc_db->query("REPLACE INTO {$ucenter['uc_db_table_prefix']}mergemembers SET appid='".UC_APPID."', username='******'", 'SILENT'); } } $db->query("update ".TABLE_PREFIX."system_members set ucuid={$ucuid} where uid={$data['uid']}"); } $next = ($start + $limit); $this->Messager("[{$start}-{$next}]正在进行用户数据的合并中,请稍候……",'admin.php?mod=ucenter&code=merge&confirm=1&start='.$next); }
function DoMerge() { $start = max(0, (int) $this->Get['start']); $limit = 500; $ucenter = jconf::get('ucenter'); if (!$ucenter['enable'] || !$this->Get['confirm'] || 'mysql' != $ucenter['uc_connect']) { $this->Messager("你的配置不正确,或者已经进行过用户数据整合了", 'admin.php?mod=ucenter&code=ucenter'); } include_once ROOT_PATH . './api/uc_api_db.php'; $db = new JSG_UC_API_DB(); $db->connect($this->Config['db_host'], $this->Config['db_user'], $this->Config['db_pass'], $this->Config['db_name'], $this->Config['charset'], $this->Config['db_persist'], $this->Config['db_table_prefix']); if (!$start) { if (get_param('new_merge')) { $db->query("update " . TABLE_PREFIX . "members set `ucuid`=0 where `ucuid`!=0"); } else { $db->query("update " . TABLE_PREFIX . "members set `ucuid`=0 where `ucuid`<0"); } } $query = $db->query("select * from " . TABLE_PREFIX . "members where ucuid=0 limit {$limit}"); if ($db->num_rows($query) < 1) { $this->Messager("用户数据合并成功", 'admin.php?mod=ucenter&code=ucenter'); } $uc_db = new JSG_UC_API_DB(); $uc_db->connect($ucenter['uc_db_host'], $ucenter['uc_db_user'], $ucenter['uc_db_password'], $ucenter['uc_db_name'], $ucenter['uc_db_charset'], 0, $ucenter['uc_db_table_prefix']); while (false != ($data = $db->fetch_array($query))) { $ucuid = -1; $db->query("update `" . TABLE_PREFIX . "members` set `ucuid`='{$ucuid}' where `uid`='{$data['uid']}'"); if ($data['salt']) { $salt = $data['salt']; $password = $data['password']; } else { $salt = rand(100000, 999999); $password = md5($data['password'] . $salt); } $data['username'] = addslashes($data['username']); $data['nickname'] = addslashes($data['nickname']); $uc_user = $uc_db->fetch_first("SELECT * FROM {$ucenter['uc_db_table_prefix']}members WHERE username='******'nickname']}'"); if (!$uc_user) { $uc_db->query("INSERT LOW_PRIORITY INTO {$ucenter['uc_db_table_prefix']}members SET username='******'nickname']}', `password`='{$password}',email='{$data['email']}', regip='{$data['regip']}', regdate='{$data['regdate']}', salt='{$salt}'", 'SILENT'); $ucuid = $uc_db->insert_id(); $uc_db->query("INSERT LOW_PRIORITY INTO {$ucenter['uc_db_table_prefix']}memberfields SET uid='{$ucuid}'", 'SILENT'); } else { $ucuid = $uc_user['uid']; } $db->query("update `" . TABLE_PREFIX . "members` set `ucuid`='{$ucuid}' where `uid`='{$data['uid']}'"); } $db->close(); $uc_db->close(); $next = $start + $limit; $this->Messager("[{$start}-{$next}]正在进行用户数据的合并中,请稍候……", 'admin.php?mod=ucenter&code=merge&confirm=1&start=' . $next); }