Exemplo n.º 1
0
 /**
  * Load your component.
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_CORELANG, $objTemplate, $objDatabase, $act;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
             $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
             $objTemplate = $this->cx->getTemplate();
             \Permission::checkAccess(177, 'static');
             $config = \Env::get('config');
             $objLicense = new \Cx\Core_Modules\License\LicenseManager($act, $objTemplate, $_CORELANG, $config, $objDatabase);
             $objLicense->getPage($_POST, $_CORELANG);
             break;
         default:
             break;
     }
 }
Exemplo n.º 2
0
 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');
     }
 }