/**
  * Do something before content is loaded from DB
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_CONFIG, $cl, $lang, $objInit, $dataBlocks, $lang, $dataBlocks, $themesPages, $page_template;
     // Initialize counter and track search engine robot
     \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
     if (\Cx\Core\Setting\Controller\Setting::getValue('dataUseModule') && $cl->loadFile(ASCMS_MODULE_PATH . '/Data/Controller/DataBlocks.class.php')) {
         $lang = $objInit->loadLanguageData('Data');
         $dataBlocks = new \Cx\Modules\Data\Controller\DataBlocks($lang);
         \Env::get('cx')->getPage()->setContent($dataBlocks->replace(\Env::get('cx')->getPage()->getContent()));
         $themesPages = $dataBlocks->replace($themesPages);
         $page_template = $dataBlocks->replace($page_template);
     }
 }
예제 #2
0
 /**
  * Constructor for PHP5
  *
  * @param int $lang
  */
 function __construct()
 {
     global $objInit;
     \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
     if (\Cx\Core\Setting\Controller\Setting::getValue('dataUseModule')) {
         $this->active = true;
     } else {
         return;
     }
     $this->_arrSettings = $this->createSettingsArray();
     $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_THEMES_PATH);
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
     $this->langVars = $objInit->loadLanguageData('Data');
 }
 /**
  * Do something after content is loaded from DB
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function postContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             // Show the Shop navbar in the Shop, or on every page if configured to do so
             if (!Shop::isInitialized()) {
                 \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
                 if (\Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop')) {
                     Shop::init();
                     Shop::setNavbar();
                 }
             }
             break;
     }
 }
 /**
  * postInit
  *
  * @param \Cx\Core\Core\Controller\Cx $cx
  *
  * @return null
  */
 public function postInit(\Cx\Core\Core\Controller\Cx $cx)
 {
     $componentController = $this->getComponent('MultiSite');
     if (!$componentController) {
         return;
     }
     \Cx\Core\Setting\Controller\Setting::init('MultiSite', 'config', 'FileSystem');
     if (\Cx\Core\Setting\Controller\Setting::getValue('mode', 'MultiSite') != \Cx\Core_Modules\MultiSite\Controller\ComponentController::MODE_WEBSITE) {
         return;
     }
     $updateFile = $cx->getWebsiteTempPath() . '/Update/' . \Cx\Core_Modules\Update\Model\Repository\DeltaRepository::PENDING_DB_UPDATES_YML;
     if (!file_exists($updateFile)) {
         return;
     }
     $componentController->setCustomerPanelDomainAsMainDomain();
     $updateController = $this->getController('Update');
     $updateController->applyDelta();
 }
 /**
  * Show the general setting options
  * 
  * @global array $_ARRAYLANG
  */
 public function showDefault()
 {
     global $_ARRAYLANG;
     \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config');
     //get post values
     $settings = isset($_POST['setting']) ? $_POST['setting'] : array();
     if (isset($_POST['save'])) {
         $includeFromSave = array('entriesPerPage');
         foreach ($settings as $settingName => $settingValue) {
             if (in_array($settingName, $includeFromSave)) {
                 \Cx\Core\Setting\Controller\Setting::set($settingName, $settingValue);
                 \Cx\Core\Setting\Controller\Setting::update($settingName);
                 \Message::ok($_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_SUCCESS_MSG']);
             }
         }
     }
     //get the settings values from DB
     $this->template->setVariable(array($this->moduleNameLang . '_ENTRIES_PER_PAGE' => \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager')));
 }
 /**
  * FeedBack Form
  * 
  * @global array $_ARRAYLANG
  */
 public function showFeedBackForm()
 {
     global $_ARRAYLANG;
     $objUser = \FWUser::getFWUserObject();
     //feed back types
     $feedBackTypes = array($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_SELECT_FEEDBACK'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_BUG_REPORT'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_FEATURE_REQUEST'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_HAVE_QUESTION']);
     \Cx\Core\Setting\Controller\Setting::init('Support', 'setup', 'Yaml');
     $faqUrl = \Cx\Core\Setting\Controller\Setting::getValue('faqUrl', 'Support');
     $recipientMailAddress = \Cx\Core\Setting\Controller\Setting::getValue('recipientMailAddress', 'Support');
     $faqLink = '<a target="_blank" title="click to FAQ page" href=' . $faqUrl . '>' . $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_FAQ'] . '</a>';
     //Get License information
     $license = \Env::get('cx')->getLicense();
     $licenseName = $license->getEditionName();
     $licenseValid = date(ASCMS_DATE_FORMAT_DATE, $license->getValidToDate());
     $licenseVersion = $license->getVersion()->getNumber();
     //get the input datas
     $feedBackType = isset($_POST['feedBackType']) ? contrexx_input2raw($_POST['feedBackType']) : '';
     $feedBackSubject = isset($_POST['feedBackSubject']) ? contrexx_input2raw($_POST['feedBackSubject']) : '';
     $feedBackComment = isset($_POST['feedBackComment']) ? contrexx_input2raw($_POST['feedBackComment']) : '';
     $customerName = isset($_POST['customerName']) ? contrexx_input2raw($_POST['customerName']) : '';
     $customerEmailId = isset($_POST['customerEmailId']) ? contrexx_input2raw($_POST['customerEmailId']) : '';
     $feedBackUrl = isset($_POST['feedBackUrl']) ? contrexx_input2raw($_POST['feedBackUrl']) : '';
     if (isset($_POST['sendAndSave'])) {
         if (!empty($feedBackSubject) && !empty($feedBackComment)) {
             //get the hostname domain
             $domainRepo = new \Cx\Core\Net\Model\Repository\DomainRepository();
             $domain = $domainRepo->findOneBy(array('id' => 0));
             $arrFields = array('name' => contrexx_raw2xhtml($customerName), 'fromEmail' => contrexx_raw2xhtml($customerEmailId), 'feedBackType' => $feedBackType != 0 ? contrexx_raw2xhtml($feedBackTypes[$feedBackType]) : '', 'url' => $faqUrl, 'comments' => contrexx_raw2xhtml($feedBackComment), 'subject' => contrexx_raw2xhtml($feedBackSubject), 'firstName' => $objUser->objUser->getProfileAttribute('firstname'), 'lastName' => $objUser->objUser->getProfileAttribute('lastname'), 'phone' => !$objUser->objUser->getProfileAttribute('phone_office') ? $objUser->objUser->getProfileAttribute('phone_mobile') : $objUser->objUser->getProfileAttribute('phone_office'), 'company' => $objUser->objUser->getProfileAttribute('company'), 'toEmail' => $recipientMailAddress, 'licenseName' => $licenseName, 'licenseValid' => $licenseValid, 'licenseVersion' => $licenseVersion, 'domainName' => $domain ? $domain->getName() : '');
             //send the feedBack mail
             $this->sendMail($arrFields) ? \Message::ok($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_EMAIL_SEND_SUCESSFULLY']) : \Message::error($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_EMAIL_SEND_FAILED']);
         } else {
             \Message::error($_ARRAYLANG['TXT_SUPPORT_ERROR_MSG_FIELDS_EMPTY']);
             $this->template->setVariable(array('TXT_SUPPORT_ERROR_CLASS_SUBJECT' => !empty($feedBackSubject) ? "" : "errBoxStyle", 'TXT_SUPPORT_ERROR_CLASS_COMMENT' => !empty($feedBackComment) ? "" : "errBoxStyle", 'SUPPORT_FEEDBACK_SUBJECT' => contrexx_raw2xhtml($feedBackSubject), 'SUPPORT_FEEDBACK_COMMENT' => contrexx_raw2xhtml($feedBackComment)));
         }
     }
     //show FeedBack Types
     foreach ($feedBackTypes as $key => $feedbackType) {
         $this->template->setVariable(array('SUPPORT_FEEDBACK_TYPES' => $feedbackType, 'SUPPORT_FEEDBACK_SELECTED_TYPE' => !empty($feedBackType) && $feedBackType == $key ? 'selected' : '', 'SUPPORT_FEEDBACK_ID' => $key));
         $this->template->parse('showFeedBackTypes');
     }
     $this->template->setVariable(array('SUPPORT_FEEDBACK_FAQ' => $faqLink, 'SUPPORT_FEEDBACK_CUSTOMER_NAME' => $objUser->objUser->getUsername(), 'SUPPORT_FEEDBACK_CUSTOMER_EMAIL' => $objUser->objUser->getEmail()));
     $this->template->setVariable(array('TXT_SUPPORT_FEEDBACK' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK'], 'TXT_SUPPORT_FEEDBACK_SUBJECT' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_SUBJECT'], 'TXT_SUPPORT_FEEDBACK_COMMENTS' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_COMMENTS']));
 }
 /**
  * Do something before content is loaded from DB
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $knowledgeInterface, $page_template, $themesPages;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             // get knowledge content
             \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
             if (MODULE_INDEX < 2 && \Cx\Core\Setting\Controller\Setting::getValue('useKnowledgePlaceholders', 'Config')) {
                 $knowledgeInterface = new KnowledgeInterface();
                 if (preg_match('/{KNOWLEDGE_[A-Za-z0-9_]+}/i', \Env::get('cx')->getPage()->getContent())) {
                     $knowledgeInterface->parse(\Env::get('cx')->getPage()->getContent());
                 }
                 if (preg_match('/{KNOWLEDGE_[A-Za-z0-9_]+}/i', $page_template)) {
                     $knowledgeInterface->parse($page_template);
                 }
                 if (preg_match('/{KNOWLEDGE_[A-Za-z0-9_]+}/i', $themesPages['index'])) {
                     $knowledgeInterface->parse($themesPages['index']);
                 }
             }
             break;
     }
 }
 /**
  * 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;
     }
 }
 public function SearchFindContent($search)
 {
     $term_db = $search->getTerm();
     $flagIsReseller = false;
     $objUser = \FWUser::getFWUserObject()->objUser;
     if ($objUser->login()) {
         $objCustomer = \Cx\Modules\Shop\Controller\Customer::getById($objUser->getId());
         \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
         if ($objCustomer && $objCustomer->is_reseller()) {
             $flagIsReseller = true;
         }
     }
     $querySelect = $queryCount = $queryOrder = null;
     list($querySelect, $queryCount, $queryTail, $queryOrder) = \Cx\Modules\Shop\Controller\Products::getQueryParts(null, null, null, $term_db, false, false, '', $flagIsReseller);
     $query = $querySelect . $queryTail . $queryOrder;
     //Search query
     $parseSearchData = function (&$searchData) {
         $searchData['title'] = $searchData['name'];
         $searchData['content'] = $searchData['long'] ? $searchData['long'] : $searchData['short'];
         $searchData['score'] = $searchData['score1'] + $searchData['score2'] + $searchData['score3'];
     };
     $result = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($search->getResultArray($query, 'Shop', 'details', 'productId=', $search->getTerm(), $parseSearchData));
     $search->appendResult($result);
 }
예제 #10
0
 /**
  *
  * 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;
 }
예제 #11
0
 /**
  * Change Subscription State to Terminate.
  *
  * @throws WebsiteException
  */
 public function terminate()
 {
     global $_ARRAYLANG;
     if ($this->externalSubscriptionId) {
         \Cx\Core\Setting\Controller\Setting::init('MultiSite', '', 'FileSystem');
         $instanceName = \Cx\Core\Setting\Controller\Setting::getValue('payrexxAccount', 'MultiSite');
         $apiSecret = \Cx\Core\Setting\Controller\Setting::getValue('payrexxApiSecret', 'MultiSite');
         if (empty($instanceName) || empty($apiSecret)) {
             return;
         }
         $payrexx = new \Payrexx\Payrexx($instanceName, $apiSecret);
         $subscription = new \Payrexx\Models\Request\Subscription();
         $subscription->setId($this->externalSubscriptionId);
         try {
             $response = $payrexx->cancel($subscription);
             if (isset($response['status']) && $response['status'] != 'success' || isset($response['data']['status']) && $response['data']['status'] != 'cancelled') {
                 throw new SubscriptionException($_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PAYREXX_CANCEL_FAILED']);
             }
         } catch (\Payrexx\PayrexxException $e) {
             throw new SubscriptionException($e->getMessage());
         }
     }
     //set state terminated.
     $this->setState(self::STATE_TERMINATED);
     //Set current date/time
     $this->setTerminationDate(new \DateTime());
     //Trigger the model event terminated on the subscription's product entity.
     \Env::get('cx')->getEvents()->triggerEvent('model/terminated', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
 }
예제 #12
0
 public function showFtp()
 {
     global $_ARRAYLANG, $objTemplate, $_CONFIG;
     $this->strPageTitle = $_ARRAYLANG['TXT_SETTINGS_FTP'];
     $objTemplate->addBlockfile('ADMIN_CONTENT', 'settings_ftp', 'settings_ftp.html');
     //get the ftp server name
     $domainRepo = \Env::get('em')->getRepository('Cx\\Core\\Net\\Model\\Entity\\Domain');
     $objDomain = $domainRepo->findOneBy(array('id' => 0));
     //get the ftp user name
     \Cx\Core\Setting\Controller\Setting::init('MultiSite', 'website', 'FileSystem');
     $ftpUserName = \Cx\Core\Setting\Controller\Setting::getValue('websiteFtpUser', 'MultiSite');
     if (empty($ftpUserName)) {
         throw new \Exception('FTP Failed to load: Website Ftp User is empty');
     }
     $objTemplate->setVariable(array('FTP_SERVER_NAME' => 'ftp://' . $objDomain->getName(), 'FTP_USER_NAME' => $ftpUserName));
     $objTemplate->setVariable(array('TXT_SETTINGS_FTP' => $_ARRAYLANG['TXT_SETTINGS_FTP'], 'TXT_SETTINGS_FTP_SERVER' => $_ARRAYLANG['TXT_SETTINGS_FTP_SERVER'], 'TXT_SETTINGS_FTP_USER' => $_ARRAYLANG['TXT_SETTINGS_FTP_USER'], 'TXT_SETTINGS_FTP_PASSWORD' => $_ARRAYLANG['TXT_SETTINGS_FTP_PASSWORD'], 'TXT_SETTINGS_RESET_PASSWORD' => $_ARRAYLANG['TXT_SETTINGS_RESET_PASSWORD']));
 }
예제 #13
0
 /**
  * Global save function for saving the settings into database
  *
  * @return null
  */
 function _saveSettings()
 {
     global $_ARRAYLANG, $objDatabase;
     foreach ($_POST['settings'] as $name => $value) {
         if (is_array($value)) {
             $value = implode(',', $value);
         }
         $query = "UPDATE " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_settings\n                         SET value = '" . contrexx_addslashes($value) . "'\n                       WHERE name = '" . contrexx_addslashes($name) . "'";
         $objResult = $objDatabase->Execute($query);
     }
     if (isset($_POST['settings']['headlinesStatus'])) {
         \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
         $headLinesStatusIntval = intval($_POST['settings']['headlinesStatus']);
         if (!\Cx\Core\Setting\Controller\Setting::isDefined('calendarheadlines')) {
             \Cx\Core\Setting\Controller\Setting::add('calendarheadlines', $headLinesStatusIntval, 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, '1:TXT_ACTIVATED,0:TXT_DEACTIVATED', 'component');
         } else {
             \Cx\Core\Setting\Controller\Setting::set('calendarheadlines', $headLinesStatusIntval);
             \Cx\Core\Setting\Controller\Setting::update('calendarheadlines');
         }
     }
     if ($objResult !== false) {
         $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_SETTINGS_SUCCESSFULLY_EDITED'];
     } else {
         $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_SETTINGS_CORRUPT_EDITED'];
     }
 }
예제 #14
0
 /**
  * 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;
 }
예제 #15
0
 /**
  * Return the global setting
  *
  * @return string
  * @throws DatabaseError
  * @global $objDatabase
  * @return mixed
  */
 protected function getGlobalSetting()
 {
     //return the global setting('useKnowledgePlaceholders') value
     \Cx\Core\Setting\Controller\Setting::init('Config', 'component', 'Yaml');
     return \Cx\Core\Setting\Controller\Setting::getValue('useKnowledgePlaceholders', 'Config');
 }
예제 #16
0
 /**
  * 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;
 }
 /**
  * Show the last run's crawler result
  * 
  * @global array $_ARRAYLANG 
  */
 public function showCrawlerResult()
 {
     global $_ARRAYLANG;
     \JS::activate('cx');
     $objCx = \ContrexxJavascript::getInstance();
     $objCx->setVariable(array('updateSuccessMsg' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_UPDATE_SUCCESS_MSG'], 'loadingLabel' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LABEL_LOADING']), 'LinkManager');
     if (isset($_POST['checkAgain'])) {
         $this->recheckSelectedLinks();
     }
     //show crawler results
     //get parameters
     $pos = isset($_GET['pos']) ? $_GET['pos'] : 0;
     //set the settings value from DB
     \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config');
     $pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager');
     $parameter = './index.php?cmd=' . $this->moduleName . '&act=crawlerResult';
     $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->linkRepository->brokenLinkCount(), $pageLimit, true, $pos, 'pos'));
     $brokenLinks = $this->linkRepository->getBrokenLinks($pos, $pageLimit);
     $i = 1;
     $objUser = new \Cx\Core_Modules\LinkManager\Controller\User();
     if ($brokenLinks && $brokenLinks->count() > 0) {
         foreach ($brokenLinks as $brokenLink) {
             $this->template->setVariable(array($this->moduleNameLang . '_BROKEN_LINK_ID' => contrexx_raw2xhtml($brokenLink->getId()), $this->moduleNameLang . '_BROKEN_LINK_IMAGE' => $brokenLink->getBrokenLinkText() == $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NO_IMAGE'] ? 'brokenImage' : 'brokenLinkImage', $this->moduleNameLang . '_BROKEN_LINK_TEXT' => $brokenLink->getBrokenLinkText(), $this->moduleNameLang . '_BROKEN_LINK_URL' => contrexx_raw2xhtml($brokenLink->getRequestedPath()), $this->moduleNameLang . '_BROKEN_LINK_REFERER' => contrexx_raw2xhtml($brokenLink->getLeadPath()) . '&pos=' . $pos . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code(), $this->moduleNameLang . '_BROKEN_LINK_MODULE_NAME' => contrexx_raw2xhtml($brokenLink->getModuleName()), $this->moduleNameLang . '_BROKEN_LINK_ENTRY_TITLE' => contrexx_raw2xhtml($brokenLink->getEntryTitle()), $this->moduleNameLang . '_BROKEN_LINK_STATUS_CODE' => $brokenLink->getLinkStatusCode() == 0 ? $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NON_EXISTING_DOMAIN'] : contrexx_raw2xhtml($brokenLink->getLinkStatusCode()), $this->moduleNameLang . '_BROKEN_LINK_STATUS' => $brokenLink->getLinkStatus() ? $brokenLink->getLinkStatus() : 0, $this->moduleNameLang . '_BROKEN_LINK_STATUS_CHECKED' => $brokenLink->getLinkStatus() ? 'checked' : '', $this->moduleNameLang . '_BROKEN_LINK_DETECTED' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($brokenLink->getDetectedTime()), $this->moduleNameLang . '_BROKEN_LINK_UPDATED_BY' => $brokenLink->getUpdatedBy() ? contrexx_raw2xhtml($objUser->getUpdatedUserName($brokenLink->getUpdatedBy(), 0)) : '', $this->moduleNameLang . '_CRAWLER_BROKEN_LINK' => $brokenLink->getLinkRecheck() && $brokenLink->getLinkStatus() ? 'brokenLink' : '', $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1)));
             $this->template->parse($this->moduleName . 'CrawlerResultList');
         }
         $this->template->hideBlock('LinkManagerNoCrawlerResultFound');
     } else {
         $this->template->touchBlock('LinkManagerNoCrawlerResultFound');
     }
 }
