} } elseif ($module == 'phpsso') { //安装phpsso $ssourl = $siteurl . 'phpsso_server/'; $cookie_pre = random(5, 'abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ') . '_'; $auth_key = random(20, '1294567890abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ'); $phpsso_auth_key = random(32, '1294567890abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ'); $sso_tablepre = $tablepre . 'sso_'; $sys_sso_config = array('phpsso' => '1', 'phpsso_appid' => '1', 'phpsso_api_url' => substr($ssourl, 0, -1), 'phpsso_auth_key' => $phpsso_auth_key); $sso_config = array('cookie_pre' => $cookie_pre, 'auth_key' => $auth_key, 'web_path' => $rootpath . 'phpsso_server/', 'errorlog' => '0', 'app_path' => $ssourl, 'js_path' => $ssourl . 'statics/js/', 'css_path' => $ssourl . 'statics/css/', 'img_path' => $ssourl . 'statics/images/'); $sso_db_config = array('hostname' => $dbhost, 'username' => $dbuser, 'password' => $dbpw, 'database' => $dbname, 'tablepre' => $sso_tablepre, 'pconnect' => $pconnect, 'charset' => $dbcharset); set_config($sys_sso_config, 'system'); //更改cms中sso配置 set_sso_config($sso_config, 'system'); //写入sso中配置信息 set_sso_config($sso_db_config, 'database'); //写入sso数据库配置信息 $lnk = mysql_connect($dbhost, $dbuser, $dbpw) or die('Not connected : ' . mysql_error()); $version = mysql_get_server_info(); if ($version > '4.1' && $dbcharset) { mysql_query("SET NAMES '{$dbcharset}'"); } if ($version > '5.0') { mysql_query("SET sql_mode=''"); } mysql_select_db($dbname); $dbfile = 'phpsso_db.sql'; if (file_exists(PHPCMS_PATH . "install/main/" . $dbfile)) { $sql = file_get_contents(PHPCMS_PATH . "install/main/" . $dbfile); _sql_execute($sql, $sso_tablepre, 'ps_'); }
'app_path'=>$ssourl, 'js_path'=>$ssourl.'statics/js/', 'css_path'=>$ssourl.'statics/css/', 'img_path'=>$ssourl.'statics/images/', ); $sso_db_config = array('hostname'=>$dbhost, 'username'=>$dbuser, 'password'=>$dbpw, 'database'=>$dbname, 'tablepre'=>$sso_tablepre, 'pconnect'=>$pconnect, 'charset'=>$dbcharset, ); set_config($sys_sso_config,'system'); //更改cms中sso配置 set_sso_config($sso_config,'system'); //写入sso中配置信息 set_sso_config($sso_db_config,'database'); //写入sso数据库配置信息 $lnk = mysql_connect($dbhost, $dbuser, $dbpw) or die ('Not connected : ' . mysql_error()); $version = mysql_get_server_info(); if($version > '4.1' && $dbcharset) { mysql_query("SET NAMES '$dbcharset'"); } if($version > '5.0') { mysql_query("SET sql_mode=''"); } mysql_select_db($dbname); $dbfile = 'phpsso_db.sql'; if(file_exists(PHPCMS_PATH."install/main/".$dbfile)) { $sql = file_get_contents(PHPCMS_PATH."install/main/".$dbfile); _sql_execute($sql,$sso_tablepre,'ps_'); }