/**
  * prepare
  * 
  * @param   void
  * 
  * @return  bool
  **/
 public function prepare()
 {
     parent::prepare();
     if ($this->mObject->isNew()) {
         if ($this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')) {
             $uid = $this->mRoot->mContext->mXoopsUser->get('uid');
             $this->mObject->set('uid', $uid);
         }
     }
     $mReq = $this->mRoot->mContext->mRequest;
     $forum_id = (int) $mReq->getRequest('forum_id');
     $this->forum_id = $forum_id > 0 ? $forum_id : 1;
     $this->_setForumObject();
     /* get forum permissions for current user
     			You can get them like
     				$can_post = $this->mHandler->get_forum_permissions('can_post');
     				$can_edit = $this->mHandler->get_forum_permissions('can_edit');
     					  : and so on
     			or
     	            $grpPerms =  $this->mHandler->get_forum_all_permissions();
     		  */
     $this->mHandler = $this->_getHandler();
     // get Froumaccess object with $forum_id
     $criteria = new Criteria('forum_id', $this->forum_id);
     $criteria->setSort('groupid', 'ASC');
     $this->mForumAcc = $this->mHandler->getObjects($criteria);
     $this->mObject->set('forum_id', $this->forum_id);
     $this->_setForumAccArr($fgAccObj);
     // byref
     $this->_setGroupForm($fgAccObj);
     $this->_setUserForm();
     return true;
 }
예제 #2
0
 /**
  * prepare
  * 
  * @param   void
  * 
  * @return  bool
  **/
 public function prepare()
 {
     parent::prepare();
     if ($this->mObject->isNew()) {
     }
     return true;
 }
예제 #3
0
 /**
  * prepare
  * 
  * @param   void
  * 
  * @return  bool
  **/
 public function prepare()
 {
     parent::prepare();
     // in case of NEW post
     if ($this->mObject->isNew()) {
         if ($this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')) {
             $this->mObject->set('uid', $this->mRoot->mContext->mXoopsUser->get('uid'));
         }
         $this->mObject->set('post_time', time());
         $this->mObject->set('modified_time', time());
         $this->mObject->set('uid_hidden', 0);
         $this->mObject->set('poster_ip', addslashes(@$_SERVER['REMOTE_ADDR']));
         $this->mObject->set('modifier_ip', addslashes(@$_SERVER['REMOTE_ADDR']));
         // get pid --> is it response post?
         $pid = (int) $this->mRoot->mContext->mRequest->getRequest('pid');
         if (isset($pid) && $pid > 0) {
             $this->mObject->set('pid', $pid);
             $topic_id = (int) $this->mRoot->mContext->mRequest->getRequest('topic_id');
             $mParentHandler =& $this->_getHandler();
             $criteria = new CriteriaCompo();
             $criteria->add(new Criteria('post_id', $pid));
             $mGotObjects =& $mParentHandler->getObjects($criteria, true);
             $this->mParentObj =& $mGotObjects[0];
             // get parent object --> is it really response post?
             if (is_object($this->mParentObj)) {
                 $this->mObject->set('topic_id', $this->mParentObj->get('topic_id'));
                 $this->mObject->set('subject', "Re: " . ltrim($this->mParentObj->get('subject'), 'Re: '));
                 $this->mObject->set('depth_in_tree', (int) $this->mParentObj->get('depth_in_tree') + 1);
             }
         }
         //adump($pid,$topic_id);
         //adump($this->mParentObj);
     }
     return true;
 }
 /**
  * prepare
  * 
  * @param   void
  * 
  * @return  bool
  **/
 public function prepare()
 {
     parent::prepare();
     if ($this->mObject->isNew()) {
         if ($this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')) {
             $this->mObject->set('uid', $this->mRoot->mContext->mXoopsUser->get('uid'));
         }
     }
     return true;
 }
예제 #5
0
 /**
  * prepare
  * 
  * @param   void
  * 
  * @return  bool
  **/
 public function prepare()
 {
     parent::prepare();
     if ($this->mObject->isNew()) {
         $this->mObject->set('category_id', $this->_getCatId());
         $this->mObject->set('forum_topics_count', 0);
         $this->mObject->set('forum_posts_count', 0);
         $this->mObject->set('forum_last_post_id', 0);
         $this->mObject->set('forum_last_post_time', 0);
         $this->mObject->set('status', 0);
         //$this->mObject->set('posttime', 0);
         //die;
         //adump($this->mObject);
     }
     $this->_setupAccessController('forums');
     //adump($temp=($this->mObject->get('topics_count')) ? $this->mObject->get('topics_count') : intval($this->mRoot->mContext->mRequest->getRequest('topics_count')));
     //$this->mObject->set('topics_count',$temp);
     return true;
 }
 /**
  * prepare
  * 
  * @param   void
  * 
  * @return  bool
  **/
 public function prepare()
 {
     return parent::prepare() && is_object($this->mObject);
 }
 /**
  * prepare
  *
  * @param   void
  *
  * @return  bool
  **/
 public function prepare()
 {
     parent::prepare();
     //$this->_setupObject();
     //$this->_setupActionForm();
     //adump('prepare');
     $mydirname = $this->mDirname = $this->mAsset->mDirname;
     //adump('prepare',$mydirname);
     $Func = $this->mImportFunc = new Xcforum_Import_Functions($mydirname);
     $this->mImportableModules = $Func->import_getimportablemodules();
     $module_handler =& xoops_gethandler('module');
     $modules = $module_handler->getObjects(new Criteria('hascomments', 1));
     $comment_handler =& xoops_gethandler('comment');
     $comimportable_modules = array();
     foreach ($modules as $module) {
         $mid = $module->getVar('mid');
         $comment_sum = $comment_handler->getCount(new Criteria('com_modid', $mid));
         $this->mComImportableModules[$mid] = $module->getVar('name') . " ({$comment_sum})";
     }
     //adump($this->mImportableModules);
     return true;
 }