예제 #19
0
 /**
  * Generates a new dynamic access-ID
  *
  * @return mixed    Returns the newly created dynamic access-ID or FALSE on failure.
  */
 public static function createNewDynamicAccessId()
 {
     \Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml');
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('lastAccessId')) {
         $newAccessId = 1;
         \Cx\Core\Setting\Controller\Setting::add('lastAccessId', $newAccessId, 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, '', 'core');
     } else {
         $newAccessId = \Cx\Core\Setting\Controller\Setting::getValue('lastAccessId', 'Config') + 1;
         \Cx\Core\Setting\Controller\Setting::set('lastAccessId', $newAccessId);
         if (!\Cx\Core\Setting\Controller\Setting::update('lastAccessId')) {
             return false;
         }
     }
     // verify that the update was successful
     \Cx\Core\Setting\Controller\Setting::init('Config', 'core', 'Yaml');
     if (\Cx\Core\Setting\Controller\Setting::getValue('lastAccessId', 'Config') != $newAccessId) {
         return false;
     }
     return $newAccessId;
 }
예제 #20
0
 /**
  * Updates the providers and write changes to the setting db.
  * The provider array has to be two dimensional.
  *
  * array(
  *     ProviderName1 => array(provider_app_id, provider_app_secret),
  *     ProviderName1 => array(provider_app_id, provider_app_secret),
  * )
  *
  * @static
  * @param array $providers the new provider data
  */
 public static function updateProviders($providers)
 {
     \Cx\Core\Setting\Controller\Setting::init('Access', 'sociallogin');
     \Cx\Core\Setting\Controller\Setting::set('providers', json_encode($providers));
     \Cx\Core\Setting\Controller\Setting::update('providers');
 }
