/**
  * 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');
         }
     }
 }
 /**
  * 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')));
 }
 /**
  * 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
0
 /**
  * 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());
     if (!\Cx\Core\Setting\Controller\Setting::update('usergroup_id_customer')) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup ID for customers");
     }
     $group_id_customer = $objGroup->getId();
     $objGroup = null;
     $group_id_reseller = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_reseller', 'Shop');
     if ($group_id_reseller) {
         $objGroup = \FWUser::getFWUserObject()->objGroup->getGroup($group_id_reseller);
     }
     if (!$objGroup || $objGroup->EOF) {
         $objGroup = \FWUser::getFWUserObject()->objGroup->getGroups(array('group_name' => 'Shop Wiederverkäufer'));
     }
     if (!$objGroup || $objGroup->EOF) {
         $objGroup = new \UserGroup();
         $objGroup->setActiveStatus(true);
         $objGroup->setDescription('Online Shop Wiederverkäufer');
         $objGroup->setName('Shop Wiederverkäufer');
         $objGroup->setType('frontend');
     }
     if (!$objGroup) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to create UserGroup for resellers");
     }
     //DBG::log("Customer::errorHandler(): Made reseller usergroup: ".var_export($objGroup, true));
     if (!$objGroup->store() || !$objGroup->getId()) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup for resellers");
     }
     \Cx\Core\Setting\Controller\Setting::set('usergroup_id_reseller', $objGroup->getId());
     if (!\Cx\Core\Setting\Controller\Setting::update('usergroup_id_reseller')) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup ID for resellers");
     }
     $group_id_reseller = $objGroup->getId();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     $query = "\n            SELECT `customer`.`customerid`,\n                   `customer`.`prefix`, `customer`.`firstname`,\n                   `customer`.`lastname`,\n                   `customer`.`company`, `customer`.`address`,\n                   `customer`.`city`, `customer`.`zip`,\n                   `customer`.`country_id`,\n                   `customer`.`phone`, `customer`.`fax`,\n                   `customer`.`email`,\n                   `customer`.`username`, `customer`.`password`,\n                   `customer`.`company_note`,\n                   `customer`.`is_reseller`,\n                   `customer`.`customer_status`, `customer`.`register_date`,\n                   `customer`.`group_id`\n              FROM `{$table_name_old}` AS `customer`\n             ORDER BY `customer`.`customerid` ASC";
     $objResult = \Cx\Lib\UpdateUtil::sql($query);
     while (!$objResult->EOF) {
         $old_customer_id = $objResult->fields['customerid'];
         if (empty($objResult->fields['email'])) {
             $objResult->fields['email'] = $objResult->fields['username'];
         }
         $email = $objResult->fields['email'];
         $objUser = \FWUser::getFWUserObject()->objUser->getUsers(array('email' => array(0 => $email)));
         // TODO: See whether a User with that username (but different e-mail address) exists!
         $objUser_name = \FWUser::getFWUserObject()->objUser->getUsers(array('username' => array(0 => $objResult->fields['username'])));
         if ($objUser && $objUser_name) {
             $objUser = $objUser_name;
         }
         $objCustomer = null;
         if ($objUser) {
             $objCustomer = self::getById($objUser->getId());
         }
         if (!$objCustomer) {
             $lang_id = Order::getLanguageIdByCustomerId($old_customer_id);
             $lang_id = \FWLanguage::getLangIdByIso639_1($lang_id);
             if (!$lang_id) {
                 $lang_id = $default_lang_id;
             }
             $objCustomer = new Customer();
             if (preg_match('/^(?:frau|mad|mme|signora|miss)/i', $objResult->fields['prefix'])) {
                 $objCustomer->gender('gender_female');
             } elseif (preg_match('/^(?:herr|mon|signore|mister|mr)/i', $objResult->fields['prefix'])) {
                 $objCustomer->gender('gender_male');
                 //                } else {
                 // Other "genders", like "family", "thing", or "it" won't be matched
                 // and are left on "gender_unknown".
                 //DBG::log("*** Prefix {$objResult->fields['prefix']}, UNKNOWN GENDER!");
             }
             //DBG::log("Prefix {$objResult->fields['prefix']}, made gender ".$objCustomer->gender());
             $objCustomer->company($objResult->fields['company']);
             $objCustomer->firstname($objResult->fields['firstname']);
             $objCustomer->lastname($objResult->fields['lastname']);
             $objCustomer->address($objResult->fields['address']);
             $objCustomer->city($objResult->fields['city']);
             $objCustomer->zip($objResult->fields['zip']);
             $objCustomer->country_id($objResult->fields['country_id']);
             $objCustomer->phone($objResult->fields['phone']);
             $objCustomer->fax($objResult->fields['fax']);
             $objCustomer->email($objResult->fields['email']);
             $objCustomer->companynote($objResult->fields['company_note']);
             $objCustomer->active($objResult->fields['customer_status']);
             // Handled by a UserGroup now, see below
             //$objCustomer->setResellerStatus($objResult->fields['is_reseller']);
             $objCustomer->register_date($objResult->fields['register_date']);
             $objCustomer->group_id($objResult->fields['group_id']);
             // NOTE: Mind that the User class has been modified to accept e-mail addresses
             // as usernames!
             $objCustomer->username($objResult->fields['username']);
             // Copy the md5 hash of the password!
             $objCustomer->password = $objResult->fields['password'];
             $objCustomer->setFrontendLanguage($lang_id);
         }
         if ($objResult->fields['is_reseller']) {
             $objCustomer->setGroups($objCustomer->getAssociatedGroupIds() + array($group_id_reseller));
             //DBG::log("Customer::errorHandler(): Added reseller: ".$objCustomer->id());
         } else {
             $objCustomer->setGroups($objCustomer->getAssociatedGroupIds() + array($group_id_customer));
             //DBG::log("Customer::errorHandler(): Added customer: ".$objCustomer->id());
         }
         if (!$objCustomer->store()) {
             //DBG::log(var_export($objCustomer, true));
             throw new \Cx\Lib\Update_DatabaseException("Failed to migrate existing Customer ID " . $old_customer_id . " to Users (Messages: " . join(', ', $objCustomer->error_msg) . ")");
         }
         // Update the Orders table with the new Customer ID.
         // Note that we use the ambiguous old customer ID that may
         // coincide with a new User ID, so to prevent inconsistencies,
         // migrated Orders are marked as such.
         $query = "\n                UPDATE `{$table_order_name}`\n                   SET `customer_id`=" . $objCustomer->id() . ",\n                       `migrated`=1\n                 WHERE `customer_id`={$old_customer_id}\n                   AND `migrated`=0";
         \Cx\Lib\UpdateUtil::sql($query);
         // Drop migrated
         $query = "\n                DELETE FROM `{$table_name_old}`\n                 WHERE `customerid`={$old_customer_id}";
         \Cx\Lib\UpdateUtil::sql($query);
         $objResult->MoveNext();
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return false;
         }
     }
     // Remove the flag, it's no longer needed.
     // (You could also verify that all records have been migrated by
     // querying them with "[...] WHERE `migrated`=0", which *MUST* result
     // in an empty recordset.  This is left as an exercise for the reader.)
     $query = "\n            ALTER TABLE `{$table_order_name}`\n             DROP `migrated`";
     \Cx\Lib\UpdateUtil::sql($query);
     \Cx\Lib\UpdateUtil::drop_table($table_name_old);
     //DBG::log("Updated Customer table and related stuff");
     // Always
     return false;
 }
예제 #5
0
 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
0
 /**
  * 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();
 }
 /**
  * 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
                 $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_backend='" . contrexx_addslashes($value) . "' WHERE id=" . intval($id));
             }
             if ($googleMapIsEnabled && $addressElements < 4) {
                 $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active_backend='1' WHERE name='country'");
                 $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active_backend='1' WHERE name='zip'");
                 $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active_backend='1' WHERE name='street'");
                 $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active_backend='1' WHERE name='city'");
                 $this->strOkMessage = $_ARRAYLANG['TXT_DIRECTORY_GOOGLEMAP_REQUIRED_FIELDS_MISSING'];
             }
         }
         //get post data
         if ($_POST['setSort'] != "") {
             foreach ($_POST['setSort'] as $id => $sort) {
                 $sort = $sort;
                 //update settings
                 $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET sort=" . intval($sort) . " WHERE id=" . intval($id));
             }
         }
         //get post data
         if ($_POST['setSearch'] != "") {
             foreach ($_POST['setSearch'] as $id => $search) {
                 //update settings
                 $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET is_search=" . $search . " WHERE id=" . intval($id));
             }
         }
         //get post data
         if ($_POST['setRequired'] != "") {
             foreach ($_POST['setRequired'] as $id => $required) {
                 //update settings
                 $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET is_required=" . $required . " WHERE id=" . intval($id));
             }
         }
         //get post data
         if ($_POST['setSpezFields'] != "") {
             foreach ($_POST['setSpezFields'] as $id => $value) {
                 //update settings
                 $objReult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET title='" . contrexx_addslashes($value) . "' WHERE id=" . intval($id));
             }
         }
         //get dropdown data
         foreach ($_POST['setDropdown'] as $id => $value) {
             //update settings
             $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings SET setvalue='" . contrexx_addslashes($value) . "' WHERE setid=" . intval($id));
         }
         //update settings
         $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1' WHERE name='title'");
         if ($this->descriptionFieldRequired()) {
             $objResult = $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_inputfields SET active='1', is_required='1', active_backend='1' WHERE name='description'");
         }
         $this->strOkMessage = $_ARRAYLANG['TXT_DIR_SETTINGS_SUCCESFULL_SAVE'];
     }
     if ($_POST['inputValue']['zoom'] != "") {
         $googleStartPoint = intval($_POST['inputValue']['lat']);
         $googleStartPoint .= '.' . intval($_POST['inputValue']['lat_fraction']);
         $googleStartPoint .= ':' . intval($_POST['inputValue']['lon']);
         $googleStartPoint .= '.' . intval($_POST['inputValue']['lon_fraction']);
         $googleStartPoint .= ':' . intval($_POST['inputValue']['zoom']);
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_directory_settings SET setvalue='" . $googleStartPoint . "' WHERE setname='googlemap_start_location'");
     }
 }
예제 #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('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
0
 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
0
 /**
  * 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
0
 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
0
 /**
  * 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
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));
     }
 }
예제 #14
0
 /**
  * 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
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);
         }
     }
 }
예제 #16
0
 /**
  * Updates the providers and write changes to the setting db.
  * The provider array has to be two dimensional.
  *
  * array(
  *     ProviderName1 => array(provider_app_id, provider_app_secret),
  *     ProviderName1 => array(provider_app_id, provider_app_secret),
  * )
  *
  * @static
  * @param array $providers the new provider data
  */
 public static function updateProviders($providers)
 {
     \Cx\Core\Setting\Controller\Setting::init('Access', 'sociallogin');
     \Cx\Core\Setting\Controller\Setting::set('providers', json_encode($providers));
     \Cx\Core\Setting\Controller\Setting::update('providers');
 }
