Esempio n. 1
0
 private function strip($in)
 {
     $bb = new BBCode();
     $tfe = new TextFormattingEvent($in);
     $bb->receive_event($tfe);
     return $tfe->stripped;
 }
 /**
  * @return BBCode;
  */
 public function nbbc()
 {
     if ($this->_NBBC === null) {
         $plugin = new BBCode();
         $this->_NBBC = $plugin->nbbc();
         $this->_NBBC->setIgnoreNewlines(true);
         $this->_NBBC->addRule('attachment', array('mode' => Nbbc\BBCode::BBCODE_MODE_CALLBACK, 'method' => array($this, "DoAttachment"), 'class' => 'image', 'allow_in' => array('listitem', 'block', 'columns', 'inline', 'link'), 'end_tag' => Nbbc\BBCode::BBCODE_PROHIBIT, 'content' => Nbbc\BBCode::BBCODE_PROHIBIT, 'plain_start' => "[image]", 'plain_content' => array()));
     }
     return $this->_NBBC;
 }
 /**
  * @return BBCode;
  */
 public function NBBC()
 {
     if ($this->_NBBC === NULL) {
         require_once PATH_PLUGINS . '/HtmLawed/htmLawed/htmLawed.php';
         $Plugin = new NBBCPlugin('BBCodeRelaxed');
         $this->_NBBC = $Plugin->NBBC();
         $this->_NBBC->ignore_newlines = TRUE;
         $this->_NBBC->enable_smileys = FALSE;
         $this->_NBBC->AddRule('attachment', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, "DoAttachment"), 'class' => 'image', 'allow_in' => array('listitem', 'block', 'columns', 'inline', 'link'), 'end_tag' => BBCODE_PROHIBIT, 'content' => BBCODE_PROHIBIT, 'plain_start' => "[image]", 'plain_content' => array()));
     }
     return $this->_NBBC;
 }
Esempio n. 4
0
 function Parse($string)
 {
     global $config;
     require_once dirname(__FILE__) . '/nbbc/nbbc.php';
     $setup = new BBCode();
     if (!isset($config)) {
         // old compatibility mode
         $setup->SetSmileyURL(baseaddress() . 'smileys');
     } else {
         $setup->SetSmileyURL($config->getValue('baseaddress') . 'smileys');
     }
     // $setup->SetEnableSmileys(false);
     $setup->SetAllowAmpersand(true);
     // escape (x)html entities
     return $setup->Parse(htmlent($string));
 }
