本文整理汇总了PHP中Cx\Core\Setting\Controller\Setting::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::set方法的具体用法?PHP Setting::set怎么用?PHP Setting::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Setting\Controller\Setting
的用法示例。
在下文中一共展示了Setting::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateGlobalSetting
/**
* Update the global setting
*
* @param int $value
* @throws DatabaseError
* @global $objDatabase
*/
protected function updateGlobalSetting($value)
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
if (isset($value)) {
if (!\Cx\Core\Setting\Controller\Setting::isDefined('useKnowledgePlaceholders')) {
\Cx\Core\Setting\Controller\Setting::add('useKnowledgePlaceholders', $value, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('useKnowledgePlaceholders', $value);
\Cx\Core\Setting\Controller\Setting::update('useKnowledgePlaceholders');
}
}
}
示例2: showDefault
/**
* Show the general setting options
*
* @global array $_ARRAYLANG
*/
public function showDefault()
{
global $_ARRAYLANG;
\Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config');
//get post values
$settings = isset($_POST['setting']) ? $_POST['setting'] : array();
if (isset($_POST['save'])) {
$includeFromSave = array('entriesPerPage');
foreach ($settings as $settingName => $settingValue) {
if (in_array($settingName, $includeFromSave)) {
\Cx\Core\Setting\Controller\Setting::set($settingName, $settingValue);
\Cx\Core\Setting\Controller\Setting::update($settingName);
\Message::ok($_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_SUCCESS_MSG']);
}
}
}
//get the settings values from DB
$this->template->setVariable(array($this->moduleNameLang . '_ENTRIES_PER_PAGE' => \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager')));
}
示例3: parsePage
/**
* Use this to parse your backend page
*
* You will get the template located in /View/Template/{CMD}.html
* You can access Cx class using $this->cx
* To show messages, use \Message class
* @param \Cx\Core\Html\Sigma $template Template for current CMD
* @param array $cmd CMD separated by slashes
* @global array $_ARRAYLANG Language data
*/
public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd)
{
global $_ARRAYLANG;
// Parse entity view generation pages
$entityClassName = $this->getNamespace() . '\\Model\\Entity\\' . current($cmd);
if (in_array($entityClassName, $this->getEntityClasses())) {
$this->parseEntityClassPage($template, $entityClassName, current($cmd));
return;
}
// Not an entity, parse overview or settings
switch (current($cmd)) {
case 'Settings':
\Cx\Core\Setting\Controller\Setting::init('Wysiwyg', 'config', 'Yaml');
if (isset($_POST) && isset($_POST['bsubmit'])) {
\Cx\Core\Setting\Controller\Setting::set('specificStylesheet', isset($_POST['specificStylesheet']) ? 1 : 0);
\Cx\Core\Setting\Controller\Setting::set('replaceActualContents', isset($_POST['replaceActualContents']) ? 1 : 0);
\Cx\Core\Setting\Controller\Setting::storeFromPost();
}
$i = 0;
if (!\Cx\Core\Setting\Controller\Setting::isDefined('specificStylesheet') && !\Cx\Core\Setting\Controller\Setting::add('specificStylesheet', '0', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1', 'config')) {
throw new \Exception("Failed to add new configuration option");
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('replaceActualContents') && !\Cx\Core\Setting\Controller\Setting::add('replaceActualContents', '0', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1', 'config')) {
throw new \Exception("Failed to add new configuration option");
}
$tmpl = new \Cx\Core\Html\Sigma();
\Cx\Core\Setting\Controller\Setting::show($tmpl, 'index.php?cmd=Config&act=Wysiwyg&tpl=Settings', $_ARRAYLANG['TXT_CORE_WYSIWYG'], $_ARRAYLANG['TXT_CORE_WYSIWYG_ACT_SETTINGS'], 'TXT_CORE_WYSIWYG_');
$template->setVariable('WYSIWYG_CONFIG_TEMPLATE', $tmpl->get());
break;
case '':
default:
if ($template->blockExists('overview')) {
$template->touchBlock('overview');
}
break;
}
}
示例4: errorHandler
/**
* Handles database errors
*
* Also migrates old Shop Customers to the User accounts and adds
* all new settings
* @return boolean false Always!
* @throws Cx\Lib\Update_DatabaseException
*/
static function errorHandler()
{
// Customer
$table_name_old = DBPREFIX . "module_shop_customers";
// If the old Customer table is missing, the migration has completed
// successfully already
if (!\Cx\Lib\UpdateUtil::table_exist($table_name_old)) {
return false;
}
// Ensure that the ShopSettings (including \Cx\Core\Setting) and Order tables
// are ready first!
//DBG::log("Customer::errorHandler(): Adding settings");
ShopSettings::errorHandler();
// \Cx\Core\Country\Controller\Country::errorHandler(); // Called by Order::errorHandler();
Order::errorHandler();
Discount::errorHandler();
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
$objUser = \FWUser::getFWUserObject()->objUser;
// Create new User_Profile_Attributes
$index_notes = \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_notes', 'Shop');
if (!$index_notes) {
//DBG::log("Customer::errorHandler(): Adding notes attribute...");
// $objProfileAttribute = new \User_Profile_Attribute();
$objProfileAttribute = $objUser->objAttribute->getById(0);
//DBG::log("Customer::errorHandler(): NEW notes attribute: ".var_export($objProfileAttribute, true));
$objProfileAttribute->setNames(array(1 => 'Notizen', 2 => 'Notes', 3 => 'Notes', 4 => 'Notes', 5 => 'Notes', 6 => 'Notes'));
$objProfileAttribute->setType('text');
$objProfileAttribute->setMultiline(true);
$objProfileAttribute->setParent(0);
$objProfileAttribute->setProtection(array(1));
//DBG::log("Customer::errorHandler(): Made notes attribute: ".var_export($objProfileAttribute, true));
if (!$objProfileAttribute->store()) {
throw new \Cx\Lib\Update_DatabaseException("Failed to create User_Profile_Attribute 'notes'");
}
//Re initialize shop setting
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
//DBG::log("Customer::errorHandler(): Stored notes attribute, ID ".$objProfileAttribute->getId());
if (!(\Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_notes', $objProfileAttribute->getId()) && \Cx\Core\Setting\Controller\Setting::update('user_profile_attribute_notes'))) {
throw new \Cx\Lib\Update_DatabaseException("Failed to update User_Profile_Attribute 'notes' setting");
}
//DBG::log("Customer::errorHandler(): Stored notes attribute ID setting");
}
$index_group = \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_group_id', 'Shop');
if (!$index_group) {
// $objProfileAttribute = new \User_Profile_Attribute();
$objProfileAttribute = $objUser->objAttribute->getById(0);
$objProfileAttribute->setNames(array(1 => 'Kundenrabattgruppe', 2 => 'Discount group', 3 => 'Kundenrabattgruppe', 4 => 'Kundenrabattgruppe', 5 => 'Kundenrabattgruppe', 6 => 'Kundenrabattgruppe'));
$objProfileAttribute->setType('text');
$objProfileAttribute->setParent(0);
$objProfileAttribute->setProtection(array(1));
if (!$objProfileAttribute->store()) {
throw new \Cx\Lib\Update_DatabaseException("Failed to create User_Profile_Attribute 'notes'");
}
//Re initialize shop setting
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
if (!(\Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_customer_group_id', $objProfileAttribute->getId()) && \Cx\Core\Setting\Controller\Setting::update('user_profile_attribute_customer_group_id'))) {
throw new \Cx\Lib\Update_DatabaseException("Failed to update User_Profile_Attribute 'customer_group_id' setting");
}
}
// For the migration, a temporary flag is needed in the orders table
// in order to prevent mixing up old and new customer_id values.
$table_order_name = DBPREFIX . "module_shop_orders";
if (!\Cx\Lib\UpdateUtil::column_exist($table_order_name, 'migrated')) {
$query = "\n ALTER TABLE `{$table_order_name}`\n ADD `migrated` TINYINT(1) unsigned NOT NULL default 0";
\Cx\Lib\UpdateUtil::sql($query);
}
// Create missing UserGroups for customers and resellers
$objGroup = null;
$group_id_customer = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_customer', 'Shop');
if ($group_id_customer) {
$objGroup = \FWUser::getFWUserObject()->objGroup->getGroup($group_id_customer);
}
if (!$objGroup || $objGroup->EOF) {
$objGroup = \FWUser::getFWUserObject()->objGroup->getGroups(array('group_name' => 'Shop Endkunden'));
}
if (!$objGroup || $objGroup->EOF) {
$objGroup = new \UserGroup();
$objGroup->setActiveStatus(true);
$objGroup->setDescription('Online Shop Endkunden');
$objGroup->setName('Shop Endkunden');
$objGroup->setType('frontend');
}
//DBG::log("Group: ".var_export($objGroup, true));
if (!$objGroup) {
throw new \Cx\Lib\Update_DatabaseException("Failed to create UserGroup for customers");
}
//DBG::log("Customer::errorHandler(): Made customer usergroup: ".var_export($objGroup, true));
if (!$objGroup->store() || !$objGroup->getId()) {
throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup for customers");
}
//DBG::log("Customer::errorHandler(): Stored customer usergroup, ID ".$objGroup->getId());
\Cx\Core\Setting\Controller\Setting::set('usergroup_id_customer', $objGroup->getId());
//.........这里部分代码省略.........
示例5: checkProfileAttributes
protected function checkProfileAttributes()
{
$objUser = \FWUser::getFWUserObject()->objUser;
$index_notes = \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_notes', 'Shop');
if ($index_notes) {
$objProfileAttribute = $objUser->objAttribute->getById($index_notes);
$attributeNames = $objProfileAttribute->getAttributeNames($index_notes);
if (empty($attributeNames)) {
$index_notes = false;
}
}
if (!$index_notes) {
//DBG::log("Customer::errorHandler(): Adding notes attribute...");
// $objProfileAttribute = new User_Profile_Attribute();
$objProfileAttribute = $objUser->objAttribute->getById(0);
//DBG::log("Customer::errorHandler(): NEW notes attribute: ".var_export($objProfileAttribute, true));
$objProfileAttribute->setNames(array(1 => 'Notizen', 2 => 'Notes', 3 => 'Notes', 4 => 'Notes', 5 => 'Notes', 6 => 'Notes'));
$objProfileAttribute->setType('text');
$objProfileAttribute->setMultiline(true);
$objProfileAttribute->setParent(0);
$objProfileAttribute->setProtection(array(1));
//DBG::log("Customer::errorHandler(): Made notes attribute: ".var_export($objProfileAttribute, true));
if (!$objProfileAttribute->store()) {
throw new \Cx\Lib\Update_DatabaseException("Failed to create User_Profile_Attribute 'notes'");
}
//Re initialize shop setting
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
//DBG::log("Customer::errorHandler(): Stored notes attribute, ID ".$objProfileAttribute->getId());
if (!(\Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_notes', $objProfileAttribute->getId()) && \Cx\Core\Setting\Controller\Setting::update('user_profile_attribute_notes'))) {
throw new \Cx\Lib\Update_DatabaseException("Failed to update User_Profile_Attribute 'notes' setting");
}
//DBG::log("Customer::errorHandler(): Stored notes attribute ID setting");
}
$index_group = \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_group_id', 'Shop');
if ($index_group) {
$objProfileAttribute = $objUser->objAttribute->getById($index_notes);
$attributeNames = $objProfileAttribute->getAttributeNames($index_group);
if (empty($attributeNames)) {
$index_group = false;
}
}
if (!$index_group) {
// $objProfileAttribute = new User_Profile_Attribute();
$objProfileAttribute = $objUser->objAttribute->getById(0);
$objProfileAttribute->setNames(array(1 => 'Kundenrabattgruppe', 2 => 'Discount group', 3 => 'Kundenrabattgruppe', 4 => 'Kundenrabattgruppe', 5 => 'Kundenrabattgruppe', 6 => 'Kundenrabattgruppe'));
$objProfileAttribute->setType('text');
$objProfileAttribute->setParent(0);
$objProfileAttribute->setProtection(array(1));
if (!$objProfileAttribute->store()) {
throw new \Cx\Lib\Update_DatabaseException("Failed to create User_Profile_Attribute 'notes'");
}
//Re initialize shop setting
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
if (!(\Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_customer_group_id', $objProfileAttribute->getId()) && \Cx\Core\Setting\Controller\Setting::update('user_profile_attribute_customer_group_id'))) {
throw new \Cx\Lib\Update_DatabaseException("Failed to update User_Profile_Attribute 'customer_group_id' setting");
}
}
}
示例6: storeVat
/**
* Stores all VAT settings
*
* Takes all values from the POST array.
* @static
*/
static function storeVat()
{
//DBG::log("start of storeVat: ".self::$success.", changed: ".self::$changed);
if (empty($_POST['bvat'])) {
//DBG::log("No bvat");
self::deleteVat();
self::setProductsVat();
return;
}
//DBG::log("Got bvat");
$result = \Cx\Core\Setting\Controller\Setting::set('vat_number', trim(strip_tags(contrexx_input2raw($_POST['vat_number']))));
if (isset($result)) {
self::$success &= $result;
}
//DBG::log("HERE: ".self::$success);
$result = \Cx\Core\Setting\Controller\Setting::set('vat_default_id', intval($_POST['vat_default_id']));
if (isset($result)) {
self::$success &= $result;
}
$result = \Cx\Core\Setting\Controller\Setting::set('vat_other_id', intval($_POST['vat_other_id']));
if (isset($result)) {
self::$success &= $result;
}
$vat_enabled_home_customer = !empty($_POST['vat_enabled_home_customer']);
$result = \Cx\Core\Setting\Controller\Setting::set('vat_enabled_home_customer', $vat_enabled_home_customer);
if (isset($result)) {
self::$success &= $result;
}
if ($vat_enabled_home_customer) {
$result = \Cx\Core\Setting\Controller\Setting::set('vat_included_home_customer', !empty($_POST['vat_included_home_customer']));
if (isset($result)) {
self::$success &= $result;
}
}
$vat_enabled_home_reseller = !empty($_POST['vat_enabled_home_reseller']);
$result = \Cx\Core\Setting\Controller\Setting::set('vat_enabled_home_reseller', $vat_enabled_home_reseller);
if (isset($result)) {
self::$success &= $result;
}
//DBG::log("after set(): ".self::$success.", my changed: ".self::$changed.", \Cx\Core\Setting\Controller\Setting: ".\Cx\Core\Setting\Controller\Setting::changed());
if ($vat_enabled_home_reseller) {
$result = \Cx\Core\Setting\Controller\Setting::set('vat_included_home_reseller', !empty($_POST['vat_included_home_reseller']));
if (isset($result)) {
self::$success &= $result;
}
}
$vat_enabled_foreign_customer = !empty($_POST['vat_enabled_foreign_customer']);
$result = \Cx\Core\Setting\Controller\Setting::set('vat_enabled_foreign_customer', $vat_enabled_foreign_customer);
if (isset($result)) {
self::$success &= $result;
}
if ($vat_enabled_foreign_customer) {
$result = \Cx\Core\Setting\Controller\Setting::set('vat_included_foreign_customer', !empty($_POST['vat_included_foreign_customer']));
if (isset($result)) {
self::$success &= $result;
}
}
$vat_enabled_foreign_reseller = !empty($_POST['vat_enabled_foreign_reseller']);
$result = \Cx\Core\Setting\Controller\Setting::set('vat_enabled_foreign_reseller', $vat_enabled_foreign_reseller);
if (isset($result)) {
self::$success &= $result;
}
if ($vat_enabled_foreign_reseller) {
$result = \Cx\Core\Setting\Controller\Setting::set('vat_included_foreign_reseller', !empty($_POST['vat_included_foreign_reseller']));
if (isset($result)) {
self::$success &= $result;
}
}
//DBG::log("storeVat(): after \Cx\Core\Setting\Controller\Setting: ".self::$success.", changed: ".self::$changed);
self::update_vat();
//DBG::log("end of storeVat(): ".self::$success.", changed: ".self::$changed);
Vat::init();
}
示例7: updateSettings
/**
* update settings
* @access public
* @global array
* @global ADONewConnection
* @global array
* @global array
*/
function updateSettings()
{
global $objDatabase, $_CORELANG, $_ARRAYLANG;
if (isset($_POST['set_sys_submit'])) {
//get post data
foreach ($_POST['setvalue'] as $id => $value) {
//update settings
// check for description field to be required
if ($id == 13 && $value == 1) {
$objDatabase->Execute("UPDATE `" . DBPREFIX . "module_directory_inputfields` SET active='1', is_required='1', active_backend='1' WHERE name='description'");
}
if (ini_get('allow_url_fopen') == false && $id == 19) {
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings SET setvalue='0' WHERE setid=" . intval($id));
} else {
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings SET setvalue='" . contrexx_addslashes($value) . "' WHERE setid=" . intval($id));
}
}
$this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
}
if (isset($_POST['set_google_submit'])) {
//get post data
foreach ($_POST['setvalue'] as $id => $value) {
//update settings
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings_google SET setvalue='" . contrexx_addslashes($value) . "' WHERE setid=" . intval($id));
}
$this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
}
if (isset($_POST['set_homecontent_submit'])) {
//update settings
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
if (isset($_POST['setHomeContent'])) {
if (!\Cx\Core\Setting\Controller\Setting::isDefined('directoryHomeContent')) {
\Cx\Core\Setting\Controller\Setting::add('directoryHomeContent', contrexx_addslashes($_POST['setHomeContent']), 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('directoryHomeContent', contrexx_addslashes($_POST['setHomeContent']));
\Cx\Core\Setting\Controller\Setting::update('directoryHomeContent');
}
}
\Cx\Core\Csrf\Controller\Csrf::header('Location: ?cmd=Directory&act=settings&tpl=homecontent');
exit;
$this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
}
if (isset($_POST['set_mail_submit'])) {
//update settings
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_mail SET title='" . contrexx_addslashes($_POST['mailConfirmTitle']) . "', content='" . $_POST['mailConfirmContent'] . "' WHERE id='1'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_mail SET title='" . contrexx_addslashes($_POST['mailRememberTitle']) . "', content='" . $_POST['mailRememberContent'] . "' WHERE id='2'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings SET setvalue='" . contrexx_addslashes($_POST['mailRememberAdress']) . "' WHERE setid='30'");
$this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
}
if (isset($_POST['set_inputs_submit'])) {
//update settings
// title field should stay active, required and available for search
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='0' Where id !='1'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET is_search='0' Where id !='1'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET is_required='0' Where id !='1'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active_backend='0' Where id !='1'");
//get post data
if ($_POST['setStatus'] != "") {
$addressElements = 0;
$googleMapIsEnabled = false;
foreach ($_POST['setStatus'] as $id => $value) {
//update settings
$objResult = $objDatabase->Execute("SELECT `name` FROM " . DBPREFIX . "module_directory_inputfields WHERE id=" . intval($id));
$name = $objResult->fields['name'];
switch ($name) {
case 'country':
case 'zip':
case 'street':
case 'city':
$addressElements++;
break;
case 'googlemap':
$googleMapIsEnabled = true;
break;
default:
}
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='" . contrexx_addslashes($value) . "' WHERE id=" . intval($id));
}
if ($googleMapIsEnabled && $addressElements < 4) {
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='country'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='zip'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='street'");
$objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='city'");
$this->strOkMessage = $_ARRAYLANG['TXT_DIRECTORY_GOOGLEMAP_REQUIRED_FIELDS_MISSING'];
}
}
//get post data
if ($_POST['setStatusBackend'] != "") {
$addressElements = 0;
$googleMapIsEnabled = false;
foreach ($_POST['setStatusBackend'] as $id => $value) {
//update settings
//.........这里部分代码省略.........
示例8: updateSettings
/**
* Update settings and write them to the database
*
* @global object $objDatabase
* @global object $objTemplate
* @global array $_ARRAYLANG
*/
function updateSettings()
{
global $objDatabase, $objTemplate, $_ARRAYLANG, $_CONFIG;
if (!isset($_POST['frmSettings_Submit'])) {
return;
}
\Cx\Core\Setting\Controller\Setting::init('Config', 'cache', 'Yaml');
\Cx\Core\Setting\Controller\Setting::set('cacheEnabled', $_POST['cachingStatus']);
\Cx\Core\Setting\Controller\Setting::set('cacheExpiration', intval($_POST['cachingExpiration']));
\Cx\Core\Setting\Controller\Setting::set('cacheUserCache', contrexx_input2db($_POST['usercache']));
\Cx\Core\Setting\Controller\Setting::set('cacheOPCache', contrexx_input2db($_POST['opcache']));
\Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheDbStatus', contrexx_input2db($_POST['cacheDbStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheReverseProxy', contrexx_input2db($_POST['cacheReverseProxy']));
\Cx\Core\Setting\Controller\Setting::set('internalSsiCache', contrexx_input2db($_POST['internalSsiCache']));
$oldSsiValue = $_CONFIG['cacheSsiOutput'];
\Cx\Core\Setting\Controller\Setting::set('cacheSsiOutput', contrexx_input2db($_POST['cacheSsiOutput']));
\Cx\Core\Setting\Controller\Setting::set('cacheSsiType', contrexx_input2db($_POST['cacheSsiType']));
foreach (array('cacheUserCacheMemcacheConfig' => array('key' => 'memcacheSetting', 'defaultPort' => 11211), 'cacheProxyCacheConfig' => array('key' => 'reverseProxy', 'defaultPort' => 8080), 'cacheSsiProcessorConfig' => array('key' => 'ssiProcessor', 'defaultPort' => 8080)) as $settingName => $settings) {
$hostnamePortSetting = $settings['key'];
if (!empty($_POST[$hostnamePortSetting . 'Ip']) || !empty($_POST[$hostnamePortSetting . 'Port'])) {
$settings = json_encode(array('ip' => !empty($_POST[$hostnamePortSetting . 'Ip']) ? contrexx_input2raw($_POST[$hostnamePortSetting . 'Ip']) : '127.0.0.1', 'port' => !empty($_POST[$hostnamePortSetting . 'Port']) ? intval($_POST[$hostnamePortSetting . 'Port']) : $defaultPort));
\Cx\Core\Setting\Controller\Setting::set($settingName, $settings);
}
}
\Cx\Core\Setting\Controller\Setting::updateAll();
$this->arrSettings = $this->getSettings();
$this->initUserCaching();
// reinit user caches (especially memcache)
$this->initOPCaching();
// reinit opcaches
$this->getActivatedCacheEngines();
$this->clearCache($this->getOpCacheEngine());
if ($oldSsiValue != contrexx_input2db($_POST['cacheSsiOutput'])) {
$this->_deleteAllFiles('cxPages');
}
if (!count($this->objSettings->strErrMessage)) {
$objTemplate->SetVariable('CONTENT_OK_MESSAGE', $_ARRAYLANG['TXT_SETTINGS_UPDATED']);
} else {
$objTemplate->SetVariable('CONTENT_STATUS_MESSAGE', implode("<br />\n", $this->objSettings->strErrMessage));
}
}
示例9: saveSettings
private function saveSettings()
{
global $objDatabase;
/**
* save mailtemplates
*/
foreach ($_POST["filesharingMail"] as $lang => $inputs) {
$objMailTemplate = $objDatabase->Execute("SELECT `subject`, `content` FROM " . DBPREFIX . "module_filesharing_mail_template WHERE `lang_id` = " . intval($lang));
$content = str_replace(array('{', '}'), array('[[', ']]'), contrexx_input2db($inputs["content"]));
if ($objMailTemplate === false or $objMailTemplate->RecordCount() == 0) {
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_filesharing_mail_template (`subject`, `content`, `lang_id`) VALUES ('" . contrexx_input2db($inputs["subject"]) . "', '" . contrexx_raw2db($content) . "', '" . contrexx_raw2db($lang) . "')");
} else {
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing_mail_template SET `subject` = '" . contrexx_input2db($inputs["subject"]) . "', `content` = '" . contrexx_raw2db($content) . "' WHERE `lang_id` = '" . contrexx_raw2db($lang) . "'");
}
}
/**
* save permissions
*/
\Cx\Core\Setting\Controller\Setting::init('FileSharing', 'config');
$oldFilesharingSetting = \Cx\Core\Setting\Controller\Setting::getValue('permission', 'FileSharing');
$newFilesharingSetting = $_POST['filesharingSettingsPermission'];
if (!is_numeric($newFilesharingSetting)) {
if (is_numeric($oldFilesharingSetting)) {
// remove AccessId
\Permission::removeAccess($oldFilesharingSetting, 'dynamic');
}
} else {
$accessGroups = '';
if (isset($_POST['filesharing_access_associated_groups'])) {
$accessGroups = $_POST['filesharing_access_associated_groups'];
}
// get groups
\Permission::removeAccess($oldFilesharingSetting, 'dynamic');
if (isset($_POST['filesharing_access_associated_groups'])) {
$accessGroups = $_POST['filesharing_access_associated_groups'];
}
// add AccessID
$newFilesharingSetting = \Permission::createNewDynamicAccessId();
// save AccessID
if (count($accessGroups)) {
\Permission::setAccess($newFilesharingSetting, 'dynamic', $accessGroups);
}
}
// save new setting
\Cx\Core\Setting\Controller\Setting::set('permission', $newFilesharingSetting);
\Cx\Core\Setting\Controller\Setting::updateAll();
}
示例10: createNewDynamicAccessId
/**
* Generates a new dynamic access-ID
*
* @return mixed Returns the newly created dynamic access-ID or FALSE on failure.
*/
public static function createNewDynamicAccessId()
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml');
if (!\Cx\Core\Setting\Controller\Setting::isDefined('lastAccessId')) {
$newAccessId = 1;
\Cx\Core\Setting\Controller\Setting::add('lastAccessId', $newAccessId, 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, '', 'core');
} else {
$newAccessId = \Cx\Core\Setting\Controller\Setting::getValue('lastAccessId', 'Config') + 1;
\Cx\Core\Setting\Controller\Setting::set('lastAccessId', $newAccessId);
if (!\Cx\Core\Setting\Controller\Setting::update('lastAccessId')) {
return false;
}
}
// verify that the update was successful
\Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml');
if (\Cx\Core\Setting\Controller\Setting::getValue('lastAccessId', 'Config') != $newAccessId) {
return false;
}
return $newAccessId;
}
示例11: _updateHomeContentSettings
function _updateHomeContentSettings()
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
$status = false;
if (isset($_POST['setHomeContent'])) {
$setHomeContent = intval($_POST['setHomeContent']);
if (!\Cx\Core\Setting\Controller\Setting::isDefined('podcastHomeContent')) {
$status = \Cx\Core\Setting\Controller\Setting::add('podcastHomeContent', $setHomeContent, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('podcastHomeContent', $setHomeContent);
$status = \Cx\Core\Setting\Controller\Setting::update('podcastHomeContent');
}
}
return $status;
}
示例12: updateSettings
/**
* Validate and save new settings.
*
* @global ADONewConnection
* @global array
* @global array
*/
function updateSettings()
{
global $objDatabase, $_ARRAYLANG;
//update settings table and write new settings file for /config
if (isset($_POST['set_homecontent_submit'])) {
//update settings
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
if (isset($_POST['setHomeContent'])) {
$setHomeContent = intval($_POST['setHomeContent']);
if (!\Cx\Core\Setting\Controller\Setting::isDefined('forumHomeContent')) {
\Cx\Core\Setting\Controller\Setting::add('forumHomeContent', $setHomeContent, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('forumHomeContent', $setHomeContent);
\Cx\Core\Setting\Controller\Setting::update('forumHomeContent');
}
}
if (isset($_POST['setTagContent'])) {
$forumTagContent = intval($_POST['setTagContent']);
if (!\Cx\Core\Setting\Controller\Setting::isDefined('forumTagContent')) {
\Cx\Core\Setting\Controller\Setting::add('forumTagContent', $forumTagContent, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('forumTagContent', $forumTagContent);
\Cx\Core\Setting\Controller\Setting::update('forumTagContent');
}
}
}
foreach ($_POST['setvalue'] as $intSetId => $strSetValue) {
switch ($intSetId) {
case 1:
$strSetValue = intval($strSetValue) == 0 ? $this->_arrSettings['thread_paging'] : intval($strSetValue);
break;
case 2:
$strSetValue = intval($strSetValue) == 0 ? $this->_arrSettings['posting_paging'] : intval($strSetValue);
break;
case 3:
$strSetValue = intval($strSetValue) == 0 ? $this->_arrSettings['latest_entries_count'] : intval($strSetValue);
break;
default:
}
$objDatabase->Execute(' UPDATE ' . DBPREFIX . 'module_forum_settings
SET value="' . addslashes($strSetValue) . '"
WHERE id=' . intval($intSetId) . '
LIMIT 1');
}
$this->_arrSettings = $this->createSettingsArray();
// $objCache = new \CacheManager();
// $objCache->deleteAllFiles();
$this->_strOkMessage = $_ARRAYLANG['TXT_FORUM_SETTINGS_UPDATE_OK'];
}
示例13: updateSettings
/**
* Update settings and write them to the database
*
* @global object $objDatabase
* @global object $objTemplate
* @global array $_ARRAYLANG
*/
function updateSettings()
{
global $objDatabase, $objTemplate, $_ARRAYLANG, $_CONFIG;
if (!isset($_POST['frmSettings_Submit'])) {
return;
}
\Cx\Core\Setting\Controller\Setting::init('Config', 'cache', 'Yaml');
\Cx\Core\Setting\Controller\Setting::set('cacheEnabled', $_POST['cachingStatus']);
\Cx\Core\Setting\Controller\Setting::set('cacheExpiration', intval($_POST['cachingExpiration']));
\Cx\Core\Setting\Controller\Setting::set('cacheUserCache', contrexx_input2db($_POST['usercache']));
\Cx\Core\Setting\Controller\Setting::set('cacheOPCache', contrexx_input2db($_POST['opcache']));
\Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheDbStatus', contrexx_input2db($_POST['cacheDbStatus']));
\Cx\Core\Setting\Controller\Setting::set('cacheVarnishStatus', contrexx_input2db($_POST['cacheVarnishStatus']));
if (!empty($_POST['memcacheSettingIp']) || !empty($_POST['memcacheSettingPort'])) {
$settings = json_encode(array('ip' => !empty($_POST['memcacheSettingIp']) ? contrexx_input2raw($_POST['memcacheSettingIp']) : '127.0.0.1', 'port' => !empty($_POST['memcacheSettingPort']) ? intval($_POST['memcacheSettingPort']) : '11211'));
\Cx\Core\Setting\Controller\Setting::set('cacheUserCacheMemcacheConfig', $settings);
}
if (!empty($_POST['varnishCachingIp']) || !empty($_POST['varnishCachingPort'])) {
$settings = json_encode(array('ip' => !empty($_POST['varnishCachingIp']) ? contrexx_input2raw($_POST['varnishCachingIp']) : '127.0.0.1', 'port' => !empty($_POST['varnishCachingPort']) ? intval($_POST['varnishCachingPort']) : '8080'));
\Cx\Core\Setting\Controller\Setting::set('cacheProxyCacheVarnishConfig', $settings);
}
\Cx\Core\Setting\Controller\Setting::updateAll();
$this->arrSettings = $this->getSettings();
$this->initUserCaching();
// reinit user caches (especially memcache)
$this->initOPCaching();
// reinit opcaches
$this->getActivatedCacheEngines();
$this->clearCache($this->getOpCacheEngine());
if (!count($this->objSettings->strErrMessage)) {
$objTemplate->SetVariable('CONTENT_OK_MESSAGE', $_ARRAYLANG['TXT_SETTINGS_UPDATED']);
} else {
$objTemplate->SetVariable('CONTENT_STATUS_MESSAGE', implode("<br />\n", $this->objSettings->strErrMessage));
}
}
示例14: _saveSettings
/**
* Save the settings associated to the block system
*
* @access private
* @param array $arrSettings
*/
function _saveSettings($arrSettings)
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
if (isset($arrSettings['blockStatus'])) {
if (!\Cx\Core\Setting\Controller\Setting::isDefined('blockStatus')) {
\Cx\Core\Setting\Controller\Setting::add('blockStatus', $arrSettings['blockStatus'], 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('blockStatus', $arrSettings['blockStatus']);
\Cx\Core\Setting\Controller\Setting::update('blockStatus');
}
}
if (isset($arrSettings['blockRandom'])) {
if (!\Cx\Core\Setting\Controller\Setting::isDefined('blockRandom')) {
\Cx\Core\Setting\Controller\Setting::add('blockRandom', $arrSettings['blockRandom'], 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
} else {
\Cx\Core\Setting\Controller\Setting::set('blockRandom', $arrSettings['blockRandom']);
\Cx\Core\Setting\Controller\Setting::update('blockRandom');
}
}
}
示例15: save
/**
*
* @global type $_POST
* @param \settingsManager $settingsManager
* @param \ADONewConnection $objDb
*/
public function save($objDb)
{
\Cx\Core\Setting\Controller\Setting::init('Config', 'license', 'Yaml');
// core
if (!\Cx\Core\Setting\Controller\Setting::isDefined('installationId')) {
\Cx\Core\Setting\Controller\Setting::add('installationId', $this->getInstallationId(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'core');
} else {
\Cx\Core\Setting\Controller\Setting::set('installationId', $this->getInstallationId());
}
// license
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseKey')) {
\Cx\Core\Setting\Controller\Setting::add('licenseKey', $this->getLicenseKey(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseKey', $this->getLicenseKey());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseState')) {
\Cx\Core\Setting\Controller\Setting::add('licenseState', $this->getState(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseState', $this->getState());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseValidTo')) {
\Cx\Core\Setting\Controller\Setting::add('licenseValidTo', $this->getValidToDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATETIME, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseValidTo', $this->getValidToDate());
}
// we must encode the serialized objects to prevent that non-ascii chars
// get written into the config/settings.php file
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseMessage')) {
\Cx\Core\Setting\Controller\Setting::add('licenseMessage', base64_encode(serialize($this->getMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseMessage', base64_encode(serialize($this->getMessages())));
}
// see comment above why we encode the serialized data here
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licensePartner')) {
\Cx\Core\Setting\Controller\Setting::add('licensePartner', base64_encode(serialize($this->getPartner())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licensePartner', base64_encode(serialize($this->getPartner())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseCustomer')) {
\Cx\Core\Setting\Controller\Setting::add('licenseCustomer', base64_encode(serialize($this->getCustomer())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseCustomer', base64_encode(serialize($this->getCustomer())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('upgradeUrl')) {
\Cx\Core\Setting\Controller\Setting::add('upgradeUrl', $this->getUpgradeUrl(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('upgradeUrl', $this->getUpgradeUrl());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseCreatedAt')) {
\Cx\Core\Setting\Controller\Setting::add('licenseCreatedAt', $this->getCreatedAtDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATE, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseCreatedAt', $this->getCreatedAtDate());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseDomains')) {
\Cx\Core\Setting\Controller\Setting::add('licenseDomains', base64_encode(serialize($this->getRegisteredDomains())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseDomains', base64_encode(serialize($this->getRegisteredDomains())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('availableComponents')) {
\Cx\Core\Setting\Controller\Setting::add('availableComponents', base64_encode(serialize($this->getAvailableComponents())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('availableComponents', base64_encode(serialize($this->getAvailableComponents())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('dashboardMessages')) {
\Cx\Core\Setting\Controller\Setting::add('dashboardMessages', base64_encode(serialize($this->getDashboardMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('dashboardMessages', base64_encode(serialize($this->getDashboardMessages())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('isUpgradable')) {
\Cx\Core\Setting\Controller\Setting::add('isUpgradable', $this->isUpgradable() ? 'on' : 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:Activated,off:Deactivated', 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('isUpgradable', $this->isUpgradable() ? 'on' : 'off');
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneMessages')) {
\Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneMessages', base64_encode(serialize($this->getGrayzoneMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseGrayzoneMessages', base64_encode(serialize($this->getGrayzoneMessages())));
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneTime')) {
\Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneTime', $this->getGrayzoneTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseGrayzoneTime', $this->getGrayzoneTime());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseLockTime')) {
\Cx\Core\Setting\Controller\Setting::add('licenseLockTime', $this->getFrontendLockTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseLockTime', $this->getFrontendLockTime());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseUpdateInterval')) {
\Cx\Core\Setting\Controller\Setting::add('licenseUpdateInterval', $this->getRequestInterval(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
} else {
\Cx\Core\Setting\Controller\Setting::set('licenseUpdateInterval', $this->getRequestInterval());
}
if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseFailedUpdate')) {
//.........这里部分代码省略.........