Example #1
0
 private function getChildren($id, &$root, $depth = 0, $onlyactive = false, $pubOnly = false)
 {
     if ($onlyactive) {
         $where = ' AND status="active" ';
     }
     $sql = 'select * from menu where parent_id=' . $id . @$where . ' ORDER BY sort asc';
     $roots = Database::singleton()->query_fetch_all($sql);
     $first = true;
     foreach ($roots as &$item) {
         if ($this->getModInfo($item['module_id']) == 'Content' && $pubOnly == true) {
             include_once '../modules/Content/include/CMSPage.php';
             $data = new CMSPage($item['link']);
             if ($data->getAccess() == 'public') {
                 $cur =& $root[];
                 $cur = new MenuItem($item['id']);
                 $cur->depth = $depth;
                 $this->getChildren($item['id'], $cur->children, $depth + 1, $onlyactive, $pubOnly);
                 if ($first) {
                     $cur->top = true;
                     $first = false;
                 }
             }
         } else {
             $cur =& $root[];
             $cur = new MenuItem($item['id']);
             $cur->depth = $depth;
             $this->getChildren($item['id'], $cur->children, $depth + 1, $onlyactive, $pubOnly);
             if ($first) {
                 $cur->top = true;
                 $first = false;
             }
         }
     }
     $cur->bottom = true;
 }
Example #2
0
 public function getUserInterface($params = null)
 {
     include 'include/CMSPage.php';
     $this->smarty->assign('hasRestriction', $this->hasRestriction());
     $page = new CMSPage($_REQUEST['page']);
     $rev = $page->getActiveRevisions($_SESSION['lang']);
     if ($page->getAccess() != 'public' && $this->hasRestriction()) {
         $auth_container = new User();
         $auth = new Auth($auth_container, null, 'authInlineHTML');
         $auth->start();
         if (!$auth->checkAuth()) {
             return authInlineHTML();
         } else {
             if ($page->getAccess() != 'public' && $_SESSION['authenticated_user']->hasPerm('membersaccess')) {
                 $this->smarty->assign('content_perms', true);
             } else {
                 $this->smarty->assign('content_perms', false);
             }
         }
     } else {
         $this->smarty->assign('content_perms', true);
     }
     $metaData = $rev->getMetaData();
     $this->smarty->assign('content', $rev);
     $this->setMetaDescription($metaData['description']);
     $this->setMetaTitle($metaData['title']);
     $this->setMetaKeywords($metaData['keywords']);
     $this->setPageTitle($rev->getPageTitle());
     return $this->smarty->fetch('db:content.tpl');
 }