/**
  * Runs all the methods to store the various settings from the shop
  * admin zone.
  *
  * Note that not all of the methods report their success or failure back
  * here (yet), so you should not rely on the result of this method.
  * @return  mixed               True on success, false on failure,
  *                              null if no change is detected.
  * @static
  */
 static function storeSettings()
 {
     global $_CORELANG;
     self::$success = true;
     self::$changed = false;
     self::storeGeneral();
     self::storeCurrencies();
     self::storePayments();
     self::storeShipping();
     self::storeCountries();
     $result = Zones::store_from_post();
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     self::storeVat();
     if (\Cx\Core\Setting\Controller\Setting::changed()) {
         self::$changed = true;
         if (\Cx\Core\Setting\Controller\Setting::updateAll() === false) {
             return false;
         }
     }
     if (self::$changed) {
         return self::$success ? \Message::ok($_CORELANG['TXT_CORE_SETTING_STORED_SUCCESSFULLY']) : \Message::error($_CORELANG['TXT_CORE_SETTING_ERROR_STORING']);
     }
     return null;
 }
 /**
  * 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));
     }
 }
 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();
 }
示例#4
0
 /**
  * settings general
  * 
  * @global <type> $objDatabase
  * @global <type> $_ARRAYLANG
  * @return true
  */
 public function showGeneralSettings()
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->addBlockfile('CRM_SETTINGS_FILE', 'settings_block', 'module_' . $this->moduleNameLC . '_settings_general.html');
     $this->_pageTitle = $_ARRAYLANG['TXT_CRM_SETTINGS'];
     $objTpl = $this->_objTpl;
     $objTpl->hideBlock('insufficient-warning');
     if (isset($_POST['save'])) {
         $settings = array('allow_pm' => !$this->isPmInstalled ? 0 : (isset($_POST['allowPm']) ? 1 : 0), 'create_user_account' => isset($_POST['create_user_account']) ? 1 : 0, 'customer_default_language_backend' => isset($_POST['default_language_backend']) ? (int) $_POST['default_language_backend'] : 0, 'customer_default_language_frontend' => isset($_POST['default_language_frontend']) ? (int) $_POST['default_language_frontend'] : 0, 'default_user_group' => isset($_POST['default_user_group']) ? (int) $_POST['default_user_group'] : 0, 'user_account_mantatory' => isset($_POST['user_account_mantatory']) ? 1 : 0, 'emp_default_user_group' => isset($_POST['emp_default_user_group']) ? (int) $_POST['emp_default_user_group'] : 0, 'default_country_value' => isset($_POST['default_country_value']) ? (int) $_POST['default_country_value'] : 0, 'user_profile_attribute_industry_type' => isset($_POST['user_profile_attribute_industry_type']) ? $_POST['user_profile_attribute_industry_type'] : 0, 'user_profile_attribute_company_size' => isset($_POST['user_profile_attribute_company_size']) ? $_POST['user_profile_attribute_company_size'] : 0, 'user_profile_attribute_customer_type' => isset($_POST['user_profile_attribute_customer_type']) ? $_POST['user_profile_attribute_customer_type'] : 0);
         \Cx\Core\Setting\Controller\Setting::init('Crm', 'config');
         // save industry_typ and company_size user profil attribut id
         \Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_industry_type', $settings['user_profile_attribute_industry_type']);
         \Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_company_size', $settings['user_profile_attribute_company_size']);
         \Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_customer_type', $settings['user_profile_attribute_customer_type']);
         \Cx\Core\Setting\Controller\Setting::updateAll();
         foreach ($settings as $settings_var => $settings_val) {
             $updateAllowPm = 'UPDATE ' . DBPREFIX . 'module_' . $this->moduleNameLC . '_settings
                                 SET `setvalue` = "' . contrexx_input2db($settings_val) . '"
                                     WHERE setname = "' . $settings_var . '"';
             $objDatabase->Execute($updateAllowPm);
         }
         $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_CHANGES_UPDATED_SUCCESSFULLY'];
     }
     $settings = $this->getSettings();
     if (isset($settings['emp_default_user_group']) && !empty($settings['emp_default_user_group'])) {
         $groupId = array();
         $groupValidation = $objDatabase->Execute("SELECT group_id FROM " . DBPREFIX . "access_group_static_ids WHERE access_id = {$this->customerAccessId}");
         if ($groupValidation && $groupValidation->RecordCount() > 0) {
             while (!$groupValidation->EOF) {
                 array_push($groupId, (int) $groupValidation->fields['group_id']);
                 $groupValidation->MoveNext();
             }
         }
         if (!in_array($settings['emp_default_user_group'], $groupId)) {
             $objTpl->setVariable('CRM_INSUFFICIENT_WARNING', $_ARRAYLANG['TXT_CRM_SETTINGS_EMPLOYEE_ACCESS_ERROR']);
             $objTpl->touchBlock('insufficient-warning');
         }
     }
     if ($settings['create_user_account'] == 1) {
         $this->createProfilAttributes();
     }
     $objLanguages = $objDatabase->Execute("SELECT `id`, `name`, `frontend`, `backend` FROM " . DBPREFIX . "languages WHERE frontend = 1 OR backend =1");
     if ($objLanguages) {
         $objTpl->setVariable(array('CRM_LANG_NAME' => $_ARRAYLANG['TXT_CRM_STANDARD'], 'CRM_LANG_VALUE' => 0, 'CRM_LANG_SELECTED' => $settings['customer_default_language_frontend'] == 0 ? "selected='selected'" : ''));
         $objTpl->parse("langFrontend");
         $objTpl->setVariable(array('CRM_LANG_NAME' => $_ARRAYLANG['TXT_CRM_STANDARD'], 'CRM_LANG_VALUE' => 0, 'CRM_LANG_SELECTED' => $settings['customer_default_language_backend'] == 0 ? "selected='selected'" : ''));
         $objTpl->parse("langBackend");
         while (!$objLanguages->EOF) {
             if ($objLanguages->fields['frontend']) {
                 $objTpl->setVariable(array('CRM_LANG_NAME' => contrexx_raw2xhtml($objLanguages->fields['name']), 'CRM_LANG_VALUE' => (int) $objLanguages->fields['id'], 'CRM_LANG_SELECTED' => $settings['customer_default_language_frontend'] == $objLanguages->fields['id'] ? "selected='selected'" : ''));
                 $objTpl->parse("langFrontend");
             }
             if ($objLanguages->fields['backend']) {
                 $objTpl->setVariable(array('CRM_LANG_NAME' => contrexx_raw2xhtml($objLanguages->fields['name']), 'CRM_LANG_VALUE' => (int) $objLanguages->fields['id'], 'CRM_LANG_SELECTED' => $settings['customer_default_language_backend'] == $objLanguages->fields['id'] ? "selected='selected'" : ''));
                 $objTpl->parse("langBackend");
             }
             $objLanguages->MoveNext();
         }
     }
     $objFWUser = \FWUser::getFWUserObject();
     $objGroupIds = $objFWUser->objGroup->getGroups($filter = array('is_active' => true));
     if ($objGroupIds) {
         while (!$objGroupIds->EOF) {
             $objTpl->setVariable(array('CRM_GROUP_NAME' => contrexx_raw2xhtml($objGroupIds->getName()), 'CRM_GROUP_VALUE' => (int) $objGroupIds->getId(), 'CRM_USER_GROUP_SELECTED' => $settings['default_user_group'] == $objGroupIds->getId() ? "selected='selected'" : ''));
             $objTpl->parse("userGroup");
             $objGroupIds->next();
         }
     }
     //show backend groups
     $objBackendGroupIds = $objFWUser->objGroup->getGroups($filter = array('is_active' => true, 'type' => 'backend'));
     if ($objBackendGroupIds) {
         while (!$objBackendGroupIds->EOF) {
             $objTpl->setVariable(array('CRM_GROUP_NAME' => contrexx_raw2xhtml($objBackendGroupIds->getName()), 'CRM_GROUP_VALUE' => (int) $objBackendGroupIds->getId(), 'CRM_USER_GROUP_SELECTED' => $settings['emp_default_user_group'] == $objBackendGroupIds->getId() ? "selected='selected'" : ''));
             $objTpl->parse("empUserGroup");
             $objBackendGroupIds->next();
         }
     }
     $countries = $this->getCountry();
     foreach ($countries as $key => $value) {
         if ($settings['default_country_value'] == $value['id']) {
             $selected = "selected='selected'";
         } else {
             $selected = '';
         }
         $objTpl->setVariable(array('CRM_DEFAULT_COUNTRY_ID' => (int) $value['id'], 'CRM_DEFAULT_COUNTRY_NAME' => contrexx_raw2xhtml($value['name']), 'CRM_DEFAULT_COUNTRY_SELECTED' => $selected));
         $objTpl->parse("default_country");
     }
     $objTpl->setVariable(array('CRM_ALLOW_PM' => $settings['allow_pm'] ? "checked='checked'" : '', 'CRM_CREATE_ACCOUNT_USER' => $settings['create_user_account'] ? "checked='checked'" : '', 'CRM_ACCOUNT_MANTATORY' => $settings['user_account_mantatory'] ? "checked='checked'" : ''));
     $objTpl->setVariable(array('TXT_CRM_ALLOW_PM' => $_ARRAYLANG["TXT_CRM_ALLOW_PM"], 'TXT_CRM_DEFAULT_COUNTRY' => $_ARRAYLANG["TXT_CRM_DEFAULT_COUNTRY"], 'TXT_CRM_SELECT_COUNTRY' => $_ARRAYLANG["TXT_CRM_SELECT_COUNTRY"], 'TXT_CRM_CUSTOMERS' => $_ARRAYLANG['TXT_CRM_CUSTOMERS'], 'TXT_CRM_LANGUAGE' => $_ARRAYLANG['TXT_CRM_TITLE_LANGUAGE'], 'TXT_CRM_BACKEND' => $_ARRAYLANG['TXT_CRM_BACKEND'], 'TXT_CRM_FRONTEND' => $_ARRAYLANG['TXT_CRM_FRONTEND'], 'TXT_CRM_ALLOW_PM_EXPLANATION' => $_ARRAYLANG["TXT_CRM_ALLOW_PM_EXPLANATION"], 'TXT_CRM_SAVE' => $_ARRAYLANG['TXT_CRM_SAVE'], 'TXT_CRM_DEFAULT_LANGUAGE' => $_ARRAYLANG['TXT_CRM_DEFAULT_LANGUAGE'], 'TXT_CRM_DEFAULT_USER_GROUP' => $_ARRAYLANG['TXT_CRM_DEFAULT_USER_GROUP'], 'TXT_CRM_CREATE_ACCOUNT_USER' => $_ARRAYLANG['TXT_CRM_CREATE_ACCOUNT_USER'], 'TXT_CRM_CREATE_ACCOUNT_USER_TIP' => $_ARRAYLANG['TXT_CRM_CREATE_ACCOUNT_USER_TIP'], 'TXT_CRM_PROFILE_ATTRIBUT_INDUSTRY_TYPE' => $_ARRAYLANG['TXT_CRM_PROFILE_ATTRIBUT_INDUSTRY_TYPE'], 'TXT_CRM_PROFILE_ATTRIBUT_COMPANY_SIZE' => $_ARRAYLANG['TXT_CRM_PROFILE_ATTRIBUT_COMPANY_SIZE'], 'TXT_CRM_PROFILE_ATTRIBUT_CUSTOMER_TYPE' => $_ARRAYLANG['TXT_CRM_PROFILE_ATTRIBUT_CUSTOMER_TYPE'], 'MODULE_NAME' => $this->moduleName, 'TXT_CRM_NOTES' => $_ARRAYLANG['TXT_CRM_NOTES'], 'TXT_CRM_GENERAL' => $_ARRAYLANG['TXT_CRM_GENERAL'], 'TXT_CRM_CURRENCY' => $_ARRAYLANG['TXT_CRM_CURRENCY'], 'TXT_CRM_CUSTOMER_TYPES' => $_ARRAYLANG['TXT_CRM_CUSTOMER_TYPES'], 'TXT_CRM_EMPLOYEE' => $_ARRAYLANG['TXT_CRM_SETTINGS_EMPLOYEE'], 'TXT_CRM_EMP_DEFAULT_USER_GROUP' => $_ARRAYLANG['TXT_CRM_EMP_DEFAULT_USER_GROUP'], 'TXT_CRM_SETTINGS_EMP_TOOLTIP' => $_ARRAYLANG['TXT_CRM_SETTINGS_EMPLOYEE_TOOLTIP'], 'TXT_CRM_ACCOUNT_ARE_MANTATORY' => $_ARRAYLANG['TXT_CRM_ACCOUNT_ARE_MANTATORY'], 'CRM_PROFILE_ATTRIBUT_INDUSTRY_TYPE_DROPDOWN' => \Html::getSelect('user_profile_attribute_industry_type', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_industry_type', 'Crm'), '', '', 'tabindex="0" style="width: 270px;"'), 'CRM_PROFILE_ATTRIBUT_COMPANY_SIZE_DROPDOWN' => \Html::getSelect('user_profile_attribute_company_size', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_company_size', 'Crm'), '', '', 'tabindex="0" style="width: 270px;"'), 'CRM_PROFILE_ATTRIBUT_CUSTOMER_TYPE_DROPDOWN' => \Html::getSelect('user_profile_attribute_customer_type', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_type', 'Crm'), '', '', 'tabindex="0" style="width: 270px;"')));
     if (!$this->isPmInstalled) {
         $objTpl->hideBlock('allowPmModule');
     }
 }
示例#5
0
 /**
  *
  * @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')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseFailedUpdate', $this->getFirstFailedUpdateTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseFailedUpdate', $this->getFirstFailedUpdateTime());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseSuccessfulUpdate')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseSuccessfulUpdate', $this->getLastSuccessfulUpdateTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseSuccessfulUpdate', $this->getLastSuccessfulUpdateTime());
     }
     // release
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsEdition')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsEdition', $this->getEditionName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsEdition', $this->getEditionName());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsVersion')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsVersion', $this->getVersion()->getNumber(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsVersion', $this->getVersion()->getNumber());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsCodeName')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsCodeName', $this->getVersion()->getCodeName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsCodeName', $this->getVersion()->getCodeName());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsStatus')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsStatus', $this->getVersion()->getState(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsStatus', $this->getVersion()->getState());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsReleaseDate')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsReleaseDate', $this->getVersion()->getReleaseDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATE, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsReleaseDate', $this->getVersion()->getReleaseDate());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsName')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsName', $this->getVersion()->getName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsName', $this->getVersion()->getName());
     }
     \Cx\Core\Setting\Controller\Setting::updateAll();
     $query = '
         UPDATE
             ' . DBPREFIX . 'modules
         SET
             `is_licensed` = \'0\' , 
             `additional_data` = NULL
         WHERE
             `distributor` = \'Cloudrexx AG\'
     ';
     $objDb->Execute($query);
     $query = '
         UPDATE
             ' . DBPREFIX . 'modules
         SET
             `is_licensed` = \'1\'
         WHERE
             `name` IN(\'' . implode('\', \'', $this->getLegalComponentsList()) . '\')
     ';
     $objDb->Execute($query);
     //Save legal components additional data values.
     if (!\FWValidator::isEmpty($this->getLegalComponentsAdditionalData())) {
         foreach ($this->getLegalComponentsAdditionalData() as $componentName => $additionalData) {
             if (empty($componentName)) {
                 continue;
             }
             $query = "\n                    UPDATE \n                        " . DBPREFIX . "modules\n                    SET \n                        `additional_data` = '" . contrexx_raw2db(json_encode($additionalData)) . "'\n                    WHERE \n                        `name` = '" . contrexx_raw2db($componentName) . "'\n                    ";
             $objDb->Execute($query);
         }
     }
 }
示例#6
0
 public function testUpdateAllInFileSystem()
 {
     \DBG::log('*** testUpdateAllInFileSystem ***');
     $this->addValuesFileSystem();
     Setting::init('MultiSiteTest', null, 'FileSystem');
     Setting::set('key6.2', 'changedvalue6.2');
     Setting::set('key7.1', 'changedvalue7.1');
     Setting::set('key7.2', 'changedvalue7.2');
     Setting::updateAll();
     Setting::init('MultiSiteTest', null, 'FileSystem');
     $this->assertEquals('changedvalue6.2', Setting::getValue('key6.2'));
     $this->assertEquals('changedvalue7.1', Setting::getValue('key7.1'));
     $this->assertEquals('changedvalue7.2', Setting::getValue('key7.2'));
     $this->deleteValuesFileSystem();
 }
示例#7
0
 /**
  * Handles and fixes database related problems
  * @return  boolean             False.  Always.
  */
 static function errorHandler()
 {
     \Yellowpay::errorHandler();
     // Also calls \Cx\Core\Setting\Controller\Setting::errorHandler()
     foreach (array('postfinance_accepted_payment_methods' => 'yellowpay_accepted_payment_methods', 'postfinance_shop_id' => 'yellowpay_shopid', 'postfinance_hash_signature_in' => 'yellowpay_hashseed', 'postfinance_hash_signature_out' => 'yellowpay_hashseed', 'postfinance_authorization_type' => 'yellowpay_authorization', 'postfinance_use_testserver' => 'yellowpay_use_testserver') as $to => $from) {
         $value = EgovLibrary::GetSettings($from);
         //DBG::log("EgovLibrary::errorHandler(): Copying from $from, value $value, to $to<br />");
         \Cx\Core\Setting\Controller\Setting::set($to, $value);
     }
     \Cx\Core\Setting\Controller\Setting::updateAll();
 }
示例#8
0
 /**
  * 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));
     }
 }