#*******************************************#
# 奇虎组图简化版 For MX2.6.1
# ------------------------------------------------------
# 开发:YiYoRain
# 最后更新:2008-4-12 22:00
# 插件形式:奇虎API调用
# 安装:易
#********************************************#
这是利用奇虎最近公开的API制作的,之前我向奇虎的客服反映过要求公开API
在此之前也研究过DZ的,无奈DZ代码实在太乱HACK毫无头绪
如果推出3.0 继续跟进升级
另,因为是简化版,所以和DZ功能上还有很大差距,比如组图搜索和附件功能等
=================================
安装步骤
=================================
0.注册奇虎组图联盟帐号
http://z.xkoo.com/
拿到简化版的代码(里面有你的帐号和密码)
1.复制文件
把includes和editor两个文件夹复制到论坛根目录并覆盖
其中的文件如果你修改过,请参考最后的手动文件修改
2.修改模板
风格管理->编辑模板->newpost->newpost_end
找到[code=xml]
<form action='./../../&'quot;attach.php" method="post" enctype="multipart/form-data" id="mxb_attachform" name="mxb_attachform" target="attachframe">
[/code]
在此前面加入你从奇虎组图得到的简化版插件代码
你可以复制我的代码
[code=xml]
<!--++ plugin_code qcomic begin-->
<script type="text/javascript">
var qcomic_phid = 0;
var qcomic_status = 0;
function qcomic_lite_status(phid, phidstatus) {
qcomic_phid = phid;
qcomic_status = phidstatus;
}
function setImageInfo(phid, phidstatus) {
qcomic_phid = phid;
qcomic_status = phidstatus;
}
function qcomic_lite_submit(phid) {
qcomic_lite_status(phid, 0);
// 这里写提交的代码,例子如下
var retval = document.mxbform.onsubmit();
if (retval==true) document.mxbform.submit();
}
function qcomic_lite_addgroupubb(fname, fparams, idx) {
// 这里写增加ubb的代码,例子如下
insertqcomic(idx,fparams);
}
</script>
<script type="text/javascript" src='./../../&'quot;includes/javascript/qcomic.js"></script>
<script language="javascript" type="text/javascript">
flashTagIns.setNew("http://p.xkoo.com/flash/upload_lite_v2.swf", 750, 45);
flashTagIns.setVersion("7,0,19,0");
flashTagIns.setId('qcomic_lite_upload');
flashTagIns.allowscriptAccess = "always";
flashTagIns.swLiveConnect = "true";
flashTagIns.wmode = "transparent";
flashTagIns.flashVars = '这里使用你的代码对应的参数';
flashTagIns.write(document);
window.qcomic_lite_upload = document.getElementById('mxbform').qcomic_lite_upload;
</script>
<div id="qcomic_edit_container_lite"></div>
<!--++ plugin_code qcomic end-->
[/code]
从奇虎的简化版插件代码的同样位置找到你的ID和密码,把上面的“这里使用你的代码对应的参数”改成你的就可以了
第二处
风格管理->编辑模板->newpost->newpost_header
找到[code=xml]function check_form_attach() {[/code]
后面加入[code=xml]
//--++ plugin_code qcomic begin
if (typeof(qcomic_status)!='undefined' && qcomic_status) {
alert("您上传了图片,请先把图片代码插入到正文中");
return false;
}
//--++ plugin_code qcomic end
[/code]
3.对照step_ubb.jpg添加新的UBB
后台->BBcode管理->添加新的BBcode
其中自定义 BBcode 替换代码为
[code=xml]
<!--++ plugin_code qcomic begin-->
<!-{content}-->
<script src='./../../&'quot;includes/javascript/qcomic.js" type="text/javascript"></script><br>
<div id="qcomic_view_{option}_before" style="clear:both; overflow:hidden;"></div>
<script language="javascript" type="text/javascript">
flashTagIns.setNew("http://p.xkoo.com/flash/pic_nav.swf", 750, 50);
flashTagIns.setVersion("7,0,19,0");
flashTagIns.setId('qcomic_flash_{option}');
flashTagIns.allowscriptAccess = "always";
flashTagIns.allowFullScreen = "true";
flashTagIns.swLiveConnect = "true";
flashTagIns.wmode = null;
flashTagIns.flashVars = '{content}';
flashTagIns.write(document);
window.qcomic_flash_{option}= document.modactions.qcomic_flash_{option};
//qcomic_proxy.qcomic_debug('[viewthread.htm]'+flashTagIns);
</script>
<div id="qcomic_view_{option}_after" style="clear:both; overflow:hidden;"></div>
<div id="qcomic_edit_container_lite"></div>
<!--++ plugin_code qcomic end-->
[/code]
到此完成,测试一下~~~~
===========================================
附:
手动修改代码
editor/mxe.js
找到function insertattach(atid)
前面插入
[code=xml]
function insertqcomic(idx,atid) {
if (!mxeTxa){
mxeWin.focus();
}else{
mxeTxa.focus();
}
setRange(mxe);
if(wMode) {
attach = " [pp="+idx+"]"+atid+"[/pp] ";
if (isIE) {
rng.select();
rng.pasteHTML(attach);
} else mexcCommand('insertHTML', false, attach);
} else {
insertText(" [pp="+idx+"]"+atid+"[/pp]");
}
}
[/code]
includes/functions_codeparse.php
找到[code=PHP]
$row['bbcodereplacement'] = str_replace( array('{option}', '{content}'), array($match[2][$i], $match[3][$i]), $row['bbcodereplacement'] );
$text = str_replace( $match[0][$i], $row['bbcodereplacement'], $text );
[/code]
这段代码有BUG
换成
[code=php]
//YiYoRain 2008-4-12debug
$t= str_replace( array('{option}', '{content}'), array($match[2][$i], $match[3][$i]), $row['bbcodereplacement'] );
$text = str_replace( $match[0][$i], $t, $text );
[/code]
你的论坛不知道为什么,把传给奇虎的地址串中的&解析成了&
看看是不是过滤的问题