客户要求将权限改为多选,意思是:栏目和文章可以选择有几个科室能浏览,不是现在的单一科室和局领导。
应对此要求,就需要修改原来的逻辑了:
现将数据库中对应的权限字段由smallint改为varchar
arctype表的corank字段和archives表的arcrank字段
修改list.php函数,判断列表页的访问权限时,先遍历下文章的阅读权限,看用户的权限包含在(这里用到了in_array函数)是否符合文章阅读权限要求,不符合就提示权限错误。
<?php /** * * 栏目列表/频道动态页 * * @version $Id: list.php 1 15:38 2010年7月8日Z tianya $ * @package DedeCMS.Site * @copyright Copyright (c) 2007 - 2010, DesDev, Inc. * @license http://help.dedecms.com/usersguide/license.html * @link http://www.dedecms.com */ require_once(dirname(__FILE__)."/../include/common.inc.php"); //$t1 = ExecTime(); $tid = (isset($tid) && is_numeric($tid) ? $tid : 0); $channelid = (isset($channelid) && is_numeric($channelid) ? $channelid : 0); if($tid==0 && $channelid==0) die(" Request Error! "); if(isset($TotalResult)) $TotalResult = intval(preg_replace("/[^\d]/", '', $TotalResult)); //如果指定了内容模型ID但没有指定栏目ID,那么自动获得为这个内容模型的第一个顶级栏目作为频道默认栏目 if(!empty($channelid) && empty($tid)) { $tinfos = $dsql->GetOne("SELECT tp.id,ch.issystem FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.channeltype='$channelid' And tp.reid=0 order by sortrank asc"); if(!is_array($tinfos)) die(" No catalogs in the channel! "); $tid = $tinfos['id']; } else { $tinfos = $dsql->GetOne("SELECT ch.issystem FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id='$tid' "); } //管理员级别 if($tinfos['issystem']==-1) { $nativeplace = ( (empty($nativeplace) || !is_numeric($nativeplace)) ? 0 : $nativeplace ); $infotype = ( (empty($infotype) || !is_numeric($infotype)) ? 0 : $infotype ); if(!empty($keyword)) $keyword = FilterSearch($keyword); $cArr = array(); if(!empty($nativeplace)) $cArr['nativeplace'] = $nativeplace; if(!empty($infotype)) $cArr['infotype'] = $infotype; if(!empty($keyword)) $cArr['keyword'] = $keyword; include(DEDEINC."/arc.sglistview.class.php"); $lv = new SgListView($tid,$cArr); } else { include(DEDEINC."/arc.listview.class.php"); $lv = new ListView($tid); //对设置了会员级别的栏目进行处理 //文章权限>0 if(isset($lv->Fields['corank']) && $lv->Fields['corank'] !="") { require_once(DEDEINC.'/memberlogin.class.php'); $cfg_ml = new MemberLogin(); $ranks=explode(",",$lv->Fields['corank']); foreach($ranks as $rank){ //文章阅读权限>10,用户权限>10&&!=100 则只有相等才能阅读 if( $rank>10 &&$cfg_ml->M_Rank>10 &&$cfg_ml->M_Rank!=100 && !in_array($cfg_ml->M_Rank,$ranks) ) { $dsql->Execute('me' , "SELECT * FROM `#@__arcrank` "); while($row = $dsql->GetObject('me')) { $memberTypes[$row->rank] = $row->membername; } $memberTypes[0] = "游客或没权限会员"; $msgtitle = "你没有权限浏览栏目:{$lv->Fields['typename']} !"; $moremsg = "这个栏目需要 <font color='red'>".$memberTypes[$rank]."</font> 才能访问,你目前是:<font color='red'>".$memberTypes[$cfg_ml->M_Rank]."</font> !"; include_once(DEDETEMPLATE.'/plus/view_msg_catalog.htm'); exit(); }else if(($cfg_ml->M_Rank<=10 ||$cfg_ml->M_Rank ==100 )&&($cfg_ml->M_Rank < $rank)){ $dsql->Execute('me' , "SELECT * FROM `#@__arcrank` "); while($row = $dsql->GetObject('me')) { $memberTypes[$row->rank] = $row->membername; } $memberTypes[0] = "游客或没权限会员"; $msgtitle = "你没有权限浏览栏目:{$lv->Fields['typename']} !"; $moremsg = "这个栏目需要 <font color='red'>".$memberTypes[$rank]."</font> 才能访问,你目前是:<font color='red'>".$memberTypes[$cfg_ml->M_Rank]."</font> !"; include_once(DEDETEMPLATE.'/plus/view_msg_catalog.htm'); exit(); } } } } if($lv->IsError) ParamError(); $lv->Display();
3.修改vew.php文件,修改文章权限逻辑,判断登录用户是否包含在文章权限内,逻辑同上。
<?php /** * * 关于文章权限设置的说明 * 文章权限设置限制形式如下: * 如果指定了会员等级,那么必须到达这个等级才能浏览 * 如果指定了金币,浏览时会扣指点的点数,并保存记录到用户业务记录中 * 如果两者同时指定,那么必须同时满足两个条件 * * @version $Id: view.php 1 15:38 2010年7月8日Z tianya $ * @package DedeCMS.Site * @copyright Copyright (c) 2007 - 2010, DesDev, Inc. * @license http://help.dedecms.com/usersguide/license.html * @link http://www.dedecms.com */ require_once(dirname(__FILE__)."/../include/common.inc.php"); require_once(DEDEINC.'/arc.archives.class.php'); $t1 = ExecTime(); if(empty($okview)) $okview = ''; if(isset($arcID)) $aid = $arcID; if(!isset($dopost)) $dopost = ''; $arcID = $aid = (isset($aid) && is_numeric($aid)) ? $aid : 0; if($aid==0) die(" Request Error! "); $arc = new Archives($aid); if($arc->IsError) ParamError(); //检查阅读权限 $needMoney = $arc->Fields['money']; $needRank = $arc->Fields['arcrank']; require_once(DEDEINC.'/memberlogin.class.php'); $cfg_ml = new MemberLogin(); if($needRank < 0 && $arc->Fields['mid'] != $cfg_ml->M_ID) { ShowMsg('文章尚未审核,非作者本人无权查看!', 'javascript:;'); exit(); } //设置了权限限制的文章 //arctitle msgtitle moremsg if($needMoney>0 || $needRank!='') { $arctitle = $arc->Fields['title']; /* $arclink = GetFileUrl($arc->ArcID,$arc->Fields["typeid"],$arc->Fields["senddate"], $arc->Fields["title"],$arc->Fields["ismake"],$arc->Fields["arcrank"]); */ $arclink = $cfg_phpurl.'/view.php?aid='.$arc->ArcID; $arcLinktitle = "<a href=\"{$arclink}\"><u>".$arctitle."</u></a>"; $description = $arc->Fields["description"]; $pubdate = GetDateTimeMk($arc->Fields["pubdate"]); $ranks=explode(",",$needRank); foreach($ranks as $rank){ //会员级别不足 if(($rank>10 && $cfg_ml->M_Rank>10 && $cfg_ml->M_Rank!=100 && !in_array($cfg_ml->M_Rank,$ranks) && $arc->Fields['mid']!=$cfg_ml->M_ID)) { $dsql->Execute('me' , "SELECT * FROM `#@__arcrank` "); while($row = $dsql->GetObject('me')) { $memberTypes[$row->rank] = $row->membername; } $memberTypes[0] = "游客或没权限会员"; $msgtitle = "你没有权限浏览文档:{$arctitle} !"; $moremsg = "这篇文档需要 <font color='red'>".$memberTypes[$rank]."</font> 才能访问,你目前是:<font color='red'>".$memberTypes[$cfg_ml->M_Rank]."</font> !"; include_once(DEDETEMPLATE.'/plus/view_msg.htm'); exit(); } else if(($cfg_ml->M_Rank<=10 ||$cfg_ml->M_Rank ==100 ) && $cfg_ml->M_Rank < $rank && $arc->Fields['mid']!=$cfg_ml->M_ID) { $dsql->Execute('me' , "SELECT * FROM `#@__arcrank` "); while($row = $dsql->GetObject('me')) { $memberTypes[$row->rank] = $row->membername; } $memberTypes[0] = "游客或没权限会员"; $msgtitle = "你没有权限浏览文档:{$arctitle} !"; $moremsg = "这篇文档需要 <font color='red'>".$memberTypes[$rank]."</font> 才能访问,你目前是:<font color='red'>".$memberTypes[$cfg_ml->M_Rank]."</font> !"; include_once(DEDETEMPLATE.'/plus/view_msg.htm'); exit(); } } //需要金币的情况 if($needMoney > 0 && $arc->Fields['mid'] != $cfg_ml->M_ID) { $sql = "SELECT aid,money FROM `#@__member_operation` WHERE buyid='ARCHIVE".$aid."' AND mid='".$cfg_ml->M_ID."'"; $row = $dsql->GetOne($sql); //未购买过此文章 if(!is_array($row)) { if($cfg_ml->M_Money=='' || $needMoney > $cfg_ml->M_Money) { $msgtitle = "你没有权限浏览文档:{$arctitle} !"; $moremsg = "这篇文档需要 <font color='red'>".$needMoney." 金币</font> 才能访问,你目前拥有金币:<font color='red'>".$cfg_ml->M_Money." 个</font> !"; include_once(DEDETEMPLATE.'/plus/view_msg.htm'); $arc->Close(); exit(); } else { if($dopost=='buy') { $inquery = "INSERT INTO `#@__member_operation`(mid,oldinfo,money,mtime,buyid,product,pname) VALUES ('".$cfg_ml->M_ID."','$arctitle','$needMoney','".time()."', 'ARCHIVE".$aid."', 'archive',''); "; if($dsql->ExecuteNoneQuery($inquery)) { $inquery = "UPDATE `#@__member` SET money=money-$needMoney WHERE mid='".$cfg_ml->M_ID."'"; if(!$dsql->ExecuteNoneQuery($inquery)) { showmsg('购买失败, 请返回', -1); exit; } #api{{ if(defined('UC_APPID')) { include_once DEDEROOT.'/api/uc.func.php'; $row = $dsql->GetOne("SELECT `scores`,`userid` FROM `#@__member` WHERE `mid`='".$cfg_ml->M_ID."'"); uc_credit_note($row['userid'],-$needMoney,'money'); } #/aip}} showmsg('购买成功,购买扣点不会重扣金币,谢谢!', '/plus/view.php?aid='.$aid); exit; } else { showmsg('购买失败, 请返回', -1); exit; } } $msgtitle = "扣金币购买阅读!"; $moremsg = "阅读该文档内容需要付费!<br>这篇文档需要 <font color='red'>".$needMoney." 金币</font> 才能访问,你目前拥有金币 <font color='red'>".$cfg_ml->M_Money." </font>个!<br>确认阅读请点 [<a href='/plus/view.php?aid=".$aid."&dopost=buy' target='_blank'>确认付点阅读</a>]" ; include_once($cfg_basedir.$cfg_templets_dir."/plus/view_msg.htm"); $arc->Close(); exit(); } } }//金币处理付处理 } $arc->Display();
4.修改浏览权限选择模板页面catalog_edit.htm,改为多选:
<select name="corank[]" id="corank" style="width:100" multiple="true">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>"> <title>栏目管理</title> <link href="css/base.css" rel="stylesheet" type="text/css"> <script language='javascript' src="js/main.js"></script> <script language="javascript"> var channelArray = new Array(); <?php $i = 0; foreach($channelArray as $k=>$arr){ echo "channelArray[$k] = \"{$arr['nid']}\";\r\n"; } ?> function Nav() { if(window.navigator.userAgent.indexOf("MSIE")>=1) return 'IE'; else if(window.navigator.userAgent.indexOf("Firefox")>=1) return 'FF'; else return "OT"; } function SelectTemplets(fname) { var posLeft = 200; var posTop = 300; window.open("../include/dialog/select_templets.php?f="+fname, "poptempWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop); } function ShowHide(objname) { var obj = document.getElementById(objname); if(obj.style.display != "none") obj.style.display = "none"; else { if(Nav()=='IE') obj.style.display = "block"; else obj.style.display = "table-row"; } } function ShowObj(objname) { var obj = document.getElementById(objname); if(Nav()=='IE') obj.style.display = "block"; else obj.style.display = "table"; } function HideObj(objname){ var obj = document.getElementById(objname); obj.style.display = "none"; } function ShowItem1(){ ShowObj('head1'); ShowObj('needset'); HideObj('head2'); HideObj('adset'); HideObj('head3'); HideObj('ctset'); } function ShowItem2(){ ShowObj('head2'); ShowObj('adset'); HideObj('head1'); HideObj('needset'); HideObj('head3'); HideObj('ctset'); } function ShowItem3(){ ShowObj('head3'); ShowObj('ctset'); HideObj('head1'); HideObj('needset'); HideObj('head2'); HideObj('adset'); } function CheckTypeDir() { var upinyin = document.getElementById('upinyin'); var tpobj = document.getElementById('typedir'); if(upinyin.checked) tpobj.style.display = "none"; else tpobj.style.display = "block"; } function ParTemplet(obj) { var sevvalue = channelArray[obj.value]; var tobj = document.getElementById('smclass'); var tempindex = document.getElementsByName('tempindex'); var templist = document.getElementsByName('templist'); var temparticle = document.getElementsByName('temparticle'); var dfstyle = document.getElementsByName('dfstyle'); var dfstyleValue = dfstyle[0].value; tempindex[0].value = dfstyleValue+"/index_"+sevvalue+".htm"; templist[0].value = dfstyleValue+"/list_"+sevvalue+".htm"; temparticle[0].value = dfstyleValue+"/article_"+sevvalue+".htm"; if(obj.value < 0) { if(Nav()=='IE') tobj.style.display = "block"; else tobj.style.display = "table-row"; } else { tobj.style.display = "none"; } } function checkSubmit() { if(document.form1.typename.value==""){ alert("栏目名称不能为空!"); document.form1.typename.focus(); return false; } return true; } function CheckCross() { var cross2 = document.getElementById('cross2'); var crossid = document.getElementById('crossid'); if(cross2.checked) crossid.style.display = 'block'; else crossid.style.display = 'none'; } </script> </head> <body leftmargin='15' topmargin='10' bgcolor="#FFFFFF"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#cfcfcf" style="BORDER-COLLAPSE: collapse"> <tr> <td width="100%" height="20" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="30"><IMG height=14 src="images/book1.gif" width=20> <a href="catalog_main.php"><u>栏目管理</u></a>>> 修改栏目</td> </tr> </table></td> </tr> <tr> <td width="100%" height="1" background="images/sp_bg.gif"></td> </tr> </table> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr><td height="10"></td></tr> <tr> <form name="form1" action="catalog_edit.php" method="post" onSubmit="return checkSubmit();"> <input type="hidden" name="dopost" value="save" /> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <input type="hidden" name="topid" value="<?php echo $myrow['topid']; ?>" /> <td height="95" align="center" bgcolor="#FFFFFF"> <table width="100%" border="0" cellspacing="0" id="head1" cellpadding="0"> <tr> <td colspan="2" bgcolor="#FFFFFF" align="left"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="84" height="24" align="center" background="images/itemnote1.gif"> 常规选项 </td> <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem2()"><u>高级选项</u></a> </td> <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem3()"><u>栏目内容</u></a> </td> </tr> </table> </td> </tr> </table> <table width="100%" border="0" cellspacing="0" id="head2" cellpadding="0" style="display:none"> <tr> <td colspan="2" bgcolor="#FFFFFF" style="text-align:left;"> <table height="24" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="84" align="center" background="images/itemnote2.gif" bgcolor="#F2F7DF"><a href="#" onClick="ShowItem1()"><u>常规选项</u></a> </td> <td width="84" align="center" background="images/itemnote1.gif">高级选项 </td> <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem3()"><u>栏目内容</u></a> </td> </tr> </table> </td> </tr> </table> <table width="100%" border="0" cellspacing="0" id="head3" cellpadding="0" style="display:none"> <tr> <td colspan="2" bgcolor="#FFFFFF" style="text-align:left;"> <table height="24" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="84" align="center" background="images/itemnote2.gif" bgcolor="#F2F7DF"><a href="#" onClick="ShowItem1()"><u>常规选项</u></a> </td> <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem2()"><u>高级选项</u> </td> <td width="84" align="center" background="images/itemnote1.gif">栏目内容 </td> </tr> </table> </td> </tr> </table> <table width="100%" border="0" id="needset" cellspacing="0" cellpadding="0" style="border:1px solid #cfcfcf;background:#ffffff;text-align:left;"> <tr> <td width="150" class='bline' height="26" style="padding-left:10px;">是否支持投稿:</td> <td class='bline'> <input type='radio' name='issend' value='0' class='np' <?php if($myrow['issend']=="0") echo " checked='1' ";?> /> 不支持 <input type='radio' name='issend' value='1' class='np' <?php if($myrow['issend']=="1") echo " checked='1' ";?> /> 支持 </td> </tr> <tr> <td width="150" class='bline' height="26" style="padding-left:10px;">是否隐藏栏目:</td> <td class='bline'> <input type='radio' name='ishidden' value='0' class='np'<?php if($myrow['ishidden']=="0") echo " checked='1' ";?>/> 显示 <input type='radio' name='ishidden' value='1' class='np'<?php if($myrow['ishidden']=="1") echo " checked='1' ";?>/> 隐藏 </td> </tr> <tr> <td class='bline' height="26" style="padding-left:10px;"><font color='red'>内容模型:</font> </td> <td class='bline'> <select name="channeltype" id="channeltype" style="width:200px" onChange="ParTemplet(this)"> <?php foreach($channelArray as $k=>$arr) { if($k==$channelid) echo " <option value='{$k}' selected>{$arr['typename']}|{$arr['nid']}</option>\r\n"; else echo " <option value='{$k}'>{$arr['typename']}|{$arr['nid']}</option>\r\n"; } ?> </select> </td> </tr> <tr> <td class='bline' height="26" style="padding-left:10px;"><font color='red'>栏目名称:</font></td> <td class='bline'><input name="typename" type="text" id="typename" size="30" value="<?php echo $myrow['typename']?>" class="iptxt" /></td> </tr> <tr> <td class='bline' height="26" style="padding-left:10px;">英文名称:</td> <td class='bline'><input name="typenameen" type="text" id="typenameen" size="30" value="<?php echo $myrow['typenameen']?>" class="iptxt" /> (栏目模板里用{dede:field.typenameen /}调用)</td> </tr> <tr> <td class='bline' height="26" style="padding-left:10px;"> 排列顺序: </td> <td class='bline'> <input name="sortrank" size="6" type="text" value="<?php echo $myrow['sortrank']?>" class="iptxt" /> (由低 -> 高) </td> </tr> <tr> <td class='bline' height="76px" style="padding-left:10px;">浏览权限:</td> <td class='bline'> <select name="corank[]" id="corank" style="width:100" multiple="true"> <?php $dsql->SetQuery("Select * from #@__arcrank where rank >= 0"); $dsql->Execute('cc'); while($row = $dsql->GetObject('cc')) { if(in_array($row->rank,$ranks)) echo "<option value='".$row->rank."' selected>".$row->membername."</option>\r\n"; else echo "<option value='".$row->rank."'>".$row->membername."</option>\r\n"; } ?> </select> (仅限制栏目里的文档浏览权限) </td> </tr> <tr> <td class='bline' height="26" style="padding-left:10px;">文件保存目录:</td> <td class='bline'> <input name="typedir" type="text" id="typedir" value="<?php echo $myrow['typedir']?>" style="width:300px" class="iptxt" /> </td> </tr> <tr> <td height="26" style="padding-left:10px;">栏目列表选项:</td> <td> <input type='radio' name='isdefault' value='1' class='np'<?php if($myrow['isdefault']==1) echo " checked='1' ";?>/> 链接到默认页 <input type='radio' name='isdefault' value='0' class='np'<?php if($myrow['isdefault']==0) echo " checked='1' ";?>/> 链接到列表第一页 <input type='radio' name='isdefault' value='-1' class='np'<?php if($myrow['isdefault']==-1) echo " checked='1' ";?>/> 使用动态页 </td> </tr> <tr> <td class='bline' height="26" style="padding-left:10px;">默认页的名称: </td> <td class='bline'><input name="defaultname" type="text" value="<?php echo $myrow['defaultname']?>" class="iptxt" /></td> </tr> <tr> <td height="26" class='bline' style="padding-left:10px;">栏目属性:</td> <td class='bline'> <input name="ispart" type="radio" id="radio" value="0" class='np'<?php if($myrow['ispart']==0) echo " checked='1' ";?>/> 最终列表栏目(允许在本栏目发布文档,并生成文档列表)<br> <input name="ispart" type="radio" id="radio2" value="1" class='np'<?php if($myrow['ispart']==1) echo " checked='1' ";?>/> 频道封面(栏目本身不允许发布文档)<br> <input name="ispart" type="radio" id="radio3" value="2" class='np'<?php if($myrow['ispart']==2) echo " checked='1' ";?>/> 外部连接(在"文件保存目录"处填写网址) </td> </tr> <tr id='helpvarco' style='display:none'> <td height="80" bgcolor="#F3F7EA" style="padding-left:10px;">栏目交叉说明: </td> <td bgcolor="#F3F7EA"> 交叉栏目是指一个大栏目与另一个非下级的子栏目出现交叉的情况,相当于系统原来的副栏目功能,不过现在改在栏目里预先设置好。<br />例如: 网站上有大栏目——智能手机、音乐手机,另外又有栏目——诺基亚->智能手机、诺基亚->音乐手机,这样顶级的大栏目就和另一个大栏目的子栏目形成了交叉,这样只需要在大栏目中指定交叉的栏目即可。 <br />注:会自动索引交叉栏目的内容,但不会索引交叉栏目下级栏目的内容,这种应用也适用于按地区划分资讯的站点。 </td> </tr> <tr> <td style="padding-left:10px;">栏目交叉:<img src="images/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvarco')" /><br />仅适用[最终列表栏目]</td> <td class='bline' style="padding:3px 0px 3px 0px"> <input name="cross" type="radio" id="cross0" onClick="CheckCross()" value="0" class='np'<?php if($myrow['cross']==0) echo " checked='1' ";?> /> 不交叉 <input name="cross" type="radio" id="cross1" onClick="CheckCross()" value="1" class='np'<?php if($myrow['cross']==1) echo " checked='1' ";?>/> 自动获取同名栏目内容 <input name="cross" type="radio" id="cross2" onClick="CheckCross()" value="2" class='np'<?php if($myrow['cross']==2) echo " checked='1' ";?>/> 手工指定交叉栏目ID(用逗号分开) <br /> <textarea name="crossid" cols="50" rows="3" id="crossid" style="<?php if($myrow['cross']!=2) echo "display:none";?>" class="alltxt" ><?php echo $myrow['crossid']; ?></textarea> </td> </tr> <tr id='smclass' style='<?php echo ($channelid<0 ? '' : 'display:none'); ?>'> <td class='bline' style="padding-left:10px;">绑定小分类: <br />仅适用[分类信息模型]</td> <td class='bline' style="padding:3px 0px 3px 0px"> <select name='smalltype[]' size='5' style='width:120px' multiple='yes'> <?php $smtypes = explode(',',trim($myrow['smalltypes'])); $sql = "Select * From `#@__sys_enum` where egroup like 'infotype' order by disorder asc, id desc "; $dsql->Execute('s',$sql); while($arr = $dsql->GetArray('s')) { if(in_array($arr['evalue'],$smtypes)) { $selstr = " selected='1' "; } else { $selstr = ''; } if($arr['evalue']%500==0) { echo "<option value='{$arr['evalue']}'{$selstr}>{$arr['ename']}</option>\r\n"; } else if(preg_match("#\.#", $arr['evalue'])) { echo "<option value='{$arr['evalue']}'{$selstr}> └───{$arr['ename']}</option>\r\n"; } else { echo "<option value='{$arr['evalue']}'{$selstr}> └─{$arr['ename']}</option>\r\n"; } } ?> </select> 按 Ctrl 多选,不选系统将调用全部分类,在<a href='stepselect_main.php'>“<u>联动类别管理</u>”</a>中管理 </td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #cfcfcf;background:#ffffff;display:none;text-align:left;" id="adset"> <tr> <td class='bline' width="150" height="24" style="padding-left:10px;">多站点支持:</td> <td class='bline'> <input name="moresite" type="radio" class="np" value="0"<?php if($myrow['moresite']==0) echo " checked='1' ";?>/> 不启用 <input type="radio" name="moresite" class="np" value="1"<?php if($myrow['moresite']==1) echo " checked='1' ";?>/> 启用 </td> </tr> <tr> <td height="24" bgcolor="#F9FCEF" style="padding-left:10px;">说明:</td> <td bgcolor="#F9FCEF">绑名绑定仅需要在顶级栏目设定,子级栏目更改无效。</td> </tr> <tr> <td class='bline' height="24" style="padding-left:10px;">绑定域名:</td> <td class='bline'> <input name="siteurl" type="text" id="siteurl" size="35" value="<?php echo $myrow['siteurl']?>" class="iptxt" /> (需加 http://,一级或二级域名的根网址) </td> </tr> <tr> <td class='bline' height="24" style="padding-left:10px;">站点根目录:</td> <td class='bline'> 为简化操作,站点根目录与当前栏目目录一致,请注意当前栏目文件保存目录的设置,域名需自行手工绑定到这个目录。 </td> </tr> <tr id='helpvar1' style='display:none'> <td height="24" bgcolor="#F9FCEF" style="padding-left:10px;">支持变量: </td> <td bgcolor="#F9FCEF"> {tid}表示栏目ID,<br> {cid}表示频道模型的'名字ID' <font color='#888888'> ( <?php foreach($channelArray as $k=>$arr) { echo "{$arr['typename']}({$arr['nid']})、"; } ?> ) </font> <br/> 模板文件的默认位置是放在模板目录 "cms安装目录 <?php echo $cfg_templets_dir ?> " 内。 <input type='hidden' value='{style}' name='dfstyle' /> </td> </tr> <tr> <td height="26" style="padding-left:10px;">封面模板:</td> <td> <input name="tempindex" type="text" value="<?php echo $myrow['tempindex']?>" style="width:300px" class="iptxt" /> <input type="button" name="set1" value="浏览..." class="coolbg np" style="width:60px" onClick="SelectTemplets('form1.tempindex');"/> <img src="images/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar1')"/> </td> </tr> <tr> <td height="26" style="padding-left:10px;">列表模板:</td> <td> <input name="templist" type="text" value="<?php echo $myrow['templist']?>" style="width:300px" class="iptxt" /> <input type="button" name="set3" value="浏览..." class="coolbg np" style="width:60px" onClick="SelectTemplets('form1.templist');"/> </td> </tr> <tr> <td height="26" style="padding-left:10px;">文章模板:</td> <td><input name="temparticle" type="text" value="<?php echo $myrow['temparticle']?>" style="width:300px" class="iptxt" /> <input type="button" name="set4" value="浏览..." class="coolbg np" style="width:60px" onClick="SelectTemplets('form1.temparticle');"/> </td> </tr> <tr id='helpvar2' style='display:none'> <td height="24" bgcolor="#F9FCEF" style="padding-left:10px;">支持变量: </td> <td height="24" bgcolor="#F9FCEF"> {Y}、{M}、{D} 年月日<br/> {timestamp} INT类型的UNIX时间戳<br/> {aid} 文章ID<br/> {pinyin} 拼音+文章ID<br/> {py} 拼音部首+文章ID<br/> {typedir} 栏目目录 <br/> {cc} 日期+ID混编后用转换为适合的字母 <br/> </td> </tr> <tr> <td height="26" style="padding-left:10px;">文章命名规则:</td> <td> <input name="namerule" type="text" id="namerule" value="<?php echo $myrow['namerule']?>" size="40" class="iptxt" /> <img src="images/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar2')"/> </td> </tr> <tr id='helpvar3' style='display:none'> <td height="24" bgcolor="#F9FCEF" style="padding-left:10px;">支持变量: </td> <td bgcolor="#F9FCEF">{page} 列表的页码</td> </tr> <tr> <td height="26" style="padding-left:10px;">列表命名规则:</td> <td> <input name="namerule2" type="text" id="namerule2" value="<?php echo $myrow['namerule2']?>" size="40" class="iptxt" /> <img src="images/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar3')"/></td> </tr> <tr> <td height="65" style="padding-left:10px;">栏目图片:</td> <td><input name="typeimg" type="text" style="width:250px"id="typeimg" class="alltxt" value="<?php echo $myrow['typeimg'];?>"/> <input type="button" name="set9" value="浏览... " class="coolbgnp" style="width:60px" onClick="SelectImage('form1.typeimg','small');"/> (栏目模板里用{dede:field.typeimg /}调用) </td> </tr> <tr> <td height="65" style="padding-left:10px;">SEO标题:</td> <td> <input name="seotitle" type="text" style="width:250px" id="seotitle" class="alltxt" value="<?php echo $myrow['seotitle']?>" /> (栏目模板里用{dede:field.seotitle /}调用) </td> </tr> <tr> <td height="65" style="padding-left:10px;">关键字:</td> <td> <textarea name="keywords" cols="70" rows="4" id="keywords" class="alltxt" ><?php echo $myrow['keywords']?></textarea> </td> </tr> <tr> <td height="65" style="padding-left:10px;">栏目描述:</td> <td height="65"><textarea name="description" cols="70" style="height:50px" rows="4" id="description" class="alltxt" ><?php echo $myrow['description']?></textarea></td> </tr> <tr> <td height="45" style="padding-left:10px;">继承选项:</td> <td> <input name="upnext" type="checkbox" id="upnext" value="1" class="np"/> 同时更改下级栏目的浏览权限、内容类型、模板风格、命名规则等通用属性 </td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #cfcfcf;background:#ffffff;display:none;text-align:left;" id="ctset"> <tr> <td height="28"> 说明:栏目内容是替代原来栏目单独页的更灵活的一种方式,可在栏目模板中用{dede:field.content/}调用,通常用于企业简介之类的用途。</td> </tr> <tr> <td style="padding:10px;"> <?php GetEditor("content",$myrow['content'],"450","Default","print","false"); ?> </td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F9FCEF" style="border:1px solid #cfcfcf;border-top:none;"> <tr> <td width="1%" height="36"></td> <td width="99%" valign="bottom"> <input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" border="0" class="np"/> <a href="catalog_main.php"><img src="images/button_back.gif" width="60" height="22" border="0"></a> </td> </tr> </table></td> </form> </tr> </table> </body> </html>
4.修改存入数据库的数据处理逻辑catlog_edit.php
//add by xiaorui 20200320 增加权限多选
$corank=implode(',',$corank);
//add end
<?php /** * 栏目编辑 * * @version $Id: catalog_edit.php 1 14:31 2010年7月12日Z tianya $ * @package DedeCMS.Administrator * @copyright Copyright (c) 2007 - 2010, DesDev, Inc. * @license http://help.dedecms.com/usersguide/license.html * @link http://www.dedecms.com */ require_once(dirname(__FILE__)."/config.php"); require_once(DEDEINC."/typelink.class.php"); if(empty($dopost)) $dopost = ''; $id = isset($id) ? intval($id) : 0; //检查权限许可 CheckPurview('t_Edit,t_AccEdit'); //检查栏目操作许可 CheckCatalog($id, '你无权更改本栏目!'); /*栏目二开字段 by 小虎哥*/ $dsql->GetTableFields('#@__arctype'); $fieldArray = $dsql->GetArray(); if (!in_array('typenameen', $fieldArray)) { // 英文栏目名称 $dsql->ExecuteNoneQuery("ALTER TABLE `#@__arctype` ADD `typenameen` char(100) NOT NULL default ''"); } if (!in_array('typeimg', $fieldArray)) { // 栏目封面图 $dsql->ExecuteNoneQuery("ALTER TABLE `#@__arctype` ADD `typeimg` char(100) NOT NULL default ''"); } /*--end*/ /*----------------------- function action_save() ----------------------*/ if($dopost=="save") { $description = Html2Text($description,1); $keywords = Html2Text($keywords,1); $uptopsql = $smalltypes = ''; if(isset($smalltype) && is_array($smalltype)) $smalltypes = join(',',$smalltype); if($topid==0) { $sitepath = $typedir; $uptopsql = " ,siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' "; } //add by xiaorui 20200320 增加权限多选 $corank=implode(',',$corank); //add end if($ispart!=0) $cross = 0; $upquery = "UPDATE `#@__arctype` SET issend='$issend', sortrank='$sortrank', typename='$typename', typenameen='$typenameen', typedir='$typedir', typeimg='$typeimg', isdefault='$isdefault', defaultname='$defaultname', issend='$issend', ishidden='$ishidden', channeltype='$channeltype', tempindex='$tempindex', templist='$templist', temparticle='$temparticle', namerule='$namerule', namerule2='$namerule2', ispart='$ispart', corank='$corank', description='$description', keywords='$keywords', seotitle='$seotitle', moresite='$moresite', `cross`='$cross', `content`='$content', `crossid`='$crossid', `smalltypes`='$smalltypes' $uptopsql WHERE id='$id' "; if(!$dsql->ExecuteNoneQuery($upquery)) { ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!","-1"); exit(); } //如果选择子栏目可投稿,更新顶级栏目为可投稿 if($topid>0 && $issend==1) { $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; "); } $slinks = " id IN (".GetSonIds($id).")"; //修改顶级栏目时强制修改下级的多站点支持属性 if($topid==0 && preg_match("#,#", $slinks)) { $upquery = "UPDATE `#@__arctype` SET moresite='$moresite', siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' WHERE 1=1 AND $slinks"; $dsql->ExecuteNoneQuery($upquery); } //更改子栏目属性 if(!empty($upnext)) { $upquery = "UPDATE `#@__arctype` SET issend='$issend', defaultname='$defaultname', channeltype='$channeltype', tempindex='$tempindex', templist='$templist', temparticle='$temparticle', namerule='$namerule', namerule2='$namerule2', ishidden='$ishidden' WHERE 1=1 AND $slinks"; if(!$dsql->ExecuteNoneQuery($upquery)) { ShowMsg("更改当前栏目成功,但更改下级栏目属性时失败!","-1"); exit(); } } UpDateCatCache(); ShowMsg("成功更改一个分类!","catalog_main.php"); exit(); }//End Save Action else if ($dopost=="savetime") { $uptopsql = ''; $slinks = " id IN (".GetSonIds($id).")"; //顶级栏目二级域名根目录处理 if($topid==0 && $moresite==1) { $sitepath = $typedir; $uptopsql = " ,sitepath='$sitepath' "; if(preg_match("#,#", $slinks)) { $upquery = "UPDATE `#@__arctype` SET sitepath='$sitepath' WHERE $slinks"; $dsql->ExecuteNoneQuery($upquery); } } //如果选择子栏目可投稿,更新顶级栏目为可投稿 if($topid > 0 && $issend==1) { $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; "); } $upquery = "UPDATE `#@__arctype` SET issend='$issend', sortrank='$sortrank', typedir='$typedir', typename='$typename', isdefault='$isdefault', defaultname='$defaultname', ispart='$ispart', corank='$corank' $uptopsql WHERE id='$id' "; if(!$dsql->ExecuteNoneQuery($upquery)) { ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!","-1"); exit(); } UpDateCatCache(); ShowMsg("成功更改一个分类!","catalog_main.php"); exit(); } //读取栏目信息 $dsql->SetQuery("SELECT tp.*,ch.typename as ctypename FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id=$id"); $myrow = $dsql->GetOne(); $topid = $myrow['topid']; if($topid>0) { $toprow = $dsql->GetOne("SELECT moresite,siteurl,sitepath FROM `#@__arctype` WHERE id=$topid"); foreach($toprow as $k=>$v) { if(!preg_match("#[0-9]#", $k)) { $myrow[$k] = $v; } } } $myrow['content']=empty($myrow['content'])? " " : $myrow['content']; //add by xiaorui 显示权限多选 20200320 $ranks = explode(',',$myrow['corank']); //add end //读取频道模型信息 $channelid = $myrow['channeltype']; $dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id"); $dsql->Execute(); while($row = $dsql->GetObject()) { $channelArray[$row->id]['typename'] = $row->typename; $channelArray[$row->id]['nid'] = $row->nid; if($row->id==$channelid) { $nid = $row->nid; } } PutCookie('lastCid',GetTopid($id),3600*24,"/"); if($dopost == 'time') { ?> <form name="form1" action="catalog_edit.php" method="post" onSubmit="return checkSubmit();"> <input type="hidden" name="dopost" value="savetime" /> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <input type="hidden" name="topid" value="<?php echo $myrow['topid']; ?>" /> <input type="hidden" name="moresite" value="<?php echo $myrow['moresite']; ?>" /> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class='bline' height="26" align="center" colspan="2"> <a href='catalog_edit.php?id=<?php echo $id; ?>'><u>当前是快捷编辑模式,如果您要修改更详细的参数,请使用高级模式>></u></a> </td> </tr> <tr> <td width="150" class='bline' height="26" align="center">是否支持投稿:</td> <td class='bline'> <input type='radio' name='issend' value='0' class='np' <?php if($myrow['issend']=="0") echo " checked='1' ";?> /> 不支持 <input type='radio' name='issend' value='1' class='np' <?php if($myrow['issend']=="1") echo " checked='1' ";?> /> 支持 </td> </tr> <!-- 在快速修改更改内容模型后,因为模板没改变,会导致错误,因此去除些选择框。 --> <tr> <td class='bline' height="26" align="center"><font color='red'>内容模型:</font> </td> <td class='bline'> <?php foreach($channelArray as $k=>$arr) { if($k==$channelid) echo "{$arr['typename']} | {$arr['nid']}"; } ?> <a href='catalog_edit.php?id=<?php echo $id; ?>'><u>[修改]</u></a> </td> </tr> <tr> <td class='bline' height="26" align="center"><font color='red'>栏目名称:</font></td> <td class='bline'><input name="typename" type="text" id="typename" size="30" value="<?php echo $myrow['typename']?>" class="iptxt" /></td> </tr> <tr> <td class='bline' height="26" align="center"> 排列顺序: </td> <td class='bline'> <input name="sortrank" size="6" type="text" value="<?php echo $myrow['sortrank']?>" class="iptxt" /> (由低 -> 高) </td> </tr> <tr> <td class='bline' height="26" align="center">浏览权限:</td> <td class='bline'> <select name="corank" id="corank" style="width:100" > <?php $dsql->SetQuery("SELECT * FROM #@__arcrank WHERE rank >= 0"); $dsql->Execute(); while($row = $dsql->GetObject()) { if($myrow['corank']==$row->rank) echo "<option value='".$row->rank."' selected>".$row->membername."</option>\r\n"; else echo "<option value='".$row->rank."'>".$row->membername."</option>\r\n"; } ?> </select> (仅限制栏目里的文档浏览权限) </td> </tr> <tr> <td class='bline' height="26" align="center">文件保存目录:</td> <td class='bline'><input name="typedir" type="text" id="typedir" value="<?php echo $myrow['typedir']?>" style="width:300px" class="iptxt" /></td> </tr> <tr> <td height="26" align="center" class='bline'>栏目列表选项:</td> <td class='bline'> <input type='radio' name='isdefault' value='1' class='np'<?php if($myrow['isdefault']==1) echo " checked='1' ";?>/> 链接到默认页 <input type='radio' name='isdefault' value='0' class='np'<?php if($myrow['isdefault']==0) echo " checked='1' ";?>/> 链接到列表第一页 <input type='radio' name='isdefault' value='-1' class='np'<?php if($myrow['isdefault']==-1) echo " checked='1' ";?>/> 使用动态页 </td> </tr> <tr> <td class='bline' height="26" align="center">默认页的名称: </td> <td class='bline'><input name="defaultname" type="text" value="<?php echo $myrow['defaultname']?>" class="iptxt" /></td> </tr> <tr> <td height="26" class='bline' align="center">栏目属性:</td> <td class='bline'> <input name="ispart" type="radio" id="radio" value="0" class='np'<?php if($myrow['ispart']==0) echo " checked='1' ";?>/> 最终列表栏目(允许在本栏目发布文档,并生成文档列表)<br> <input name="ispart" type="radio" id="radio2" value="1" class='np'<?php if($myrow['ispart']==1) echo " checked='1' ";?>/> 频道封面(栏目本身不允许发布文档)<br> <input name="ispart" type="radio" id="radio3" value="2" class='np'<?php if($myrow['ispart']==2) echo " checked='1' ";?>/> 外部连接(在"文件保存目录"处填写网址) </td> </tr> <tr> <td align="center" colspan="2" height="54" bgcolor='#FAFEE0'> <input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" border="0" class="np"/> <a title='关闭' onclick='CloseMsg()'><img src="images/button_back.gif" width="60" height="22" border="0"></a> </td> </tr> </table> </form> <?php exit(); } else { include DedeInclude('templets/catalog_edit.htm'); } ?>
5.同上,修改文章修改权限模板页面article_edit.htm/php
//add by xiaorui 20200320 多选权限
$arcrank=implode(',',$arcrank);
//add end
<?php /** * 文档编辑 * * @version $Id: article_edit.php 1 14:12 2010年7月12日Z tianya $ * @package DedeCMS.Administrator * @copyright Copyright (c) 2007 - 2010, DesDev, Inc. * @license http://help.dedecms.com/usersguide/license.html * @link http://www.dedecms.com */ require_once(dirname(__FILE__)."/config.php"); CheckPurview('a_Edit,a_AccEdit,a_MyEdit'); require_once(DEDEINC."/customfields.func.php"); require_once(DEDEADMIN."/inc/inc_archives_functions.php"); if(file_exists(DEDEDATA.'/template.rand.php')) { require_once(DEDEDATA.'/template.rand.php'); } if(empty($dopost)) $dopost = ''; $aid = isset($aid) && is_numeric($aid) ? $aid : 0; if($dopost!='save') { require_once(DEDEADMIN."/inc/inc_catalog_options.php"); require_once(DEDEINC."/dedetag.class.php"); ClearMyAddon(); //读取归档信息 $query = "SELECT ch.typename AS channelname,ar.membername AS rankname,arc.* FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel LEFT JOIN `#@__arcrank` ar ON ar.rank=arc.arcrank WHERE arc.id='$aid' "; $arcRow = $dsql->GetOne($query); if(!is_array($arcRow)) { ShowMsg("读取档案基本信息出错!","-1"); exit(); } $query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'"; $cInfos = $dsql->GetOne($query); if(!is_array($cInfos)) { ShowMsg("读取频道配置信息出错!","javascript:;"); exit(); } $addtable = $cInfos['addtable']; $addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'"); if(!is_array($addRow)) { ShowMsg("读取附加信息出错!","javascript:;"); exit(); } $channelid = $arcRow['channel']; $tags = GetTags($aid); include DedeInclude("templets/article_edit.htm"); exit(); } /*-------------------------------- function __save(){ } -------------------------------*/ else if($dopost=='save') { require_once(DEDEINC.'/image.func.php'); require_once(DEDEINC.'/oxwindow.class.php'); $flag = isset($flags) ? join(',',$flags) : ''; $notpost = isset($notpost) && $notpost == 1 ? 1: 0; if(empty($typeid2)) $typeid2 = 0; if(!isset($autokey)) $autokey = 0; if(!isset($remote)) $remote = 0; if(!isset($dellink)) $dellink = 0; if(!isset($autolitpic)) $autolitpic = 0; if(empty($typeid)) { ShowMsg("请指定文档的栏目!", "-1"); exit(); } if(empty($channelid)) { ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } if(!CheckChannel($typeid, $channelid)) { ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } if(!TestPurview('a_Edit')) { if(TestPurview('a_AccEdit')) { CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!"); } else { CheckArcAdmin($id, $cuserLogin->getUserID()); } } //对保存的内容进行处理 $pubdate = GetMkTime($pubdate); $sortrank = AddDay($pubdate,$sortup); $ismake = $ishtml==0 ? -1 : 0; $autokey = 1; $title = dede_htmlspecialchars(cn_substrR($title,$cfg_title_maxlen)); $shorttitle = cn_substrR($shorttitle,36); $color = cn_substrR($color,7); $writer = cn_substrR($writer,20); $source = cn_substrR($source,30); $description = cn_substrR($description,250); $keywords = trim(cn_substrR($keywords,60)); $filename = trim(cn_substrR($filename,40)); $isremote = (empty($isremote)? 0 : $isremote); $serviterm=empty($serviterm)? "" : $serviterm; if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 if(empty($ddisremote)) { $ddisremote = 0; } $litpic = GetDDImage('none',$picname,$ddisremote); //分析body里的内容 $body = AnalyseHtmlBody($body,$description,$litpic,$keywords,'htmltext'); //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; if(!empty($dede_addonfields)) { $addonfields = explode(';',$dede_addonfields); $inadd_f = ''; $inadd_v = ''; if(is_array($addonfields)) { foreach($addonfields as $v) { if($v=='') { continue; } $vs = explode(',',$v); if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 { ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); }else { if(!isset(${$vs[0]})) { ${$vs[0]} = ''; } ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id); } $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'"; } } } //处理图片文档的自定义属性 if($litpic!='' && !preg_match("#p#", $flag)) { $flag = ($flag=='' ? 'p' : $flag.',p'); } if($redirecturl!='' && !preg_match("#j#", $flag)) { $flag = ($flag=='' ? 'j' : $flag.',j'); } //跳转网址的文档强制为动态 if(preg_match("#j#", $flag)) $ismake = -1; //add by xiaorui 20200320 多选权限 $arcrank=implode(',',$arcrank); //add end //更新数据库的SQL语句 $query = "UPDATE #@__archives SET typeid='$typeid', typeid2='$typeid2', sortrank='$sortrank', flag='$flag', click='$click', ismake='$ismake', arcrank='$arcrank', money='$money', title='$title', color='$color', writer='$writer', source='$source', litpic='$litpic', pubdate='$pubdate', voteid='$voteid', notpost='$notpost', description='$description', keywords='$keywords', shorttitle='$shorttitle', filename='$filename', dutyadmin='$adminid', weight='$weight' WHERE id='$id'; "; if(!$dsql->ExecuteNoneQuery($query)) { ShowMsg('更新数据库archives表时出错,请检查',-1); exit(); } $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); if($addtable!='') { $useip = GetIP(); $templet = empty($templet) ? '' : $templet; $iquery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},redirecturl='$redirecturl',templet='$templet',userip='$useip' WHERE aid='$id'"; if(!$dsql->ExecuteNoneQuery($iquery)) { ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;"); exit(); } } //生成HTML UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags); if($cfg_remote_site=='Y' && $isremote=="1") { if($serviterm!=""){ list($servurl, $servuser, $servpwd) = explode(',', $serviterm); $config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE'); } else { $config=array(); } if(!$ftp->connect($config)) exit('Error:None FTP Connection!'); } $artUrl = MakeArt($id,true,true,$isremote); if($artUrl=='') { $artUrl = $cfg_phpurl."/view.php?aid=$id"; } ClearMyAddon($id, $title); //返回成功信息 $msg = " 请选择你的后续操作: <a href='article_add.php?cid=$typeid'><u>发布新文章</u></a> <a href='archives_do.php?aid=".$id."&dopost=editArchives'><u>查看更改</u></a> <a href='$artUrl' target='_blank'><u>查看文章</u></a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives'><u>管理文章</u></a> $backurl "; $wintitle = "成功更改文章!"; $wecome_info = "文章管理::更改文章"; $win = new OxWindow(); $win->AddTitle("成功更改文章:"); $win->AddMsgItem($msg); $winform = $win->GetWindow("hand"," ",false); $win->Display(); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>"> <title>更改文章</title> <style type="text/css"> <!-- body { background-image: url(images/allbg.gif); } --> </style> <link href="css/base.css" rel="stylesheet" type="text/css"> <link href='css/tb-box.css' rel='stylesheet' type='text/css' /> <script language="javascript" src="../include/js/dedeajax2.js"></script> <script type="text/javascript" src="js/calendar/calendar.js"></script> <script language="javascript" src="js/main.js"></script> <script type="text/javascript"src="js/handlers.js"></script> <script type="text/javascript" src="../images/swfupload/swfupload.js"></script> <script language="javascript" src="../include/js/jquery/jquery.js"></script> <script language="javascript" src="../include/js/jquery/ui.core.js"></script> <script language="javascript" src="../include/js/jquery/ui.draggable.js"></script> <script language='javascript' src='js/tb-box.js'></script> <script language="javascript"> <!-- var swfu = null; var arctype = 'article'; function checkSubmit() { if(document.form1.title.value=='') { alert('文章标题不能为空!'); document.form1.title.focus(); return false; } } function addVote() { tb_show('添加投票', 'vote_add.php?isarc=1&TB_iframe=true&height=460&width=600', false); } function selectVote() { tb_show('选取投票','vote_main.php?issel=1&TB_iframe=true&height=460&width=600',false); } function viewVote() { if($("#voteid").val() != 0) { window.open('<?php echo $cfg_cmsurl;?>/plus/vote.php?dopost=view&aid=' + $("#voteid").val()); } else { alert('请选择一个投票'); return false; } } window.onload = function () { swfu = new SWFUpload( { // Backend Settings upload_url: "swfupload.php", post_params: {"PHPSESSID": "<?php echo session_id(); ?>", "dopost" : "", "arctype" : arctype, "arcid":<?php echo $arcRow['id']?>}, // File Upload Settings file_size_limit : "2 MB", // 2MB file_types : "*.jpg; *.gif; *.png", file_types_description : "选择 JPEG/GIF/PNG 格式图片", file_upload_limit : "0", file_queue_error_handler : fileQueueError, file_dialog_complete_handler : fileDialogComplete, upload_progress_handler : uploadProgress, upload_error_handler : uploadError, upload_success_handler : uploadSuccess, upload_complete_handler : uploadComplete, button_image_url : "../images/SmallSpyGlassWithTransperancy_17x18.png", button_placeholder_id : "spanButtonPlaceholder", button_width: '100%', button_height: 26, button_text : '<div class="button" style="background-color:#E5F1CF; height:26px; text-align:center; line-height:26px">上传图片(可多选)</div>', button_text_style : '', button_text_top_padding: 0, button_text_left_padding: 10, button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT, button_cursor: SWFUpload.CURSOR.HAND, // Flash Settings flash_url : "../images/swfupload/swfupload.swf", custom_settings : { upload_target : "divFileProgressContainer" }, // Debug Settings debug: false }); }; function addtoEditOld(picurl,pid) { var picTitle = jQuery('input[name="picinfook'+pid+'"]').val(); var picHTML = '<img src="'+picurl+'" alt="'+picTitle+'"/>'; CKEDITOR.instances.body.insertHtml(picHTML); } //删除已经上传的图片 function delAlbPic(pid){ // 同步删除编辑器中插入的图片 jQuery("#__tmpbody").html(); jQuery.get('swfupload.php?dopost=addtoedit&id=' + pid, function(data) { var iptbody = CKEDITOR.instances.body.getData(); jQuery("#__tmpbody").html(iptbody); jQuery("#__tmpbody").find('img').each(function() { if(jQuery(this).attr('src') == data) { //alert(data); jQuery(this).remove(); } }); CKEDITOR.instances.body.setData(jQuery("#__tmpbody").html()); jQuery("#__tmpbody").html(); var tgobj = $Obj('albCtok'+pid); var myajax = new DedeAjax(tgobj); myajax.SendGet2('swfupload.php?dopost=del&id='+pid); $Obj('thumbnails').removeChild(tgobj); }); } function addtoEdit(pid) { jQuery.get('swfupload.php?dopost=addtoedit&id=' + pid, function(data) { var picTitle = jQuery('input[name="picinfook'+pid+'"]').val(); var picHTML = '<img src="'+data+'" alt="'+picTitle+'"/>'; CKEDITOR.instances.body.insertHtml(picHTML); }); } //删除已经上传的图片(编辑时用) function delAlbPicOld(picfile, pid){ var iptbody = CKEDITOR.instances.body.getData(); jQuery("#__tmpbody").html(iptbody); jQuery("#__tmpbody").find('img').each(function() { if(jQuery(this).attr('src') == picfile) { //alert(data); jQuery(this).remove(); } }); CKEDITOR.instances.body.setData(jQuery("#__tmpbody").html()); jQuery("#__tmpbody").html(); var tgobj = $Obj('albold'+pid); var myajax = new DedeAjax(tgobj); myajax.SendGet2('swfupload.php?dopost=delold&picfile='+picfile); $Obj('thumbnailsEdit').removeChild(tgobj); } --> </script> </head> <body topmargin="8"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="60%" height="30"><IMG height=14 src="images/book1.gif" width=20> <a href="catalog_do.php?cid=<?php echo $arcRow['typeid']?>&channelid=<?php echo $channelid?>&dopost=listArchives"><u>文章列表</u></a> >> 更改文章</td> <td width="30%" align='right'> <?php echo $backurl; ?><a href="catalog_main.php">[<u>栏目管理</u>]</a></td> <td width="1%"> </td> </tr> </table> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="head1"> <tr> <td colspan="2"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="84" height="24" align="center" background="images/itemnote1.gif"> 常规信息 </td> <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem2()"><u>高级参数</u></a></td> </tr> </table></td> </tr> </table> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="head2" style="display:none"> <tr> <td colspan="2"><table height="24" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem1()"><u>常规信息</u></a> </td> <td width="84" align="center" background="images/itemnote1.gif">高级参数</td> </tr> </table></td> </tr> </table> <form name="form1" action="article_edit.php" enctype="multipart/form-data" method="post" onSubmit="return checkSubmit();"> <input type="hidden" name="dopost" value="save" /> <input type="hidden" name="channelid" value="<?php echo $channelid?>" /> <input type="hidden" name="id" value="<?php echo $aid?>" /> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" id="needset" style="border:1px solid #cfcfcf;background:#ffffff;"> <tr> <td height="24" colspan="2" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"> 文章标题:</td> <td width='408'><input name="title" type="text" id="title" value="<?php echo $arcRow['title']; ?>" style="width:388px"></td> <td width="90"> 简略标题:</td> <td><input name="shorttitle" type="text" id="shorttitle" style="width:150px" value="<?php echo $arcRow['shorttitle']; ?>"></td> </tr> </table></td> </tr> <tr> <td width="400%" height="24" colspan="2" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"> 自定义属性:</td> <td><?php $dsql->SetQuery("SELECT * FROM `#@__arcatt` ORDER BY sortid ASC"); $dsql->Execute(); while($trow = $dsql->GetObject()) { if($trow->att=='j') { $jumpclick = " onclick='ShowUrlTr()'"; } else { $jumpclick = ''; } if(preg_match("#".$trow->att."#", $arcRow['flag'])) { echo "<input class='np' type='checkbox' name='flags[]' id='flags{$trow->att}' value='{$trow->att}' {$jumpclick} checked='checked' />{$trow->attname}[{$trow->att}]"; } else { echo "<input class='np' type='checkbox' name='flags[]' id='flags{$trow->att}' value='{$trow->att}'{$jumpclick} />{$trow->attname}[{$trow->att}]"; } } ?></td> </tr> </table></td> </tr> <tr> <td height="24" colspan="2" class="bline" id="redirecturltr" style="display:<?php echo (empty($addRow['redirecturl']) ? 'none' : 'block');?>"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"> 跳转网址:</td> <td><input name="redirecturl" type="text" id="redirecturl" style="width:300px" value="<?php echo $addRow["redirecturl"]?>" /></td> </tr> </table></td> </tr> <tr> <td width="400%" height="24" colspan="2" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"> TAG标签:</td> <td><input name="tags" type="text" id="tags" value="<?php echo $tags; ?>" style="width:300px" /> (','号分开,单个标签小于12字节)</td> <td width="40">权重:</td> <td width="141"><input name="weight" type="text" id="weight" style="width:50px" value="<?php echo $arcRow['weight'];?>" /> (越小越靠前)</td> </tr> </table></td> </tr> <tr id="pictable"> <td height="24" colspan="2" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90" height="81"> 缩 略 图:<br/></td> <td><input name="picname" type="text" id="picname" style="width:300px" value="<?php echo $arcRow["litpic"]?>"> <input type="button" name="Submit" value="浏览..." style="width:70px" onClick="SelectImage('form1.picname','');"> <input type="button" name="Submit2" value="裁剪" style="margin-left:8px;" onClick="imageCut('picname');" class='np coolbg'/> <input type='checkbox' class='np' name='ddisremote' value='1' /> 远程 </td> <td align="center"><img src="<?php if($arcRow["litpic"]!="") echo $arcRow["litpic"]; else echo "images/pview.gif";?>" width="150" height="100" id="picview" name="picview"></td> </tr> </table></td> </tr> <tr> <td height="24" colspan="2" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"> 文章来源:</td> <td width="250"><input name="source" type="text" id="source" style="width:160px" value="<?php echo $arcRow["source"]?>" size="16"> <input name="selsource" type="button" id="selsource" value="选择" /></td> <td width="90">作 者:</td> <td><input name="writer" type="text" id="writer" style="width:120px" value="<?php echo $arcRow["writer"]?>"> <input name="selwriter" type="button" id="selwriter" value="选择" /></td> </tr> </table></td> </tr> <tr> <td height="24" colspan="2" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"> 文章主栏目:</td> <td><?php $typeOptions = GetOptionList($arcRow['typeid'],$cuserLogin->getUserChannel(),$channelid); echo "<select name='typeid' id='typeid' style='width:240px'>\r\n"; if($arcRow["typeid"]=="0") echo "<option value='0' selected>请选择栏目...</option>\r\n"; echo $typeOptions; echo "</select>"; ?> <img src='images/menusearch.gif' style='cursor:pointer' onClick="ShowCatMap(event, this, <?php echo $channelid; ?>, 'typeid', '<?php echo $arcRow['typeid']; ?>')" alt='快捷选择' title='快捷选择' /> <?php if($cfg_remote_site=='Y') { ?> <input name="isremote" type="checkbox" id="isremote" value="1" <?php if($cfg_title_site=='Y') echo "checked";?>> 是否同步远程发布 <?php GetFtp();?> <?php } ?></td> </tr> </table></td> </tr> <?php if($cfg_need_typeid2=='Y') { ?> <tr> <td height="24" colspan="2" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"> 文章副栏目:</td> <td><span id='typeid2ct'></span> <input type='text' name='typeid2' id='typeid2' value='<?php echo ($arcRow['typeid2']=='0' ? '' : $arcRow['typeid2']); ?>' style='width:200px;' /> <img src='images/menusearch2.gif' style='cursor:pointer;' onClick="ShowCatMap(event, this, <?php echo $channelid; ?>, 'typeid2', '<?php echo $arcRow['typeid2']; ?>')" alt='选择副栏目' title='选择副栏目' /></td> </tr> </table></td> </tr> <?php } ?> <tr> <td colspan="2"><?php PrintAutoFieldsEdit($cInfos['fieldset'],$addRow,'autofield'); ?></td> </tr> <tr> <td height="24" colspan="2" bgcolor="#F9FCEF" class="bline2"> 文章内容:</td> </tr> <tr> <td width="400%" height="24" colspan="2" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"> 附加选项:</td> <td><input name="remote" type="checkbox" class="np" id="remote" value="1" checked> 下载远程图片和资源 <input name="autolitpic" type="checkbox" class="np" id="autolitpic" value="1" checked> 提取第一个图片为缩略图 </td> </tr> </table></td> </tr> <tr> <td width="100%"><?php GetEditor("body",stripcslashes($addRow['body']),450); ?></td> <td width="255" align="center" valign="top" bgcolor="#FFFFCC" id="mPic" style="display:none"><div class="multipic"> <div style="display: block;background-color:#E5F1CF; height:26px"> <span id="spanButtonPlaceholder"></span> </div> <div id="divFileProgressContainer"></div> <div id="thumbnailsEdit" style="width: 254px; height: 535px; background-color: rgb(255, 255, 255); overflow-y: scroll;"> <?php //var_dump("SELECT * FROM `#@__uploads` WHERE arcid = {$addRow['aid']}"); $dsql->SetQuery("SELECT * FROM `#@__uploads` WHERE arcid = {$addRow['aid']}"); $dsql->Execute(); while($trow = $dsql->GetArray()) { ?> <div class="albCt" id="albold<?php echo $trow['aid'];?>"><img width="120" onclick="addtoEditOld('<?php echo $trow['url'];?>',<?php echo $trow['aid'];?>)" src="<?php echo $trow['url'];?>" style="cursor:pointer"><a href="javascript:delAlbPicOld('<?php echo $trow['url'];?>', <?php echo $trow['aid'];?>)">[删除]</a> <div style="margin-top:10px">注释: <input type="text" style="width:100px;" value="<?php echo $trow['title'];?>" name="picinfook<?php echo $trow['aid'];?>"> </div> </div> <?php } ?> <div id="thumbnails"></div> </div> </div></td> </tr> </table> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="votehead" style="margin-top:10px;"> <tr> <td><table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="84" height="24" align="center" background="images/itemnote1.gif"><a href='javascript:ShowHideT("voteset")'><u>插入投票</u></a></td> </tr> </table></td> </tr> </table> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" id="voteset" style="border:1px solid #cfcfcf;background:#ffffff;"> <tr> <td height="30"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90" height="22"> 投票:</td> <td><input type="text" name="voteid" id="voteid" value="<?php echo $arcRow['voteid']; ?>" /> <input name="selvote" type="button" id="selvote" value="选择投票" onClick="selectVote()" /> <input name="addvote" type="button" id="addvote" value="新增投票" onclick="addVote()" /> <input type="button" name="viewvote" id="viewvote" value="查看投票" onclick="viewVote()" /></td> </tr> </table></td> </tr> </table> <!-- //高级参数 --> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" id="adset" style="border:1px solid #cfcfcf;background:#ffffff;display:none"> <tr> <td height="24" colspan="4" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110" height="22"> 评论选项:</td> <td width="250"><input type='radio' name='notpost' class='np' value='0'<?php if($arcRow['notpost']==0) echo " checked='1' "; ?>/> 允许评论 <input type='radio' name='notpost' class='np' value='1'<?php if($arcRow['notpost']==1) echo " checked='1' "; ?>/> 禁止评论 </td> <td width="90">浏览次数:</td> <td><input type='text' name='click' value='<?php echo $arcRow['click']; ?>' style='width:100px;' /></td> </tr> </table></td> </tr> <tr> <td height="24" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110"> 文章排序:</td> <td width="250"><select name="sortup" id="sortup" style="width:150"> <?php $subday = SubDay($arcRow["sortrank"],$arcRow["pubdate"]); echo "<option value='0'>正常排序</option>\r\n"; if($subday>0) echo "<option value='$subday' selected>置顶 $subday 天</option>\r\n"; ?> <option value="7">置顶一周</option> <option value="30">置顶一个月</option> <option value="90">置顶三个月</option> <option value="180">置顶半年</option> <option value="360">置顶一年</option> </select></td> <td width="90">标题颜色:</td> <td><input name="color" type="text" id="color" style="width:120" value="<?php echo $arcRow["color"]?>"> <input name="modcolor" type="button" id="modcolor" value="选取" onClick="ShowColor(event,this)"></td> </tr> </table></td> </tr> <tr> <td height="24" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110"> 阅读权限:</td> <td width="250"><select name="arcrank[]" id="arcrank" style="width:150" multiple="true"> <?php $urank = $cuserLogin->getUserRank(); //管理员用户 if($urank==10){ $dsql->SetQuery("Select * from `#@__arcrank` where adminrank<='$urank'"); $dsql->Execute(); while($row = $dsql->GetObject()){ if($arcRow["arcrank"]==$row->rank) echo "<option value='".$row->rank."' selected='1'>".$row->membername."</option>\r\n"; else echo "<option value='".$row->rank."'>".$row->membername."</option>\r\n"; } }else if($urank==6){//信息发布员6 $userid=$cuserLogin->getUserID(); $dsql->SetQuery("Select * from `#@__member` where mid='$userid'"); $dsql->Execute('us'); $row = $dsql->GetObject('us'); $mrank=$row->rank; //echo "<option value='".$row->rank."' selected='1'>".$mrank."</option>\r\n"; $dsql->SetQuery("Select * from `#@__arcrank` where rank in('0','10','$mrank')"); $dsql->Execute(); while($row = $dsql->GetObject()){ if($arcRow["arcrank"]==$row->rank) echo "<option value='".$row->rank."' selected='1'>".$row->membername."</option>\r\n"; else echo "<option value='".$row->rank."'>".$row->membername."</option>\r\n"; } } ?> </select></td> <td width="90">发布选项:</td> <td><input name="ishtml" type="radio" class="np" value="1"<?php if($arcRow["ismake"]!=-1) echo " checked";?>> 生成HTML <input type="radio" name="ishtml" class="np" value="0"<?php if($arcRow["ismake"]==-1) echo " checked";?>> 仅动态浏览 </td> </tr> </table></td> </tr> <tr> <td height="75" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110"> 更新时间:</td> <td width="250"><?php $nowtime = GetDateTimeMk(time()); echo "<input name=\"pubdate\" value=\"$nowtime\" type=\"text\" id=\"pubdate\" style=\"width:120px;\">"; ?> <script language="javascript" type="text/javascript"> Calendar.setup({ inputField : "pubdate", ifFormat : "%Y-%m-%d %H:%M:%S", showsTime : true, timeFormat : "24" }); </script></td> <td width="92">消费金币:</td> <td width="368"><input name="money" type="text" id="money" value="<?php echo $arcRow["money"]?>" size="10"></td> </tr> </table></td> </tr> <tr> <td height="24" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110" height="51"> 关键字:</td> <td><input type="text" name="keywords" id="keywords" style="width:60%" value="<?php echo $arcRow["keywords"]?>" /></td> </tr> </table></td> </tr> <tr> <td height="24" class="bline"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110" height="51"> 文章摘要:</td> <td><textarea name="description" rows="5" id="description" style="width:80%"><?php echo $arcRow["description"]?></textarea></td> </tr> </table></td> </tr> <tr> <td height="24" colspan="4"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110"> 自定义文件名:</td> <td><input type="text" name="filename" id="filename" value="<?php echo $arcRow["filename"]?>" /> (不包括后缀名如.html等)</td> <td><?php if(isset($cfg_tamplate_rand) && $cfg_tamplate_rand==1) { ?> 模板选择: <select name='templet' id='templet' style='width:200px' size='1'> <?php foreach($cfg_tamplate_arr as $k=>$v) { $v = trim($v); echo ($v==$addRow['templet'] ? "<option value='$v' selected>$v</option>\r\n" : "<option value='$v'>$v</option>\r\n"); } ?> </select> <?php } else{ echo "<input type='hidden' name='templet' value='{$addRow['templet']}' />"; } ?></td> </tr> </table></td> </tr> </table> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F9FCEF" style="border:1px solid #cfcfcf;border-top:none;"> <tr> <td height="35"><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="17%"> </td> <td width="83%"><table width="214" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="115"><input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" class="np" border="0" style="cursor:pointer"></td> <td width="99"><img src="images/button_reset.gif" width="60" height="22" border="0" onClick="location.reload();" style="cursor:pointer"></td> </tr> </table></td> </tr> </table></td> </tr> </table> <script language='javascript'>InitPage();</script> </form> <div id="__tmpbody" style="display:none"></div> </body> </html>
6.根据上面的edit编辑页面再去修改下add页面 article_add.htm/php catalog_add.htm/php
有话要说...