Esempio n. 5
0
File: bb.php Progetto: anqh/anqh
 /**
  * Create new BBCode object and initialize our own settings
  *
  * @param  string  $text
  */
 public function __construct($text = null)
 {
     parent::BBCode();
     $this->text = $text;
     // Automagically print hrefs
     $this->SetDetectURLs(true);
     // We have our own smileys
     $config = Kohana::$config->load('site.smiley');
     if (!empty($config)) {
         $this->ClearSmileys();
         $this->SetSmileyURL(URL::base() . $config['dir']);
         foreach ($config['smileys'] as $name => $smiley) {
             $this->AddSmiley($name, $smiley['src']);
         }
     } else {
         $this->SetEnableSmileys(false);
     }
     // We handle newlines with Kohana
     //$this->SetIgnoreNewlines(true);
     $this->SetPreTrim('a');
     $this->SetPostTrim('a');
     // User our own quote
     $this->AddRule('quote', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, 'bbcode_quote'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns'), 'content' => BBCODE_REQUIRED));
     // Media tags
     $this->AddRule('audio', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, 'bbcode_media'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns', 'inline'), 'allow' => array('align' => '/^left|center|right$/'), 'default' => array('align' => 'left'), 'content' => BBCODE_REQUIRED, 'plain_content' => array('')));
     $this->AddRule('video', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, 'bbcode_media'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns', 'inline'), 'allow' => array('align' => '/^left|center|right$/'), 'default' => array('align' => 'left'), 'content' => BBCODE_REQUIRED, 'plain_content' => array('')));
 }
function ShowSendMessagesPage()
{
    global $USER, $LNG;
    $ACTION = HTTP::_GP('action', '');
    if ($ACTION == 'send') {
        switch ($USER['authlevel']) {
            case AUTH_MOD:
                $class = 'mod';
                break;
            case AUTH_OPS:
                $class = 'ops';
                break;
            case AUTH_ADM:
                $class = 'admin';
                break;
            default:
                $class = '';
                break;
        }
        $Subject = HTTP::_GP('subject', '', true);
        $Message = HTTP::_GP('text', '', true);
        $Mode = HTTP::_GP('mode', 0);
        $Lang = HTTP::_GP('lang', '');
        if (!empty($Message) && !empty($Subject)) {
            require 'includes/classes/BBCode.class.php';
            if ($Mode == 0 || $Mode == 2) {
                $From = '<span class="' . $class . '">' . $LNG['user_level'][$USER['authlevel']] . ' ' . $USER['username'] . '</span>';
                $pmSubject = '<span class="' . $class . '">' . $Subject . '</span>';
                $pmMessage = '<span class="' . $class . '">' . BBCode::parse($Message) . '</span>';
                $USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
                while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
                    $sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
                    PlayerUtil::sendMessage($UserData['id'], $USER['id'], $From, 50, $pmSubject, $sendMessage, TIMESTAMP, NULL, 1, Universe::getEmulated());
                }
            }
            if ($Mode == 1 || $Mode == 2) {
                require 'includes/classes/Mail.class.php';
                $userList = array();
                $USERS = $GLOBALS['DATABASE']->query("SELECT `email`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
                while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
                    $userList[$UserData['email']] = array('username' => $UserData['username'], 'body' => BBCode::parse(str_replace('{USERNAME}', $UserData['username'], $Message)));
                }
                Mail::multiSend($userList, strip_tags($Subject));
            }
            exit($LNG['ma_message_sended']);
        } else {
            exit($LNG['ma_subject_needed']);
        }
    }
    $sendModes = $LNG['ma_modes'];
    if (Config::get()->mail_active == 0) {
        unset($sendModes[1]);
        unset($sendModes[2]);
    }
    $template = new template();
    $template->assign_vars(array('langSelector' => array_merge(array('' => $LNG['ma_all']), $LNG->getAllowedLangs(false)), 'modes' => $sendModes));
    $template->show('SendMessagesPage.tpl');
}
 public static function parse($code)
 {
     $bbcode = new BBCode();
     if (defined('SMILEY_DIR')) {
         $bbcode->SetSmileyDir(substr(SMILEY_PATH, 0, -1));
         $bbcode->SetSmileyURL(substr(SMILEY_DIR, 0, -1));
     }
     // A few backwards compatible issues
     $code = str_replace('[img:right]', '[img align="right"]', $code);
     /*
     	'quote' => Array(
     		'mode' => BBCODE_MODE_LIBRARY,
     		'method' => "DoQuote",
     		'allow_in' => Array('listitem', 'block', 'columns'),
     		'before_tag' => "sns",
     		'after_tag' => "sns",
     		'before_endtag' => "sns",
     		'after_endtag' => "sns",
     		'plain_start' => "\n<b>Quote:</b>\n",
     		'plain_end' => "\n",
     	),
     */
     // Open tags
     $bbcode->AddRule('open', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array(__CLASS__, 'DoOpen'), 'class' => 'link', 'allow_in' => array('listitem', 'block', 'columns', 'inline'), 'content' => BBCODE_REQUIRED, 'plain_start' => "<a href=\"{\$link}\">", 'plain_end' => "</a>", 'plain_content' => array('_content', '_default'), 'plain_link' => array('_default', '_content')));
     $bbcode->AddRule('colour', array('mode' => BBCODE_MODE_ENHANCED, 'allow' => array('_default' => '/^#?[a-zA-Z0-9._ -]+$/'), 'template' => '<span style="color:{$_default/tw}">{$_content/v}</span>', 'class' => 'inline', 'allow_in' => array('listitem', 'block', 'columns', 'inline', 'link')));
     for ($i = 1; $i < 5; $i++) {
         $bbcode->AddRule('h' . $i, array('simple_start' => "\n<h" . $i . ">\n", 'simple_end' => "\n</h" . $i . ">\n", 'allow_in' => array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n"));
     }
     $bbcode->AddRule('quote', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array(__CLASS__, 'DoQuote'), 'allow_in' => array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n<b>Quote:</b>\n", 'plain_end' => "\n"));
     $bbcode->AddRule('span', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array(__CLASS__, 'DoSpan'), 'allow_in' => array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n<b>Quote:</b>\n", 'plain_end' => "\n"));
     /*
     		'mode' => BBCODE_MODE_LIBRARY,
     		'method' => 'DoURL',
     		'class' => 'link',
     		'allow_in' => Array('listitem', 'block', 'columns', 'inline'),
     		'content' => BBCODE_REQUIRED,
     		'plain_start' => "<a href=\"{\$link}\">",
     		'plain_end' => "</a>",
     		'plain_content' => Array('_content', '_default'),
     		'plain_link' => Array('_default', '_content'),
     */
     $bbcode->AddRule('action', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array(__CLASS__, 'DoAction'), 'class' => 'link', 'allow_in' => array('listitem', 'block', 'columns', 'inline'), 'content' => BBCODE_REQUIRED, 'plain_start' => "<a href=\"{\$link}\">", 'plain_end' => "</a>", 'plain_content' => array('_content', '_default'), 'plain_link' => array('_default', '_content')));
     return '<div class="text">' . @$bbcode->Parse($code) . '</div>';
 }
Esempio n. 8
0
	/**
	 * Object Constructor
	 *
	 * @param
	 * @return	void
	 * @since	1.0
	 */
	function __construct() {
		parent::__construct ();
		$this->defaults = new KunenaBBCodeLibrary;
		$this->tag_rules = $this->defaults->default_tag_rules;
		$this->smileys = $this->defaults->default_smileys;
		if (empty($this->smileys)) $this->SetEnableSmileys(false);
		$this->SetSmileyDir ( JPATH_ROOT .'/'. KPATH_COMPONENT_RELATIVE );
		$this->SetSmileyURL ( JURI::root(true) . '/' . KPATH_COMPONENT_RELATIVE );
		$this->SetDetectURLs ( true );
	}
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $sujet = ForumSubjects::where("id", $id)->first();
     $categorie = ForumCategories::find($sujet->category);
     foreach ($sujet->messages as $message) {
         Date::setLocale('fr');
         $date = new Date($message->created);
         $message->when = $date->format('j F Y');
         $message->message = $this::text_humanized($message->message);
         $message->message = BBCode::parse($message->message);
     }
     return view('forum.sujets.show', ['categorie' => $categorie, "sujet" => $sujet]);
 }
Esempio n. 10
0
 /**
  * Object Constructor
  *
  * @return	void
  */
 function __construct($relative = true)
 {
     parent::__construct();
     $this->defaults = new KunenaBbcodeLibrary();
     $this->tag_rules = $this->defaults->default_tag_rules;
     $view = JString::strtolower(JRequest::getCmd('type', JRequest::getCmd('view', '')));
     $this->smileys = $this->defaults->default_smileys;
     if (empty($this->smileys)) {
         $this->SetEnableSmileys(false);
     }
     $this->SetSmileyDir(JPATH_ROOT);
     $this->SetSmileyURL($relative ? JURI::root(true) : rtrim(JURI::root(), '/'));
     $this->SetDetectURLs(true);
     $this->SetURLPattern(array($this, 'parseUrl'));
     $this->SetURLTarget('_blank');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaBbcodeConstruct', array($this));
 }
Esempio n. 11
0
File: BB.php Progetto: anqqa/Anqh
 /**
  * Create new BBCode object and initialize our own settings
  *
  */
 public function __construct($text = null)
 {
     parent::BBCode();
     $this->text = $text;
     // Automagically print hrefs
     $this->SetDetectURLs(true);
     // We have our own smileys
     $config = Kohana::config('site.smiley');
     if (!empty($config)) {
         $this->ClearSmileys();
         $this->SetSmileyURL(url::base() . $config['dir']);
         foreach ($config['smileys'] as $name => $smiley) {
             $this->AddSmiley($name, $smiley['src']);
         }
     } else {
         $this->SetEnableSmileys(false);
     }
     // We handle newlines with Kohana
     $this->SetIgnoreNewlines(true);
     $this->SetPreTrim('a');
     $this->SetPostTrim('a');
     // User our own quote
     $this->AddRule('quote', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, 'bbcode_quote'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns'), 'content' => BBCODE_REQUIRED));
 }
Esempio n. 12
0
<?php 
if (!$published || !empty($revision) || !empty($preview)) {
    ?>
<br /><br />
<blockquote>
<strong>Description:</strong><br />
<?php 
    echo $description;
    ?>
</blockquote>
<?php 
}
?>
	
	<p><?php 
echo BBCode::parse($body);
?>
</p>

<?php 
if (!empty($mlt)) {
    ?>
    <p><h4>More Like This:</h4>
<?php 
    foreach ($mlt as $fetched) {
        echo '<a href="' . Url::format('article/view/' . Id::create($fetched, 'news')) . '">' . $fetched['title'] . '</a><br />';
    }
    ?>
</p>
<?php 
}
 /**
  * This callback processes any custom BBCodes with parser.php
  */
 protected function callback_html($field)
 {
     // Strips Invision custom HTML first from $field before parsing $field to parser.php
     $invision_markup = $field;
     $invision_markup = html_entity_decode($invision_markup);
     // Replace '[html]' with '<pre><code>'
     $invision_markup = preg_replace('/\\[html\\]/', '<pre><code>', $invision_markup);
     // Replace '[/html]' with '</code></pre>'
     $invision_markup = preg_replace('/\\[\\/html\\]/', '</code></pre>', $invision_markup);
     // Replace '[sql]' with '<pre><code>'
     $invision_markup = preg_replace('/\\[sql\\]/', '<pre><code>', $invision_markup);
     // Replace '[/sql]' with '</code></pre>'
     $invision_markup = preg_replace('/\\[\\/sql\\]/', '</code></pre>', $invision_markup);
     // Replace '[php]' with '<pre><code>'
     $invision_markup = preg_replace('/\\[php\\]/', '<pre><code>', $invision_markup);
     // Replace '[/php]' with '</code></pre>'
     $invision_markup = preg_replace('/\\[\\/php\\]/', '</code></pre>', $invision_markup);
     // Replace '[xml]' with '<pre><code>'
     $invision_markup = preg_replace('/\\[xml\\]/', '<pre><code>', $invision_markup);
     // Replace '[/xml]' with '</code></pre>'
     $invision_markup = preg_replace('/\\[\\/xml\\]/', '</code></pre>', $invision_markup);
     // Replace '[CODE]' with '<pre><code>'
     $invision_markup = preg_replace('/\\[CODE\\]/', '<pre><code>', $invision_markup);
     // Replace '[/CODE]' with '</code></pre>'
     $invision_markup = preg_replace('/\\[\\/CODE\\]/', '</code></pre>', $invision_markup);
     // Replace '[quote:XXXXXXX]' with '<blockquote>'
     $invision_markup = preg_replace('/\\[quote:(.*?)\\]/', '<blockquote>', $invision_markup);
     // Replace '[quote="$1"]' with '<em>@$1 wrote:</em><blockquote>'
     $invision_markup = preg_replace('/\\[quote="(.*?)":(.*?)\\]/', '<em>@$1 wrote:</em><blockquote>', $invision_markup);
     // Replace '[/quote:XXXXXXX]' with '</blockquote>'
     $invision_markup = preg_replace('/\\[\\/quote:(.*?)\\]/', '</blockquote>', $invision_markup);
     // Replace '[twitter]$1[/twitter]' with '<a href="https://twitter.com/$1">@$1</a>"
     $invision_markup = preg_replace('/\\[twitter\\](.*?)\\[\\/twitter\\]/', '<a href="https://twitter.com/$1">@$1</a>', $invision_markup);
     // Replace '[member='username']' with '@username"
     $invision_markup = preg_replace('/\\[member=\'(.*?)\'\\]/', '@$1 ', $invision_markup);
     // Replace '[media]' with ''
     $invision_markup = preg_replace('/\\[media\\]/', '', $invision_markup);
     // Replace '[/media]' with ''
     $invision_markup = preg_replace('/\\[\\/media\\]/', '', $invision_markup);
     // Replace '[list:XXXXXXX]' with '<ul>'
     $invision_markup = preg_replace('/\\[list\\]/', '<ul>', $invision_markup);
     // Replace '[list=1:XXXXXXX]' with '<ul>'
     $invision_markup = preg_replace('/\\[list=1\\]/', '<ul>', $invision_markup);
     // Replace '[*:XXXXXXX]' with '<li>'
     $invision_markup = preg_replace('/\\[\\*\\](.*?)\\<br \\/\\>/', '<li>$1</li>', $invision_markup);
     // Replace '[/list:u:XXXXXXX]' with '</ul>'
     $invision_markup = preg_replace('/\\[\\/list\\]/', '</ul>', $invision_markup);
     // Replace '[hr]' with '<hr>"
     $invision_markup = preg_replace('/\\[hr\\]/', '<hr>', $invision_markup);
     // Replace '[font=XXXXXXX]' with ''
     $invision_markup = preg_replace('/\\[font=(.*?)\\]/', '', $invision_markup);
     // Replace '[/font]' with ''
     $invision_markup = preg_replace('/\\[\\/font\\]/', '', $invision_markup);
     // Replace any Invision smilies from path '/sp-resources/forum-smileys/sf-smily.gif' with the equivelant WordPress Smilie
     $invision_markup = preg_replace('/\\<img src=(.*?)EMO\\_DIR(.*?)bbc_emoticon(.*?)alt=\'(.*?)\' \\/\\>/', '$4', $invision_markup);
     $invision_markup = preg_replace('/\\:angry\\:/', ':mad:', $invision_markup);
     $invision_markup = preg_replace('/\\:mellow\\:/', ':neutral:', $invision_markup);
     $invision_markup = preg_replace('/\\:blink\\:/', ':eek:', $invision_markup);
     $invision_markup = preg_replace('/B\\)/', ':cool:', $invision_markup);
     $invision_markup = preg_replace('/\\:rolleyes\\:/', ':roll:', $invision_markup);
     $invision_markup = preg_replace('/\\:unsure\\:/', ':???:', $invision_markup);
     // Now that Invision custom HTML has been stripped put the cleaned HTML back in $field
     $field = $invision_markup;
     require_once bbpress()->admin->admin_dir . 'parser.php';
     $bbcode = BBCode::getInstance();
     $bbcode->enable_smileys = false;
     $bbcode->smiley_regex = false;
     return html_entity_decode($bbcode->Parse($field));
 }
Esempio n. 14
0
 /**
  * This is save info function, use it whatever saving or updating 
  * 
  * @param string $lowerItem
  * @param array $fields
  * @param array $systemFields
  * @param string $actionType
  * @return array 
  */
 public function saveInfo($lowerItem, $fields, $systemFields, $actionType, $compatible = false)
 {
     $item = ucfirst($lowerItem);
     $modelName = $item . 'InfoView';
     $model = new $modelName();
     $basicInfoFields = array_keys($model->attributes);
     $basicInfoFields[] = 'action_note';
     $basicInfo = array();
     $customInfo = array();
     $isNeedBBCodeTransfer = true;
     if (isset($fields['no_bbcode_transfer']) && !empty($fields['no_bbcode_transfer'])) {
         $isNeedBBCodeTransfer = false;
     }
     foreach ($fields as $key => $field) {
         if (in_array($key, $systemFields)) {
             continue;
         }
         if ($compatible) {
             if ('AssignedTo' == $key || 'ScriptedBy' == $key) {
                 $field = $this->getRealNameByName($field);
             } else {
                 if ('MailTo' == $key) {
                     $field = $this->getRealNamesByMailTo($field);
                 }
             }
             $key = $this->fieldOld2New($key, $lowerItem);
         }
         if ($isNeedBBCodeTransfer && in_array($key, array('action_note', 'repeat_step', 'case_step', 'result_step'))) {
             $field = BBCode::bbcode2html($field);
         }
         if ('no_bbcode_transfer' != $key && !in_array($key, $basicInfoFields)) {
             $customInfo[$key] = $field;
             continue;
         }
         $basicInfo[$key] = $field;
     }
     if (Info::ACTION_OPEN == $actionType && isset($basicInfo['id'])) {
         unset($basicInfo['id']);
     }
     if (Info::ACTION_OPEN_EDIT == $actionType && 'bug' == $lowerItem && isset($basicInfo['id'])) {
         $bug = BugInfo::model()->findByPk($basicInfo['id']);
         if (!isset($basicInfo['bug_status'])) {
             $basicInfo['bug_status'] = $bug->bug_status;
         }
         if (null !== $bug) {
             switch ($basicInfo['bug_status']) {
                 case BugInfo::STATUS_ACTIVE:
                     if (BugInfo::STATUS_ACTIVE !== $bug->bug_status) {
                         $actionType = BugInfo::ACTION_ACTIVATE;
                     } else {
                         $actionType = BugInfo::ACTION_OPEN_EDIT;
                     }
                     break;
                 case BugInfo::STATUS_RESOLVED:
                     if (BugInfo::STATUS_RESOLVED !== $bug->bug_status) {
                         $actionType = BugInfo::ACTION_RESOLVE;
                     } else {
                         $actionType = BugInfo::ACTION_RESOLVE_EDIT;
                     }
                     break;
                 case BugInfo::STATUS_CLOSED:
                     if (BugInfo::STATUS_CLOSED !== $bug->bug_status) {
                         $actionType = BugInfo::ACTION_CLOSE;
                     } else {
                         $actionType = BugInfo::ACTION_CLOSE_EDIT;
                     }
                     break;
                 default:
                     break;
             }
         }
     }
     $code = API::ERROR_NONE;
     $attachmentFile = CUploadedFile::getInstancesByName('attachment_file');
     $result = InfoService::saveInfo($lowerItem, $actionType, $basicInfo, $customInfo, $attachmentFile);
     $info = $result['detail'];
     if (CommonService::$ApiResult['FAIL'] === $result['status']) {
         $code = API::ERROR_SAVE_INFO;
     }
     return array($code, $info);
 }
Esempio n. 15
0
 function view()
 {
     global $USER, $LNG;
     require 'includes/classes/BBCode.class.php';
     $db = Database::get();
     $ticketID = HTTP::_GP('id', 0);
     $sql = "SELECT a.*, t.categoryID, t.status FROM %%TICKETS_ANSWER%% a INNER JOIN %%TICKETS%% t USING(ticketID) WHERE a.ticketID = :ticketID ORDER BY a.answerID;";
     $answerResult = $db->select($sql, array(':ticketID' => $ticketID));
     $answerList = array();
     if (empty($answerResult)) {
         $this->printMessage(sprintf($LNG['ti_not_exist'], $ticketID), array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=ticket')));
     }
     $ticket_status = 0;
     foreach ($answerResult as $answerRow) {
         $answerRow['time'] = _date($LNG['php_tdformat'], $answerRow['time'], $USER['timezone']);
         $answerRow['message'] = BBCode::parse($answerRow['message']);
         $answerList[$answerRow['answerID']] = $answerRow;
         if (empty($ticket_status)) {
             $ticket_status = $answerRow['status'];
         }
     }
     $categoryList = $this->ticketObj->getCategoryList();
     $this->assign(array('ticketID' => $ticketID, 'categoryList' => $categoryList, 'answerList' => $answerList, 'status' => $ticket_status));
     $this->display('page.ticket.view.tpl');
 }
Esempio n. 16
0
<?php

require '../include/mellivora.inc.php';
login_session_refresh();
head('Home');
if (cache_start('home', CONFIG_CACHE_TIME_HOME)) {
    require CONFIG_PATH_THIRDPARTY . 'nbbc/nbbc.php';
    $bbc = new BBCode();
    $bbc->SetEnableSmileys(false);
    $news = db_query_fetch_all('SELECT * FROM news ORDER BY added DESC');
    foreach ($news as $item) {
        echo '
        <div class="news-container">';
        section_head($item['title']);
        echo '
            <div class="news-body">
                ', $bbc->parse($item['body']), '
            </div>
        </div>
        ';
    }
    cache_end('home');
}
foot();
Esempio n. 17
0
 protected function callback_html($field)
 {
     require_once bbpress()->admin->admin_dir . 'parser.php';
     $bbcode = BBCode::getInstance();
     return html_entity_decode($bbcode->Parse($field));
 }
Esempio n. 18
0
 protected static function split_on_bbcodes($text, $allowed = 0, $allow_html = false)
 {
     global $bb_codes;
     # Split all bbcodes.
     $text_parts = BBCode::split_bbcodes($text);
     # Merge all bbcodes and do special actions depending on the type of code.
     $text = '';
     while ($part = array_shift($text_parts)) {
         if ($part['code'] == 'php') {
             # [PHP]
             $text .= $allowed ? BBCode::decode_php($part['text']) : nl2br(htmlspecialchars($part['text']));
         } elseif ($part['code'] == 'code') {
             # [CODE]
             if (!$allowed && false !== strpos($part['text'], '<')) {
                 $part['text'] = nl2br(htmlspecialchars($part['text']));
             }
             $text .= $allowed ? BBCode::decode_code($part['text']) : $part['text'];
         } elseif ($part['code'] == 'quote') {
             # [QUOTE] and [QUOTE=""]
             if ($part['text'][6] == ']') {
                 $text .= $bb_codes['quote'] . BBCode::split_on_bbcodes(substr($part['text'], 7, -8), $allowed, $allow_html) . $bb_codes['quote_close'];
             } else {
                 $part['text'] = preg_replace('/\\[quote=["]*(.*?)["]*\\]/si', $bb_codes['quote_name'], BBCode::split_on_bbcodes(substr($part['text'], 0, -8), $allowed, $allow_html), 1);
                 $text .= $part['text'] . $bb_codes['quote_close'];
             }
         } elseif ($part['subc']) {
             $tmptext = '[' . BBCode::split_on_bbcodes(substr($part['text'], 1, -1)) . ']';
             $text .= $part['code'] == 'list' ? BBCode::decode_list($tmptext) : $tmptext;
             unset($tmptext);
         } else {
             if ($allow_html) {
                 $tmptext = false === strpos($part['text'], '<') ? nl2br($part['text']) : $part['text'];
             } else {
                 $tmptext = nl2br(BBCode::encode_html($part['text']));
             }
             $text .= $part['code'] == 'list' ? BBCode::decode_list($tmptext) : $tmptext;
             unset($tmptext);
         }
     }
     return $text;
 }
Esempio n. 19
0
 public static function parse_html($content, $process_content_plugins = false, $bbcode = true, $autolink = true)
 {
     if ($bbcode) {
         require_once CJLIB_PATH . '/lib/nbbc/nbbc_main.php';
         $bbcode = new BBCode();
         $bbcode->SetSmileyURL(CJLIB_MEDIA_URI . '/smileys');
         $bbcode->SetSmileyDir(CJLIB_MEDIA_PATH . DS . 'smileys');
         $bbcode->SetTagMarker('[');
         $bbcode->SetAllowAmpersand(false);
         $bbcode->SetEnableSmileys(true);
         $bbcode->SetDetectURLs($autolink);
         $bbcode->SetPlainMode(false);
         $bbcode->SetDebug(false);
         $content = $bbcode->Parse($content);
     } else {
         if ($autolink) {
             require_once 'lib_autolink.php';
             $content = autolink_urls($content, 50, ' rel="nofollow"');
         }
     }
     if ($process_content_plugins) {
         $content = JHTML::_('content.prepare', $content);
     }
     return $content;
 }
Esempio n. 20
0
$email = preg_replace("[\r\n]", "", $email);
$sub = $sanitize->CleanStr($sub, 0);
//Or this
$sub = preg_replace("[\r\n]", "", $sub);
$url = $sanitize->CleanStr($url, 0);
//Or this
$url = preg_replace("[\r\n]", "", $url);
$resto = $sanitize->CleanStr($resto, 0);
//Or this
$resto = preg_replace("[\r\n]", "", $resto);
$com = $sanitize->CleanStr($com, $moderator);
//But they can with this.
$clean = $sanitize->process($name, $com, $sub, $email, $resto, $url, $dest, $moderator);
if (USE_BBCODE === true) {
    require_once CORE_DIR . '/general/text_process/bbcode.php';
    $bbcode = new BBCode();
    $clean['com'] = $bbcode->format($clean['com']);
}
if (SPOILERS && $spoiler) {
    $clean['sub'] = "SPOILER<>" . $clean['sub'];
}
if ($moderator && isset($_POST['showCap'])) {
    if ($moderator == 1) {
        $clean['name'] = '<span class="cap moderator" >' . $clean['name'] . ' ## Mod </span> <img src="http://3chan.ml/static/mod-icon.png" alt="Mod Icon" title="This user is a 3chan Modorator." style="margin-bottom: -3px;"/> ';
    }
    if ($moderator == 2) {
        $clean['name'] = '<span class="cap admin" >' . $clean['name'] . ' ## Admin </span> <img src="http://3chan.ml/static/admin-icon.png" alt="Admin Icon" title="This user is a 3chan Administrator." style="margin-bottom: -3px;"/>';
    }
    if ($moderator == 3) {
        $clean['name'] = '<span class="cap manager" >' . $clean['name'] . ' ## Manager  </span>';
    }
Esempio n. 21
0
 private function getBlogsReviews($thislist, $type = 'reviews')
 {
     $this->data['settings'] = $thislist;
     $hash = md5(serialize($thislist));
     $this->data['settings_hash'] = $hash;
     if ($this->customer->isLogged()) {
         $customer_group_id = $this->customer->getCustomerGroupId();
     } else {
         $customer_group_id = $this->config->get('config_customer_group_id');
     }
     $rate = array();
     $this->language->load('record/blog');
     $this->load->model('catalog/comment');
     $this->load->model('catalog/blog');
     $this->load->model('tool/image');
     if (isset($thislist['title_list_latest'][$this->config->get('config_language_id')])) {
         $this->data['heading_title'] = $thislist['title_list_latest'][$this->config->get('config_language_id')];
     } else {
         $this->data['heading_title'] = "";
     }
     $this->data['text_comments'] = $this->language->get('text_comments');
     $this->data['text_viewed'] = $this->language->get('text_viewed');
     $row = $this->cache->get('product.blog.reviews.' . (int) $this->config->get('config_language_id') . '.' . (int) $this->config->get('config_store_id') . '.' . (int) $customer_group_id . '.' . $hash);
     if (0 == 0 || empty($row)) {
         $comments = $this->model_catalog_comment->getCommentsByBlogsIN($thislist, 3);
         if (isset($comments) && count($comments) > 0) {
             foreach ($comments as $comment) {
                 if ($comment['type'] == 'blogs') {
                     $blog_href = $this->model_catalog_blog->getPathByBlog($comment['blog_id']);
                     $blog_link = $this->url->link('record/blog', 'blog_id=' . $blog_href['path']);
                     $record_link = $this->url->link('record/record', 'record_id=' . $comment['record_id'] . "&blog_id=" . $blog_href['path']);
                     $rate = $this->model_catalog_comment->getRatesByCommentId($comment['comment_id']);
                     $this->data['text_category'] = $this->language->get('text_blog');
                     $this->data['text_record'] = $this->language->get('text_record');
                 }
                 //$comment['type'] == 'blogs'
                 if ($comment['type'] == 'categories') {
                     if (isset($comment['review_id'])) {
                         $comment['comment_id'] = $comment['review_id'];
                     } else {
                         $comment['comment_id'] = '';
                     }
                     if (isset($comment['commentid'])) {
                         $comment['comment_id'] = $comment['commentid'];
                     } else {
                         $comment['comment_id'] = '';
                     }
                     if (isset($comment['product_id'])) {
                         $comment['record_id'] = $comment['product_id'];
                     } else {
                         if (!isset($comment['record_id'])) {
                             $comment['record_id'] = '';
                         }
                     }
                 }
                 //$comment['type'] == 'categories'
                 if ($comment['type'] == 'categories') {
                     $blog_href = $this->model_catalog_blog->getPathByCategory($comment['blog_id']);
                     $blog_link = $this->url->link('product/category', 'path=' . $blog_href['path']);
                     $record_link = $this->url->link('product/product', 'product_id=' . $comment['record_id'] . "&path=" . $blog_href['path']);
                     $rate = array();
                     $this->data['text_category'] = $this->language->get('text_category');
                     $this->data['text_record'] = $this->language->get('text_product');
                 }
                 //$comment['type'] == 'categories'
                 $rate_count = 0;
                 $rate_delta = 0;
                 $rate_delta_plus = 0;
                 $rate_delta_minus = 0;
                 foreach ($rate as $r) {
                     $rate_count = $r['rate_count'];
                     $rate_delta = $r['rate_delta'];
                     $rate_delta_plus = $r['rate_delta_plus'];
                     $rate_delta_minus = $r['rate_delta_minus'];
                 }
                 //$rate as $r
                 $this->load->model('tool/image');
                 if ($comment) {
                     if ($comment['image']) {
                         if (isset($thislist['avatar']['width']) && isset($thislist['avatar']['height']) && $thislist['avatar']['width'] != "" && $thislist['avatar']['height'] != "") {
                             $thumb = $this->model_tool_image->resize($comment['image'], $thislist['avatar']['width'], $thislist['avatar']['height'], 1);
                         } else {
                             $thumb = $this->model_tool_image->resize($comment['image'], 150, 150, 1);
                         }
                     } else {
                         $thumb = '';
                     }
                 } else {
                     $thumb = '';
                 }
                 if (!isset($comment['text'])) {
                     $comment['text'] = '';
                 }
                 //!isset($comment['text'])
                 if ($comment['text'] != '') {
                     $flag_desc = 'none';
                     if ($thislist['desc_symbols'] != '') {
                         $amount = $thislist['desc_symbols'];
                         $flag_desc = 'symbols';
                     }
                     //$thislist['desc_symbols'] != ''
                     if ($thislist['desc_words'] != '') {
                         $amount = $thislist['desc_words'];
                         $flag_desc = 'words';
                     }
                     //$thislist['desc_words'] != ''
                     if ($thislist['desc_pred'] != '') {
                         $amount = $thislist['desc_pred'];
                         $flag_desc = 'pred';
                     }
                     //$thislist['desc_pred'] != ''
                     switch ($flag_desc) {
                         case 'symbols':
                             $pattern = '/((.*?)\\S){0,' . $amount . '}/isu';
                             preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
                             $text = $out[0][0];
                             break;
                         case 'words':
                             $pattern = '/((.*?)\\x20){0,' . $amount . '}/isu';
                             preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
                             $text = $out[0][0];
                             break;
                         case 'pred':
                             $pattern = '/((.*?)\\.){0,' . $amount . '}/isu';
                             preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
                             $text = $out[0][0];
                             break;
                         case 'none':
                             $text = html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8');
                             break;
                     }
                     //$flag_desc
                 }
                 //$comment['text'] != ''
                 if ($text == '') {
                     $text = html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8');
                 }
                 //$text == ''
                 if ($this->rdate($this->language->get('text_date')) == $this->rdate($this->language->get('text_date'), strtotime($comment['date_added']))) {
                     $date_str = $this->language->get('text_today');
                 } else {
                     $date_str = $this->language->get('text_date');
                 }
                 $date_available = $this->rdate($date_str . $this->language->get('text_hours'), strtotime($comment['date_added']));
                 require_once DIR_SYSTEM . 'library/bbcode.class.php';
                 $text = strip_tags($text);
                 $text = BBCode::parse($text);
                 $this->data['comments'][] = array('comment_id' => $comment['comment_id'], 'parent_id' => $comment['parent_id'], 'blog_id' => $comment['blog_id'], 'blog_name' => $comment['blog_name'], 'blog_href' => $blog_link, 'blog_path' => $blog_href['path'], 'record_id' => $comment['record_id'], 'record_comments' => $comment['record_comments'], 'record_viewed' => $comment['record_viewed'], 'record_name' => $comment['record_name'], 'record_rating' => (int) $comment['rating_avg'], 'record_href' => $record_link, 'customer_id' => $comment['customer_id'], 'author' => $comment['author'], 'text' => $text, 'rating' => (int) $comment['rating'], 'rate_count' => $rate_count, 'rate_delta' => $rate_delta, 'rate_delta_plus' => $rate_delta_plus, 'rate_delta_minus' => $rate_delta_minus, 'date' => $date_available, 'image' => $comment['image'], 'thumb' => $thumb, 'text_category' => $this->data['text_category'], 'text_record' => $this->data['text_record']);
             }
             //$comments as $comment
         }
         //isset($comments) && count($comments) > 0
         $this->cache->set('product.blog.reviews.' . (int) $this->config->get('config_language_id') . '.' . (int) $this->config->get('config_store_id') . '.' . (int) $customer_group_id . '.' . $hash, $this->data);
     } else {
         $this->data = $row;
     }
     return $this->data;
 }
Esempio n. 22
0
<?php 
require_once "src/nbbc_main.php";
// Expanded version.
//require_once("nbbc.php");				// Condensed version.
$BBCodeTestSuite = array("Input Validation Tests", array('descr' => "Unknown tags like [foo] get ignored.", 'bbcode' => "This is [foo]a tag[/foo].", 'html' => "This is [foo]a tag[/foo]."), array('descr' => "Broken tags like [foo get ignored.", 'bbcode' => "This is [foo a tag.", 'html' => "This is [foo a tag."), array('descr' => "Broken tags like [/foo get ignored.", 'bbcode' => "This is [/foo a tag.", 'html' => "This is [/foo a tag."), array('descr' => "Broken tags like [] get ignored.", 'bbcode' => "This is [] a tag.", 'html' => "This is [] a tag."), array('descr' => "Broken tags like [/  ] get ignored.", 'bbcode' => "This is [/  ] a tag.", 'html' => "This is [/  ] a tag."), array('descr' => "Broken tags like [/ get ignored.", 'bbcode' => "This is [/ a tag.", 'html' => "This is [/ a tag."), array('descr' => "Broken [ tags before [b]real tags[/b] don't break the real tags.", 'bbcode' => "Broken [ tags before [b]real tags[/b] don't break the real tags.", 'html' => "Broken [ tags before <b>real tags</b> don't break the real tags."), array('descr' => "Broken [tags before [b]real tags[/b] don't break the real tags.", 'bbcode' => "Broken [tags before [b]real tags[/b] don't break the real tags.", 'html' => "Broken [tags before <b>real tags</b> don't break the real tags."), array('descr' => "[i][b]Mis-ordered nesting[/i][/b] gets fixed.", 'bbcode' => "[i][b]Mis-ordered nesting[/i][/b] gets fixed.", 'html' => "<i><b>Mis-ordered nesting</b></i> gets fixed."), array('descr' => "[url=][b]Mis-ordered nesting[/url][/b] gets fixed.", 'bbcode' => "[url=http://www.google.com][b]Mis-ordered nesting[/url][/b] gets fixed.", 'html' => "<a href=\"http://www.google.com\" class=\"bbcode_url\"><b>Mis-ordered nesting</b></a> gets fixed."), array('descr' => "[i]Unended blocks are automatically ended.", 'bbcode' => "[i]Unended blocks are automatically ended.", 'html' => "<i>Unended blocks are automatically ended.</i>"), array('descr' => "Unstarted blocks[/i] have their end tags ignored.", 'bbcode' => "Unstarted blocks[/i] have their end tags ignored.", 'html' => "Unstarted blocks[/i] have their end tags ignored."), array('descr' => "[b]Mismatched tags[/i] are not matched to each other.", 'bbcode' => "[b]Mismatched tags[/i] are not matched to each other.", 'html' => "<b>Mismatched tags[/i] are not matched to each other.</b>"), array('descr' => "[center]Inlines and [b]blocks get[/b] nested correctly[/center].", 'bbcode' => "[center]Inlines and [b]blocks get[/b] nested correctly[/center].", 'html' => "\n<div class=\"bbcode_center\" style=\"text-align:center\">\nInlines and <b>blocks get</b> nested correctly\n</div>\n."), array('descr' => "[b]Inlines and [center]blocks get[/center] nested correctly[/b].", 'bbcode' => "[b]Inlines and [center]blocks get[/center] nested correctly[/b].", 'html' => "<b>Inlines and </b>\n<div class=\"bbcode_center\" style=\"text-align:center\">\nblocks get\n</div>\nnested correctly."), array('descr' => "BBCode is [B]case-insensitive[/b].", 'bbcode' => "[cEnTeR][b]This[/B] is a [I]test[/i].[/CeNteR]", 'html' => "\n<div class=\"bbcode_center\" style=\"text-align:center\">\n<b>This</b> is a <i>test</i>.\n</div>\n"), array('descr' => "Plain text gets passed through unchanged.", 'bbcode' => "Plain text gets passed through unchanged.  b is not a tag and i is not a tag and neither is /i and neither is (b).", 'html' => "Plain text gets passed through unchanged.  b is not a tag and i is not a tag and neither is /i and neither is (b)."), "Special-Character Tests", array('descr' => "& and < and > and \" get replaced with HTML-safe equivalents.", 'bbcode' => "This <woo!> &\"yeah!\" 'sizzle'", 'html' => "This &lt;woo!&gt; &amp;&quot;yeah!&quot; 'sizzle'"), array('descr' => ":-) produces a smiley <img> element.", 'bbcode' => "This is a test of the emergency broadcasting system :-)", 'regex' => "/This is a test of the emergency broadcasting system <img src=\\\"smileys\\/smile.gif\\\" width=\\\"[0-9]*\\\" height=\\\"[0-9]*\\\" alt=\\\":-\\)\\\" title=\\\":-\\)\\\" class=\\\"bbcode_smiley\\\" \\/>/"), array('descr' => "--- does *not* produce a [rule] tag.", 'bbcode' => "This is a test of the --- emergency broadcasting system.", 'html' => "This is a test of the --- emergency broadcasting system."), array('descr' => "---- does *not* produce a [rule] tag.", 'bbcode' => "This is a test of the ---- emergency broadcasting system.", 'html' => "This is a test of the ---- emergency broadcasting system."), array('descr' => "----- produces a [rule] tag.", 'bbcode' => "This is a test of the ----- emergency broadcasting system.", 'html' => "This is a test of the\n<hr class=\"bbcode_rule\" />\nemergency broadcasting system."), array('descr' => "--------- produces a [rule] tag.", 'bbcode' => "This is a test of the --------- emergency broadcasting system.", 'html' => "This is a test of the\n<hr class=\"bbcode_rule\" />\nemergency broadcasting system."), array('descr' => "[-] does *not* produce a comment.", 'bbcode' => "This is a test of the [- emergency broadcasting] system.", 'html' => "This is a test of the [- emergency broadcasting] system."), array('descr' => "[--] produces a comment.", 'bbcode' => "This is a test of the [-- emergency broadcasting] system.", 'html' => "This is a test of the  system."), array('descr' => "[----] produces a comment.", 'bbcode' => "This is a test of the [---- emergency broadcasting] system.", 'html' => "This is a test of the  system."), array('descr' => "[--] comments may contain - and [ and \" and ' characters.", 'bbcode' => "This is a test of the [-- emergency - [ \" ' broadcasting] system.", 'html' => "This is a test of the  system."), array('descr' => "[--] comments may *not* contain newlines.", 'bbcode' => "This is a test of the [-- emergency\n\rbroadcasting] system.", 'html' => "This is a test of the [-- emergency<br />\nbroadcasting] system."), array('descr' => "['] produces a comment.", 'bbcode' => "This is a test of the ['emergency broadcasting] system.", 'html' => "This is a test of the  system."), array('descr' => "['] comments may contain [ and \" and ' characters.", 'bbcode' => "This is a test of the ['emergency [ \" ' broadcasting] system.", 'html' => "This is a test of the  system."), array('descr' => "['] comments may *not* contain newlines.", 'bbcode' => "This is a test of the [' emergency\n\rbroadcasting] system.", 'html' => "This is a test of the [' emergency<br />\nbroadcasting] system."), array('descr' => "[!-- --] produces a comment.", 'bbcode' => "This is a test of the [!-- emergency broadcasting --] system.", 'html' => "This is a test of the  system."), array('descr' => "[!-- ] does *not* produce a viable comment.", 'bbcode' => "This is a test of the [!-- emergency broadcasting ] system.", 'html' => "This is a test of the [!-- emergency broadcasting ] system."), array('descr' => "[!-- - -- ] [ --] produces a comment.", 'bbcode' => "This is a test of the [!-- emergency - broadcasting -- system ] thingy --].", 'html' => "This is a test of the ."), array('descr' => "[!-- - -- ] [ --] --] produces a comment with a --] left over.", 'bbcode' => "This is a test of the [!-- emergency - broadcasting -- system ] thingy --] and other --] stuff.", 'html' => "This is a test of the  and other --] stuff."), array('descr' => "[!-- --] does not break any following tags outside it.", 'bbcode' => "The [!-- quick brown --]fox jumps over the [b]lazy[/b] [i]dog[/i].", 'html' => "The fox jumps over the <b>lazy</b> <i>dog</i>."), array('descr' => "Tag marker mode '<' works correctly.", 'bbcode' => "This is <b>a <i>test</b></i>.", 'html' => "This is <b>a <i>test</i></b>.", 'tag_marker' => '<'), array('descr' => "Tag marker mode '{' works correctly.", 'bbcode' => "This is {b}a {i}test{/b}{/i}.", 'html' => "This is <b>a <i>test</i></b>.", 'tag_marker' => '{'), array('descr' => "Tag marker mode '(' works correctly.", 'bbcode' => "This is (b)a (i)test(/b)(/i).", 'html' => "This is <b>a <i>test</i></b>.", 'tag_marker' => '('), array('descr' => "Ampersand pass-through mode works correctly.", 'bbcode' => "This is <b>a <i>test</b></i> &amp; some junk.", 'html' => "This is <b>a <i>test</i></b> &amp; some junk.", 'tag_marker' => '<'), "Whitespace Tests", array('descr' => "Newlines get replaced with <br /> tags.", 'bbcode' => "This\nis\r\na\n\rtest.", 'html' => "This<br />\nis<br />\na<br />\ntest."), array('descr' => "Newlines *don't* get replaced with <br /> tags in ignore-newline mode.", 'bbcode' => "This\nis\r\na\n\rtest.", 'html' => "This\nis\na\ntest.", 'newline_ignore' => true), array('descr' => "Space before and after newlines gets removed.", 'bbcode' => "This \n \t is \na\n test.", 'html' => "This<br />\nis<br />\na<br />\ntest."), array('descr' => "Whitespace doesn't matter inside tags after the tag name.", 'bbcode' => "This [size = 4  ]is a test[/size ].", 'html' => "This <span style=\"font-size:1.17em\">is a test</span>."), array('descr' => "Whitespace does matter inside \"quotes\" in tags.", 'bbcode' => "This [wstest=\"  Courier   New  \"]is a test[/wstest].", 'html' => "This <span style=\"wstest:  Courier   New  \">is a test</span>."), array('descr' => "Whitespace does matter inside 'quotes' in tags.", 'bbcode' => "This [wstest='  Courier   New  ']is a test[/wstest].", 'html' => "This <span style=\"wstest:  Courier   New  \">is a test</span>."), array('descr' => "Whitespace is properly collapsed near block tags like [center].", 'bbcode' => "Not centered.    \n    \n    [center]    \n    \n    A bold stone gathers no italics.    \n    \n    [/center]    \n    \n    Not centered.", 'html' => "Not centered.<br />\n" . "\n<div class=\"bbcode_center\" style=\"text-align:center\">\n" . "<br />\n" . "A bold stone gathers no italics.<br />\n" . "\n</div>\n" . "<br />\n" . "Not centered."), array('descr' => "[code]...[/code] should strip whitespace outside it but not inside it.", 'bbcode' => "Not\ncode.\n" . "[code]    \n\n    This is a test.    \n\n    [/code]\n" . "Also not code.\n", 'html' => "Not<br />\ncode.\n" . "<div class=\"bbcode_code\">\n" . "<div class=\"bbcode_code_head\">Code:</div>\n" . "<div class=\"bbcode_code_body\" style=\"white-space:pre\">\n    This is a test.    \n</div>\n" . "</div>\n" . "Also not code.<br />\n"), array('descr' => "[list] and [*] must consume correct quantities of whitespace.", 'bbcode' => "[list]\n\n\t[*] One Box\n\n\t[*] Two Boxes\n\t[*] \n Three Boxes\n\n[/list]\n", 'html' => "\n<ul class=\"bbcode_list\">\n<br />\n<li>One Box<br />\n</li>\n<li>Two Boxes</li>\n<li><br />\nThree Boxes<br />\n</li>\n</ul>\n"), "Inline Tag Conversion Tests", array('descr' => "[i] gets correctly converted.", 'bbcode' => "This is a test of the [i]emergency broadcasting system[/i].", 'html' => "This is a test of the <i>emergency broadcasting system</i>."), array('descr' => "[b] gets correctly converted.", 'bbcode' => "This is a test of the [b]emergency broadcasting system[/b].", 'html' => "This is a test of the <b>emergency broadcasting system</b>."), array('descr' => "[u] gets correctly converted.", 'bbcode' => "This is a test of the [u]emergency broadcasting system[/u].", 'html' => "This is a test of the <u>emergency broadcasting system</u>."), array('descr' => "[s] gets correctly converted.", 'bbcode' => "This is a test of the [s]emergency broadcasting system[/s].", 'html' => "This is a test of the <strike>emergency broadcasting system</strike>."), array('descr' => "[sup] gets correctly converted.", 'bbcode' => "This is a test of the [sup]emergency broadcasting system[/sup].", 'html' => "This is a test of the <sup>emergency broadcasting system</sup>."), array('descr' => "[sub] gets correctly converted.", 'bbcode' => "This is a test of the [sub]emergency broadcasting system[/sub].", 'html' => "This is a test of the <sub>emergency broadcasting system</sub>."), array('descr' => "[font=Arial] gets correctly converted (simple font name).", 'bbcode' => "This is a test of the [font=Arial]emergency broadcasting system[/font].", 'html' => "This is a test of the <span style=\"font-family:'Arial'\">emergency broadcasting system</span>."), array('descr' => "[font=Times New Roman] gets correctly converted (unquoted default value).", 'bbcode' => "This is a test of the [font=Times New Roman]emergency broadcasting system[/font].", 'html' => "This is a test of the <span style=\"font-family:'Times New Roman'\">emergency broadcasting system</span>."), array('descr' => "[font=Times New Roman size=1] gets converted (trailing parameter identified).", 'bbcode' => "This is a test of the [font=Times New Roman size=1]emergency broadcasting system[/font].", 'html' => "This is a test of the <span style=\"font-family:'Times New Roman'\">emergency broadcasting system</span>."), array('descr' => "[font=\"Courier New\"] gets correctly converted (quoted default value).", 'bbcode' => "This is a test of the [font=\"Courier New\"]emergency broadcasting system[/font].", 'html' => "This is a test of the <span style=\"font-family:'Courier New'\">emergency broadcasting system</span>."), array('descr' => "[font=\"Courier New\" blarg size=1] gets converted (floating parameter ignored).", 'bbcode' => "This is a test of the [font=\"Courier New\" blarg size=1]emergency broadcasting system[/font].", 'html' => "This is a test of the <span style=\"font-family:'Courier New'\">emergency broadcasting system</span>."), array('descr' => "[size=6] gets correctly converted.", 'bbcode' => "This is a test of the [size=6]emergency broadcasting system[/size].", 'html' => "This is a test of the <span style=\"font-size:2.0em\">emergency broadcasting system</span>."), array('descr' => "[size=10] gets correctly converted.", 'bbcode' => "This is a test of the [size=10]emergency broadcasting system[/size].", 'html' => "This is a test of the <span style=\"font-size:1.0em\">emergency broadcasting system</span>."), array('descr' => "[size=blah] gets ignored.", 'bbcode' => "This is a test of the [size=blah]emergency broadcasting system[/size].", 'html' => "This is a test of the [size=blah]emergency broadcasting system[/size]."), array('descr' => "[color=red] gets correctly converted.", 'bbcode' => "This is a test of the [color=red]emergency broadcasting system[/color].", 'html' => "This is a test of the <span style=\"color:red\">emergency broadcasting system</span>."), array('descr' => "[color=gronk] gets correctly converted.", 'bbcode' => "This is a test of the [color=gronk]emergency broadcasting system[/color].", 'html' => "This is a test of the <span style=\"color:gronk\">emergency broadcasting system</span>."), array('descr' => "[color=#FFF] gets correctly converted.", 'bbcode' => "This is a test of the [color=#FFF]emergency broadcasting system[/color].", 'html' => "This is a test of the <span style=\"color:#FFF\">emergency broadcasting system</span>."), array('descr' => "[color=*#\$] is prohibited.", 'bbcode' => "This is a test of the [color=*#\$]emergency broadcasting system[/color].", 'html' => "This is a test of the [color=*#\$]emergency broadcasting system[/color]."), array('descr' => "[spoiler] gets converted.", 'bbcode' => "Ssh, don't tell, but [spoiler]Darth is Luke's father[/spoiler]!", 'html' => "Ssh, don't tell, but <span class=\"bbcode_spoiler\">Darth is Luke's father</span>!"), array('descr' => "[acronym] gets converted.", 'bbcode' => "The [acronym=\"British Broadcasting Company\"]BBC[/acronym] airs [i]Doctor Who[/i] on Saturdays.", 'html' => "The <span class=\"bbcode_acronym\" title=\"British Broadcasting Company\">BBC</span> airs <i>Doctor Who</i> on Saturdays."), "URL Tests", array('descr' => "[url=...] (with no protocol given) gets converted.", 'bbcode' => "This is a test of the [url=fleeb.html]emergency broadcasting system[/url].", 'html' => "This is a test of the <a href=\"fleeb.html\" class=\"bbcode_url\">emergency broadcasting system</a>."), array('descr' => "[url=http:...] gets converted.", 'bbcode' => "This is a test of the [url=http://www.google.com]emergency broadcasting system[/url].", 'html' => "This is a test of the <a href=\"http://www.google.com\" class=\"bbcode_url\">emergency broadcasting system</a>."), array('descr' => "[url=http:...] gets converted correctly in plain mode.", 'bbcode' => "This is a test of the [url=http://www.google.com]emergency broadcasting system[/url].", 'html' => "This is a test of the <a href=\"http://www.google.com\">emergency broadcasting system</a>.", 'plainmode' => true), array('descr' => "Unquoted [url=http:...] with parameters gets converted.", 'bbcode' => "This is a test of the [url=http://www.google.com?q=broadcasting&y=foo&x=bar]emergency broadcasting system[/url].", 'html' => "This is a test of the <a href=\"http://www.google.com?q=broadcasting&amp;y=foo&amp;x=bar\" class=\"bbcode_url\">emergency broadcasting system</a>."), array('descr' => "[url=https:...] gets converted.", 'bbcode' => "This is a test of the [url=https://www.google.com]emergency broadcasting system[/url].", 'html' => "This is a test of the <a href=\"https://www.google.com\" class=\"bbcode_url\">emergency broadcasting system</a>."), array('descr' => "[url=ftp:...] gets converted.", 'bbcode' => "This is a test of the [url=ftp://www.google.com]emergency broadcasting system[/url].", 'html' => "This is a test of the <a href=\"ftp://www.google.com\" class=\"bbcode_url\">emergency broadcasting system</a>."), array('descr' => "[url=mailto:...] gets converted.", 'bbcode' => "This is a test of the [url=mailto:john@example.com]emergency broadcasting system[/url].", 'html' => "This is a test of the <a href=\"mailto:john@example.com\" class=\"bbcode_url\">emergency broadcasting system</a>."), array('descr' => "[url=javascript:...] is prohibited.", 'bbcode' => "This is a test of the [url=javascript:alert()]emergency broadcasting system[/url].", 'html' => "This is a test of the [url=javascript:alert()]emergency broadcasting system[/url]."), array('descr' => "[url=(unknown protocol):...] is prohibited.", 'bbcode' => "This is a test of the [url=flooble:blarble]emergency broadcasting system[/url].", 'html' => "This is a test of the [url=flooble:blarble]emergency broadcasting system[/url]."), array('descr' => "The [url]http://...[/url] form works correctly.", 'bbcode' => "The [url]http://www.google.com[/url] form works correctly.", 'html' => "The <a href=\"http://www.google.com\" class=\"bbcode_url\">http://www.google.com</a> form works correctly."), array('descr' => "The [url]http://...[/url] form works correctly in plain mode.", 'bbcode' => "The [url]http://www.google.com[/url] form works correctly.", 'html' => "The <a href=\"http://www.google.com\">http://www.google.com</a> form works correctly.", 'plainmode' => true), array('descr' => "The [url]malformed...url...[/url] form is fully unprocessed.", 'bbcode' => "The [url]a.imagehost.org/view/egdgdo[/url] form is fully unprocessed.", 'html' => "The <a href=\"a.imagehost.org/view/egdgdo\" class=\"bbcode_url\">a.imagehost.org/view/egdgdo</a> form is fully unprocessed."), array('descr' => "[url=\"...=...\"] contains an embedded equal sign (quotes work correctly).", 'bbcode' => "The [url=\"http://www.google.com/?foo=bar&baz=frob\" bar=foo]link[/url] works correctly.", 'html' => "The <a href=\"http://www.google.com/?foo=bar&amp;baz=frob\" class=\"bbcode_url\">link</a> works correctly."), array('descr' => "[url=\"...=...\"] contains an embedded equal sign (test #2).", 'bbcode' => "The [url=\"http://www.demourl.com/opinion.php?idopinion=234\"]Opinion[/url] is funny.", 'html' => "The <a href=\"http://www.demourl.com/opinion.php?idopinion=234\" class=\"bbcode_url\">Opinion</a> is funny."), array('descr' => "[url=\"...\" target=\"...\"] has its target ignored by default.", 'bbcode' => "The [url=\"http://www.demourl.com/opinion.php?idopinion=234\" target=_blank]Opinion[/url] is funny.", 'html' => "The <a href=\"http://www.demourl.com/opinion.php?idopinion=234\" class=\"bbcode_url\">Opinion</a> is funny."), array('descr' => "[url=\"...\" target=\"...\"] has its target used when URL targeting is enabled.", 'bbcode' => "The [url=\"http://www.demourl.com/opinion.php?idopinion=234\" target=_blank]Opinion[/url] is funny.", 'html' => "The <a href=\"http://www.demourl.com/opinion.php?idopinion=234\" class=\"bbcode_url\" target=\"_blank\">Opinion</a> is funny.", 'urltarget' => true), array('descr' => "[url] has a target applied when forced URL targeting is enabled.", 'bbcode' => "The [url=\"http://www.demourl.com/opinion.php?idopinion=234\"]Opinion[/url] is funny.", 'html' => "The <a href=\"http://www.demourl.com/opinion.php?idopinion=234\" class=\"bbcode_url\" target=\"somewhere\">Opinion</a> is funny.", 'urlforcetarget' => "somewhere"), array('descr' => "[url target=\"...\"] has its target ignored when forced URL targeting is enabled.", 'bbcode' => "The [url=\"http://www.demourl.com/opinion.php?idopinion=234\" target=\"_blank\"]Opinion[/url] is funny.", 'html' => "The <a href=\"http://www.demourl.com/opinion.php?idopinion=234\" class=\"bbcode_url\" target=\"somewhere\">Opinion</a> is funny.", 'urlforcetarget' => "somewhere"), array('descr' => "[url] has a target applied even with URL target overriding.", 'bbcode' => "The [url=\"http://www.demourl.com/opinion.php?idopinion=234\"]Opinion[/url] is funny.", 'html' => "The <a href=\"http://www.demourl.com/opinion.php?idopinion=234\" class=\"bbcode_url\" target=\"somewhere\">Opinion</a> is funny.", 'urlforcetarget' => "somewhere", 'urltarget' => 'override'), array('descr' => "[url target=\"...\"] has its target applied with URL target overriding.", 'bbcode' => "The [url=\"http://www.demourl.com/opinion.php?idopinion=234\" target=\"_blank\"]Opinion[/url] is funny.", 'html' => "The <a href=\"http://www.demourl.com/opinion.php?idopinion=234\" class=\"bbcode_url\" target=\"_blank\">Opinion</a> is funny.", 'urlforcetarget' => "somewhere", 'urltarget' => 'override'), array('descr' => "[url=(includes a smiley)] is not converted into a smiley.", 'bbcode' => "This is a test of the [url=http://www.google.com/foo:-P]emergency broadcasting system[/url].", 'html' => "This is a test of the <a href=\"http://www.google.com/foo:-P\" class=\"bbcode_url\">emergency broadcasting system</a>."), "Embedded URL Tests", array('descr' => "Embedded URLs get detected and converted.", 'bbcode' => "Go to http://www.google.com for your search needs!", 'html' => "Go to <a href=\"http://www.google.com/\">http://www.google.com</a> for your search needs!", 'detect_urls' => true), array('descr' => "Embedded HTTPS URLs get detected and converted.", 'bbcode' => "Go to https://www.google.com for your search needs!", 'html' => "Go to <a href=\"https://www.google.com/\">https://www.google.com</a> for your search needs!", 'detect_urls' => true), array('descr' => "Embedded FTP URLs get detected and converted.", 'bbcode' => "Go to ftp://www.google.com for your search needs!", 'html' => "Go to <a href=\"ftp://www.google.com/\">ftp://www.google.com</a> for your search needs!", 'detect_urls' => true), array('descr' => "Embedded Javascript URLs are properly ignored.", 'bbcode' => "Go to javascript:foo.com;alert(); for your search needs!", 'html' => "Go to javascript:<a href=\"http://foo.com/\">foo.com</a>;alert(); for your search needs!", 'detect_urls' => true), array('descr' => "Embedded domain names get detected and converted.", 'bbcode' => "Go to www.google.com for your search needs!", 'html' => "Go to <a href=\"http://www.google.com/\">www.google.com</a> for your search needs!", 'detect_urls' => true), array('descr' => "Embedded IPs get detected and converted.", 'bbcode' => "Go to 127.0.0.1:667/flarb for your own computer!", 'html' => "Go to <a href=\"http://127.0.0.1:667/flarb\">127.0.0.1:667/flarb</a> for your own computer!", 'detect_urls' => true), array('descr' => "Embedded addresses are smart about being inside parentheses.", 'bbcode' => "I love Google! (google.com)", 'html' => "I love Google! (<a href=\"http://google.com/\">google.com</a>)", 'detect_urls' => true), array('descr' => "Embedded-URL detector disallows junk that only seems like a URL.", 'bbcode' => "I browse alt.net.screw-you:80/flarb all the time.", 'html' => "I browse alt.net.screw-you:80/flarb all the time.", 'detect_urls' => true), array('descr' => "Embedded-URL detector also detects e-mail addresses.", 'bbcode' => "Send complaints to complaints@whitehouse.gov .", 'html' => "Send complaints to <a href=\"mailto:complaints@whitehouse.gov\">complaints@whitehouse.gov</a> .", 'detect_urls' => true), array('descr' => "Embedded-URL detector takes precedence over the smiley detector.", 'bbcode' => "This is a good dictionary:  http://www.amazon.com/Oxford-Dictionary-American-Usage-Style/dp/0195135083/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1217890161&sr=8-1&x=p", 'html' => "This is a good dictionary:  <a href=\"http://www.amazon.com/Oxford-Dictionary-American-Usage-Style/dp/0195135083/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1217890161&amp;sr=8-1&amp;x=p\">http://www.amazon.com/Oxford-Dictionary-American-Usage-Style/dp/0195135083/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1217890161&amp;sr=8-1&amp;x=p</a>", 'detect_urls' => true), "Special URL-Like-Tag Tests", array('descr' => "[email] gets converted.", 'bbcode' => "Send complaints to [email]john@example.com[/email].", 'html' => "Send complaints to <a href=\"mailto:john@example.com\" class=\"bbcode_email\">john@example.com</a>."), array('descr' => "[email] supports both forms.", 'bbcode' => "Send complaints to [email=john@example.com]John Smith[/email].", 'html' => "Send complaints to <a href=\"mailto:john@example.com\" class=\"bbcode_email\">John Smith</a>."), array('descr' => "Bad addresses in [email] are ignored.", 'bbcode' => "Send complaints to [email]jo\"hn@@@exa:mple.com[/email].", 'html' => "Send complaints to [email]jo&quot;hn@@@exa:mple.com[/email]."), array('descr' => "The [[wiki]] special tag produces a wiki link.", 'bbcode' => "This is a test of the [[wiki]] tag.", 'html' => "This is a test of the <a href=\"/?page=wiki\" class=\"bbcode_wiki\">wiki</a> tag."), array('descr' => "The [[wiki]] special tag does not convert [a-zA-Z0-9'\".:_-].", 'bbcode' => "This is a test of the [[\"Ab1cd'Ef2gh_Ij3kl.,Mn4op:Qr9st-Uv0wx\"]] tag.", 'html' => "This is a test of the <a href=\"/?page=%22Ab1cd%27Ef2gh_Ij3kl.%2CMn4op%3AQr9st_Uv0wx%22\" class=\"bbcode_wiki\">&quot;Ab1cd'Ef2gh_Ij3kl.,Mn4op:Qr9st-Uv0wx&quot;</a> tag."), array('descr' => "The [[wiki]] special tag can contain spaces.", 'bbcode' => "This is a test of the [[northwestern salmon]].", 'html' => "This is a test of the <a href=\"/?page=northwestern_salmon\" class=\"bbcode_wiki\">northwestern salmon</a>."), array('descr' => "The [[wiki]] special tag cannot contain newlines.", 'bbcode' => "This is a test of the [[northwestern\nsalmon]].", 'html' => "This is a test of the [[northwestern<br />\nsalmon]]."), array('descr' => "The [[wiki]] special tag can contain a title after a | character.", 'bbcode' => "This is a test of the [[northwestern salmon|Northwestern salmon are yummy!]].", 'html' => "This is a test of the <a href=\"/?page=northwestern_salmon\" class=\"bbcode_wiki\">Northwestern salmon are yummy!</a>."), array('descr' => "The [[wiki]] special tag doesn't damage anything outside it.", 'bbcode' => "I really loved reading [[arc 1|the first story arc]] because it was more entertaining than [[arc 2|the second story arc]] was.", 'html' => "I really loved reading <a href=\"/?page=arc_1\" class=\"bbcode_wiki\">the first story arc</a> because it was more entertaining than <a href=\"/?page=arc_2\" class=\"bbcode_wiki\">the second story arc</a> was."), array('descr' => "The [[wiki]] special tag condenses and trims internal whitespace.", 'bbcode' => "This is a test of the [[  northwestern \t salmon   |   Northwestern   salmon are   yummy!  ]].", 'html' => "This is a test of the <a href=\"/?page=northwestern_salmon\" class=\"bbcode_wiki\">Northwestern   salmon are   yummy!</a>."), "Images and Replaced-Tag Conversion Tests", array('descr' => "[img] produces an image.", 'bbcode' => "This is Google's logo: [img]http://www.google.com/intl/en_ALL/images/logo.gif[/img].", 'html' => "This is Google's logo: <img src=\"http://www.google.com/intl/en_ALL/images/logo.gif\" alt=\"logo.gif\" class=\"bbcode_img\" />."), array('descr' => "[img] disallows a javascript: URL.", 'bbcode' => "This is Google's logo: [img]javascript:alert()[/img].", 'html' => "This is Google's logo: [img]javascript:alert()[/img]."), array('descr' => "[img] disallows a URL with an unknown protocol type.", 'bbcode' => "This is Google's logo: [img]foobar:bar.jpg[/img].", 'html' => "This is Google's logo: [img]foobar:bar.jpg[/img]."), array('descr' => "[img] disallows HTML content.", 'bbcode' => "This is Google's logo: [img]<a href='javascript:alert(\"foo\")'>click me</a>[/img].", 'html' => "This is Google's logo: [img]&lt;a href='javascript:alert(&quot;foo&quot;)'&gt;click me&lt;/a&gt;[/img]."), array('descr' => "[img] can produce a local image.", 'bbcode' => "This is a smiley: [img]smile.gif[/img].", 'html' => "This is a smiley: <img src=\"smileys/smile.gif\" alt=\"smile.gif\" width=\"16\" height=\"16\" class=\"bbcode_img\" />."), array('descr' => "[img] can produce a local rooted URL.", 'bbcode' => "This is a smiley: [img]/smile.gif[/img].", 'html' => "This is a smiley: <img src=\"/smile.gif\" alt=\"smile.gif\" class=\"bbcode_img\" />."), array('descr' => "[img] can produce a local relative URL.", 'bbcode' => "This is a smiley: [img]../smile.gif[/img].", 'html' => "This is a smiley: <img src=\"../smile.gif\" alt=\"smile.gif\" class=\"bbcode_img\" />."), array('descr' => "[img] will skip nonexistent local images.", 'bbcode' => "This is a smiley: [img]flarb.gif[/img].", 'html' => "This is a smiley: [img]flarb.gif[/img]."), array('descr' => "[rule] produces a horizontal rule.", 'bbcode' => "This is a test of the [rule] emergency broadcasting system.", 'html' => "This is a test of the\n<hr class=\"bbcode_rule\" />\nemergency broadcasting system."), array('descr' => "[br] is equivalent to a newline.", 'bbcode' => "This is a newline.    [br]    And here we are!    \n  And more!", 'html' => "This is a newline.<br />\nAnd here we are!<br />\nAnd more!"), "Block Tag Conversion Tests", array('descr' => "[center]...[/center] should produce centered alignment.", 'bbcode' => "Not centered.[center]A [b]bold[/b] stone gathers no italics.[/center]Not centered.", 'html' => "Not centered.\n" . "<div class=\"bbcode_center\" style=\"text-align:center\">\n" . "A <b>bold</b> stone gathers no italics.\n" . "</div>\n" . "Not centered."), array('descr' => "[left]...[/left] should produce left alignment.", 'bbcode' => "Not left.[left]A [b]bold[/b] stone gathers no italics.[/left]Not left.", 'html' => "Not left.\n" . "<div class=\"bbcode_left\" style=\"text-align:left\">\n" . "A <b>bold</b> stone gathers no italics.\n" . "</div>\n" . "Not left."), array('descr' => "[right]...[/right] should produce right alignment.", 'bbcode' => "Not right.[right]A [b]bold[/b] stone gathers no italics.[/right]Not right.", 'html' => "Not right.\n" . "<div class=\"bbcode_right\" style=\"text-align:right\">\n" . "A <b>bold</b> stone gathers no italics.\n" . "</div>\n" . "Not right."), array('descr' => "[indent]...[/indent] should produce indented content.", 'bbcode' => "Not indented.[indent]A [b]bold[/b] stone gathers no italics.[/indent]Not indented.", 'html' => "Not indented.\n" . "<div class=\"bbcode_indent\" style=\"margin-left:4em\">\n" . "A <b>bold</b> stone gathers no italics.\n" . "</div>\n" . "Not indented."), array('descr' => "[code]...[/code] should reproduce its contents exactly as they're given.", 'bbcode' => "Not code." . "[code]A [b]and[/b] & <woo>!\n\tAnd a ['hey'] and a [/nonny] and a ho ho ho![/code]" . "Also not code.", 'html' => "Not code." . "\n<div class=\"bbcode_code\">\n" . "<div class=\"bbcode_code_head\">Code:</div>\n" . "<div class=\"bbcode_code_body\" style=\"white-space:pre\">A [b]and[/b] &amp; &lt;woo&gt;!\n" . "\tAnd a ['hey'] and a [/nonny] and a ho ho ho!</div>\n" . "</div>\n" . "Also not code."), array('descr' => "[code]...[/code] should reproduce PHP source code undamaged.", 'bbcode' => "Not code.\n" . "[code]\n" . "\$foo['bar'] = 42;\n" . "if (\$foo[\"bar\"] < 42) \$foo[] = 0;\n" . "[/code]\n" . "Also not code.\n", 'html' => "Not code." . "\n<div class=\"bbcode_code\">\n" . "<div class=\"bbcode_code_head\">Code:</div>\n" . "<div class=\"bbcode_code_body\" style=\"white-space:pre\">\$foo['bar'] = 42;\n" . "if (\$foo[&quot;bar&quot;] &lt; 42) \$foo[] = 0;</div>\n" . "</div>\n" . "Also not code.<br />\n"), array('descr' => "<code>...</code> should not misbehave in '<' tag marker mode.", 'bbcode' => "Not code." . "<code>A <b>and</b> & <woo>!\n\tAnd a [hey] and a [/nonny] and a ho ho ho!</code>" . "Also not code.", 'html' => "Not code." . "\n<div class=\"bbcode_code\">\n" . "<div class=\"bbcode_code_head\">Code:</div>\n" . "<div class=\"bbcode_code_body\" style=\"white-space:pre\">A &lt;b&gt;and&lt;/b&gt; &amp; &lt;woo&gt;!\n" . "\tAnd a [hey] and a [/nonny] and a ho ho ho!</div>\n" . "</div>\n" . "Also not code.", 'tag_marker' => '<'), array('descr' => "[quote]...[/quote] should produce a plain quote.", 'bbcode' => "Outside the quote." . "[quote]A [b]and[/b] & <woo>!\n\tAnd a [hey] and a [/nonny] and a ho ho ho![/quote]" . "Also outside the quote.", 'html' => "Outside the quote." . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">Quote:</div>\n" . "<div class=\"bbcode_quote_body\">A <b>and</b> &amp; &lt;woo&gt;!<br />\n" . "And a [hey] and a [/nonny] and a ho ho ho!</div>\n" . "</div>\n" . "Also outside the quote."), array('descr' => "Multiple nested [quote]...[/quote] tags should produce nested quotes.", 'bbcode' => "text0\n[quote]\n[quote]\n[quote]text1[/quote]\ntext2[/quote]\ntext3[/quote]\ntext4", 'html' => "text0" . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">Quote:</div>\n" . "<div class=\"bbcode_quote_body\">" . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">Quote:</div>\n" . "<div class=\"bbcode_quote_body\">" . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">Quote:</div>\n" . "<div class=\"bbcode_quote_body\">" . "text1" . "</div>\n" . "</div>\n" . "text2" . "</div>\n" . "</div>\n" . "text3" . "</div>\n" . "</div>\n" . "text4"), array('descr' => "Multiple nested [quote]...[/quote] tags should produce nested quotes.", 'bbcode' => "[quote]\n[quote]\n[quote]text1[/quote]\ntext2[/quote]\ntext3[/quote]\ntext4 :) text5 :o text6 :o", 'html' => "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">Quote:</div>\n" . "<div class=\"bbcode_quote_body\">" . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">Quote:</div>\n" . "<div class=\"bbcode_quote_body\">" . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">Quote:</div>\n" . "<div class=\"bbcode_quote_body\">" . "text1" . "</div>\n" . "</div>\n" . "text2" . "</div>\n" . "</div>\n" . "text3" . "</div>\n" . "</div>\n" . "text4 <img src=\"smileys/smile.gif\" width=\"16\" height=\"16\" alt=\":)\" title=\":)\" class=\"bbcode_smiley\" /> text5 :o text6 :o"), array('descr' => "[quote=John]...[/quote] should produce a quote from John.", 'bbcode' => "Outside the quote." . "[quote=John]A [b]and[/b] & <woo>!\n\tAnd a [hey] and a [/nonny] and a ho ho ho![/quote]" . "Also outside the quote.", 'html' => "Outside the quote." . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">John wrote:</div>\n" . "<div class=\"bbcode_quote_body\">A <b>and</b> &amp; &lt;woo&gt;!<br />\n" . "And a [hey] and a [/nonny] and a ho ho ho!</div>\n" . "</div>\n" . "Also outside the quote."), array('descr' => "[quote=\"John Smith\"]...[/quote] should produce a quote from John Smith.", 'bbcode' => "Outside the quote." . "[quote=\"John Smith\"]A [b]and[/b] & <woo>!\n\tAnd a [hey] and a [/nonny] and a ho ho ho![/quote]" . "Also outside the quote.", 'html' => "Outside the quote." . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">John Smith wrote:</div>\n" . "<div class=\"bbcode_quote_body\">A <b>and</b> &amp; &lt;woo&gt;!<br />\n" . "And a [hey] and a [/nonny] and a ho ho ho!</div>\n" . "</div>\n" . "Also outside the quote."), array('descr' => "[quote name= date= url=]...[/quote] should produce a detailed quote.", 'bbcode' => "Outside the quote." . "[quote name=\"John Smith\" date=\"July 4, 1776\" url=\"http://www.constitution.gov\"]We hold these truths to be self-evident...[/quote]" . "Also outside the quote.", 'html' => "Outside the quote." . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\"><a href=\"http://www.constitution.gov\">John Smith wrote on July 4, 1776:</a></div>\n" . "<div class=\"bbcode_quote_body\">We hold these truths to be self-evident...</div>\n" . "</div>\n" . "Also outside the quote."), array('descr' => "[quote name= date= url=]...[/quote] should disallow bad URLs.", 'bbcode' => "Outside the quote." . "[quote name=\"John Smith\" date=\"July 4, 1776\" url=\"javascript:alert()\"]We hold these truths to be self-evident...[/quote]" . "Also outside the quote.", 'html' => "Outside the quote." . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">John Smith wrote on July 4, 1776:</div>\n" . "<div class=\"bbcode_quote_body\">We hold these truths to be self-evident...</div>\n" . "</div>\n" . "Also outside the quote."), array('descr' => "[quote=\"<script>javascript:alert()</script>\"] should not produce Javascript.", 'bbcode' => "Outside the quote." . "[quote=\"<script>javascript:alert()</script>\"]A [b]and[/b] & <woo>!\n\tAnd a [hey] and a [/nonny] and a ho ho ho![/quote]" . "Also outside the quote.", 'html' => "Outside the quote." . "\n<div class=\"bbcode_quote\">\n" . "<div class=\"bbcode_quote_head\">&lt;script&gt;javascript:alert()&lt;/script&gt; wrote:</div>\n" . "<div class=\"bbcode_quote_body\">A <b>and</b> &amp; &lt;woo&gt;!<br />\n" . "And a [hey] and a [/nonny] and a ho ho ho!</div>\n" . "</div>\n" . "Also outside the quote."), array('descr' => "[columns] should produce columns.", 'bbcode' => "Before the columns." . "[columns]This is a test.[nextcol]This is [b]beside[/b] it.[nextcol]This is [i]also[/i] beside it.[/columns]" . "After the columns.", 'html' => "Before the columns." . "\n<table class=\"bbcode_columns\"><tbody><tr><td class=\"bbcode_column bbcode_firstcolumn\">\n" . "This is a test." . "\n</td><td class=\"bbcode_column\">\n" . "This is <b>beside</b> it." . "\n</td><td class=\"bbcode_column\">\n" . "This is <i>also</i> beside it." . "\n</td></tr></tbody></table>\n" . "After the columns."), array('descr' => "[nextcol] doesn't do anything outside a [columns] block.", 'bbcode' => "Here's some text.[nextcol]\nHere's some more.\n", 'html' => "Here's some text.[nextcol]<br />\nHere's some more.<br />\n"), array('descr' => "Bad column misuse doesn't break layouts.", 'bbcode' => "[center][columns]This is a test.[nextcol]This is also a [b]test[/b].[/center][/columns]", 'html' => "\n<div class=\"bbcode_center\" style=\"text-align:center\">\n" . "\n<table class=\"bbcode_columns\"><tbody><tr><td class=\"bbcode_column bbcode_firstcolumn\">\n" . "This is a test." . "\n</td><td class=\"bbcode_column\">\n" . "This is also a <b>test</b>." . "\n</td></tr></tbody></table>\n" . "\n</div>\n"), "Lists and List Items", array('descr' => "[list] and [*] should produce an unordered list.", 'bbcode' => "[list][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ul class=\"bbcode_list\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ul>\n"), array('descr' => "[list=circle] should produce an unordered list.", 'bbcode' => "[list=circle][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ul class=\"bbcode_list\" style=\"list-style-type:circle\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ul>\n"), array('descr' => "[list=disc] should produce an unordered list.", 'bbcode' => "[list=disc][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ul class=\"bbcode_list\" style=\"list-style-type:disc\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ul>\n"), array('descr' => "[list=square] should produce an unordered list.", 'bbcode' => "[list=square][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ul class=\"bbcode_list\" style=\"list-style-type:square\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ul>\n"), array('descr' => "[list=1] should produce an ordered list.", 'bbcode' => "[list=1][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ol class=\"bbcode_list\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ol>\n"), array('descr' => "[list=A] should produce an ordered list.", 'bbcode' => "[list=A][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ol class=\"bbcode_list\" style=\"list-style-type:upper-alpha\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ol>\n"), array('descr' => "[list=a] should produce an ordered list.", 'bbcode' => "[list=a][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ol class=\"bbcode_list\" style=\"list-style-type:lower-alpha\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ol>\n"), array('descr' => "[list=I] should produce an ordered list.", 'bbcode' => "[list=I][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ol class=\"bbcode_list\" style=\"list-style-type:upper-roman\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ol>\n"), array('descr' => "[list=i] should produce an ordered list.", 'bbcode' => "[list=i][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ol class=\"bbcode_list\" style=\"list-style-type:lower-roman\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ol>\n"), array('descr' => "[list=greek] should produce an ordered list.", 'bbcode' => "[list=greek][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ol class=\"bbcode_list\" style=\"list-style-type:lower-greek\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ol>\n"), array('descr' => "[list=georgian] should produce an ordered list.", 'bbcode' => "[list=georgian][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ol class=\"bbcode_list\" style=\"list-style-type:georgian\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ol>\n"), array('descr' => "[list=armenian] should produce an ordered list.", 'bbcode' => "[list=armenian][*]One Box[*]Two Boxes[*]Three Boxes[/list]", 'html' => "\n<ol class=\"bbcode_list\" style=\"list-style-type:armenian\">\n<li>One Box</li>\n<li>Two Boxes</li>\n<li>Three Boxes</li>\n</ol>\n"));
function MicroNow()
{
    list($usec, $sec) = explode(" ", microtime());
    return (double) $usec + (double) $sec;
}
function FormatTime($time)
{
    return sprintf("%0.2f ms", $time * 1000);
}
$bbcode = new BBCode();
$bbcode->AddRule('wstest', array('mode' => BBCODE_MODE_ENHANCED, 'allow' => array('_default' => '/^[a-zA-Z0-9._ -]+$/'), 'template' => '<span style="wstest:{$_default}">{$_content}</span>', 'class' => 'inline', 'allow_in' => array('listitem', 'block', 'columns', 'inline', 'link')));
$bbcode->SetLocalImgDir("smileys");
$bbcode->SetLocalImgURL("smileys");
print "<table class='test_table' align='center'>\n" . "<thead><tr><th>Description</th><th>Result</th><th>Avg. Time</th></thead>\n" . "<tbody>\n";
$numpassed = 0;
$numfailed = 0;
$numtested = 0;
foreach ($BBCodeTestSuite as $test) {
    if (is_string($test)) {
        print "<tr class='spacer'><th colspan='3'></th></tr>\n" . "<tr class='group'><th colspan='3'>" . htmlspecialchars($test) . "</th></tr>\n";
    } else {
        $output = "<tr class='test'><td class='descr'>" . htmlspecialchars($test['descr']) . "</td>";
        if (@$test['debug'] == true) {
            $bbcode->SetDebug(true);
        } else {
 /**
  * This callback processes any custom parser.php attributes and custom code with preg_replace
  */
 protected function callback_html($field)
 {
     // Strips vBulletin custom HTML first from $field before parsing $field to parser.php
     $vbulletin_markup = $field;
     $vbulletin_markup = html_entity_decode($vbulletin_markup);
     // Replace '[QUOTE]' with '<blockquote>'
     $vbulletin_markup = preg_replace('/\\[QUOTE\\]/', '<blockquote>', $vbulletin_markup);
     // Replace '[QUOTE=User Name($1);PostID($2)]' with '<em>@$1 $2 wrote:</em><blockquote>"
     $vbulletin_markup = preg_replace('/\\[QUOTE=(.*?);(.*?)\\]/', '<em>@$1 $2 wrote:</em><blockquote>', $vbulletin_markup);
     // Replace '[/QUOTE]' with '</blockquote>'
     $vbulletin_markup = preg_replace('/\\[\\/QUOTE\\]/', '</blockquote>', $vbulletin_markup);
     // Replace '[MENTION=###($1)]User Name($2)[/MENTION]' with '@$2"
     $vbulletin_markup = preg_replace('/\\[MENTION=(.*?)\\](.*?)\\[\\/MENTION\\]/', '@$2', $vbulletin_markup);
     // Replace '[video=youtube;$1]$2[/video]' with '$2"
     $vbulletin_markup = preg_replace('/\\[video\\=youtube;(.*?)\\](.*?)\\[\\/video\\]/', '$2', $vbulletin_markup);
     // Now that vBulletin custom HTML has been stripped put the cleaned HTML back in $field
     $field = $vbulletin_markup;
     // Parse out any bbCodes in $field with the BBCode 'parser.php'
     require_once bbpress()->admin->admin_dir . 'parser.php';
     $bbcode = BBCode::getInstance();
     $bbcode->enable_smileys = false;
     $bbcode->smiley_regex = false;
     return html_entity_decode($bbcode->Parse($field));
 }
Esempio n. 24
0
<?php

require '../include/mellivora.inc.php';
require CONFIG_PATH_THIRDPARTY . 'nbbc/nbbc.php';
enforce_authentication();
$time = time();
$bbc = new BBCode();
$bbc->SetEnableSmileys(false);
head('Challenges');
if (isset($_GET['status'])) {
    if ($_GET['status'] == 'correct') {
        message_inline_green('<h1>Correct flag, you are awesome!</h1>', false);
    } else {
        if ($_GET['status'] == 'incorrect') {
            message_inline_red('<h1>Incorrect flag, try again.</h1>', false);
        } else {
            if ($_GET['status'] == 'manual') {
                message_inline_blue('<h1>Your submission is awaiting manual marking.</h1>', false);
            }
        }
    }
}
$categories = db_select_all('categories', array('id', 'title', 'description', 'available_from', 'available_until', 'instanceID'), array('instanceID' => $_SESSION["IID"]), 'title ASC');
if (isset($_GET['category'])) {
    validate_id($_GET['category']);
    // select our chosen category
    $current_category = db_select_one('categories', array('id', 'title', 'description', 'available_from', 'available_until'), array('id' => $_GET['category']));
    if (!$current_category) {
        message_error('No category found with that ID', false);
    }
} else {
Esempio n. 25
0
 /**
  * This callback processes any custom parser.php attributes and custom code with preg_replace
  */
 protected function callback_html($field)
 {
     // Strips SMF custom HTML first from $field before parsing $field to parser.php
     $SMF_markup = $field;
     $SMF_markup = html_entity_decode($SMF_markup);
     // Replace '[quote]' with '<blockquote>'
     $SMF_markup = preg_replace('/\\[quote\\]/', '<blockquote>', $SMF_markup);
     // Replace '[quote ($1)]' with '<blockquote>"
     $SMF_markup = preg_replace('/\\[quote (.*?)\\]/', '<blockquote>', $SMF_markup);
     // Replace '[/quote]' with '</blockquote>'
     $SMF_markup = preg_replace('/\\[\\/quote\\]/', '</blockquote>', $SMF_markup);
     // Replace '[glow]' with ''
     $SMF_markup = preg_replace('/\\[glow\\]/', '', $SMF_markup);
     // Replace '[glow]' with ''
     $SMF_markup = preg_replace('/\\[glow=(.*?)\\]/', '', $SMF_markup);
     // Replace '[/glow]' with ''
     $SMF_markup = preg_replace('/\\[\\/glow\\]/', '', $SMF_markup);
     // Replace '[shadow]' with ''
     $SMF_markup = preg_replace('/\\[shadow\\]/', '', $SMF_markup);
     // Replace '[shadow]' with ''
     $SMF_markup = preg_replace('/\\[shadow=(.*?)\\]/', '', $SMF_markup);
     // Replace '[/shadow]' with ''
     $SMF_markup = preg_replace('/\\[\\/shadow\\]/', '', $SMF_markup);
     // Replace '[move]' with ''
     $SMF_markup = preg_replace('/\\[move\\]/', '', $SMF_markup);
     // Replace '[/move]' with ''
     $SMF_markup = preg_replace('/\\[\\/move\\]/', '', $SMF_markup);
     // Replace '[table]' with '<table>'
     $SMF_markup = preg_replace('/\\[table\\]/', '<table>', $SMF_markup);
     // Replace '[/table]' with '</table>'
     $SMF_markup = preg_replace('/\\[\\/table\\]/', '</table>', $SMF_markup);
     // Replace '[tr]' with '<tr>'
     $SMF_markup = preg_replace('/\\[tr\\]/', '<tr>', $SMF_markup);
     // Replace '[/tr]' with '</tr>'
     $SMF_markup = preg_replace('/\\[\\/tr\\]/', '</tr>', $SMF_markup);
     // Replace '[td]' with '<td>'
     $SMF_markup = preg_replace('/\\[td\\]/', '<td>', $SMF_markup);
     // Replace '[/td]' with '</td>'
     $SMF_markup = preg_replace('/\\[\\/td\\]/', '</td>', $SMF_markup);
     // Replace '[list]' with '<ul>'
     $SMF_markup = preg_replace('/\\[list\\]/', '<ul>', $SMF_markup);
     // Replace '[liist type=decimal]' with '<ol type="a">'
     $SMF_markup = preg_replace('/\\[list\\ type=decimal\\]/', '<ol type="a">', $SMF_markup);
     // Replace '[li]' with '<li>'
     $SMF_markup = preg_replace('/\\[li\\]/', '<li>', $SMF_markup);
     // Replace '[/li]' with '</li>'
     $SMF_markup = preg_replace('/\\[\\/li\\]/', '</li>', $SMF_markup);
     // Replace '[tt]' with '<tt>'
     $SMF_markup = preg_replace('/\\[tt\\]/', '<tt>', $SMF_markup);
     // Replace '[/tt]' with '</tt>'
     $SMF_markup = preg_replace('/\\[\\/tt\\]/', '</tt>', $SMF_markup);
     // Replace '<br />' with '<br>'
     $SMF_markup = preg_replace('/\\<br \\/\\>/', '<br>', $SMF_markup);
     // Replace '[size=$1]' with '<span style="font-size:$1%;">$3</span>'
     $SMF_markup = preg_replace('/\\[size=(.*?)\\]/', '<span style="font-size:$1">', $SMF_markup);
     // Replace '[/size]' with '</span>'
     $SMF_markup = preg_replace('/\\[\\/size\\]/', '</span>', $SMF_markup);
     // Replace non-break space '&nbsp;' with space ' '
     $SMF_markup = preg_replace('/&nbsp;/', ' ', $SMF_markup);
     // Now that SMF custom HTML has been stripped put the cleaned HTML back in $field
     $field = $SMF_markup;
     // Parse out any bbCodes in $field with the BBCode 'parser.php'
     require_once bbpress()->admin->admin_dir . 'parser.php';
     $bbcode = BBCode::getInstance();
     $bbcode->enable_smileys = false;
     $bbcode->smiley_regex = false;
     return html_entity_decode($bbcode->Parse($field));
 }
Esempio n. 26
0
 protected function comment_to_html($comment, $trim = false)
 {
     global $user;
     $tfe = new TextFormattingEvent($comment->comment);
     // sending this event to all ~50 exts has a lot of overhead
     if (SPEED_HAX) {
         $bb = new BBCode();
         $bb->receive_event($tfe);
     } else {
         send_event($tfe);
     }
     $i_uid = int_escape($comment->owner_id);
     $h_name = html_escape($comment->owner_name);
     $h_poster_ip = html_escape($comment->poster_ip);
     $h_timestamp = autodate($comment->posted);
     $h_comment = $trim ? substr($tfe->stripped, 0, 50) . "..." : $tfe->formatted;
     $i_comment_id = int_escape($comment->comment_id);
     $i_image_id = int_escape($comment->image_id);
     $anoncode = "";
     if ($h_name == "Anonymous" && $this->anon_id >= 0) {
         $anoncode = "<sup>{$this->anon_id}</sup>";
         $this->anon_id++;
     }
     $h_userlink = "<a href='" . make_link("user/{$h_name}") . "'>{$h_name}</a>{$anoncode}";
     $stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
     $stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
     $h_dellink = $user->is_admin() ? "<br>({$h_poster_ip}, {$h_timestamp}, <a " . "onclick=\"return confirm('Delete comment by {$h_name}:\\n{$stripped_nonl}');\" " . "href='" . make_link("comment/delete/{$i_comment_id}/{$i_image_id}") . "'>Del</a>)" : "";
     if ($trim) {
         return "\n\t\t\t\t{$h_userlink}: {$h_comment}\n\t\t\t\t<a href='" . make_link("post/view/{$i_image_id}") . "'>&gt;&gt;&gt;</a>\n\t\t\t\t{$h_dellink}\n\t\t\t";
     } else {
         //$avatar = "";
         //if(!empty($comment->owner->email)) {
         //	$hash = md5(strtolower($comment->owner->email));
         //	$avatar = "<img src=\"http://www.gravatar.com/avatar/$hash.jpg\"><br>";
         //}
         $oe = $this->comments_shown++ % 2 == 0 ? "even" : "odd";
         return "\n\t\t\t\t<a name='{$i_comment_id}'></a>\n\t\t\t\t<div class='{$oe} comment'>\n\t\t\t\t<!--<span class='timeago' style='float: right;'>{$h_timestamp}</span>-->\n\t\t\t\t{$h_userlink}: {$h_comment}\n\t\t\t\t{$h_dellink}\n\t\t\t\t</div>\n\t\t\t";
     }
 }
Esempio n. 27
0
<?php

require '../include/mellivora.inc.php';
require CONST_PATH_THIRDPARTY . 'nbbc/nbbc.php';
enforce_authentication();
$time = time();
$bbc = new BBCode();
$bbc->SetEnableSmileys(false);
head('Challenges');
if (isset($_GET['status'])) {
    if ($_GET['status'] == 'correct') {
        message_dialog('Congratulations! You got the flag!', 'Correct flag', 'Yay!', 'challenge-attempt correct on-page-load');
    } else {
        if ($_GET['status'] == 'incorrect') {
            message_dialog('Sorry! That wasn\'t correct', 'Incorrect flag', 'Ok', 'challenge-attempt incorrect on-page-load');
        } else {
            if ($_GET['status'] == 'manual') {
                message_inline_blue('<h1>Your submission is awaiting manual marking.</h1>', false);
            }
        }
    }
}
$categories = db_select_all('categories', array('id', 'title', 'description', 'available_from', 'available_until'), array('exposed' => 1), 'title ASC');
// determine which category to display
if (isset($_GET['category'])) {
    validate_id($_GET['category']);
    $current_category = array_search_matching_key($_GET['category'], $categories, 'id');
    if (!$current_category) {
        message_error(lang_get('no_category_for_id'), false);
    }
} else {
Esempio n. 28
0
 /**
  * Adds a bbcode to the parser
  * @param BBCode $bbcode
  * @param bool $replace If to replace another bbcode which is for the same tag
  * @return bool
  */
 public function add_bbcode(BBCode $bbcode, $replace = true)
 {
     if (!$replace && isset($this->bbcodes[$bbcode->tag()])) {
         return false;
     }
     $this->bbcodes[$bbcode->tag()] = $bbcode;
     return true;
 }
Esempio n. 29
0
 public static function Code($string)
 {
     $bb = new BBCode();
     return $bb->Format($string);
 }
Esempio n. 30
0
 function view()
 {
     global $USER, $LNG;
     $ticketID = HTTP::_GP('id', 0);
     $answerResult = $GLOBALS['DATABASE']->query("SELECT a.*, t.categoryID, t.status FROM " . TICKETS_ANSWER . " a INNER JOIN " . TICKETS . " t USING(ticketID) WHERE a.ticketID = " . $ticketID . " ORDER BY a.answerID;");
     $answerList = array();
     $ticket_status = 0;
     require 'includes/classes/BBCode.class.php';
     while ($answerRow = $GLOBALS['DATABASE']->fetch_array($answerResult)) {
         if (empty($ticket_status)) {
             $ticket_status = $answerRow['status'];
         }
         $answerRow['time'] = _date($LNG['php_tdformat'], $answerRow['time'], $USER['timezone']);
         $answerRow['message'] = BBCode::parse($answerRow['message']);
         $answerList[$answerRow['answerID']] = $answerRow;
     }
     $GLOBALS['DATABASE']->free_result($answerResult);
     $categoryList = $this->ticketObj->getCategoryList();
     $this->tplObj->assign_vars(array('ticketID' => $ticketID, 'ticket_status' => $ticket_status, 'categoryList' => $categoryList, 'answerList' => $answerList));
     $this->tplObj->show('page.ticket.view.tpl');
 }