A decision may change the lifelong! 注册 | 登陆

UBB Hack for Sablog-X 1.1

作者网站:http://www.bpsky.net/

详细的使用方法.
首先下载扩展包,我已经修改写好的了这个函数,你需要复修替换原来的就行了.设计思路是外挂式的.就是说,我写的函数是脱离sax内核独力执行的,所以理论上是不存在安全性问题的.

1.下载并解压扩展包,
2.替换./include/common.js文件.
3.重点了..按照下例在show.htm文件中加入ubb面板与替换表情功能...
/***********************UBB显示部分修改**************************/
//原始模板评论显示语法..
foreach($commentdb as $key => $comment){print <<<EOT
--><a name="cm$comment[commentid]"></a><div class="cmcontent" id="comm_$comment[commentid]">$comment[content]</div>

//hack过后的评论内容转换...
foreach($commentdb as $key => $comment){
$UBBcomment=replaceUBB($comment[content],$options['templatename']);
print <<<EOT
-->
<a name="cm$comment
[commentid]"></a>
<div class="acmcontent" id="comm_$comment
[commentid]">$UBBcomment</div><!--end-->

/***************************UBB Panel*******************************/
//UBB面板插入..
<textarea name="content" id="content" cols="56" rows="8" onkeydown="ctlent(event);"></textarea>
/*         *         上面这段代码是你的模板评论输入栏的位子,你可以修改显示UBB标签的位置         *         */


<div class="UBBpanel">
<
div class="title">Add UBB</div>
<!--
EOT;


$ubb=ubb_exists($options['templatename']);


foreach(
$ubb as $var){
print <<<EOT
-->
<div class="ubbimg" onmouseover="this.style.border='2px solid #CCCCCC'" onmouseout="this.style.border='2px solid #EDF8DD'"><img src="./templates/
{$options['templatename']}/ubbimg/{$var}.gif" onclick='insertUBB("$var")' alt="表情" /></div>
<!--
EOT;
}
print <<<EOT
-->
<div class="clear"></div>
</div><!--end UBBPanel-->

4.好了,去网上找你喜欢的ubb表情吧~~然后上传到你的模板(./templates/模板名/ubbimg)
5.修改你的ubb图片名称.有两项硬性规定..大家要注意一下.这是为了让系统自动扫描你的ubb图片作的一些限定.
UBB图片名称必需以ubb01.gif延伸到ubb99.gif,目前系统只扫描到01-99个UBB表情,相信已经够用了.UBB表情图片只支持gif文件.
6.特别注意一下,因为个人的blog里修改了很多global的文件,已经和官方不同..所以回收global.php文件,请自行加入以下代码..0702
function replaceUBB($content,$template){
$ubb=preg_replace('/(\[ubb)(\d{2})(\])/',"<img src='./templates/$template/ubbimg/ubb\\2.gif' alt='表情'/>",$content);
return 
$ubb;
}


function 
ubb_exists($template){
$i=0;
$file_path="./templates/$template/ubbimg/";
while(
true){
$i++;
$temp_path=($i<=9)?($file_path.'ubb0'.$i.'.gif'):($file_path.'ubb'.$i.'.gif');
if( 
file_exists($temp_path) ){
         
$ubb[$i]=$i<=9?"ubb0$i":"ubb$i";
}else{
         break;
}
}
return 
$ubb;
}

7.不会修改s的朋友可以下载我已经修改好的show.htm文件.只能应用到官方效果中...非官方模板,自行研究了.

图片附件:
大小: 120.77 K
尺寸: 444 x 452
浏览: 100 次
点击打开新窗口浏览全图

Tags: sablog, hack

« 上一篇 | 下一篇 »

只显示5条记录相关文章

Ellen for Sablog-X 1.1 (浏览: 2685, 评论: 3)
[SaI]让你体验Sablog的Ajax前台调用! (浏览: 3103, 评论: 10)
UBB Hack for Sablog-X 1.1 [FAQ] (浏览: 3398, 评论: 0)
Byron for Sablog-X 1.1加强版 (浏览: 2503, 评论: 0)
Hato for Sablog-X 1.0 (浏览: 2830, 评论: 0)

发表评论

评论内容 (必填):