示例#1
0
 /**
  * calculate the final config of $this->cfg through $this->cfg default value and MbqMain::$customConfig and MbqMain::$oMbqAppEnv and the plugin support degree
  */
 public function calCfg()
 {
     $url = WCF::getPath();
     MbqMain::$oMbqAppEnv->siteRootUrl = substr($url, 0, strlen($url) - 4);
     //init current user
     //$oUser = DefaultUserAuthentication::getInstance()->loginAutomatically(true);
     //$oUser =  WCF::getSession()->getUser();
     $oUser = WCF::getUser();
     if ($oUser && $oUser->userID) {
         MbqMain::$oMbqAppEnv->oCurrentUser = $oUser;
         $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser');
         $oMbqRdEtUser->initOCurMbqEtUser($oUser->userID);
     }
     if (MbqMain::hasLogin()) {
         //!!!
         header('Mobiquo_is_login: true');
     } else {
         header('Mobiquo_is_login: false');
     }
     $oMbqRdEtForum = MbqMain::$oClk->newObj('MbqRdEtForum');
     MbqMain::$oMbqAppEnv->exttForumTree = $oMbqRdEtForum->getForumTree();
     //!!!
     MbqMain::$oMbqAppEnv->accessibleBoardIds = Board::getAccessibleBoardIDs(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
     parent::calCfg();
     /* calculate the final config */
     $this->cfg['base']['sys_version']->setOriValue(PACKAGE_VERSION);
     if (OFFLINE) {
         $this->cfg['base']['is_open']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.is_open.range.no'));
     } else {
         $this->cfg['base']['is_open']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.is_open.range.yes'));
     }
     //if (!MODULE_CONVERSATION || !WCF::getSession()->getPermission('user.conversation.canUseConversation')) {
     if (!MODULE_CONVERSATION) {
         $this->cfg['pc']['module_enable']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.pc.module_enable.range.disable'));
         $this->cfg['pc']['conversation']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.pc.conversation.range.notSupport'));
     }
     if (!MbqMain::$oMbqAppEnv->accessibleBoardIds) {
         $this->cfg['user']['guest_okay']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.user.guest_okay.range.notSupport'));
         $this->cfg['forum']['guest_search']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.forum.guest_search.range.notSupport'));
     }
     if ($this->getCfg('base.push')->oriValue == MbqBaseFdt::getFdt('MbqFdtConfig.base.push.range.support') && !OFFLINE && (@ini_get('allow_url_fopen') || function_exists('curl_init'))) {
         $this->cfg['base']['push']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.push.range.support'));
     } else {
         $this->cfg['base']['push']->setOriValue(MbqBaseFdt::getFdt('MbqFdtConfig.base.push.range.notSupport'));
     }
 }
 /**
  * @see	wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     //parent::readParameters();   //!!!
     //if (isset($_REQUEST['mode'])) $this->mode = $_REQUEST['mode'];
     $this->mode = 'unreadPosts';
     /*
     if (!in_array($this->mode, static::$validModes)) {
     	throw new IllegalLinkException();
     }
     */
     // get accessible board ids
     $this->boardIDs = Board::getAccessibleBoardIDs(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
     foreach ($this->boardIDs as $key => $boardID) {
         $board = BoardCache::getInstance()->getBoard($boardID);
         if ($board->isIgnored() || !$board->searchable) {
             unset($this->boardIDs[$key]);
         }
     }
     if (!count($this->boardIDs)) {
         //throw new PermissionDeniedException();
         MbqError::alert('', "Can not found allowed forums.", '', MBQ_ERR_APP);
     }
 }