Ejemplo n.º 1
0
 private function onMove(GWF_ForumThread $t, GWF_ForumBoard $b)
 {
     //		if (false === ($b->isThreadAllowed())) {
     //			$_POST['move'] = $t->getBoardID();
     //			return $this->module->error('err_no_thread_allowed');
     //		}
     $pc = $t->getPostCount();
     if (false === $t->getBoard()->adjustCounters(-1, -$pc)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $b->adjustCounters(1, $pc)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $t->saveVars(array('thread_bid' => $b->getID(), 'thread_gid' => $b->getGroupID()))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $t->saveVar('thread_bid', $b->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_thread_moved', array($t->display('thread_title'), $b->display('board_title')));
 }
Ejemplo n.º 2
0
 /**
  * Move this board to another.
  * @param GWF_ForumBoard $newParent
  * @return true|false
  */
 public function move(GWF_ForumBoard $newParent)
 {
     $newpid = $newParent->getID();
     if (false === $this->getParent()->adjustCounters(-$this->getThreadCount(), -$this->getPostCount())) {
         return false;
     }
     if (false === $this->saveVar('board_pid', $newParent->getID())) {
         return false;
     }
     if (false === $newParent->adjustCounters($this->getThreadCount(), $this->getPostCount())) {
         return false;
     }
     return true;
 }