1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-12 01:25:01 +02:00

moved bbcodes to new folder

This commit is contained in:
CaMer0n
2010-02-10 07:36:24 +00:00
parent f52da8e887
commit dc2c797c00
26 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1 @@
return "<div class='indent'>{$code_text}</div>";

1
e107_core/bbcodes/br.bb Normal file
View File

@@ -0,0 +1 @@
return '<br />';

View File

@@ -0,0 +1 @@
return "<div style='text-align:center'>$code_text</div>";

44
e107_core/bbcodes/code.bb Normal file
View File

@@ -0,0 +1,44 @@
global $pref, $e107cache, $tp;
if($pref['smiley_activate'])
{
if (!is_object($tp->e_emote))
{
require_once(e_HANDLER.'emote_filter.php');
$tp->e_emote = new e_emoteFilter;
}
$code_text = $tp->e_emote->filterEmotesRev($code_text);
}
$search = array(E_NL,'&#092;','&#036;', '&lt;');
$replace = array("\r\n","\\",'$', '<');
$code_text = str_replace($search, $replace, $code_text);
if(isset($pref['useGeshi']) && $pref['useGeshi'] && file_exists(e_PLUGIN."geshi/geshi.php")) {
$code_md5 = md5($code_text);
if(!$CodeCache = $e107cache->retrieve('GeshiParsed_'.$code_md5)) {
require_once(e_PLUGIN."geshi/geshi.php");
if($parm) {
$geshi = new GeSHi($code_text, $parm, e_PLUGIN."geshi/geshi/");
} else {
$geshi = new GeSHi($code_text, ($pref['defaultLanGeshi'] ? $pref['defaultLanGeshi'] : 'php'), e_PLUGIN."geshi/geshi/");
}
$geshi->line_style1 = "font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;";
$geshi->set_encoding('utf-8');
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_header_type(GESHI_HEADER_DIV);
$CodeCache = $geshi->parse_code();
$e107cache->set('GeshiParsed_'.$code_md5, $CodeCache);
}
$ret = "<div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'>".str_replace("&amp;", "&", $CodeCache)."</div>";
}
else
{
$code_text = html_entity_decode($code_text, ENT_QUOTES, 'utf-8');
$highlighted_text = highlight_string($code_text, TRUE);
$divClass = ($parm) ? $parm : 'code_highlight';
$ret = "<div class='".$tp -> toAttribute($divClass)." code-box' style='unicode-bidi: embed; direction: ltr'>{$highlighted_text}</div>";
}
$ret = str_replace("[", "&#091;", $ret);
return $ret;

View File

@@ -0,0 +1,38 @@
$aColors = array(
"black" => "#000000",
"blue" => "#0000FF",
"brown" => "#A52A2A",
"cyan" => "#00FFFF",
"darkblue" => "#00008B",
"darkred" => "#8B0000",
"green" => "#008000",
"indigo" => "#4B0082",
"olive" => "#808000",
"orange" => "#FFA500",
"red" => "#FF0000",
"violet" => "#EE82EE",
"white" => "#FFFFFF",
"yellow" => "#FFFF00",
"aqua" => "#00FFFF",
"fuchsia" => "#FF00FF",
"gray" => "#808080",
"lime" => "#00FF00",
"maroon" => "#800000",
"navy" => "#000080",
"purple" => "#800080",
"silver" => "#C0C0C0",
"teal" => "#008080"
);
if(array_key_exists($parm, $aColors))
{
return "<span style='color:{$aColors[$parm]}'>$code_text</span>";
}
else
{
if(preg_match("/(#[a-fA-F0-9]{3,6})/", $parm, $matches))
{
return "<span style='color:{$matches[1]}'>$code_text</span>";
}
}

View File

@@ -0,0 +1,27 @@
global $pref;
if($pref['make_clickable'])
{
if($parm)
{
list($p1,$p2) = explode("@",$parm);
return "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"".$p1."\"+\"@\"+\"".$p2."\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"".$p1."\"+\"@\"+\"".$p2."\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
}
else
{
list($p1, $p2) = explode("@", $code_text);
// CHARSET is utf-8 - email.bb too
$email_text = $p1.'©'.$p2;
return "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"".$p1."\"+\"@\"+\"".$p2."\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"".$p1."\"+\"@\"+\"".$p2."\"; return true;' onmouseout='window.status=\"\";return true;'>".$email_text."</a>";
}
}
// Old method that attracts SPAM.
if ($parm) {
return "<a href='mailto:".$tp -> toAttribute($parm)."'>".$code_text."</a>";
} else {
return "<a href='mailto:".$tp -> toAttribute($code_text)."'>".$code_text."</a>";
}

