/** * Parse an input string with BB code to a final output string of HTML * * @param string Input Text (BB code) * @param bool Whether to parse smilies * @param bool Whether to parse img (for the video bbcodes) * @param bool Whether to allow HTML (for smilies) * * @return string|false String output Text (HTML) if a valid page, false if invalid page */ function parse_bbcode($input_text, $do_smilies, $do_imgcode, $do_html = false) { if ($this->output_page) { $this->current_page = 1; $this->pages = array(1 => array('title' => '')); } else { $this->current_page = 0; $this->pages = array(); } if (!$this->candownload) { $do_imgcode = false; } $last_page_text = parent::parse_bbcode($input_text, $do_smilies, $do_imgcode, $do_html); $this->parse_output = ''; $this->fetched_valid_page = true; if ($this->output_page) { if ($this->output_page == $this->current_page) { return $last_page_text; } else if (isset($this->pages[$this->output_page])) { return $this->pages[$this->output_page]['text']; } else { $this->fetched_valid_page = false; return ''; } } else { return $last_page_text; } }
public function fetch_shouts($limit = 20, $userid = 0) { if ($userid < 1) { $query = $this->vbulletin->db->query("\n SELECT * FROM " . TABLE_PREFIX . "jb_firebolt_shout\n WHERE pmto = '0' OR pmto = '" . intval($this->vbulletin->userinfo['userid']) . "' OR userid = '" . $this->vbulletin->userinfo['userid'] . "'\n ORDER BY id DESC LIMIT 0," . intval($limit)); } else { $query = $this->vbulletin->db->query("\n SELECT * FROM " . TABLE_PREFIX . "jb_firebolt_shout\n WHERE\n ( userid = '" . intval($userid) . "' && pmto = '" . intval($this->vbulletin->userinfo['userid']) . "' )\n OR\n ( userid = '" . intval($this->vbulletin->userinfo['userid']) . "' && pmto = '" . intval($userid) . "' )\n ORDER BY id DESC LIMIT 0," . intval($limit)); } $output = ''; if ($this->usersettings['banned']) { $notice = 'You are currently banned from the shoutbox.'; } else { $notice = $this->vbulletin->options['jb_firebolt_notice']; } if (trim($notice) != null) { $bbcode_parser = new vB_BbCodeParser($this->vbulletin, fetch_tag_list()); if (!function_exists('convert_url_to_bbcode')) { require_once DIR . '/includes/functions_newpost.php'; } $notice = convert_url_to_bbcode($notice); $notice = $bbcode_parser->parse_bbcode($notice, true, false, false); $output .= "<b>Notice:</b> " . $notice . "<br />"; } if (!$this->usersettings['banned']) { while ($shout = $this->vbulletin->db->fetch_array($query)) { $bbcode_parser = new vB_BbCodeParser($this->vbulletin, fetch_tag_list()); if (!function_exists('convert_url_to_bbcode')) { require_once DIR . '/includes/functions_newpost.php'; } $sdate = vbdate($this->vbulletin->options['dateformat'], $shout['shouttime']); $stime = vbdate($this->vbulletin->options['timeformat'], $shout['shouttime']); $message = $shout['shout']; $message = convert_url_to_bbcode($message); $message = $bbcode_parser->parse_bbcode($message, true, false, false); if (trim($message) == null) { $this->vbulletin->db->query("\n DELETE FROM " . TABLE_PREFIX . "jb_firebolt_shout\n WHERE id = '" . intval($shout['id']) . "'\n "); continue; } $user = fetch_userinfo($shout['userid']); if (!$this->vbulletin->options['jb_firebolt_new_shout_layout']) { $message = $this->stylize($message, $user['userid']); } if ($this->vbulletin->options['jb_firebolt_new_shout_layout']) { $username = $user['username']; $templater = vB_Template::create('jb_firebolt_shout_modern'); $templater->register('user', $user); } else { $username = fetch_musername($user); $templater = vB_Template::create('jb_firebolt_shout'); } $templater->register('sdate', $sdate); $templater->register('stime', $stime); $templater->register('username', $username); $templater->register('message', $message); $output .= $templater->render(); } } return $output; }