コード例 #1
0
 public function postFlush($eventArgs)
 {
     try {
         \Cx\Core\Config\Controller\Config::updatePhpCache();
     } catch (\Exception $e) {
         \DBG::msg($e->getMessage());
     }
 }
コード例 #2
0
 public function getPage($post, &$_CORELANG)
 {
     $lc = LicenseCommunicator::getInstance($this->config);
     $lc->addJsUpdateCode($this->lang, $this->license, true, false);
     $sm = new \Cx\Core\Config\Controller\Config();
     if (\FWUser::getFWUserObject()->objUser->getAdminStatus()) {
         if (isset($post['save']) && isset($post['licenseKey'])) {
             $license = License::getCached($this->config, $this->db);
             if ($license->checkSum(contrexx_input2db($post['licenseKey']))) {
                 $license->setLicenseKey(contrexx_input2db($post['licenseKey']));
                 // save it before we check it, so we only change the license key
                 $license->save($this->db);
                 $license->check();
                 $this->license = $license;
             }
         } else {
             if (isset($post['update'])) {
                 // This is only a backup if javascript is bogus
                 try {
                     $lc->update($this->license, $this->config, true, false, $this->lang);
                     $this->license->save($this->db);
                 } catch (\Exception $e) {
                 }
             }
         }
     }
     if (!file_exists(ASCMS_TEMP_PATH . '/licenseManager.html')) {
         try {
             $lc->update($this->license, $this->config, true, true, $this->lang);
             $this->license->save($this->db);
         } catch (\Exception $e) {
         }
     }
     if (file_exists(ASCMS_TEMP_PATH . '/licenseManager.html')) {
         \JS::activate('cx');
         $remoteTemplate = new \Cx\Core\Html\Sigma(ASCMS_TEMP_PATH);
         $remoteTemplate->loadTemplateFile('/licenseManager.html');
         if (isset($_POST['save']) && isset($_POST['licenseKey'])) {
             $remoteTemplate->setVariable('STATUS_TYPE', 'okbox');
             $remoteTemplate->setVariable('STATUS_MESSAGE', $this->lang['TXT_LICENSE_SAVED']);
         } else {
             if (isset($_POST['update'])) {
                 $remoteTemplate->setVariable('STATUS_TYPE', 'okbox');
                 $remoteTemplate->setVariable('STATUS_MESSAGE', $this->lang['TXT_LICENSE_UPDATED']);
             }
         }
         $remoteTemplate->setVariable($this->lang);
         $this->setLicensePlaceholders($remoteTemplate);
         if ($remoteTemplate->blockExists('legalComponents')) {
             foreach ($this->license->getLegalComponentsList() as $component) {
                 $remoteTemplate->setVariable('LICENSE_LEGAL_COMPONENT', contrexx_raw2xhtml($component));
                 $remoteTemplate->parse('legalComponents');
             }
         }
         if ($remoteTemplate->blockExists('licenseDomain')) {
             foreach ($this->license->getRegisteredDomains() as $domain) {
                 $remoteTemplate->setVariable('LICENSE_DOMAIN', contrexx_raw2xhtml($domain));
                 $remoteTemplate->parse('licenseDomain');
             }
         }
         $message = $this->license->getMessage(false, \FWLanguage::getLanguageCodeById(BACKEND_LANG_ID), $this->lang);
         if (!$sm->isWritable()) {
             $remoteTemplate->setVariable('MESSAGE_TITLE', preg_replace('/<br \\/>/', ' ', sprintf($_CORELANG['TXT_SETTINGS_ERROR_NO_WRITE_ACCESS'], \Cx\Core\Config\Controller\Config::getSettingsFile())));
             $remoteTemplate->setVariable('MESSAGE_LINK', '#');
             $remoteTemplate->setVariable('MESSAGE_LINK_TARGET', '_self');
             $remoteTemplate->setVariable('MESSAGE_TYPE', 'alertbox');
         } else {
             if ($message && strlen($message->getText())) {
                 $remoteTemplate->setVariable('MESSAGE_TITLE', contrexx_raw2xhtml($this->getReplacedMessageText($message)));
                 $remoteTemplate->setVariable('MESSAGE_LINK', contrexx_raw2xhtml($message->getLink()));
                 $remoteTemplate->setVariable('MESSAGE_LINK_TARGET', contrexx_raw2xhtml($message->getLinkTarget()));
                 $remoteTemplate->setVariable('MESSAGE_TYPE', contrexx_raw2xhtml($message->getType()));
             } else {
                 if ($remoteTemplate->blockExists('message')) {
                     $remoteTemplate->setVariable('MESSAGE_TYPE', '" style="display:none;');
                 }
             }
         }
         if (\FWUser::getFWUserObject()->objUser->getAdminStatus()) {
             $remoteTemplate->touchBlock('licenseAdmin');
             $remoteTemplate->hideBlock('licenseNotAdmin');
         } else {
             $remoteTemplate->hideBlock('licenseAdmin');
             $remoteTemplate->touchBlock('licenseNotAdmin');
             $remoteTemplate->setVariable('LICENSE_ADMIN_MAIL', contrexx_raw2xhtml($this->config['coreAdminEmail']));
         }
         $this->template->setVariable('ADMIN_CONTENT', $remoteTemplate->get());
     } else {
         $this->template->setVariable('ADMIN_CONTENT', $this->lang['TXT_LICENSE_NO_TEMPLATE']);
     }
 }