39
e107_core/bbcodes/file.bb Normal file
View File

@@ -0,0 +1,39 @@
global $pref, $fromadmin;
if ((e_PAGE == 'page.php') || (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin))
{
list($fname, $uc) = explode("^", $parm."^");
if($uc)
{
if(!check_class($uc))
{
return;
}
}
$ext = substr($fname, strrpos($fname, '.')+1);
if(is_readable(THEME.'images/'.$ext.'.png'))
{
$image = THEME_ABS.'images/'.$ext.'.png';
}
elseif(is_readable(e_IMAGE.'/generic/'.$ext.'.png'))
{
$image = e_IMAGE_ABS.'generic/'.$ext.'.png';
}
elseif(is_readable(THEME.'images/file.png'))
{
$image = THEME_ABS.'images/file.png';
}
else
{
$image = e_IMAGE_ABS.'generic/lite/file.png';
}
if (strpos($fname, '{e_BASE}') === 0)
{
$fname = str_replace('{e_BASE}', SITEURL, $fname); // Translate into an absolute URL
}
return "<a href='".$tp -> toAttribute($fname)."'><img src='".$image."' alt='' style='border:0; vertical-align:middle' /></a> <a href='".$tp -> toAttribute($fname)."'>".$code_text."</a>";
}

View File

@@ -0,0 +1,22 @@
// USAGE: [flash=width,height]http://www.example.com/file.swf[/flash]
$movie_path = (substr($code_text,0,4) == "http") ? "http://".eregi_replace("http://", "",$code_text) : $code_text;
$movie_path = $tp -> toAttribute($movie_path);
$parm_array = explode(",",$parm);
$width_type = strpos($parm_array[0], "%") !== FALSE ? "%" : "";
$height_type = strpos($parm_array[1], "%") !== FALSE ? "%" : "";
$width_value = ereg_replace("[^0-9]","",$parm_array[0]);
$height_value = ereg_replace("[^0-9]","",$parm_array[1]);
$width_value = $width_value ? $width_value.$width_type : "50";
$height_value = $height_value ? $height_value.$height_type : "50";
return "<object type='application/x-shockwave-flash' data='$movie_path' width='$width_value' height='$height_value'>
<param name='movie' value='$movie_path' />
<param name='quality' value='high' />
<param name='allowscriptaccess' value='samedomain' />
</object>";

24
e107_core/bbcodes/hide.bb Normal file
View File

@@ -0,0 +1,24 @@
global $sql, $e_hide_query, $e_hide_hidden, $e_hide_allowed;
if(!$e_hide_allowed || !isset($e_hide_query) || !$sql->db_Select_gen($e_hide_query))
{
if(defined('HIDE_TEXT_HIDDEN'))
{
return "<div class='".HIDE_TEXT_HIDDEN."'>{$e_hide_hidden}</div>";
}
else
{
return "<div style='border:solid 1px;padding:5px'>{$e_hide_hidden}</div>";
}
}
else
{
if(defined('HIDE_TEXT_SHOWN'))
{
return "<div class='".HIDE_TEXT_SHOWN."'>$code_text</div>";
}
else
{
return "<div style='border:solid 1px;padding:5px'>$code_text</div>";
}
}

View File

@@ -0,0 +1,3 @@
//$code_text = str_replace("\r\n", " ", $code_text);
//$code_text = html_entity_decode($code_text, ENT_QUOTES, CHARSET);
return $code_text;

1
e107_core/bbcodes/i.bb Normal file
View File

@@ -0,0 +1 @@
return "<em class='bbcode italic'>$code_text</em>";

View File

View File

@@ -0,0 +1 @@
return "<div style='text-align:justify'>$code_text</div>";

View File

@@ -0,0 +1 @@
return "<div style='text-align:left'>$code_text</div>";

70
e107_core/bbcodes/link.bb Normal file
View File

