catalog_edit.php
11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<?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, '你无权更改本栏目!');
/*-----------------------
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' ";
}
if($ispart!=0) $cross = 0;
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
sortrank='$sortrank',
typename='$typename',
typedir='$typedir',
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'];
//读取频道模型信息
$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');
}
?>