예제 #17
0
 /**
  * Validate and save the settings from $_POST into the database.
  *
  * @global    ADONewConnection
  * @global     array
  */
 function saveSettings()
 {
     global $objDatabase, $_ARRAYLANG;
     //On-Off-Settings can only be 0 or 1.
     $arrOnOffValues = array('frmSettings_CommentsAllow' => 'data_comments_activated', 'frmSettings_CommentsAllowAnonymous' => 'data_comments_anonymous', 'frmSettings_CommentsAutoActivate' => 'data_comments_autoactivate', 'frmSettings_CommentsNotification' => 'data_comments_notification', 'frmSettings_VotingAllow' => 'data_voting_activated', 'frmSettings_BlockActivated' => 'data_block_activated', 'frmSettings_RssActivated' => 'data_rss_activated');
     //Integer-Settings [0 .. infinite]
     $arrIntegerValues = array('frmSettings_CommentsTimeout' => 'data_comments_timeout', 'frmSettings_GeneralIntroduction' => 'data_general_introduction', 'frmSettings_BlockNumberOfMessages' => 'data_block_messages', 'frmSettings_RssNumberOfMessages' => 'data_rss_messages', 'frmSettings_RssNumberOfComments' => 'data_rss_comments', 'frmSettings_TagHitlist' => 'data_tags_hitlist', 'frmSettings_frontendPage' => 'data_target_cmd', 'frmSettings_shadowbox_width' => 'data_shadowbox_width', 'frmSettings_shadowbox_height' => 'data_shadowbox_height');
     // String Settings
     $arrTextValues = array('frmSettings_templateCategory' => 'data_template_category', 'frmSettings_templateEntry' => 'data_template_entry', 'frmSettings_templateShadowbox' => 'data_template_shadowbox');
     //Enum-Settings, must be a value of a given list
     $arrEnumValues = array('frmSettings_CommentsEditor' => 'data_comments_editor', 'frmSettings_action' => 'data_entry_action');
     $arrEnumPossibilities = array('frmSettings_CommentsEditor' => 'wysiwyg,textarea', 'frmSettings_action' => 'content,overlaybox');
     foreach ($_POST as $strKey => $strValue) {
         if (key_exists($strKey, $arrOnOffValues)) {
             $objDatabase->Execute('    UPDATE ' . DBPREFIX . 'module_data_settings
                                         SET `value` = "' . intval($strValue) . '"
                                         WHERE `name` = "' . $arrOnOffValues[$strKey] . '"
                                     ');
         }
         if (key_exists($strKey, $arrIntegerValues)) {
             $objDatabase->Execute('    UPDATE ' . DBPREFIX . 'module_data_settings
                                         SET `value` = "' . abs(intval($strValue)) . '"
                                         WHERE `name` = "' . $arrIntegerValues[$strKey] . '"
                                     ');
         }
         if (key_exists($strKey, $arrEnumValues)) {
             $arrSplit = explode(',', $arrEnumPossibilities[$strKey]);
             if (in_array($strValue, $arrSplit)) {
                 $objDatabase->Execute('    UPDATE ' . DBPREFIX . 'module_data_settings
                                             SET `value` = "' . $strValue . '"
                                             WHERE `name` = "' . $arrEnumValues[$strKey] . '"
                                         ');
             }
         }
         if (key_exists($strKey, $arrTextValues)) {
             $objDatabase->Execute(" UPDATE " . DBPREFIX . "module_data_settings\n                                            SET `value` = '" . contrexx_addslashes(trim($strValue)) . "'\n                                            WHERE `name`= '" . $arrTextValues[$strKey] . "'\n                                            ");
         }
     }
     \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
     \Cx\Core\Setting\Controller\Setting::set('dataUseModule', isset($_POST['frmSettings_useDatalist']) ? 1 : 0);
     \Cx\Core\Setting\Controller\Setting::storeFromPost();
     $this->_arrSettings = $this->createSettingsArray();
     $this->_strOkMessage = $_ARRAYLANG['TXT_DATA_SETTINGS_SAVE_SUCCESSFULL'];
 }
예제 #18
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');
     }
 }
예제 #19
0
 function _saveSettings()
 {
     global $_CORELANG;
     $feedNewsMLStatus = isset($_POST['feedSettingsUseNewsML']) ? intval($_POST['feedSettingsUseNewsML']) : 0;
     \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
     if (isset($feedNewsMLStatus)) {
         if (!\Cx\Core\Setting\Controller\Setting::isDefined('feedNewsMLStatus')) {
             \Cx\Core\Setting\Controller\Setting::add('feedNewsMLStatus', $feedNewsMLStatus, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
         } else {
             \Cx\Core\Setting\Controller\Setting::set('feedNewsMLStatus', $feedNewsMLStatus);
             \Cx\Core\Setting\Controller\Setting::update('feedNewsMLStatus');
         }
     }
     $_SESSION['strOkMessage'] = $_CORELANG['TXT_SETTINGS_UPDATED'];
 }
예제 #20
0
 private function deactivateSetting($config)
 {
     if (\Permission::checkAccess(17, 'static', true)) {
         \Cx\Core\Setting\Controller\Setting::init('Config', 'administrationArea', 'Yaml');
         if (!\Cx\Core\Setting\Controller\Setting::isDefined($config)) {
             $status = \Cx\Core\Setting\Controller\Setting::add($config, 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'administrationArea');
         } else {
             \Cx\Core\Setting\Controller\Setting::set($config, 'off');
             $status = \Cx\Core\Setting\Controller\Setting::update($config);
         }
         if ($status) {
             die('success');
         }
     }
     die('error');
 }
예제 #21
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();
 }
예제 #22
0
 function _smtpDefaultAccount()
 {
     global $_ARRAYLANG;
     $id = intval($_GET['id']);
     $arrSmtp = \SmtpSettings::getSmtpAccount($id, false);
     if ($arrSmtp || ($id = 0) !== false) {
         \Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml');
         \Cx\Core\Setting\Controller\Setting::set('coreSmtpServer', $id);
         if (\Cx\Core\Setting\Controller\Setting::update('coreSmtpServer')) {
             $this->strOkMessage .= sprintf($_ARRAYLANG['TXT_SETTINGS_DEFAULT_SMTP_CHANGED'], htmlentities($arrSmtp['name'], ENT_QUOTES, CONTREXX_CHARSET)) . '<br />';
         } else {
             $this->strErrMessage[] = $_ARRAYLANG['TXT_SETTINGS_CHANGE_DEFAULT_SMTP_FAILED'];
         }
     }
 }
예제 #23
0
 /**
  * Update CodeBase
  * 
  * @param string $newCodeBaseVersion   latest codeBase version
  * @param string $installationRootPath installationRoot path
  * @param string $oldCodeBaseVersion   old codeBase version
  */
 public function updateCodeBase($newCodeBaseVersion, $installationRootPath, $oldCodeBaseVersion = '')
 {
     //change installation root
     $objConfigData = new \Cx\Lib\FileSystem\File(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteConfigPath() . '/configuration.php');
     $configData = $objConfigData->getData();
     if (!\FWValidator::isEmpty($oldCodeBaseVersion)) {
         $matches = array();
         preg_match('/\\$_PATHCONFIG\\[\'ascms_installation_root\'\\] = \'(.*?)\';/', $configData, $matches);
         $installationRootPath = str_replace($newCodeBaseVersion, $oldCodeBaseVersion, $matches[1]);
         $newCodeBaseVersion = $oldCodeBaseVersion;
     }
     $newConfigData = preg_replace('/\\$_PATHCONFIG\\[\'ascms_installation_root\'\\] = \'.*?\';/', '$_PATHCONFIG[\'ascms_installation_root\'] = \'' . $installationRootPath . '\';', $configData);
     $objConfigData->write($newConfigData);
     //change code base
     \Cx\Core\Setting\Controller\Setting::init('Config', '', 'Yaml');
     \Cx\Core\Setting\Controller\Setting::set('coreCmsVersion', $newCodeBaseVersion);
     \Cx\Core\Setting\Controller\Setting::update('coreCmsVersion');
 }
예제 #24
0
 /**
  * Save the news settings
  * @access private
  * @global ADONewConnection
  * @global array
  * @global array
  * @see createRSS()
  */
 function _saveSettings()
 {
     global $objDatabase, $_CONFIG, $_ARRAYLANG;
     // Store settings
     if (isset($_GET['act']) && $_GET['act'] == 'settings' && isset($_POST['store'])) {
         // save multilanguage news_feed_title and news_feed_description
         $this->storeFeedLocales('news_feed_title', $_POST['newsFeedTitle']);
         $this->storeFeedLocales('news_feed_description', $_POST['newsFeedDescription']);
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings\n                              SET value='" . intval($_POST['newsFeedStatus']) . "'\n                            WHERE name = 'news_feed_status'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings\n                              SET value='" . contrexx_input2db($_POST['newsFeedImage']) . "'\n                            WHERE name='news_feed_image'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings\n                              SET value='" . intval($_POST['headlinesLimit']) . "'\n                            WHERE name = 'news_headlines_limit'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . intval($_POST['recentNewsMessageLimit']) . "' WHERE name = 'recent_news_message_limit'");
         // Notify-user. 0 = disabled.
         $this->_store_settings_item('news_notify_user', intval($_POST['newsNotifySelectedUser']));
         // Notify-Group. 0 = disabled.
         $this->_store_settings_item('news_notify_group', intval($_POST['newsNotifySelectedGroup']));
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='1' WHERE name = 'news_settings_activated'");
         $submitNews = isset($_POST['newsSubmitNews']) ? intval($_POST['newsSubmitNews']) : 0;
         $submitNewsCommunity = isset($_POST['newsSubmitOnlyCommunity']) ? intval($_POST['newsSubmitOnlyCommunity']) : 0;
         $activateSubmittedNews = isset($_POST['newsActivateSubmittedNews']) ? intval($_POST['newsActivateSubmittedNews']) : 0;
         $newsCommentsAllow = isset($_POST['newsCommentsAllow']) ? intval($_POST['newsCommentsAllow']) : 0;
         $newsCommentsAllowAnonymous = isset($_POST['newsCommentsAllowAnonymous']) ? intval($_POST['newsCommentsAllowAnonymous']) : 0;
         $newsCommentsAutoActivate = isset($_POST['newsCommentsAutoActivate']) ? intval($_POST['newsCommentsAutoActivate']) : 0;
         $newsCommentsNotification = isset($_POST['newsCommentsNotification']) ? intval($_POST['newsCommentsNotification']) : 0;
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $submitNews . "' WHERE name='news_submit_news'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $submitNewsCommunity . "' WHERE name='news_submit_only_community'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $activateSubmittedNews . "' WHERE name='news_activate_submitted_news'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . !empty($_POST['newsMessageProtection']) . "' WHERE name='news_message_protection'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . !empty($_POST['newsMessageProtectionRestricted']) . "' WHERE name='news_message_protection_restricted'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $newsCommentsAllow . "' WHERE name='news_comments_activated'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $newsCommentsAllowAnonymous . "' WHERE name='news_comments_anonymous'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $newsCommentsAutoActivate . "' WHERE name='news_comments_autoactivate'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $newsCommentsNotification . "' WHERE name='news_comments_notification'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . (!empty($_POST['newsCommentsTimeout']) ? abs(intval($_POST['newsCommentsTimeout'])) : 30) . "' WHERE name='news_comments_timeout'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . !empty($_POST['newsUseTop']) . "' WHERE name='news_use_top'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . !empty($_POST['newsUseTeaserText']) . "' WHERE name = 'news_use_teaser_text'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . !empty($_POST['newsUseTags']) . "' WHERE name = 'news_use_tags'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . !empty($_POST['useRelatedNews']) . "' WHERE name = 'use_related_news'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . !empty($_POST['newsUseTypes']) . "' WHERE name = 'news_use_types'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . !empty($_POST['newsUseTop']) . "' WHERE name='news_use_top'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . (!empty($_POST['newsTopDays']) ? intval($_POST['newsTopDays']) : 10) . "' WHERE name = 'news_top_days'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . (!empty($_POST['newsTopLimit']) ? intval($_POST['newsTopLimit']) : 10) . "' WHERE name = 'news_top_limit'");
         $newsFilterPublisher = isset($_POST['newsFilterPublisher']) ? intval($_POST['newsFilterPublisher']) : 0;
         $newsFilterAuthor = isset($_POST['newsFilterAuthor']) ? intval($_POST['newsFilterAuthor']) : 0;
         $assignedPublisherGroups = isset($_POST['newsAssignedPublisherGroups']) && $newsFilterPublisher ? implode(',', contrexx_input2db($_POST['newsAssignedPublisherGroups'])) : 0;
         $assignedAuthorGroups = isset($_POST['newsAssignedAuthorGroups']) && $newsFilterAuthor ? implode(',', contrexx_input2db($_POST['newsAssignedAuthorGroups'])) : 0;
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $assignedPublisherGroups . "' WHERE name = 'news_assigned_publisher_groups'");
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . $assignedAuthorGroups . "' WHERE name = 'news_assigned_author_groups'");
         // save default teasers
         $defaultTeasers = array();
         if (isset($_POST['newsDefaultTeaserSelected'])) {
             foreach ($_POST['newsDefaultTeaserSelected'] as $key => $value) {
                 if (!empty($value)) {
                     $defaultTeasers[] = intval($key);
                 }
             }
         }
         $objDatabase->Execute("UPDATE " . DBPREFIX . "module_news_settings SET value='" . implode(";", $defaultTeasers) . "' WHERE name='news_default_teasers'");
         \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
         $newsUseTeasers = isset($_POST['newsUseTeasers']) ? intval($_POST['newsUseTeasers']) : 0;
         if (!\Cx\Core\Setting\Controller\Setting::isDefined('newsTeasersStatus')) {
             \Cx\Core\Setting\Controller\Setting::add('newsTeasersStatus', $newsUseTeasers, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
         } else {
             \Cx\Core\Setting\Controller\Setting::set('newsTeasersStatus', $newsUseTeasers);
             \Cx\Core\Setting\Controller\Setting::update('newsTeasersStatus');
         }
         $this->strOkMessage = $_ARRAYLANG['TXT_NEWS_SETTINGS_SAVED'];
         $this->getSettings();
         $this->createRSS();
     }
 }
