======================================
Mod ubbc for 2.0
by RED
=====================================
Download về các file cần thiết :
skin_cache/cacheid_2/skin_post.php
sources/lib/post_parser.php
Vào:
• skin_cache/cacheid_2/skin_post.php và tìm trong function postbox_buttons($data="") {:
CODE
<script type='text/javascript' src='jscripts/ipb_bbcode.js'></script>
</td>
<td class='pformright'>
<input type='button' accesskey='b' value=' B ' onclick='simpletag("B")' class='codebuttons' name='B' style="font-weight:bold" onmouseover="hstat('bold')" />
<input type='button' accesskey='i' value=' I ' onclick='simpletag("I")' class='codebuttons' name='I' style="font-style:italic" onmouseover="hstat('italic')" />
<input type='button' accesskey='u' value=' U ' onclick='simpletag("U")' class='codebuttons' name='U' style="text-decoration:underline" onmouseover="hstat('under')" />
<select name='ffont' class='codebuttons' onchange="alterfont(this.options[this.selectedIndex].value, 'FONT')" onmouseover="hstat('font')">
<option value='0'>{$ibforums->lang['ct_font']}</option>
<option value='Arial' style='font-family:Arial'>{$ibforums->lang['ct_arial']}</option>
<option value='Times' style='font-family:Times'>{$ibforums->lang['ct_times']}</option>
<option value='Courier' style='font-family:Courier'>{$ibforums->lang['ct_courier']}</option>
<option value='Impact' style='font-family:Impact'>{$ibforums->lang['ct_impact']}</option>
<option value='Geneva' style='font-family:Geneva'>{$ibforums->lang['ct_geneva']}</option>
<option value='Optima' style='font-family:Optima'>Optima</option>
</select><select name='fsize' class='codebuttons' onchange="alterfont(this.options[this.selectedIndex].value, 'SIZE')" onmouseover="hstat('size')">
<option value='0'>{$ibforums->lang['ct_size']}</option>
<option value='1'>{$ibforums->lang['ct_sml']}</option>
<option value='7'>{$ibforums->lang['ct_lrg']}</option>
<option value='14'>{$ibforums->lang['ct_lest']}</option>
</select><select name='fcolor' class='codebuttons' onchange="alterfont(this.options[this.selectedIndex].value, 'COLOR')" onmouseover="hstat('color')">
<option value='0'>{$ibforums->lang['ct_color']}</option>
<option value='blue' style='color:blue'>{$ibforums->lang['ct_blue']}</option>
<option value='red' style='color:red'>{$ibforums->lang['ct_red']}</option>
<option value='purple' style='color:purple'>{$ibforums->lang['ct_purple']}</option>
<option value='orange' style='color:orange'>{$ibforums->lang['ct_orange']}</option>
<option value='yellow' style='color:yellow'>{$ibforums->lang['ct_yellow']}</option>
<option value='gray' style='color:gray'>{$ibforums->lang['ct_grey']}</option>
<option value='green' style='color:green'>{$ibforums->lang['ct_green']}</option>
</select>
<a href='javascript:closeall();' onmouseover="hstat('close')">{$ibforums->lang['js_close_all_tags']}</a>
<br />
<input type='button' accesskey='h' value=' http:// ' onclick='tag_url()' class='codebuttons' name='url' onmouseover="hstat('url')" />
<input type='button' accesskey='g' value=' IMG ' onclick='tag_image()' class='codebuttons' name='img' onmouseover="hstat('img')" />
<input type='button' accesskey='e' value=' @ ' onclick='tag_email()' class='codebuttons' name='email' onmouseover="hstat('email')" />
<input type='button' accesskey='q' value=' QUOTE ' onclick='simpletag("QUOTE")' class='codebuttons' name='QUOTE' onmouseover="hstat('quote')" />
<input type='button' accesskey='p' value=' CODE ' onclick='simpletag("CODE")' class='codebuttons' name='CODE' onmouseover="hstat('code')" />
<input type='button' accesskey='l' value=' LIST ' onclick='tag_list()' class='codebuttons' name="LIST" onmouseover="hstat('list')" />
<!--<input type='button' accesskey='l' value=' SQL ' onclick='simpletag("SQL")' class='codebuttons' name='SQL'>
<input type='button' accesskey='t' value=' HTML ' onclick='simpletag("HTML")' class='codebuttons' name='HTML'>-->
<br />
{$ibforums->lang['hb_open_tags']}: <input type='text' name='tagcount' size='3' maxlength='3' style='font-size:10px;font-family:verdana,arial;border:0px;font-weight:bold;' readonly="readonly" class='row1' value="0" />
<input type='text' name='helpbox' size='50' maxlength='120' style='width:auto;font-size:10px;font-family:verdana,arial;border:0px' readonly="readonly" class='row1' value="{$ibforums->lang['hb_start']}" />
</td>
</tr>
<tr>
Thay bằng:
CODE
<td class='row1'>
<script language="javascript" type="text/javascript" src="html/UBBC/ubbc.js"></script>
<script language="javascript" type="text/javascript"><!--
var flash_w = '200'; var flash_h = '400';
var ubbc_dir = 'html/UBBC';
var emoticon_dir = 'style_emoticons/default';
var use_graphics = 1; // 1 = Graphical, 0 = Form based (buttons)
makeInterface(1,1,use_graphics);
//--></script>
</td>
</tr>
<tr>
Tìm Tiếp :
CODE
textarea cols='80' rows='20' name='Post' tabindex='5' class='textarea'>$data</textarea>
Thay bằng :
CODE
<textarea cols="80" rows="20" wrap="soft" name="Post" tabindex="3" class="textinput" onClick="storeCaret(this);" onKeyup="storeCaret(this);" onChange="storeCaret(this);" onFocus="storeCaret(this);">*$data</textarea>
<script language="javascript"><!--
ubbcInit(1,1,use_graphics);
//--></script>
------------------
Tương tự , các bạn lặp lại bước này ở function pm_postbox_buttons($data="") {
------------------
Sau đó các bạn mở ./sources/lib/post_parser.php và tìm:
CODE
$txt = preg_replace( "#\[s\](.+?)\[/s\]#is", "<s>\\1</s>", $txt );
Thêm phía dưới:
CODE
$txt = preg_replace( "#\[shadow=(\S+?)\s*\](.*?)\[\/shadow\]#is", "<font style='width=80%; filter:shadow\(color=\\1)'>\\2</font>", $txt );
$txt = preg_replace( "#\[glow=(\S+?)\s*\](.*?)\[\/glow\]#is", "<font style='width=80%; filter:glow\(color=\\1)'>\\2</font>", $txt );
$txt = preg_replace( "#\[fliph\](.+?)\[\/fliph\]#is", "<font style='width=80%; filter:flipH'>\\1</font>", $txt );
$txt = preg_replace( "#\[flipv\](.+?)\[\/flipv\]#is", "<font style='width=80%; filter:flipV'>\\1</font>", $txt );
$txt = preg_replace( "#\[move\](.+?)\[\/move\]#is", "<marquee>\\1</marquee>", $txt );
$txt = preg_replace( "#\[blur\](.*?)\[\/blur\]#is", "<font style='width=80%; filter:blur'>\\1</font>", $txt );
$txt = preg_replace( "#\[align\s*=\s*(\S+?)\s*\](.*?)\[\/align\]#is", "<div align=\"\\1\">\\2</div>", $txt );
$txt = preg_replace( "#\[dropshadow=(\S+?)\s*\](.*?)\[\/dropshadow\]#is", "<font style='width=80%; filter:dropshadow(color=\\1)'>\\2</font>", $txt );
$txt = preg_replace( "#(\[invert\])(.+?)(\[/invert\])#is", "<font style='width=80%; filter:invert'>\\2</font>", $txt );
$txt = preg_replace( "#(\[xray\])(.+?)(\[/xray\])#is", "<font style='width=80%; filter:xray'>\\2</font>", $txt );
$txt = preg_replace( "#\[spoiler\](.*)\[/spoiler\]#is", "<\!-- spoilerKillit --><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td bgcolor=\"#000000\" valign=\"middle\" align=\"left\"><font color=\"#000000\" size=\"1\"><b>Spoiler (Highlight to Read)\:</b></font><br></td></tr><tr><td bgcolor=\"#ffffff\" valign=\"middle\" align=\"left\"><font color=\"#ffffff\" size=\"1\"><\!-- spoilerKillitEnd --><\!--txtStart-->\\1<\!--txtEnd--><\!-- spoilerKillit --></td></tr></table><\!-- spoilerKillitEnd -->", $txt );
$txt = preg_replace( "#\[video\](.+?)\[/video\]#is", "<div align=\"center\"><embed SRC=\\1 type=\"audio/x-pn-realaudio-plugin\" CONSOLE=\"Clip1\"CONTROLS=\"ImageWindow,ControlPanel,StatusBar\" HEIGHT=\"230\" WIDTH=\"240\"AUTOSTART=\"false\"></embed>", $txt );
$txt = preg_replace( "#\[sound\](.+?)\[/sound\]#is", "<param name=\"BACKGROUNDCOLOR\" <br /><embed src=\\1 align=\"baseline\" border=\"0\" width=\"275\" height=\"40\" type=\"audio/x-pn-realaudio-plugin\" console=\"Clip1\" controls=\"ControlPanel\" autostart=\"true\">", $txt );
$txt = preg_replace( "#\[web\](.+?)\[/web\]#is", "<IFRAME WIDTH=550 HEIGHT=400 SRC=\\1></IFRAME>", $txt );
$txt = preg_replace( "#\[me\](.+?)\[/me\]#is", "<b>*" . $ibforums->member['name'] . " \\1</b><br>", $txt );
Rồi tìm tiếp :
CODE
function unconvert($txt="", $code=1, $html=0) {
$txt = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $txt );
if ($code == 1)
{
Thêm vào phía dưới:
CODE
$txt = preg_replace( "#(<font style='width=80%; filter:invert'>)(.+?)(</font>)#is", "\[invert\]\\2\[/invert\]", $txt );
$txt = preg_replace( "#(<font style='width=80%; filter:xray'>)(.+?)(</font>)#is", "\[xray\]\\2\[/xray\]", $txt );
$txt = preg_replace( "#(<marquee>)(.+?)(</marquee>)#is", "\[move\]$2\[/move\]", $txt );
$txt = preg_replace( "#(<font style='width=80%; filter:glow\(color=)(.+?)(\)'>)(.+?)(</font>)#is", "\[glow=\\2\]\\4\[/glow\]", $txt );
$txt = preg_replace( "#(<font style='width=80%; filter:shadow\(color=)(.+?)(\)'>)(.+?)(</font>)#is", "\[shadow=\\2\]\\4\[/shadow\]", $txt );
$txt = preg_replace( "#(<font style='width=80%; filter:flipV'>)(.+?)(</font>)#is", "\[flipv\]\\2\[/flipv\]", $txt );
$txt = preg_replace( "#(<font style='width=80%; filter:flipH'>)(.+?)(</font>)#is", "\[fliph\]\\2\[/fliph\]", $txt );
$txt = preg_replace( '#(<div align=")(.+?)(">)(.+?)(</div>)#is', "\[ALIGN=\\2\]\\4\[/ALIGN\]", $txt );
$txt = preg_replace( "#(<font style='width=80%; filter:blur'>)(.+?)(</font>)#is", "\[blur\]\\2\[\/blur]", $txt );
$txt = preg_replace( "#(<font style='width=80%; filter:dropshadow\(color=)(.+?)(\)'>)(.+?)(</font>)#is", "\[dropshadow=\\2\]\\4\[\/dropshadow\]", $txt );
$txt = preg_replace( "#(<\!--txtStart-->)(.+?)(<\!--txtEnd-->)#is", "\[spoiler\]\\2\[/spoiler\]", $txt );
$txt = preg_replace( "#(<\!-- spoilerKillit -->)(.+?)(<\!-- spoilerKillitEnd -->)#is", "", $txt );
$txt = preg_replace( "#<param name=\"BACKGROUNDCOLOR\" <br /><embed src=(.+?)align=\"baseline\" border=\"0\" width=\"275\" height=\"40\" type=\"audio/x-pn-realaudio-plugin\" console=\"Clip1\" controls=\"ControlPanel\" autostart=\"true\">#" , "\[sound\]\\1\[/sound\]" , $txt );
$txt = preg_replace( "#<div align=\"center\"><embed SRC=(.+?)type=\"audio/x-pn-realaudio-plugin\" CONSOLE=\"Clip1\"CONTROLS=\"ImageWindow,ControlPanel,StatusBar\" HEIGHT=\"230\" WIDTH=\"240\"AUTOSTART=\"false\"></embed>#" , "\[video\]\\1\[/video\]" , $txt );
$txt = preg_replace( "#<IFRAME WIDTH=550 HEIGHT=400 SRC=(.+?)></IFRAME>#" , "\[web\]\\1\[/web\]" , $txt );
$txt = preg_replace( "#\[me\](.+?)\[/me\]#is", "<b>*" . $ibforums->member['name'] . " \\1</b><br>", $txt );
$txt = preg_replace( "#\[me\](.+)#is", "*" . $ibforums->member['name'] . " \\1<br>", $txt );
Tạo thư mục html/UBBC trong thư mục diễn đàn của bạn và upload các file trong file đính kèm vào đó là xong!
Chúc may mắn!