protected function buildOutputFromItems($items, $options) { parent::buildOutputFromItems($items, $options); $xml = new vB_Xml_Builder(); $xml->add_group('rss', array('version' => '0.91')); $xml->add_group('channel'); $xml->add_tag('title', $this->rssinfo['title']); $xml->add_tag('link', $this->rssinfo['link'] . '/', array(), false, true); $xml->add_tag('description', $this->rssinfo['description']); $xml->add_tag('language', $this->defaultLang['languagecode']); $xml->add_group('image'); $xml->add_tag('url', $this->rssinfo['icon']); $xml->add_tag('title', $this->rssinfo['title']); $xml->add_tag('link', $this->rssinfo['link'] . '/', array(), false, true); $xml->close_group('image'); $dateformat = vB::getDatastore()->getOption('dateformat'); $timeformat = vB::getDatastore()->getOption('timeformat'); // gather channel info $channelsInfo = $this->getItemsChannelInfo($items); $items = $this->formatItems($items, $options); foreach ($items as $id => $item) { $item = $item['content']; $xml->add_group('item'); $xml->add_tag('title', $item['external_prefix_plain'] . vB_String::htmlSpecialCharsUni($item['external_title'])); $xml->add_tag('link', vB_Api::instanceInternal('route')->getAbsoluteNodeUrl($item['external_nodeid']), array(), false, true); $xml->add_tag('description', vB_Phrase::fetchSinglePhrase('rss_91_forum_w_posted_by_x_post_time_y_at_z', array($channelsInfo[$item['channelid']]['htmltitle'], $item['authorname'], $this->callvBDate($dateformat, $item['publishdate']), $this->callvBDate($timeformat, $item['publishdate'])))); $xml->close_group('item'); } $xml->close_group('channel'); $xml->close_group('rss'); $output .= '<!DOCTYPE rss PUBLIC "-//RSS Advisory Board//DTD RSS 0.91//EN" "http://www.rssboard.org/rss-0.91.dtd">' . "\r\n"; $output .= $xml->output(); return $xml->fetch_xml_tag() . $output; }
public function get_admin_detail_chat() { global $vbulletin; // Get the settings options and the user's info $options = vB::getDatastore()->getValue('options'); $userinfo = vB::getCurrentSession()->fetch_userinfo(); // Api Key and Secret $api = $options['chat_cat_messenger_api']; $secret = $options['chat_cat_messenger_secret']; $login_url = $options['chat_cat_messenger_login_url']; $register_url = $options['chat_cat_messenger_register_url']; $primary_domain = $options['chat_cat_messenger_primary_url']; // echo $primary_domain; // die(); // User info $uname = $userinfo['username']; $uid = $userinfo['userid']; $desc = $userinfo['field1']; $src = ''; $home = $options['bburl'] . '/member/' . $uid; //echo $home;die; $location = $userinfo['field2']; $bod = $userinfo['birthday']; if (!empty($bod)) { $year = explode("-", $bod); $bod = $year['2']; } $profilepic = $vbulletin->db->query_first("\n\t\t\tSELECT userid, dateline, height, width\n\t\t\tFROM " . TABLE_PREFIX . "customavatar\n\t\t\tWHERE userid = " . $uid); if ($profilepic['dateline']) { $img = $options['bburl'] . '/image.php?userid=' . $uid . '&thumb=1&dateline=' . $profilepic[dateline] . '&type=avtar'; } else { $img = null; } $src = urlencode($img); $home = urlencode($home); //$src = urldecode($img); $chatdata = array(); $chatdata['sinonurl'] = ''; if (isset($api) && $api != '') { $chatdata['sinonurl'] = '/ajaxchat.php?uid=' . $uid . '&api=' . $api . '&secret=' . $secret . '&uname=' . $uname . '&desc=' . $desc . '&src=' . $src . '&home=' . $home . '&birthday=' . $bod . '&location=' . $location; } $chatdata['primaryurl'] = $primary_domain; if ($login_url != '') { $chatdata['loginurl'] = $login_url; if (!preg_match("@^[hf]tt?ps?://@", $chatdata['loginurl'])) { $chatdata['loginurl'] = "http://" . $chatdata['loginurl']; } } else { $chatdata['loginurl'] = ''; } if ($register_url != '') { $chatdata['registerurl'] = $register_url; if (!preg_match("@^[hf]tt?ps?://@", $chatdata['registerurl'])) { $chatdata['registerurl'] = "http://" . $chatdata['registerurl']; } } else { $chatdata['registerurl'] = $options['frontendurl'] . '/register'; } return $chatdata; }
protected function __construct() { parent::__construct(); $this->storage = vB::getDatastore()->getOption('attachfile'); $this->filePath = vB::getDatastore()->getOption('attachpath'); $this->assertor = vB::getDbAssertor(); }
public static function time($timestamp) { if (empty($timestamp)) { $timestamp = 0; } return vbdate(vB::getDatastore()->getOption('timeformat'), $timestamp); }
/** * Callback function for convert_url_to_bbcode * * Should only be called from convert_url_to_bbcode * * @param string Message text * @param string Text to prepend * * @return string */ function convert_url_to_bbcode_callback($messagetext, $prepend) { $datastore = vB::getDatastore(); $bbcodecache = $datastore->getValue('bbcodecache'); $bbcodeoptions = $datastore->getValue('bf_misc_bbcodeoptions'); // the auto parser - adds [url] tags around neccessary things $messagetext = str_replace('\\"', '"', $messagetext); $prepend = str_replace('\\"', '"', $prepend); static $urlSearchArray, $urlReplaceArray, $emailSearchArray, $emailReplaceArray; if (empty($urlSearchArray)) { $taglist = '\\[b|\\[i|\\[u|\\[left|\\[center|\\[right|\\[indent|\\[quote|\\[highlight|\\[\\*' . '|\\[/b|\\[/i|\\[/u|\\[/left|\\[/center|\\[/right|\\[/indent|\\[/quote|\\[/highlight'; foreach ($bbcodecache as $customtag) { if (!(intval($customtag['options']) & $bbcodeoptions['disable_urlconversion'])) { $customtag_quoted = preg_quote($customtag['bbcodetag'], '#'); $taglist .= '|\\[' . $customtag_quoted . '|\\[/' . $customtag_quoted; } } // Legacy Hook 'url_to_bbcode_callback' Removed // $urlSearchArray = array('#(^|(?<=[^_a-z0-9-=\\]"\'/@]|(?<=' . $taglist . ')\\]))((https?|ftp|gopher|news|telnet)://|www\\.)((\\[(?!/)|[^\\s[^$`"{}<>])+)(?!\\[/url|\\[/img)(?=[,.!\')]*(\\)\\s|\\)$|[\\s[]|$))#siU'); $urlReplaceArray = array("[url]\\2\\4[/url]"); $emailSearchArray = array('/([ \\n\\r\\t])([_a-z0-9-+]+(\\.[_a-z0-9-+]+)*@[^\\s]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,6}))/si', '/^([_a-z0-9-+]+(\\.[_a-z0-9-+]+)*@[^\\s]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,6}))/si'); $emailReplaceArray = array("\\1[email]\\2[/email]", "[email]\\0[/email]"); } $text = preg_replace($urlSearchArray, $urlReplaceArray, $messagetext); if (strpos($text, "@")) { $text = preg_replace($emailSearchArray, $emailReplaceArray, $text); } return $prepend . $text; }
/** * Adds a new node. * * @param mixed $data 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. * * @throws vB_Exception_Api * * @return integer the new nodeid */ public function add($data, $options = array()) { $vboptions = vB::getDatastore()->getValue('options'); if (!empty($data['pagetext'])) { $strlen = vB_String::vbStrlen($this->library->parseAndStrip($data['pagetext']), true); if ($strlen < $vboptions['postminchars']) { throw new vB_Exception_Api('please_enter_message_x_chars', $vboptions['postminchars']); } if ($vboptions['postmaxchars'] != 0 and $strlen > $vboptions['postmaxchars']) { throw new vB_Exception_Api('maxchars_exceeded_x_y', array($vboptions['postmaxchars'], $strlen)); } } else { if (!empty($data['rawtext'])) { $strlen = vB_String::vbStrlen($this->library->parseAndStrip($data['rawtext']), true); if ($strlen < $vboptions['postminchars']) { throw new vB_Exception_Api('please_enter_message_x_chars', $vboptions['postminchars']); } if ($vboptions['postmaxchars'] != 0 and $strlen > $vboptions['postmaxchars']) { throw new vB_Exception_Api('maxchars_exceeded_x_y', array($vboptions['postmaxchars'], $strlen)); } } else { throw new vB_Exception_Api('invalid_data'); } } $this->cleanInput($data); $this->cleanOptions($options); $wysiwyg = true; if (isset($options['wysiwyg'])) { $wysiwyg = (bool) $options['wysiwyg']; } $result = $this->library->add($data, $options, $wysiwyg); return $result['nodeid']; }
public function __construct(&$routeInfo, &$matches, &$queryString = '') { if (isset($matches['params']) and !empty($matches['params'])) { $paramString = strpos($matches['params'], '/') === 0 ? substr($matches['params'], 1) : $matches['params']; $params = explode('/', $paramString); if (count($params) >= 2) { $this->pagenum = $params[1]; $this->folderid = $params[0]; } else { if (!empty($params)) { $this->pagenum = $params[1]; } } } if (!empty($matches['pagenum']) and intval($matches['pagenum'])) { $this->pagenum = $matches['pagenum']; } if (!empty($matches['folderid']) and intval($matches['folderid'])) { $this->folderid = $matches['folderid']; } $routeInfo['arguments']['subtemplate'] = $this->subtemplate; $userid = vB::getCurrentSession()->get('userid'); $pmquota = vB::getUserContext($userid)->getLimit('pmquota'); $vboptions = vB::getDatastore($userid)->getValue('options'); $canUsePmSystem = ($vboptions['enablepms'] and $pmquota); if (!$canUsePmSystem and !$this->overrideDisable) { throw new vB_Exception_NodePermission('privatemessage'); } }
public function createSession($userid = 1) { //$this->session = vB_Session_Web::getSession(1); $this->session = new vB_Session_Cli(vB::getDbAssertor(), vB::getDatastore(), vB::getConfig(), $userid); vB::setCurrentSession($this->session); $this->timeNow = time(); }
/** * This function updates specified settings * @param array $values * 'varname' => $vbulletin->GPC['varname'], * 'grouptitle' => $vbulletin->GPC['grouptitle'], * 'optioncode' => $vbulletin->GPC['optioncode'], * 'defaultvalue' => $vbulletin->GPC['defaultvalue'], * 'displayorder' => $vbulletin->GPC['displayorder'], * 'volatile' => $vbulletin->GPC['volatile'], * 'datatype' => $vbulletin->GPC['datatype'], * 'validationcode' => $vbulletin->GPC['validationcode'], * 'product' => $vbulletin->GPC['product'], * 'blacklist' => $vbulletin->GPC['blacklist'], * 'title' => $vbulletin->GPC['title'], * 'username' => $vbulletin->userinfo['username'], * 'description' => $vbulletin->GPC['description'] * @return array, $response */ public function updateSetting($values) { require_once DIR . '/includes/class_xml.php'; require_once DIR . '/includes/functions_file.php'; require_once DIR . '/includes/adminfunctions_options.php'; require_once DIR . '/includes/adminfunctions.php'; $response = array(); $langid = $values['volatile'] ? -1 : 0; if (defined('DEV_AUTOEXPORT') and DEV_AUTOEXPORT) { $old_setting = vB::getDbAssertor()->getRow('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'varname' => $values['varname'])); } vB::getDbAssertor()->assertQuery('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'grouptitle' => $values['grouptitle'], 'optioncode' => $values['optioncode'], 'defaultvalue' => $values['defaultvalue'], 'displayorder' => $values['displayorder'], 'volatile' => $values['volatile'], 'datatype' => $values['datatype'], 'validationcode' => $values['validationcode'], 'product' => $values['product'], 'blacklist' => $values['blacklist'], 'ispublic' => $values['ispublic'], 'adminperm' => isset($values['adminperm']) ? $values['adminperm'] : '', vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'varname', 'value' => $values['varname'], 'operator' => vB_dB_Query::OPERATOR_EQ)))); $phrases = vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'languageid' => array(-1, 0), 'fieldname' => 'vbsettings', 'varname' => array("setting_" . $values['varname'] . "_title", "setting_" . $values['varname'] . "_desc"))); $full_product_info = fetch_product_list(true); $product_version = $full_product_info[$values['product']]['version']; if ($phrases and $phrases->valid()) { foreach ($phrases as $phrase) { if ($phrase['varname'] == "setting_" . $values['varname'] . "_title") { vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'languageid' => $langid, 'text' => $values['title'], 'product' => $values['product'], 'username' => $values['username'], 'dateline' => TIMENOW, 'version' => $product_version, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'languageid', 'value' => $phrase['languageid'], 'operator' => vB_dB_Query::OPERATOR_EQ), array('field' => 'varname', 'value' => "setting_" . $values['varname'] . "_title", 'operator' => vB_dB_Query::OPERATOR_EQ)))); } else { if ($phrase['varname'] == "setting_" . $values['varname'] . "_desc") { vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'languageid' => $langid, 'text' => $values['description'], 'product' => $values['product'], 'username' => $values['username'], 'dateline' => TIMENOW, 'version' => $product_version, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'languageid', 'value' => $phrase['languageid'], 'operator' => vB_dB_Query::OPERATOR_EQ), array('field' => 'varname', 'value' => "setting_" . $values['varname'] . "_desc", 'operator' => vB_dB_Query::OPERATOR_EQ)))); } } } } vB::getDatastore()->build_options(); $response['update'] = true; return $response; }
public static function resolvePath($path) { $currentDir = getcwd(); chdir(DIR . '/' . vB::getDatastore()->getValue('modcpdir')); $path = realpath($path); chdir($currentDir); return $path; }
/** * Log errors to a file * * @param string The error message to be placed within the log * @param string The type of error that occured. php, database, security, etc. * * @return boolean */ function log_vbulletin_error($errstring, $type = 'database') { global $vbulletin; $options = vB::getDatastore()->getValue('options'); // do different things depending on the error log type switch ($type) { // log PHP E_USER_ERROR, E_USER_WARNING, E_WARNING to file case 'php': if (!empty($options['errorlogphp'])) { $errfile = $options['errorlogphp']; $errstring .= "\r\nDate: " . date('l dS \\o\\f F Y h:i:s A') . "\r\n"; $errstring .= "Username: {$vbulletin->userinfo['username']}\r\n"; $errstring .= 'IP Address: ' . IPADDRESS . "\r\n"; } break; // log database error to file // log database error to file case 'database': if (!empty($options['errorlogdatabase'])) { $errstring = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $errstring); $errfile = $options['errorlogdatabase']; } break; // log admin panel login failure to file // log admin panel login failure to file case 'security': if (!empty($options['errorlogsecurity'])) { $errfile = $options['errorlogsecurity']; $username = $errstring; $errstring = 'Failed admin logon in ' . $vbulletin->db->appname . ' ' . $vbulletin->options['templateversion'] . "\r\n\r\n"; $errstring .= 'Date: ' . date('l dS \\o\\f F Y h:i:s A') . "\r\n"; $errstring .= "Script: http://{$_SERVER['HTTP_HOST']}" . unhtmlspecialchars($vbulletin->scriptpath) . "\r\n"; $errstring .= 'Referer: ' . REFERRER . "\r\n"; $errstring .= "Username: {$username}\r\n"; $errstring .= 'IP Address: ' . IPADDRESS . "\r\n"; $errstring .= "Strikes: {$GLOBALS['strikes']}/5\r\n"; } break; } // if no filename is specified, exit this function if (!isset($errfile) or !($errfile = trim($errfile)) or defined('DEMO_MODE') and DEMO_MODE == true) { return false; } // rotate the log file if filesize is greater than $vbulletin->options[errorlogmaxsize] if ($vbulletin->options['errorlogmaxsize'] != 0 and $filesize = @filesize("{$errfile}.log") and $filesize >= $vbulletin->options['errorlogmaxsize']) { @copy("{$errfile}.log", $errfile . TIMENOW . '.log'); @unlink("{$errfile}.log"); } // write the log into the appropriate file if ($fp = @fopen("{$errfile}.log", 'a+')) { @fwrite($fp, "{$errstring}\r\n=====================================================\r\n\r\n"); @fclose($fp); return true; } else { return false; } }
/** * Check whether paid subscriptions system is active or not * * @throws vB_Exception_Api * @return void */ public function checkStatus() { $this->subobj->cache_user_subscriptions(); $this->fetchActivePaymentApis(); if (empty($this->subobj->subscriptioncache) or empty($this->apicache) or !vB::getDatastore()->getOption('subscriptionmethods')) { // Paid Subscription is disabled. throw new vB_Exception_Api('nosubscriptions'); } }
protected function typeEnabledForUser($user) { static $bf_masks; if (empty($bf_masks)) { $bf_masks = vB::getDatastore()->getValue('bf_misc_usernotificationoptions'); } // The original mapping was taken from vB_Library_Privatemessage->userReceivesNotification() return (bool) ($user['notification_options'] & $bf_masks['general_followrequest']); }
/** * Create a session for this page load * * Should only be called from the Request code. * Will use a reexisting session that matches the session hash * * @param string $sessionhash -- the token given to the client for session handling. If the client has this token they * can use the session. * @param array $restoreSessionInfo -- Information to handle "remember me" logic. * * remembermetoken -- Token value for "remember me". Stored in the "password" cookie for legacy reasons. There are * so special values to indicate that we should reauthentic via a method other than the internal vB remember me * system. * * userid -- user we are remembering * * fbsr_{appid} (optional) -- Only valid if facebook is enabled, and only used if "remembermetoken" is "facebook". */ public static function createSessionNew($sessionhash, $restoreSessionInfo = array()) { $assertor = vB::getDbAssertor(); $datastore = vB::getDatastore(); $config = vB::getConfig(); //this looks weird but its valid. Will create the an instance of whatever session class this was called //on. So vB_Session_Web::createSessionNew() will do the expected thing. $session = new vB_Session_WebApi($assertor, $datastore, $config, $sessionhash, $restoreSessionInfo); return $session; }
public static function createSession($vbApiParamsToVerify, $vBApiRequests) { self::$vBApiParamsToVerify = $vbApiParamsToVerify; self::$vBApiRequests = $vBApiRequests; $assertor = vB::getDbAssertor(); $datastore = vB::getDatastore(); $config = vB::getConfig(); $session = new vB_Session_Api($assertor, $datastore, $config, '', $vbApiParamsToVerify, $vBApiRequests); return $session; }
public static function getSession($userId, $sessionHash = '', &$dBAssertor = null, &$datastore = null, &$config = null) { $dBAssertor = $dBAssertor ? $dBAssertor : vB::getDbAssertor(); $datastore = $datastore ? $datastore : vB::getDatastore(); $config = $config ? $config : vB::getConfig(); $restoreSessionInfo = array('userid' => $userId); $session = new vB_Session_Web($dBAssertor, $datastore, $config, $sessionHash, $restoreSessionInfo); $session->set('userid', $userId); $session->fetch_userinfo(); return $session; }
/** Rebuilds the map of channel to channel type. */ public static function rebuildChannelTypes() { $channelQry = vB::getDbAssertor()->assertQuery('vBAdmincp:getChannelTypes', array('guids' => array_keys(self::$channelTypes))); $channelTypes = array(); foreach ($channelQry as $channelType) { //Note that it's possible there could be more than one record for a given node. We sorted by depth descending, so the closest //one will be last. $channelTypes[$channelType['nodeid']] = self::$channelTypes[$channelType['guid']]; } vB::getDatastore()->build('vBChannelTypes', serialize($channelTypes), 1); }
public function __construct(&$routeInfo, &$matches, &$queryString = '') { $userid = vB::getCurrentSession()->get('userid'); $pmquota = vB::getUserContext($userid)->getLimit('pmquota'); $vboptions = vB::getDatastore($userid)->getValue('options'); $canUsePmSystem = ($vboptions['enablepms'] and $pmquota); if (!$canUsePmSystem) { throw new vB_Exception_NodePermission('privatemessage'); } parent::__construct($routeInfo, $matches, $queryString); }
/** * Constructor * */ private function __construct() { $this->options = vB::getDatastore()->get_value('options'); if (!isset($this->options['vb_antispam_type']) or empty($this->options['vb_antispam_key'])) { $this->verified = false; } else { $this->bburl = $this->options['bburl']; $this->akismetKey = $this->options['vb_antispam_key']; } //validate the keys. $this->_build(); }
public function getUrl() { //bburl isn't correct as it will create a link to core rather than admincp. This happens to work //for admincp for the time being, but is the wrong url. // $bburl = vB::getDatastore()->getOption('bburl'); // return $bburl . '/' . $this->prefix . '/' . $this->arguments['file'] . '.php'; //user the header hack instead. $url = vB::getDatastore()->getOption('frontendurl') . '/' . $this->prefix . '/' . $this->arguments['file'] . '.php'; if (strtolower(vB_String::getCharset()) != 'utf-8') { $url = vB_String::encodeUtf8Url($url); } return $url; }
/** * Fetches the appropriate subclass based on how the userpics are being stored. * * @param vB_Registry Instance of the vBulletin data registry object - expected to have the database object as one of its $this->db member. * @param integer One of the ERRTYPE_x constants * * @return vB_DataManager_Userpic Subclass of vB_DataManager_Userpic */ public static function &fetch_library(&$registry, $errtype = vB_DataManager_Constants::ERRTYPE_STANDARD, $classtype = 'userpic_avatar', $usefilesystem = false) { $options = vB::getDatastore()->getValue('options'); if ($options['usefileavatar'] or $usefilesystem) { $newclass = new vB_DataManager_Userpic_Filesystem($registry, $errtype); list($prefix, $type) = explode('_', $classtype); $newclass->setStorageOptions($type); } else { $class = 'vB_DataManager_' . $classtype; $newclass = new $class($registry, $errtype); } return $newclass; }
public function editpost($postid) { $cleaner = vB::getCleaner(); $postid = $cleaner->clean($postid, vB_Cleaner::TYPE_UINT); $post = vB_Api::instance('node')->getFullContentforNodes(array($postid)); if (empty($post)) { return array("response" => array("errormessage" => array("invalidid"))); } $post = $post[0]; $prefixes = vB_Library::instance('vb4_functions')->getPrefixes($postid); $options = vB::getDatastore()->getValue('options'); $out = array('show' => array('tag_option' => 1), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars']), 'response' => array('prefix_options' => $prefixes, 'poststarttime' => 0, 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash())); return $out; }
protected function buildOutputFromItems($items, $options) { $output = $this->threadObj; $output .= "var threads = new Array(" . sizeof($items) . ");\r\n"; $itemnum = 0; $items = $this->formatItems($items, $options); foreach ($items as $item) { $item = $item['content']; $item['title'] = vB_Library_Functions::addSlashesJs(vB_String::htmlSpecialCharsUni($item['external_prefix_plain']) . $item['external_title']); $item['authorname'] = vB_Library_Functions::addSlashesJs($item['authorname']); $output .= "\tthreads[{$itemnum}] = new thread({$item['external_nodeid']}, '{$item['title']}', '{$item['authorname']}', '" . vB_Library_Functions::addSlashesJs($this->callvBDate(vB::getDatastore()->getOption('dateformat'), $item['publishdate'])) . "', '" . vB_Library_Functions::addSlashesJs($this->callvBDate(vB::getDatastore()->getOption('timeformat'), $item['publishdate'])) . "');\r\n"; $itemnum++; } return $output; }
/** * Returns all of the user groups with ismoderator set * * @return array usergroupids for each usergroup */ public function getSuperModGroups() { $datastore = vB::getDatastore(); $groups = $datastore->getValue('usergroupcache'); $bf_ugp_adminpermissions = $datastore->getValue('bf_ugp_adminpermissions'); $perm = $bf_ugp_adminpermissions['ismoderator']; $smod_groups = array(); foreach ($groups as $ugid => $groupinfo) { if ($groupinfo['adminpermissions'] & $perm) { // super mod group $smod_groups[] = $ugid; } } return $smod_groups; }
/** * Constructor */ function __construct() { $vboptions = vB::getDatastore()->getValue('options'); $this->secure = $vboptions['smtp_tls']; // Prior to 3.8 this was a radio button so SSL is 1 if ($vboptions['smtp_tls'] == 1) { $this->secure = 'ssl'; } else { if ($vboptions['smtp_tls'] === 0) { $this->secure = 'none'; } } $this->smtpHost = $vboptions['smtp_host']; $this->smtpPort = !empty($vboptions['smtp_port']) ? intval($vboptions['smtp_port']) : 25; $this->smtpUser =& $vboptions['smtp_user']; $this->smtpPass =& $vboptions['smtp_pass']; $this->delimiter = "\r\n"; }
function construct_img_html($imagepath) { global $vbulletin; static $smiliePath = false; //The handling of images is a bit convoluted, but for smiles we need to respect the datastore smiliepath. See VBV-12255 if ($smiliePath === false) { if (!empty($vbulletin->GPC['table']) and $vbulletin->GPC['table'] == 'smilie') { $smiliePath = vB::getDatastore()->getOption('smiliepath'); } else { $smiliePath = ''; } } if (substr($imagepath, 0, strlen($smiliePath)) != $smiliePath) { $imagepath = $smiliePath . $imagepath; } // returns an image based on imagepath return '<img src="' . resolve_cp_image_url($imagepath) . "\" alt=\"{$imagepath}\" align=\"middle\" />"; }
protected function buildOutputFromItems($items, $options) { $xml = new vB_XML_Builder(); $xml->add_group('source'); $xml->add_tag('url', vB::getDatastore()->getOption('frontendurl') . '/'); $items = $this->formatItems($items, $options); foreach ($items as $id => $item) { $item = $item['content']; $xml->add_group('thread', array('id' => $item['external_nodeid'])); $xml->add_tag('title', $item['external_prefix_plain'] . vB_String::unHtmlSpecialChars($item['external_title'])); $xml->add_tag('author', vB_String::unHtmlSpecialChars($item['authorname'])); $xml->add_tag('date', $this->callvBDate(vB::getDatastore()->getOption('dateformat'), $item['publishdate'])); $xml->add_tag('time', $this->callvBDate(vB::getDatastore()->getOption('timeformat'), $item['publishdate'])); $xml->close_group('thread'); } $xml->close_group('source'); return $xml->fetch_xml(); }
/** * Singleton emulation: Select library * * @return object */ public static function &fetch_library(&$registry, $library = '') { global $show; static $instance; if (!$instance) { if ($library) { // Override the defined vboption $chosenlib = $library; } else { $vboptions = vB::getDatastore()->getValue('options'); $chosenlib = $vboptions['hv_type'] ? $vboptions['hv_type'] : 'Disabled'; } $selectclass = 'vB_HumanVerify_' . $chosenlib; $chosenlib = strtolower($chosenlib); require_once DIR . '/includes/class_humanverify_' . $chosenlib . '.php'; $instance = new $selectclass($registry); } return $instance; }
public function newthread($forumid) { $cleaner = vB::getCleaner(); $forumid = $cleaner->clean($forumid, vB_Cleaner::TYPE_UINT); $forum = vB_Api::instance('node')->getFullContentforNodes(array($forumid)); if (empty($forum)) { return array("response" => array("errormessage" => array("invalidid"))); } $forum = $forum[0]; $foruminfo = vB_Library::instance('vb4_functions')->parseForumInfo($forum); $prefixes = vB_Library::instance('vb4_functions')->getPrefixes($forumid); $options = vB::getDatastore()->getValue('options'); $postattachment = $forum['content']['createpermissions']['vbforum_attach']; $postattachment = empty($postattachment) ? 0 : intval($postattachment); $usercontext = vB::getUserContext($this->currentUserId); $maxtags = $usercontext->getChannelLimits($forumid, 'maxstartertags'); $out = array('show' => array('tag_option' => 1), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars'], 'maxtags' => $maxtags), 'response' => array('forumrules' => array('can' => array('postattachment' => $postattachment)), 'prefix_options' => $prefixes, 'foruminfo' => $foruminfo, 'poststarttime' => vB::getRequest()->getTimeNow(), 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash())); return $out; }
public function newreply($threadid, $disablesmilies = false) { $cleaner = vB::getCleaner(); $threadid = $cleaner->clean($threadid, vB_Cleaner::TYPE_UINT); $thread = vB_Api::instance('node')->getFullContentforNodes(array($threadid)); if (empty($thread)) { return array("response" => array("errormessage" => array("invalidid"))); } $thread = $thread[0]; $prefixes = vB_Library::instance('vb4_functions')->getPrefixes($threadid); $options = vB::getDatastore()->getValue('options'); $postattachment = $thread['content']['createpermissions']['vbforum_attach']; $postattachment = empty($postattachment) ? 0 : intval($postattachment); /* additional options' checked checkboxes array... */ $checked = array('parseurl' => 1, 'signature' => "", "subscribe" => $thread['content']['subscribed']); // SIGNATURE $userContext = vB::getUserContext(); $currentUserId = $userContext->fetchUserId(); $signature = vB_Api::instanceInternal('user')->fetchSignature($currentUserId); if (!empty($signature)) { $checked['signature'] = 1; } // DISABLESMILIES // getDataForParse converts channel.options into bbcodeoptions, and this is used by the // frontend nodetext / bbcode parsers $textDataArray = vB_Api::instanceInternal('content_text')->getDataForParse(array($threadid)); $channelAllowsSmilies = $textDataArray[$threadid]['bbcodeoptions']['allowsmilies']; if ($channelAllowsSmilies) { if (!empty($disablesmilies)) { $checked['disablesmilies'] = 1; } else { $checked['disablesmilies'] = ""; } $show['smiliebox'] = 1; } else { $show['smiliebox'] = 0; } $out = array('show' => array('tag_option' => 1, 'smiliebox' => $show['smiliebox']), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars']), 'response' => array('title' => '', 'forumrules' => array('can' => array('postattachment' => $postattachment)), 'prefix_options' => $prefixes, 'poststarttime' => 0, 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash()), 'checked' => $checked); return $out; }