Exemplo n.º 1
0
 /**
  * prepare
  *
  * @param	void
  *
  * @return	bool
  **/
 public function prepare()
 {
     $this->mfAccHandler =& $this->mAsset->getObject('handler', 'Forumaccess', false);
     $this->mForumAcc = $this->mfAccHandler->get_forum_permissions('can_read');
     $mCriteria = $this->mFilter->getCriteria();
     $mCriteria->add(new criteria('forum_id', $this->mForumAcc['can_read'], 'IN'));
     parent::prepare();
     $this->_setupAccessController('forums');
     $this->forum_id = (int) $this->mRoot->mContext->mRequest->getRequest('forum_id');
     return true;
 }
 /**
  * prepare
  * 
  * @param	void
  * 
  * @return	bool
  **/
 public function prepare()
 {
     parent::prepare();
     return true;
 }
Exemplo n.º 3
0
 /**
  * executeViewSuccess
  *
  * @param	XCube_RenderTarget	&$render
  *
  * @return	void
  **/
 public function executeViewSuccess(&$render)
 {
     // set each permission flags and usr's info
     if (is_object($this->mObject)) {
         if (isset($this->forum_id) && $this->forum_id > 0) {
             if (isset($this->mForumAcc) && count($this->mForumAcc) > 0) {
                 if ($this->can_read === true) {
                     // permissions
                     $params = array();
                     $params['uid'] = $this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser') ? $this->mRoot->mContext->mXoopsUser->get('uid') : 0;
                     $params['can_read'] = true;
                     $params['can_post'] = in_array($this->forum_id, $this->mForumAcc['post']);
                     $params['can_edit'] = in_array($this->forum_id, $this->mForumAcc['edit']);
                     $params['can_delete'] = in_array($this->forum_id, $this->mForumAcc['delete']);
                     $params['can_reply'] = in_array($this->forum_id, $this->mForumAcc['post']);
                     $params['isadminormod'] = $this->mod_isadmin ? true : in_array($this->forum_id, $this->mForumAcc['moderate']);
                     $params['mod_config'] =& $this->mod_config;
                     foreach ($this->mPostsObj as &$obj) {
                         /*
                          * 		// permissions
                          */
                         $rtn = Xcforum_Utils::processThispost($obj, $this->mObject, $params);
                         $obj->initVar('poster_dispname', XOBJ_DTYPE_STRING, $rtn['poster_dispname'], false);
                         $obj->initVar('poster_uname', XOBJ_DTYPE_STRING, $rtn['poster_uname'], false);
                         $obj->initVar('poster_name', XOBJ_DTYPE_STRING, $rtn['poster_name'], false);
                         $obj->initVar('poster_gname', XOBJ_DTYPE_STRING, $rtn['poster_gname'], false);
                         $obj->initVar('poster_avatar', XOBJ_DTYPE_STRING, $rtn['poster_avatar'], false);
                         $obj->initVar('poster_from4disp', XOBJ_DTYPE_STRING, $rtn['poster_from4disp'], false);
                         $obj->initVar('signature', XOBJ_DTYPE_STRING, $rtn['poster_signature'], false);
                         $obj->initVar('poster_uid', XOBJ_DTYPE_INT, $rtn['poster_uid'], false);
                         $obj->initVar('poster_regdate', XOBJ_DTYPE_INT, $rtn['poster_regdate'], false);
                         $obj->initVar('poster_rank', XOBJ_DTYPE_INT, $rtn['poster_rank'], false);
                         $obj->initVar('poster_is_online', XOBJ_DTYPE_INT, $rtn['poster_is_online'], false);
                         $obj->initVar('poster_posts_count', XOBJ_DTYPE_INT, $rtn['poster_posts_count'], false);
                         $obj->initVar('can_read', XOBJ_DTYPE_INT, true, false);
                         $obj->initVar('can_post', XOBJ_DTYPE_INT, $rtn['can_post'], false);
                         $obj->initVar('can_edit', XOBJ_DTYPE_INT, $rtn['can_edit'], false);
                         $obj->initVar('can_delete', XOBJ_DTYPE_INT, $rtn['can_delete'], false);
                         $obj->initVar('can_reply', XOBJ_DTYPE_INT, $rtn['can_reply'], false);
                     }
                     $this->mForumObj->initVar('isadminormod', XOBJ_DTYPE_INT, $params['isadminormod'], false);
                     unset($params);
                 }
             }
         }
     }
     //$memberHandler =& Xcforum_Utils::getXoopsHandler('member');
     //$cri = new criteriacompo();
     //$cri->add( new criteria('uid', $uids, 'IN'));
     //$mUsers = $memberHandler->getUsers();
     //adump($mUsers);
     //adump($users);
     /*
     $uses[$uid] = array(
     	'uid' => $uid,
     	'uname' => $obj->get('uname'),
     	'name' => $obj->get('name'),
     );
     */
     $render->setTemplateName($this->mAsset->mDirname . '_topic_view.html');
     $render->setAttribute('forumObj', $this->mForumObj);
     $render->setAttribute('topicObj', $this->mObject);
     $render->setAttribute('postObj', $this->mPostsObj);
     $render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     $render->setAttribute('pageNavi', $this->mFilter->mNavi);
     $render->setAttribute('topics', $this->mTopics_ExtObj);
     $render->setAttribute('external_link_id', $this->ext_link_id);
     $render->setAttribute('tree_tp_count', @count($this->mTopics_ExtObj));
     parent::executeViewSuccess($render);
 }
