Exemplo n.º 1
0
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 public function rebuild(array $parameters)
 {
     $data = array('aliasToPage' => array(), 'pages' => array(), 'stylesheetsToPage' => array(), 'structure' => array());
     // fetch pages
     $pageList = new PageList();
     $pageList->sqlOrderBy = 'page.parentID ASC, page.showOrder ASC';
     $pageList->readObjects();
     $data['pages'] = $pageList->getObjects();
     foreach ($pageList as $page) {
         // Handle aliase to page assignment. Notice that we
         // can't simply use '$page->getAlias()' here since the
         // function would require a builded cache!
         $alias = $page->alias;
         $tmp = $page;
         while ($tmp->parentID && ($tmp = $data['pages'][$tmp->parentID])) {
             $alias = $tmp->alias . '/' . $alias;
         }
         $data['aliasToPage'][$alias] = $page->pageID;
         // page structure
         $data['structure'][$page->parentID][] = $page->pageID;
     }
     // stylesheets
     $sql = "SELECT\t*\n\t\t\tFROM\tcms" . WCF_N . "_stylesheet_to_page";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute();
     while ($row = $statement->fetchArray()) {
         $data['stylesheetsToPage'][$row['pageID']][] = $row['stylesheetID'];
     }
     return $data;
 }
 /**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     $this->pageList = new PageList();
     $this->pageList->sqlLimit = CMS_DASHBOARD_SIDEBAR_ENTRIES;
     $this->pageList->sqlOrderBy = 'page.creationTime DESC';
     $this->pageList->readObjects();
     $this->fetched();
 }
 /**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     $this->pageList = new PageList();
     $this->pageList->getConditionBuilder()->add('page.clicks > 0');
     $this->pageList->sqlLimit = CMS_DASHBOARD_SIDEBAR_ENTRIES;
     $this->pageList->sqlOrderBy = 'page.clicks DESC';
     $this->pageList->readObjects();
     $this->fetched();
 }
Exemplo n.º 4
0
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // set dates
     if (isset($_POST['startDate'])) {
         $this->startDate = strtotime($_POST['startDate']);
     }
     if (isset($_POST['endDate'])) {
         $this->endDate = strtotime($_POST['endDate']);
     }
     if ($this->startDate == 0) {
         $this->startDate = TIME_NOW - 604800;
     }
     if ($this->endDate == 0) {
         $this->endDate = TIME_NOW;
     }
     // get stats
     $this->visits = VisitCountHandler::getInstance()->getVisitors($this->startDate, $this->endDate);
     foreach ($this->visits as $visit) {
         $browsers = @unserialize($visit['visitors']['browsers']);
         if (empty($browsers)) {
             $browsers = array();
         }
         foreach ($browsers as $key => $value) {
             $this->browsers[$key] = array('visits' => isset($this->browsers[$key]['visits']) ? $this->browsers[$key]['visits'] + $value : $value);
         }
         $platforms = @unserialize($visit['visitors']['platforms']);
         if (empty($platforms)) {
             $platforms = array();
         }
         foreach ($platforms as $key => $value) {
             $this->platforms[$key] = array('visits' => isset($this->platforms[$key]['visits']) ? $this->platforms[$key]['visits'] + $value : $value);
         }
         $devices = @unserialize($visit['visitors']['devices']);
         if (empty($devices)) {
             $devices = array();
         }
         foreach ($devices as $key => $value) {
             $this->devices[$key] = array('visits' => isset($this->devices[$key]['visits']) ? $this->devices[$key]['visits'] + $value : $value);
         }
     }
     // read pages
     $list = new PageList();
     $list->sqlOrderBy = 'page.clicks DESC';
     $list->sqlLimit = '8';
     $list->readObjects();
     $this->pages = $list->getObjects();
     // user online list
     $this->usersOnlineList = new UsersOnlineList();
     $this->usersOnlineList->readStats();
     $this->usersOnlineList->readObjects();
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 public function rebuild(array $parameters)
 {
     $data = array();
     $objectTypeName = 'de.codequake.cms.page';
     $pageList = new PageList();
     $pageList->readObjects();
     $pageList = $pageList->getObjects();
     $aclOptions = ACLHandler::getInstance()->getPermissions(ACLHandler::getInstance()->getObjectTypeID($objectTypeName), array_keys($pageList));
     $options = $aclOptions['options']->getObjects();
     foreach (array('group', 'user') as $type) {
         foreach ($aclOptions[$type] as $pageID => $optionData) {
             if (!isset($data[$pageID])) {
                 $data[$pageID] = array('group' => array(), 'user' => array());
             }
             foreach ($optionData as $typeID => $optionValues) {
                 $data[$pageID][$type][$typeID] = array();
                 foreach ($optionValues as $optionID => $optionValue) {
                     $data[$pageID][$type][$typeID][$options[$optionID]->optionName] = $optionValue;
                 }
             }
         }
     }
     return $data;
 }
Exemplo n.º 6
0
 /**
  * Returns whether this page has other pages assigned as children
  * 
  * @return	boolean
  */
 public function hasChildren()
 {
     $list = new PageList();
     $list->getConditionBuilder()->add('page.parentID = (?)', array($this->pageID));
     if ($list->countObjects() != 0) {
         return true;
     }
     return false;
 }