1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 22:57:14 +02:00

new module creation

This commit is contained in:
mcfly
2006-12-02 04:36:16 +00:00
commit e149b35fcc
2196 changed files with 182987 additions and 0 deletions

1
e107_files/bbcode/b.bb Normal file
View File

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

View File

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

1
e107_files/bbcode/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>";

38
e107_files/bbcode/code.bb Normal file
View File

@@ -0,0 +1,38 @@
global $pref, $e107cache, $tp;
if($pref['smiley_activate']) {
$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($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(CHARSET);
$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, CHARSET);
$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,5 @@
if ($parm) {
return "<a href='mailto:".$tp -> toAttribute($parm)."'>".$code_text."</a>";
} else {
return "<a href='mailto:".$tp -> toAttribute($code_text)."'>".$code_text."</a>";
}

15
e107_files/bbcode/file.bb Normal file
View File

@@ -0,0 +1,15 @@
global $pref, $fromadmin;
if (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin)
{
$image = (file_exists(THEME."images/file.png") ? THEME."images/file.png" : e_IMAGE."generic/".IMODE."/file.png");
list($fname, $uc) = explode("^", $parm."^");
if(isset($uc))
{
if(!check_class($uc))
{
return;
}
}
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,21 @@
// USAGE: [flash=width,height]http://www.example.com/file.swf[/flash]
$movie_path = "http://".eregi_replace("http://", "",$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_files/bbcode/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_files/bbcode/i.bb Normal file
View File

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

62
e107_files/bbcode/img.bb Normal file
View File

@@ -0,0 +1,62 @@
global $pref;
if (preg_match("#\.php\?.*#",$code_text)){return "";}
global $IMAGES_DIRECTORY, $FILES_DIRECTORY, $e107;
$search = array('"', '{E_IMAGE}', '{E_FILE}');
$replace = array('&#039;', $e107->base_path.$IMAGES_DIRECTORY, $e107->base_path.$FILES_DIRECTORY);
$code_text = str_replace($search, $replace, $code_text);
unset($imgParms);
$imgParms['class']="bbcode";
$imgParms['alt']='';
$imgParms['style']="vertical-align:middle; border:0";
$code_text = $tp -> toAttribute($code_text);
if($parm) {
$parm = preg_replace('#onerror *=#i','',$parm);
$parm = str_replace("amp;", "&", $parm);
parse_str($parm,$tmp);
foreach($tmp as $p => $v) {
$imgParms[$p]=$v;
}
}
$parmStr="";
foreach($imgParms as $k => $v) {
$parmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' ";
}
if(file_exists(e_IMAGE."newspost_images/".$code_text))
{
$code_text = e_IMAGE."newspost_images/".$code_text;
}
if (!$postID) {
return "<img src='".$code_text."' {$parmStr} />";
} else {
if(strstr($postID,'class:')) {
$uc = substr($postID,6);
}
if ($pref['image_post']) {
if($uc == '') {
if (!function_exists('e107_userGetuserclass')) {
require_once(e_HANDLER.'user_func.php');
}
$uc = e107_userGetuserclass($postID);
}
if (check_class($pref['image_post_class'],$uc)) {
return "<img src='".$code_text."' {$parmStr} />";
}
else
{
return ($pref['image_post_disabled_method'] ? "[ image disabled ]" : "Image: $code_text");
}
}
else
{
if ($pref['image_post_disabled_method']) {
return '[ image disabled ]';
} else {
return "Image: $code_text";
}
}
}

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>";

26
e107_files/bbcode/link.bb Normal file
View File

@@ -0,0 +1,26 @@
global $pref;
$parm = trim($parm);
$external = (($pref['links_new_window'] || strpos($parm, 'external') === 0) && substr($parm,0,1) != "#") ? " rel='external'" : "";
if(strpos($parm,"{e_")!==FALSE){
$external = "";
}
if(substr($parm,0,6) == "mailto")
{
list($pre,$email) = explode(":",$parm);
list($p1,$p2) = explode("@",$email);
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 ($parm && $parm != 'external' && strpos($parm, ' ') === FALSE)
{
$parm = preg_replace('#^external.#is', '', $parm);
return "<a class='bbcode' href='".$tp -> toAttribute($parm)."'".$external.">".$code_text."</a>";
}
else
{
return "<a class='bbcode' href='".$tp -> toAttribute($link_text)."'".$external.">".$code_text."</a>";
}

48
e107_files/bbcode/list.bb Normal file
View File

@@ -0,0 +1,48 @@
/* Tag: unordered list [list]*line 1*line2*line 3*line 4*line5 etc[/list] */
/* Tag: ordered list [list=<list type>]*line 1*line2*line 3*line 4*line5 etc[/list] */
/* 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(preg_match("#\[list\](.*?)\[/list\]#si", $full_text, $match))
{
/* unordered list */
$listitems = explode("*", $match[1]);
$listtext = "<ul>";
foreach($listitems as $item)
{
if($item && $item != E_NL)
{
$listtext .= "<li>$item</li>";
}
}
$listtext .= "</ul>";
return $listtext;
}
else if(preg_match("#\[list=(.*?)\](.*?)\[/list\]#si", $full_text, $match))
{
$type = $tp -> toAttribute($match[1]);
$listitems = $match[2];
$listitems = explode("*", $match[2]);
$listtext = "\n<ol style='list-style-type: $type'>";
foreach($listitems as $item)
{
if($item && $item != E_NL)
{
$listtext .= "<li>$item</li>";
}
}
$listtext .= "</ol>";
return $listtext;
}

4
e107_files/bbcode/php.bb Executable file
View File

@@ -0,0 +1,4 @@
$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);

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_files/bbcode/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_files/bbcode/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,20 @@
/* 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)."' ";
}
preg_match ("#\](.*?)\[/textarea#", $full_text, $match);
$value = $match[1];
return "<textarea $tastr>$value</textarea>";

View File

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

1
e107_files/bbcode/u.bb Normal file
View File

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

14
e107_files/bbcode/url.bb Normal file
View File

@@ -0,0 +1,14 @@
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);
return "<a href='".$tp -> toAttribute($parm)."'".$external.">".$code_text."</a>";
}
else
{
return "<a href='".$tp -> toAttribute($code_text)."'".$external.">".$code_text."</a>";
}