/**
  * Update ePayment status.
  *
  * @access      public
  * @param       integer     $status
  * @return      boolean
  */
 public function setEpaymentStatus($status)
 {
     $objResult = $this->objDatabase->Execute('UPDATE `' . DBPREFIX . 'module_checkout_settings_general` SET `value`=' . intval($status) . ' WHERE `id`=1');
     if ($objResult) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * Update settings.
  *
  * @access      public
  * @param       array       $arrYellowpay
  */
 public function update($arrYellowpay)
 {
     foreach ($arrYellowpay as $name => $value) {
         $objResult = $this->objDatabase->Execute('
             UPDATE `' . DBPREFIX . 'module_checkout_settings_yellowpay`
             SET `value`="' . contrexx_raw2db($value) . '"
             WHERE `name`="' . $name . '"
         ');
         if (!$objResult) {
             return false;
         }
     }
     return true;
 }
Esempio n. 3
0
 /**
  * Initialisation
  *
  * @access  private
  */
 private function init()
 {
     // check the content for installed and used modules
     $arrCmActiveModules = array();
     $arrCmInstalledModules = array();
     $qb = $this->em->createQueryBuilder();
     $qb->add('select', 'p')->add('from', 'Cx\\Core\\ContentManager\\Model\\Entity\\Page p')->add('where', $qb->expr()->neq('p.module', $qb->expr()->literal('')));
     $pages = $qb->getQuery()->getResult();
     foreach ($pages as $page) {
         $arrCmInstalledModules[] = $page->getModule();
         if ($page->isActive()) {
             $arrCmActiveModules[] = $page->getModule();
         }
     }
     $arrCmInstalledModules = array_unique($arrCmInstalledModules);
     $arrCmActiveModules = array_unique($arrCmActiveModules);
     // add static modules
     $arrCmInstalledModules[] = 'Block';
     $arrCmInstalledModules[] = 'Crm';
     $arrCmInstalledModules[] = 'Order';
     $arrCmInstalledModules[] = 'Pim';
     $arrCmInstalledModules[] = 'Support';
     $arrCmActiveModules[] = 'Block';
     $arrCmInstalledModules[] = 'upload';
     $arrCmActiveModules[] = 'upload';
     $objResult = $this->db->Execute('SELECT `name`, `is_core`, `is_required` FROM `' . DBPREFIX . 'modules`');
     if ($objResult !== false) {
         while (!$objResult->EOF) {
             $moduleName = $objResult->fields['name'];
             if ($moduleName == 'News') {
                 $this->arrModules[] = $moduleName;
                 //$this->arrCoreModules[] = $moduleName;
                 if (in_array($moduleName, $arrCmInstalledModules)) {
                     $this->arrInstalledModules[] = $moduleName;
                     if (in_array($moduleName, $arrCmInstalledModules)) {
                         $this->arrActiveModules[] = $moduleName;
                     }
                 }
                 $objResult->MoveNext();
                 continue;
             }
             if (!empty($moduleName)) {
                 $isCore = $objResult->fields['is_core'];
                 if ($isCore == 1) {
                     $this->arrCoreModules[] = $moduleName;
                 } else {
                     $this->arrModules[] = $moduleName;
                 }
                 if (in_array($moduleName, $arrCmInstalledModules) && ($isCore || !$isCore && is_dir($this->cl->getFilePath(ASCMS_MODULE_PATH . '/' . $moduleName)))) {
                     $this->arrInstalledModules[] = $moduleName;
                 }
                 if (in_array($moduleName, $arrCmActiveModules) && ($isCore || !$isCore && is_dir($this->cl->getFilePath(ASCMS_MODULE_PATH . '/' . $moduleName)))) {
                     $this->arrActiveModules[] = $moduleName;
                 }
             }
             $objResult->MoveNext();
         }
     }
 }
Esempio n. 4
0
 /**
  * Update existing transaction.
  *
  * @access      public
  * @param       integer     $id         id of transaction
  * @param       integer     $status     status of transaction
  * @return      boolean                 status of update
  */
 public function updateStatus($id, $status)
 {
     $objResult = $this->objDatabase->Execute('UPDATE `' . DBPREFIX . 'module_checkout_transactions` SET `status`="' . contrexx_raw2db($status) . '", `time`=' . time() . ' WHERE `id`=' . intval($id));
     if ($objResult && $this->objDatabase->Affected_Rows() > 0) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 5
0
 /**
  * See ADONewConnection::NextID()
  *
  * @access  public
  * @param   mixed
  * @return  mixed
  */
 public function _nextId($sequence)
 {
     $nextId = $this->db->NextID($sequence);
     // workaround since ADOConnection::NextID() doesn't return the last inserted id in `contrexx_module_news_categories_catid`
     if (empty($nextId) && $sequence == DBPREFIX . 'module_news_categories_catid') {
         if ($objResult = $this->db->Execute('SELECT `id` FROM `' . contrexx_raw2db($sequence) . '` LIMIT 1')) {
             $nextId = $objResult->fields['id'];
         }
     }
     return $nextId;
 }
Esempio n. 6
0
 /**
  * Update customer mail.
  *
  * @access      public
  * @param       array       $arrCustomerMail
  */
 public function updateCustomerMail($arrCustomerMail)
 {
     $objResult = $this->objDatabase->Execute('
         UPDATE `' . DBPREFIX . 'module_checkout_settings_mails`
         SET `title`="' . contrexx_raw2db($arrCustomerMail['title']) . '",
             `content`="' . contrexx_raw2db($arrCustomerMail['content']) . '"
         WHERE `id`=2
     ');
     if ($objResult) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 7
0
 /**
  * Sets the MySQL default timezone
  *
  * @access  private
  * @param   ADONewConnection    $objDatabase
  * @param   string              $timezone
  */
 private function setTimezone($objDatabase, $timezone = '')
 {
     $arrTimezones = timezone_identifiers_list();
     if (empty($timezone)) {
         $timezone = isset($_SESSION['installer']['config']['timezone']) ? $_SESSION['installer']['config']['timezone'] : '';
     }
     if (array_key_exists($timezone, $arrTimezones)) {
         $timezone = $arrTimezones[$timezone];
     }
     if ($timezone !== '' && (in_array($timezone, $arrTimezones) || $timezone == 'UTC')) {
         if (!$objDatabase->Execute('SET TIME_ZONE = "' . addslashes($timezone) . '"')) {
             //calculate and set the timezone offset if the mysql timezone tables aren't loaded
             $objDateTimeZone = new DateTimeZone($timezone);
             $objDateTime = new DateTime('now', $objDateTimeZone);
             $offset = $objDateTimeZone->getOffset($objDateTime);
             $offsetHours = round(abs($offset) / 3600);
             $offsetMinutes = round((abs($offset) - $offsetHours * 3600) / 60);
             $offsetString = ($offset > 0 ? '+' : '-') . ($offsetHours < 10 ? '0' : '') . $offsetHours . ':' . ($offsetMinutes < 10 ? '0' : '') . $offsetMinutes;
             $objDatabase->Execute('SET TIME_ZONE="' . addslashes($offsetString) . '"');
         }
     }
 }
Esempio n. 8
0
 /**
  *
  * @global type $_POST
  * @param \settingsManager $settingsManager
  * @param \ADONewConnection $objDb 
  */
 public function save($objDb)
 {
     \Cx\Core\Setting\Controller\Setting::init('Config', 'license', 'Yaml');
     // core
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('installationId')) {
         \Cx\Core\Setting\Controller\Setting::add('installationId', $this->getInstallationId(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'core');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('installationId', $this->getInstallationId());
     }
     // license
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseKey')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseKey', $this->getLicenseKey(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseKey', $this->getLicenseKey());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseState')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseState', $this->getState(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseState', $this->getState());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseValidTo')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseValidTo', $this->getValidToDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATETIME, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseValidTo', $this->getValidToDate());
     }
     // we must encode the serialized objects to prevent that non-ascii chars
     // get written into the config/settings.php file
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseMessage')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseMessage', base64_encode(serialize($this->getMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseMessage', base64_encode(serialize($this->getMessages())));
     }
     // see comment above why we encode the serialized data here
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licensePartner')) {
         \Cx\Core\Setting\Controller\Setting::add('licensePartner', base64_encode(serialize($this->getPartner())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licensePartner', base64_encode(serialize($this->getPartner())));
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseCustomer')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseCustomer', base64_encode(serialize($this->getCustomer())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseCustomer', base64_encode(serialize($this->getCustomer())));
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('upgradeUrl')) {
         \Cx\Core\Setting\Controller\Setting::add('upgradeUrl', $this->getUpgradeUrl(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('upgradeUrl', $this->getUpgradeUrl());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseCreatedAt')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseCreatedAt', $this->getCreatedAtDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATE, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseCreatedAt', $this->getCreatedAtDate());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseDomains')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseDomains', base64_encode(serialize($this->getRegisteredDomains())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseDomains', base64_encode(serialize($this->getRegisteredDomains())));
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('availableComponents')) {
         \Cx\Core\Setting\Controller\Setting::add('availableComponents', base64_encode(serialize($this->getAvailableComponents())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('availableComponents', base64_encode(serialize($this->getAvailableComponents())));
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('dashboardMessages')) {
         \Cx\Core\Setting\Controller\Setting::add('dashboardMessages', base64_encode(serialize($this->getDashboardMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('dashboardMessages', base64_encode(serialize($this->getDashboardMessages())));
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('isUpgradable')) {
         \Cx\Core\Setting\Controller\Setting::add('isUpgradable', $this->isUpgradable() ? 'on' : 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:Activated,off:Deactivated', 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('isUpgradable', $this->isUpgradable() ? 'on' : 'off');
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneMessages')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneMessages', base64_encode(serialize($this->getGrayzoneMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseGrayzoneMessages', base64_encode(serialize($this->getGrayzoneMessages())));
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneTime')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneTime', $this->getGrayzoneTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseGrayzoneTime', $this->getGrayzoneTime());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseLockTime')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseLockTime', $this->getFrontendLockTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseLockTime', $this->getFrontendLockTime());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseUpdateInterval')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseUpdateInterval', $this->getRequestInterval(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseUpdateInterval', $this->getRequestInterval());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseFailedUpdate')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseFailedUpdate', $this->getFirstFailedUpdateTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseFailedUpdate', $this->getFirstFailedUpdateTime());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseSuccessfulUpdate')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseSuccessfulUpdate', $this->getLastSuccessfulUpdateTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseSuccessfulUpdate', $this->getLastSuccessfulUpdateTime());
     }
     // release
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsEdition')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsEdition', $this->getEditionName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsEdition', $this->getEditionName());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsVersion')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsVersion', $this->getVersion()->getNumber(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsVersion', $this->getVersion()->getNumber());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsCodeName')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsCodeName', $this->getVersion()->getCodeName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsCodeName', $this->getVersion()->getCodeName());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsStatus')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsStatus', $this->getVersion()->getState(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsStatus', $this->getVersion()->getState());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsReleaseDate')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsReleaseDate', $this->getVersion()->getReleaseDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATE, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsReleaseDate', $this->getVersion()->getReleaseDate());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsName')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsName', $this->getVersion()->getName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsName', $this->getVersion()->getName());
     }
     \Cx\Core\Setting\Controller\Setting::updateAll();
     $query = '
         UPDATE
             ' . DBPREFIX . 'modules
         SET
             `is_licensed` = \'0\' , 
             `additional_data` = NULL
         WHERE
             `distributor` = \'Cloudrexx AG\'
     ';
     $objDb->Execute($query);
     $query = '
         UPDATE
             ' . DBPREFIX . 'modules
         SET
             `is_licensed` = \'1\'
         WHERE
             `name` IN(\'' . implode('\', \'', $this->getLegalComponentsList()) . '\')
     ';
     $objDb->Execute($query);
     //Save legal components additional data values.
     if (!\FWValidator::isEmpty($this->getLegalComponentsAdditionalData())) {
         foreach ($this->getLegalComponentsAdditionalData() as $componentName => $additionalData) {
             if (empty($componentName)) {
                 continue;
             }
             $query = "\n                    UPDATE \n                        " . DBPREFIX . "modules\n                    SET \n                        `additional_data` = '" . contrexx_raw2db(json_encode($additionalData)) . "'\n                    WHERE \n                        `name` = '" . contrexx_raw2db($componentName) . "'\n                    ";
             $objDb->Execute($query);
         }
     }
 }