/** * 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'); } } }
/** * 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; } }
/** * 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; }
/** * * @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); } } }
/** * Show on overview of the mail templates for the given section and group * * If empty, the $limit defaults to the * "numof_mailtemplate_per_page_backend" setting for the given section * and group. * @param string $section The section * @param string $group The group * @param integer $limit The optional limit for the number * of templates to be shown * @param string $act The action of the mail template * default set to mailtemplate_overview * @return \Cx\Core\Html\Sigma The template object */ static function overview($section, $group, $limit = 0, $useDefaultActs = true, $act = 'mailtemplate_edit') { global $_CORELANG; $objTemplateLocal = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/MailTemplate/View/Template/Generic'); $objTemplateLocal->setErrorHandling(PEAR_ERROR_DIE); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTemplateLocal); if (!$objTemplateLocal->loadTemplateFile('Overview.html')) { die("Failed to load template Overview.html"); } if (empty($section) || empty($group)) { \Message::error($_CORELANG['TXT_CORE_MAILTEMPLATE_ERROR_NO_SECTION_OR_GROUP']); return false; } if (empty($limit)) { \Cx\Core\Setting\Controller\Setting::init($section, $group); $limit = \Cx\Core\Setting\Controller\Setting::getValue('numof_mailtemplate_per_page_backend', $section); // TODO: TEMPORARY if (is_null($limit)) { $limit = 25; \Cx\Core\Setting\Controller\Setting::add('numof_mailtemplate_per_page_backend', $limit, 1001, 'text', '', $group); } } $uri = \Html::getRelativeUri_entities(); $tab_index = \Cx\Core\Setting\Controller\Setting::tab_index(); \Html::replaceUriParameter($uri, 'active_tab=' . $tab_index); \Html::replaceUriParameter($uri, 'userFrontendLangId=' . FRONTEND_LANG_ID); //echo("Made uri for sorting: ".htmlentities($uri)."<br />"); \Html::stripUriParam($uri, 'key'); \Html::stripUriParam($uri, 'delete_mailtemplate_key'); $uri_edit = $uri_overview = $uri; //echo("Made uri for sorting: ".htmlentities($uri)."<br />"); if ($useDefaultActs) { \Html::stripUriParam($uri, 'act'); \Html::replaceUriParameter($uri_edit, 'act=mailtemplate_edit'); \Html::replaceUriParameter($uri_overview, 'act=mailtemplate_overview'); } $objSorting = new \Sorting($uri_overview, array('name' => $_CORELANG['TXT_CORE_MAILTEMPLATE_NAME'], 'key' => $_CORELANG['TXT_CORE_MAILTEMPLATE_KEY'], 'html' => $_CORELANG['TXT_CORE_MAILTEMPLATE_IS_HTML'], 'protected' => $_CORELANG['TXT_CORE_MAILTEMPLATE_PROTECTED']), true, 'order_mailtemplate'); $count = 0; // Template titles are shown in the current language only, no need // (and no way either) to load them all. Names are shown in the // currently active frontend language only. $pagingParameterName = $section . '_' . $group; $arrTemplates = self::getArray($section, FRONTEND_LANG_ID, $objSorting->getOrder(), \Paging::getPosition($pagingParameterName), $limit, $count); $arrLanguageName = \FWLanguage::getNameArray(); $objTemplateLocal->setGlobalVariable($_CORELANG + array('CORE_MAILTEMPLATE_NAME' => $objSorting->getHeaderForField('name'), 'CORE_MAILTEMPLATE_KEY' => $objSorting->getHeaderForField('key'), 'CORE_MAILTEMPLATE_HTML' => $objSorting->getHeaderForField('html'), 'CORE_MAILTEMPLATE_PROTECTED' => $objSorting->getHeaderForField('protected'), 'PAGING' => \Paging::get($uri_overview, $_CORELANG['TXT_CORE_MAILTEMPLATE_PAGING'], $count, $limit, true, null, $pagingParameterName), 'URI_BASE' => $uri, 'URI_EDIT' => $uri_edit, 'CORE_MAILTEMPLATE_COLSPAN' => 5 + count($arrLanguageName))); foreach ($arrLanguageName as $language_name) { $objTemplateLocal->setVariable('MAILTEMPLATE_LANGUAGE_HEADER', $language_name); $objTemplateLocal->parse('core_mailtemplate_language_header'); } if (empty($arrTemplates)) { \Message::information($_CORELANG['TXT_CORE_MAILTEMPLATE_WARNING_NONE']); $arrTemplates = array(); } // Load *all* templates and languages self::init($section); $i = 0; foreach ($arrTemplates as $arrTemplate) { $key = $arrTemplate['key']; $objTemplateLocal->setVariable(array('MAILTEMPLATE_ROWCLASS' => ++$i % 2 + 1, 'MAILTEMPLATE_PROTECTED' => \Html::getCheckmark($arrTemplate['protected']), 'MAILTEMPLATE_HTML' => \Html::getCheckmark($arrTemplate['html']), 'MAILTEMPLATE_NAME' => '<a href="' . $uri_edit . '&key=' . urlencode($key) . '">' . contrexx_raw2xhtml($arrTemplate['name']) . '</a>', 'MAILTEMPLATE_KEY' => $arrTemplate['key'], 'MAILTEMPLATE_FUNCTIONS' => \Html::getBackendFunctions(array('copy' => $uri_edit . '&copy=1&key=' . $arrTemplate['key'], 'edit' => $uri_edit . '&key=' . $arrTemplate['key'], 'delete' => $arrTemplate['protected'] ? '' : $uri_overview . '&delete_mailtemplate_key=' . $arrTemplate['key'] . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code()), array('delete' => $_CORELANG['TXT_CORE_MAILTEMPLATE_DELETE_CONFIRM'])))); foreach (array_keys($arrLanguageName) as $lang_id) { $available = isset(self::$arrTemplates[$lang_id][$key]) && self::$arrTemplates[$lang_id][$key]['available']; $title = $available ? $_CORELANG['TXT_CORE_MAILTEMPLATE_EDIT'] : $_CORELANG['TXT_CORE_MAILTEMPLATE_NEW']; $icon = '<a href="' . CONTREXX_DIRECTORY_INDEX . "?cmd={$section}&act=" . $act . '&key=' . $key . '&userFrontendLangId=' . $lang_id . '"' . ' title="' . $title . '">' . '<img src="../core/Core/View/Media/icons/' . ($available ? 'edit.gif' : 'add.png') . '"' . ' width="16" height="16" alt="' . $title . '" border="0" /></a>'; $objTemplateLocal->setVariable('MAILTEMPLATE_LANGUAGE', $icon); $objTemplateLocal->parse('core_mailtemplate_language_column'); } $objTemplateLocal->parse('core_mailtemplate_row'); } return $objTemplateLocal; }
/** * Fixes database errors. * * Also migrates settings from the old Shop settings table to \Cx\Core\Setting. * @return boolean False. Always. * @throws Cx\Lib\Update_DatabaseException */ static function errorHandler() { global $_CONFIGURATION; // ShopSettings \Cx\Core\Setting\Controller\Setting::errorHandler(); \Cx\Core\Setting\Controller\Setting::init('Shop', 'config'); $table_name = DBPREFIX . 'module_shop_config'; $i = 0; if (\Cx\Lib\UpdateUtil::table_exist($table_name)) { // Migrate all entries using the \Cx\Core\Setting\Controller\Setting class $query = "\n SELECT `name`, `value`, `status`\n FROM " . DBPREFIX . "module_shop_config\n ORDER BY `id` ASC"; $objResult = \Cx\Lib\UpdateUtil::sql($query); if (!$objResult) { throw new \Cx\Lib\Update_DatabaseException('Failed to query old Shop settings', $query); } while (!$objResult->EOF) { $name = $objResult->fields['name']; $value = $objResult->fields['value']; $status = $objResult->fields['status']; $name_status = null; switch ($name) { // OBSOLETE case 'tax_default_id': case 'tax_enabled': case 'tax_included': case 'tax_number': // Ignore, do not migrate! $name = null; break; // VALUE ONLY (RE: arrConfig\[.*?\]\[.value.\]) // VALUE ONLY (RE: arrConfig\[.*?\]\[.value.\]) case 'confirmation_emails': $name = 'email_confirmation'; break; case 'country_id': case 'datatrans_merchant_id': case 'datatrans_request_type': break; case 'datatrans_status': $name = 'datatrans_active'; break; case 'datatrans_use_testserver': case 'email': case 'fax': case 'orderitems_amount_max': case 'paypal_default_currency': case 'postfinance_mobile_ijustwanttotest': case 'postfinance_mobile_sign': case 'postfinance_mobile_status': case 'postfinance_mobile_webuser': case 'product_sorting': case 'saferpay_finalize_payment': case 'saferpay_window_option': break; case 'shop_address': case 'shop_company': case 'shop_show_products_default': case 'shop_thumbnail_max_height': case 'shop_thumbnail_max_width': case 'shop_thumbnail_quality': case 'shop_weight_enable': $name = preg_replace('/^shop_/', '', $name); break; case 'telephone': case 'vat_default_id': case 'vat_enabled_foreign_customer': case 'vat_enabled_foreign_reseller': case 'vat_enabled_home_customer': case 'vat_enabled_home_reseller': case 'vat_included_foreign_customer': case 'vat_included_foreign_reseller': case 'vat_included_home_customer': case 'vat_included_home_reseller': case 'vat_number': case 'vat_other_id': break; case 'yellowpay_accepted_payment_methods': case 'yellowpay_authorization_type': case 'yellowpay_hash_seed': case 'yellowpay_hash_signature_in': case 'yellowpay_hash_signature_out': case 'yellowpay_use_testserver': $name = preg_replace('/^yellowpay(.*)$/', 'postfinance$1', $name); break; case 'yellowpay_id': // Obsolete $name = null; break; // VALUE & STATUS // VALUE & STATUS case 'paypal_account_email': $name_status = 'paypal_active'; break; case 'saferpay_id': $name_status = 'saferpay_active'; break; case 'yellowpay_shop_id': $name = 'postfinance_shop_id'; $name_status = 'postfinance_active'; break; // STATUS ONLY (RE: arrConfig\[.*?\]\[.status.\]) // STATUS ONLY (RE: arrConfig\[.*?\]\[.status.\]) case 'payment_lsv_status': $name_status = 'payment_lsv_active'; $name = null; break; case 'saferpay_use_test_account': $name_status = $name; $name = null; break; } if ($name) { if (\Cx\Core\Setting\Controller\Setting::getValue($name, 'Shop') === NULL && !\Cx\Core\Setting\Controller\Setting::add($name, $value, ++$i)) { throw new \Cx\Lib\Update_DatabaseException("Failed to add \\Cx\\Core\\Setting entry for '{$name}'"); } } if ($name_status) { if (\Cx\Core\Setting\Controller\Setting::getValue($name_status, 'Shop') === NULL && !\Cx\Core\Setting\Controller\Setting::add($name_status, $status, ++$i)) { throw new \Cx\Lib\Update_DatabaseException("Failed to add \\Cx\\Core\\Setting entry for status '{$name_status}'"); } } $objResult->MoveNext(); } } \Cx\Core\Setting\Controller\Setting::init('Shop', 'config'); // Try adding any that just *might* be missing for *any* reason \Cx\Core\Setting\Controller\Setting::add('email', '*****@*****.**', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('email_confirmation', '*****@*****.**', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('company', 'Comvation AG', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('address', 'Burgstrasse 20', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('country_id', 204, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('telephone', '+4133 2266000', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('fax', '+4133 2266001', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_number', '12345678', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_enabled_foreign_customer', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_enabled_foreign_reseller', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_enabled_home_customer', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_enabled_home_reseller', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_included_foreign_customer', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_included_foreign_reseller', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_included_home_customer', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_included_home_reseller', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_default_id', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('vat_other_id', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('weight_enable', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('show_products_default', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('product_sorting', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, '0:TXT_SHOP_PRODUCT_SORTING_ALPHABETIC,' . '1:TXT_SHOP_PRODUCT_SORTING_INDIVIDUAL,' . '2:TXT_SHOP_PRODUCT_SORTING_PRODUCTCODE', 'config'); \Cx\Core\Setting\Controller\Setting::add('thumbnail_max_width', 140, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('thumbnail_max_height', 140, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('thumbnail_quality', 90, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('saferpay_id', '1234', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('saferpay_active', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('saferpay_use_test_account', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('saferpay_finalize_payment', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('saferpay_window_option', 2, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('paypal_active', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('paypal_account_email', '*****@*****.**', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('paypal_default_currency', 'CHF', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); // Also see Yellowpay.class \Cx\Core\Setting\Controller\Setting::add('payrexx_instance_name', 'Instanz Name', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT); \Cx\Core\Setting\Controller\Setting::add('payrexx_api_secret', 'API Secret', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT); \Cx\Core\Setting\Controller\Setting::add('payrexx_active', '0', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1'); \Cx\Core\Setting\Controller\Setting::add('postfinance_shop_id', 'Ihr Kontoname', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT); \Cx\Core\Setting\Controller\Setting::add('postfinance_active', '0', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1'); \Cx\Core\Setting\Controller\Setting::add('postfinance_authorization_type', 'SAL', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, 'RES:Reservation,SAL:Verkauf'); // OBSOLETE // As it appears that in_array(0, $array) is true for each non-empty // $array, indices for the entries must be numbered starting at 1. // $arrPayments = array(); // foreach (self::$arrKnownPaymentMethod as $index => $name) { // $arrPayments[$index] = $name; // } // \Cx\Core\Setting\Controller\Setting::add('postfinance_accepted_payment_methods', '', ++$i, // \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOXGROUP, // \Cx\Core\Setting\Controller\Setting::joinValues($arrPayments)); \Cx\Core\Setting\Controller\Setting::add('postfinance_hash_signature_in', 'Mindestens 16 Buchstaben, Ziffern und Zeichen', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT); \Cx\Core\Setting\Controller\Setting::add('postfinance_hash_signature_out', 'Mindestens 16 Buchstaben, Ziffern und Zeichen', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT); \Cx\Core\Setting\Controller\Setting::add('postfinance_use_testserver', '1', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1'); \Cx\Core\Setting\Controller\Setting::add('postfinance_mobile_webuser', '1234', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('postfinance_mobile_sign', 'geheimer_schlüssel', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('postfinance_mobile_ijustwanttotest', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('postfinance_mobile_status', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('datatrans_merchant_id', '1234', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('datatrans_active', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('datatrans_request_type', 'CAA', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('datatrans_use_testserver', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('payment_lsv_active', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); // New for V3.0 // Disable jsCart by default. $useJsCart = '0'; // Activate it in case it was activated in config/configuration.php if (isset($_CONFIGURATION['custom']['shopJsCart']) && $_CONFIGURATION['custom']['shopJsCart']) { $useJsCart = '1'; } \Cx\Core\Setting\Controller\Setting::add('use_js_cart', $useJsCart, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX); // Disable shopnavbar on other pages by default. $shopnavbar = '0'; // Activate it in case it was activated in config/configuration.php if (isset($_CONFIGURATION['custom']['shopnavbar']) && $_CONFIGURATION['custom']['shopnavbar']) { $shopnavbar = '1'; } \Cx\Core\Setting\Controller\Setting::add('shopnavbar_on_all_pages', $shopnavbar, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX); // New for v3.1.0 \Cx\Core\Setting\Controller\Setting::add('orderitems_amount_min', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); // New for v2.2(?) \Cx\Core\Setting\Controller\Setting::add('orderitems_amount_max', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); // New for v2.3 \Cx\Core\Setting\Controller\Setting::add('register', ShopLibrary::REGISTER_MANDATORY, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, \Cx\Core\Setting\Controller\Setting::joinValues(array(ShopLibrary::REGISTER_MANDATORY, ShopLibrary::REGISTER_OPTIONAL, ShopLibrary::REGISTER_NONE)), 'config'); \Cx\Core\Setting\Controller\Setting::add('numof_products_per_page_frontend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('history_maximum_age_days', 730, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('numof_orders_per_page_frontend', 10, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('numof_orders_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('numof_customers_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('numof_manufacturers_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('numof_mailtemplate_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('numof_coupon_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('usergroup_id_customer', 0, 341, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN_USERGROUP, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('usergroup_id_reseller', 0, 342, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN_USERGROUP, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('user_profile_attribute_customer_group_id', 0, 351, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN_USER_CUSTOM_ATTRIBUTE, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('user_profile_attribute_notes', 0, 352, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN_USER_CUSTOM_ATTRIBUTE, null, 'config'); \Cx\Core\Setting\Controller\Setting::add('num_categories_per_row', 4, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); // Note that the Settings *MUST* be reinited after adding new entries! // Add more new/missing settings here \Cx\Lib\UpdateUtil::drop_table($table_name); // Always return false; }
/** * 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'"); } }
/** * Fixes database errors. * * @global array $_CONFIG * * @return boolean * @throws SupportException */ static function errorHandler() { global $_CONFIG; try { \Cx\Core\Setting\Controller\Setting::init('Support', '', 'Yaml'); //setup group \Cx\Core\Setting\Controller\Setting::init('Support', 'setup', 'Yaml'); if (!\Cx\Core\Setting\Controller\Setting::isDefined('faqUrl') && !\Cx\Core\Setting\Controller\Setting::add('faqUrl', 'https://www.cloudrexx.com/FAQ', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'setup')) { throw new SupportException("Failed to add Setting entry for faq url"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('recipientMailAddress') && !\Cx\Core\Setting\Controller\Setting::add('recipientMailAddress', $_CONFIG['coreAdminEmail'], 2, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'setup')) { throw new SupportException("Failed to add Setting entry for recipient mail address"); } } catch (\Exception $e) { \DBG::msg($e->getMessage()); } // Always! return false; }
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'); }
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; }
/** * 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']; }
/** * Fixes database errors. * * @return boolean * @throws GeoIpException */ static function initConfig() { try { \Cx\Core\Setting\Controller\Setting::init('GeoIp', '', 'Yaml'); //setup config \Cx\Core\Setting\Controller\Setting::init('GeoIp', 'config', 'Yaml'); if (!\Cx\Core\Setting\Controller\Setting::isDefined('serviceStatus') && !\Cx\Core\Setting\Controller\Setting::add('serviceStatus', 0, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'config')) { throw new GeoIpException("Failed to add Setting entry for GeoIp Service Status"); } } catch (\Exception $e) { \DBG::msg($e->getMessage()); } // Always! return false; }
/** * Handles errors ocurring in this class * * Applies to the section (module) SettingsDb has been initialized with. * In particular, tries to add missing Settings using the defaults. * However, you will have to set them to their correct values after this. * Note that you *MUST* call \Cx\Core\Setting\Controller\Setting::init() using the proper section * and group parameters beforehand. Otherwise, no settings will be added. */ static function errorHandler() { // Yellowpay \Cx\Core\Setting\Controller\Setting::errorHandler(); // You *MUST* call this yourself beforehand, using the proper section! //\Cx\Core\Setting\Controller\Setting::init('Shop', 'config'); // Signature: ($name, $value, $ord, $type, $values, $key) \Cx\Core\Setting\Controller\Setting::add('postfinance_shop_id', 'Ihr Kontoname', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT); \Cx\Core\Setting\Controller\Setting::add('postfinance_active', '0', 2, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1'); \Cx\Core\Setting\Controller\Setting::add('postfinance_authorization_type', 'SAL', 3, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, 'RES:Reservation,SAL:Verkauf'); // OBSOLETE // As it appears that in_array(0, $array) is true for each non-empty // $array, indices for the entries must be numbered starting at 1. // $arrPayments = array(); // foreach (self::$arrKnownPaymentMethod as $index => $name) { // $arrPayments[$index] = $name; // } // \Cx\Core\Setting\Controller\Setting::add('postfinance_accepted_payment_methods', '', // 4, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOXGROUP, // \Cx\Core\Setting\Controller\Setting::joinValues($arrPayments)); \Cx\Core\Setting\Controller\Setting::add('postfinance_hash_signature_in', 'Mindestens 16 Buchstaben, Ziffern und Zeichen', 5, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT); \Cx\Core\Setting\Controller\Setting::add('postfinance_hash_signature_out', 'Mindestens 16 Buchstaben, Ziffern und Zeichen', 6, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT); \Cx\Core\Setting\Controller\Setting::add('postfinance_use_testserver', '1', 7, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1'); // Always return false; }
/** * 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'); } } }
static function view_settings_vat() { global $_ARRAYLANG; // TODO: Temporary. Remove in release with working update // Returns NULL on missing entries even when other settings are properly loaded $vat_number = \Cx\Core\Setting\Controller\Setting::getValue('vat_number', 'Shop'); if (is_null($vat_number)) { \Cx\Core\Setting\Controller\Setting::add('vat_number', '12345678', 1, 'text', '', 'config'); } // Shop general settings template self::$objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_vat.html'); self::$objTemplate->setGlobalVariable($_ARRAYLANG); $enabled_home_customer = \Cx\Core\Setting\Controller\Setting::getValue('vat_enabled_home_customer', 'Shop'); $included_home_customer = \Cx\Core\Setting\Controller\Setting::getValue('vat_included_home_customer', 'Shop'); $enabled_home_reseller = \Cx\Core\Setting\Controller\Setting::getValue('vat_enabled_home_reseller', 'Shop'); $included_home_reseller = \Cx\Core\Setting\Controller\Setting::getValue('vat_included_home_reseller', 'Shop'); $enabled_foreign_customer = \Cx\Core\Setting\Controller\Setting::getValue('vat_enabled_foreign_customer', 'Shop'); $included_foreign_customer = \Cx\Core\Setting\Controller\Setting::getValue('vat_included_foreign_customer', 'Shop'); $enabled_foreign_reseller = \Cx\Core\Setting\Controller\Setting::getValue('vat_enabled_foreign_reseller', 'Shop'); $included_foreign_reseller = \Cx\Core\Setting\Controller\Setting::getValue('vat_included_foreign_reseller', 'Shop'); self::$objTemplate->setVariable(array('SHOP_VAT_NUMBER' => \Cx\Core\Setting\Controller\Setting::getValue('vat_number', 'Shop'), 'SHOP_VAT_CHECKED_HOME_CUSTOMER' => $enabled_home_customer ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_DISPLAY_HOME_CUSTOMER' => $enabled_home_customer ? 'block' : 'none', 'SHOP_VAT_SELECTED_HOME_CUSTOMER_INCLUDED' => $included_home_customer ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_VAT_SELECTED_HOME_CUSTOMER_EXCLUDED' => $included_home_customer ? '' : \Html::ATTRIBUTE_SELECTED, 'SHOP_VAT_CHECKED_HOME_RESELLER' => $enabled_home_reseller ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_DISPLAY_HOME_RESELLER' => $enabled_home_reseller ? 'block' : 'none', 'SHOP_VAT_SELECTED_HOME_RESELLER_INCLUDED' => $included_home_reseller ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_VAT_SELECTED_HOME_RESELLER_EXCLUDED' => $included_home_reseller ? '' : \Html::ATTRIBUTE_SELECTED, 'SHOP_VAT_CHECKED_FOREIGN_CUSTOMER' => $enabled_foreign_customer ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_DISPLAY_FOREIGN_CUSTOMER' => $enabled_foreign_customer ? 'block' : 'none', 'SHOP_VAT_SELECTED_FOREIGN_CUSTOMER_INCLUDED' => $included_foreign_customer ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_VAT_SELECTED_FOREIGN_CUSTOMER_EXCLUDED' => $included_foreign_customer ? '' : \Html::ATTRIBUTE_SELECTED, 'SHOP_VAT_CHECKED_FOREIGN_RESELLER' => $enabled_foreign_reseller ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_DISPLAY_FOREIGN_RESELLER' => $enabled_foreign_reseller ? 'block' : 'none', 'SHOP_VAT_SELECTED_FOREIGN_RESELLER_INCLUDED' => $included_foreign_reseller ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_VAT_SELECTED_FOREIGN_RESELLER_EXCLUDED' => $included_foreign_reseller ? '' : \Html::ATTRIBUTE_SELECTED, 'SHOP_VAT_DEFAULT_MENUOPTIONS' => Vat::getMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('vat_default_id', 'Shop'), true), 'SHOP_VAT_OTHER_MENUOPTIONS' => Vat::getMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('vat_other_id', 'Shop'), true))); // start value added tax (VAT) display // fill in the VAT fields of the template $i = 0; foreach (Vat::getArray() as $vat_id => $arrVat) { self::$objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$i % 2 + 1), 'SHOP_VAT_ID' => $vat_id, 'SHOP_VAT_RATE' => $arrVat['rate'], 'SHOP_VAT_CLASS' => $arrVat['class'])); self::$objTemplate->parse('vatRow'); } }
/** * * This code creates the crm setting for company size, customerType and industryType if the do not exist and * also creates the profile attributes and links them with the new settings in the crm * * @global <type> $_CORELANG * @global <type> $_ARRAYLANG * @autor Adrian Berger <*****@*****.**> * @return void */ function createProfilAttributes() { global $_CORELANG, $_ARRAYLANG; $objFWUser = \FWUser::getFWUserObject(); $objUser = $objFWUser->objUser; $objInit = \Env::get('init'); // save lang id and arrayLangs, because they will be replaced temporary with another language and after that // we need the arrays in this language, because otherwise the user gets the site in a wrong language $backendLangId = $objInit->backendLangId; $_tempCORELANG = $_CORELANG; $_tempARRAYLANG = $_ARRAYLANG; // get all languages, so we can load the placeholder for all languages $FWLanguages = new \FWLanguage(); $languages = $FWLanguages->getLanguageArray(); $attributNameAfterLang = array('TXT_CRM_COMPANY_SIZE' => 'user_profile_attribute_company_size', 'TXT_CRM_INDUSTRY_TYPE' => 'user_profile_attribute_industry_type', 'TXT_CRM_CUSTOMER_TYPE' => 'user_profile_attribute_customer_type'); \Cx\Core\Setting\Controller\Setting::init('Crm', 'config'); foreach ($attributNameAfterLang as $key => $attributName) { if (!\Cx\Core\Setting\Controller\Setting::isDefined($attributName)) { if (!$objUser->objAttribute->getAttributeIdByName($_ARRAYLANG[$key]) !== null) { $attribut = $objUser->objAttribute->getById(0); $attribut->init(); $placeholderArr = array(); foreach ($languages as $language) { $objInit->backendLangId = $language["id"]; $langArr = $objInit->loadLanguageData(); $placeholderArr[$language["id"]] = $langArr[$key]; } $attribut->setNames($placeholderArr); $attribut->setType('text'); $attribut->setParent(0); if (!$attribut->store()) { throw new \Cx\Modules\Crm\Controller\CrmSettingsException('Failed to create User_Profile_Attribute for ' . $key); } } \CX\Core\Setting\Controller\Setting::add($attributName, $objUser->objAttribute->getAttributeIdByName($_ARRAYLANG[$key]), false, 'dropdown_user_custom_attribute', '', 'config'); } } // restore the original language settings, so the page loads in the correct language $objInit->backendLangId = $backendLangId; $_CORELANG = $_tempCORELANG; $_ARRAYLANG = $_tempARRAYLANG; }
public function parseSettingsPage() { global $_ARRAYLANG, $objDatabase; \Cx\Core\Setting\Controller\Setting::init('FileSharing', 'config'); if (!\Cx\Core\Setting\Controller\Setting::getValue('permission', 'FileSharing')) { \Cx\Core\Setting\Controller\Setting::add('permission', 'off'); } if (isset($_POST['save_settings'])) { $this->saveSettings(); } $this->_objTpl->setVariable(array('FILESHARING_INFO' => $_ARRAYLANG["TXT_FILESHARING_SETTINGS_GENERAL_INFORMATION"], 'FILESHARING_MAIL_TEMPLATES' => $_ARRAYLANG["TXT_FILESHARING_MAIL_TEMPLATES"], 'TXT_FILESHARING_SECURITY' => $_ARRAYLANG["TXT_FILESHARING_SECURITY"], 'TXT_FILESHARING_SECURITY_INFO' => $_ARRAYLANG["TXT_FILESHARING_SECURITY_INFO"], 'TXT_FILESHARING_APPLICATION_NAME' => $_ARRAYLANG["TXT_FILESHARING_SETTINGS_GENERAL_MODULE_NAME_TITLE"], 'FILESHARING_APPLICATION_NAME' => $_ARRAYLANG["TXT_FILESHARING_MODULE"], 'TXT_FILESHARING_DESCRIPTION' => $_ARRAYLANG["TXT_FILESHARING_SETTINGS_GENERAL_MODULE_DESCRIPTION_TITLE"], 'FILESHARING_DESCRIPTION' => $_ARRAYLANG["TXT_FILESHARING_SETTINGS_GENERAL_MODULE_DESCRIPTION"], 'TXT_FILESHARING_MANUAL' => $_ARRAYLANG["TXT_FILESHARING_SETTINGS_GENERAL_MODULE_MANUAL_TITLE"], 'FILESHARING_MANUAL' => $_ARRAYLANG["TXT_FILESHARING_SETTINGS_GENERAL_MODULE_MANUAL"])); /** * parse mailtemplates */ $arrActiveSystemFrontendLanguages = \FWLanguage::getActiveFrontendLanguages(); foreach ($arrActiveSystemFrontendLanguages as $activeLang) { $objMailTemplate = $objDatabase->Execute("SELECT `subject`, `content` FROM " . DBPREFIX . "module_filesharing_mail_template WHERE `lang_id` = " . intval($activeLang["id"])); if ($objMailTemplate !== false) { $content = str_replace(array('{', '}'), array('[[', ']]'), $objMailTemplate->fields["content"]); $this->_objTpl->setVariable(array('FILESHARING_MAIL_SUBJECT' => htmlentities($objMailTemplate->fields["subject"], ENT_QUOTES, CONTREXX_CHARSET), 'FILESHARING_MAIL_CONTENT' => htmlentities($content, ENT_QUOTES, CONTREXX_CHARSET))); } $this->_objTpl->setVariable(array('TXT_MAIL_SUBJECT' => $_ARRAYLANG['TXT_MAIL_SUBJECT'], 'TXT_MAIL_CONTENT' => $_ARRAYLANG['TXT_MAIL_CONTENT'], 'LANG_NAME' => $activeLang["name"], 'LANG' => $activeLang["id"])); $this->_objTpl->parse('filesharing_email_template'); } /** * parse permissions */ $oldFilesharingPermission = \Cx\Core\Setting\Controller\Setting::getValue('permission', 'FileSharing'); $objFWUser = \FWUser::getFWUserObject(); if (!is_numeric($oldFilesharingPermission)) { // Get all groups $objGroup = $objFWUser->objGroup->getGroups(); } else { // Get access groups $objGroup = $objFWUser->objGroup->getGroups(array('dynamic' => $oldFilesharingPermission)); $arrAssociatedGroups = $objGroup->getLoadedGroupIds(); } $objGroup = $objFWUser->objGroup->getGroups(); while (!$objGroup->EOF) { $option = '<option value="' . $objGroup->getId() . '">' . htmlentities($objGroup->getName(), ENT_QUOTES, CONTREXX_CHARSET) . ' [' . $objGroup->getType() . ']</option>'; if (in_array($objGroup->getId(), $arrAssociatedGroups)) { $arrAssociatedGroupOptions[] = $option; } else { $arrNotAssociatedGroupOptions[] = $option; } $objGroup->next(); } if (!is_numeric($mediaManageSetting)) { // Get all groups $objGroup = $objFWUser->objGroup->getGroups(); } else { // Get access groups $objGroup = $objFWUser->objGroup->getGroups(array('dynamic' => $mediaManageSetting)); $arrAssociatedManageGroups = $objGroup->getLoadedGroupIds(); } $objGroup = $objFWUser->objGroup->getGroups(); while (!$objGroup->EOF) { $option = '<option value="' . $objGroup->getId() . '">' . htmlentities($objGroup->getName(), ENT_QUOTES, CONTREXX_CHARSET) . ' [' . $objGroup->getType() . ']</option>'; if (in_array($objGroup->getId(), $arrAssociatedManageGroups)) { $arrAssociatedGroupManageOptions[] = $option; } else { $arrNotAssociatedGroupManageOptions[] = $option; } $objGroup->next(); } $this->_objTpl->setVariable(array('FILESHARING_ALLOW_USER_UPLOAD_ON' => $oldFilesharingPermission == 'on' ? 'checked="checked"' : '', 'FILESHARING_ALLOW_USER_UPLOAD_OFF' => $oldFilesharingPermission == 'off' ? 'checked="checked"' : '', 'FILESHARING_ALLOW_USER_UPLOAD_GROUP' => is_numeric($oldFilesharingPermission) ? 'checked="checked"' : '', 'FILESHARING_ACCESS_DISPLAY' => is_numeric($oldFilesharingPermission) ? 'block' : 'none', 'FILESHARING_ACCESS_ASSOCIATED_GROUPS' => implode("\n", $arrAssociatedGroupOptions), 'FILESHARING_ACCESS_NOT_ASSOCIATED_GROUPS' => implode("\n", $arrNotAssociatedGroupOptions), 'FILESHARING_SECURITY' => $_ARRAYLANG["TXT_FILESHARING_SECURITY"])); $this->_objTpl->parse('filesharing_security'); }
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']; }
/** * Fixes database errors. * * @return boolean False. Always. * @throws \Cx\Lib\Update_DatabaseException */ static function init($configPath = null) { try { //site group \Cx\Core\Setting\Controller\Setting::init('Config', 'site', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('systemStatus') && !\Cx\Core\Setting\Controller\Setting::add('systemStatus', 'on', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Page Status"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('languageDetection') && !\Cx\Core\Setting\Controller\Setting::add('languageDetection', 'on', 2, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Auto Detect Language"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreGlobalPageTitle') && !\Cx\Core\Setting\Controller\Setting::add('coreGlobalPageTitle', 'Contrexx Example Website', 3, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Global Page Title"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('mainDomainId') && !\Cx\Core\Setting\Controller\Setting::add('mainDomainId', '0', 4, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, '{src:\\' . __CLASS__ . '::getDomains()}', 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Main Domain"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('forceDomainUrl') && !\Cx\Core\Setting\Controller\Setting::add('forceDomainUrl', 'off', 5, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Home Page Url"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreListProtectedPages') && !\Cx\Core\Setting\Controller\Setting::add('coreListProtectedPages', 'off', 6, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Protected Pages"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('searchVisibleContentOnly') && !\Cx\Core\Setting\Controller\Setting::add('searchVisibleContentOnly', 'on', 7, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Visible Contents"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('advancedUploadFrontend') && !\Cx\Core\Setting\Controller\Setting::add('advancedUploadFrontend', 'off', 8, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Visible Contents"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('forceProtocolFrontend') && !\Cx\Core\Setting\Controller\Setting::add('forceProtocolFrontend', 'none', 9, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, '{src:\\' . __CLASS__ . '::getPortOptions()}', 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Protocol In Use"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('portFrontendHTTP') && !\Cx\Core\Setting\Controller\Setting::add('portFrontendHTTP', 80, 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'site')) { \DBG::log("Failed to add Setting entry for core HTTP Port (Frontend)"); throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for core HTTP Port (Frontend)"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('portFrontendHTTPS') && !\Cx\Core\Setting\Controller\Setting::add('portFrontendHTTPS', 443, 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'site')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for core HTTPS Port (Frontend)"); } //administrationArea group \Cx\Core\Setting\Controller\Setting::init('Config', 'administrationArea', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('dashboardNews') && !\Cx\Core\Setting\Controller\Setting::add('dashboardNews', 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Dashboard News"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('dashboardNewsSrc') && !\Cx\Core\Setting\Controller\Setting::add('dashboardNewsSrc', 'http://www.contrexx.com/feed/news_headlines_de.xml', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for dashboardNewsSrc"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('dashboardStatistics') && !\Cx\Core\Setting\Controller\Setting::add('dashboardStatistics', 'on', 2, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Dashboard Statistics"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('advancedUploadBackend') && !\Cx\Core\Setting\Controller\Setting::add('advancedUploadBackend', 'on', 3, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for advanced Upload Tools"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('sessionLifeTime') && !\Cx\Core\Setting\Controller\Setting::add('sessionLifeTime', '3600', 4, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for session Length"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('sessionLifeTimeRememberMe') && !\Cx\Core\Setting\Controller\Setting::add('sessionLifeTimeRememberMe', '1209600', 5, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for session Length Remember"); } if (in_array('SystemInfo', \Env::get('cx')->getLicense()->getLegalComponentsList())) { if (!\Cx\Core\Setting\Controller\Setting::isDefined('dnsServer') && !\Cx\Core\Setting\Controller\Setting::add('dnsServer', 'ns1.contrexxhosting.com', 6, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Dns Server"); } } if (!\Cx\Core\Setting\Controller\Setting::isDefined('timezone') && !\Cx\Core\Setting\Controller\Setting::add('timezone', 'Europe/Zurich', 7, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, '{src:\\' . __CLASS__ . '::getTimezoneOptions()}', 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Time zone"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('forceProtocolBackend') && !\Cx\Core\Setting\Controller\Setting::add('forceProtocolBackend', 'none', 8, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, '{src:\\' . __CLASS__ . '::getPortOptions()}', 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Protocol In Use Administrator"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('portBackendHTTP') && !\Cx\Core\Setting\Controller\Setting::add('portBackendHTTP', 80, 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for core HTTP Port (Backend)"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('portBackendHTTPS') && !\Cx\Core\Setting\Controller\Setting::add('portBackendHTTPS', 443, 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'administrationArea')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for core HTTPS Port (Backend)"); } //security group \Cx\Core\Setting\Controller\Setting::init('Config', 'security', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreIdsStatus') && !\Cx\Core\Setting\Controller\Setting::add('coreIdsStatus', 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'security')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Security system notifications "); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('passwordComplexity') && !\Cx\Core\Setting\Controller\Setting::add('passwordComplexity', 'off', 2, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'security')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Passwords must meet the complexity requirements"); } //contactInformation group \Cx\Core\Setting\Controller\Setting::init('Config', 'contactInformation', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreAdminName') && !\Cx\Core\Setting\Controller\Setting::add('coreAdminName', 'Administrator', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for core Admin Name"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreAdminEmail') && !\Cx\Core\Setting\Controller\Setting::add('coreAdminEmail', '*****@*****.**', 2, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for core Admin Email"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('contactFormEmail') && !\Cx\Core\Setting\Controller\Setting::add('contactFormEmail', '*****@*****.**', 3, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for contact Form Email"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('contactCompany') && !\Cx\Core\Setting\Controller\Setting::add('contactCompany', 'Ihr Firmenname', 4, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for contact Company"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('contactAddress') && !\Cx\Core\Setting\Controller\Setting::add('contactAddress', 'Musterstrasse 12', 5, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for contact Address"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('contactZip') && !\Cx\Core\Setting\Controller\Setting::add('contactZip', '3600', 6, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for contact Zip"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('contactPlace') && !\Cx\Core\Setting\Controller\Setting::add('contactPlace', 'Musterhausen', 7, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for contact Place"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('contactCountry') && !\Cx\Core\Setting\Controller\Setting::add('contactCountry', 'Musterland', 8, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for contact Country"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('contactPhone') && !\Cx\Core\Setting\Controller\Setting::add('contactPhone', '033 123 45 67', 9, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for contact Phone"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('contactFax') && !\Cx\Core\Setting\Controller\Setting::add('contactFax', '033 123 45 68', 10, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'contactInformation')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for contact Fax"); } //otherConfigurations group \Cx\Core\Setting\Controller\Setting::init('Config', 'otherConfigurations', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('xmlSitemapStatus') && !\Cx\Core\Setting\Controller\Setting::add('xmlSitemapStatus', 'on', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'otherConfigurations')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for XML Sitemap"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('frontendEditingStatus') && !\Cx\Core\Setting\Controller\Setting::add('frontendEditingStatus', 'on', 2, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'otherConfigurations')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Frontend Editing"); } if (in_array('SystemInfo', \Env::get('cx')->getLicense()->getLegalComponentsList())) { if (!\Cx\Core\Setting\Controller\Setting::isDefined('useCustomizings') && !\Cx\Core\Setting\Controller\Setting::add('useCustomizings', 'off', 3, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'otherConfigurations')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Customizing"); } } if (!\Cx\Core\Setting\Controller\Setting::isDefined('corePagingLimit') && !\Cx\Core\Setting\Controller\Setting::add('corePagingLimit', '30', 4, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'otherConfigurations')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Records per page"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('searchDescriptionLength') && !\Cx\Core\Setting\Controller\Setting::add('searchDescriptionLength', '150', 5, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'otherConfigurations')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Number of Characters in Search Results"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('googleMapsAPIKey') && !\Cx\Core\Setting\Controller\Setting::add('googleMapsAPIKey', '', 6, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'otherConfigurations')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Google-Map API key "); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('googleAnalyticsTrackingId') && !\Cx\Core\Setting\Controller\Setting::add('googleAnalyticsTrackingId', '', 7, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'otherConfigurations')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for Google Analytics Tracking ID"); } // core \Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreSmtpServer') && !\Cx\Core\Setting\Controller\Setting::add('coreSmtpServer', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'core')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for coreSmtpServer"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('lastAccessId') && !\Cx\Core\Setting\Controller\Setting::add('lastAccessId', '1', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, '', 'core')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for lastAccessId"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('installationId') && !\Cx\Core\Setting\Controller\Setting::add('installationId', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'core')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for installationId"); } // component \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('bannerStatus') && !\Cx\Core\Setting\Controller\Setting::add('bannerStatus', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for bannerStatus"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('spamKeywords') && !\Cx\Core\Setting\Controller\Setting::add('spamKeywords', 'sex, viagra', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXTAREA, '', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for spamKeywords"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('newsTeasersStatus') && !\Cx\Core\Setting\Controller\Setting::add('newsTeasersStatus', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for newsTeasersStatus"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('feedNewsMLStatus') && !\Cx\Core\Setting\Controller\Setting::add('feedNewsMLStatus', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for feedNewsMLStatus"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('calendarheadlines') && !\Cx\Core\Setting\Controller\Setting::add('calendarheadlines', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for calendarheadlines"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('calendarheadlinescount') && !\Cx\Core\Setting\Controller\Setting::add('calendarheadlinescount', '5', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, '', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for calendarheadlinescount"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('calendardefaultcount') && !\Cx\Core\Setting\Controller\Setting::add('calendardefaultcount', '16', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, '', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for calendardefaultcount"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('calendarheadlinescat') && !\Cx\Core\Setting\Controller\Setting::add('calendarheadlinescat', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, '', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for calendarheadlinescat"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('blockStatus') && !\Cx\Core\Setting\Controller\Setting::add('blockStatus', '1', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for blockStatus"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('blockRandom') && !\Cx\Core\Setting\Controller\Setting::add('blockRandom', '1', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for blockRandom"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('directoryHomeContent') && !\Cx\Core\Setting\Controller\Setting::add('directoryHomeContent', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for directoryHomeContent"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('forumHomeContent') && !\Cx\Core\Setting\Controller\Setting::add('forumHomeContent', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for forumHomeContent"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('podcastHomeContent') && !\Cx\Core\Setting\Controller\Setting::add('podcastHomeContent', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for podcastHomeContent"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('forumTagContent') && !\Cx\Core\Setting\Controller\Setting::add('forumTagContent', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for forumTagContent"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('dataUseModule') && !\Cx\Core\Setting\Controller\Setting::add('dataUseModule', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for dataUseModule"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('useKnowledgePlaceholders') && !\Cx\Core\Setting\Controller\Setting::add('useKnowledgePlaceholders', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for useKnowledgePlaceholders"); } // release \Cx\Core\Setting\Controller\Setting::init('Config', 'release', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsEdition') && !\Cx\Core\Setting\Controller\Setting::add('coreCmsEdition', 'Open Source', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for coreCmsEdition"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsVersion') && !\Cx\Core\Setting\Controller\Setting::add('coreCmsVersion', '4.0.0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for coreCmsVersion"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsCodeName') && !\Cx\Core\Setting\Controller\Setting::add('coreCmsCodeName', 'Nandri', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for coreCmsCodeName"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsStatus') && !\Cx\Core\Setting\Controller\Setting::add('coreCmsStatus', 'Stable', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for coreCmsStatus"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsReleaseDate') && !\Cx\Core\Setting\Controller\Setting::add('coreCmsReleaseDate', '1348783200', 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATE, null, 'release')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for coreCmsReleaseDate"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsName') && !\Cx\Core\Setting\Controller\Setting::add('coreCmsName', 'Contrexx', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for coreCmsName"); } // license \Cx\Core\Setting\Controller\Setting::init('Config', 'license', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseKey') && !\Cx\Core\Setting\Controller\Setting::add('licenseKey', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseKey"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseState') && !\Cx\Core\Setting\Controller\Setting::add('licenseState', 'OK', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseState"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseValidTo') && !\Cx\Core\Setting\Controller\Setting::add('licenseValidTo', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATETIME, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseValidTo"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseMessage') && !\Cx\Core\Setting\Controller\Setting::add('licenseMessage', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseMessage"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licensePartner') && !\Cx\Core\Setting\Controller\Setting::add('licensePartner', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licensePartner"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseCustomer') && !\Cx\Core\Setting\Controller\Setting::add('licenseCustomer', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseCustomer"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('upgradeUrl') && !\Cx\Core\Setting\Controller\Setting::add('upgradeUrl', 'http://license.contrexx.com/', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for upgradeUrl"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneMessages') && !\Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneMessages', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseGrayzoneMessages"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneTime') && !\Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneTime', '14', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseGrayzoneTime"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseLockTime') && !\Cx\Core\Setting\Controller\Setting::add('licenseLockTime', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseLockTime"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseUpdateInterval') && !\Cx\Core\Setting\Controller\Setting::add('licenseUpdateInterval', '24', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseUpdateInterval"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseFailedUpdate') && !\Cx\Core\Setting\Controller\Setting::add('licenseFailedUpdate', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseFailedUpdate"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseSuccessfulUpdate') && !\Cx\Core\Setting\Controller\Setting::add('licenseSuccessfulUpdate', '0', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseSuccessfulUpdate"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseCreatedAt') && !\Cx\Core\Setting\Controller\Setting::add('licenseCreatedAt', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATE, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseCreatedAt"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseDomains') && !\Cx\Core\Setting\Controller\Setting::add('licenseDomains', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for licenseDomains"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('availableComponents') && !\Cx\Core\Setting\Controller\Setting::add('availableComponents', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for availableComponents"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('dashboardMessages') && !\Cx\Core\Setting\Controller\Setting::add('dashboardMessages', '', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for dashboardMessages"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('isUpgradable') && !\Cx\Core\Setting\Controller\Setting::add('isUpgradable', 'on', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'license')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for isUpgradable"); } // cache if (in_array('SystemInfo', \Env::get('cx')->getLicense()->getLegalComponentsList())) { \Cx\Core\Setting\Controller\Setting::init('Config', 'cache', 'Yaml', $configPath); if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheEnabled') && !\Cx\Core\Setting\Controller\Setting::add('cacheEnabled', 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheEnabled"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheExpiration') && !\Cx\Core\Setting\Controller\Setting::add('cacheExpiration', '86400', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheExpiration"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheOpStatus') && !\Cx\Core\Setting\Controller\Setting::add('cacheOpStatus', 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheOpStatus"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheDbStatus') && !\Cx\Core\Setting\Controller\Setting::add('cacheDbStatus', 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheDbStatus"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheVarnishStatus') && !\Cx\Core\Setting\Controller\Setting::add('cacheVarnishStatus', 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheVarnishStatus"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheUserCache') && !\Cx\Core\Setting\Controller\Setting::add('cacheUserCache', 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheUserCache"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheOPCache') && !\Cx\Core\Setting\Controller\Setting::add('cacheOPCache', 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheOPCache"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheProxyCacheVarnishConfig') && !\Cx\Core\Setting\Controller\Setting::add('cacheProxyCacheVarnishConfig', '{"ip":"127.0.0.1","port":"8080"}', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheProxyCacheVarnishConfig"); } if (!\Cx\Core\Setting\Controller\Setting::isDefined('cacheUserCacheMemcacheConfig') && !\Cx\Core\Setting\Controller\Setting::add('cacheUserCacheMemcacheConfig', '{"ip":"127.0.0.1","port":11211}', 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'cache')) { throw new \Cx\Lib\Update_DatabaseException("Failed to add Setting entry for cacheUserCacheMemcacheConfig"); } } } catch (\Exception $e) { \DBG::msg($e->getMessage()); } // Always return false; }
/** * Tries to recreate the database table(s) for the class * * Should be called whenever there's a problem with the database table. * @return boolean False. Always. */ static function errorHandler() { $table_name = DBPREFIX . 'core_country'; $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'alpha2' => array('type' => 'CHAR(2)', 'notnull' => true, 'default' => ''), 'alpha3' => array('type' => 'CHAR(3)', 'notnull' => true, 'default' => ''), 'ord' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'renamefrom' => 'sort_order'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'renamefrom' => 'is_active')); \Cx\Lib\UpdateUtil::table($table_name, $table_structure); if (\Cx\Lib\UpdateUtil::table_empty($table_name)) { \Text::deleteByKey('core', self::TEXT_NAME); // Copy the Countries from the Shop module if possible if (\Cx\Lib\UpdateUtil::table_exist(DBPREFIX . "module_shop_countries")) { $query = "\n SELECT `countries_id`, `countries_name`,\n `countries_iso_code_2`, `countries_iso_code_3`,\n `activation_status`\n FROM " . DBPREFIX . "module_shop_countries"; $objResult = \Cx\Lib\UpdateUtil::sql($query); if (!$objResult) { throw new \Cx\Lib\Update_DatabaseException("Failed to to query Country names", $query); } $default_lang_id = \FWLanguage::getDefaultLangId(); while (!$objResult->EOF) { $id = $objResult->fields['countries_id']; $name = $objResult->fields['countries_name']; $alpha2 = $objResult->fields['countries_iso_code_2']; $alpha3 = $objResult->fields['countries_iso_code_3']; $active = $objResult->fields['activation_status']; $ord = 0; if ($id == 14) { // fixing missing name $name = 'Österreich'; } if (!self::store($alpha2, $alpha3, $default_lang_id, $name, $ord, $active, $id)) { throw new \Cx\Lib\Update_DatabaseException("Failed to to migrate Country '{$name}'"); } $objResult->MoveNext(); } \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_countries'); } } // USE FOR NEW INSTALLATIONS ONLY! // These records will lead to inconsistencies with Country references in // other tables otherwise. if (\Cx\Lib\UpdateUtil::table_empty($table_name)) { // Add new Country records if available if (file_exists(ASCMS_CORE_PATH . '/countries_iso_3166-2.php') && (include_once ASCMS_CORE_PATH . '/countries_iso_3166-2.php')) { //DBG::log("Country::errorHandler(): Included ISO file"); $arrCountries = null; $ord = 0; foreach ($arrCountries as $country_id => $arrCountry) { $name = $arrCountry[0]; $alpha2 = $arrCountry[1]; $alpha3 = $arrCountry[2]; // Not currently in use: // $numeric = $arrCountry[3]; // $iso_full = $arrCountry[4]; // English (language ID 2) only! if (!self::store($alpha2, $alpha3, 2, $name, ++$ord, true, $country_id)) { throw new \Cx\Lib\Update_DatabaseException("Failed to to add Country '{$name}' from ISO file"); } //DBG::log("Country::errorHandler(): Added Country ID $country_id: '$name'"); } } } //DBG::activate(DBG_ADODB); // Add more languages from the countries_languages.php file, // if present $arrCountries = array(); // $arrCountries is redefined in the file if (file_exists(ASCMS_CORE_PATH . '/countries_languages.php') && (include_once ASCMS_CORE_PATH . '/countries_languages.php')) { foreach ($arrCountries as $alpha2 => $arrLanguage) { //DBG::log("errorHandler: Looking for Alpha-2 $alpha2"); $country_id = self::getIdByAlpha2($alpha2); if (!$country_id) { // TODO: Fail or not? continue; } foreach ($arrLanguage as $lang_id => $name) { if (!\Text::replace($country_id, $lang_id, 'core', self::TEXT_NAME, $name)) { throw new \Cx\Lib\Update_DatabaseException("Failed to to update Country '{$name}' from languages file"); } //DBG::log("Country::errorHandler(): Added Country ID $country_id: language ID $lang_id"); } } } \Cx\Core\Setting\Controller\Setting::init('core', 'country'); \Cx\Core\Setting\Controller\Setting::add('numof_countries_per_page_backend', 30, 101); // More to come... // Always! return false; }
/** * parse the upload form * * @access private */ private function getForm() { global $_ARRAYLANG; \Cx\Core\Setting\Controller\Setting::init('FileSharing', 'config'); $permissionNeeded = \Cx\Core\Setting\Controller\Setting::getValue('permission', 'FileSharing'); if (!$permissionNeeded) { \Cx\Core\Setting\Controller\Setting::add('permission', 'off'); $permissionNeeded = \Cx\Core\Setting\Controller\Setting::getValue('permission', 'FileSharing'); } if ($permissionNeeded == 'off' || is_numeric($permissionNeeded) && !\Permission::checkAccess($permissionNeeded, 'dynamic')) { $this->objTemplate->setVariable('FILESHARING_NO_ACCESS', $_ARRAYLANG['TXT_FILESHARING_NO_ACCESS']); if ($this->objTemplate->parse('no_access')) { $this->objTemplate->parse('no_access'); } if ($this->objTemplate->blockExists('upload_form')) { $this->objTemplate->hideBlock('upload_form'); } if ($this->objTemplate->blockExists('uploaded')) { $this->objTemplate->hideBlock('uploaded'); } } else { // parse the upload form // init uploader $uploadId = $this->initUploader(); // set form parameters $formAction = clone \Env::get("Resolver")->getUrl(); $formAction->setParam("uploadId", $uploadId); $formAction->setParam("check", false); $formAction->setParam("hash", false); $this->objTemplate->setVariable(array("FORM_ACTION" => $formAction, "FORM_METHOD" => "POST", "FILESHARING_EMAIL" => $_ARRAYLANG["TXT_EMAIL"], "FILESHARING_EMAIL_INFO" => $_ARRAYLANG["TXT_FILESHARING_EMAIL_INFO"], "FILESHARING_SUBJECT" => $_ARRAYLANG["TXT_FILESHARING_SUBJECT"], "FILESHARING_SUBJECT_INFO" => $_ARRAYLANG["TXT_FILESHARING_SUBJECT_INFO"], "FILESHARING_MESSAGE" => $_ARRAYLANG["TXT_FILESHARING_MESSAGE"], "FILESHARING_MESSAGE_INFO" => $_ARRAYLANG["TXT_FILESHARING_MESSAGE_INFO"], "FILESHARING_EXPIRATION" => $_ARRAYLANG["TXT_FILESHARING_EXPIRATION"], "FILESHARING_SEND" => $_ARRAYLANG["TXT_FILESHARING_SEND"], "FILESHARING_MORE" => $_ARRAYLANG["TXT_FILESHARING_MORE"], "FILESHARING_ERROR_FILE_NOT_FOUND" => $_ARRAYLANG["TXT_FILESHARING_ERROR_FILE_NOT_FOUND"], "FILESHARING_ERROR_NO_FILES_UPLOADED" => $_ARRAYLANG["TXT_FILESHARING_ERROR_NO_FILES_UPLOADED"], 'TXT_FILESHARING_EXPLANATION' => $_ARRAYLANG['TXT_FILESHARING_EXPLANATION'], 'TXT_FILESHARING_I_AGREE' => $_ARRAYLANG['TXT_FILESHARING_I_AGREE'], 'TXT_FILESHARING_TERMS_OF_SERVICE' => $_ARRAYLANG['TXT_FILESHARING_TERMS_OF_SERVICE'], 'TXT_FILESHARING_I_ACCEPT' => $_ARRAYLANG['TXT_FILESHARING_I_ACCEPT'], 'TXT_FILESHARING_FILES' => $_ARRAYLANG['TXT_FILESHARING_FILES'])); if ($this->objTemplate->blockExists('upload_form')) { $this->objTemplate->touchBlock("upload_form"); } if ($this->objTemplate->blockExists('uploaded')) { $this->objTemplate->hideBlock("uploaded"); } } }
/** * find all custom css variables and return an array with the values * * @param integer $skinId skin id, default is 0 * @return array List with needed wysiwyg options */ public function getCustomCSSVariables($skinId) { $themeRepo = new \Cx\Core\View\Model\Repository\ThemeRepository(); $skin = ''; $content = ''; $cssArr = array(); $ymlOption = array(); $componentData = array(); \Cx\Core\Setting\Controller\Setting::init('Wysiwyg', 'config', 'Yaml'); 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"); } //0 is default theme so you dont must change the themefolder if (!empty($skinId)) { $skin = $themeRepo->findById($skinId)->getFoldername(); $componentData = $themeRepo->findById($skinId)->getComponentData(); } else { $skin = $themeRepo->getDefaultTheme()->getFoldername(); $componentData = $themeRepo->getDefaultTheme()->getComponentData(); } if (\Cx\Core\Setting\Controller\Setting::getValue('specificStylesheet', 'Wysiwyg')) { $path = $this->cx->getClassLoader()->getFilePath($this->cx->getCodeBaseThemesPath() . '/' . $skin . '/index.html'); if ($path) { $content = file_get_contents($path); $cssArr = \JS::findCSS($content); } } if (!empty($componentData['rendering']['wysiwyg'])) { $ymlOption = $componentData['rendering']['wysiwyg']; } if (!empty($ymlOption['css'])) { if ($this->cx->getClassLoader()->getFilePath($this->cx->getCodeBaseThemesPath() . '/' . $skin . '/' . $ymlOption['css'])) { $cssArr[] = $this->cx->getWebsiteOffsetPath() . '/' . $skin . '/' . $ymlOption['css']; } } return array('css' => $cssArr, 'bodyClass' => !empty($ymlOption['bodyClass']) ? $ymlOption['bodyClass'] : '', 'bodyId' => !empty($ymlOption['bodyId']) ? $ymlOption['bodyId'] : ''); }
/** * 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(); } }
public function testStoreFromPost() { \DBG::log('*** testStoreFromPost ***'); global $_POST, $_FILES; Setting::init('MultiSiteTest', 'posttestgroup', 'FileSystem'); //Setting::add('key10.1', '', false, Setting::TYPE_FILEUPLOAD); Setting::add('key10.2', '', false, Setting::TYPE_CHECKBOX); Setting::add('key10.3', '', false, Setting::TYPE_CHECKBOXGROUP); Setting::add('key10.4', ''); $_POST = array('key10.2' => 'postcheckboxvalue10', 'key10.3' => array_flip(array(1, 2, 3, 4, 5, 6)), 'key10.4' => 'postvalue10'); try { Setting::storeFromPost(); } catch (Exception $e) { } finally { Setting::init('MultiSiteTest', 'posttestgroup', 'FileSystem'); $this->assertEquals('postcheckboxvalue10', Setting::getValue('key10.2')); $this->assertEquals('1,2,3,4,5,6', Setting::getValue('key10.3')); $this->assertEquals('postvalue10', Setting::getValue('key10.4')); Setting::init('MultiSiteTest', null, 'FileSystem'); Setting::deleteModule(); } }
/** * 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']; } }
/** * 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'); } } }