예제 #25
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();
 }
예제 #26
0
 /**
  * Global save function for saving the settings into database
  *
  * @return null
  */
 function _saveSettings()
 {
     global $_ARRAYLANG, $objDatabase;
     foreach ($_POST['settings'] as $name => $value) {
         if (is_array($value)) {
             $value = implode(',', $value);
         }
         $query = "UPDATE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings\n                         SET value = '" . contrexx_addslashes($value) . "'\n                       WHERE name = '" . contrexx_addslashes($name) . "'";
         $objResult = $objDatabase->Execute($query);
     }
     if (isset($_POST['settings']['headlinesStatus'])) {
         \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
         $headLinesStatusIntval = intval($_POST['settings']['headlinesStatus']);
         if (!\Cx\Core\Setting\Controller\Setting::isDefined('calendarheadlines')) {
             \Cx\Core\Setting\Controller\Setting::add('calendarheadlines', $headLinesStatusIntval, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
         } else {
             \Cx\Core\Setting\Controller\Setting::set('calendarheadlines', $headLinesStatusIntval);
             \Cx\Core\Setting\Controller\Setting::update('calendarheadlines');
         }
     }
     if ($objResult !== false) {
         $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_SETTINGS_SUCCESSFULLY_EDITED'];
     } else {
         $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_SETTINGS_CORRUPT_EDITED'];
     }
 }
예제 #27
0
 /**
  * Save the last access id
  * @param intval $id
  */
 private function updateAccessId($id)
 {
     \Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml');
     if (isset($id)) {
         if (!\Cx\Core\Setting\Controller\Setting::isDefined('lastAccessId')) {
             \Cx\Core\Setting\Controller\Setting::add('lastAccessId', $id, 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, '', 'core');
         } else {
             \Cx\Core\Setting\Controller\Setting::set('lastAccessId', $id);
             \Cx\Core\Setting\Controller\Setting::update('lastAccessId');
         }
     }
 }