Exemplo n.º 4
0
 /**
  * executeViewSuccess
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewSuccess(&$render)
 {
     if (isset($this->forum_id) && $this->forum_id > 0) {
         if (isset($this->mForumAcc) && count($this->mForumAcc) > 0) {
             if ($this->can_read === true) {
                 // permissions
                 $params = array();
                 $params['uid'] = $this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser') ? $this->mRoot->mContext->mXoopsUser->get('uid') : 0;
                 $params['can_read'] = true;
                 $params['can_post'] = in_array($this->forum_id, $this->mForumAcc['post']);
                 $params['can_edit'] = in_array($this->forum_id, $this->mForumAcc['edit']);
                 $params['can_delete'] = in_array($this->forum_id, $this->mForumAcc['delete']);
                 $params['can_reply'] = in_array($this->forum_id, $this->mForumAcc['post']);
                 $params['isadminormod'] = $this->mod_isadmin ? true : in_array($this->forum_id, $this->mForumAcc['moderate']);
                 $params['mod_config'] =& $this->mod_config;
                 $rtn = Xcforum_Utils::processThispost($this->mObject, $this->mTopicObj, $params);
                 //adump($rtn);
                 $this->mObject->initVar('poster_dispname', XOBJ_DTYPE_STRING, $rtn['poster_dispname'], false);
                 $this->mObject->initVar('poster_uname', XOBJ_DTYPE_STRING, $rtn['poster_uname'], false);
                 $this->mObject->initVar('poster_name', XOBJ_DTYPE_STRING, $rtn['poster_name'], false);
                 $this->mObject->initVar('poster_gname', XOBJ_DTYPE_STRING, $rtn['poster_gname'], false);
                 $this->mObject->initVar('can_read', XOBJ_DTYPE_INT, true, false);
                 $this->mObject->initVar('can_post', XOBJ_DTYPE_INT, $rtn['can_post'], false);
                 $this->mObject->initVar('can_edit', XOBJ_DTYPE_INT, $rtn['can_edit'], false);
                 $this->mObject->initVar('can_delete', XOBJ_DTYPE_INT, $rtn['can_delete'], false);
                 $this->mObject->initVar('can_reply', XOBJ_DTYPE_INT, $rtn['can_reply'], false);
                 $this->mForumObj->initVar('isadminormod', XOBJ_DTYPE_INT, $rtn['isadminormod'], false);
                 // for posts tree
                 foreach ($this->mPostsObj as &$obj) {
                     $rtn = Xcforum_Utils::processThispost($obj, $this->mTopicObj, $params);
                     $obj->initVar('poster_dispname', XOBJ_DTYPE_STRING, $rtn['poster_dispname'], false);
                     $obj->initVar('poster_uname', XOBJ_DTYPE_STRING, $rtn['poster_uname'], false);
                     $obj->initVar('poster_name', XOBJ_DTYPE_STRING, $rtn['poster_name'], false);
                     $obj->initVar('poster_gname', XOBJ_DTYPE_STRING, $rtn['poster_gname'], false);
                 }
             }
         }
     }
     $render->setTemplateName($this->mAsset->mDirname . '_post_view.html');
     $render->setAttribute('forumObj', $this->mForumObj);
     $render->setAttribute('topicObj', $this->mTopicObj);
     $render->setAttribute('postObj', $this->mObject);
     $render->setAttribute('postsObj', $this->mPostsObj);
     $render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     $render->setAttribute('topics', $this->mTopics_ExtObj);
     $render->setAttribute('external_link_id', $this->ext_link_id);
     $render->setAttribute('tree_tp_count', @count($this->mTopics_ExtObj));
     $render->setAttribute('can_edit', $this->can_edit);
     $render->setAttribute('can_delete', $this->can_delete);
     $render->setAttribute('can_reply', $this->can_reply);
     parent::executeViewSuccess($render);
 }