本文整理汇总了PHP中save_config_file函数的典型用法代码示例。如果您正苦于以下问题:PHP save_config_file函数的具体用法?PHP save_config_file怎么用?PHP save_config_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_config_file函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_msg
}
show_msg(lang('update', 'domains_completed'), "{$theurl}?step=data&op={$nextop}");
} else {
$deletevar = array('app', 'home');
//Need to delete Config items
$default_config = $_config = array();
$default_configfile = DISCUZ_ROOT . './config/config_global_default.php';
if (!file_exists($default_configfile)) {
exit(lang('update', 'config_default_lost'));
} else {
include $default_configfile;
$default_config = $_config;
}
$configfile = DISCUZ_ROOT . './config/config_global.php';
include $configfile;
if (save_config_file($configfile, $_config, $default_config, $deletevar)) {
show_msg(lang('update', 'data_processing_completed'), "{$theurl}?step=delete");
} else {
show_msg(lang('update', 'config_not_writable') . '<br /><br /><a href="' . $theurl . '?step=delete">' . lang('update', 'config_continue') . '</a>');
}
}
} elseif ($_GET['step'] == 'delete') {
if (!$devmode) {
show_msg(lang('update', 'data_delete_next'), "{$theurl}?step=style");
}
$oldtables = array();
$query = DB::query("SHOW TABLES LIKE '{$config['tablepre']}%'");
while ($value = DB::fetch($query)) {
$values = array_values($value);
$oldtables[] = $values[0];
}
示例2: array
$error = array();
if (submitcheck()) {
$newconfig = getgpc('newconfig');
if (is_array($newconfig)) {
$checkarray = $setting['config']['ucenter'] ? array('source', 'target', 'ucenter') : array('source', 'target');
foreach ($checkarray as $key) {
if (!empty($newconfig[$key]['dbhost'])) {
$check = mysql_connect_test($newconfig[$key], $key);
if ($check < 0) {
$error[$key] = lang('mysql_connect_error_' . abs($check));
}
} else {
$error[$key] = lang('mysql_config_error');
}
}
save_config_file($configfile, $newconfig, $config_default);
if (empty($error)) {
$db_target = new db_mysql($newconfig['target']);
$db_target->connect();
delete_process('all');
showmessage('config_success', 'index.php?a=select&source=' . $source);
}
}
}
showtips('如果无法显示设置项目,请删除文件 data/config.inc.php');
$config = loadconfig('config.inc.php');
if (empty($config)) {
$config = $config_default;
}
show_form_header();
show_config_input('source', $config['source'], $error['source']);
示例3: show_msg
}
} else {
show_msg('admininfo_invalid', '', 0);
}
$uid = DZUCFULL ? 1 : $adminuser['uid'];
$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);
$_config['db'][1]['dbhost'] = $dbhost;
$_config['db'][1]['dbname'] = $dbname;
$_config['db'][1]['dbpw'] = $dbpw;
$_config['db'][1]['dbuser'] = $dbuser;
$_config['db'][1]['tablepre'] = $tablepre;
$_config['admincp']['founder'] = (string) $uid;
$_config['security']['authkey'] = $authkey;
$_config['cookie']['cookiepre'] = random(4) . '_';
$_config['memory']['prefix'] = random(6) . '_';
save_config_file(ROOT_PATH . CONFIG, $_config, $default_config);
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, DBCHARSET);
if (!VIEW_OFF) {
show_header();
show_install();
}
if (DZUCFULL) {
install_uc_server();
}
$sql = file_get_contents($sqlfile);
$sql = str_replace("\r\n", "\n", $sql);
runquery($sql);
runquery($extrasql);
$sql = file_get_contents(ROOT_PATH . './install/data/install_data.sql');
$sql = str_replace("\r\n", "\n", $sql);
示例4: install_done
/**
* 完成安装
*
* @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;
}
示例5: array
$uc_dbtablepre = UC_DBTABLEPRE;
$ucconfig = array($newapp_authkey, UC_APPID, UC_DBHOST, UC_DBNAME, UC_DBUSER, UC_DBPW, UC_DBCHARSET, $uc_dbtablepre, UC_CHARSET, UC_API, UC_IP);
$ucconfig = @implode('|', $ucconfig);
save_uc_config($ucconfig, DISCUZ_ROOT . './config/config_ucenter.php');
$ucdb->query("UPDATE {$apptablename} SET authkey = '{$newapp_appkey}' WHERE appid = " . UC_APPID);
//note
} else {
$cpmessage .= $toolslang['nlocaluc'];
}
// $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);
} elseif ($value == 'config_authkey') {
$default_config = $_config;
$authkey = substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $dbhost . $dbuser . $dbpw . $dbname . $username . $password . $pconnect . substr($timestamp, 0, 8)), 8, 6) . random(10);
$_config['security']['authkey'] = $authkey;
$cpmessage .= $toolslang['resetauthkey'];
save_config_file('./config/config_global.php', $_config, $default_config);
} elseif ($value == 'setting_authkey') {
$authkey = substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $dbhost . $dbuser . $dbpw . $dbname . $username . $password . $pconnect . substr($timestamp, 0, 8)), 8, 6) . random(10);
DB::update('common_setting', array('svalue' => $authkey), "skey = 'authkey'");
} elseif ($value == 'my_sitekey' && $xver >= 2) {
require_once DISCUZ_ROOT . '/api/manyou/Manyou.php';
$cloudClient = new Discuz_Cloud_Client();
$res = $cloudClient->resetKey();
if (!$res) {
$cpmessage .= $toolslang['mykeyerror'];
} else {
$sId = $res['sId'];
$sKey = $res['sKey'];
DB::query("REPLACE INTO " . DB::table('common_setting') . " (`skey`, `svalue`)\n \t\t\t\t\t\tVALUES ('my_siteid', '{$sId}'), ('my_sitekey', '{$sKey}'), ('cloud_status', '1')");
}
}
示例6: saveVersion
function saveVersion($version)
{
global $_config;
if (!$_config) {
return;
}
$_config['version'] = $version;
save_config_file();
}
示例7: mysql_close
}
mysql_close($link);
}
if (strpos($dbinfo['tablepre'], '.') !== false) {
show_msg('数据表前缀为空,或者格式错误,请检查', $tablepre);
}
if ($admininfo['username'] && $admininfo['password'] && $admininfo['email'] && $admininfo['password'] == $admininfo['password2']) {
if (StrLenW2($admininfo['username']) > 12 || StrLenW2($admininfo['username']) < 3 || !$admininfo['username']) {
show_msg('非法用户名,用户名长度不应当超过 12 个英文字符,一般是中文,字母或者数字', $admininfo['username']);
} elseif (!strstr($admininfo['email'], '@') || $admininfo['email'] != stripslashes($admininfo['email']) || $admininfo['email'] != htmlspecialchars($admininfo['email'])) {
show_msg('Email 地址错误,此邮件地址已经被使用或者格式无效,请更换为其他地址', $admininfo['email']);
}
} else {
show_msg('管理员信息不完整,请检查管理员账号,密码,邮箱', '');
}
save_config_file($dbinfo, QCS_ROOT . './Conf/config.inc.php');
save_uc_config_file($dbinfo, QCS_ROOT . './Conf/uc_config.inc.php');
touch($lockfile);
$db = new dbstuff();
$db->connect($dbinfo['dbhost'], $dbinfo['dbuser'], $dbinfo['dbpw'], $dbinfo['dbname'], 0, true);
@mysql_query("set names utf8");
$tablepre = $dbinfo['tablepre'];
$sql = file_get_contents(QCS_ROOT . './install/include/data.sql');
$sql = str_replace("\r\n", "\n", $sql);
show_header();
show_install();
runquery($sql);
$auth_code = generate_key();
$invitecode = uniqid() . rand(1000, 9999);
$regtime = time();
$pwd = md5(strrev(md5($admininfo['password'])) . base64_encode($admininfo['password']));
示例8: install_done
/**
* 完成安装
*
* @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;
}
}
示例9: foreach
$db->query($sql);
}
//更新图片所属的分类
$album_mdl =& loader::model('album');
$photo_mdl =& loader::model('photo');
$albums = $album_mdl->get_all();
if ($albums) {
foreach ($albums as $album) {
$photo_mdl->update_by_aid($album['id'], array('cate_id' => $album['cate_id']));
}
}
//setting新增值
$setting_mdl->set_conf('system.enable_comment_captcha', true);
$setting_mdl->set_conf('system.enable_login_captcha', false);
$setting_mdl->set_conf('system.comment_audit', 0);
$setting_mdl->set_conf('upload.enable_cut_big_pic', false);
$setting_mdl->set_conf('upload.max_width', 1600);
$setting_mdl->set_conf('upload.max_height', 1200);
$setting_mdl->set_conf('upload.enable_thumb_cut', false);
$setting_mdl->set_conf('upload.thumb_width', 180);
$setting_mdl->set_conf('upload.thumb_height', 180);
$setting_mdl->set_conf('upload.use_old_imgname', false);
$setting_mdl->set_conf('display.album_pageset', 12);
$setting_mdl->set_conf('display.photo_pageset', 12);
$setting_mdl->set_conf('display.album_sort_default', 'ct_desc');
$setting_mdl->set_conf('display.photo_sort_default', 'tu_desc');
$config =& loader::config();
$default_config =& loader::config('config.default');
$default_config['img_path_key'] = random(10);
save_config_file(ROOTDIR . 'conf/config.php', $config, $default_config);
//require_once(ROOTDIR.'install/upgrade_2.2.php');
示例10: show_install
show_install();
$sql = file_get_contents($sqlfile);
$sql = str_replace("\r\n", "\n", $sql);
runquery($sql);
} elseif ($dbadapter == 'sqlite') {
$step = $step + 1;
show_header();
show_install();
$tablepre = 'meu_';
$CONFIG['database']['default']['adapter'] = 'sqlite';
$CONFIG['database']['default']['dbpath'] = $dst_dbfile;
$CONFIG['database']['default']['pre'] = $tablepre;
$CONFIG['cookie_name'] = 'MPIC_' . random(4);
$CONFIG['cookie_auth_key'] = random(12);
$CONFIG['img_engine'] = class_exists('imagick') ? 'imagick' : 'gd';
save_config_file($confile, $CONFIG, $default_config);
if (file_exists(ROOTDIR . $dst_dbfile)) {
@unlink(ROOTDIR . $dst_dbfile);
}
@touch(ROOTDIR . $dst_dbfile);
$db =& loader::database();
$sql = file_get_contents($sqlite_sqlfile);
$sql = str_replace("\r\n", "\n", $sql);
runquery($sql);
}
$datasql = file_get_contents($datasqlfile);
runquery($datasql);
$sql = $db->insert('#@nav', array('type' => 0, 'name' => lang('home'), 'url' => 'default', 'sort' => '100'));
$db->query($sql);
$sql = $db->insert('#@nav', array('type' => 0, 'name' => lang('tags'), 'url' => 'tags', 'sort' => '100'));
$db->query($sql);