@@ -0,0 +1,70 @@
// $Id: link.bb,v 1.10 2010-01-29 16:30:49 secretr Exp $
global $pref;
/**
* e107 BBCodes
*
* @package e107
* @subpackage bbcode
* @version $Id: link.bb,v 1.10 2010-01-29 16:30:49 secretr Exp $;
*
* @todo try and avoid URLs with a language in [..]
*/
/**
[link=$parm $extras]$code_text[/link]
Correct Usage:
[link=http://mysite.com external]My text[/link]
[link=http://mysite.com rel=external]My text[/link]
[link=external]http://mysite.com[/link]
[link]http://mysite.com[/link]
[link=mailto:myemail@email.com]My name[/link]
Historic usage:
[link=external=http://mysite.com]My text[/link]
*/
$parm = trim($parm);
/* Fix for people using link=external= */
if(strpos($parm,"external=") !== FALSE)
{
list($extras,$parm) = explode("=",$parm,2);
$parm = $parm." ".$extras;
}
if(substr($parm,0,6) == "mailto")
{
list($pre,$email) = explode(":",$parm);
list($p1,$p2) = explode("@",$email);
$p2=rawurlencode($p2); // Primarily to pick up spaces, which are not allowed
return "<a class='bbcode' rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
}
if (substr($code_text,0,1) == ']')
{ // Special fix for E107 urls including a language (not nice, really)
$code_text = substr($code_text,1);
$parm .= ']';
}
list($link,$extras) = explode(" ",$parm);
if(!$parm) $link = $code_text;
if($link == "external" && $extras == "")
{
$link = $code_text;
$extras = "rel=external";
}
if($extras == "external" || strpos($extras,"rel=external")!==FALSE)
{
$insert = "rel='external' ";
}
else
{
$insert = ($pref['links_new_window'] && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#" && substr($link,0,1) != "/" && strpos($extras,"rel=internal")===FALSE) ? "rel='external' " : "";
}
if (strtolower(substr($link,0,11)) == 'javascript:') return '';
return "<a class='bbcode' href='".$tp -> toAttribute($link)."' ".$insert.">".$code_text."</a>";

43
e107_core/bbcodes/list.bb Normal file
View File

@@ -0,0 +1,43 @@
/* Tag: unordered list [list][*]line 1[*]line2[*]line 3[*]line 4[*]line5 etc[/list] - preferred */
/* Tag: ordered list [list=<list type>][*]line 1[*]line2[*]line 3[*]line 4[*]line5 etc[/list] - preferred */
/* Tag: unordered list [list]*line 1*line2*line 3*line 4*line5 etc[/list] - legacy*/
/* Tag: ordered list [list=<list type>]*line 1*line2*line 3*line 4*line5 etc[/list] - legacy */
/* valid list types:
disc
circle
square
decimal 1, 2, 3 (default)
lower-roman i, ii, iii
upper-roman I, II, III
lower-alpha a, b, c
upper-alpha A, B, C
*/
if (strpos($code_text,"[*]") !== FALSE)
{
$listitems = explode("[*]", $code_text);
}
else
{
$listitems = explode("*", $code_text);
}
if ($parm == '')
{ /* unordered list */
$listtext = "<ul class='bbcode'>";
$trailer = "</ul>";
}
else
{
$type = $tp -> toAttribute($parm);
$listtext = "\n<ol class='bbcode' style='list-style-type: $type'>";
$trailer = "</ol>";
}
foreach($listitems as $item)
{
if($item && $item != E_NL)
{
$listtext .= "<li class='bbcode'>$item</li>";
}
}
return $listtext.$trailer;

9
e107_core/bbcodes/php.bb Executable file
View File

@@ -0,0 +1,9 @@
if(!$postID) { return ''; }
if($postID == 'admin' || check_class($pref['php_bbcode'], '', $postID))
{
$search = array("&quot;", "&#039;", "&#036;", '<br />', E_NL, "-&gt;");
$replace = array('"', "'", "$", "\n", "\n", "->");
$code_text = str_replace($search, $replace, $code_text);
return eval($code_text);
}
return '';

View File

@@ -0,0 +1,2 @@
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_parser_functions.php");
return "<div class='indent'><em>$parm ".LAN_WROTE."</em> ...<br />$code_text</div>";

View File

@@ -0,0 +1 @@
return "<div style='text-align:right'>$code_text</div>";

View File

@@ -0,0 +1,8 @@
if(is_numeric($parm) && $parm > 0 && $parm < 38)
{
return "<span style='font-size:{$parm}px'>$code_text</span>";
}
else
{
return $code_text;
}

2
e107_core/bbcodes/spoiler.bb Executable file
View File

@@ -0,0 +1,2 @@
$spoiler_color = (defined("SPOILER_COLOR") ? SPOILER_COLOR : "#ff00ff");
return "<span style='color:{$spoiler_color};background-color:{$spoiler_color}'>$code_text</span>";

51
e107_core/bbcodes/stream.bb Executable file
View File

@@ -0,0 +1,51 @@
unset($stream_parms);
if($parm)
{
parse_str($parm,$tmp);
foreach($tmp as $p => $v)
{
$stream_parms[$p]=$v;
}
}
$stream_parms['autostart'] = isset($stream_parms['autostart']) ? $stream_parms['autostart'] : 'true';
$stream_parms['showcontrols'] = isset($stream_parms['showcontrols']) ? $stream_parms['showcontrols'] : 'true';
$stream_parms['showstatusbar'] = isset($stream_parms['showstatusbar']) ? $stream_parms['showstatusbar'] : 'true';
$stream_parms['autorewind'] = isset($stream_parms['autorewind']) ? $stream_parms['autorewind'] : 'true';
$stream_parms['showdisplay'] = isset($stream_parms['showdisplay']) ? $stream_parms['showdisplay'] : 'true';
if (isset($stream_parms['width'])) {
$width = $stream_parms['width'];
unset($stream_parms['width']);
} else {
$width = '320';
}
if (isset($stream_parms['height'])) {
$height = $stream_parms['height'];
unset($stream_parms['height']);
} else {
$height = '360';
}
$parmStr="";
foreach($stream_parms as $k => $v)
{
$MozparmStr .= "<param name='".$tp -> toAttribute($k)."' value='".$tp -> toAttribute($v)."'>\n";
$IEparmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' ";
}
$ret = "
<object id='MediaPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' standby='Loading Microsoft<66> Windows<77> Media Player components...' type='application/x-oleobject' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' width='".$tp -> toAttribute($width)."' height='".$tp -> toAttribute($height)."'>\n";
$ret .= "<param name='filename' value='".$tp -> toAttribute($code_text)."'>\n";
$ret .= $MozparmStr;
$ret .= "<embed src='".$tp -> toAttribute($code_text)."' width='".$tp -> toAttribute($width)."' height='".$tp -> toAttribute($height)."' id='mediaPlayer' name='mediaPlayer' {$IEparmStr}>
</object>
";
return $ret;

View File

@@ -0,0 +1,10 @@
/* Tag: [textarea name=name&style=style&row=rows&whatever=whatever]value[/textarea] */
$tastr = "";
parse_str($parm, $tmp);
foreach($tmp as $key => $p)
{
$tastr .= $tp -> toAttribute($key)." = '".$tp -> toAttribute($p)."' ";
}
return "<textarea $tastr>$code_text</textarea>";

View File

@@ -0,0 +1,2 @@
include_once(e_HANDLER."date_class.php");
return convert::convert_date($code_text, $parm);

1
e107_core/bbcodes/u.bb Normal file
View File

@@ -0,0 +1 @@
return "<span class='bbcode underline' style='text-decoration:underline'>$code_text</span>";

19
e107_core/bbcodes/url.bb Normal file
View File

@@ -0,0 +1,19 @@
global $pref;
$parm = trim($parm);
$external = ($pref['links_new_window'] || strpos($parm, 'external') === 0) ? ' rel="external"' : '';
if ($parm && $parm != 'external' && strpos($parm, ' ') === FALSE)
{
$parm = preg_replace('#^external.#is', '', $parm);
if (strtolower(substr($parm, 0, 11)) == 'javascript:')
return '';
return '<a href="'.$tp->toAttribute($parm).'" class="bbcode"'.$external.'>'.$code_text.'</a>';
}
else
{
if (strtolower(substr($code_text, 0, 11)) == 'javascript:')
return '';
return '<a href="'.$tp->toAttribute($code_text).'" class="bbcode"'.$external.'>'.$code_text.'</a>';
}