Ejemplo n.º 1
0
 /**
  * Initializes the sidebar.
  */
 public function init()
 {
     // call init event
     EventHandler::fireAction($this, 'init');
     $userID = WCF::getUser()->userID;
     $key = __CLASS__ . '.' . ($this->contest ? $this->contest->contestID : 0) . '.' . $userID;
     $cacheResource = array('file' => WCF_DIR . 'cache/cache.' . $key . '.php', 'cache' => $key, 'minLifetime' => 0, 'maxLifetime' => 15 * 60);
     // only write cache for guest user
     if ($userID > 0 || ($val = WCF::getCache()->getCacheSource()->get($cacheResource)) === null) {
         $val = $this->_init();
         if ($userID == 0) {
             WCF::getCache()->getCacheSource()->set($cacheResource, $val);
         }
     }
     // activate
     foreach ($val as $key => $list) {
         $this->{$key} = $list;
     }
     // deactivate
     foreach ($this->disabledModules as $diss) {
         $this->{$diss} = null;
     }
     // advertising
     $this->advertiseParticipant = $this->contest && !in_array('advertiseParticipant', $this->disabledModules) && $this->contest->isParticipantable(false);
     $this->advertiseSponsor = $this->contest && !in_array('advertiseSponsor', $this->disabledModules) && $this->contest->isSponsorable(false);
     $this->advertiseJury = false;
 }