<?php
 class vB_DataManager_RSSFeed extends vB_DataManager { protected $validfields = [ 'rssfeedid' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_INCR, vB_DataManager_Constants::VF_METHOD, 'verify_nonzero'], 'title' => [vB_Cleaner::TYPE_STR, vB_DataManager_Constants::REQ_YES], 'url' => [vB_Cleaner::TYPE_STR, vB_DataManager_Constants::REQ_YES], 'ttl' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_YES, vB_DataManager_Constants::VF_METHOD], 'maxresults' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_NO], 'userid' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_YES, vB_DataManager_Constants::VF_METHOD], 'nodeid' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_YES, vB_DataManager_Constants::VF_METHOD], 'iconid' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_NO], 'titletemplate' => [vB_Cleaner::TYPE_STR, vB_DataManager_Constants::REQ_YES], 'bodytemplate' => [vB_Cleaner::TYPE_STR, vB_DataManager_Constants::REQ_YES], 'searchwords' => [vB_Cleaner::TYPE_STR, vB_DataManager_Constants::REQ_NO], 'itemtype' => [vB_Cleaner::TYPE_STR, vB_DataManager_Constants::REQ_YES, vB_DataManager_Constants::VF_METHOD], 'topicactiondelay' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_NO], 'lastrun' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_AUTO], 'options' => [vB_Cleaner::TYPE_NOCLEAN, vB_DataManager_Constants::REQ_NO], 'prefixid' => [vB_Cleaner::TYPE_NOHTML, vB_DataManager_Constants::REQ_NO] ]; protected $bitfields = ['options' => 'bf_misc_feedoptions']; protected $table = 'vBForum:rssfeed'; protected $keyField = 'rssfeedid'; protected $rssfeed; protected function verify_nodeid(&$forumid) { try { $node = vB_Api::instanceInternal('node')->getNodeContent($forumid); $node = $node[$forumid]; } catch (vB_Exception_Api $ex) { return false; } if ($forumid != -1 AND empty($node)) { $this->error('invalid_channel_specified'); return false; } if ($node['category']) { $this->error('forum_is_a_category_allow_posting'); return false; } return true; } public function set_user_by_name($username) { if ($username != '' AND $user = $this->assertor->getRow('user', ['username' => $username])) { $this->do_set('userid', $user['userid']); return true; } else { $this->error('invalid_user_specified'); return false; } } protected function verify_ttl(&$ttl) { switch ($ttl) { case 43200: case 36000: case 28800: case 21600: case 14400: case 7200: case 3600: case 1800: case 1200: case 600: return true; default: $ttl = 1800; return true; } } protected function verify_itemtype(&$itemtype) { switch ($itemtype) { case 'topic': case 'announcement': return true; default: $itemtype = 'topic'; return true; } } function pre_save($doquery = true) { if ($this->presave_called !== null) { return $this->presave_called; } $return_value = true; $this->presave_called = $return_value; return $return_value; } function post_save_each($doquery = true) { return true; } function post_delete($doquery = true) { $this->db_delete(TABLE_PREFIX, 'vBForum:rsslog', ['rssfeedid' => $this->existing['rssfeedid']]); } } 