ClassInfoType.php
5.02 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
<?php
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
$link=db_connect();
$empire=new mysqlquery();
//驗證用戶
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
//驗證權限
CheckLevel($logininid,$loginin,$classid,"class");
//設置欄目標題分類
function SetClassInfoType($add,$logininid,$loginin){
global $empire,$dbtbpre;
CheckLevel($logininid,$loginin,$classid,"class");//驗證權限
$classid=(int)$add['classid'];
if(empty($classid))
{
printerror("ErrorUrl","history.go(-1)");
}
$cr=$empire->fetch1("select classid,modid,classname,islast from {$dbtbpre}enewsclass where classid='$classid'");
if(!$cr['classid']||!$cr['islast']||!$cr['modid'])
{
printerror("ErrorUrl","history.go(-1)");
}
$noclassinfo=(int)$add['noclassinfo'];
if($noclassinfo==1)
{
$ttids='-';
}
else
{
$typeid=$add['typeid'];
$count=count($typeid);
$ttids='';
if($count)
{
$dh='';
for($i=0;$i<$count;$i++)
{
$tid=(int)$typeid[$i];
if(empty($tid))
{
continue;
}
$ttids.=$dh.$tid;
$dh=',';
}
if($ttids)
{
$ttids=','.$ttids.',';
}
}
}
$sql=$empire->query("update {$dbtbpre}enewsclassadd set ttids='$ttids' where classid='$classid'");
if($sql)
{
insert_dolog("classid=$classid&classname=$cr[classname]");//操作日誌
printerror("SetClassInfoTypeSuccess","ClassInfoType.php?classid=$classid".hReturnEcmsHashStrHref2(0));
}
else
{
printerror("DbError","history.go(-1)");
}
}
$enews=$_POST['enews'];
if($enews)
{
hCheckEcmsRHash();
}
if($enews=='SetClassInfoType')
{
SetClassInfoType($_POST,$logininid,$loginin);
}
$classid=(int)$_GET['classid'];
if(!$classid)
{
printerror("ErrorUrl","history.go(-1)");
}
$cr=$empire->fetch1("select classid,bclassid,modid,classname,islast from {$dbtbpre}enewsclass where classid='$classid'");
if(!$cr['classid']||!$cr['islast']||!$cr['modid'])
{
printerror("ErrorUrl","history.go(-1)");
}
$caddr=$empire->fetch1("select ttids from {$dbtbpre}enewsclassadd where classid='$classid'");
$url=$cr['classname'].' > 設置標題分類';
if($cr['bclassid'])
{
$bcr=$empire->fetch1("select classid,classname from {$dbtbpre}enewsclass where classid='$cr[bclassid]'");
$url=$bcr['classname'].' > '.$url;
}
$sql=$empire->query("select typeid,tname from {$dbtbpre}enewsinfotype where mid='$cr[modid]' order by myorder,typeid");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>設置欄目標題分類</title>
<link href="adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
<script>
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.name=='chkall'||e.name=='noclassinfo')
{
}
else
{
e.checked = form.chkall.checked;
}
}
}
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td>位置:<?=$url?>
</td>
</tr>
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<form name="form1" method="post" action="ClassInfoType.php" onsubmit="return confirm('確認設置?');">
<?=$ecms_hashur['form']?>
<input type="hidden" name="enews" value="SetClassInfoType">
<input type="hidden" name="classid" value="<?=$classid?>">
<tr class="header">
<td width="10%"><div align="center">選擇 </div></td>
<td width="59%" height="25"><div align="center">分類名稱</div></td>
</tr>
<?php
while($r=$empire->fetch($sql))
{
$checked='';
if(strstr($caddr['ttids'],','.$r['typeid'].','))
{
$checked=' checked';
}
?>
<tr bgcolor="#FFFFFF">
<td><div align="center">
<input name="typeid[]" type="checkbox" id="typeid[]" value="<?=$r['typeid']?>"<?=$checked?>>
</div></td>
<td height="25">
<?=$r['tname']?>
(
<?=$r['typeid']?>
)</td>
</tr>
<?php
}
db_close();
$empire=null;
?>
<tr bgcolor="#FFFFFF">
<td><div align="center">
<input name="noclassinfo" type="checkbox" id="noclassinfo" value="1"<?=$caddr['ttids']=='-'?' checked':''?>>
</div></td>
<td height="25"><strong>本欄目不使用標題分類</strong></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><div align="center">
<input type=checkbox name=chkall value=on onclick=CheckAll(this.form)>
</div></td>
<td height="25"><input type="submit" name="Submit" value="提 交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</form>
</table>
</body>
</html>