示例#1
0
 /**
  * Updates the given channel
  *
  * @param  int  $nodeid
  * @param  int  $data
  *
  * @return bool
  */
 public function update($nodeid, $data)
 {
     if (!empty($data['filedataid'])) {
         $this->validateIcon($nodeid, array('filedataid' => $data['filedataid']));
         $oldChannelData = $this->fetchChannelById($nodeid);
     }
     $ret = parent::update($nodeid, $data);
     if (!empty($data['filedataid'])) {
         $assertor = vB::getDbAssertor();
         $assertor->assertQuery('incrementFiledataRefcountAndMakePublic', array('filedataid' => $data['filedataid']));
         if (!empty($oldChannelData)) {
             $assertor->assertQuery('decrementFiledataRefcount', array('filedataid' => $oldChannelData['filedataid']));
         }
     }
     return $ret;
 }
示例#2
0
 /**
  * Updates a record
  *
  * @param  mixed array of nodeid's
  * @param  mixed array of permissions that should be checked.
  *
  * @return bool
  */
 public function update($nodeid, $data)
 {
     if (!vB::getUserContext()->getChannelPermission('forumpermissions2', 'canusehtml', $data['parentid'])) {
         // Regardless of this node's previous htmlstate, if the user doesn't have permission to use html, turn it off.
         $data['htmlstate'] = 'off';
     }
     /*
      *	check attachment permissions & limits
      *	When a text node is added, $data['attachments'] is set by the controller from the filedataids, see
      *	vB5_Frontend_Controller_CreateContent->addAttachments()
      *	The actual attachment additions happen in vB5_Frontend_Controller_CreateContent->handleAttachmentUploads()
      *
      *	This check is called here, content_text, and not the parent, content, because attachments are added via a call to
      *	vB_Library_Content_Attach->add() from vB_Library_Content_Text->add(). So any other content type that should
      *	be able to add attachments must be a child of text.
      *	TODO is this true for updates?
      */
     $this->checkAttachmentPermissions($data, $nodeid);
     // checks 'htmlstate' for comments and updates $data if needed
     $this->checkHtmlstateForComments($data, $nodeid);
     // Parent update() calls cleanInput().
     $result = parent::update($nodeid, $data);
     return $result;
 }