/** * 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; } }
/** * 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; }
/** * 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; }
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'); }
/** * * 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; }
/** * 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; }
/** * 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'); } } }
/** * Store general settings * * @return boolean true on success, false otherwise. * @static */ static function storeGeneral() { if (empty($_POST['general'])) { return; } // TODO: Use // \Cx\Core\Setting\Controller\Setting::storeFromPost(); \Cx\Core\Setting\Controller\Setting::set('email', trim(strip_tags(contrexx_input2raw($_POST['email'])))); \Cx\Core\Setting\Controller\Setting::set('email_confirmation', trim(strip_tags(contrexx_input2raw($_POST['email_confirmation'])))); // added: shop company name and address \Cx\Core\Setting\Controller\Setting::set('company', trim(strip_tags(contrexx_input2raw($_POST['company'])))); \Cx\Core\Setting\Controller\Setting::set('address', trim(strip_tags(contrexx_input2raw($_POST['address'])))); \Cx\Core\Setting\Controller\Setting::set('telephone', trim(strip_tags(contrexx_input2raw($_POST['telephone'])))); \Cx\Core\Setting\Controller\Setting::set('fax', trim(strip_tags(contrexx_input2raw($_POST['fax'])))); \Cx\Core\Setting\Controller\Setting::set('country_id', intval($_POST['country_id'])); // Thumbnail settings \Cx\Core\Setting\Controller\Setting::set('thumbnail_max_width', intval($_POST['thumbnail_max_width'])); \Cx\Core\Setting\Controller\Setting::set('thumbnail_max_height', intval($_POST['thumbnail_max_height'])); \Cx\Core\Setting\Controller\Setting::set('thumbnail_quality', intval($_POST['thumbnail_quality'])); // Extended settings // New in V2.something \Cx\Core\Setting\Controller\Setting::set('weight_enable', !empty($_POST['weight_enable'])); \Cx\Core\Setting\Controller\Setting::set('show_products_default', empty($_POST['show_products_default']) ? 0 : intval($_POST['show_products_default'])); // Mind that this defaults to 1, zero is not a valid value \Cx\Core\Setting\Controller\Setting::set('product_sorting', empty($_POST['product_sorting']) ? 1 : intval($_POST['product_sorting'])); // Order amount lower limit (new in 3.1.0) $orderItemsAmountMin = empty($_POST['orderitems_amount_min']) ? 0 : floatval($_POST['orderitems_amount_min']); if (!\Cx\Core\Setting\Controller\Setting::isDefined('orderitems_amount_min')) { \Cx\Core\Setting\Controller\Setting::add('orderitems_amount_min', $orderItemsAmountMin, false, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); } else { \Cx\Core\Setting\Controller\Setting::set('orderitems_amount_min', $orderItemsAmountMin); } // Order amount upper limit (applicable when using Saferpay) \Cx\Core\Setting\Controller\Setting::set('orderitems_amount_max', empty($_POST['orderitems_amount_max']) ? 0 : floatval($_POST['orderitems_amount_max'])); // New in V3.0.0 \Cx\Core\Setting\Controller\Setting::set('use_js_cart', intval($_POST['use_js_cart'])); \Cx\Core\Setting\Controller\Setting::set('shopnavbar_on_all_pages', intval($_POST['shopnavbar_on_all_pages'])); \Cx\Core\Setting\Controller\Setting::set('register', trim(strip_tags(contrexx_input2raw($_POST['register'])))); \Cx\Core\Setting\Controller\Setting::set('numof_customers_per_page_backend', intval($_POST['numof_customers_per_page_backend'])); \Cx\Core\Setting\Controller\Setting::set('numof_manufacturers_per_page_backend', intval($_POST['numof_manufacturers_per_page_backend'])); \Cx\Core\Setting\Controller\Setting::set('numof_mailtemplate_per_page_backend', intval($_POST['numof_mailtemplate_per_page_backend'])); \Cx\Core\Setting\Controller\Setting::set('usergroup_id_customer', intval($_POST['usergroup_id_customer'])); \Cx\Core\Setting\Controller\Setting::set('usergroup_id_reseller', intval($_POST['usergroup_id_reseller'])); \Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_customer_group_id', intval($_POST['user_profile_attribute_customer_group_id'])); \Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_notes', intval($_POST['user_profile_attribute_notes'])); // New in V3.0.4 or V3.1.0 if (!\Cx\Core\Setting\Controller\Setting::set('numof_products_per_page_backend', intval($_POST['numof_products_per_page_backend']))) { \Cx\Core\Setting\Controller\Setting::add('numof_products_per_page_backend', intval($_POST['numof_products_per_page_backend']), 53, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); } if (!\Cx\Core\Setting\Controller\Setting::set('numof_orders_per_page_backend', intval($_POST['numof_orders_per_page_backend']))) { \Cx\Core\Setting\Controller\Setting::add('numof_orders_per_page_backend', intval($_POST['numof_orders_per_page_backend']), 54, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); } if (!\Cx\Core\Setting\Controller\Setting::set('numof_coupon_per_page_backend', intval($_POST['numof_coupon_per_page_backend']))) { \Cx\Core\Setting\Controller\Setting::add('numof_coupon_per_page_backend', intval($_POST['numof_coupon_per_page_backend']), 58, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); } if (!\Cx\Core\Setting\Controller\Setting::set('numof_products_per_page_frontend', intval($_POST['numof_products_per_page_frontend']))) { \Cx\Core\Setting\Controller\Setting::add('numof_products_per_page_frontend', intval($_POST['numof_products_per_page_frontend']), null, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); } if (!\Cx\Core\Setting\Controller\Setting::set('num_categories_per_row', intval($_POST['num_categories_per_row']))) { \Cx\Core\Setting\Controller\Setting::add('num_categories_per_row', intval($_POST['num_categories_per_row']), null, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config'); } }
/** * 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'] : ''); }
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']; }
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; }
/** * 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'"); } }
/** * 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(); } }
/** * * @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); } } }
/** * 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'); } } }