예제 #21
0
 /**
  * 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");
         }
     }
 }
예제 #22
0
 private function saveSettings()
 {
     global $objDatabase;
     /**
      * save mailtemplates
      */
     foreach ($_POST["filesharingMail"] as $lang => $inputs) {
         $objMailTemplate = $objDatabase->Execute("SELECT `subject`, `content` FROM " . DBPREFIX . "module_filesharing_mail_template WHERE `lang_id` = " . intval($lang));
         $content = str_replace(array('{', '}'), array('[[', ']]'), contrexx_input2db($inputs["content"]));
         if ($objMailTemplate === false or $objMailTemplate->RecordCount() == 0) {
             $objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_filesharing_mail_template (`subject`, `content`, `lang_id`) VALUES ('" . contrexx_input2db($inputs["subject"]) . "', '" . contrexx_raw2db($content) . "', '" . contrexx_raw2db($lang) . "')");
         } else {
             $objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing_mail_template SET `subject` = '" . contrexx_input2db($inputs["subject"]) . "', `content` = '" . contrexx_raw2db($content) . "' WHERE `lang_id` = '" . contrexx_raw2db($lang) . "'");
         }
     }
     /**
      * save permissions
      */
     \Cx\Core\Setting\Controller\Setting::init('FileSharing', 'config');
     $oldFilesharingSetting = \Cx\Core\Setting\Controller\Setting::getValue('permission', 'FileSharing');
     $newFilesharingSetting = $_POST['filesharingSettingsPermission'];
     if (!is_numeric($newFilesharingSetting)) {
         if (is_numeric($oldFilesharingSetting)) {
             // remove AccessId
             \Permission::removeAccess($oldFilesharingSetting, 'dynamic');
         }
     } else {
         $accessGroups = '';
         if (isset($_POST['filesharing_access_associated_groups'])) {
             $accessGroups = $_POST['filesharing_access_associated_groups'];
         }
         // get groups
         \Permission::removeAccess($oldFilesharingSetting, 'dynamic');
         if (isset($_POST['filesharing_access_associated_groups'])) {
             $accessGroups = $_POST['filesharing_access_associated_groups'];
         }
         // add AccessID
         $newFilesharingSetting = \Permission::createNewDynamicAccessId();
         // save AccessID
         if (count($accessGroups)) {
             \Permission::setAccess($newFilesharingSetting, 'dynamic', $accessGroups);
         }
     }
     // save new setting
     \Cx\Core\Setting\Controller\Setting::set('permission', $newFilesharingSetting);
     \Cx\Core\Setting\Controller\Setting::updateAll();
 }
