Exemple #1
0
 /**
  * opens a node for posting
  *
  * @param	mixed	integer or array of integers
  * @return	mixed	Either array 'errors' => error string or array of id's.
  */
 public function openNode($nodeid)
 {
     $userContext = vB::getUserContext();
     if ($userContext->isModerator()) {
         $this->inlinemodAuthCheck();
     }
     //we need to handle a single nodeid or an array of nodeids
     if (!is_array($nodeid)) {
         $nodeids = array($nodeid);
     } else {
         $nodeids = $nodeid;
     }
     //First check permissions of course.
     foreach ($nodeids as $nodeid) {
         //this can be approved through moderator permissions, or because the node is the current user's and they have forumpermission canopenclose
         if (!vB::getUserContext()->getChannelPermission('moderatorpermissions', 'canopenclose', $nodeid)) {
             $node = $this->library->getNode($nodeid);
             if ($node['userid'] != vB::getCurrentSession()->get('userid') or !vB::getUserContext()->getChannelPermission('forumpermissions', 'canopenclose', $nodeid)) {
                 throw new vB_Exception_Api('no_permission');
             }
         }
     }
     return $this->library->openNode($nodeids);
 }