Repository navigation
Expand file tree
/
Copy pathcatadmin.php
More file actions
executable file
·298 lines (293 loc) · 10.9 KB
/
Copy pathcatadmin.php
File metadata and controls
executable file
·298 lines (293 loc) · 10.9 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
288
289
290
291
292
293
294
295
296
297
298
<?php
/**
*
* Duhok Forum 3.0
* @author Dilovan Matini (original founder)
* @copyright 2007 - 2021 Dilovan Matini
* @see df.lelav.com
* @see https://github.com/dilovanmatini/duhok-forum
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT ANY WARRANTY;
*
*/
const _df_script = "catadmin";
const _df_filename = "catadmin.php";
define('_df_path', dirname(__FILE__)."/");
require_once _df_path."globals.php";
if(ulv != 4){
$DF->quick();
exit();
}
$Template->header();
if(type == "add"){
?>
<script type="text/javascript">
function checkSubmit(frm){
if(frm.subject.value == ""){
alert("يجب عليك كتابة اسم الفئة.");
}
else if(isNaN(parseInt(frm.monitor.value))){
alert("يجب عليك فقط إدخال ارقام في خانة رقم مراقب.");
}
else{
frm.submit();
}
}
</script>
<?php
echo"
<center>
<table class=\"border\" width=\"60%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\">
<form method=\"post\" action=\"catadmin.php?type=insert\">
<tr>
<td class=\"asHeader\" colspan=\"2\">إضافة فئة جديدة</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>اسم الفئة</nobr></td>
<td class=\"asNormalB\"><input type=\"text\" style=\"width:350px\" name=\"subject\"></td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>رقم مراقب</nobr></td>
<td class=\"asNormalB\"><input type=\"text\" style=\"width:50px\" name=\"monitor\" value=\"0\"> ملاحظة: فقط إدخل رقم عضو الذي تريد تعينه كمراقب هذه الفئة</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>رقم نائب مراقب</nobr></td>
<td class=\"asNormalB\"><input type=\"text\" style=\"width:50px\" name=\"submonitor\" value=\"0\"> ملاحظة: فقط إدخل رقم عضو الذي تريد تعينه كنائب مراقب لهذه الفئة</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>الأرشفة</nobr></td>
<td class=\"asNormalB\">
<select class=\"asGoTo\" name=\"archive\">
<option value=\"0\">غير مؤرشف</option>
<option value=\"1\">مؤرشف</option>
</select>
</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>مجموعة</nobr></td>
<td class=\"asNormalB\">
<select class=\"asGoTo\" name=\"level\">";
for($x=0;$x<=4;$x++){
echo"
<option value=\"$x\">{$Template->groups[$x]}</option>";
}
echo"
</select>
</td>
</tr>
<tr>
<td class=\"asHeader\" colspan=\"2\">خيارات الفئة</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>إخفاء فئة</nobr></td>
<td class=\"asNormalB\">
<input type=\"radio\" class=\"none\" name=\"hidden\" value=\"1\"> نعم
<input type=\"radio\" class=\"none\" name=\"hidden\" value=\"0\" checked> لا
</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>إخفاء مراقب في صفحة الرئيسية</nobr></td>
<td class=\"asNormalB\">
<input type=\"radio\" class=\"none\" name=\"hidemonhome\" value=\"1\"> نعم
<input type=\"radio\" class=\"none\" name=\"hidemonhome\" value=\"0\" checked> لا
</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>إخفاء مراقب في معلومات منتدى</nobr></td>
<td class=\"asNormalB\">
<input type=\"radio\" class=\"none\" name=\"hidemoninfo\" value=\"1\"> نعم
<input type=\"radio\" class=\"none\" name=\"hidemoninfo\" value=\"0\" checked> لا
</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>إخفاء مراقب في بيانات العضو</nobr></td>
<td class=\"asNormalB\">
<input type=\"radio\" class=\"none\" name=\"hidemonprofile\" value=\"1\"> نعم
<input type=\"radio\" class=\"none\" name=\"hidemonprofile\" value=\"0\" checked> لا
</td>
</tr>
<tr>
<td class=\"asNormalB\" align=\"center\" colspan=\"2\"><input onClick=\"checkSubmit(this.form)\" class=\"button\" type=\"button\" value=\"أضف فئة\"></td>
</tr>
</form>
</table>
</center>";
}
elseif(type == "edit"){
$sql=$mysql->query("SELECT * FROM ".prefix."category WHERE id = '".c."'", __FILE__, __LINE__);
$rs=$mysql->fetchAssoc($sql);
if(!$rs){
$Template->errMsg('لم يتم العثور على أي فئة');
}
$c=$rs['id'];
?>
<script type="text/javascript">
function checkSubmit(frm){
if(frm.subject.value == ""){
alert("يجب عليك كتابة اسم الفئة.");
}
else if(isNaN(parseInt(frm.monitor.value))){
alert("يجب عليك فقط إدخال ارقام في خانة رقم مراقب.");
}
else{
frm.submit();
}
}
</script>
<?php
echo"
<center>
<table class=\"border\" width=\"60%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\">
<form method=\"post\" action=\"catadmin.php?type=update&c=$c\">
<input type=\"hidden\" name=\"lastsubmonitor\" value=\"{$rs['submonitor']}\">
<tr>
<td class=\"asHeader\" colspan=\"2\">تعديل الفئة</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>اسم الفئة</nobr></td>
<td class=\"asNormalB\"><input type=\"text\" style=\"width:350px\" name=\"subject\" value=\"{$rs['subject']}\"></td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>رقم مراقب</nobr></td>
<td class=\"asNormalB\"><input type=\"text\" style=\"width:50px\" name=\"monitor\" value=\"{$rs['monitor']}\"> ملاحظة: فقط إدخل رقم عضو الذي تريد تعينه كمراقب هذه الفئة</td>
</tr>";
if($rs['monitor']>0){
echo"
<tr>
<td class=\"asFixedB\"><nobr>اسم مراقب</nobr></td>
<td class=\"asNormalB\">{$Template->userColorLink($rs['monitor'])}</td>
</tr>";
}
echo"<tr>
<td class=\"asFixedB\"><nobr>رقم نائب المراقب</nobr></td>
<td class=\"asNormalB\"><input type=\"text\" style=\"width:50px\" name=\"submonitor\" value=\"{$rs['submonitor']}\"> ملاحظة: فقط إدخل رقم عضو الذي تريد تعينه كنائب مراقب لهذه الفئة</td>
</tr>";
if($rs['submonitor']>0){
echo"
<tr>
<td class=\"asFixedB\"><nobr>اسم نائب المراقب</nobr></td>
<td class=\"asNormalB\">{$Template->userColorLink($rs['submonitor'])}</td>
</tr>";
}
echo"
<tr>
<td class=\"asFixedB\"><nobr>الأرشفة</nobr></td>
<td class=\"asNormalB\">
<select class=\"asGoTo\" name=\"archive\">
<option value=\"0\" {$DF->choose($rs['archive'],0,'s')}>غير مؤرشف</option>
<option value=\"1\" {$DF->choose($rs['archive'],1,'s')}>مؤرشف</option>
</select>
</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>مجموعة</nobr></td>
<td class=\"asNormalB\">
<select class=\"asGoTo\" name=\"level\">";
for($x=0;$x<=4;$x++){
echo"
<option value=\"$x\" {$DF->choose($rs['level'],$x,'s')}>{$Template->groups[$x]}</option>";
}
echo"
</select>
</td>
</tr>
<tr>
<td class=\"asHeader\" colspan=\"2\">خيارات الفئة</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>إخفاء فئة</nobr></td>
<td class=\"asNormalB\">
<input type=\"radio\" class=\"none\" name=\"hidden\" value=\"1\" {$DF->choose($rs['hidden'],1,'c')}> نعم
<input type=\"radio\" class=\"none\" name=\"hidden\" value=\"0\" {$DF->choose($rs['hidden'],0,'c')}> لا
</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>إخفاء مراقب في صفحة الرئيسية</nobr></td>
<td class=\"asNormalB\">
<input type=\"radio\" class=\"none\" name=\"hidemonhome\" value=\"1\" {$DF->choose($rs['hidemonhome'],1,'c')}> نعم
<input type=\"radio\" class=\"none\" name=\"hidemonhome\" value=\"0\" {$DF->choose($rs['hidemonhome'],0,'c')}> لا
</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>إخفاء مراقب في معلومات منتدى</nobr></td>
<td class=\"asNormalB\">
<input type=\"radio\" class=\"none\" name=\"hidemoninfo\" value=\"1\" {$DF->choose($rs['hidemoninfo'],1,'c')}> نعم
<input type=\"radio\" class=\"none\" name=\"hidemoninfo\" value=\"0\" {$DF->choose($rs['hidemoninfo'],0,'c')}> لا
</td>
</tr>
<tr>
<td class=\"asFixedB\"><nobr>إخفاء مراقب في بيانات العضو</nobr></td>
<td class=\"asNormalB\">
<input type=\"radio\" class=\"none\" name=\"hidemonprofile\" value=\"1\" {$DF->choose($rs['hidemonprofile'],1,'c')}> نعم
<input type=\"radio\" class=\"none\" name=\"hidemonprofile\" value=\"0\" {$DF->choose($rs['hidemonprofile'],0,'c')}> لا
</td>
</tr>
<tr>
<td class=\"asNormalB\" align=\"center\" colspan=\"2\"><input onClick=\"checkSubmit(this.form)\" class=\"button\" type=\"button\" value=\"تعديل فئة\"></td>
</tr>
</form>
</table>
</center>";
}
elseif(type == "insert"){
$monitor=(int)$_POST['monitor'];
$submonitor=(int)$_POST['submonitor'];
$mysql->insert("category (submonitor,subject,monitor,archive,level,hidden,hidemonhome,hidemoninfo,hidemonprofile) VALUES (
'$submonitor','{$_POST['subject']}','$monitor','{$_POST['archive']}','{$_POST['level']}','{$_POST['hidden']}','{$_POST['hidemonhome']}','{$_POST['hidemoninfo']}','{$_POST['hidemonprofile']}')", __FILE__, __LINE__);
$Template->msg('تم إضافة فئة جديدة بنجاح');
}
elseif(type == "update"){
$c=(int)$mysql->get('category','id',c);
if($c>0){
$monitor=(int)$_POST['monitor'];
$submonitor=(int)$_POST['submonitor'];
$lastsubmonitor=(int)$_POST['lastsubmonitor'];
$mysql->update("category SET
subject = '{$_POST['subject']}',
monitor = '$monitor',
submonitor = '$submonitor',
archive = '{$_POST['archive']}',
level = '{$_POST['level']}',
hidden = '{$_POST['hidden']}',
hidemonhome = '{$_POST['hidemonhome']}',
hidemoninfo = '{$_POST['hidemoninfo']}',
hidemonprofile = '{$_POST['hidemonprofile']}'
WHERE id = '$c'", __FILE__, __LINE__);
$Template->msg('تم تعديل الفئة بنجاح');
}
else{
$Template->errMsg('لم يتم العثور على أي فئة');
}
}
elseif(type == "lock"){
$c=(int)$mysql->get('category','id',c);
if($c>0){
$mysql->update("category SET status = '0' WHERE id = '$c'", __FILE__, __LINE__);
$Template->msg('تم قفل الفئة بنجاح');
}
else{
$Template->errMsg('لم يتم العثور على أي فئة');
}
}
elseif(type == "open"){
$c=(int)$mysql->get('category','id',c);
if($c>0){
$mysql->update("category SET status = '1' WHERE id = '$c'", __FILE__, __LINE__);
$Template->msg('تم فتح الفئة بنجاح');
}
else{
$Template->errMsg('لم يتم العثور على أي فئة');
}
}
elseif(type == "delete"){
$c=(int)$mysql->get('category','id',c);
if($c>0){
$mysql->delete("category WHERE id = '$c'", __FILE__, __LINE__);
$Template->msg('تم حذف الفئة بنجاح','index.php');
}
else{
$Template->errMsg('لم يتم العثور على أي فئة');
}
}
$Template->footer();
?>