<?
//
// H-Tracker v0.2
// http://h-tracker.org
// Based on TorrentTrader (http://www.torrenttrader.org)
//
//
function textbbcode($form,$name,$content="") {
global $site_config, $THEME;
//$form = form name
//$name = textarea name
//$content = textarea content (only for edit pages etc)
?>
<script language=javascript>
function SmileIT(smile,textarea){
// Attempt to create a text range (IE).
if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange)
{
var caretPos = textarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? smile + ' ' : smile
caretPos.select();
}
// Mozilla text range replace.
else if (typeof(textarea.selectionStart) != "undefined")
{
var begin = textarea.value.substr(0, textarea.selectionStart);
var end = textarea.value.substr(textarea.selectionEnd);
var scrollPos = textarea.scrollTop;
textarea.value = begin + smile + end;
if (textarea.setSelectionRange)
{
textarea.focus();
textarea.setSelectionRange(begin.length + smile.length, begin.length + smile.length);
}
textarea.scrollTop = scrollPos;
}
// Just put it on the end.
else
{
textarea.value += smile;
textarea.focus(textarea.value.length - 1);
}
}
function PopMoreSmiles(form,name) {
link='moresmiles.php?form='+form+'&text='+name
newWin=window.open(link,'moresmile','height=500,width=300,resizable=yes,scrollbars=yes');
if (window.focus) {newWin.focus()}
}
function PopMoreTags(form,name) {
link='tags.php?form='+form+'&text='+name
newWin=window.open(link,'moresmile','height=500,width=775,resizable=no,scrollbars=yes');
if (window.focus) {newWin.focus()}
}
function show_smilies(sender)
{
if(sender)
{
var getStyle = document.getElementById('toolseditor').style.visibility;
if(getStyle == "visible")
document.getElementById('toolseditor').style.visibility = "hidden";
else
document.getElementById('toolseditor').style.visibility = "visible";
}
else
{
document.getElementById('toolseditor').style.visibility = "hidden";
}
}
function BBTag(opentag, closetag, textarea)
{
// Can a text range be created?
if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange)
{
var caretPos = textarea.caretPos, temp_length = caretPos.text.length;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? opentag + caretPos.text + closetag + ' ' : opentag + caretPos.text + closetag;
if (temp_length == 0)
{
caretPos.moveStart("character", -closetag.length);
caretPos.moveEnd("character", -closetag.length);
caretPos.select();
}
else
textarea.focus(caretPos);
}
// Mozilla text range wrap.
else if (typeof(textarea.selectionStart) != "undefined")
{
var begin = textarea.value.substr(0, textarea.selectionStart);
var selection = textarea.value.substr(textarea.selectionStart, textarea.selectionEnd - textarea.selectionStart);
var end = textarea.value.substr(textarea.selectionEnd);
var newCursorPos = textarea.selectionStart;
var scrollPos = textarea.scrollTop;
textarea.value = begin + opentag + selection + closetag + end;
if (textarea.setSelectionRange)
{
if (selection.length == 0)
textarea.setSelectionRange(newCursorPos + opentag.length, newCursorPos + opentag.length);
else
textarea.setSelectionRange(newCursorPos, newCursorPos + opentag.length + selection.length + closetag.length);
textarea.focus();
}
textarea.scrollTop = scrollPos;
}
// Just put them on the end, then.
else
{
textarea.value += opentag + closetag;
textarea.focus(textarea.value.length - 1);
}
}
</script>
<table cellpadding="15" cellspacing="0" width="100%" align="center" border=0 class=ttable_col1><tr><td>
<table cellpadding="5" cellspacing="0" width="95%" align="center" border=0 class=table_editor>
<tr>
<td colspan=3 class="editorimage" align=center>
<img title="Bold" src="themes/<?=$THEME?>/images/editor/bold.gif" onclick="javascript: BBTag('[b]','[/b]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Italic" src="themes/<?=$THEME?>/images/editor/i.gif" onclick="javascript: BBTag('[i]','[/i]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Underline" src="themes/<?=$THEME?>/images/editor/u.gif" onclick="javascript: BBTag('[u]','[/u]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="List" src="themes/<?=$THEME?>/images/editor/list.gif" onclick="javascript: BBTag('[*]','',<?php echo "document.forms.".$form.".".$name; ?>)" /></div>
<img title="Code" src="themes/<?=$THEME?>/images/editor/code.gif" onclick="javascript: BBTag('[code]','[/code]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Quote" src="themes/<?=$THEME?>/images/editor/quote.gif" onclick="javascript: BBTag('[quote]','[/quote]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Url" src="themes/<?=$THEME?>/images/editor/url.gif" onclick="javascript: BBTag('[url]','[/url]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Image" src="themes/<?=$THEME?>/images/editor/img.gif" onclick="javascript: BBTag('[img]','[/img]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Text Align Left" src="themes/<?=$THEME?>/images/editor/left.gif" onclick="javascript: BBTag('[left]','[/left]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Text Align Center" src="themes/<?=$THEME?>/images/editor/center.gif" onclick="javascript: BBTag('[center]','[/center]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Text Align Right" src="themes/<?=$THEME?>/images/editor/right.gif" onclick="javascript: BBTag('[right]','[/right]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Video" src="themes/<?=$THEME?>/images/editor/video.gif" onclick="javascript: BBTag('[video]','[/video]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Youtube" src="themes/<?=$THEME?>/images/editor/youtube.gif" onclick="javascript: BBTag('[tube]','[/tube]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Google Video" src="themes/<?=$THEME?>/images/editor/googlevid.gif" onclick="javascript: BBTag('[gvideo]','[/gvideo]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Flash" src="themes/<?=$THEME?>/images/editor/flash.gif" onclick="javascript: BBTag('[swf]','[/swf]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Audio" src="themes/<?=$THEME?>/images/editor/sound.gif" onclick="javascript: BBTag('[audio]','[/audio]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Marquee Up" src="themes/<?=$THEME?>/images/editor/marq_up.gif" onclick="javascript: BBTag('[marqueeup]','[/marqueeup]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Marquee Left" src="themes/<?=$THEME?>/images/editor/marq_left.gif" onclick="javascript: BBTag('[marqueeleft]','[/marqueeleft]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Marquee Right" src="themes/<?=$THEME?>/images/editor/marq_right.gif" onclick="javascript: BBTag('[marqueeright]','[/marqueeright]',<?php echo "document.forms.".$form.".".$name; ?>)" />
<img title="Marquee Down" src="themes/<?=$THEME?>/images/editor/marq_down.gif" onclick="javascript: BBTag('[marqueedown]','[/marqueedown]',<?php echo "document.forms.".$form.".".$name; ?>)" />
</td>
</tr>
<tr>
<td colspan="3" class="editortext" align="center"><div id="toolseditor">
<?
$res_smilies = mysql_query("select * from smilies");
$count = 0;
echo "<table cellspacing=1 border=0 cellpadding=1>\n<tr>";
while($row_smilies = mysql_fetch_array($res_smilies))
{
if($count == 4)
{
echo "</tr><tr>";
$count=0;
}
echo "\n<td align='center' width='35'>\n<img src=\"images/smilies/".$row_smilies['id'].".gif\" border=\"0\" alt='Insert this smile' onclick=\"SmileIT('".($row_smilies['image_code'])."',document.forms.".$form.".".$name.");\" border=\"0\">\n</td>";
$count ++;
}
echo "</table></div>";
echo "<img src=\"images/smilies/1.gif\" border=\"0\" onclick=\"show_smilies('toolseditor')\">";
echo " - <a href=\"javascript: PopMoreSmiles('$form','$name','450','400','yes')\"><b>More Smiles</b></a> - ";
?>
<select onchange="BBTag('[color=' + this.options[this.selectedIndex].value.toLowerCase() + ']','[/color]', <?php echo "document.forms.".$form.".".$name; ?>); this.selectedIndex = 0;" size="1" style="background-color:#DEDEDE;" name="fontchange">
<option value="" selected="selected">Change Color</option>
<option value="Black" style="color:black">Black</option>
<option value="Red" style="color:red">Red</option>
<option value="Yellow" style="color:Yellow">Yellow</option>
<option value="Pink" style="color:Pink">Pink</option>
<option value="Green" style="color:Green">Green</option>
<option value="Orange" style="color:Orange">Orange</option>
<option value="Purple" style="color:Purple">Purple</option>
<option value="Blue" style="color:Blue">Blue</option>
<option value="Beige" style="color:Beige">Beige</option>
<option value="Brown" style="color:Brown">Brown</option>
<option value="Teal" style="color:Teal">Teal</option>
<option value="Navy" style="color:Navy">Navy</option>
<option value="Maroon" style="color:Maroon">Maroon</option>
<option value="LimeGreen" style="color:LimeGreen">Lime Green</option>
</select>
<select onchange="BBTag('[size=' + this.options[this.selectedIndex].value.toLowerCase() + ']','[/size]', <?php echo "document.forms.".$form.".".$name; ?>); this.selectedIndex = 0;" size="1" style="background-color:#DEDEDE;" name="fontchange">
<option value="" selected="selected">Font Size</option>
<option value="1">xx-small</option>
<option value="2">x-small</option>
<option value="3">small</option>
<option value="4">medium</option>
<option value="5">large</option>
<option value="6">x-large</option>
<option value="7">xx-large</option>
</select>
</td>
</tr>
<tr>
<td class="editor" align="center">
<textarea name="<? echo $name; ?>" rows="10" cols="50"><? echo $content; ?></textarea>
</td>
</td>
</tr>
</table></td></tr>
</table>
<?
}
?>