private function __construct() { global $objInit; $backOrFrontend = $objInit->mode; global $objFWUser; $langId; if ($backOrFrontend == "frontend") { $langId = $objInit->getFrontendLangId(); } else { //backend $langId = $objInit->getBackendLangId(); } $langCode = FWLanguage::getLanguageCodeById($langId); $this->setVariable(array('path' => ASCMS_PATH_OFFSET . '/update/' . $langCode . '/', 'basePath' => ASCMS_PATH_OFFSET . '/update/', 'cadminPath' => ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH . '/', 'mode' => $objInit->mode, 'language' => $langCode), 'contrexx'); //let i18n set it's variables $i18n = new ContrexxJavascriptI18n($langCode); $i18n->variablesTo($this); //determine the correct jquery ui css' path. //the user might have overridden the default css in the theme, so look out for this too. $jQUiCssPath = 'themes/' . $objInit->getCurrentThemesPath() . '/jquery-ui.css'; //customized css would be here if ($objInit->mode != 'frontend' || !file_exists(ASCMS_DOCUMENT_ROOT . '/' . $jQUiCssPath)) { //use standard css $jQUiCssPath = 'lib/javascript/jquery/ui/css/jquery-ui.css'; } $this->setVariable(array('jQueryUiCss' => $jQUiCssPath), 'contrexx-ui'); }
/** * @override */ public function getXHtml($backend = false) { global $objInit; $uploadPath = $this->getUploadPath('jump'); $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders'); $tpl->setErrorHandling(PEAR_ERROR_DIE); $tpl->loadTemplateFile('jump.html'); $basePath = 'index.php?'; $basePath .= $this->isBackendRequest ? 'cmd=Upload&act' : 'section=Upload&cmd'; //act and cmd vary $appletPath = $basePath . '=jumpUploaderApplet'; $l10nPath = $basePath . '=jumpUploaderL10n'; $langId; if (!$this->isBackendRequest) { $langId = $objInit->getFrontendLangId(); } else { //backend $langId = $objInit->getBackendLangId(); } $langCode = \FWLanguage::getLanguageCodeById($langId); if (!file_exists(ASCMS_CORE_MODULE_PATH . '/Upload/ressources/uploaders/jump/messages_' . $langCode . '.zip')) { $langCode = 'en'; } $l10nPath .= '&lang=' . $langCode; $tpl->setVariable('UPLOAD_CHUNK_LENGTH', \FWSystem::getMaxUploadFileSize() - 1000); $tpl->setVariable('UPLOAD_APPLET_URL', $appletPath); $tpl->setVariable('UPLOAD_LANG_URL', $l10nPath); $tpl->setVariable('UPLOAD_URL', $uploadPath); $tpl->setVariable('UPLOAD_ID', $this->uploadId); return $tpl->get(); }
public function __construct($langCode = null, $text = '', $type = 'alertbox', $link = '', $linkTarget = '_blank', $showInDashboard = true) { $this->langCode = $langCode ? $langCode : \FWLanguage::getLanguageCodeById(LANG_ID); $this->text = $text; $this->type = $type; $this->link = $link; $this->linkTarget = $linkTarget; $this->showInDashboard = $showInDashboard; }
/** * Override this to do your representation of the tree. * * @param string $title * @param int $level 0-based level of the element * @param boolean $hasChilds are there children of this element? if yes, they will be processed in the subsequent calls. * @param int $lang language id * @param string $path path to this element, e.g. '/CatA/CatB' * @param boolean $current if a $currentPage has been specified, this will be set to true if either a parent element of the current element or the current element itself is rendered. * * @return string your string representation of the element. */ protected function renderElement($title, $level, $hasChilds, $lang, $path, $current, $page) { $url = (string) \Cx\Core\Routing\NodePlaceholder::fromNode($page->getNode(), null, array()); $pages = $page->getNode()->getPages(); $titles = array(); foreach ($pages as $page) { $titles[\FWLanguage::getLanguageCodeById($page->getLang())] = $page->getTitle(); } $this->return[] = array('click' => "javascript:{setUrl('{$url}',null,null,'" . \FWLanguage::getLanguageCodeById(BACKEND_LANG_ID) . $path . "','page')}", 'name' => $titles, 'extension' => 'Html', 'level' => $level - 1, 'url' => $path, 'node' => $url); }
/** * Registers the JavaScript code for jQueryUi.Datepicker * * Also activates jQueryUi and tries to load the current language and use * that as the default. * Add element specific defaults and code in your method. */ static function addDatepickerJs() { static $language_code = null; // Only run once if ($language_code) { return; } JS::activate('jqueryui'); $language_code = FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID); //DBG::log("Language ID ".FRONTEND_LANG_ID.", code $language_code"); // Must load timepicker as well, because the region file accesses it JS::registerJS('lib/javascript/jquery/ui/jquery-ui-timepicker-addon.js'); // TODO: Add more languages to the i18n folder! JS::registerJS('lib/javascript/jquery/ui/i18n/' . 'jquery.ui.datepicker-' . $language_code . '.js'); JS::registerCode(' cx.jQuery(function() { cx.jQuery.datepicker.setDefaults(cx.jQuery.datepicker.regional["' . $language_code . '"]); }); '); }
private function performLanguageAction($action, $params) { global $_CORELANG; // Global access check if (!\Permission::checkAccess(6, 'static', true) || !\Permission::checkAccess(35, 'static', true)) { throw new \Cx\Core\ContentManager\ContentManagerException($_CORELANG['TXT_CORE_CM_USAGE_DENIED']); } if (!\Permission::checkAccess(53, 'static', true)) { throw new \Cx\Core\ContentManager\ContentManagerException($_CORELANG['TXT_CORE_CM_COPY_DENIED']); } if (!isset($params['get']) || !isset($params['get']['to'])) { throw new \Cx\Core\ContentManager\ContentManagerException('Illegal parameter list'); } $em = \Env::get('em'); $nodeRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node'); $targetLang = contrexx_input2raw($params['get']['to']); $fromLang = \FWLanguage::getFallbackLanguageIdById($targetLang); if ($fromLang === false) { throw new \Cx\Core\ContentManager\ContentManagerException('Language has no fallback to copy/link from'); } $toLangCode = \FWLanguage::getLanguageCodeById($targetLang); if ($toLangCode === false) { throw new \Cx\Core\ContentManager\ContentManagerException('Could not get id for language #"' . $targetLang . '"'); } $limit = 0; $offset = 0; if (isset($params['get']['limit'])) { $limit = contrexx_input2raw($params['get']['limit']); } if (isset($params['get']['offset'])) { $offset = contrexx_input2raw($params['get']['offset']); } $result = $nodeRepo->translateRecursive($nodeRepo->getRoot(), $fromLang, $targetLang, $action == 'copy', $limit, $offset); return $result; }
public function getCode($tabIndex = null) { $tabIndexAttr = ''; if (isset($tabIndex)) { $tabIndexAttr = "tabindex=\"{$tabIndex}\""; } $widget = <<<HTML <div id="recaptcha_widget" style="display:none"> <div id="recaptcha_image"></div> <div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div> <span class="recaptcha_only_if_image">Enter the words above:</span> <span class="recaptcha_only_if_audio">Enter the numbers you hear:</span> <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" {$tabIndexAttr} /> <div> <div> <a title="Get a new challenge" href="javascript:Recaptcha.reload()" id="recaptcha_reload_btn"> <img src="http://www.google.com/recaptcha/api/img/clean/refresh.png" id="recaptcha_reload" alt="Get a new challenge" height="18" width="25"> </a> </div> <div class="recaptcha_only_if_image"> <a title="Get an audio challenge" href="javascript:Recaptcha.switch_type('audio');" id="recaptcha_switch_audio_btn" class="recaptcha_only_if_image"> <img src="http://www.google.com/recaptcha/api/img/clean/audio.png" id="recaptcha_switch_audio" alt="Get an audio challenge" height="15" width="25"> </a> </div> <div class="recaptcha_only_if_audio"> <a title="Get a visual challenge" href="javascript:Recaptcha.switch_type('image');" id="recaptcha_switch_img_btn" class="recaptcha_only_if_audio"> <img src="http://www.google.com/recaptcha/api/img/clean/text.png" id="recaptcha_switch_img" alt="Get a visual challenge" height="15" width="25"> </a> </div> <div> <a href="javascript:Recaptcha.showhelp()"title="Help" target="_blank" id="recaptcha_whatsthis_btn"> <img alt="Help" src="http://www.google.com/recaptcha/api/img/clean/help.png" id="recaptcha_whatsthis" height="16" width="25"> </a> </div> </div> </div> <script type="text/javascript" src= "http://www.google.com/recaptcha/api/challenge?k=%1\$s"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=%1\$s" height="300" width="500" frameborder="0"></iframe><br /> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"> </noscript> HTML; $lang = \FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID); //\JS::registerCode("var RecaptchaOptions = { lang : '$lang', theme : 'clean' }"); \JS::registerCode("var RecaptchaOptions = { lang : '{$lang}', theme : 'custom', custom_theme_widget: 'recaptcha_widget' }"); //\JS::registerCSS("lib/reCAPTCHA/recaptcha.widget.clean.css"); $code = sprintf($widget, $this->public_key); //$code = recaptcha_get_html($this->public_key, $this->error); return $code; }
/** * add and modify language values * * @global array * @global ADONewConnection * @return boolean True on success, false on failure */ function modifyLanguage() { global $_ARRAYLANG, $_CONFIG, $objDatabase; $langRemovalStatus = isset($_POST['removeLangVersion']) ? contrexx_input2raw($_POST['removeLangVersion']) : false; if (!empty($_POST['submit']) and isset($_POST['addLanguage']) && $_POST['addLanguage'] == "true") { //----------------------------------------------- // Add new language with all variables //----------------------------------------------- if (!empty($_POST['newLangName']) and !empty($_POST['newLangShortname'])) { $newLangShortname = addslashes(strip_tags($_POST['newLangShortname'])); $newLangName = addslashes(strip_tags($_POST['newLangName'])); $newLangCharset = addslashes(strip_tags($_POST['newLangCharset'])); $objResult = $objDatabase->Execute("SELECT lang FROM " . DBPREFIX . "languages WHERE lang='" . $newLangShortname . "'"); if ($objResult !== false) { if ($objResult->RecordCount() >= 1) { $this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR']; return false; } else { $objDatabase->Execute("INSERT INTO " . DBPREFIX . "languages SET lang='" . $newLangShortname . "',\n name='" . $newLangName . "',\n charset='" . $newLangCharset . "',\n is_default='false'"); $newLanguageId = $objDatabase->Insert_ID(); if (!empty($newLanguageId)) { $objResult = $objDatabase->SelectLimit("SELECT id FROM " . DBPREFIX . "languages WHERE is_default='true'", 1); if ($objResult !== false && !$objResult->EOF) { $defaultLanguage = $objResult->fields['id']; $objResult = $objDatabase->Execute("SELECT varid,content,module FROM " . DBPREFIX . "language_variable_content WHERE 1 AND lang=" . $defaultLanguage); if ($objResult !== false) { while (!$objResult->EOF) { $arrayLanguageContent[$objResult->fields['varid']] = stripslashes($objResult->fields['content']); $arrayLanguageModule[$objResult->fields['varid']] = $objResult->fields['module']; $objResult->MoveNext(); } foreach ($arrayLanguageContent as $varid => $content) { $LanguageModule = $arrayLanguageModule[$varid]; $objDatabase->Execute("INSERT INTO " . DBPREFIX . "language_variable_content SET varid=" . $varid . ", content='" . addslashes($content) . "', module=" . $LanguageModule . ", lang=" . $newLanguageId . ", status=0"); } $this->strOkMessage = $_ARRAYLANG['TXT_NEW_LANGUAGE_ADDED_SUCCESSFUL']; return true; } } } else { $this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR']; return false; } } } } } elseif (!empty($_POST['submit']) and $_POST['modLanguage'] == "true") { $eventArgs = array('langRemovalStatus' => $langRemovalStatus); $frontendLangIds = array_keys(\FWLanguage::getActiveFrontendLanguages()); $postLangIds = array_keys($_POST['langActiveStatus']); foreach (array_keys(\FWLanguage::getLanguageArray()) as $langId) { $isLangInPost = in_array($langId, $postLangIds); $isLangInFrontend = in_array($langId, $frontendLangIds); if ($isLangInPost == $isLangInFrontend) { continue; } $eventArgs['langData'][] = array('langId' => $langId, 'status' => $isLangInPost && !$isLangInFrontend); } //Trigger the event 'languageStatusUpdate' //if the language is activated/deactivated for frontend if (!empty($eventArgs)) { $evm = \Cx\Core\Core\Controller\Cx::instanciate()->getEvents(); $evm->triggerEvent('languageStatusUpdate', array($eventArgs, new \Cx\Core\Model\RecursiveArrayAccess(array()))); } //----------------------------------------------- // Update languages //----------------------------------------------- foreach ($_POST['langName'] as $id => $name) { $active = 0; if (isset($_POST['langActiveStatus'][$id]) && $_POST['langActiveStatus'][$id] == 1) { $languageCode = \FWLanguage::getLanguageCodeById($id); $pageRepo = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $alias = $pageRepo->findBy(array('type' => \Cx\Core\ContentManager\Model\Entity\Page::TYPE_ALIAS, 'slug' => $languageCode), true); if (count($alias)) { if (is_array($alias)) { $alias = $alias[0]; } $id = $alias->getNode()->getId(); $config = \Env::get('config'); $link = 'http://' . $config['domainUrl'] . ASCMS_PATH_OFFSET . '/' . $alias->getSlug(); $lang = \Env::get('lang'); $this->strErrMessage = $lang['TXT_CORE_REMOVE_ALIAS_TO_ACTIVATE_LANGUAGE'] . ':<br /> <a href="index.php?cmd=Alias&act=modify&id=' . $id . '" target="_blank">' . $link . '</a>'; return false; } $active = 1; } $status = "false"; if ($_POST['langDefaultStatus'] == $id) { $status = "true"; } $adminstatus = 0; if (isset($_POST['langAdminStatus'][$id]) && $_POST['langAdminStatus'][$id] == 1) { $adminstatus = 1; } $fallBack = isset($_POST['fallBack'][$id]) && $_POST['fallBack'][$id] != "" ? intval($_POST['fallBack'][$id]) : 'NULL'; $objDatabase->Execute("UPDATE " . DBPREFIX . "languages SET \n name='" . $name . "',\n frontend=" . $active . ",\n is_default='" . $status . "',\n backend='" . $adminstatus . "',\n fallback=" . $fallBack . "\n WHERE id=" . $id); } $this->strOkMessage = $_ARRAYLANG['TXT_DATA_RECORD_UPDATED_SUCCESSFUL']; \FWLanguage::init(); return true; } return false; }
/** * Generates a list of pages pointing to $page * @param \Cx\Core\ContentManager\Model\Entity\Page $page Page to get referencing pages for * @param array $subPages (optional, by reference) Do not use, internal * @return array List of pages (ID as key, page object as value) */ protected function getPagesPointingTo($page, &$subPages = array()) { $cx = \Cx\Core\Core\Controller\Cx::instanciate(); $em = $cx->getDb()->getEntityManager(); $pageRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $fallback_lang_codes = \FWLanguage::getFallbackLanguageArray(); $active_langs = \FWLanguage::getActiveFrontendLanguages(); // get all active languages and their fallbacks // $fallbacks[<langId>] = <fallsBackToLangId> // if <langId> has no fallback <fallsBackToLangId> will be null $fallbacks = array(); foreach ($active_langs as $lang) { $fallbacks[\FWLanguage::getLanguageCodeById($lang['id'])] = array_key_exists($lang['id'], $fallback_lang_codes) ? \FWLanguage::getLanguageCodeById($fallback_lang_codes[$lang['id']]) : null; } // get all symlinks and fallbacks to it $query = ' SELECT p FROM Cx\\Core\\ContentManager\\Model\\Entity\\Page p WHERE ( p.type = ?1 AND ( p.target LIKE ?2'; if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION) { $query .= ' OR p.target LIKE ?3'; } $query .= ' ) ) OR ( p.type = ?4 AND p.node = ' . $page->getNode()->getId() . ' ) '; $q = $em->createQuery($query); $q->setParameter(1, 'symlink'); $q->setParameter('2', '%NODE_' . $page->getNode()->getId() . '%'); if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION) { $q->setParameter('3', '%NODE_' . strtoupper($page->getModule()) . '%'); } $q->setParameter(4, 'fallback'); $result = $q->getResult(); if (!$result) { return $subPages; } foreach ($result as $subPage) { if ($subPage->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_SYMLINK) { $subPages[$subPage->getId()] = $subPage; } else { if ($subPage->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_FALLBACK) { // check if $subPage is a fallback to $page $targetLang = \FWLanguage::getLanguageCodeById($page->getLang()); $currentLang = \FWLanguage::getLanguageCodeById($subPage->getLang()); while ($currentLang && $currentLang != $targetLang) { $currentLang = $fallbacks[$currentLang]; } if ($currentLang && !isset($subPages[$subPage->getId()])) { $subPages[$subPage->getId()] = $subPage; // recurse! $this->getPagesPointingTo($subPage, $subPages); } } } } return $subPages; }
public function testPagesAtPath() { $pageRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $nodeRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node'); $n1 = new \Cx\Core\ContentManager\Model\Entity\Node(); $n2 = new \Cx\Core\ContentManager\Model\Entity\Node(); $n3 = new \Cx\Core\ContentManager\Model\Entity\Node(); $n1->setParent($nodeRepo->getRoot()); $nodeRepo->getRoot()->addChildren($n1); $n2->setParent($n1); $n2->addChildren($n1); $n3->setParent($nodeRepo->getRoot()); $nodeRepo->getRoot()->addChildren($n3); self::$em->persist($n1); self::$em->persist($n2); self::$em->persist($n3); self::$em->flush(); $p1 = new \Cx\Core\ContentManager\Model\Entity\Page(); $p1->setLang(1); $p1->setTitle('rootTitle_1'); $p1->setNode($n1); $p1->setNodeIdShadowed($n1->getId()); $p1->setUseCustomContentForAllChannels(''); $p1->setUseCustomApplicationTemplateForAllChannels(''); $p1->setUseSkinForAllChannels(''); $p1->setCmd(''); $p1->setActive(1); $p2 = new \Cx\Core\ContentManager\Model\Entity\Page(); $p2->setLang(2); $p2->setTitle('rootTitle_1'); $p2->setNode($n1); $p2->setNodeIdShadowed($n1->getId()); $p2->setUseCustomContentForAllChannels(''); $p2->setUseCustomApplicationTemplateForAllChannels(''); $p2->setUseSkinForAllChannels(''); $p2->setCmd(''); $p2->setActive(1); $p3 = new \Cx\Core\ContentManager\Model\Entity\Page(); $p3->setLang(3); $p3->setTitle('rootTitle_2'); $p3->setNode($n1); $p3->setNodeIdShadowed($n1->getId()); $p3->setUseCustomContentForAllChannels(''); $p3->setUseCustomApplicationTemplateForAllChannels(''); $p3->setUseSkinForAllChannels(''); $p3->setCmd(''); $p3->setActive(1); $p4 = new \Cx\Core\ContentManager\Model\Entity\Page(); $p4->setLang(3); $p4->setTitle('childTitle'); $p4->setNode($n2); $p4->setNodeIdShadowed($n2->getId()); $p4->setUseCustomContentForAllChannels(''); $p4->setUseCustomApplicationTemplateForAllChannels(''); $p4->setUseSkinForAllChannels(''); $p4->setCmd(''); $p4->setActive(1); $p5 = new \Cx\Core\ContentManager\Model\Entity\Page(); $p5->setLang(1); $p5->setTitle('otherRootChild'); $p5->setNode($n3); $p5->setNodeIdShadowed($n3->getId()); $p5->setUseCustomContentForAllChannels(''); $p5->setUseCustomApplicationTemplateForAllChannels(''); $p5->setUseSkinForAllChannels(''); $p5->setCmd(''); $p5->setActive(1); self::$em->persist($n1); self::$em->persist($n2); self::$em->persist($n3); self::$em->persist($p1); self::$em->persist($p2); self::$em->persist($p3); self::$em->persist($p4); self::$em->persist($p5); self::$em->flush(); //make sure we re-fetch a correct state self::$em->refresh($n1); self::$em->refresh($n2); self::$em->refresh($n3); //1 level $match = $pageRepo->getPagesAtPath('/' . \FWLanguage::getLanguageCodeById(1) . '/rootTitle_1'); $this->assertEquals('rootTitle_1/', $match['matchedPath']); $this->assertInstanceOf('Cx\\Core\\ContentManager\\Model\\Entity\\Page', $match['page'][1]); // $this->assertEquals(array(1,2),$match['lang']); //2 levels $match = $pageRepo->getPagesAtPath('/' . \FWLanguage::getLanguageCodeById(3) . '/rootTitle_2/childTitle'); $this->assertEquals('rootTitle_2/childTitle/', $match['matchedPath']); $this->assertEquals('', $match['unmatchedPath']); $this->assertInstanceOf('Cx\\Core\\ContentManager\\Model\\Entity\\Page', $match['page'][3]); $this->assertEquals(array(3), $match['lang']); //3 levels, 2 in tree $match = $pageRepo->getPagesAtPath('/' . \FWLanguage::getLanguageCodeById(3) . '/rootTitle_2/childTitle/asdfasdf'); $this->assertEquals('rootTitle_2/childTitle/', $match['matchedPath']); // check unmatched path too $this->assertEquals('asdfasdf', $match['unmatchedPath']); $this->assertInstanceOf('Cx\\Core\\ContentManager\\Model\\Entity\\Page', $match['page'][3]); $this->assertEquals(array(3), $match['lang']); //3 levels, wrong lang from 2nd level $match = $pageRepo->getPagesAtPath('/' . \FWLanguage::getLanguageCodeById(1) . '/rootTitle_1/childTitle/asdfasdf'); $this->assertEquals('rootTitle_1/', $match['matchedPath']); $this->assertInstanceOf('Cx\\Core\\ContentManager\\Model\\Entity\\Page', $match['page'][1]); //$this->assertEquals(array(1,2),$match['lang']); //inexistant $match = $pageRepo->getPagesAtPath('doesNotExist'); $this->assertEquals(null, $match); //exact matching $match = $pageRepo->getPagesAtPath('rootTitle_2/childTitle/asdfasdf', null, null, true); $this->assertEquals(null, $match); //given lang matching $match = $pageRepo->getPagesAtPath('/' . \FWLanguage::getLanguageCodeById(1) . '/rootTitle_1', null, 1); $this->assertEquals('rootTitle_1/', $match['matchedPath']); $this->assertInstanceOf('Cx\\Core\\ContentManager\\Model\\Entity\\Page', $match['page']); //second other child of root node $match = $pageRepo->getPagesAtPath('/' . \FWLanguage::getLanguageCodeById(1) . '/otherRootChild', null, 1); $this->assertEquals('otherRootChild/', $match['matchedPath']); $this->assertInstanceOf('Cx\\Core\\ContentManager\\Model\\Entity\\Page', $match['page']); }
/** * Gets the search results. * * @return mixed Parsed content. */ public function getSearchResults() { global $_ARRAYLANG; $this->template->addBlockfile('ADMIN_CONTENT', 'search', 'Default.html'); if (!empty($this->term)) { $pages = $this->getSearchedPages(); $countPages = $this->countSearchedPages(); usort($pages, array($this, 'sortPages')); if ($countPages > 0) { $parameter = '&cmd=Search' . (empty($this->term) ? '' : '&term=' . contrexx_raw2encodedUrl($this->term)); $paging = \Paging::get($parameter, '', $countPages, 0, true, null, 'pos'); $this->template->setVariable(array('TXT_SEARCH_RESULTS_COMMENT' => sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_COMMENT'], $this->term, $countPages), 'TXT_SEARCH_TITLE' => $_ARRAYLANG['TXT_NAVIGATION_TITLE'], 'TXT_SEARCH_CONTENT_TITLE' => $_ARRAYLANG['TXT_PAGETITLE'], 'TXT_SEARCH_SLUG' => $_ARRAYLANG['TXT_CORE_CM_SLUG'], 'TXT_SEARCH_LANG' => $_ARRAYLANG['TXT_LANGUAGE'], 'SEARCH_PAGING' => $paging)); foreach ($pages as $page) { // used for alias pages, because they have no language if ($page->getLang() == "") { $languages = ""; foreach (\FWLanguage::getIdArray('frontend') as $langId) { $languages[] = \FWLanguage::getLanguageCodeById($langId); } } else { $languages = array(\FWLanguage::getLanguageCodeById($page->getLang())); } $aliasLanguages = implode(', ', $languages); $originalPage = $page; $link = 'index.php?cmd=ContentManager&page=' . $page->getId(); if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_ALIAS) { $pageRepo = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); if ($originalPage->isTargetInternal()) { // is internal target, get target page $originalPage = $pageRepo->getTargetPage($page); } else { // is an external target, set the link to the external targets url $originalPage = new \Cx\Core\ContentManager\Model\Entity\Page(); $originalPage->setTitle($page->getTarget()); $link = $page->getTarget(); } } $this->template->setVariable(array('SEARCH_RESULT_BACKEND_LINK' => $link, 'SEARCH_RESULT_TITLE' => $originalPage->getTitle(), 'SEARCH_RESULT_CONTENT_TITLE' => $originalPage->getContentTitle(), 'SEARCH_RESULT_SLUG' => substr($page->getPath(), 1), 'SEARCH_RESULT_LANG' => $aliasLanguages, 'SEARCH_RESULT_FRONTEND_LINK' => \Cx\Core\Routing\Url::fromPage($page))); $this->template->parse('search_result_row'); } } else { $this->template->setVariable(array('TXT_SEARCH_NO_RESULTS' => sprintf($_ARRAYLANG['TXT_SEARCH_NO_RESULTS'], $this->term))); } } else { $this->template->setVariable(array('TXT_SEARCH_NO_TERM' => $_ARRAYLANG['TXT_SEARCH_NO_TERM'])); } }
/** * Get the client record * * @return GeoIp2\Model\Country */ public function getClientRecord() { if ($this->clientRecord) { return $this->clientRecord; } //skip the process incase mode is not frontend or GeoIp is deactivated if (!$this->isGeoIpEnabled()) { return null; } // Get stats controller to get client ip $statsComponentContoller = $this->getComponent('Stats'); if (!$statsComponentContoller) { return null; } //Get the country name and code by using the ipaddress through GeoIp2 library $countryDb = $this->getDirectory() . '/Data/GeoLite2-Country.mmdb'; $activeLocale = \FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID); $locale = in_array($activeLocale, $this->availableLocale) ? $activeLocale : $this->defaultLocale; try { $reader = new \GeoIp2\Database\Reader($countryDb, array($locale)); $this->clientRecord = $reader->country($statsComponentContoller->getCounterInstance()->getClientIp()); return $this->clientRecord; } catch (\Exception $e) { \DBG::log($e->getMessage()); return null; } }
/** * Show overview * * Show the blocks overview page * * @access private * @global array * @global ADONewConnection * @global array * @see blockLibrary::getBlocks(), blockLibrary::blockNamePrefix */ function _showOverview() { global $_ARRAYLANG, $objDatabase, $_CORELANG; if (isset($_POST['displaysubmit'])) { foreach ($_POST['displayorder'] as $blockId => $value) { $query = "UPDATE " . DBPREFIX . "module_block_blocks SET `order`='" . intval($value) . "' WHERE id='" . intval($blockId) . "'"; $objDatabase->Execute($query); } } $this->_pageTitle = $_ARRAYLANG['TXT_BLOCK_BLOCKS']; $this->_objTpl->loadTemplateFile('module_block_overview.html'); $catId = !empty($_REQUEST['catId']) ? intval($_REQUEST['catId']) : 0; $this->_objTpl->setVariable(array('TXT_BLOCK_BLOCKS' => $_ARRAYLANG['TXT_BLOCK_BLOCKS'], 'TXT_BLOCK_NAME' => $_ARRAYLANG['TXT_BLOCK_NAME'], 'TXT_BLOCK_PLACEHOLDER' => $_ARRAYLANG['TXT_BLOCK_PLACEHOLDER'], 'TXT_BLOCK_SUBMIT_SELECT' => $_ARRAYLANG['TXT_BLOCK_SUBMIT_SELECT'], 'TXT_BLOCK_SUBMIT_DELETE' => $_ARRAYLANG['TXT_BLOCK_SUBMIT_DELETE'], 'TXT_BLOCK_SUBMIT_ACTIVATE' => $_ARRAYLANG['TXT_BLOCK_SUBMIT_ACTIVATE'], 'TXT_BLOCK_SUBMIT_DEACTIVATE' => $_ARRAYLANG['TXT_BLOCK_SUBMIT_DEACTIVATE'], 'TXT_BLOCK_SUBMIT_GLOBAL' => $_ARRAYLANG['TXT_BLOCK_SUBMIT_GLOBAL'], 'TXT_BLOCK_SUBMIT_GLOBAL_OFF' => $_ARRAYLANG['TXT_BLOCK_SUBMIT_GLOBAL_OFF'], 'TXT_BLOCK_SELECT_ALL' => $_ARRAYLANG['TXT_BLOCK_SELECT_ALL'], 'TXT_BLOCK_DESELECT_ALL' => $_ARRAYLANG['TXT_BLOCK_DESELECT_ALL'], 'TXT_BLOCK_PLACEHOLDER' => $_ARRAYLANG['TXT_BLOCK_PLACEHOLDER'], 'TXT_BLOCK_FUNCTIONS' => $_ARRAYLANG['TXT_BLOCK_FUNCTIONS'], 'TXT_BLOCK_DELETE_SELECTED_BLOCKS' => $_ARRAYLANG['TXT_BLOCK_DELETE_SELECTED_BLOCKS'], 'TXT_BLOCK_CONFIRM_DELETE_BLOCK' => $_ARRAYLANG['TXT_BLOCK_CONFIRM_DELETE_BLOCK'], 'TXT_SAVE_CHANGES' => $_CORELANG['TXT_SAVE_CHANGES'], 'TXT_BLOCK_OPERATION_IRREVERSIBLE' => $_ARRAYLANG['TXT_BLOCK_OPERATION_IRREVERSIBLE'], 'TXT_BLOCK_STATUS' => $_ARRAYLANG['TXT_BLOCK_STATUS'], 'TXT_BLOCK_CATEGORY' => $_ARRAYLANG['TXT_BLOCK_CATEGORY'], 'TXT_BLOCK_CATEGORIES_ALL' => $_ARRAYLANG['TXT_BLOCK_CATEGORIES_ALL'], 'TXT_BLOCK_ORDER' => $_ARRAYLANG['TXT_BLOCK_ORDER'], 'TXT_BLOCK_LANGUAGE' => $_ARRAYLANG['TXT_BLOCK_LANGUAGE'], 'TXT_BLOCK_INCLUSION' => $_ARRAYLANG['TXT_BLOCK_INCLUSION'], 'BLOCK_CATEGORIES_DROPDOWN' => $this->_getCategoriesDropdown($catId), 'DIRECTORY_INDEX' => CONTREXX_DIRECTORY_INDEX, 'CSRF_PARAM' => \Cx\Core\Csrf\Controller\Csrf::param())); $arrBlocks = $this->getBlocks($catId); if (empty($arrBlocks)) { return; } // create new ContentTree instance $objContentTree = new \ContentTree(); $pageRepo = \Cx\Core\Core\Controller\Cx::instanciate()->getDb()->getEntityManager()->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $rowNr = 0; foreach ($arrBlocks as $blockId => $arrBlock) { if ($arrBlock['active'] == '1') { $status = '<a href="index.php?cmd=Block&act=deactivate&blockId=' . $blockId . '" title="' . $_ARRAYLANG['TXT_BLOCK_ACTIVE'] . '"><img src="../core/Core/View/Media/icons/led_green.gif" width="13" height="13" border="0" alt="' . $_ARRAYLANG['TXT_BLOCK_ACTIVE'] . '" /></a>'; } else { $status = '<a href="index.php?cmd=Block&act=activate&blockId=' . $blockId . '" title="' . $_ARRAYLANG['TXT_BLOCK_INACTIVE'] . '"><img src="../core/Core/View/Media/icons/led_red.gif" width="13" height="13" border="0" alt="' . $_ARRAYLANG['TXT_BLOCK_INACTIVE'] . '" /></a>'; } $blockPlaceholder = $this->blockNamePrefix . $blockId; $random1Class = $arrBlock['random'] == 1 ? 'active' : ''; $random2Class = $arrBlock['random2'] == 1 ? 'active' : ''; $random3Class = $arrBlock['random3'] == 1 ? 'active' : ''; $random4Class = $arrBlock['random4'] == 1 ? 'active' : ''; $globalClass = in_array($arrBlock['global'], array(1, 2)) ? 'active' : ''; $random1Info = sprintf($arrBlock['random'] ? $_ARRAYLANG['TXT_BLOCK_RANDOM_INFO_INCLUDED'] : $_ARRAYLANG['TXT_BLOCK_RANDOM_INFO_EXCLUDED'], '[[BLOCK_RANDOMIZER]]'); $random2Info = sprintf($arrBlock['random2'] ? $_ARRAYLANG['TXT_BLOCK_RANDOM_INFO_INCLUDED'] : $_ARRAYLANG['TXT_BLOCK_RANDOM_INFO_EXCLUDED'], '[[BLOCK_RANDOMIZER2]]'); $random3Info = sprintf($arrBlock['random3'] ? $_ARRAYLANG['TXT_BLOCK_RANDOM_INFO_INCLUDED'] : $_ARRAYLANG['TXT_BLOCK_RANDOM_INFO_EXCLUDED'], '[[BLOCK_RANDOMIZER3]]'); $random4Info = sprintf($arrBlock['random4'] ? $_ARRAYLANG['TXT_BLOCK_RANDOM_INFO_INCLUDED'] : $_ARRAYLANG['TXT_BLOCK_RANDOM_INFO_EXCLUDED'], '[[BLOCK_RANDOMIZER4]]'); $lang = array(); foreach ($arrBlock['lang'] as $langId) { $lang[] = \FWLanguage::getLanguageCodeById($langId); } $langString = implode(', ', $lang); $strGlobalSelectedPages = $arrBlock['global'] == 2 ? $this->getSelectedPages($blockId, 'global', $objContentTree, $pageRepo) : ''; $strDirectSelectedPages = $arrBlock['direct'] == 1 ? $this->getSelectedPages($blockId, 'direct', $objContentTree, $pageRepo) : ''; $targeting = $this->loadTargetingSettings($blockId); $targetingClass = ''; $targetingInfo = ''; if (!empty($targeting)) { $targetingClass = 'active'; $arrSelectedCountries = array(); if (!empty($targeting['country']) && !empty($targeting['country']['value'])) { $targetingInfo = $targeting['country']['filter'] == 'include' ? $_ARRAYLANG['TXT_BLOCK_TARGETING_INFO_INCLUDE'] : $_ARRAYLANG['TXT_BLOCK_TARGETING_INFO_EXCLUDE']; foreach ($targeting['country']['value'] as $countryId) { $countryName = \Cx\Core\Country\Controller\Country::getNameById($countryId); if (!empty($countryName)) { $arrSelectedCountries[] = '<li>' . contrexx_raw2xhtml($countryName) . '</li>'; } } } if ($arrSelectedCountries) { $targetingInfo .= '<br /><ul>' . implode($arrSelectedCountries) . '</ul>'; } } $blockDirectInfo = sprintf($arrBlock['direct'] == 1 ? $_ARRAYLANG['TXT_BLOCK_DIRECT_INFO_SHOW_SELECTED_PAGES'] : $_ARRAYLANG['TXT_BLOCK_DIRECT_INFO_SHOW_ALL_PAGES'], '[[' . $blockPlaceholder . ']]'); $this->_objTpl->setVariable(array('BLOCK_ROW_CLASS' => $rowNr % 2 ? "row1" : "row2", 'BLOCK_ID' => $blockId, 'BLOCK_RANDOM_1_CLASS' => $random1Class, 'BLOCK_RANDOM_2_CLASS' => $random2Class, 'BLOCK_RANDOM_3_CLASS' => $random3Class, 'BLOCK_RANDOM_4_CLASS' => $random4Class, 'BLOCK_RANDOM_1_INFO' => $random1Info, 'BLOCK_RANDOM_2_INFO' => $random2Info, 'BLOCK_RANDOM_3_INFO' => $random3Info, 'BLOCK_RANDOM_4_INFO' => $random4Info, 'BLOCK_TARGETING_CLASS' => $targetingClass, 'BLOCK_TARGETING_INFO' => !empty($targeting) ? $targetingInfo : $_ARRAYLANG['TXT_BLOCK_LOCATION_BASED_DISPLAY_INFO'], 'BLOCK_GLOBAL_CLASS' => $globalClass, 'BLOCK_GLOBAL_INFO' => $arrBlock['global'] == 1 ? $_ARRAYLANG['TXT_BLOCK_DISPLAY_ALL_PAGE'] : ($arrBlock['global'] == 2 ? $_ARRAYLANG['TXT_BLOCK_DISPLAY_SELECTED_PAGE'] . '<br />' . $strGlobalSelectedPages : $_ARRAYLANG['TXT_BLOCK_DISPLAY_GLOBAL_INACTIVE']), 'BLOCK_CATEGORY_NAME' => $this->_categoryNames[$arrBlock['cat']], 'BLOCK_ORDER' => $arrBlock['order'], 'BLOCK_PLACEHOLDER' => $blockPlaceholder, 'BLOCK_PLACEHOLDER_INFO' => $arrBlock['direct'] == 1 ? $blockDirectInfo . '<br />' . $strDirectSelectedPages : $blockDirectInfo, 'BLOCK_NAME' => contrexx_raw2xhtml($arrBlock['name']), 'BLOCK_MODIFY' => sprintf($_ARRAYLANG['TXT_BLOCK_MODIFY_BLOCK'], contrexx_raw2xhtml($arrBlock['name'])), 'BLOCK_COPY' => sprintf($_ARRAYLANG['TXT_BLOCK_COPY_BLOCK'], contrexx_raw2xhtml($arrBlock['name'])), 'BLOCK_DELETE' => sprintf($_ARRAYLANG['TXT_BLOCK_DELETE_BLOCK'], contrexx_raw2xhtml($arrBlock['name'])), 'BLOCK_STATUS' => $status, 'BLOCK_LANGUAGES_NAME' => $langString)); $this->_objTpl->parse('blockBlockList'); $rowNr++; } }
private function getTreeCode() { if (count($this->arrMigrateLangIds) === 1) { return true; } $jsSimilarPages = array(); $this->similarPages = $this->findSimilarPages(); foreach ($this->similarPages as $nodeId => $arrPageIds) { $jsSimilarPages[$nodeId] = array_values($arrPageIds); foreach ($this->arrMigrateLangIds as $migrateLangId) { if (!isset($arrPageIds[$migrateLangId])) { $this->similarPages[$nodeId][$migrateLangId] = 0; } } ksort($this->similarPages[$nodeId]); } $objCx = \ContrexxJavascript::getInstance(); $objCx->setVariable('similarPages', json_encode($jsSimilarPages), 'update/contentMigration'); $objTemplate = new \HTML_Template_Sigma(UPDATE_TPL); $objTemplate->setErrorHandling(PEAR_ERROR_DIE); $objTemplate->loadTemplateFile('page_grouping.html'); $groupedBorderWidth = count($this->arrMigrateLangIds) * 325 - 48; $objTemplate->setGlobalVariable(array('USERNAME' => $_SESSION['contrexx_update']['username'], 'PASSWORD' => $_SESSION['contrexx_update']['password'], 'CMS_VERSION' => $_SESSION['contrexx_update']['version'], 'MIGRATE_LANG_IDS' => $this->migrateLangIds, 'LANGUAGE_WRAPPER_WIDTH' => 'width: ' . count($this->arrMigrateLangIds) * 330 . 'px;', 'GROUPED_SCROLL_WIDTH' => 'width: ' . count($this->arrMigrateLangIds) * 325 . 'px;', 'GROUPED_BORDER_WIDTH' => 'width: ' . $groupedBorderWidth . 'px;')); $cl = \Env::get('ClassLoader'); $cl->loadFile(ASCMS_CORE_PATH . '/Tree.class.php'); $cl->loadFile(UPDATE_CORE . '/UpdateTree.class.php'); $pageRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $nodeRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node'); foreach ($this->arrMigrateLangIds as $lang) { $objContentTree = new \UpdateContentTree($lang); foreach ($objContentTree->getTree() as $arrPage) { $pageId = $arrPage['catid']; $nodeId = $arrPage['node_id']; $langId = $arrPage['lang']; $level = $arrPage['level']; $title = $arrPage['catname']; $sort = $nodeRepo->find($nodeId)->getLft(); $grouped = $this->isGrouppedPage($this->similarPages, $pageId) ? 'grouped' : ''; $objTemplate->setVariable(array('TITLE' => $title, 'ID' => $pageId, 'NODE' => $nodeId, 'LANG' => strtoupper(\FWLanguage::getLanguageCodeById($langId)), 'LEVEL' => $level + 1, 'SORT' => $sort, 'GROUPED' => $grouped, 'MARGIN' => 'margin-left: ' . $level * 15 . 'px;')); $objTemplate->parse('page'); } $langFull = \FWLanguage::getLanguageParameter($lang, 'name'); $langShort = strtoupper(\FWLanguage::getLanguageParameter($lang, 'lang')); $objTemplate->setVariable(array('LANG_FULL' => $langFull, 'LANG_SHORT' => $langShort)); $objTemplate->parse('language'); } $groupedBorderWidth -= 2; foreach ($this->similarPages as $nodeId => $arrPageIds) { $node = $nodeRepo->find($nodeId); $margin = ($node->getLvl() - 1) * 15; $nodeWidth = $groupedBorderWidth - $margin; $width = ($groupedBorderWidth - 10) / count($this->arrMigrateLangIds); $index = 0; $last = count($arrPageIds) - 1; foreach ($arrPageIds as $pageLangId => $pageId) { if ($index === 0) { $pageWidth = $width - 24; } elseif ($index === $last) { $pageWidth = $width - $margin; } else { $pageWidth = $width; } $index++; $page = $pageRepo->find($pageId); if ($page) { $langCode = strtoupper(\FWLanguage::getLanguageCodeById($page->getLang())); $objTemplate->setVariable(array('CLASS' => '', 'DATA_ID' => 'data-id="' . $pageId . '"', 'DATA_LANG' => 'data-lang="' . $langCode . '"', 'TITLE' => $page->getTitle(), 'LANG' => $langCode, 'WIDTH' => 'width: ' . $pageWidth . 'px;')); } else { $langCode = strtoupper(\FWLanguage::getLanguageCodeById($pageLangId)); $objTemplate->setVariable(array('CLASS' => 'no-page', 'DATA_ID' => '', 'DATA_LANG' => '', 'TITLE' => 'Keine Seite', 'LANG' => $langCode, 'WIDTH' => 'width: ' . $pageWidth . 'px;')); } $objTemplate->parse('groupedPage'); } $objTemplate->setVariable(array('ID' => $nodeId, 'LEVEL' => $node->getLvl(), 'SORT' => $node->getLft(), 'STYLE' => 'width: ' . $nodeWidth . 'px; margin-left: ' . $margin . 'px;')); $objTemplate->parse('groupedNode'); } return $objTemplate->get(); }
/** * Returns the type of the page as string. * * @param \Cx\Core\ContentManager\Model\Entity\Page $page * @return string $type */ public function getTypeByPage($page) { global $_CORELANG; switch ($page->getType()) { case \Cx\Core\ContentManager\Model\Entity\Page::TYPE_REDIRECT: $criteria = array('nodeIdShadowed' => $page->getTargetNodeId(), 'lang' => $page->getLang()); $targetPage = $this->findOneBy($criteria); $targetTitle = $targetPage ? $targetPage->getTitle() : $page->getTarget(); $type = $_CORELANG['TXT_CORE_CM_TYPE_REDIRECT'] . ': '; $type .= $targetTitle; break; case \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION: $type = $_CORELANG['TXT_CORE_CM_TYPE_APPLICATION'] . ': '; $type .= $page->getModule(); $type .= $page->getCmd() != '' ? ' | ' . $page->getCmd() : ''; break; case \Cx\Core\ContentManager\Model\Entity\Page::TYPE_FALLBACK: $fallbackLangId = \FWLanguage::getFallbackLanguageIdById($page->getLang()); if ($fallbackLangId == 0) { $fallbackLangId = \FWLanguage::getDefaultLangId(); } $type = $_CORELANG['TXT_CORE_CM_TYPE_FALLBACK'] . ' '; $type .= \FWLanguage::getLanguageCodeById($fallbackLangId); break; default: $type = $_CORELANG['TXT_CORE_CM_TYPE_CONTENT']; } return $type; }
/** * Returns the HTML code for the Saferpay payment form. * @param array $arrCards The optional accepted card types * @return string The HTML code * @static */ static function _SaferpayProcessor() { global $_ARRAYLANG; $arrShopOrder = array('AMOUNT' => str_replace('.', '', $_SESSION['shop']['grand_total_price']), 'CURRENCY' => Currency::getActiveCurrencyCode(), 'ORDERID' => $_SESSION['shop']['order_id'], 'ACCOUNTID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_id', 'Shop'), 'SUCCESSLINK' => \Cx\Core\Routing\Url::fromModuleAndCmd('Shop' . MODULE_INDEX, 'success', '', array('result' => 1, 'handler' => 'saferpay'))->toString(), 'FAILLINK' => \Cx\Core\Routing\Url::fromModuleAndCmd('Shop' . MODULE_INDEX, 'success', '', array('result' => 0, 'handler' => 'saferpay'))->toString(), 'BACKLINK' => \Cx\Core\Routing\Url::fromModuleAndCmd('Shop' . MODULE_INDEX, 'success', '', array('result' => 2, 'handler' => 'saferpay'))->toString(), 'DESCRIPTION' => '"' . $_ARRAYLANG['TXT_ORDER_NR'] . ' ' . $_SESSION['shop']['order_id'] . '"', 'LANGID' => \FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID), 'NOTIFYURL' => \Cx\Core\Routing\Url::fromModuleAndCmd('Shop' . MODULE_INDEX, 'success', '', array('result' => '-1', 'handler' => 'saferpay'))->toString(), 'ALLOWCOLLECT' => 'no', 'DELIVERY' => 'no'); $payInitUrl = \Saferpay::payInit($arrShopOrder, \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop')); //DBG::log("PaymentProcessing::_SaferpayProcessor(): payInit URL: $payInitUrl"); // Fixed: Added check for empty return string, // i.e. on connection problems if (!$payInitUrl) { return "<font color='red'><b>" . $_ARRAYLANG['TXT_SHOP_PSP_FAILED_TO_INITIALISE_SAFERPAY'] . "<br />{$payInitUrl}</b></font>" . "<br />" . \Saferpay::getErrors(); } $return = "<script src='http://www.saferpay.com/OpenSaferpayScript.js'></script>\n"; switch (\Cx\Core\Setting\Controller\Setting::getValue('saferpay_window_option', 'Shop')) { case 0: // iframe return $return . $_ARRAYLANG['TXT_ORDER_PREPARED'] . "<br/><br/>\n" . "<iframe src='{$payInitUrl}' width='580' height='400' scrolling='no' marginheight='0' marginwidth='0' frameborder='0' name='saferpay'></iframe>\n"; case 1: // popup return $return . $_ARRAYLANG['TXT_ORDER_LINK_PREPARED'] . "<br/><br/>\n" . "<script type='text/javascript'>\n function openSaferpay() {\n strUrl = '{$payInitUrl}';\n if (strUrl.indexOf(\"WINDOWMODE=Standalone\") == -1) {\n strUrl += \"&WINDOWMODE=Standalone\";\n }\n oWin = window.open(strUrl, 'SaferpayTerminal',\n 'scrollbars=1,resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,width=580,height=400'\n );\n if (oWin == null || typeof(oWin) == \"undefined\") {\n alert(\"The payment couldn't be initialized. It seems like you are using a popup blocker!\");\n }\n }\n </script>\n" . "<input type='button' name='order_now' value='" . $_ARRAYLANG['TXT_ORDER_NOW'] . "' onclick='openSaferpay()' />\n"; default: //case 2: // new window } return $return . $_ARRAYLANG['TXT_ORDER_LINK_PREPARED'] . "<br/><br/>\n" . "<form method='post' action='{$payInitUrl}'>\n<input type='submit' value='" . $_ARRAYLANG['TXT_ORDER_NOW'] . "' />\n</form>\n"; }
function getHomePage() { global $_CORELANG, $_CONFIG, $objTemplate, $objDatabase; $objTemplate->addBlockfile('ADMIN_CONTENT', 'content', 'index_home.html'); \JS::activate('jquery-bootstrap'); \JS::activate('jquery-jqplot'); $arrAccessIDs = array(5, 10, 76, '84_1', 6, 19, 75, '84_2', 17, 18, 7, 32, 21); foreach ($arrAccessIDs as $id) { $accessID = strpos($id, '_') ? substr($id, 0, strpos($id, '_')) : $id; if (\Permission::checkAccess($accessID, 'static', true)) { $objTemplate->touchBlock('check_access_' . $id); } else { $objTemplate->hideBlock('check_access_' . $id); } } $objTemplate->setVariable(array('CSRF' => \Cx\Core\Csrf\Controller\Csrf::param(), 'TXT_LAST_LOGIN' => htmlentities($_CORELANG['TXT_LAST_LOGIN'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_CONTREXX_NEWS' => htmlentities($_CORELANG['TXT_CONTREXX_NEWS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_CREATING_AND_PUBLISHING' => htmlentities($_CORELANG['TXT_CREATING_AND_PUBLISHING'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_EVALUATE_AND_VIEW' => htmlentities($_CORELANG['TXT_EVALUATE_AND_VIEW'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_MANAGE' => htmlentities($_CORELANG['TXT_MANAGE'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_NEW_SITE' => htmlentities($_CORELANG['TXT_NEW_PAGE'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_ADD_NEWS' => htmlentities($_CORELANG['TXT_ADD_NEWS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_ADD_BLOCK' => htmlentities($_CORELANG['TXT_ADD_BLOCK'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_ADD_FORM' => htmlentities($_CORELANG['TXT_ADD_FORM'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_CONTENT_MANAGER' => htmlentities($_CORELANG['TXT_CONTENT_MANAGER'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_STATS' => htmlentities($_CORELANG['TXT_STATS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_WORKFLOW' => htmlentities($_CORELANG['TXT_WORKFLOW'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_FORMS' => htmlentities($_CORELANG['TXT_FORMS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_SYSTEM_SETTINGS' => htmlentities($_CORELANG['TXT_SYSTEM_SETTINGS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_USER_MANAGER' => htmlentities($_CORELANG['TXT_USER_ADMINISTRATION'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_MEDIA_MANAGER' => htmlentities($_CORELANG['TXT_MEDIA_MANAGER'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_IMAGE_ADMINISTRATION' => htmlentities($_CORELANG['TXT_IMAGE_ADMINISTRATION'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_SKINS' => htmlentities($_CORELANG['TXT_DESIGN_MANAGEMENT'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_VISITORS' => htmlentities($_CORELANG['TXT_CORE_VISITORS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_REQUESTS' => htmlentities($_CORELANG['TXT_CORE_REQUESTS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_DASHBOARD_NEWS_ALERT' => htmlentities($_CORELANG['TXT_DASHBOARD_NEWS_ALERT'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_DASHBOARD_STATS_ALERT' => htmlentities($_CORELANG['TXT_DASHBOARD_STATS_ALERT'], ENT_QUOTES, CONTREXX_CHARSET))); $objTemplate->setGlobalVariable('TXT_LOGOUT', $_CORELANG['TXT_LOGOUT']); if (\Permission::checkAccess(17, 'static', true)) { $objTemplate->touchBlock('news_delete'); $objTemplate->touchBlock('stats_delete'); } else { $objTemplate->hideBlock('news_delete'); $objTemplate->hideBlock('stats_delete'); } $license = \Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase); $message = $license->getMessage(true, \FWLanguage::getLanguageCodeById(BACKEND_LANG_ID), $_CORELANG); if ($message instanceof \Cx\Core_Modules\License\Message && strlen($message->getText()) && $message->showInDashboard()) { $licenseManager = new \Cx\Core_Modules\License\LicenseManager('', null, $_CORELANG, $_CONFIG, $objDatabase); $objTemplate->setVariable('MESSAGE_TITLE', contrexx_raw2xhtml($licenseManager->getReplacedMessageText($message))); $licenseType = $message->getType(); switch ($licenseType) { case '--this case is not defined by license --': $bsCalloutType = 'danger'; break; case 'alertbox': $bsCalloutType = 'warning'; break; case 'okbox': default: $bsCalloutType = 'info'; break; } $objTemplate->setVariable('MESSAGE_TYPE', $bsCalloutType); $objTemplate->setVariable('MESSAGE_LINK', contrexx_raw2xhtml($message->getLink())); $objTemplate->setVariable('MESSAGE_LINK_TARGET', contrexx_raw2xhtml($message->getLinkTarget())); } // TODO: Unused // $objFWUser = \FWUser::getFWUserObject(); $objResult = $objDatabase->SelectLimit('SELECT `logs`.`datetime`, `users`.`username` FROM `' . DBPREFIX . 'log` AS `logs` LEFT JOIN `' . DBPREFIX . 'access_users` AS `users` ON `users`.`id`=`logs`.`userid` ORDER BY `logs`.`id` DESC', 1); if ($objResult && $objResult->RecordCount() > 0) { $objTemplate->setVariable(array('LAST_LOGIN_USERNAME' => contrexx_raw2xhtml($objResult->fields['username']), 'LAST_LOGIN_TIME' => date('d.m.Y', strtotime($objResult->fields['datetime'])))); $objTemplate->parse('last_login'); } else { $objTemplate->setVariable('LOG_ERROR_MESSAGE', $_CORELANG['TXT_NO_DATA_FOUND']); } if ($_CONFIG['dashboardStatistics'] == 'on') { $arrStatistics = $this->getStatistics(); $objTemplate->setVariable(array('STATS_TITLE' => $_CORELANG['TXT_CORE_STATS_FROM'] . ' ' . reset($arrStatistics['dates']) . ' - ' . end($arrStatistics['dates']), 'STATS_TICKS' => json_encode($arrStatistics['ticks']), 'STATS_DATES' => json_encode($arrStatistics['dates']), 'STATS_VISITORS' => json_encode($arrStatistics['visitors']), 'STATS_REQUESTS' => json_encode($arrStatistics['requests']), 'STATS_TOTAL_VISITORS' => array_sum($arrStatistics['visitors']), 'STATS_TOTAL_REQUESTS' => array_sum($arrStatistics['requests']))); } else { $objTemplate->hideBlock('stats'); $objTemplate->hideBlock('stats_javascript'); } $arrItems = null; // This index may be unset if (!empty($_CONFIG['dashboardNewsSrc'])) { $objRss = new \XML_RSS($_CONFIG['dashboardNewsSrc'] . '?version=' . $_CONFIG['coreCmsVersion']); $objRss->parse(); $arrItems = $objRss->getItems(); } if (!empty($arrItems) && $_CONFIG['dashboardNews'] == 'on') { if (empty($arrItems[0]['description'])) { $objTemplate->setVariable(array('NEWS_CONTENT' => $arrItems[0]['title'], 'NEWS_LINK' => $arrItems[0]['link'])); $objTemplate->hideBlock('news_title'); } else { $objTemplate->setVariable(array('NEWS_TITLE' => $arrItems[0]['title'], 'NEWS_CONTENT' => $arrItems[0]['description'], 'NEWS_LINK' => $arrItems[0]['link'])); } $objTemplate->parse('news'); } else { $objTemplate->hideBlock('news'); } }
/** * @param Sigma $template */ public function preFinalize(Sigma $template) { if (count($this->mediaBrowserInstances) == 0) { return; } global $_ARRAYLANG; /** * @var $init \InitCMS */ $init = \Env::get('init'); $init->loadLanguageData('MediaBrowser'); foreach ($_ARRAYLANG as $key => $value) { if (preg_match("/TXT_FILEBROWSER_[A-Za-z0-9]+/", $key)) { \ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser'); } } $thumbnailsTemplate = new Sigma(); $thumbnailsTemplate->loadTemplateFile($this->cx->getCoreModuleFolderName() . '/MediaBrowser/View/Template/Thumbnails.html'); $thumbnailsTemplate->setVariable('TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE', sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE'])); foreach ($this->cx->getMediaSourceManager()->getThumbnailGenerator()->getThumbnails() as $thumbnail) { $thumbnailsTemplate->setVariable(array('THUMBNAIL_NAME' => sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_' . strtoupper($thumbnail['name']) . '_SIZE'], $thumbnail['size']), 'THUMBNAIL_ID' => $thumbnail['id'], 'THUMBNAIL_SIZE' => $thumbnail['size'])); $thumbnailsTemplate->parse('thumbnails'); } \ContrexxJavascript::getInstance()->setVariable('thumbnails_template', $thumbnailsTemplate->get(), 'mediabrowser'); \ContrexxJavascript::getInstance()->setVariable('chunk_size', min(floor((\FWSystem::getMaxUploadFileSize() - 1000000) / 1000000), 20) . 'mb', 'mediabrowser'); \ContrexxJavascript::getInstance()->setVariable('languages', \FWLanguage::getActiveFrontendLanguages(), 'mediabrowser'); \ContrexxJavascript::getInstance()->setVariable('language', \FWLanguage::getLanguageCodeById(\FWLanguage::getDefaultLangId()), 'mediabrowser'); \JS::activate('mediabrowser'); \JS::registerJS('core_modules/MediaBrowser/View/Script/MediaBrowser.js'); }
protected function getFallbackArray() { $fallbacks = \FWLanguage::getFallbackLanguageArray(); $output = array(); foreach ($fallbacks as $key => $value) { $output[\FWLanguage::getLanguageCodeById($key)] = \FWLanguage::getLanguageCodeById($value); } return $output; }
/** * Checks whether $page is of type 'fallback'. Loads fallback content if yes. * @param Cx\Core\ContentManager\Model\Doctrine $page * @param boolean $requestedPage Set to TRUE (default) if the $page passed by $page is the first resolved page (actual requested page) * @throws ResolverException */ public function handleFallbackContent($page, $requestedPage = true) { //handle untranslated pages - replace them by the right language version. // Important: We must reset the modified $page object here. // Otherwise the EntityManager holds false information about the page. // I.e. type might be 'application' instead of 'fallback' // See bug-report #1536 $page = $this->pageRepo->findOneById($page->getId()); if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_FALLBACK || $page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_SYMLINK) { // in case the first resolved page (= original requested page) is a fallback page // we must check here if this very page is active. // If we miss this check, we would only check if the referenced fallback page is active! if ($requestedPage && !$page->isActive()) { return; } // if this page is protected, we do not follow fallback $this->checkPageFrontendProtection($page); if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_SYMLINK) { $fallbackPage = $this->pageRepo->getTargetPage($page); } else { $fallbackPage = $this->getFallbackPage($page); } // due that the fallback is located within a different language // we must set $this->lang to the fallback's language. // this is required because we will next try to resolve the page // that is referenced by the fallback page $this->lang = $fallbackPage->getLang(); $this->url->setLangDir(\FWLanguage::getLanguageCodeById($this->lang)); $this->url->setSuggestedTargetPath(substr($fallbackPage->getPath(), 1)); // now lets resolve the page that is referenced by our fallback page $this->resolvePage(true); $page->getFallbackContentFrom($this->page); // Important: We must assigne a copy of $page to $this->path here. // Otherwise, the virtual fallback page ($this->page) will also // be reset, when we reset (see next command) the original // requested page $page. $this->page = clone $page; // Due to the fallback-resolving, the virtual language directory // is currently set to the fallback language. Therefore we must set // it back to the language of the original request. Same also applies // to $this->lang, which was used to resolv the fallback page(s). $this->url->setLangDir(\FWLanguage::getLanguageCodeById($page->getLang())); $this->lang = $page->getLang(); } }
/** * Returns "$protocolAndDomainWithPathOffset/link/to/page$params. * Notice that there is no trailing slash inserted after the link. * If you need one, prepend it to $params. * @param string $protocolAndDomain 'http://example.com/cms' - will generate absolute link if left empty * @param string $params '?a=b' * */ public function getURL($protocolAndDomainWithPathOffset, $params) { $path = $this->getPath($this); return $protocolAndDomainWithPathOffset . '/' . \FWLanguage::getLanguageCodeById($this->lang) . $path . $params; }
/** * Get input field based on language id and value * * @param integer $id Input field id * @param string $value input field value * @param integer $langId Language id * * @return string Return input field based on language id and value */ private function getInput($id = 0, $value = '', $langId = 0) { global $_ARRAYLANG; $cx = \Cx\Core\Core\Controller\Cx::instanciate(); $strImagePreview = null; if (!empty($value) && file_exists($cx->getWebsitePath() . $value . ".thumb")) { $strImagePreview = '<img id="' . $this->moduleNameLC . 'Inputfield_' . $id . '_' . $langId . '_preview" src="' . $value . '.thumb" alt="" style="border: 1px solid rgb(10, 80, 161); margin: 0px 0px 3px;" width="' . intval($this->arrSettings['settingsThumbSize']) . '" /> <input data-id="' . $id . '" type="checkbox" class="' . (!$langId ? 'mediadirInputfieldDefaultDeleteFile' : '') . '" id="mediadirInputfield_delete_' . $id . '_' . $langId . '" value="1" name="deleteMedia[' . $id . '][' . $langId . ']" />' . $_ARRAYLANG['TXT_MEDIADIR_DELETE'] . '<br />'; } $flagPath = $cx->getCodeBaseOffsetPath() . $cx->getCoreFolderName() . '/Country/View/Media/Flag'; $inputStyle = !empty($langId) ? 'background: #ffffff url(\'' . $flagPath . '/flag_' . \FWLanguage::getLanguageCodeById($langId) . '.gif\') no-repeat 3px 3px;' : ''; $inputDefaultClass = empty($langId) ? $this->moduleNameLC . 'InputfieldDefault' : $this->moduleNameLC . 'LangInputfield'; $mode = $cx->getMode(); if ($mode == \Cx\Core\Core\Controller\Cx::MODE_BACKEND) { $strInputfield = <<<INPUT {$strImagePreview} <input type="text" name="{$this->moduleNameLC}Inputfield[{$id}][{$langId}]" value="{$value}" data-id="{$id}" data-is-image="true" class="{$inputDefaultClass}" id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}" style="{$inputStyle}" autocomplete="off" onfocus="this.select();" /> <input type="button" onClick="getMediaBrowser(\$J(this));" data-is-image="true" data-input-id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}" data-views="filebrowser" data-startmediatype="{$this->moduleNameLC}" value="{$_ARRAYLANG['TXT_BROWSE']}" /> INPUT; } else { if (empty($value) || $value == "new_image") { $strValueHidden = "new_image"; $value = ""; } else { $strValueHidden = $value; } $strInputfield = <<<INPUT {$strImagePreview} <input type="text" name="{$this->moduleNameLC}InputfieldSource[{$id}][{$langId}]" value="{$value}" data-id="{$id}" data-is-image="true" class="{$inputDefaultClass}" id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}" style="{$inputStyle}" autocomplete="off" onfocus="this.select();" /> <input type="button" onClick="getUploader(\$J(this));" data-is-image="true" data-input-id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}" value="{$_ARRAYLANG['TXT_BROWSE']}" /> <input id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}_hidden" name="{$this->moduleNameLC}Inputfield[{$id}][{$langId}]" value="{$strValueHidden}" type="hidden" /> <span class="{$this->moduleNameLC}InputfieldFilesize"> {$_ARRAYLANG['TXT_MEDIADIR_MAX_FILESIZE']} {$this->arrSettings['settingsImageFilesize']} KB </span> INPUT; } return $strInputfield; }
/** * Shows all files / pages in filebrowser */ function _setContent() { global $_FRONTEND_LANGID; $this->_objTpl->addBlockfile('FILEBROWSER_CONTENT', 'fileBrowser_content', 'module_fileBrowser_content.html'); $ckEditorFuncNum = isset($_GET['CKEditorFuncNum']) ? '&CKEditorFuncNum=' . contrexx_raw2xhtml($_GET['CKEditorFuncNum']) : ''; $ckEditor = isset($_GET['CKEditor']) ? '&CKEditor=' . contrexx_raw2xhtml($_GET['CKEditor']) : ''; $rowNr = 0; switch ($this->_mediaType) { case 'webpages': $jd = new \Cx\Core\Json\JsonData(); $data = $jd->data('node', 'getTree', array('get' => array('recursive' => 'true'))); $pageStack = array(); $ref = 0; $data['data']['tree'] = array_reverse($data['data']['tree']); foreach ($data['data']['tree'] as &$entry) { $entry['attr']['level'] = 0; array_push($pageStack, $entry); } while (count($pageStack)) { $entry = array_pop($pageStack); $page = $entry['data'][0]; $arrPage['level'] = $entry['attr']['level']; $arrPage['node_id'] = $entry['attr']['rel_id']; $children = $entry['children']; $children = array_reverse($children); foreach ($children as &$entry) { $entry['attr']['level'] = $arrPage['level'] + 1; array_push($pageStack, $entry); } $arrPage['catname'] = $page['title']; $arrPage['catid'] = $page['attr']['id']; $arrPage['lang'] = BACKEND_LANG_ID; $arrPage['protected'] = $page['attr']['protected']; $arrPage['type'] = \Cx\Core\ContentManager\Model\Entity\Page::TYPE_CONTENT; $arrPage['alias'] = $page['title']; $arrPage['frontend_access_id'] = $page['attr']['frontend_access_id']; $arrPage['backend_access_id'] = $page['attr']['backend_access_id']; // JsonNode does not provide those //$arrPage['level'] = ; //$arrPage['type'] = ; //$arrPage['parcat'] = ; //$arrPage['displaystatus'] = ; //$arrPage['moduleid'] = ; //$arrPage['startdate'] = ; //$arrPage['enddate'] = ; // But we can simulate level and type for our purposes: (level above) $jsondata = json_decode($page['attr']['data-href']); $path = $jsondata->path; if (trim($jsondata->module) != '') { $arrPage['type'] = \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION; $module = explode(' ', $jsondata->module, 2); $arrPage['modulename'] = $module[0]; if (count($module) > 1) { $arrPage['cmd'] = $module[1]; } } $url = "'" . '[[' . \Cx\Core\ContentManager\Model\Entity\Page::PLACEHOLDER_PREFIX; // TODO: This only works for regular application pages. Pages of type fallback that are linked to an application // will be parsed using their node-id ({NODE_<ID>}) if ($arrPage['type'] == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION && $this->_mediaMode !== 'alias') { $url .= $arrPage['modulename']; if (!empty($arrPage['cmd'])) { $url .= '_' . $arrPage['cmd']; } $url = strtoupper($url); } else { $url .= $arrPage['node_id']; } // if language != current language or $alwaysReturnLanguage if ($this->_frontendLanguageId != $_FRONTEND_LANGID || isset($_GET['alwaysReturnLanguage']) && $_GET['alwaysReturnLanguage'] == 'true') { $url .= '_' . $this->_frontendLanguageId; } $url .= "]]'"; $this->_objTpl->setVariable(array('FILEBROWSER_ROW_CLASS' => $rowNr % 2 == 0 ? "row1" : "row2", 'FILEBROWSER_FILE_PATH_CLICK' => "javascript:{setUrl({$url},null,null,'" . \FWLanguage::getLanguageCodeById($this->_frontendLanguageId) . $path . "','page')}", 'FILEBROWSER_FILE_NAME' => $arrPage['catname'], 'FILEBROWSER_FILESIZE' => ' ', 'FILEBROWSER_FILE_ICON' => $this->_iconPath . 'htm.png', 'FILEBROWSER_FILE_DIMENSION' => ' ', 'FILEBROWSER_SPACING_STYLE' => 'style="margin-left: ' . $arrPage['level'] * 15 . 'px;"')); $this->_objTpl->parse('content_files'); $rowNr++; } break; case 'Media1': case 'Media2': case 'Media3': case 'Media4': \Permission::checkAccess(7, 'static'); //Access Media-Archive \Permission::checkAccess(38, 'static'); //Edit Media-Files \Permission::checkAccess(39, 'static'); //Upload Media-Files //Hier soll wirklich kein break stehen! Beabsichtig! //Upload Media-Files //Hier soll wirklich kein break stehen! Beabsichtig! default: if (count($this->_arrDirectories) > 0) { foreach ($this->_arrDirectories as $arrDirectory) { $this->_objTpl->setVariable(array('FILEBROWSER_ROW_CLASS' => $rowNr % 2 == 0 ? "row1" : "row2", 'FILEBROWSER_FILE_PATH_CLICK' => "index.php?cmd=FileBrowser&standalone=true&langId={$this->_frontendLanguageId}&type={$this->_mediaType}&path={$arrDirectory['path']}" . $ckEditor . $ckEditorFuncNum, 'FILEBROWSER_FILE_NAME' => $arrDirectory['name'], 'FILEBROWSER_FILESIZE' => ' ', 'FILEBROWSER_FILE_ICON' => $arrDirectory['icon'], 'FILEBROWSER_FILE_DIMENSION' => ' ')); $this->_objTpl->parse('content_files'); $rowNr++; } } if (count($this->_arrFiles) > 0) { $arrEscapedPaths = array(); foreach ($this->_arrFiles as $arrFile) { $arrEscapedPaths[] = contrexx_raw2encodedUrl($arrFile['path']); $this->_objTpl->setVariable(array('FILEBROWSER_ROW_CLASS' => $rowNr % 2 == 0 ? "row1" : "row2", 'FILEBROWSER_ROW_STYLE' => in_array($arrFile['name'], $this->highlightedFiles) ? ' style="background: ' . $this->highlightColor . ';"' : '', 'FILEBROWSER_FILE_PATH_DBLCLICK' => "setUrl('" . contrexx_raw2xhtml($arrFile['path']) . "'," . $arrFile['width'] . "," . $arrFile['height'] . ",'')", 'FILEBROWSER_FILE_PATH_CLICK' => "javascript:{showPreview(" . (count($arrEscapedPaths) - 1) . "," . $arrFile['width'] . "," . $arrFile['height'] . ")}", 'FILEBROWSER_FILE_NAME' => contrexx_stripslashes($arrFile['name']), 'FILEBROWSER_FILESIZE' => $arrFile['size'] . ' KB', 'FILEBROWSER_FILE_ICON' => $arrFile['icon'], 'FILEBROWSER_FILE_DIMENSION' => empty($arrFile['width']) && empty($arrFile['height']) ? '' : intval($arrFile['width']) . 'x' . intval($arrFile['height']))); $this->_objTpl->parse('content_files'); $rowNr++; } $this->_objTpl->setVariable('FILEBROWSER_FILES_JS', "'" . implode("','", $arrEscapedPaths) . "'"); } if (array_key_exists($this->_mediaType, $this->mediaTypePaths)) { $this->_objTpl->setVariable('FILEBROWSER_IMAGE_PATH', $this->mediaTypePaths[$this->_mediaType][1]); } else { $this->_objTpl->setVariable('FILEBROWSER_IMAGE_PATH', ASCMS_CONTENT_IMAGE_WEB_PATH); } break; } $this->_objTpl->parse('fileBrowser_content'); }
/** * displays newsletter contentn in browser * */ public static function displayInBrowser() { global $objDatabase, $_ARRAYLANG, $_CONFIG; $id = !empty($_GET['id']) ? contrexx_input2raw($_GET['id']) : ''; $email = !empty($_GET['email']) ? contrexx_input2raw($_GET['email']) : ''; $code = !empty($_GET['code']) ? contrexx_input2raw($_GET['code']) : ''; $unsubscribe = ''; $profile = ''; $date = ''; $sex = ''; $salutation = ''; $title = ''; $firstname = ''; $lastname = ''; $position = ''; $company = ''; $industry_sector = ''; $address = ''; $city = ''; $zip = ''; $country = ''; $phoneOffice = ''; $phoneMobile = ''; $phonePrivate = ''; $fax = ''; $birthday = ''; $website = ''; if (!self::checkCode($id, $email, $code)) { // unable to verify user, therefore we will not load any user data to prevent leaking any privacy data $email = ''; $code = ''; } // Get newsletter content and template. $query = ' SELECT `n`.`content`, `t`.`html`, `n`.`date_sent` FROM `' . DBPREFIX . 'module_newsletter` as `n` INNER JOIN `' . DBPREFIX . 'module_newsletter_template` as `t` ON `n`.`template` = `t`.`id` WHERE `n`.`id` = "' . contrexx_raw2db($id) . '" '; $objResult = $objDatabase->Execute($query); if ($objResult->RecordCount()) { $html = $objResult->fields['html']; $content = $objResult->fields['content']; $date = date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date_sent']); } else { // newsletter not found > redirect to homepage \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . \Cx\Core\Routing\Url::fromDocumentRoot()); exit; } // Get user details. $query = ' SELECT `id`, `email`, `uri`, `salutation`, `title`, `position`, `company`, `industry_sector`, `sex`, `lastname`, `firstname`, `address`, `zip`, `city`, `country_id`, `phone_office`, `phone_mobile`, `phone_private`, `fax`, `birthday` FROM `' . DBPREFIX . 'module_newsletter_user` WHERE `email` = "' . contrexx_raw2db($email) . '" '; $objResult = $objDatabase->Execute($query); if ($objResult->RecordCount()) { // set recipient sex switch ($objResult->fields['sex']) { case 'm': $gender = 'gender_male'; break; case 'f': $gender = 'gender_female'; break; default: $gender = 'gender_undefined'; break; } $objUser = \FWUser::getFWUserObject()->objUser; $userId = $objResult->fields['id']; $sex = $objUser->objAttribute->getById($gender)->getName(); //$salutation = contrexx_raw2xhtml($objUser->objAttribute->getById('title_'.$objResult->fields['salutation'])->getName()); $objNewsletterLib = new NewsletterLib(); $arrRecipientTitles = $objNewsletterLib->_getRecipientTitles(); $salutation = $arrRecipientTitles[$objResult->fields['salutation']]; $title = contrexx_raw2xhtml($objResult->fields['title']); $firstname = contrexx_raw2xhtml($objResult->fields['firstname']); $lastname = contrexx_raw2xhtml($objResult->fields['lastname']); $position = contrexx_raw2xhtml($objResult->fields['position']); $company = contrexx_raw2xhtml($objResult->fields['company']); $industry_sector = contrexx_raw2xhtml($objResult->fields['industry_sector']); $address = contrexx_raw2xhtml($objResult->fields['address']); $city = contrexx_raw2xhtml($objResult->fields['city']); $zip = contrexx_raw2xhtml($objResult->fields['zip']); // TODO: migrate to Country class $country = contrexx_raw2xhtml($objUser->objAttribute->getById('country_' . $objResult->fields['country_id'])->getName()); $phoneOffice = contrexx_raw2xhtml($objResult->fields['phone_office']); $phoneMobile = contrexx_raw2xhtml($objResult->fields['phone_mobile']); $phonePrivate = contrexx_raw2xhtml($objResult->fields['phone_private']); $fax = contrexx_raw2xhtml($objResult->fields['fax']); $website = contrexx_raw2xhtml($objResult->fields['uri']); $birthday = contrexx_raw2xhtml($objResult->fields['birthday']); // unsubscribe and profile links have been removed from browser-view - 12/20/12 TD //$unsubscribe = '<a href="'.\Cx\Core\Routing\Url::fromModuleAndCmd('Newsletter', 'unsubscribe', '', array('code' => $code, 'mail' => $email)).'">'.$_ARRAYLANG['TXT_UNSUBSCRIBE'].'</a>'; //$profile = '<a href="'.\Cx\Core\Routing\Url::fromModuleAndCmd('Newsletter', 'profile', '', array('code' => $code, 'mail' => $email)).'">'.$_ARRAYLANG['TXT_EDIT_PROFILE'].'</a>'; } elseif ($objUser = \FWUser::getFWUserObject()->objUser->getUsers(array('email' => contrexx_raw2db($email), 'active' => 1), null, null, null, 1)) { $sex = $objUser->objAttribute->getById($objUser->getProfileAttribute('gender'))->getName(); $salutation = contrexx_raw2xhtml($objUser->objAttribute->getById('title_' . $objUser->getProfileAttribute('title'))->getName()); $firstname = contrexx_raw2xhtml($objUser->getProfileAttribute('firstname')); $lastname = contrexx_raw2xhtml($objUser->getProfileAttribute('lastname')); $company = contrexx_raw2xhtml($objUser->getProfileAttribute('company')); $address = contrexx_raw2xhtml($objUser->getProfileAttribute('address')); $city = contrexx_raw2xhtml($objUser->getProfileAttribute('city')); $zip = contrexx_raw2xhtml($objUser->getProfileAttribute('zip')); // TODO: migrate to Country class $country = contrexx_raw2xhtml($objUser->objAttribute->getById('country_' . $objUser->getProfileAttribute('country'))->getName()); $phoneOffice = contrexx_raw2xhtml($objUser->getProfileAttribute('phone_office')); $phoneMobile = contrexx_raw2xhtml($objUser->getProfileAttribute('phone_mobile')); $phonePrivate = contrexx_raw2xhtml($objUser->getProfileAttribute('phone_private')); $fax = contrexx_raw2xhtml($objUser->getProfileAttribute('phone_fax')); $website = contrexx_raw2xhtml($objUser->getProfileAttribute('website')); $birthday = date(ASCMS_DATE_FORMAT_DATE, $objUser->getProfileAttribute('birthday')); // unsubscribe and profile links have been removed from browser-view - 12/20/12 TD //$unsubscribe = '<a href="'.\Cx\Core\Routing\Url::fromModuleAndCmd('Newsletter', 'unsubscribe', '', array('code' => $code, 'mail' => $email)).'">'.$_ARRAYLANG['TXT_UNSUBSCRIBE'].'</a>'; //$profile = '<a href="'.\Cx\Core\Routing\Url::fromModuleAndCmd('Newsletter', 'profile', '', array('code' => $code, 'mail' => $email)).'">'.$_ARRAYLANG['TXT_EDIT_PROFILE'].'</a>'; } else { // no user found by the specified e-mail address, therefore we will unset any profile specific data to prevent leaking any privacy data $email = ''; $code = ''; } $search = array('[[email]]', '[[date]]', '[[display_in_browser_url]]', '[[unsubscribe]]', '[[profile_setup]]', '[[sex]]', '[[salutation]]', '[[title]]', '[[firstname]]', '[[lastname]]', '[[position]]', '[[company]]', '[[industry_sector]]', '[[address]]', '[[city]]', '[[zip]]', '[[country]]', '[[phone_office]]', '[[phone_private]]', '[[phone_mobile]]', '[[fax]]', '[[birthday]]', '[[website]]'); $replace = array($email, $date, ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/' . \FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID) . '/index.php?section=Newsletter&cmd=displayInBrowser&standalone=true&code=' . $code . '&email=' . $email . '&id=' . $id, '', '', $sex, $salutation, $title, $firstname, $lastname, $position, $company, $industry_sector, $address, $city, $zip, $country, $phoneOffice, $phoneMobile, $phonePrivate, $fax, $birthday, $website); // Replaces the placeholder in the template and content. $html = str_replace($search, $replace, $html); $content = str_replace($search, $replace, $content); // prepare links in content for tracking if (is_object($objUser) && $objUser->getId()) { $userId = $objUser->getId(); $realUser = true; } else { $userId = $userId ? $userId : 0; $realUser = false; } $content = self::prepareNewsletterLinksForSend($id, $content, $userId, $realUser); // Finally replace content placeholder in the template. $html = str_replace('[[content]]', $content, $html); // parse node-url placeholders \LinkGenerator::parseTemplate($html); // Output die($html); }
/** * Parse the newsletter * @author Cloudrexx AG * @author Stefan Heinemann <*****@*****.**> * @param string $userType Which type the user has (newsletter or access) */ function ParseNewsletter($subject, $content_text, $TemplateSource, $format, $TargetEmail, $userData, $NewsletterID, $testDelivery = false) { global $objDatabase, $_ARRAYLANG, $_CONFIG; $NewsletterBody = ''; $codeResult = $objDatabase->Execute('SELECT `code` FROM `' . DBPREFIX . 'module_newsletter_tmp_sending` WHERE `newsletter` = ' . $NewsletterID . ' AND `email` = "' . $userData['email'] . '"'); $code = $codeResult->fields['code']; // TODO: replace with new methode $this->GetBrowserViewURL() $browserViewUrl = ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/' . \FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID) . '/index.php?section=Newsletter&cmd=displayInBrowser&standalone=true&code=' . $code . '&email=' . $userData['email'] . '&id=' . $NewsletterID; if ($format == 'text') { $NewsletterBody = $_ARRAYLANG['TXT_NEWSLETTER_BROWSER_VIEW'] . "\n" . $browserViewUrl; return $NewsletterBody; } $country = empty($userData['country_id']) ? '' : htmlentities(\FWUser::getFWUserObject()->objUser->objAttribute->getById('country_' . $userData['country_id'])->getName(), ENT_QUOTES, CONTREXX_CHARSET); switch ($userData['sex']) { case 'm': $sex = $_ARRAYLANG['TXT_NEWSLETTER_MALE']; break; case 'f': $sex = $_ARRAYLANG['TXT_NEWSLETTER_FEMALE']; break; default: $sex = ''; break; } switch ($userData['type']) { case self::USER_TYPE_ACCESS: case self::USER_TYPE_CORE: $realUser = true; break; case self::USER_TYPE_NEWSLETTER: default: $realUser = false; break; } // lets prepare all links for tracker before we replace placeholders // TODO: migrate tracker to new URL-format $content_text = self::prepareNewsletterLinksForSend($NewsletterID, $content_text, $userData['id'], $realUser); $search = array('[[email]]', '[[sex]]', '[[salutation]]', '[[title]]', '[[firstname]]', '[[lastname]]', '[[position]]', '[[company]]', '[[industry_sector]]', '[[address]]', '[[city]]', '[[zip]]', '[[country]]', '[[phone_office]]', '[[phone_private]]', '[[phone_mobile]]', '[[fax]]', '[[birthday]]', '[[website]]'); $replace = array($userData['email'], $sex, $userData['salutation'], $userData['title'], $userData['firstname'], $userData['lastname'], $userData['position'], $userData['company'], $userData['industry_sector'], $userData['address'], $userData['city'], $userData['zip'], $country, $userData['phone_office'], $userData['phone_private'], $userData['phone_mobile'], $userData['fax'], $userData['birthday'], $userData['website']); if ($testDelivery) { $replace = $search; } // do the replacement $content_text = str_replace($search, $replace, $content_text); $TemplateSource = str_replace($search, $replace, $TemplateSource); $search = array('[[display_in_browser_url]]', '[[profile_setup]]', '[[unsubscribe]]', '[[date]]', '[[subject]]'); $replace = array($browserViewUrl, $this->GetProfileURL($userData['code'], $TargetEmail, $userData['type']), $this->GetUnsubscribeURL($userData['code'], $TargetEmail, $userData['type']), date(ASCMS_DATE_FORMAT_DATE), $subject); // Replace the links in the content $content_text = str_replace($search, $replace, $content_text); // replace the links in the template $TemplateSource = str_replace($search, $replace, $TemplateSource); // i believe this replaces image paths... $allImg = array(); preg_match_all('/src="([^"]*)"/', $content_text, $allImg, PREG_PATTERN_ORDER); $size = sizeof($allImg[1]); $i = 0; while ($i < $size) { $URLforReplace = $allImg[1][$i]; $replaceUrl = new \Cx\Core\Routing\Url($URLforReplace, true); if ($replaceUrl->isInternal()) { $ReplaceWith = $replaceUrl->toString(); } else { $ReplaceWith = $URLforReplace; } $content_text = str_replace('"' . $URLforReplace . '"', '"' . $ReplaceWith . '"', $content_text); $i++; } // Set HTML height and width attributes for img-tags $allImgsWithHeightOrWidth = array(); preg_match_all('/<img[^>]*style=(["\'])[^\\1]*(?:width|height):\\s*[^;\\1]+;?\\s*[^\\1]*\\1[^>]*>/', $content_text, $allImgsWithHeightOrWidth); foreach ($allImgsWithHeightOrWidth as $img) { $htmlHeight = $this->getAttributeOfTag($img, 'img', 'height'); $htmlWidth = $this->getAttributeOfTag($img, 'img', 'width'); // no need to proceed if attributes are already set if (!empty($htmlHeight) && !empty($htmlWidth)) { continue; } $cssHeight = $this->getCssAttributeOfTag($img, 'img', 'height'); $cssWidth = $this->getCssAttributeOfTag($img, 'img', 'width'); // no need to proceed if we have no values to set if (empty($cssHeight) && empty($cssWidth)) { continue; } $imgOrig = $img; // set height and width attributes (if not yet set) if (empty($htmlHeight) && !empty($cssHeight)) { $img = $this->setAttributeOfTag($img, 'img', 'height', $cssHeight); } if (empty($htmlWidth) && !empty($cssWidth)) { $img = $this->setAttributeOfTag($img, 'img', 'width', $cssWidth); } $content_text = str_replace($imgOrig, $img, $content_text); } $NewsletterBody = str_replace("[[content]]", $content_text, $TemplateSource); return $NewsletterBody; }
/** * Select the prefered locale version of a message * @param array Array containing all localized versions of a message with its language code as index * @param string Preferend Language code * @return mixed Either the prefered message as string or NULL if $messages is empty */ private function getMessageInPreferedLanguage($messages, $langCode) { // check if a message is available if (empty($messages)) { return new Message(); } // return message in selected (=> current interface) language if (isset($messages[$langCode])) { return $messages[$langCode]; } // return message in default language if (isset($messages[\FWLanguage::getLanguageCodeById(\FWLanguage::getDefaultLangId())])) { return $messages[\FWLanguage::getLanguageCodeById(\FWLanguage::getDefaultLangId())]; } // return message in what ever language it is available reset($messages); return current($messages); }
public function getLangDir() { $lang_dir = ''; if ($this->langDir == '' && defined('FRONTEND_LANG_ID')) { $lang_dir = \FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID); } else { $lang_dir = $this->langDir; } return $lang_dir; }
/** * Generates the cloudrexx login link to log in with the given provider. * This can be used to generate the redirect url. * * @static * @param string $provider the provider name * @param string|null $redirect the redirect url * @return string */ public static function getLoginUrl($provider, $redirect = null) { global $_CONFIG, $objInit; return ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/' . \FWLanguage::getLanguageCodeById($objInit->getDefaultFrontendLangId()) . '/index.php?section=Login&provider=' . $provider . (!empty($redirect) ? '&redirect=' . $redirect : ''); }
/** * Get input field based on language id and value * * @param integer $id Input field id * @param string $value Input field value * @param integer $langId Language id * @param array $arrInputfield Language id * * @return string Return input field based on language id and value */ private function getInput($id = 0, $value = '', $langId = 0, $arrInputfield = array()) { global $_ARRAYLANG; $cx = \Cx\Core\Core\Controller\Cx::instanciate(); $arrValue = explode(",", $value); $filePath = $arrValue[0]; $displayName = null; $strFilePreview = null; if (!empty($filePath) && file_exists(\Env::get('cx')->getWebsitePath() . $filePath)) { $arrFileInfo = pathinfo($filePath); $strFileName = htmlspecialchars($arrFileInfo['basename'], ENT_QUOTES, CONTREXX_CHARSET); if (empty($arrValue[1])) { $displayName = $strFileName; } else { $displayName = strip_tags(htmlspecialchars($arrValue[1], ENT_QUOTES, CONTREXX_CHARSET)); } $strFilePreview = '<a href="' . urldecode($filePath) . '" target="_blank">' . $strFileName . '</a> <input data-id="' . $id . '" type="checkbox" class="' . (!$langId ? 'mediadirInputfieldDefaultDeleteFile' : '') . '" id="mediadirInputfield_delete_' . $id . '_' . $langId . '" value="1" name="deleteMedia[' . $id . '][' . $langId . ']" />' . $_ARRAYLANG['TXT_MEDIADIR_DELETE'] . '<br />'; } $flagPath = $cx->getCodeBaseOffsetPath() . $cx->getCoreFolderName() . '/Country/View/Media/Flag'; $inputStyle = !empty($langId) ? 'background: #ffffff url(\'' . $flagPath . '/flag_' . \FWLanguage::getLanguageCodeById($langId) . '.gif\') no-repeat 3px 3px;' : ''; $inputDefaultClass = empty($langId) ? $this->moduleNameLC . 'InputfieldDefault' : $this->moduleNameLC . 'LangInputfield'; $mode = $cx->getMode(); if ($mode == \Cx\Core\Core\Controller\Cx::MODE_BACKEND) { $strInputfield = <<<INPUT {$strFilePreview} <input type="text" name="{$this->moduleNameLC}Inputfield[{$id}][file][{$langId}]" value="{$filePath}" data-id="{$id}" class="{$inputDefaultClass}" id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}" style="{$inputStyle}" autocomplete="off" onfocus="this.select();" /> <input type="button" onClick="getMediaBrowser(\$J(this));" data-input-id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}" data-views="filebrowser" data-startmediatype="{$this->moduleNameLC}" value="{$_ARRAYLANG['TXT_BROWSE']}" /> <br /> <input type="text" name="{$this->moduleNameLC}Inputfield[{$id}][name][{$langId}]" value="{$displayName}" data-id="{$id}" data-related-field-prefix="{$this->moduleNameLC}InputfieldFileDisplayName" class="{$this->moduleNameLC}InputfieldFileDisplayName {$inputDefaultClass}" id="{$this->moduleNameLC}InputfieldFileDisplayName_{$id}_{$langId}" onfocus="this.select();" /> <i>{$_ARRAYLANG['TXT_MEDIADIR_DISPLAYNAME']}</i> INPUT; } else { if (empty($filePath) || $filePath == "new_image") { $strValueHidden = "new_image"; $filePath = ""; } else { $strValueHidden = $filePath; } $strInfoValue = $strInfoClass = ''; $strInfo = !empty($arrInputfield['info'][$langId]) ? $arrInputfield['info'][$langId] : (!empty($arrInputfield['info'][0]) ? $arrInputfield['info'][0] : ''); if ($strInfo) { $strInfoValue = 'title="' . $strInfo . '"'; $strInfoClass = 'mediadirInputfieldHint'; } $strInputfield = <<<INPUT {$strFilePreview} <input type="text" name="{$this->moduleNameLC}InputfieldSource[{$id}][{$langId}]" value="{$value}" data-id="{$id}" class="{$inputDefaultClass}" id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}" style="{$inputStyle}" autocomplete="off" onfocus="this.select();" /> <input type="button" onClick="getUploader(\$J(this));" data-input-id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}" value="{$_ARRAYLANG['TXT_BROWSE']}" /> <br /> <input id="{$this->moduleNameLC}Inputfield_{$id}_{$langId}_hidden" name="{$this->moduleNameLC}Inputfield[{$id}][file][{$langId}]" value="{$strValueHidden}" type="hidden" /> <br /> <input type="text" name="{$this->moduleNameLC}Inputfield[{$id}][name][{$langId}]" value="{$displayName}" data-id="{$id}" data-related-field-prefix="{$this->moduleNameLC}InputfieldFileDisplayName" class="{$this->moduleNameLC}InputfieldFileDisplayName {$inputDefaultClass}" id="{$this->moduleNameLC}InputfieldFileDisplayName_{$id}_{$langId}" onfocus="this.select();" /> <i>{$_ARRAYLANG['TXT_MEDIADIR_DISPLAYNAME']}</i> INPUT; } return $strInputfield; }
protected function fetchResponse($license, $_CONFIG, $forceTemplate, $_CORELANG) { $v = preg_split('#\\.#', $_CONFIG['coreCmsVersion']); $e = $_CONFIG['coreCmsEdition']; $version = current($v); unset($v[key($v)]); foreach ($v as $part) { $version *= 100; $version += $part; } $srvUri = 'updatesrv1.contrexx.com'; $srvPath = '/'; $data = array('installationId' => $license->getInstallationId(), 'licenseKey' => $license->getLicenseKey(), 'edition' => $license->getEditionName(), 'version' => $this->coreCmsVersion, 'versionstate' => $this->coreCmsStatus, 'domainName' => $this->domainUrl, 'sendTemplate' => $forceTemplate); if (true) { try { $objFile = new \Cx\Lib\FileSystem\File(ASCMS_INSTANCE_PATH . ASCMS_INSTANCE_OFFSET . '/config/License.lic'); $rawData = $objFile->getData(); $response = json_decode(base64_decode($rawData)); } catch (\Cx\Lib\FileSystem\FileSystemException $e) { $license->setState(License::LICENSE_ERROR); $license->setGrayzoneMessages(array(\FWLanguage::getLanguageCodeById(LANG_ID) => new Message(\FWLanguage::getLanguageCodeById(LANG_ID), $_CORELANG['TXT_LICENSE_COMMUNICATION_ERROR']))); $license->check(); throw $e; } return $response; } $a = $_SERVER['REMOTE_ADDR']; $r = 'http://'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { $r = 'https://'; } $r .= $_SERVER['SERVER_NAME'] . ASCMS_INSTANCE_OFFSET; $request = new \HTTP_Request2('http://' . $srvUri . $srvPath . '?v=' . $version, \HTTP_Request2::METHOD_POST); $request->setHeader('X-Edition', $e); $request->setHeader('X-Remote-Addr', $a); $request->setHeader('Referer', $r); $jd = new \Cx\Core\Json\JsonData(); $request->addPostParameter('data', $jd->json($data)); try { $objResponse = $request->send(); if ($objResponse->getStatus() !== 200) { $license->setState(License::LICENSE_ERROR); $license->setGrayzoneMessages(array(\FWLanguage::getLanguageCodeById(LANG_ID) => new Message(\FWLanguage::getLanguageCodeById(LANG_ID), $_CORELANG['TXT_LICENSE_COMMUNICATION_ERROR']))); $license->check(); return null; } else { \DBG::dump($objResponse->getBody()); $response = json_decode($objResponse->getBody()); } } catch (\HTTP_Request2_Exception $objException) { $license->setState(License::LICENSE_ERROR); $license->setGrayzoneMessages(array(\FWLanguage::getLanguageCodeById(LANG_ID) => new Message(\FWLanguage::getLanguageCodeById(LANG_ID), $_CORELANG['TXT_LICENSE_COMMUNICATION_ERROR']))); $license->check(); throw $objException; } return $response; }