function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $bbcode = 0, $html = 0) { global $_G; $string = trim($string); $sppos = strpos($string, chr(0) . chr(0) . chr(0)); if ($sppos !== false) { $string = substr($string, 0, $sppos); } if ($in_slashes) { $string = dstripslashes($string); } $string = preg_replace("/\\[hide=?\\d*\\](.*?)\\[\\/hide\\]/is", '', $string); if ($html < 0) { $string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string); } elseif ($html == 0) { $string = dhtmlspecialchars($string); } if ($length) { $string = cutstr($string, $length); } if ($bbcode) { require_once DISCUZ_ROOT . './source/class/class_bbcode.php'; $bb =& bbcode::instance(); $string = $bb->bbcode2html($string, $bbcode); } if ($out_slashes) { $string = daddslashes($string); } return trim($string); }
/** * For display of custom parsed text on user-facing pages * Expects $text to be the value directly from the database (stored value) */ function generate_text_for_display($text, $only_smileys = false, $censor = true, $acro_autolinks = false, $forum_id = '999999') { global $bbcode, $config, $user; if (empty($text)) { return ''; } if (defined('IS_ICYPHOENIX') && $censor) { $text = censor_text($text); } if (!class_exists('bbcode') || empty($bbcode)) { include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT; } if (empty($bbcode)) { $bbcode = new bbcode(); if (!$user->data['session_logged_in']) { $user->data['user_allowhtml'] = $config['allow_html'] ? true : false; $user->data['user_allowbbcode'] = $config['allow_bbcode'] ? true : false; $user->data['user_allowsmile'] = $config['allow_smilies'] ? true : false; } $bbcode->allow_html = $user->data['user_allowhtml'] && $config['allow_html'] ? true : false; $bbcode->allow_bbcode = $user->data['user_allowbbcode'] && $config['allow_bbcode'] ? true : false; $bbcode->allow_smilies = $user->data['user_allowsmile'] && $config['allow_smilies'] ? true : false; } if ($only_smileys) { $text = $bbcode->parse_only_smilies($text); } else { $text = $bbcode->parse($text); if ($acro_autolinks) { $text = $bbcode->acronym_pass($text); $text = $bbcode->autolink_text($text, $forum_id); } } return $text; }
/** * Render BBCode in a message * * @param string $message Message to render -- should already be parsed using message parser. Using some modified code from $bbcode->bbcode_cache_init() in phpBB's bbcode.php. * @param string $uid BBCode uid * @param string $bitfield BBCode bitfield * @return string Demo HTML */ public function render_message($message, $uid, $bitfield) { if (empty($this->bbcode_data)) { return $message; } if (!is_object($this->bbcode)) { if (!class_exists('\\bbcode')) { require $this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext; } $this->bbcode = new \bbcode(); } // We define bbcode_bitfield here instead of when instantiating the class to prevent bbcode_cache_init() from running $this->bbcode->bbcode_bitfield = $bitfield; $bbcode_tpl = !empty($this->bbcode_data['second_pass_replace']) ? $this->bbcode_data['second_pass_replace'] : $this->bbcode_data['bbcode_tpl']; // Handle language variables $bbcode_tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(phpbb::\$user->lang['\$1'])) ? phpbb::\$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl); if ($this->bbcode_data['second_pass_replace']) { $this->bbcode->bbcode_cache[$this->contrib_id] = array('preg' => array($this->bbcode_data['second_pass_match'] => $bbcode_tpl)); } else { $this->bbcode->bbcode_cache[$this->contrib_id] = array('str' => array($this->bbcode_data['second_pass_match'] => $bbcode_tpl)); } $this->bbcode->bbcode_uid = $uid; $this->bbcode->bbcode_second_pass($message); return bbcode_nl2br($message); }
function get_html($tree = null) { $str = ''; foreach ($this->tree as $item) { if ('item' == $item['type']) { continue; } $str .= $item['str']; } $bb = new bbcode(); $bb->tags = $this->tags; $bb->mnemonics = $this->mnemonics; $bb->autolinks = $this->autolinks; $bb->parse($str); return '<code class="bb_code">' . $bb->highlight() . '</code>'; }
function get_html($tree = null) { $attr = ' class="bb"'; $width = isset($this->attrib['width']) ? $this->attrib['width'] : ''; if ($width) { $attr .= ' width="' . htmlspecialchars($width) . '"'; } $height = isset($this->attrib['height']) ? $this->attrib['height'] : ''; if ($height) { $attr .= ' height="' . htmlspecialchars($height) . '"'; } $align = isset($this->attrib['align']) ? $this->attrib['align'] : ''; if ($align) { $attr .= ' align="' . htmlspecialchars($align) . '"'; } $valign = isset($this->attrib['valign']) ? $this->attrib['valign'] : ''; if ($valign) { $attr .= ' valign="' . htmlspecialchars($valign) . '"'; } if (isset($this->attrib['colspan'])) { $colspan = (int) $this->attrib['colspan']; if ($colspan) { $attr .= ' colspan="' . $colspan . '"'; } } if (isset($this->attrib['rowspan'])) { $rowspan = (int) $this->attrib['rowspan']; if ($rowspan) { $attr .= ' rowspan="' . $rowspan . '"'; } } return '<th' . $attr . '>' . parent::get_html($this->tree) . '</th>'; }
function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $censor = 0, $bbcode = 0, $html = 0) { global $_G; $string = trim($string); if ($in_slashes) { $string = dstripslashes($string); } if ($html < 0) { $string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string); } elseif ($html == 0) { $string = dhtmlspecialchars($string); } if ($censor) { if (!class_exists('discuz_censor')) { include libfile('class/censor'); } $censor = discuz_censor::instance(); $censor->check($string); if ($censor->modbanned() || $censor->modmoderated()) { showmessage('word_banned'); } } if ($length) { $string = cutstr($string, $length); } if ($bbcode) { require_once DISCUZ_ROOT . './source/class/class_bbcode.php'; $bb =& bbcode::instance(); $string = $bb->bbcode2html($string, $bbcode); } if ($out_slashes) { $string = daddslashes($string); } return trim($string); }
function get_html($tree = null) { $attr = ' class="bb"'; $border = isset($this->attrib['border']) ? (int) $this->attrib['border'] : null; if (null !== $border) { $attr .= ' border="' . $border . '"'; } $width = isset($this->attrib['width']) ? $this->attrib['width'] : ''; if ($width) { $attr .= ' width="' . htmlspecialchars($width) . '"'; } $cellspacing = isset($this->attrib['cellspacing']) ? (int) $this->attrib['cellspacing'] : null; if (null !== $cellspacing) { $attr .= ' cellspacing="' . $cellspacing . '"'; } $cellpadding = isset($this->attrib['cellpadding']) ? (int) $this->attrib['cellpadding'] : null; if (null !== $cellpadding) { $attr .= ' cellpadding="' . $cellpadding . '"'; } $align = isset($this->attrib['align']) ? $this->attrib['align'] : ''; if ($align) { $attr .= ' align="' . htmlspecialchars($align) . '"'; } $str = '<table' . $attr . '>'; foreach ($this->tree as $key => $item) { if ('text' == $item['type']) { unset($this->tree[$key]); } } $str .= parent::get_html($this->tree) . '</table>'; return $str; }
function get_html($tree = null) { $align = ''; if (isset($this->attrib['justify'])) { $align = 'justify'; } if (isset($this->attrib['left'])) { $align = 'left'; } if (isset($this->attrib['right'])) { $align = 'right'; } if (isset($this->attrib['center'])) { $align = 'center'; } if (!$align && isset($this->attrib['align'])) { switch (strtolower($this->attrib['align'])) { case 'left': $align = 'left'; break; case 'right': $align = 'right'; break; case 'center': $align = 'center'; break; case 'justify': $align = 'justify'; break; } } return '<div class="bb" align="' . $align . '">' . parent::get_html($this->tree) . '</div>'; }
function get_html($tree = null) { $sign = ''; if (strlen($this->attrib['size'])) { $sign = $this->attrib['size'][0]; } if ('+' != $sign) { $sign = ''; } $size = (int) $this->attrib['size']; if ($size >= 50 && $size <= 200) { return '<font style="font-size:' . $size . '%">' . parent::get_html($this->tree) . '</font>'; } if (7 < $size) { $size = 7; $sign = ''; } if (-6 > $size) { $size = '-6'; $sign = ''; } if (0 == $size) { $size = 3; } $size = $sign . $size; return '<font size="' . $size . '">' . parent::get_html($this->tree) . '</font>'; }
function get_html($tree = null) { $tag_name = 'ul'; $type = ''; switch ($this->tag) { case 'ol': $tag_name = 'ol'; $type = strtolower($this->attrib['ol']); break; case 'list': if ($this->attrib['list']) { $tag_name = 'ol'; } $type = strtolower($this->attrib['list']); $this->tag = 'del'; } $attr = ' class="bb"'; if ('1' == $type) { $attr .= ' type="1"'; } elseif ($type) { $attr .= ' type="a"'; } $str = '<' . $tag_name . $attr . '>' . parent::get_html() . '</' . $tag_name . '>'; return $str; }
function get_html($tree = null) { $attrib = 'class="bb"'; if ($this->attrib['abbr']) { $attrib .= ' title="' . htmlspecialchars($this->attrib['abbr']) . '"'; } return '<abbr ' . $attrib . '>' . parent::get_html($this->tree) . '</abbr>'; }
/** * Changes the regex replacement for second pass * * @param object $event * @return null * @access public */ public function modify_case_img($event) { $bbcode_id = 4; // [img] has bbcode_id 4 hardcoded $bbcode_cache = $event['bbcode_cache']; if (!isset($bbcode_cache[$bbcode_id]) || !$this->user->optionget('viewimg')) { return; } $this->template->set_filenames(array('bbcode.html' => 'bbcode.html')); $bbcode = new \bbcode(); // We need these otherwise we cannot use $bbcode->bbcode_tpl() $bbcode->template_bitfield = new \bitfield($this->user->style['bbcode_bitfield']); $bbcode->template_filename = $this->template->get_source_file_for_handle('bbcode.html'); $extimgaslink_boardurl = generate_board_url() . '/'; $bbcode_cache[$bbcode_id] = array('preg' => array('#\\[img:$uid\\](' . preg_quote($extimgaslink_boardurl, '#') . '.*?)\\[/img:$uid\\]#s' => $bbcode->bbcode_tpl('img', $bbcode_id), '#\\[img:$uid\\](.*?)\\[/img:$uid\\]#s' => str_replace('$2', $this->user->lang('EXTIMGLINK'), $bbcode->bbcode_tpl('url', $bbcode_id, true)))); $event['bbcode_cache'] = $bbcode_cache; }
function mail_read() { global $smarty; $mail_id = (int) $_REQUEST['mail_id']; $db_query = "\n\t\t\tSELECT \n\t\t\t\t`players`.`name` as 'from', \n\t\t\t\t`mail`.`mail_id`, \n\t\t\t\t`mail`.`from_player_id`, \n\t\t\t\t`mail`.`body`, \n\t\t\t\t`mail`.`subject`, \n\t\t\t\t`mail`.`time`, \n\t\t\t\t`mail`.`status` \n\t\t\tFROM `mail` \n\t\t\tLEFT JOIN `players` ON `players`.`player_id` = `mail`.`from_player_id` \n\t\t\tWHERE \n\t\t\t\t`mail`.`round_id` = '" . $_SESSION['round_id'] . "' AND \n\t\t\t\t`mail`.`mail_id` = '" . $mail_id . "' AND \n\t\t\t\t`mail`.`to_player_id` = '" . $_SESSION['player_id'] . "' AND \n\t\t\t\t`mail`.`status` != '" . MAILSTATUS_DELETED . "'\n\t\t\tORDER BY `time` ASC \n\t\t\tLIMIT 30"; $db_result = mysql_query($db_query); if (mysql_num_rows($db_result) == 0) { $status[] = 'That mail does not exist or you do not have permission to view it.'; $smarty->append('status', $status); mail_list(); exit; } $mail = mysql_fetch_array($db_result, MYSQL_ASSOC); $mail['time'] = format_timestamp($mail['time'] + 3600 * $_SESSION['preferences']['timezone']); $mail['subject'] = htmlentities($mail['subject']); $mail['body'] = nl2br(htmlentities($mail['body'])); if ($mail['from_player_id'] == 0) { $mail['from'] = 'Administration'; } $bbtags = array('b' => array('Name' => 'b', 'HtmlBegin' => '<span style="font-weight: bold;">', 'HtmlEnd' => '</span>'), 'i' => array('Name' => 'i', 'HtmlBegin' => '<span style="font-style: italic;">', 'HtmlEnd' => '</span>'), 'u' => array('Name' => 'u', 'HtmlBegin' => '<span style="text-decoration: underline;">', 'HtmlEnd' => '</span>'), 's' => array('Name' => 's', 'HtmlBegin' => '<span style="text-decoration: line-through;">', 'HtmlEnd' => '</span>'), 'quote' => array('Name' => 'quote', 'HasParam' => true, 'HtmlBegin' => '<b>Quote %%P%%:</b><div class="mailquote">', 'HtmlEnd' => '</div>')); require_once dirname(__FILE__) . '/includes/bbcode.php'; $bbcode = new bbcode(); $bbcode->add_tag($bbtags['b']); $bbcode->add_tag($bbtags['i']); $bbcode->add_tag($bbtags['u']); $bbcode->add_tag($bbtags['s']); $bbcode->add_tag($bbtags['quote']); $mail['body'] = $bbcode->parse_bbcode($mail['body']); if ($mail['status'] == 1) { $db_query = "UPDATE `mail` SET `status` = '2' WHERE `mail_id` = '" . $mail_id . "' LIMIT 1"; $db_result = mysql_query($db_query); } $smarty->assign('mail', $mail); $smarty->display('mail_read.tpl'); }
function get_html($tree = null) { $attrib = 'class="bb"'; if ('' !== $this->attrib['*']) { $this->attrib['*'] = (int) $this->attrib['*']; $attrib .= ' value="' . $this->attrib['*'] . '"'; } return '<li ' . $attrib . '>' . parent::get_html($this->tree) . '</li>'; }
function get_html($tree = null) { $this->autolinks = false; $text = ''; foreach ($this->tree as $val) { if ('text' == $val['type']) { $text .= $val['str']; } } $href = ''; if (isset($this->attrib['url'])) { $href = $this->attrib['url']; } if (!$href && isset($this->attrib['a'])) { $href = $this->attrib['a']; } if (!$href && isset($this->attrib['href'])) { $href = $this->attrib['href']; } if (!$href && !isset($this->attrib['anchor'])) { $href = $text; } $href = $this->checkUrl($href); $attr = 'class="bb"'; if ($href) { $attr .= ' href="' . $href . '"'; } if (isset($this->attrib['title'])) { $title = $this->attrib['title']; $attr .= ' title="' . htmlspecialchars($title) . '"'; } $id = ''; if (isset($this->attrib['id'])) { $id = $this->attrib['id']; } if (!$id && isset($this->attrib['name'])) { $id = $this->attrib['name']; } if (!$id && isset($this->attrib['anchor'])) { $id = $this->attrib['anchor']; if (!$id) { $id = $text; } } if ($id) { if ($id[0] < 'A' || $id[0] > 'z') { $id = 'bb' . $id; } $attr .= ' id="' . htmlspecialchars($id) . '"'; } if (isset($this->attrib['target'])) { $target = $this->attrib['target']; $attr .= ' target="' . htmlspecialchars($target) . '"'; } return smarty_modifier_linkify(parent::get_html($this->tree), parent::get_html($this->tree)); //return '<a '.$attr.'>'.parent::get_html($this -> tree).'</a>'; }
function get_html($tree = null) { $str = "\n<" . $this->tag . ' class="bb"'; $align = isset($this->attrib['align']) ? $this->attrib['align'] : ''; if ($align) { $str .= ' align="' . htmlspecialchars($align) . '"'; } return $str . '>' . parent::get_html() . '</' . $this->tag . ">\n"; }
/** * Changes the regex replacement for second pass * * Based on phpBB.de - External Image as Link from Christian Schnegelberger<*****@*****.**> and Oliver Schramm <*****@*****.**> * * @param object $event * @return null * @access public */ public function bbcode_cache_init_end($event) { $bbcode_id = 4; // [img] has bbcode_id 4 hardcoded $bbcode_cache = $event['bbcode_cache']; if (!isset($bbcode_cache[$bbcode_id]) || !$this->user->optionget('viewimg')) { return; } $this->template->set_filenames(array('bbcode.html' => 'bbcode.html')); $bbcode = new \bbcode(); // We need these otherwise we cannot use $bbcode->bbcode_tpl() $bbcode->template_bitfield = new \bitfield($this->user->style['bbcode_bitfield']); $bbcode->template_filename = $this->template->get_source_file_for_handle('bbcode.html'); $extimgaslink_boardurl = generate_board_url() . '/'; $url = $this->helper->route('tas2580_imageproxy_main', array()); $bbcode_cache[$bbcode_id] = array('preg' => array('#\\[img:$uid\\](' . preg_quote($extimgaslink_boardurl, '#') . '.*?)\\[/img:$uid\\]#s' => $bbcode->bbcode_tpl('img', $bbcode_id), '#\\[img:$uid\\](.*?)\\[/img:$uid\\]#s' => str_replace('$1', $url . '?img=$1', $bbcode->bbcode_tpl('img', $bbcode_id, true)))); $event['bbcode_cache'] = $bbcode_cache; }
function get_html($tree = null) { $this->autolinks = false; $text = ''; foreach ($this->tree as $val) { if ('text' == $val['type']) { $text .= $val['str']; } } $href = ''; if (isset($this->attrib['url'])) { $href = $this->attrib['url']; } if (!$href && isset($this->attrib['a'])) { $href = $this->attrib['a']; } if (!$href && isset($this->attrib['href'])) { $href = $this->attrib['href']; } if (!$href && !isset($this->attrib['anchor'])) { $href = $text; } $href = $this->checkUrl($href); $attr = 'class="bb"'; if ($href) { if (system::getInstance()->prefixEquals($href, property::getInstance()->get('url')) || $href == property::getInstance()->get('url')) { $attr .= ' href="' . $href . '"'; } else { $attr .= ' href="' . $href . '" rel="nofollow"'; } } if (isset($this->attrib['title'])) { $title = $this->attrib['title']; $attr .= ' title="' . htmlspecialchars($title) . '"'; } $id = ''; if (isset($this->attrib['id'])) { $id = $this->attrib['id']; } if (!$id && isset($this->attrib['name'])) { $id = $this->attrib['name']; } if (!$id && isset($this->attrib['anchor'])) { $id = $this->attrib['anchor']; if (!$id) { $id = $text; } } if ($id) { if ($id[0] < 'A' || $id[0] > 'z') { $id = 'bb' . $id; } $attr .= ' id="' . htmlspecialchars($id) . '"'; } return '<a ' . $attr . ' target="_blank">' . parent::get_html($this->tree) . '</a>'; }
function get_html($tree = null) { $str = '<tr class="bb">'; foreach ($this->tree as $key => $item) { if ('text' == $item['type']) { unset($this->tree[$key]); } } $str .= parent::get_html($this->tree) . '</tr>'; return $str; }
public static function tohtml($text, $advanced = TRUE, $charset = 'utf8') { $basic_bbcode = array('[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[s]', '[/s]', '[ul]', '[/ul]', '[li]', '[/li]', '[ol]', '[/ol]', '[center]', '[/center]', '[left]', '[/left]', '[right]', '[/right]'); $basic_html = array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<s>', '</s>', '<ul>', '</ul>', '<li>', '</li>', '<ol>', '</ol>', '<div style="text-align: center;">', '</div>', '<div style="text-align: left;">', '</div>', '<div style="text-align: right;">', '</div>'); $text = str_replace($basic_bbcode, $basic_html, $text); if ($advanced) { $advanced_bbcode = array('#\\[color=([a-zA-Z]*|\\#?[0-9a-fA-F]{6})](.+)\\[/color\\]#Usi', '#\\[size=([0-9][0-9]?)](.+)\\[/size\\]#Usi', '#\\[quote](\\r\\n)?(.+?)\\[/quote]#si', '#\\[quote=(.*?)](\\r\\n)?(.+?)\\[/quote]#si', '#\\[url](.+)\\[/url]#Usi', '#\\[url=(.+)](.+)\\[/url\\]#Usi', '#\\[email]([\\w\\.\\-]+@[a-zA-Z0-9\\-]+\\.?[a-zA-Z0-9\\-]*\\.\\w{1,4})\\[/email]#Usi', '#\\[email=([\\w\\.\\-]+@[a-zA-Z0-9\\-]+\\.?[a-zA-Z0-9\\-]*\\.\\w{1,4})](.+)\\[/email]#Usi', '#\\[img](.+)\\[/img]#Usi', '#\\[img=(.+)](.+)\\[/img]#Usi', '#\\[code](\\r\\n)?(.+?)(\\r\\n)?\\[/code]#si', '#\\[youtube]http://[a-z]{0,3}.youtube.com/watch\\?v=([0-9a-zA-Z]{1,11})\\[/youtube]#Usi', '#\\[youtube]([0-9a-zA-Z]{1,11})\\[/youtube]#Usi'); $advanced_html = array('<span style="color: $1">$2</span>', '<span style="font-size: $1px">$2</span>', "<div class=\"quote\"><span class=\"quoteby\">Disse:</span>\r\n\$2</div>", "<div class=\"quote\"><span class=\"quoteby\">Disse <b>\$1</b>:</span>\r\n\$3</div>", '<a rel="nofollow" target="_blank" href="$1">$1</a>', '<a rel="nofollow" target="_blank" href="$1">$2</a>', '<a href="mailto: $1">$1</a>', '<a href="mailto: $1">$2</a>', '<img src="$1" alt="$1" />', '<img src="$1" alt="$2" />', '<div class="codeblock"><code>$2</code></div>', '<object type="application/x-shockwave-flash" style="width: 450px; height: 366px;" data="http://www.youtube.com/v/$1"><param name="movie" value="http://www.youtube.com/v/$1" /><param name="wmode" value="transparent" /></object>', '<object type="application/x-shockwave-flash" style="width: 450px; height: 366px;" data="http://www.youtube.com/v/$1"><param name="movie" value="http://www.youtube.com/v/$1" /><param name="wmode" value="transparent" /></object>'); $text = preg_replace($advanced_bbcode, $advanced_html, $text); } return bbcode::nl2br($text); }
function get_html($tree = null) { if ('blockquote' == $this->tag) { $author = htmlspecialchars($this->attrib['blockquote']); } else { $author = htmlspecialchars($this->attrib['quote']); } if ($author) { $author = '<div class="bb_quote_author">' . $author . '</div>'; } return '<blockquote class="bb_quote">' . $author . parent::get_html($this->tree) . '</blockquote>'; }
/** * Constructor * * @param $qsf - Quicksilver Forums module **/ function activeutil(&$qsf) { parent::bbcode($qsf); $this->get =& $qsf->get; $this->user_id = $qsf->user['user_id']; $this->time = $qsf->time; $this->ip = $qsf->ip; $this->agent = $qsf->agent; $this->self = $qsf->self; if (isset($qsf->session['id'])) { $this->sessionid = $qsf->session['id']; } }
function get_html($tree = null) { switch ($this->tag) { case 'b': $this->tag = 'strong'; break; case 's': case 'strike': $this->tag = 'del'; } $html = '<' . $this->tag . ' class="bb">' . parent::get_html() . '</' . $this->tag . '>'; return $html; }
function book_info($mysql_db, $sqlite_db, $min) { $sqlite_db->query("begin transaction;"); $bb = new bbcode(); $bb->autolinks = false; $sqltest = "SELECT BookId FROM libbannotations WHERE BookId>{$min}"; $query = $mysql_db->query($sqltest); while ($row = $query->fetch_array()) { echo "Book: " . $row['BookId'] . "\n"; $sqltest1 = "SELECT Body FROM libbannotations WHERE BookId=" . $row['BookId']; $query1 = $mysql_db->query($sqltest1); $row1 = $query1->fetch_array(); $sql = "UPDATE books SET description=? where id=?"; $insert = $sqlite_db->prepare($sql); $bb->parse($row1['Body']); $body = $bb->get_html(); $body = str_replace("<", "<", $body); $body = str_replace(">", ">", $body); $insert->execute(array($body, $row['BookId'])); $insert->closeCursor(); } $sqlite_db->query("commit;"); }
function bbcode2html($message, $parseurl = 0) { if (empty($this->search_exp)) { $this->search_exp = array("/\\s*\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s*/is", "/\\[url\\]\\s*(https?:\\/\\/|ftp:\\/\\/|gopher:\\/\\/|news:\\/\\/|telnet:\\/\\/|rtsp:\\/\\/|mms:\\/\\/|callto:\\/\\/|ed2k:\\/\\/){1}([^\\[\"']+?)\\s*\\[\\/url\\]/i", "/\\[em:(.+?):\\]/i"); $this->replace_exp = array("<div class=\"quote\"><blockquote>\\1</blockquote></div>", "<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>", " <img src=\"" . STATICURL . "image/smiley/comcom/\\1.gif\" class=\"vm\"> "); $this->search_str = array('[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]'); $this->replace_str = array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>'); } if ($parseurl == 2) { $this->search_exp[] = "/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies"; $this->replace_exp[] = '$this->bb_img(\'\\1\')'; $message = bbcode::parseurl($message); } @($message = str_replace($this->search_str, $this->replace_str, preg_replace($this->search_exp, $this->replace_exp, $message, 20))); return nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message)); }
function get_html($tree = null) { $attr = htmlspecialchars(rawurlencode($this->attrib['google'])); $attr = ' href="http://www.google.com/search?q=' . $attr . '"'; $title = isset($this->attrib['title']) ? $this->attrib['title'] : ''; if ($title) { $attr .= ' title="' . htmlspecialchars($title) . '"'; } $name = isset($this->attrib['name']) ? $this->attrib['name'] : ''; if ($name) { $attr .= ' name="' . htmlspecialchars($name) . '"'; } $target = isset($this->attrib['target']) ? $this->attrib['target'] : ''; if ($target) { $attr .= ' target="' . htmlspecialchars($target) . '"'; } return '<a class="bb_google" ' . $attr . '>' . parent::get_html($this->tree) . '</a>'; }
function get_html($tree = null) { $attr = ''; if (isset($this->attrib['face'])) { $face = $this->attrib['face']; } else { $face = $this->attrib['font']; } if ($face) { $attr .= ' face="' . htmlspecialchars($face) . '"'; } $color = isset($this->attrib['color']) ? $this->attrib['color'] : ''; if ($color) { $attr .= ' color="' . htmlspecialchars($color) . '"'; } $size = isset($this->attrib['size']) ? $this->attrib['size'] : ''; if ($size) { $attr .= ' size="' . htmlspecialchars($size) . '"'; } return '<font' . $attr . '>' . parent::get_html($this->tree) . '</font>'; }
function get_html($tree = null) { $dir = ''; switch (strtolower($this->attrib['bdo'])) { case 'ltr': $dir = 'ltr'; break; case 'rtl': $dir = 'rtl'; } if (!$dir) { return parent::get_html(); } /* <bdo> может иметь следующие атрибуты: dir, lang, id, class, style, title. */ $attr = 'dir="' . $dir . '" class="bb"'; if (isset($this->attrib['lang'])) { $attr .= ' lang="' . htmlspecialchars($this->attrib['lang']) . '"'; } return '<bdo ' . $attr . '>' . parent::get_html() . '</bdo>'; }
function get_html($tree = null) { $this->autolinks = false; $attr = ' class="bb_email"'; $href = $this->attrib['email']; if (!$href) { foreach ($this->tree as $text) { if ('text' == $text['type']) { $href .= $text['str']; } } } $protocols = array('mailto:'); $is_http = false; foreach ($protocols as $val) { if ($val == substr($href, 0, strlen($val))) { $is_http = true; break; } } if (!$is_http) { $href = 'mailto:' . $href; } if ($href) { $attr .= ' href="' . htmlspecialchars($href) . '"'; } $title = isset($this->attrib['title']) ? $this->attrib['title'] : ''; if ($title) { $attr .= ' title="' . htmlspecialchars($title) . '"'; } $name = isset($this->attrib['name']) ? $this->attrib['name'] : ''; if ($name) { $attr .= ' name="' . htmlspecialchars($name) . '"'; } $target = isset($this->attrib['target']) ? $this->attrib['target'] : ''; if ($target) { $attr .= ' target="' . htmlspecialchars($target) . '"'; } return '<a' . $attr . '>' . parent::get_html($this->tree) . '</a>'; }
$member['session_time'] = isset($row['session_time']) ? $row['session_time'] : 0; $member['session_viewonline'] = isset($row['session_viewonline']) ? $row['session_viewonline'] : 0; unset($row); } if ($config['load_user_activity']) { display_user_activity($member); } // Do the relevant calculations $memberdays = max(1, round((time() - $member['user_regdate']) / 86400)); $posts_per_day = $member['user_posts'] / $memberdays; $percentage = $config['num_posts'] ? min(100, $member['user_posts'] / $config['num_posts'] * 100) : 0; if ($member['user_sig']) { $member['user_sig'] = censor_text($member['user_sig']); if ($member['user_sig_bbcode_bitfield']) { include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx; $bbcode = new bbcode(); $bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']); } $member['user_sig'] = bbcode_nl2br($member['user_sig']); $member['user_sig'] = smiley_text($member['user_sig']); } $poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']); $template->assign_vars(show_profile($member)); // Custom Profile Fields $profile_fields = array(); if ($config['load_cpf_viewprofile']) { include_once $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx; $cp = new custom_profile(); $profile_fields = $cp->generate_profile_fields_template('grab', $user_id); $profile_fields = isset($profile_fields[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array(); }