예제 #23
0
    $contrexx_path = dirname(dirname(dirname(dirname(__FILE__))));
}
require_once $contrexx_path . '/core/Core/init.php';
$cx = init('minimal');
$sessionObj = \cmsSession::getInstance();
$_SESSION->cmsSessionStatusUpdate('backend');
$pageId = !empty($_GET['pageId']) ? $_GET['pageId'] : null;
//get the main domain
$domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
$mainDomain = $domainRepository->getMainDomain()->getName();
//find the right css files and put it into the wysiwyg
$em = $cx->getDb()->getEntityManager();
$componentRepo = $em->getRepository('Cx\\Core\\Core\\Model\\Entity\\SystemComponent');
$wysiwyg = $componentRepo->findOneBy(array('name' => 'Wysiwyg'));
$pageRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
\Cx\Core\Setting\Controller\Setting::init('Wysiwyg', 'config', 'Yaml');
$skinId = 0;
if (!empty($pageId) && $pageId != 'new') {
    $skinId = $pageRepo->find($pageId)->getSkin();
}
$ymlOption = $wysiwyg->getCustomCSSVariables($skinId);
?>
//if the wysiwyg css not defined in the session, then load the css variables and put it into the session
if(!cx.variables.get('css', 'wysiwyg')) {
    cx.variables.set('css', [<?php 
echo '\'' . implode($ymlOption['css'], '\',\'') . '\'';
?>
], 'wysiwyg');
    cx.variables.set('bodyClass', <?php 
echo '\'' . $ymlOption['bodyClass'] . '\'';
?>
예제 #24
0
 private function deactivateSetting($config)
 {
     if (\Permission::checkAccess(17, 'static', true)) {
         \Cx\Core\Setting\Controller\Setting::init('Config', 'administrationArea', 'Yaml');
         if (!\Cx\Core\Setting\Controller\Setting::isDefined($config)) {
             $status = \Cx\Core\Setting\Controller\Setting::add($config, 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:TXT_ACTIVATED,off:TXT_DEACTIVATED', 'administrationArea');
         } else {
             \Cx\Core\Setting\Controller\Setting::set($config, 'off');
             $status = \Cx\Core\Setting\Controller\Setting::update($config);
         }
         if ($status) {
             die('success');
         }
     }
     die('error');
 }
예제 #25
0
 /** 
  * gets default port from settings
  */
 function getDefaultPort()
 {
     $mode = $this->getMode() == \Cx\Core\Core\Controller\Cx::MODE_BACKEND ? 'Backend' : 'Frontend';
     \Cx\Core\Setting\Controller\Setting::init('Config', null, 'Yaml', null, \Cx\Core\Setting\Controller\Setting::NOT_POPULATE);
     $protocol = strtoupper($this->getProtocol());
     $port = \Cx\Core\Setting\Controller\Setting::getValue('port' . $mode . $protocol, 'Config');
     return $port;
 }
예제 #26
0
 /**
  * Update settings and write them to the database
  *
  * @global     object    $objDatabase
  * @global     object    $objTemplate
  * @global     array    $_ARRAYLANG
  */
 function updateSettings()
 {
     global $objDatabase, $objTemplate, $_ARRAYLANG, $_CONFIG;
     if (!isset($_POST['frmSettings_Submit'])) {
         return;
     }
     \Cx\Core\Setting\Controller\Setting::init('Config', 'cache', 'Yaml');
     \Cx\Core\Setting\Controller\Setting::set('cacheEnabled', $_POST['cachingStatus']);
     \Cx\Core\Setting\Controller\Setting::set('cacheExpiration', intval($_POST['cachingExpiration']));
     \Cx\Core\Setting\Controller\Setting::set('cacheUserCache', contrexx_input2db($_POST['usercache']));
     \Cx\Core\Setting\Controller\Setting::set('cacheOPCache', contrexx_input2db($_POST['opcache']));
     \Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
     \Cx\Core\Setting\Controller\Setting::set('cacheOpStatus', contrexx_input2db($_POST['cacheOpStatus']));
     \Cx\Core\Setting\Controller\Setting::set('cacheDbStatus', contrexx_input2db($_POST['cacheDbStatus']));
     \Cx\Core\Setting\Controller\Setting::set('cacheReverseProxy', contrexx_input2db($_POST['cacheReverseProxy']));
     \Cx\Core\Setting\Controller\Setting::set('internalSsiCache', contrexx_input2db($_POST['internalSsiCache']));
     $oldSsiValue = $_CONFIG['cacheSsiOutput'];
     \Cx\Core\Setting\Controller\Setting::set('cacheSsiOutput', contrexx_input2db($_POST['cacheSsiOutput']));
     \Cx\Core\Setting\Controller\Setting::set('cacheSsiType', contrexx_input2db($_POST['cacheSsiType']));
     foreach (array('cacheUserCacheMemcacheConfig' => array('key' => 'memcacheSetting', 'defaultPort' => 11211), 'cacheProxyCacheConfig' => array('key' => 'reverseProxy', 'defaultPort' => 8080), 'cacheSsiProcessorConfig' => array('key' => 'ssiProcessor', 'defaultPort' => 8080)) as $settingName => $settings) {
         $hostnamePortSetting = $settings['key'];
         if (!empty($_POST[$hostnamePortSetting . 'Ip']) || !empty($_POST[$hostnamePortSetting . 'Port'])) {
             $settings = json_encode(array('ip' => !empty($_POST[$hostnamePortSetting . 'Ip']) ? contrexx_input2raw($_POST[$hostnamePortSetting . 'Ip']) : '127.0.0.1', 'port' => !empty($_POST[$hostnamePortSetting . 'Port']) ? intval($_POST[$hostnamePortSetting . 'Port']) : $defaultPort));
             \Cx\Core\Setting\Controller\Setting::set($settingName, $settings);
         }
     }
     \Cx\Core\Setting\Controller\Setting::updateAll();
     $this->arrSettings = $this->getSettings();
     $this->initUserCaching();
     // reinit user caches (especially memcache)
     $this->initOPCaching();
     // reinit opcaches
     $this->getActivatedCacheEngines();
     $this->clearCache($this->getOpCacheEngine());
     if ($oldSsiValue != contrexx_input2db($_POST['cacheSsiOutput'])) {
         $this->_deleteAllFiles('cxPages');
     }
     if (!count($this->objSettings->strErrMessage)) {
         $objTemplate->SetVariable('CONTENT_OK_MESSAGE', $_ARRAYLANG['TXT_SETTINGS_UPDATED']);
     } else {
         $objTemplate->SetVariable('CONTENT_STATUS_MESSAGE', implode("<br />\n", $this->objSettings->strErrMessage));
     }
 }
예제 #27
0
 /**
  * Adding Crm Contact and link it with crm company if possible
  *
  * @param Array $arrFormData form data's
  * @param int $userAccountId
  * @param int $frontendLanguage
  * @global <object> $objDatabase
  * @global int $_LANGID
  *
  */
 function setContactPersonProfile($arrFormData = array(), $userAccountId = 0, $frontendLanguage)
 {
     global $objDatabase, $_LANGID;
     $this->contact = new \Cx\Modules\Crm\Model\Entity\CrmContact();
     if (!empty($userAccountId)) {
         $userExists = $objDatabase->Execute("SELECT id FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_contacts` WHERE user_account = {$userAccountId}");
         if ($userExists && $userExists->RecordCount()) {
             $id = (int) $userExists->fields['id'];
             $this->contact->load($id);
             $this->contact->customerName = !empty($arrFormData['firstname'][0]) ? contrexx_input2raw($arrFormData['firstname'][0]) : '';
             $this->contact->family_name = !empty($arrFormData['lastname'][0]) ? contrexx_input2raw($arrFormData['lastname'][0]) : '';
             $this->contact->contact_language = !empty($frontendLanguage) ? (int) $frontendLanguage : $_LANGID;
             $this->contact->contact_gender = !empty($arrFormData['gender'][0]) ? $arrFormData['gender'][0] == 'gender_female' ? 1 : ($arrFormData['gender'][0] == 'gender_male' ? 2 : '') : '';
             $this->contact->contactType = 2;
             $this->contact->datasource = 2;
             $this->contact->account_id = $userAccountId;
             //set profile picture
             if (!empty($arrFormData['picture'][0])) {
                 $picture = $arrFormData['picture'][0];
                 $cx = \Cx\Core\Core\Controller\Cx::instanciate();
                 if (!file_exists($cx->getWebsiteImagesCrmProfilePath() . '/' . $picture)) {
                     $file = $cx->getWebsiteImagesAccessProfilePath() . '/';
                     $newFile = $cx->getWebsiteImagesCrmProfilePath() . '/';
                     if (copy($file . $picture, $newFile . $picture)) {
                         if ($this->createThumbnailOfPicture($picture)) {
                             $this->contact->profile_picture = $picture;
                         }
                     }
                 }
             } else {
                 $this->contact->profile_picture = 'profile_person_big.png';
             }
             // save current setting values, so we can switch back to them after we got our used settings out of database
             $prevSection = \Cx\Core\Setting\Controller\Setting::getCurrentSection();
             $prevGroup = \Cx\Core\Setting\Controller\Setting::getCurrentGroup();
             $prevEngine = \Cx\Core\Setting\Controller\Setting::getCurrentEngine();
             \Cx\Core\Setting\Controller\Setting::init('Crm', 'config');
             if ($arrFormData["company"][0] != "") {
                 $crmCompany = new \Cx\Modules\Crm\Model\Entity\CrmContact();
                 if ($this->contact->contact_customer != 0) {
                     $crmCompany->load($this->contact->contact_customer);
                 }
                 $crmCompany->customerName = $arrFormData["company"][0];
                 $crmCompany->contactType = 1;
                 $customerType = $arrFormData[\Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_type', 'Crm')][0];
                 if ($customerType !== false) {
                     $crmCompany->customerType = $customerType;
                 }
                 $companySize = $arrFormData[\Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_company_size', 'Crm')][0];
                 if ($companySize !== false) {
                     $crmCompany->companySize = $companySize;
                 }
                 $industryType = $arrFormData[\Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_industry_type', 'Crm')][0];
                 if ($industryType !== false) {
                     $crmCompany->industryType = $industryType;
                 }
                 if (isset($arrFormData["phone_office"])) {
                     $crmCompany->phone = $arrFormData["phone_office"];
                 }
                 // store/update the company profile
                 $crmCompany->save();
                 // setting & storing the primary email address must be done after
                 // the company has been saved for the case where the company is
                 // being added as a new object without having an ID yet
                 if (empty($crmCompany->email)) {
                     $crmCompany->email = $this->contact->email;
                     $crmCompany->storeEMail();
                 }
                 $this->contact->contact_customer = $crmCompany->id;
             }
             if ($this->contact->save()) {
                 // insert website
                 if (!empty($arrFormData['website'][0])) {
                     $webExists = $objDatabase->SelectLimit("SELECT 1 FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_contact_websites` WHERE is_primary = '1' AND contact_id = '{$this->contact->id}'");
                     $fields = array('url' => $arrFormData['website'][0], 'url_profile' => '1', 'is_primary' => '1', 'contact_id' => $this->contact->id);
                     if ($webExists) {
                         $query = \SQL::update("module_{$this->moduleNameLC}_customer_contact_websites", $fields, array('escape' => true)) . " WHERE is_primary = '1' AND `contact_id` = {$this->contact->id}";
                     } else {
                         $query = \SQL::insert("module_{$this->moduleNameLC}_customer_contact_websites", $fields, array('escape' => true));
                     }
                     $db = $objDatabase->Execute($query);
                 }
                 //insert address
                 if (!empty($arrFormData['address'][0]) || !empty($arrFormData['city'][0]) || !empty($arrFormData['zip'][0]) || !empty($arrFormData['country'][0])) {
                     $addressExists = $objDatabase->SelectLimit("SELECT 1 FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_contact_address` WHERE is_primary = '1' AND contact_id = '{$this->contact->id}'");
                     $country = \Cx\Core\Country\Controller\Country::getById($arrFormData['country'][0]);
                     if ($addressExists && $addressExists->RecordCount()) {
                         $query = "UPDATE `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_contact_address` SET\n                                    address      = '" . contrexx_input2db($arrFormData['address'][0]) . "',\n                                    city         = '" . contrexx_input2db($arrFormData['city'][0]) . "',\n                                    zip          = '" . contrexx_input2db($arrFormData['zip'][0]) . "',\n                                    country      = '" . $country['name'] . "',\n                                    Address_Type = '2'\n                                 WHERE is_primary   = '1' AND contact_id   = '{$this->contact->id}'";
                     } else {
                         $query = "INSERT INTO `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_contact_address` SET\n                                    address      = '" . contrexx_input2db($arrFormData['address'][0]) . "',\n                                    city         = '" . contrexx_input2db($arrFormData['city'][0]) . "',\n                                    state        = '" . contrexx_input2db($arrFormData['city'][0]) . "',\n                                    zip          = '" . contrexx_input2db($arrFormData['zip'][0]) . "',\n                                    country      = '" . $country['name'] . "',\n                                    Address_Type = '2',\n                                    is_primary   = '1',\n                                    contact_id   = '{$this->contact->id}'";
                     }
                     $objDatabase->Execute($query);
                 }
                 // insert Phone
                 $contactPhone = array();
                 if (!empty($arrFormData['phone_office'][0])) {
                     $phoneExists = $objDatabase->SelectLimit("SELECT 1 FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_contact_phone` WHERE is_primary = '1' AND contact_id = '{$this->contact->id}'");
                     $fields = array('phone' => $arrFormData['phone_office'][0], 'phone_type' => '1', 'is_primary' => '1', 'contact_id' => $this->contact->id);
                     if ($phoneExists && $phoneExists->RecordCount()) {
                         $query = \SQL::update("module_{$this->moduleNameLC}_customer_contact_phone", $fields, array('escape' => true)) . " WHERE is_primary = '1' AND `contact_id` = {$this->contact->id}";
                     } else {
                         $query = \SQL::insert("module_{$this->moduleNameLC}_customer_contact_phone", $fields, array('escape' => true));
                     }
                     $objDatabase->Execute($query);
                 }
             }
             \Cx\Core\Setting\Controller\Setting::init($prevSection, $prevGroup, $prevEngine);
         }
     }
 }
예제 #28
0
 /**
  * Sets up a Product list in the given template
  *
  * If no Category ID is given, includes Products as indicated by the
  * show_products_default setting.
  * Otherwise, includes Products from the Category with the given ID.
  * Note that you cannot use more than one such block per template!
  * This would cause duplicate block names.
  * Changes the $_REQUEST array temporarily and calls
  * {@see view_product_overview()}, then restores the original request.
  * @param   \Cx\Core\Html\Sigma $template       The template
  * @param   integer             $category_id    The optional Category ID
  * @return  \Cx\Core\Html\Sigma                 The parsed template
  */
 static function parse_products_blocks(\Cx\Core\Html\Sigma $template)
 {
     global $objInit, $_ARRAYLANG;
     if (!\Cx\Core\Setting\Controller\Setting::init('Shop', 'config')) {
         return false;
     }
     $_ARRAYLANG += $objInit->loadLanguageData('Shop');
     $original_REQUEST =& $_REQUEST;
     self::$objTemplate = $template;
     $match = null;
     foreach (array_keys($template->_blocks) as $block) {
         // Match "block_shop_products" or "block_shop_products_category_X"
         if (preg_match('/^' . self::block_shop_products . '(?:_category_(\\d+))?$/', $block, $match)) {
             if (!self::$initialized) {
                 self::init();
             }
             $_REQUEST = array();
             // You might add more parameters here!
             if (isset($match[1])) {
                 $_REQUEST['catId'] = $match[1];
             }
             self::view_product_overview();
             break;
         }
     }
     $_REQUEST =& $original_REQUEST;
     return $template;
 }
 /**
  * Searches the content and returns an array that is built as needed by the search module.
  *
  * @param string $searchTerm
  *
  * @return array
  */
 public function searchResultsForSearchModule($searchTerm)
 {
     $em = \Env::get('cx')->getDb()->getEntityManager();
     $pageRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
     // only list results in case the associated page of the module is active
     $page = $pageRepo->findOneBy(array('module' => 'MediaDir', 'lang' => FRONTEND_LANG_ID, 'type' => \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION));
     //If page is not exists or page is inactive then return empty result
     if (!$page || !$page->isActive()) {
         return array();
     }
     //get the config site values
     \Cx\Core\Setting\Controller\Setting::init('Config', 'site', 'Yaml');
     $coreListProtectedPages = \Cx\Core\Setting\Controller\Setting::getValue('coreListProtectedPages', 'Config');
     $searchVisibleContentOnly = \Cx\Core\Setting\Controller\Setting::getValue('searchVisibleContentOnly', 'Config');
     //get the config otherConfigurations value
     \Cx\Core\Setting\Controller\Setting::init('Config', 'otherConfigurations', 'Yaml');
     $searchDescriptionLength = \Cx\Core\Setting\Controller\Setting::getValue('searchDescriptionLength', 'Config');
     $hasPageAccess = true;
     $isNotVisible = $searchVisibleContentOnly == 'on' && !$page->isVisible();
     if ($coreListProtectedPages == 'off' && $page->isFrontendProtected()) {
         $hasPageAccess = \Permission::checkAccess($page->getFrontendAccessId(), 'dynamic', true);
     }
     //If the page is invisible and frontend access is denied then return empty result
     if ($isNotVisible || !$hasPageAccess) {
         return array();
     }
     //get the media directory entry by the search term
     $entries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($this->moduleName);
     $entries->getEntries(null, null, null, $searchTerm);
     //if no entries found then return empty result
     if (empty($entries->arrEntries)) {
         return array();
     }
     $results = array();
     $formEntries = array();
     $defaultEntries = null;
     $objForm = new \Cx\Modules\MediaDir\Controller\MediaDirectoryForm(null, $this->moduleName);
     $numOfEntries = intval($entries->arrSettings['settingsPagingNumEntries']);
     foreach ($entries->arrEntries as $entry) {
         $pageUrlResult = null;
         $entryForm = $objForm->arrForms[$entry['entryFormId']];
         //Get the entry's link url
         //check the entry's form detail view exists if not,
         //check the entry's form overview exists if not,
         //check the default overview exists if not, dont show the corresponding entry in entry
         switch (true) {
             case $entries->checkPageCmd('detail' . $entry['entryFormId']):
                 $pageUrlResult = \Cx\Core\Routing\Url::fromModuleAndCmd($entries->moduleName, 'detail' . $entry['entryFormId'], FRONTEND_LANG_ID, array('eid' => $entry['entryId']));
                 break;
             case $pageCmdExists = $entries->checkPageCmd($entryForm['formCmd']):
             case $entries->checkPageCmd(''):
                 if ($pageCmdExists && !isset($formEntries[$entryForm['formCmd']])) {
                     $formEntries[$entryForm['formCmd']] = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($entries->moduleName);
                     $formEntries[$entryForm['formCmd']]->getEntries(null, null, null, null, null, null, 1, null, 'n', null, null, $entryForm['formId']);
                 }
                 if (!$pageCmdExists && !isset($defaultEntries)) {
                     $defaultEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($entries->moduleName);
                     $defaultEntries->getEntries();
                 }
                 //get entry's form overview / default page paging position
                 $entriesPerPage = $numOfEntries;
                 if ($pageCmdExists) {
                     $entriesPerPage = !empty($entryForm['formEntriesPerPage']) ? $entryForm['formEntriesPerPage'] : $numOfEntries;
                 }
                 $pageCmd = $pageCmdExists ? $entryForm['formCmd'] : '';
                 $entryKeys = $pageCmdExists ? array_keys($formEntries[$entryForm['formCmd']]->arrEntries) : array_keys($defaultEntries->arrEntries);
                 $entryPos = array_search($entry['entryId'], $entryKeys);
                 $position = floor($entryPos / $entriesPerPage);
                 $pageUrlResult = \Cx\Core\Routing\Url::fromModuleAndCmd($entries->moduleName, $pageCmd, FRONTEND_LANG_ID, array('pos' => $position * $entriesPerPage));
                 break;
             default:
                 break;
         }
         //If page url is empty then dont show it in the result
         if (!$pageUrlResult) {
             continue;
         }
         //Get the search results title and content from the form context field 'title' and 'content'
         $title = current($entry['entryFields']);
         $content = '';
         $objInputfields = new MediaDirectoryInputfield($entry['entryFormId'], false, $entry['entryTranslationStatus'], $this->moduleName);
         $inputFields = $objInputfields->getInputfields();
         foreach ($inputFields as $arrInputfield) {
             $contextType = isset($arrInputfield['context_type']) ? $arrInputfield['context_type'] : '';
             if (!in_array($contextType, array('title', 'content'))) {
                 continue;
             }
             $strType = isset($arrInputfield['type_name']) ? $arrInputfield['type_name'] : '';
             $strInputfieldClass = "\\Cx\\Modules\\MediaDir\\Model\\Entity\\MediaDirectoryInputfield" . ucfirst($strType);
             try {
                 $objInputfield = safeNew($strInputfieldClass, $this->moduleName);
                 $arrTranslationStatus = contrexx_input2int($arrInputfield['type_multi_lang']) == 1 ? $entry['entryTranslationStatus'] : null;
                 $arrInputfieldContent = $objInputfield->getContent($entry['entryId'], $arrInputfield, $arrTranslationStatus);
                 if (\Cx\Core\Core\Controller\Cx::instanciate()->getMode() == \Cx\Core\Core\Controller\Cx::MODE_FRONTEND && \Cx\Core\Setting\Controller\Setting::getValue('blockStatus', 'Config')) {
                     $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'] = preg_replace('/\\[\\[(BLOCK_[A-Z0-9_-]+)\\]\\]/', '{\\1}', $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE']);
                     \Cx\Modules\Block\Controller\Block::setBlocks($arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'], \Cx\Core\Core\Controller\Cx::instanciate()->getPage());
                 }
             } catch (\Exception $e) {
                 \DBG::log($e->getMessage());
                 continue;
             }
             $inputFieldValue = $arrInputfieldContent[$this->moduleConstVar . '_INPUTFIELD_VALUE'];
             if (empty($inputFieldValue)) {
                 continue;
             }
             if ($contextType == 'title') {
                 $title = $inputFieldValue;
             } elseif ($contextType == 'content') {
                 $content = \Cx\Core_Modules\Search\Controller\Search::shortenSearchContent($inputFieldValue, $searchDescriptionLength);
             }
         }
         $results[] = array('Score' => 100, 'Title' => html_entity_decode(contrexx_strip_tags($title), ENT_QUOTES, CONTREXX_CHARSET), 'Content' => $content, 'Link' => $pageUrlResult->toString());
     }
     return $results;
 }
예제 #30
0
 /**
  * Creates an array containing all important cache-settings
  *
  * @global     object    $objDatabase
  * @return    array    $arrSettings
  */
 function getSettings()
 {
     $arrSettings = array();
     \Cx\Core\Setting\Controller\Setting::init('Config', NULL, 'Yaml');
     $ymlArray = \Cx\Core\Setting\Controller\Setting::getArray('Config', null);
     foreach ($ymlArray as $key => $ymlValue) {
         $arrSettings[$key] = $ymlValue['value'];
     }
     return $arrSettings;
 }