/** * Constructor, no direct instantiation */ protected function __construct() { parent::__construct(); $this->library = vB_Library::instance('Content_Infraction'); $this->infractionChannel = $this->nodeApi->fetchInfractionChannel(); $this->assertor = vB::getDbAssertor(); }
/** * Adds a new node. * * @param mixed Array of field => value pairs which define the record. * @param array Array of options for the content being created. * Understands skipTransaction, skipFloodCheck, floodchecktime, skipDupCheck, skipNotification, nl2br, autoparselinks. * - nl2br: if TRUE, all \n will be converted to <br /> so that it's not removed by the html parser (e.g. comments). * - wysiwyg: if true convert html to bbcode. Defaults to true if not given. * * @return integer the new nodeid */ public function add($data, $options = array()) { vB_Api::instanceInternal('hv')->verifyToken($data['hvinput'], 'post'); if (vB_Api::instanceInternal('node')->fetchAlbumChannel() == $data['parentid'] and !vB::getUserContext()->hasPermission('albumpermissions', 'picturefollowforummoderation')) { $data['approved'] = 0; $data['showapproved'] = 0; } return parent::add($data, $options); }
/** * Constructor, no external instantiation. */ protected function __construct() { parent::__construct(); $this->library = vB_Library::instance('Content_Privatemessage'); $userInfo = vB::getCurrentSession()->fetch_userinfo(); if ($userInfo['userid'] > 0) { $this->library->checkFolders($userInfo['userid']); $this->pmChannel = $this->nodeApi->fetchPMChannel(); $this->notificationTypes = $this->library->fetchNotificationTypes(); } }
/** * Constructor, no external instantiation. */ protected function __construct() { parent::__construct(); $this->library = vB_Library::instance('Content_Redirect'); }
/** * Constructor, no external instantiation. */ protected function __construct() { parent::__construct(); $this->library = vB_Library::instance('Content_Report'); $this->ReportChannel = $this->nodeApi->fetchReportChannel(); }
/** * validates that the current can create a node with these values * * @param array Array of field => value pairs which define the record. * @param string Parameters to be checked for permission * * @return bool */ public function validate(&$data, $action = self::ACTION_ADD, $nodeid = false, $nodes = false) { //One extra check. If the node would otherwise be viewable but viewperms is zero for an album, the the current user //is the owner or follows the owner, they can see it. if (parent::validate($data, $action, $nodeid, $nodes)) { return true; } if ($action == self::ACTION_VIEW) { if (empty($data) and !empty($nodeid)) { $data = vB_Library::instance('node')->getNodeBare($nodeid); } if (isset($data['nodeid']) and isset($data['userid']) and isset($data['parentid']) and isset($data['viewperms'])) { $nodes = array($data); } else { if (!is_array($nodeid)) { $nodeid = array($nodeid); } if (!$nodes) { $nodes = vB_Api::instanceInternal('node')->getNodes($nodeid); } } $albumChannel = vB_Library::instance('node')->fetchAlbumChannel(); $following = vB_Api::instanceInternal('follow')->getFollowingParameters(); if (empty($following['user'])) { $following = array(vB::getCurrentSession()->get('userid')); } else { $following = $following['user']; $following[] = vB::getCurrentSession()->get('userid'); } foreach ($nodes as $node) { if ($node['parentid'] != $albumChannel or $node['viewperms'] != 0 or !in_array($node['userid'], $following)) { return false; } } //If we got here all is O.K. return true; } return false; }
/** * Cleans the input in the $data array, directly updating $data. * * @param mixed Array of fieldname => data pairs, passed by reference. * @param int|false Nodeid of the node being edited, false if creating new */ public function cleanInput(&$data, $nodeid = false) { parent::cleanInput($data, $nodeid); $cleaner = vB::getCleaner(); if (isset($data['filedataid'])) { $data['filedataid'] = intval($data['filedataid']); } if (isset($data['url'])) { $data['url'] = $cleaner->clean($data['url'], vB_Cleaner::TYPE_STR); } foreach (array('url_title', 'meta') as $fieldname) { if (isset($data[$fieldname])) { $data[$fieldname] = $cleaner->clean($data[$fieldname], vB_Cleaner::TYPE_NOHTML); } } }