本文介绍一下新增可以由自己发布并已经的文章的方法,希望能够满足各位同学的需求。
本文是对《》的补充
ps:本文只提供分类的删除,请各位同学注意
修改方法:
1,修改templates/default/cp_news.html.php文件
查找
<td class="td_input"><!--{if $do=='me'}--><input type="checkbox" value="$value[itemid]" name="item[]"/><!--{/if}--></td> |
替换为
<td class="td_input"><input type="checkbox" value="$value[itemid]" name="item[]"/></td> |
查找
<!--{if $do == 'me'}--> <tr class="checkall_box"> <td class="td_input"><input type="checkbox" onclick="checkall(this.form, 'item')" name="chkall"/> </td> <td colspan="4"><label for="check_all">全选</label> <input class="input_del" type="submit" value="删除" name="delitemsubmit" onclick="return confirm('删除不可恢复\n确认删除?');"/></td> </tr> <!--{/if}-->
|
替换为
<tr class="checkall_box"> <td class="td_input"><input type="checkbox" onclick="checkall(this.form, 'item')" name="chkall"/> </td> <td colspan="4"><label for="check_all">全选</label> <input class="input_del" type="submit" value="删除" name="delitemsubmit" onclick="return confirm('删除不可恢复\n确认删除?');"/></td> <input type="hidden" name="do" value="$do"/> </tr>
|
2,修改source/cp_news.php文件
查找
} elseif(submitcheck('delitemsubmit')) {
$itemarr = array();
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('postitems').' WHERE itemid IN('.simplode($_POST['item'], ',').') AND uid=\''.$_SGLOBAL['supe_uid'].'\''); while($value = $_SGLOBAL['db']->fetch_array($query)) { $itemarr[] = $value['itemid']; $type = $value['type']; $tag_itemidarr[] = empty($value['oitemid']) ? $value['itemid'] : $value['oitemid']; }
$_SGLOBAL['db']->query('DELETE FROM '.tname('postitems').' WHERE itemid IN('.simplode($itemarr, ',').')'); $_SGLOBAL['db']->query('DELETE FROM '.tname('postmessages').' WHERE itemid IN('.simplode($itemarr, ',').')');
//删除并更表总数 $tagarr = array('existsname'=>array(),'nonename'=>array(),'closename'=>array(),'existsid'=>array()); foreach($tag_itemidarr as $id){ postspacetag('update', $type, $id, $tagarr, '0'); }
showmessage('do_success', 'cp.php?ac=news&op=list&type='.$type);
} elseif(!empty($_POST['postnews'])) { |
替换为
} elseif(submitcheck('delitemsubmit')) { $itemarr = array(); $tablename = ($do == 'pass') ? 'spaceitems' : 'postitems'; $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname($tablename).' WHERE itemid IN('.simplode($_POST['item'], ',').') AND uid=\''.$_SGLOBAL['supe_uid'].'\''); while($value = $_SGLOBAL['db']->fetch_array($query)) { $itemarr[] = $value['itemid']; } if(empty($itemarr)) { showmessage('no_item'); } $itemidstr = simplode($itemarr); //直接删除0,放入删除箱为1 $zj_status = 1; if($do == 'pass') { //发布箱->删除 deleteitems('itemid', $itemidstr, $zj_status); } else { //待审箱->删除 deleteitems('itemid', $itemidstr, $zj_status, 1); } showmessage('do_success', 'cp.php?ac=news&op=list&type='.$type.'&do='.$do); } elseif(!empty($_POST['postnews'])) { |
ok,修改完成 (责任编辑:最模板) |