本文整理汇总了PHP中PH7\Framework\Mvc\Model\DbConfig::setSiteMode方法的典型用法代码示例。如果您正苦于以下问题:PHP DbConfig::setSiteMode方法的具体用法?PHP DbConfig::setSiteMode怎么用?PHP DbConfig::setSiteMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PH7\Framework\Mvc\Model\DbConfig
的用法示例。
在下文中一共展示了DbConfig::setSiteMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepare
private function _prepare()
{
if (!AdminCore::auth()) {
// Checking if the administrator is connected
$this->_aErrors[] = t('You must be logged in as administrator to upgrade your site.');
}
if (!$this->_displayIfIsErr()) {
// If not found error
if (!$this->_showAvailableUpgrades()) {
$this->_sHtml .= '<h2>' . t('No upgrade path for %software_name%!') . '</h2>';
} else {
$this->_sHtml .= '<h2>' . t('Upgrade available for %software_name%:') . '</h2>';
$this->_sHtml .= '<form method="post">';
foreach ($this->_showAvailableUpgrades() as $sFolder) {
$this->_sUpgradesDirUpgradeFolder = $this->_oFile->checkExtDir($sFolder);
$this->_readConfig();
$sVerName = $this->_oConfig->values['upgrade.version']['name'];
$sVerNumber = $this->_oConfig->values['upgrade.version']['number'];
$iVerBuild = $this->_oConfig->values['upgrade.version']['build'];
$sDesc = $this->_oConfig->values['upgrade.information']['description'];
if ($this->_checkUpgradeFolder($this->_sUpgradesDirUpgradeFolder)) {
$this->_sHtml .= '<p class="underline italic">' . t('Version Name: %0%, Version Number: %1%, Version Build: %2%', $sVerName, $sVerNumber, $iVerBuild) . '</p>';
if ($this->_checkVersion($sVerName, $sVerNumber, $iVerBuild)) {
$this->_sHtml .= '<button type="submit" class="success" name="submit_upgrade" value="' . $this->_sUpgradesDirUpgradeFolder . '" onclick="return confirm(\'' . t('Have you made a backup of your website files, folders and database?') . '\');">' . t('Upgrade <span class="bold italic">%software_version_name% %software_version% Build %software_build%</span> to version <span class="bold italic">%0%</span>', '<span class="bold italic">' . $sVerName . ' ' . $sVerNumber . ' Build ' . $iVerBuild . '</span>') . '</button>';
// Description upgrade path
$this->_sHtml .= '<p class="underline">' . t('Description of the upgrade patch:') . '</p>';
$this->_sHtml .= $sDesc;
// Introduction file
$this->_sHtml .= '<p class="bold underline">' . t('Introductory instruction:') . '</p>';
$this->_sHtml .= $this->_readInstruction(static::INST_INTRO_FILE);
} else {
$this->_sHtml .= '<button type="submit" class="error" disabled="disabled">' . t('Bad "version name, version number or version build" of upgrade path!') . '</button>';
}
} else {
$this->_sHtml .= '<button type="submit" class="error" disabled="disabled">' . t('Upgrade path is not valid!') . '</button>';
}
$this->_sHtml .= '<br /><hr /><br />';
unset($sVerName, $sVerNumber, $iVerBuild);
}
$this->_sHtml .= '</form>';
if ($this->_oHttpRequest->postExists('submit_upgrade')) {
if ($this->_checkUpgradeFolder($this->_oHttpRequest->post('submit_upgrade'))) {
$this->_sUpgradesDirUpgradeFolder = $this->_oHttpRequest->post('submit_upgrade');
// Upgrade Directory Path
$this->_readConfig();
$this->_sVerName = $this->_oConfig->values['upgrade.version']['name'];
// Version name upgrade
$this->_sVerNumber = $this->_oConfig->values['upgrade.version']['number'];
// Version number upgrade
$this->_iVerBuild = $this->_oConfig->values['upgrade.version']['build'];
// Version build upgrade
DbConfig::setSiteMode(DbConfig::MAINTENANCE_SITE);
$this->_oConfig->setDevelopmentMode();
usleep(100000);
$this->_check();
// Checking
// If not found error
if (!$this->_displayIfIsErr()) {
$this->_run();
// Run Upgrade!
// If no error
if (!$this->_displayIfIsErr()) {
/**
It resets the HTML variable ($this->_sHtml) to not display versions upgrade available.
The user can refresh the page to réaficher the upgrade available.
*/
$this->_sHtml = '<h3 class="success">' . t('Your update ran successfully!') . '</h3>';
if ($this->_bAutoRemoveUpgradeDir) {
if ($this->_removeUpgradeDir()) {
$this->_sHtml .= '<p class="success">' . t('The upgrade directory <em>(~%0%)</em> has been deleted!', PH7_PATH_REPOSITORY . static::DIR . PH7_DS . $this->_sUpgradesDirUpgradeFolder) . '</p>';
$this->_sHtml .= '<p class="success">' . t('Status... OK!') . '</p>';
} else {
$this->_sHtml .= '<p class="error">' . t('The upgrade directory <em>(~%0%)</em> could not be deleted, please delete it manually using an FTP client or SSH.', PH7_PATH_REPOSITORY . static::DIR . PH7_DS . $this->_sUpgradesDirUpgradeFolder) . '</p>';
$this->_sHtml .= '<p class="error">' . t('Status... Failure!') . '</p>';
}
} else {
$this->_sHtml .= '<p>' . t('Please delete the upgrade file using an FTP client or SSH.') . '</p>';
}
// Conclusion file
$this->_sHtml .= '<p class="bold underline">' . t('Conclusion of Instruction:') . '</p>';
$this->_sHtml .= $this->_readInstruction(static::INST_CONCL_FILE);
}
}
$this->_oConfig->setProductionMode();
DbConfig::setSiteMode(DbConfig::ENABLE_SITE);
usleep(100000);
}
}
}
}
}
示例2: __construct
public function __construct()
{
parent::__construct();
/********** General Settings **********/
if (!$this->str->equals($this->httpRequest->post('site_name'), DbConfig::getSetting('siteName'))) {
DbConfig::setSetting($this->httpRequest->post('site_name'), 'siteName');
}
if (!$this->str->equals($this->httpRequest->post('default_template'), DbConfig::getSetting('defaultTemplate'))) {
DbConfig::setSetting($this->httpRequest->post('default_template'), 'defaultTemplate');
}
if (!$this->str->equals($this->httpRequest->post('default_language'), DbConfig::getSetting('defaultLanguage'))) {
DbConfig::setSetting($this->httpRequest->post('default_language'), 'defaultLanguage');
}
if (!$this->str->equals($this->httpRequest->post('map_type'), DbConfig::getSetting('mapType'))) {
DbConfig::setSetting($this->httpRequest->post('map_type'), 'mapType');
}
if (!$this->str->equals($this->httpRequest->post('splash_page'), DbConfig::getSetting('splashPage'))) {
DbConfig::setSetting($this->httpRequest->post('splash_page'), 'splashPage');
}
if (!$this->str->equals($this->httpRequest->post('bg_splash_vid'), DbConfig::getSetting('bgSplashVideo'))) {
DbConfig::setSetting($this->httpRequest->post('bg_splash_vid'), 'bgSplashVideo');
}
if (!$this->str->equals($this->httpRequest->post('full_ajax_site'), DbConfig::getSetting('fullAjaxSite'))) {
DbConfig::setSetting($this->httpRequest->post('full_ajax_site'), 'fullAjaxSite');
}
if (!$this->str->equals($this->httpRequest->post('site_status'), DbConfig::getSetting('siteStatus'))) {
DbConfig::setSiteMode($this->httpRequest->post('site_status'));
}
if (!$this->str->equals($this->httpRequest->post('disclaimer'), DbConfig::getSetting('disclaimer'))) {
DbConfig::setSetting($this->httpRequest->post('disclaimer'), 'disclaimer');
}
if (!$this->str->equals($this->httpRequest->post('cookie_consent_bar'), DbConfig::getSetting('cookieConsentBar'))) {
DbConfig::setSetting($this->httpRequest->post('cookie_consent_bar'), 'cookieConsentBar');
}
if (!$this->str->equals($this->httpRequest->post('is_software_news_feed'), DbConfig::getSetting('isSoftwareNewsFeed'))) {
DbConfig::setSetting($this->httpRequest->post('is_software_news_feed'), 'isSoftwareNewsFeed');
}
/********** Logo Settings **********/
if (!empty($_FILES['logo']['tmp_name'])) {
$oLogo = new Framework\Image\Image($_FILES['logo']['tmp_name']);
if (!$oLogo->validate()) {
\PFBC\Form::setError('form_setting', Form::wrongImgFileTypeMsg());
$this->bIsErr = true;
} else {
/*
* The method deleteFile first test if the file exists, if so it delete the file.
*/
$sPathName = PH7_PATH_TPL . PH7_TPL_NAME . PH7_DS . PH7_IMG . 'logo.png';
$this->file->deleteFile($sPathName);
// It erases the old logo.
$oLogo->dynamicResize(250, 60);
$oLogo->save($sPathName);
// Clear CSS cache, because the logo is storaged with data URI in the CSS cache file
$this->file->deleteDir(PH7_PATH_CACHE . Framework\Layout\Gzip::CACHE_DIR);
// Clear the Web browser cache
(new Framework\Navigation\Browser())->noCache();
}
}
/********** Email **********/
if (!$this->str->equals($this->httpRequest->post('email_name'), DbConfig::getSetting('emailName'))) {
DbConfig::setSetting($this->httpRequest->post('email_name'), 'emailName');
}
if (!$this->str->equals($this->httpRequest->post('admin_email'), DbConfig::getSetting('adminEmail'))) {
DbConfig::setSetting($this->httpRequest->post('admin_email'), 'adminEmail');
}
if (!$this->str->equals($this->httpRequest->post('feedback_email'), DbConfig::getSetting('feedbackEmail'))) {
DbConfig::setSetting($this->httpRequest->post('feedback_email'), 'feedbackEmail');
}
if (!$this->str->equals($this->httpRequest->post('return_email'), DbConfig::getSetting('returnEmail'))) {
DbConfig::setSetting($this->httpRequest->post('return_email'), 'returnEmail');
}
/********** Registration **********/
if (!$this->str->equals($this->httpRequest->post('user_activation_type'), DbConfig::getSetting('userActivationType'))) {
DbConfig::setSetting($this->httpRequest->post('user_activation_type'), 'userActivationType');
}
if (!$this->str->equals($this->httpRequest->post('aff_activation_type'), DbConfig::getSetting('affActivationType'))) {
DbConfig::setSetting($this->httpRequest->post('aff_activation_type'), 'affActivationType');
}
if (!$this->str->equals($this->httpRequest->post('min_username_length'), DbConfig::getSetting('minUsernameLength'))) {
$iMaxUsernameLength = DbConfig::getSetting('maxUsernameLength') - 1;
if ($this->httpRequest->post('min_username_length') > $iMaxUsernameLength) {
\PFBC\Form::setError('form_setting', t('The minimum length of the username cannot exceed %0% characters.', $iMaxUsernameLength));
$this->bIsErr = true;
} else {
DbConfig::setSetting($this->httpRequest->post('min_username_length'), 'minUsernameLength');
}
}
if (!$this->str->equals($this->httpRequest->post('max_username_length'), DbConfig::getSetting('maxUsernameLength'))) {
if ($this->httpRequest->post('max_username_length') > PH7_MAX_USERNAME_LENGTH) {
\PFBC\Form::setError('form_setting', t('The maximum length of the username cannot exceed %0% characters.', PH7_MAX_USERNAME_LENGTH));
$this->bIsErr = true;
} else {
DbConfig::setSetting($this->httpRequest->post('max_username_length'), 'maxUsernameLength');
}
}
if (!$this->str->equals($this->httpRequest->post('min_age_registration'), DbConfig::getSetting('minAgeRegistration'))) {
if ($this->httpRequest->post('min_age_registration') >= DbConfig::getSetting('maxAgeRegistration')) {
\PFBC\Form::setError('form_setting', t('You cannot specify a minimum age higher than the maximum age.'));
$this->bIsErr = true;
} else {
//.........这里部分代码省略.........