解决supesite待审箱内文章附件无法编辑的bug 蘑菇今天介绍一下解决supesite待审箱内文章附件无法编辑bug的方法,希望能够帮助各位同学
1,修改根目录/admin /admin_spacenews.php文件
查找
//UPLOAD
$thevalue['uploadarr'] = array();
if(!empty($thevalue['haveattach'])) {
$query = $_SGLOBAL['db']->query('SELECT * FROM'.tname('attachments').' WHERE itemid=\''.$itemid.'\' ORDER BY dateline');
替换为
//UPLOAD
$thevalue['uploadarr'] = array();
if(!empty($thevalue['haveattach'])) {
$query = $_SGLOBAL['db']->query('SELECT * FROM'.tname('attachments').' WHERE itemid=\''.$itemid.'\' andhash=\''.$thevalue['hash'].'\' ORDER BY dateline');
查找
$query = $_SGLOBAL['db']->query('SELECT ii.*, i.* FROM'.tname('postitems').' ii LEFT JOIN '.tname('postmessages').' i ONi.itemid=ii.itemid WHERE ii.itemid=\''.$itemid.'\'');
$thevalue = $_SGLOBAL['db']->fetch_array($query);
$page = 1;
$spacetag_itemid = empty($thevalue['oitemid']) ? $itemid : $thevalue['oitemid'];
$thevalue['tagname'] = gettagname($spacetag_itemid, '0'); //TAG
在之后添加
if(!empty($thevalue['haveattach'])) {
$query = $_SGLOBAL['db']->query('SELECT * FROM'.tname('attachments').' WHERE itemid=\''.$itemid.'\' andhash=\''.$thevalue['hash'].'\' ORDER BY dateline');
while ($attach = $_SGLOBAL['db']->fetch_array($query)) {
$thevalue['uploadarr'][] = $attach;
}
if(empty($thevalue['uploadarr'])) {
$setsqlarr = array('haveattach' => 0);
$wheresqlarr = array('itemid' => $itemid);
updatetable('spaceitems', $setsqlarr, $wheresqlarr);
}
} 2,修改根目录/viewnews.php
查找
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('attachments').'WHERE itemid=\''.$itemid.'\'');
替换为
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('attachments').'WHERE itemid=\''.$itemid.'\' and hash=\''.$news['hash'].'\'');
ok,测试一下吧 解决supesite审批文章丢失附件的bug蘑菇今天给大家介绍一下解决supesite审批文章丢失附件bug的方法,希望能够帮组各位同学。
bug出现的条件:
设置一个用户组可以进入后台发文章但是需要审核,如果待审的文章中包含附件,那么审核后的咨询附件丢失
解决方法:
1,先解决supesite待审箱内文章附件无法编辑的bug,请参考《修改文档》
2,修改根目录/function/common.func.php文件
查找大约第2416行
inserttable('postmessages', saddslashes($itemmsg));
deletetable('spaceitems', array('itemid'=>$value['itemid']));
deletetable('spacenews', array('itemid'=>$value['itemid'])); |
在之前添加
$_SGLOBAL['db']->query('UPDATE '.tname('attachments').' SET itemid='.$itemmsg['itemid'].' WHERE itemid = \''.$value['itemid'].'\' and hash=\''.$value['hash'].'\''); |
查找大约第2464行
empty($value['oitemid']) ? updatespacetagspass($value['itemid'], '1', '1', $itemmsg['itemid']) : updatespacetagspass($value['oitemid'], '1'); |
在之后添加
$_SGLOBAL['db']->query('UPDATE '.tname('attachments').' SET itemid='.$itemmsg['itemid'].' WHERE itemid = \''.$value['itemid'].'\' and hash=\''.$value['hash'].'\''); |
ok,各位同学测试一下吧
增加supesite投稿时可以上传附件的功能
蘑菇今天向各位同学介绍一下增加supesite投稿时可以上传附件功能的方法,蘑菇在测试服务器上经过测试已经验证了程序的正确性,各位同学请放心使用。
建议修改前请先修改《解决supesite审批文章丢失附件的bug》
1,修改根目录/source/cp_news.php文件
查找
$itemarr = array('message' => $_POST['message'],
'relativetags' => addslashes(serialize($tagnamearr)), //相关TAG
'newsfrom' => $_POST['newsfrom'],
'newsauthor' => $_POST['newsauthor'],
'newsfromurl' => $_POST['newsfromurl'],
'postip' => $_SGLOBAL['onlineip'],
'includetags' => postgetincludetags($_POST['message'], $tagnamearr)
); |
在下面添加
$newsarr['hash'] = trim($_POST['hash']);
//附件
if(!empty($_POST['divupload']) && is_array($_POST['divupload'])) {
$newsarr['haveattach'] = 1;
} else {
$newsarr['haveattach'] = 0;
} |
查找
//更新用户最新更新时间
if($_SGLOBAL['supe_uid']) {
updatetable('members', array('updatetime'=>$_SGLOBAL['timestamp'], 'lastposttime'=>$_SGLOBAL['timestamp']), array('uid'=>$_SGLOBAL['supe_uid']));
} |
在下面添加
//附件
if($newsarr['haveattach']) {
$_SGLOBAL['db']->query('UPDATE '.tname('attachments').' SET isavailable=1, type=\''.$_POST['type'].'\', itemid='.$itemarr['itemid'].', catid=\''.$_POST['catid'].'\' WHERE hash=\''.$_POST['hash'].'\'');
} |
查找
} elseif($op == 'edit') { |
在上一行添加
$hashstr = smd5($_SGLOBAL['supe_uid'].'/'.$_SGLOBAL['timestamp'].random(6)); |
查找
$item['subject'] = shtmlspecialchars($item['subject']);
$item['message'] = jsstrip($item['message']); |
在下面添加
if(!empty($item['haveattach'])) {
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('attachments').' WHERE itemid=\''.$itemid.'\' ORDER BY dateline');
while ($attach = $_SGLOBAL['db']->fetch_array($query)) {
$item['uploadarr'][] = $attach;
}
}
$count = count($item['uploadarr']);
if(empty($item['noinsert'])) {
$item['noinsert'] = 0;
$inserthtml = getuploadinserthtml($item['uploadarr']);
} else {
$inserthtml = getuploadinserthtml($item['uploadarr'], 1);
} |
2,修改根目录/tempalte/default/cp_news.html.php文件
查找
<table width="100%" class="globalbox_border">
<tbody>
<tr>
<td width="100" align="right">获取远程资讯:</td> |
在上面添加
<input name="subjectpic" id="subjectpic" type="hidden" value="" />
<table cellspacing="0" cellpadding="0" width="100%" class="globalbox_border">
<tr id="tr_upload">
<th>内容附件:</th>
<td>
<div id="uploadbox">
<div class="tabs">
<a id="localuploadtab" href="javascript:;" class="current">本地上传</a>
<a id="remoteuploadtab" href="javascript:;" >远程上传</a>
<a id="batchuploadtab" href="javascript:;" >批量上传</a>
</div>
<div id="localupload">
<table cellpadding="0" cellspacing="0">
<tr>
<th>选择文件:</th>
<td><input name="localfile" type="file" id="localfile" size="28" /></td>
<td valign="bottom" rowspan="3" class="upbtntd"><button >上传</button></td>
</tr>
<tr>
<th>上传说明:</th>
<td><input name="uploadsubject0" type="text" size="40" /></td>
</tr>
</table>
</div>
<div id="remoteupload" style="display: none;">
<table cellpadding="0" cellspacing="0">
<tr>
<th>输入网址:</th>
<td><input type="text" size="40" name="remotefile" value="http://" /></td>
<td valign="bottom" rowspan="2" class="upbtntd"><button />上传</button></td>
</tr>
<tr>
<th>上传说明:</th>
<td><input name="uploadsubject1" type="text" size="40" /></td>
</tr>
</table>
</div>
<div id="batchupload" style="display: none;">
<table summary="" cellpadding="0" cellspacing="6" border="0" width="70%">
<tr>
<td><span id="batchdisplay"><input size="28" class="fileinput" id="batch_1" name="batchfile[]" type="file" /></span></td>
<td class="upbtntd">
<button id="doupfile" >上传</button>
</td>
</tr> <tr>
<td colspan="2">
<div id="batchpreview"></div>
</td>
</tr>
<tr>
<td colspan="2">
<button id="delall" name="delall" style="background: transparent; border: none; cursor: pointer; color: red; " >全部清空</button>
</td>
</tr>
</table>
</div>
<p class="textmsg" id="divshowuploadmsg" style="display:none"></p>
<p class="textmsg succ" id="divshowuploadmsgok" style="display:none"></p>
<input type="hidden" id="uploadallowmax" name="uploadallowmax" value="100">
<input type="hidden" name="uploadallowtype" value="$thevalue[allowtype]">
<input type="hidden" name="thumbwidth" value="$_SCONFIG[thumbarray][news][0]">
<input type="hidden" name="thumbheight" value="$_SCONFIG[thumbarray][news][1]">
<input type="hidden" name="noinsert" value="$thevalue['noinsert']">
<input name="hash" type="hidden" value="$hashstr" />
</div>
<div id="divshowupload">$inserthtml</div>
</td>
</tr>
</table> |
|
3,经网友提示,幻灯图没有显示,蘑菇新增修复方法
修改根目录/source/cp_news.php文件
查找
$_POST['type'] = shtmlspecialchars(trim($_POST['type'])); |
在下面添加
$_POST['picid'] = empty($_POST['picid'])?0:intval($_POST['picid']); //图文资讯标志
|
查找
'type' => $_POST['type'], |
在下面添加
'picid' => $_POST['picid'], |
ok,修改完成,请各位同学测试一下吧
|