コード例 #1
1
ファイル: function_home.php プロジェクト: upyun/discuz-plugin
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);
}
コード例 #2
0
/**
* 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;
}
コード例 #3
0
ファイル: demo.php プロジェクト: Sajaki/customisation-db
 /**
  * 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);
 }
コード例 #4
0
ファイル: Bbcode.php プロジェクト: ei-grad/phorm
 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>';
 }
コード例 #5
0
ファイル: Th.php プロジェクト: ei-grad/phorm
 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>';
 }
コード例 #6
0
ファイル: function_home.php プロジェクト: Kingson4Wu/php_demo
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);
}
コード例 #7
0
ファイル: Table.php プロジェクト: ei-grad/phorm
 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;
 }
コード例 #8
0
ファイル: Align.php プロジェクト: ZerGabriel/ffcms
 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>';
 }
コード例 #9
0
ファイル: Size.php プロジェクト: ei-grad/phorm
 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>';
 }
コード例 #10
0
ファイル: List.php プロジェクト: ei-grad/phorm
 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;
 }
コード例 #11
0
ファイル: Abbr.php プロジェクト: ei-grad/phorm
 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>';
 }
コード例 #12
0
 /**
  * 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;
 }
コード例 #13
0
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');
}
コード例 #14
0
ファイル: Li.php プロジェクト: ZerGabriel/ffcms
 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>';
 }
コード例 #15
0
ファイル: A.php プロジェクト: sgh1986915/cakephp2-bpong
 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>';
 }
コード例 #16
0
ファイル: P.php プロジェクト: ei-grad/phorm
 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";
 }
コード例 #17
0
ファイル: listener.php プロジェクト: tas2580/imageproxy
 /**
  * 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;
 }
コード例 #18
0
ファイル: A.php プロジェクト: ZerGabriel/ffcms
 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>';
 }
コード例 #19
0
ファイル: Tr.php プロジェクト: ei-grad/phorm
 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;
 }
コード例 #20
0
 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);
 }
コード例 #21
0
ファイル: Quote.php プロジェクト: ZerGabriel/ffcms
 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>';
 }
コード例 #22
0
 /**
  * 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'];
     }
 }
コード例 #23
0
ファイル: Simple.php プロジェクト: ei-grad/phorm
 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;
 }
コード例 #24
0
ファイル: conv_info.php プロジェクト: EvgeniiFrolov/myrulib
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("&lt;", "<", $body);
        $body = str_replace("&gt;", ">", $body);
        $insert->execute(array($body, $row['BookId']));
        $insert->closeCursor();
    }
    $sqlite_db->query("commit;");
}
コード例 #25
0
ファイル: bbcode.class.php プロジェクト: pan289091315/Discuz
 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('&nbsp; &nbsp; &nbsp; &nbsp; ', '&nbsp; &nbsp;', '&nbsp;&nbsp;'), $message));
 }
コード例 #26
0
ファイル: Google.php プロジェクト: ZerGabriel/ffcms
 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>';
 }
コード例 #27
0
ファイル: Font.php プロジェクト: ZerGabriel/ffcms
 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>';
 }
コード例 #28
0
ファイル: Bdo.php プロジェクト: ZerGabriel/ffcms
 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>';
 }
コード例 #29
0
ファイル: Email.php プロジェクト: ei-grad/phorm
 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>';
 }
コード例 #30
0
ファイル: memberlist.php プロジェクト: html/PI
     $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();
 }