/** * Gets the search query builder. * Searches for slug, title and content title by the given search term. * * @return \Doctrine\ORM\QueryBuilder $qb */ private function getSearchQueryBuilder() { $qb = $this->em->createQueryBuilder(); // build query $qb->from('Cx\\Core\\ContentManager\\Model\\Entity\\Page', 'p')->where($qb->expr()->andX($qb->expr()->orX($qb->expr()->like('p.slug', ':searchTerm'), $qb->expr()->like('p.title', ':searchTerm'), $qb->expr()->like('p.contentTitle', ':searchTerm'), $qb->expr()->andX($qb->expr()->like('p.content', ':searchTerm'), 'p.type = \'' . \Cx\Core\ContentManager\Model\Entity\Page::TYPE_CONTENT . '\''), $qb->expr()->andX($qb->expr()->orX($qb->expr()->like('p.module', ':searchTerm'), $qb->expr()->like('p.cmd', ':searchTerm')), 'p.type = \'' . \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION . '\'')), $qb->expr()->orX('p.module = \'\'', 'p.module IS NULL', $qb->expr()->in('p.module', $this->license->getLegalComponentsList())), $qb->expr()->orX($qb->expr()->in('p.lang', \FWLanguage::getIdArray('frontend')), $qb->expr()->eq('p.lang', "''"))))->setParameter('searchTerm', '%' . $this->term . '%')->orderBy('p.title'); return $qb; }
/** * Loads the language config from the database * * This used to be in __construct but is also * called from core/language.class.php to reload * the config, so core/settings.class.php can * rewrite .htaccess (virtual lang dirs). */ static function init() { global $_CONFIG, $objDatabase; $objResult = $objDatabase->Execute("\n SELECT id, lang, name, charset, themesid,\n frontend, backend, is_default, fallback\n FROM " . DBPREFIX . "languages\n ORDER BY id ASC"); if ($objResult) { $license = \Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase); $license->check(); $full = $license->isInLegalComponents('fulllanguage'); while (!$objResult->EOF) { self::$arrLanguages[$objResult->fields['id']] = array('id' => $objResult->fields['id'], 'lang' => $objResult->fields['lang'], 'name' => $objResult->fields['name'], 'charset' => $objResult->fields['charset'], 'themesid' => $objResult->fields['themesid'], 'frontend' => $objResult->fields['frontend'], 'backend' => $objResult->fields['backend'], 'is_default' => $objResult->fields['is_default'], 'fallback' => $objResult->fields['fallback']); if (!$full && $objResult->fields['is_default'] != 'true') { self::$arrLanguages[$objResult->fields['id']]['frontend'] = 0; self::$arrLanguages[$objResult->fields['id']]['backend'] = 0; } if ($objResult->fields['is_default'] == 'true') { self::$defaultLangId = $objResult->fields['id']; } $objResult->MoveNext(); } } }
/** * Overview Media Data * * @global array $_ARRAYLANG * @global array $_CONFIG * @global array $_CORELANG * @return string parsed content */ function _overviewMedia() { global $_ARRAYLANG, $_CONFIG, $_CORELANG, $objDatabase; \JS::activate('shadowbox'); $this->_objTpl->loadTemplateFile('module_media.html', true, true); switch ($this->archive) { case 'themes': $this->pageTitle = $_ARRAYLANG['TXT_MEDIA_LAYOUT']; break; case 'content': $this->pageTitle = $_ARRAYLANG['TXT_IMAGE_ADMINISTRATION']; break; case 'Contact': $this->pageTitle = $_ARRAYLANG['TXT_FILE_UPLOADS']; break; case 'attach': case 'Access': case 'Blog': case 'Calendar': case 'Downloads': case 'Gallery': case 'MediaDir': case 'Podcast': case 'Shop': $archives = array('attach' => 'TXT_FILE_UPLOADS', 'Shop' => 'TXT_IMAGE_SHOP', 'Gallery' => 'TXT_GALLERY_TITLE', 'Access' => 'TXT_USER_ADMINISTRATION', 'MediaDir' => 'TXT_MEDIADIR_MODULE', 'Downloads' => 'TXT_DOWNLOADS', 'Calendar' => 'TXT_CALENDAR', 'Podcast' => 'TXT_PODCAST', 'Blog' => 'TXT_BLOG_MODULE'); $moduleMatchTable = array('attach' => 'core'); $subnavigation = ' <div id="subnavbar_level2"> <ul>'; $license = \Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase); $license->check(); foreach ($archives as $archive => $txtKey) { $moduleName = $archive; if (isset($moduleMatchTable[$archive])) { $moduleName = $moduleMatchTable[$archive]; } if (!$license->isInLegalComponents($moduleName)) { \DBG::msg('Module "' . $archive . '" is deactivated'); continue; } $subnavigation .= ' <li><a href="index.php?cmd=Media&archive=' . $archive . '" class="' . ($this->archive == $archive ? 'active' : '') . '">' . $_ARRAYLANG[$txtKey] . '</a></li>'; } $subnavigation .= ' </ul> </div>'; $this->_objTpl->setVariable('CONTENT_SUBNAVIGATION', $subnavigation); default: $this->pageTitle = $_ARRAYLANG['TXT_MEDIA_OVERVIEW']; if ($this->archive == "FileSharing") { \Cx\Modules\FileSharing\Controller\FileSharingLib::cleanUp(); } break; } // cut, copy and paste session if (isset($_SESSION['mediaCutFile'])) { $tmpArray = array(); foreach ($_SESSION['mediaCutFile'][2] as $tmp) { if (file_exists($_SESSION['mediaCutFile'][0] . $tmp)) { $tmpArray[] = $tmp; } } if (count($tmpArray) > 0) { $_SESSION['mediaCutFile'][0] = $_SESSION['mediaCutFile'][0]; $_SESSION['mediaCutFile'][1] = $_SESSION['mediaCutFile'][1]; $_SESSION['mediaCutFile'][2] = $tmpArray; } else { unset($_SESSION['mediaCutFile']); } } if (isset($_SESSION['mediaCopyFile'])) { $tmpArray = array(); foreach ($_SESSION['mediaCopyFile'][2] as $tmp) { if (file_exists($_SESSION['mediaCopyFile'][0] . $tmp)) { $tmpArray[] = $tmp; } } if (count($tmpArray) > 0) { $_SESSION['mediaCopyFile'][0] = $_SESSION['mediaCopyFile'][0]; $_SESSION['mediaCopyFile'][1] = $_SESSION['mediaCopyFile'][1]; $_SESSION['mediaCopyFile'][2] = $tmpArray; } else { unset($_SESSION['mediaCopyFile']); } } // tree navigation $tmp = $this->arrWebPaths[$this->archive]; if (substr($this->webPath, 0, strlen($tmp)) == $tmp) { $this->_objTpl->setVariable(array('MEDIA_TREE_NAV_MAIN' => 'http://' . $_SERVER['HTTP_HOST'] . $this->arrWebPaths[$this->archive], 'MEDIA_TREE_NAV_MAIN_HREF' => 'index.php?cmd=Media&archive=' . $this->archive . '&path=' . $this->arrWebPaths[$this->archive])); if (strlen($this->webPath) != strlen($tmp)) { $tmpPath = substr($this->webPath, -(strlen($this->webPath) - strlen($tmp))); $tmpPath = explode('/', $tmpPath); $tmpLink = ''; foreach ($tmpPath as $path) { if (!empty($path)) { $tmpLink .= $path . '/'; $this->_objTpl->setVariable(array('MEDIA_TREE_NAV_DIR' => $path, 'MEDIA_TREE_NAV_DIR_HREF' => 'index.php?cmd=Media&archive=' . $this->archive . '&path=' . $this->arrWebPaths[$this->archive] . $tmpLink)); $this->_objTpl->parse('mediaTreeNavigation'); } } } } //data we want to remember for handling the uploaded files $data = array('path' => $this->path, 'webPath' => $this->webPath); $uploader = new \Cx\Core_Modules\Uploader\Model\Entity\Uploader(); $uploader->setCallback('mediaCallbackJs'); $uploader->setFinishedCallback(array(ASCMS_CORE_MODULE_PATH . '/Media/Controller/MediaLibrary.class.php', '\\Cx\\Core_modules\\Media\\Controller\\MediaLibrary', 'uploadFinished')); $uploader->setOptions(array('id' => 'media_browse_button', 'type' => 'button')); $uploader->setData($data); $this->_objTpl->setVariable('MEDIA_UPLOADER_BUTTON', $uploader->getXHtml($_ARRAYLANG['TXT_MEDIA_UPLOAD_FILES'])); //end of uploader button handling //check if a finished upload caused reloading of the page. //if yes, we know the added files and want to highlight them if (!empty($_GET['highlightUploadId'])) { $key = 'media_upload_files_' . $_GET['highlightUploadId']; if (isset($_SESSION[$key])) { $sessionHighlightCandidates = $_SESSION[$key]->toArray(); //an array with the filenames, set in mediaLib::uploadFinished } //clean up session; we do only highlight once unset($_SESSION[$key]); if (is_array($sessionHighlightCandidates)) { //make sure we don't cause any unexpected behaviour if we lost the session data $this->highlightName = $sessionHighlightCandidates; } } // Check if an image has been edited. // If yes, we know the edited file and want to highlight them. if (!empty($_GET['editedImage'])) { \Cx\Core\Core\Controller\Cx::instanciate()->getMediaSourceManager()->getThumbnailGenerator()->createThumbnailFromPath($this->path . $_GET['editedImage'], true); $this->highlightName[] = $_GET['editedImage']; } // media directory tree $i = 0; $dirTree = $this->_dirTree($this->path); $dirTree = $this->_sortDirTree($dirTree); foreach (array_keys($dirTree) as $key) { if (isset($dirTree[$key]['icon']) && is_array($dirTree[$key]['icon'])) { for ($x = 0; $x < count($dirTree[$key]['icon']); $x++) { $fileName = $dirTree[$key]['name'][$x]; if (MediaLibrary::isIllegalFileName($fileName)) { continue; } // colors $class = $i % 2 ? 'row2' : 'row1'; if (in_array($fileName, $this->highlightName)) { $class .= '" style="background-color: ' . $this->highlightColor . ';'; } if (isset($_SESSION['mediaCutFile']) && !empty($_SESSION['mediaCutFile'])) { if ($this->webPath == $_SESSION['mediaCutFile'][1] && in_array($fileName, $_SESSION['mediaCutFile'][2])) { $class .= '" style="background-color: ' . $this->highlightCCColor . ';'; } } if (isset($_SESSION['mediaCopyFile']) && !empty($_SESSION['mediaCopyFile'])) { if ($this->webPath == $_SESSION['mediaCopyFile'][1] && in_array($fileName, $_SESSION['mediaCopyFile'][2])) { $class .= '" style="background-color: ' . $this->highlightCCColor . ';'; } } $this->_objTpl->setVariable(array('MEDIA_DIR_TREE_ROW' => $class, 'MEDIA_FILE_ICON' => $dirTree[$key]['icon'][$x], 'MEDIA_FILE_NAME' => $fileName, 'MEDIA_FILE_SIZE' => $this->_formatSize($dirTree[$key]['size'][$x]), 'MEDIA_FILE_TYPE' => $this->_formatType($dirTree[$key]['type'][$x]), 'MEDIA_FILE_DATE' => $this->_formatDate($dirTree[$key]['date'][$x]), 'MEDIA_FILE_PERM' => $this->_formatPerm($dirTree[$key]['perm'][$x], $key))); // creates link if ($key == 'dir') { $tmpHref = 'index.php?cmd=Media&archive=' . $this->archive . '&path=' . $this->webPath . $fileName . '/'; } elseif ($key == 'file') { if ($this->_isImage($this->path . $fileName)) { $tmpHref = 'javascript:expandcontent(\'preview_' . $fileName . '\');'; } else { $tmpHref = 'index.php?cmd=Media&archive=' . $this->archive . '&act=download&path=' . $this->webPath . '&file=' . $fileName; } } $this->_objTpl->setVariable(array('MEDIA_FILE_NAME_HREF' => $tmpHref)); // show thumbnail if ($this->_isImage($this->path . $fileName)) { // make thumbnail if it doesn't exist $tmpSize = @getimagesize($this->path . $fileName); $thumbnails = \Cx\Core\Core\Controller\Cx::instanciate()->getMediaSourceManager()->getThumbnailGenerator()->createThumbnailFromPath($this->path . $fileName); $thumb = $this->webPath . $thumbnails[0]; if (in_array($fileName, $this->highlightName)) { $thumb .= '?lastAccess=' . fileatime($this->path . $fileName); } $this->_objTpl->setVariable(array('MEDIA_FILE_NAME_SIZE' => $tmpSize[0] . ' x ' . $tmpSize[1], 'MEDIA_FILE_NAME_PRE' => 'preview_' . $fileName, 'MEDIA_FILE_NAME_IMG_HREF' => $this->webPath . $fileName, 'MEDIA_FILE_NAME_IMG_SRC' => $thumb, 'MEDIA_FILE_NAME_IMG_SIZE' => $thumbnails[0]['size'])); $this->_objTpl->parse('mediaShowThumbnail'); $this->_objTpl->setVariable(array('MEDIA_FILE_EDIT_HREF' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=edit&path=' . $this->webPath . '&file=' . $fileName, 'MEDIA_EDIT' => $_ARRAYLANG['TXT_MEDIA_EDIT'])); $this->_objTpl->parse('mediaImageEdit'); } $this->_objTpl->setVariable(array('MEDIA_FILE_RENAME_HREF' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=rename&path=' . $this->webPath . '&file=' . $fileName, 'MEDIA_RENAME' => $_ARRAYLANG['TXT_MEDIA_RENAME'], 'MEDIA_FILE_DELETE_HREF' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=delete&path=' . $this->webPath . '&file=' . $fileName, 'MEDIA_DELETE' => $_ARRAYLANG['TXT_MEDIA_DELETE'], 'MEDIA_FILE_FILESHARING_HREF' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=filesharing&path=' . $this->webPath . '&file=' . $fileName, 'MEDIA_FILESHARING' => $_ARRAYLANG['TXT_FILESHARING_MODULE'], 'MEDIA_FILESHARING_STATE' => \Cx\Modules\FileSharing\Controller\FileSharingLib::isShared(null, (isset($_GET['path']) ? $_GET['path'] : ASCMS_FILESHARING_WEB_PATH . '/') . $fileName) ? '_green' : '_red')); if ($this->archive == "FileSharing" && !is_dir($this->path . $fileName)) { $this->_objTpl->parse('mediaFilesharing'); } else { $this->_objTpl->hideBlock('mediaFilesharing'); } $this->_objTpl->parse('mediaDirectoryTree'); $i++; } } } // empty dir or php safe mode restriction if ($i == 0 || !@opendir($this->path)) { $tmpMessage = $_ARRAYLANG['TXT_MEDIA_DIR_EMPTY']; if (!@opendir($this->path)) { $tmpMessage = 'PHP Safe Mode Restriction!'; } $this->_objTpl->setVariable(array('TXT_MEDIA_DIR_EMPTY' => $tmpMessage, 'MEDIA_SELECT_STATUS' => ' disabled')); $this->_objTpl->parse('mediaEmptyDirectory'); } else { // not empty dir (select action) $this->_objTpl->setVariable(array('TXT_SELECT_ALL' => $_CORELANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_CORELANG['TXT_DESELECT_ALL'], 'TXT_MEDIA_SELECT_ACTION' => $_ARRAYLANG['TXT_MEDIA_SELECT_ACTION'], 'TXT_MEDIA_CUT' => $_ARRAYLANG['TXT_MEDIA_CUT'], 'TXT_MEDIA_COPY' => $_ARRAYLANG['TXT_MEDIA_COPY'], 'TXT_MEDIA_DELETE' => $_ARRAYLANG['TXT_MEDIA_DELETE'])); $this->_objTpl->parse('mediaSelectAction'); $this->_objTpl->setVariable('MEDIA_ARCHIVE', $this->archive); } // paste media if (isset($_SESSION['mediaCutFile']) or isset($_SESSION['mediaCopyFile'])) { $this->_objTpl->setVariable(array('MEDIDA_PASTE_ACTION' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=paste&path=' . $this->webPath, 'TXT_MEDIA_PASTE' => $_ARRAYLANG['TXT_MEDIA_PASTE'])); $this->_objTpl->parse('mediaActionPaste'); } // parse variables $tmpHref = 'index.php?cmd=Media&archive=' . $this->archive . '&path=' . $this->webPath; $tmpIcon = $this->_sortingIcons(); $tmpClass = $this->_sortingClass(); $this->_objTpl->setVariable(array('TXT_MEDIA_CHECK_NAME' => $_ARRAYLANG['TXT_MEDIA_CHECK_NAME'], 'TXT_MEDIA_CONFIRM_DELETE_2' => $_ARRAYLANG['TXT_MEDIA_CONFIRM_DELETE_2'], 'MEDIA_DO_ACTION_PATH' => $this->webPath, 'TXT_MEDIA_MAKE_SELECTION' => $_ARRAYLANG['TXT_MEDIA_MAKE_SELECTION'], 'TXT_MEDIA_SELECT_UPLOAD_FILE' => $_ARRAYLANG['TXT_MEDIA_SELECT_UPLOAD_FILE'], 'MEDIA_JAVA_SCRIPT_PREVIEW' => $this->_getJavaScriptCodePreview())); $this->_objTpl->setVariable(array('TXT_MEDIA_NEW_DIRECTORY' => $_ARRAYLANG['TXT_MEDIA_NEW_DIRECTORY'], 'MEDIA_CREATE_DIR_ACTION' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=newDir&path=' . $this->webPath, 'TXT_MEDIA_NAME' => $_ARRAYLANG['TXT_MEDIA_NAME'], 'TXT_MEDIA_CREATE' => $_ARRAYLANG['TXT_MEDIA_CREATE'])); $this->_objTpl->setVariable(array('TXT_MEDIA_UPLOAD_FILES' => $_ARRAYLANG['TXT_MEDIA_UPLOAD_FILES'], 'MEDIA_UPLOAD_FILES_ACTION' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=upload&path=' . $this->webPath, 'TXT_MEDIA_UPLOAD' => $_ARRAYLANG['TXT_MEDIA_UPLOAD'], 'TXT_MEDIA_FORCE_OVERWRITE' => $_ARRAYLANG['TXT_MEDIA_FORCE_OVERWRITE'])); $this->_objTpl->setVariable(array('MEDIA_NAME_HREF' => $tmpHref . '&sort=name&sort_desc=' . ($this->sortBy == 'name' && !$this->sortDesc), 'MEDIA_SIZE_HREF' => $tmpHref . '&sort=size&sort_desc=' . ($this->sortBy == 'size' && !$this->sortDesc), 'MEDIA_TYPE_HREF' => $tmpHref . '&sort=type&sort_desc=' . ($this->sortBy == 'type' && !$this->sortDesc), 'MEDIA_DATE_HREF' => $tmpHref . '&sort=date&sort_desc=' . ($this->sortBy == 'date' && !$this->sortDesc), 'MEDIA_PERM_HREF' => $tmpHref . '&sort=perm&sort_desc=' . ($this->sortBy == 'perm' && !$this->sortDesc), 'TXT_MEDIA_FILE_NAME' => $_ARRAYLANG['TXT_MEDIA_FILE_NAME'], 'TXT_MEDIA_FILE_SIZE' => $_ARRAYLANG['TXT_MEDIA_FILE_SIZE'], 'TXT_MEDIA_FILE_TYPE' => $_ARRAYLANG['TXT_MEDIA_FILE_TYPE'], 'TXT_MEDIA_FILE_DATE' => $_ARRAYLANG['TXT_MEDIA_FILE_DATE'], 'TXT_MEDIA_FILE_PERM' => $_ARRAYLANG['TXT_MEDIA_FILE_PERM'], 'TXT_MEDIA_FILE_FUNCTIONS' => $_ARRAYLANG['TXT_FUNCTIONS'], 'MEDIA_NAME_ICON' => isset($tmpIcon['name']) ? $tmpIcon['name'] : '', 'MEDIA_SIZE_ICON' => isset($tmpIcon['size']) ? $tmpIcon['size'] : '', 'MEDIA_TYPE_ICON' => isset($tmpIcon['type']) ? $tmpIcon['type'] : '', 'MEDIA_DATE_ICON' => isset($tmpIcon['date']) ? $tmpIcon['date'] : '', 'MEDIA_PERM_ICON' => isset($tmpIcon['perm']) ? $tmpIcon['perm'] : '', 'MEDIA_NAME_CLASS' => isset($tmpClass['name']) ? $tmpIcon['name'] : '', 'MEDIA_SIZE_CLASS' => isset($tmpClass['size']) ? $tmpIcon['size'] : '', 'MEDIA_TYPE_CLASS' => isset($tmpClass['type']) ? $tmpIcon['type'] : '', 'MEDIA_DATE_CLASS' => isset($tmpClass['date']) ? $tmpIcon['date'] : '', 'MEDIA_PERM_CLASS' => isset($tmpClass['perm']) ? $tmpIcon['perm'] : '', 'CSRF' => \Cx\Core\Csrf\Controller\Csrf::param())); }
protected function isInFullMode() { global $_CONFIG, $objDatabase; return \Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase)->isInLegalComponents("fulllanguage"); }
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'); } }
/** * Do something after resolving is done * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function postResolve(\Cx\Core\ContentManager\Model\Entity\Page $page) { // TODO: Deactivated license check for now. Implement new behavior. return true; global $plainCmd, $objDatabase, $_CORELANG, $_LANGID, $section; $license = \Cx\Core_Modules\License\License::getCached(\Env::get('config'), $objDatabase); switch ($this->cx->getMode()) { case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND: if (!$license->isInLegalComponents('fulllanguage') && $_LANGID != \FWLanguage::getDefaultLangId()) { $_LANGID = \FWLanguage::getDefaultLangId(); \Env::get('Resolver')->redirectToCorrectLanguageDir(); } if (!empty($section) && !$license->isInLegalFrontendComponents($section)) { if ($section == 'Error') { // If the error module is not installed, show this die($_CORELANG['TXT_THIS_MODULE_DOESNT_EXISTS']); } else { //page not found, redirect to error page. \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . \Cx\Core\Routing\Url::fromModuleAndCmd('Error')); exit; } } break; case \Cx\Core\Core\Controller\Cx::MODE_BACKEND: // check if the requested module is active: if (!in_array($plainCmd, array('Login', 'noaccess', ''))) { $query = ' SELECT modules.is_licensed FROM ' . DBPREFIX . 'modules AS modules, ' . DBPREFIX . 'backend_areas AS areas WHERE areas.module_id = modules.id AND ( areas.uri LIKE "%cmd=' . contrexx_raw2db($plainCmd) . '&%" OR areas.uri LIKE "%cmd=' . contrexx_raw2db($plainCmd) . '" ) '; $res = $objDatabase->Execute($query); if (!$res->fields['is_licensed']) { $plainCmd = in_array('LicenseManager', \Env::get('cx')->getLicense()->getLegalComponentsList()) ? 'License' : 'Home'; } } // If logged in if (\Env::get('cx')->getUser()->objUser->login(true)) { $license->check(); if ($license->getState() == \Cx\Core_Modules\License\License::LICENSE_NOK) { $plainCmd = in_array('LicenseManager', \Env::get('cx')->getLicense()->getLegalComponentsList()) ? 'License' : 'Home'; $license->save($objDatabase); } $lc = \Cx\Core_Modules\License\LicenseCommunicator::getInstance(\Env::get('config')); $lc->addJsUpdateCode($_CORELANG, $license, $plainCmd == 'License'); } break; default: break; } }
/** * Initialize license and call pre-component-load hook scripts * @throws \Cx\Core\Model\DbException * @throws \Exception */ protected function preComponentLoad() { global $_CONFIG; $this->license = \Cx\Core_Modules\License\License::getCached($_CONFIG, $this->getDb()->getAdoDb()); $this->callPreComponentLoadHooks(); }
/** * Late initializations. Loads components */ protected function postInit() { global $_CONFIG; // if path configuration was wrong in loadConfig(), Url is not yet initialized if (!$this->request) { // this makes \Env::get('Resolver')->getUrl() return a sensful result $request = !empty($_GET['__cap']) ? $_GET['__cap'] : ''; $offset = $this->websiteOffsetPath; switch ($this->mode) { case self::MODE_FRONTEND: case self::MODE_BACKEND: $this->request = new \Cx\Core\Routing\Model\Entity\Request($_SERVER['REQUEST_METHOD'], \Cx\Core\Routing\Url::fromCapturedRequest($request, $offset, $_GET)); break; case self::MODE_COMMAND: case self::MODE_MINIMAL: try { $this->request = new \Cx\Core\Routing\Model\Entity\Request($_SERVER['REQUEST_METHOD'], \Cx\Core\Routing\Url::fromRequest()); } catch (\Cx\Core\Routing\UrlException $e) { } break; } } $this->license = \Cx\Core_Modules\License\License::getCached($_CONFIG, $this->getDb()->getAdoDb()); //call post-init hooks $this->callPostInitHooks(); }
/** * Parse a user's newsletter-list subscription interface * @param User User object of whoem the newsletter-list subscriptions shall be parsed */ protected function parseNewsletterLists($objUser) { global $_CONFIG, $objDatabase, $objInit; if (!$this->_objTpl->blockExists('access_newsletter')) { return; } if (\Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase)->isInLegalComponents('Newsletter')) { $arrSubscribedNewsletterListIDs = $objUser->getSubscribedNewsletterListIDs(); $arrNewsletterLists = \Cx\Modules\Newsletter\Controller\NewsletterLib::getLists(); if (!count($arrNewsletterLists)) { $this->_objTpl->hideBlock('access_newsletter_list'); return; } $row = 0; foreach ($arrNewsletterLists as $listId => $arrList) { if ($objInit->mode != 'backend' && !$arrList['status'] && !in_array($listId, $arrSubscribedNewsletterListIDs)) { continue; } $this->_objTpl->setVariable(array($this->modulePrefix . 'NEWSLETTER_ID' => $listId, $this->modulePrefix . 'NEWSLETTER_NAME' => contrexx_raw2xhtml($arrList['name']), $this->modulePrefix . 'NEWSLETTER_SELECTED' => in_array($listId, $arrSubscribedNewsletterListIDs) ? 'checked="checked"' : '', $this->modulePrefix . 'NEWSLETTER_ROW_CLASS' => $row++ % 2 + 1)); $this->_objTpl->parse('access_newsletter_list'); } $this->_objTpl->touchBlock('access_newsletter'); if ($this->_objTpl->blockExists('access_newsletter_tab')) { $this->_objTpl->touchBlock('access_newsletter_tab'); } } else { $this->_objTpl->hideBlock('access_newsletter'); if ($this->_objTpl->blockExists('access_newsletter_tab')) { $this->_objTpl->hideBlock('access_newsletter_tab'); } } }
public function update($getNew = true) { global $documentRoot, $_CONFIG, $objUser, $license, $objDatabase; if (@(include_once ASCMS_DOCUMENT_ROOT . '/lib/PEAR/HTTP/Request2.php')) { $_GET['force'] = 'true'; $_GET['silent'] = 'true'; $documentRoot = ASCMS_DOCUMENT_ROOT; $_CONFIG['licenseUpdateInterval'] = 0; $_CONFIG['licenseSuccessfulUpdate'] = 0; $_CONFIG['licenseState'] = ''; if ($getNew) { $_CONFIG['installationId'] = ''; $_CONFIG['licenseKey'] = ''; } $objUser = \FWUser::getFWUserObject()->objUser; $license = \Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase); $return = @(include_once ASCMS_DOCUMENT_ROOT . '/core_modules/License/versioncheck.php'); } // we force a version number update. if the license update failed // version number will not be upgraded yet: \Cx\Lib\UpdateUtil::sql('UPDATE `' . DBPREFIX . 'settings` SET `setvalue` = \'' . $_CONFIG['coreCmsVersion'] . '\' WHERE `setid` = 97'); $settingsManager = new \settingsManager(); $settingsManager->writeSettingsFile(); return $return === true; }