$1$3", $text);
// match www.something.domain/path/file.extension?some=variable&another=asf%
$text = preg_replace("/\s"
."("
."www"
."\.[a-z][a-z0-9\_\.\-]*"
."[a-z]{2,6}"
."("
."\/[a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*"
.")?"
.")"
."([\s|\.|\,])/i",
" $1$3", $text);
// match name@address
$text = preg_replace("/\s"
."("
."[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*"
."\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6}"
.")"
."([\s|\.|\,])/i",
" $1$2", $text);
return substr($text, 1, -1);
}
function Encode(&$text_new, &$task, $text_old, $context) {
# Encode strings for output
# Regard interpreter mode if needed
# context: 'text'
# context: 'tagremove'
# RET:
# TAGPARSER_RET_NOTHING: No Escaping done
# TAGPARSER_RET_REPLACED: Escaping done
// special states are liable for encoding (Extended Tag hit)
if($task->in_code) {
// everything inside [code] is getting converted/encoded by tag delegation
return TAGPARSER_RET_NOTHING;
}
if($task->in_noparse) {
// noparse is also needed to get encoded
$text_new = htmlspecialchars($text_old, ENT_QUOTES);
return TAGPARSER_RET_REPLACED;
}
// generally
$text_new = $text_old;
// pasting " " allows regexp to apply on \s at end
// HTMLize from plaintext
$text_new = htmlspecialchars($text_new, ENT_QUOTES);
if($context=='text'
&& ($task->autolink_disable==0)) {
// Build links HTML2HTML
$text_new = FireBoardBBCodeInterpreter::hyperlink($text_new);
// Calculate smilies HTML2HTML
$text_new = smile::smileParserCallback($text_new, $task->history, $task->emoticons, $task->iconList);
}
return TAGPARSER_RET_REPLACED;
}
function TagStandard(&$tns, &$tne, &$task, $tag)
# Function replaces TAGs with corresponding
if($task->in_code) {
return TAGPARSER_RET_NOTHING;
}
if($task->in_noparse) {
// hits deactivated by default
switch(strtolower($tag->name)) {
case 'noparse':
// specify noparse output - this only strips
$tns = ""; $tne = '';
#reenter regular replacements
$task->in_noparse = FALSE;
return TAGPARSER_RET_REPLACED;
break;
default:
break;
}
// tagname code is not processed
return TAGPARSER_RET_NOTHING;
}
switch (strtolower($tag->name)) {
case 'b':
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
break;
case 'i':
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
break;
case 'u':
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
break;
case 'size':
if(!isset($tag->options['default'])
|| strlen($tag->options['default'])==0) {
return TAGPARSER_RET_NOTHING;
}
$tns = "";
$tne = '';
return TAGPARSER_RET_REPLACED;
break;
case 'ol':
$tns = "
"; $tne = '
';
return TAGPARSER_RET_REPLACED;
break;
case 'ul':
$tns = "';
return TAGPARSER_RET_REPLACED;
break;
case 'li':
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
break;
case 'color':
if(!isset($tag->options['default'])
|| strlen($tag->options['default'])==0) {
return TAGPARSER_RET_NOTHING;
}
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
break;
case 'highlight':
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
break;
case 'left':
$tns = ""; $tne = '
';
return TAGPARSER_RET_REPLACED;
break;
case 'center':
$tns = ""; $tne = '
';
return TAGPARSER_RET_REPLACED;
break;
case 'right':
$tns = ""; $tne = '
';
return TAGPARSER_RET_REPLACED;
break;
case 'indent':
$tns = ""; $tne = '
';
return TAGPARSER_RET_REPLACED;
break;
case 'email':
$task->autolink_disable--;
if(isset($tag->options['default'])) {
$tempstr = $tag->options['default'];
if(substr($tempstr, 0, 7)!=='mailto:') {
$tempstr = 'mailto:'.$tempstr;
}
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
}
break;
case 'url':
$task->autolink_disable--;
// www. > http://www.
if(isset($tag->options['default'])) {
$tempstr = $tag->options['default'];
if(substr($tempstr, 0, 4)=='www.') {
$tempstr = 'http://'.$tempstr;
}
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
}
break;
case 'thread':
$task->autolink_disable--;
if(isset($tag->options['default'])) {
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
}
break;
case 'post':
$task->autolink_disable--;
if(isset($tag->options['default'])) {
$tns = ""; $tne = '';
return TAGPARSER_RET_REPLACED;
}
break;
case 'quote':
# ERROR: check if ID submitted, provide link?
$task->autolink_disable--;
if(isset($tag->options['default'])) {
$tns = "".htmlspecialchars($tag->options['default'], ENT_QUOTES).":
"; $tne = '';
return TAGPARSER_RET_REPLACED;
}
break;
default:
break;
}
return TAGPARSER_RET_NOTHING;
}
function TagExtended(&$tag_new, &$task, $tag, $between) {
# Function replaces TAGs with corresponding
# Encode was already been called for between
if($task->in_code) {
switch(strtolower($tag->name)) {
case 'code:1': // fb ancient compatibility
case 'code':
$types = array ("php", "mysql", "html", "js", "javascript");
$code_start_html = '| '._FB_MSG_CODE.' |
';
if (in_array($tag->options["type"], $types)) {
$t_type = $tag->options["type"];
}
else {
$t_type = "php";
}
$code_start_html .= "";
$code_end_html = '
|
';
$tag_new = $code_start_html. htmlspecialchars($between, ENT_QUOTES).$code_end_html;
#reenter regular replacements
$task->in_code = FALSE;
return TAGPARSER_RET_REPLACED;
break;
default:
break;
}
return TAGPARSER_RET_NOTHING;
}
switch(strtolower($tag->name)) {
# call htmlentities if Encode() did not already!!!
# in general $between was already Encoded (if not explicitly suppressed!)
case 'email':
$tempstr = $between;
if(substr($tempstr, 0, 7)=='mailto:') {
$between = substr($tempstr, 7);
}
else {
$tempstr = 'mailto:'.$tempstr;
}
$tag_new = "".$between.'';
return TAGPARSER_RET_REPLACED;
break;
case 'url':
$tempstr = $between;
if(substr($tempstr, 0, 4)=='www.') {
$tempstr = 'http://'.$tempstr;
}
$tag_new = "".$between.'';
return TAGPARSER_RET_REPLACED;
break;
case 'thread':
// ERROR LINK
$tag_new = "".$between.'';
return TAGPARSER_RET_REPLACED;
break;
case 'post':
// ERROR LINK
$tag_new = "".$between.'';
return TAGPARSER_RET_REPLACED;
break;
case 'img':
if($between) {
$task->autolink_disable--; # continue autolink conversion
$tag_new = "
";
return TAGPARSER_RET_REPLACED;
}
return TAGPARSER_RET_NOTHING;
break;
case 'file':
if($between) {
$task->autolink_disable--; # continue autolink conversion
$tag_new = "";
return TAGPARSER_RET_REPLACED;
}
return TAGPARSER_RET_NOTHING;
break;
case 'quote':
// ERROR LINK, USER PROPERTIES
$tag_new = 'QUOTE:
'.$between.'
';
return TAGPARSER_RET_REPLACED;
break;
case 'attach':
// ERROR LINK
$tag_new = "ATTACH: ".$between.'';
return TAGPARSER_RET_REPLACED;
break;
case 'list':
$tag_new = '';
$tag_new .= "\n";
$linearr = explode('[*]', $between);
for($i=0; $i';
$tag_new .= "\n";
}
}
$tag_new .= '
';
$tag_new .= "\n";
return TAGPARSER_RET_REPLACED;
break;
case 'video':
if ($between) {
$mv_size = intval($tag->options["size"]);
if (($mv_size < 1) or ($mv_size > 100)) {
$mv_size = 100;
}
switch ($tag->options["type"]) {
case 'clipfish':
$mv_width = (int)(464 * $mv_size / 100);
$mv_height = (int)(380 * $mv_size / 100);
$mv_param = 'http://www.clipfish.de/videoplayer.swf?as=0&videoid='.$between.'&r=1&c=0067B3';
$tag_new = '