本文整理汇总了PHP中cmsConfig::saveToFile方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsConfig::saveToFile方法的具体用法?PHP cmsConfig::saveToFile怎么用?PHP cmsConfig::saveToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsConfig
的用法示例。
在下文中一共展示了cmsConfig::saveToFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applet_config
function applet_config()
{
// получаем оригинальный конфиг
$config = cmsConfig::getDefaultConfig();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
cmsCore::c('page')->setTitle($_LANG['AD_SITE_SETTING']);
cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
$do = cmsCore::request('do', 'str', 'list');
if ($do == 'save') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$newCFG = cmsCore::getArrayFromRequest(array('scheme' => array('scheme', array('http', 'https'), ''), 'sitename' => array('sitename', 'str', ''), 'title_and_sitename' => array('title_and_sitename', 'int', 0), 'title_and_page' => array('title_and_page', 'int', 0), 'hometitle' => array('hometitle', 'str', ''), 'homecom' => array('homecom', 'str', ''), 'com_without_name_in_url' => array('com_without_name_in_url', 'str', ''), 'siteoff' => array('siteoff', 'int', 0), 'only_authorized' => array('only_authorized', 'int', 0), 'debug' => array('debug', 'int', 0), 'offtext' => array('offtext', 'str', ''), 'keywords' => array('keywords', 'str', ''), 'metadesc' => array('metadesc', 'str', ''), 'seourl' => array('seourl', 'int', 0), 'lang' => array('lang', 'str', 'ru'), 'is_change_lang' => array('is_change_lang', 'int', 0), 'sitemail' => array('sitemail', 'str', ''), 'sitemail_name' => array('sitemail_name', 'str', ''), 'wmark' => array('wmark', 'str', ''), 'template' => array('template', 'str', ''), 'admin_template' => array('admin_template', 'str', ''), 'cache' => array('cache', 'int', 0), 'cache_type' => array('cache_type', array('file', 'memcached'), ''), 'memcached_host' => array('memcached_host', 'str', ''), 'memcached_port' => array('memcached_port', 'int', 0), 'combine_css_enable' => array('combine_css_enable', 'int', 0), 'combine_css' => array('combine_css', 'html', ''), 'combine_js_enable' => array('combine_js_enable', 'int', 0), 'combine_js' => array('combine_js', 'html', ''), 'splash' => array('splash', 'int', 0), 'slight' => array('slight', 'int', 0), 'show_pw' => array('show_pw', 'int', 0), 'last_item_pw' => array('last_item_pw', 'int', 0), 'index_pw' => array('index_pw', 'int', 0), 'fastcfg' => array('fastcfg', 'int', 0), 'mailer' => array('mailer', 'str', ''), 'smtpsecure' => array('smtpsecure', 'str', ''), 'smtpauth' => array('smtpauth', 'int', 0), 'smtpuser' => array('smtpuser', 'str', $config['smtpuser']), 'smtppass' => array('smtppass', 'str', $config['smtppass']), 'smtphost' => array('smtphost', 'str', ''), 'smtpport' => array('smtpport', 'int', '25'), 'timezone' => array('timezone', 'str', $config['timezone']), 'user_stats' => array('user_stats', 'int', 0), 'seo_url_count' => array('seo_url_count', 'int', 0), 'max_pagebar_links' => array('max_pagebar_links', 'int', 0), 'allow_ip' => array('allow_ip', 'str', ''), 'iframe_enable' => array('iframe_enable', 'int', 0), 'vk_enable' => array('vk_enable', 'int', 0), 'vk_id' => array('vk_id', 'str', ''), 'vk_private_key' => array('vk_private_key', 'str', '')));
$newCFG['sitename'] = stripslashes($newCFG['sitename']);
$newCFG['hometitle'] = stripslashes($newCFG['hometitle']);
$newCFG['offtext'] = htmlspecialchars($newCFG['offtext'], ENT_QUOTES);
$newCFG['db_host'] = $config['db_host'];
$newCFG['db_base'] = $config['db_base'];
$newCFG['db_user'] = $config['db_user'];
$newCFG['db_pass'] = $config['db_pass'];
$newCFG['db_prefix'] = $config['db_prefix'];
if (cmsConfig::saveToFile($newCFG)) {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SITE_ERROR'], 'error');
}
cmsCore::clearCache();
cmsCore::redirect('index.php?view=config');
}
cpCheckWritable('/includes/config/config.inc.json');
$result = cmsCore::c('db')->query("SELECT (sum(data_length)+sum(index_length))/1024/1024 as size FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '" . $config['db_base'] . "'", true);
if (!cmsCore::c('db')->error()) {
$s = cmsCore::c('db')->fetch_assoc($result);
} else {
$s['size'] = 0;
}
cmsCore::c('page')->initTemplate('applets', 'config')->assign('config', $config)->assign('timezone_opt', cmsCore::getTimeZonesOptions($config['timezone']))->assign('admin_templates', cmsCore::getDirsList('/templates/admin'))->assign('templates', cmsCore::getDirsList('/templates'))->assign('tpl_info', cmsCore::c('page')->getTplInfo(cmsCore::c('page')->template))->assign('components_opt', cmsCore::getListItems('cms_components', $config['com_without_name_in_url'], 'title', 'ASC', 'internal=0', 'link'))->assign('homecom_opt', cmsCore::getListItems('cms_components', $config['homecom'], 'title', 'ASC', 'internal=0', 'link'))->assign('langs', cmsCore::getDirsList('/languages'))->assign('db_size', round($s['size'], 2))->display();
}
示例2: applet_config
function applet_config()
{
// получаем оригинальный конфиг
$config = cmsConfig::getDefaultConfig();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_SITE_SETTING'];
cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
$do = cmsCore::request('do', 'str', 'list');
if ($do == 'save') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$newCFG = array();
$newCFG['sitename'] = stripslashes(cmsCore::request('sitename', 'str', ''));
$newCFG['title_and_sitename'] = cmsCore::request('title_and_sitename', 'int', 0);
$newCFG['title_and_page'] = cmsCore::request('title_and_page', 'int', 0);
$newCFG['hometitle'] = stripslashes(cmsCore::request('hometitle', 'str', ''));
$newCFG['homecom'] = cmsCore::request('homecom', 'str', '');
$newCFG['siteoff'] = cmsCore::request('siteoff', 'int', 0);
$newCFG['debug'] = cmsCore::request('debug', 'int', 0);
$newCFG['offtext'] = htmlspecialchars(cmsCore::request('offtext', 'str', ''), ENT_QUOTES);
$newCFG['keywords'] = cmsCore::request('keywords', 'str', '');
$newCFG['metadesc'] = cmsCore::request('metadesc', 'str', '');
$newCFG['seourl'] = cmsCore::request('seourl', 'int', 0);
$newCFG['lang'] = cmsCore::request('lang', 'str', 'ru');
$newCFG['is_change_lang'] = cmsCore::request('is_change_lang', 'int', 0);
$newCFG['sitemail'] = cmsCore::request('sitemail', 'str', '');
$newCFG['sitemail_name'] = cmsCore::request('sitemail_name', 'str', '');
$newCFG['wmark'] = cmsCore::request('wmark', 'str', '');
$newCFG['template'] = cmsCore::request('template', 'str', '');
$newCFG['splash'] = cmsCore::request('splash', 'int', 0);
$newCFG['slight'] = cmsCore::request('slight', 'int', 0);
$newCFG['db_host'] = $config['db_host'];
$newCFG['db_base'] = $config['db_base'];
$newCFG['db_user'] = $config['db_user'];
$newCFG['db_pass'] = $config['db_pass'];
$newCFG['db_prefix'] = $config['db_prefix'];
$newCFG['show_pw'] = cmsCore::request('show_pw', 'int', 0);
$newCFG['last_item_pw'] = cmsCore::request('last_item_pw', 'int', 0);
$newCFG['index_pw'] = cmsCore::request('index_pw', 'int', 0);
$newCFG['fastcfg'] = cmsCore::request('fastcfg', 'int', 0);
$newCFG['mailer'] = cmsCore::request('mailer', 'str', '');
$newCFG['smtpsecure'] = cmsCore::request('smtpsecure', 'str', '');
$newCFG['smtpauth'] = cmsCore::request('smtpauth', 'int', 0);
$newCFG['smtpuser'] = cmsCore::inRequest('smtpuser') ? cmsCore::request('smtpuser', 'str', '') : $config['smtpuser'];
$newCFG['smtppass'] = cmsCore::inRequest('smtppass') ? cmsCore::request('smtppass', 'str', '') : $config['smtppass'];
$newCFG['smtphost'] = cmsCore::request('smtphost', 'str', '');
$newCFG['smtpport'] = cmsCore::request('smtpport', 'int', '25');
$newCFG['timezone'] = cmsCore::request('timezone', 'str', '');
$newCFG['timediff'] = cmsCore::request('timediff', 'str', '');
$newCFG['user_stats'] = cmsCore::request('user_stats', 'int', 0);
$newCFG['allow_ip'] = cmsCore::request('allow_ip', 'str', '');
if (cmsConfig::saveToFile($newCFG)) {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SITE_ERROR'], 'error');
}
cmsCore::clearCache();
cmsCore::redirect('index.php?view=config');
}
?>
<div>
<?php
cpCheckWritable('/includes/config.inc.php');
?>
<div id="config_tabs" class="uitabs">
<ul id="tabs">
<li><a href="#basic"><span><?php
echo $_LANG['AD_SITE'];
?>
</span></a></li>
<li><a href="#home"><span><?php
echo $_LANG['AD_MAIN'];
?>
</span></a></li>
<li><a href="#design"><span><?php
echo $_LANG['AD_DESIGN'];
?>
</span></a></li>
<li><a href="#time"><span><?php
echo $_LANG['AD_TIME'];
?>
</span></a></li>
<li><a href="#database"><span><?php
echo $_LANG['AD_DB'];
?>
</span></a></li>
<li><a href="#mail"><span><?php
echo $_LANG['AD_POST'];
?>
</span></a></li>
//.........这里部分代码省略.........
示例3:
$errors = true;
}
if ($errors) {
cmsCore::redirect('/install/');
}
cmsCore::c('config')->db_host = $_CFG['db_host'];
cmsCore::c('config')->db_user = $_CFG['db_user'];
cmsCore::c('config')->db_pass = $_CFG['db_pass'];
cmsCore::c('config')->db_base = $_CFG['db_base'];
cmsCore::c('config')->db_prefix = $_CFG['db_prefix'];
cmsCore::c('db')->importFromFile($sql_file);
cmsConfig::saveToFile(array_merge(cmsConfig::getDefaultConfig(), $_CFG));
cmsCore::c('db')->query("UPDATE cms_users SET password = md5('". $admin_password ."'), login = '". $admin_login ."' WHERE id = 1");
cmsCore::c('db')->query("UPDATE cms_users SET password = md5('". $admin_password ."') WHERE id > 1");
$installed = true;
cmsCore::getInstance(true);
cmsCore::c('user')->update();
cmsCore::c('user')->signInUser($admin_login, $admin_password, true);
}
// =================================================================================================== //
$info = check_requirements();
$permissions = check_permissions();
示例4: session_start
@set_time_limit(0);
session_start();
header('Content-Type: text/html; charset=utf-8');
define('VALID_CMS', 1);
define('PATH', $_SERVER['DOCUMENT_ROOT']);
include(PATH .'/core/cms.php');
if (file_exists(PATH .'/includes/config.inc.php')) {
cmsCore::c('config');
include PATH .'/includes/config.inc.php';
cmsConfig::saveToFile($_CFG);
unlink(PATH .'/includes/config.inc.php');
cmsCore::redirect('/migrate');
}
$inCore = cmsCore::getInstance();
// принудительно включаем дебаг
cmsCore::c('config')->debug = 1;
// Подключаем вспомогательный класс для миграции БД
include PATH .'/migrate/migrate.class.php';
// Выставляем необходимые опции для миграции
$migrateDB = new migrateDB(array(
'create_fields' => array(
array( 'table' => 'cms_modules_bind', 'name' => 'tpl', 'type' => 'VARCHAR(64)' ),
示例5: applet_config
function applet_config() {
// получаем оригинальный конфиг
$config = cmsConfig::getDefaultConfig();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) { cpAccessDenied(); }
cmsCore::c('page')->setTitle($_LANG['AD_SITE_SETTING']);
cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
$do = cmsCore::request('do', 'str', 'list');
if ($do == 'save') {
if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
$newCFG = cmsCore::getArrayFromRequest(array(
'scheme' => array('scheme', array('http', 'https'), ''),
'sitename' => array('sitename', 'str', ''),
'title_and_sitename' => array('title_and_sitename', 'int', 0),
'title_and_page' => array('title_and_page', 'int', 0),
'hometitle' => array('hometitle', 'str', ''),
'homecom' => array('homecom', 'str', ''),
'com_without_name_in_url' => array('com_without_name_in_url', 'str', ''),
'siteoff' => array('siteoff', 'int', 0),
'only_authorized' => array('only_authorized', 'int', 0),
'debug' => array('debug', 'int', 0),
'offtext' => array('offtext', 'str', ''),
'keywords' => array('keywords', 'str', ''),
'metadesc' => array('metadesc', 'str', ''),
'seourl' => array('seourl', 'int', 0),
'lang' => array('lang', 'str', 'ru'),
'is_change_lang' => array('is_change_lang', 'int', 0),
'sitemail' => array('sitemail', 'str', ''),
'sitemail_name' => array('sitemail_name', 'str', ''),
'wmark' => array('wmark', 'str', ''),
'template' => array('template', 'str', ''),
'cache' => array('cache', 'int', 0),
'cache_type' => array('cache_type', array('file', 'memcached'), ''),
'memcached_host' => array('memcached_host', 'str', ''),
'memcached_port' => array('memcached_port', 'int', 0),
'combine_css_enable' => array('combine_css_enable', 'int', 0),
'combine_css' => array('combine_css', 'html', ''),
'combine_js_enable' => array('combine_js_enable', 'int', 0),
'combine_js' => array('combine_js', 'html', ''),
'splash' => array('splash', 'int', 0),
'slight' => array('slight', 'int', 0),
'show_pw' => array('show_pw', 'int', 0),
'last_item_pw' => array('last_item_pw', 'int', 0),
'index_pw' => array('index_pw', 'int', 0),
'fastcfg' => array('fastcfg', 'int', 0),
'mailer' => array('mailer', 'str', ''),
'smtpsecure' => array('smtpsecure', 'str', ''),
'smtpauth' => array('smtpauth', 'int', 0),
'smtpuser' => array('smtpuser', 'str', $config['smtpuser']),
'smtppass' => array('smtppass', 'str', $config['smtppass']),
'smtphost' => array('smtphost', 'str', ''),
'smtpport' => array('smtpport', 'int', '25'),
'timezone' => array('timezone', 'str', $config['timezone']),
'user_stats' => array('user_stats', 'int', 0),
'seo_url_count' => array('seo_url_count', 'int', 0),
'max_pagebar_links' => array('max_pagebar_links', 'int', 0),
'allow_ip' => array('allow_ip', 'str', ''),
'iframe_enable' => array('iframe_enable', 'int', 0),
'vk_enable' => array('vk_enable', 'int', 0),
'vk_id' => array('vk_id', 'str', ''),
'vk_private_key' => array('vk_private_key', 'str', ''),
));
$newCFG['sitename'] = stripslashes($newCFG['sitename']);
$newCFG['hometitle'] = stripslashes($newCFG['hometitle']);
$newCFG['offtext'] = htmlspecialchars($newCFG['offtext'], ENT_QUOTES);
$newCFG['db_host'] = $config['db_host'];
$newCFG['db_base'] = $config['db_base'];
$newCFG['db_user'] = $config['db_user'];
$newCFG['db_pass'] = $config['db_pass'];
$newCFG['db_prefix'] = $config['db_prefix'];
if (cmsConfig::saveToFile($newCFG)) {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'] , 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SITE_ERROR'], 'error');
}
cmsCore::clearCache();
cmsCore::redirect('index.php?view=config');
}
cpCheckWritable('/includes/config/config.inc.json');
?>
<form class="form-horizontal" role="form" action="/admin/index.php?view=config" method="post" name="CFGform" target="_self" id="CFGform" style="margin-bottom:30px">
<input type="hidden" name="csrf_token" value="<?php echo cmsUser::getCsrfToken(); ?>" />
<div class="uitabs">
<ul id="tabs">
<li><a href="#basic"><span><?php echo $_LANG['AD_SITE']; ?></span></a></li>
<li><a href="#home"><span><?php echo $_LANG['AD_MAIN']; ?></span></a></li>
//.........这里部分代码省略.........