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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
|
<?php /************************************************************************** * * * 4images - A Web Based Image Gallery Management System * * ---------------------------------------------------------------- * * * * File: categories.php * * Copyright: (C) 2002 Jan Sorgalla * * Email: jan@4homepages.de * * Web: http://www.4homepages.de * * Scriptversion: 1.7.1 * * * * Never released without support from: Nicky (http://www.nicky.net) * * * ************************************************************************** * * * Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- * * bedingungen (Lizenz.txt) für weitere Informationen. * * --------------------------------------------------------------- * * This script is NOT freeware! Please read the Copyright Notice * * (Licence.txt) for further information. * * * *************************************************************************/
define('IN_CP', 1); define('ROOT_PATH', './../'); require('admin_global.php');
include(ROOT_PATH.'includes/search_utils.php');
if ($action == "") { $action = "modifycats"; }
$access_field_array = array( "auth_viewcat" => AUTH_ALL, "auth_viewimage" => AUTH_ALL, "auth_download" => AUTH_USER, "auth_upload" => AUTH_USER, "auth_directupload" => AUTH_ADMIN, "auth_vote" => AUTH_ALL, "auth_sendpostcard" => AUTH_ALL, "auth_readcomment" => AUTH_ALL, "auth_postcomment" => AUTH_USER );
$access_array = array( AUTH_ALL => $lang['all'], AUTH_USER => $lang['userlevel_registered'], AUTH_ACL => $lang['private'], AUTH_ADMIN => $lang['userlevel_admin'] );
function show_access_select($title = "", $type, $status) { global $access_array, $HTTP_POST_VARS; if (isset($HTTP_POST_VARS[$type])) { $status = $HTTP_POST_VARS[$type]; } echo "<tr class=\"".get_row_bg()."\" valign=\"top\">\n<td><p class=\"rowtitle\">".$title."</p></td>\n"; echo "<td>\n<select name=\"".$type."\">\n"; foreach ($access_array as $key => $val) { echo "<option value=\"".$key."\""; if ($status == $key) { echo " selected=\"selected\""; } echo ">".$val."</option>\n"; } echo "</select>\n</td>\n</tr>\n"; }
function create_cat_folder($path, $mode) { if (@is_dir($path)) { @chmod($path, $mode); return true; } else { $oldumask = umask(0); $result = mkdir($path, $mode); umask($oldumask); if (!@is_dir($path) || !$result) { $result = mkdir($path, 0755); @chmod($path, $mode); } return $result; } }
function remove_cat_folder($path) { $ok = 1; if (@is_dir($path)) { $handle = opendir($path); while ($file = @readdir($handle)) { if ($file != "." && $file != "..") { $ok = (!remove_cat_folder($path."/".$file)) ? 0 : $ok; } } closedir($handle); $ok = (!rmdir($path)) ? 0 : $ok; } else { $ok = (!unlink($path)) ? 0 : $ok; } return $ok; }
function remove_subcategories($cid = 0, $depth = 1) { global $site_db, $error_log, $lang, $category_cache;
if (!isset($category_cache[$cid])) { return false; } foreach ($category_cache[$cid] as $key => $cats) { echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>\n"; if ($depth > 1) { echo str_repeat(" ", $depth - 1)."\n"; } echo "</td><td>\n";
$sql = "DELETE FROM ".GROUP_ACCESS_TABLE." WHERE cat_id = ".$cats['cat_id']; $site_db->query($sql);
$sql = "DELETE FROM ".CATEGORIES_TABLE." WHERE cat_id = ".$cats['cat_id'];
if ($site_db->query($sql)) { echo $lang['cat_delete_success']." <b>".$cats['cat_name']."</b> (ID: ".$cats['cat_id'].")<br />\n"; } else { $error_log[] = $lang['cat_delete_error']." <b>".$cats['cat_name']."</b> (ID: ".$cats['cat_id'].")"; }
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE cat_id = ".$cats['cat_id']; $img_result = $site_db->query($sql);
$image_ids_sql = 0; while ($image_row = $site_db->fetch_array($img_result)) { $image_ids_sql .= (($image_ids_sql != "") ? ", " : "").$image_row['image_id']; }
$sql = "DELETE FROM ".IMAGES_TABLE." WHERE image_id IN ($image_ids_sql)"; if ($site_db->query($sql)) { echo "-» ".$lang['image_delete_success']."<br />\n"; } else { $error_log[] = $lang['image_delete_error']." (".$cats['cat_name'].", ID: ".$cats['cat_id'].")"; }
if (!empty($cats['cat_id'])) { if (remove_cat_folder(MEDIA_PATH."/".$cats['cat_id'])) { echo "-» ".$lang['file_delete_success']."<br />\n"; } else { $error_log[] = $lang['file_delete_error']." (".$cats['cat_name'].", ID: ".$cats['cat_id'].")"; } if (remove_cat_folder(THUMB_PATH."/".$cats['cat_id'])) { echo "-» ".$lang['thumb_delete_success']."<br />\n"; } else { $error_log[] = $lang['thumb_delete_error']." (".$cats['cat_name'].", ID: ".$cats['cat_id'].")"; } }
$sql = "DELETE FROM ".COMMENTS_TABLE." WHERE image_id IN ($image_ids_sql)"; if ($site_db->query($sql)) { echo "-» ".$lang['comments_delete_success']."<br />\n"; } else { $error_log[] = $lang['comments_delete_error']." (".$cats['cat_name'].", ID: ".$cats['cat_id'].")"; }
remove_searchwords($image_ids_sql);
echo "<br /></td></tr></table>\n"; remove_subcategories($cats['cat_id'], $depth + 1); } unset($category_cache[$cid]); return true; }
function show_category_rows($cid = 0, $depth = 1) { global $site_db, $site_sess, $lang, $category_cache;
if (!isset($category_cache[$cid])) { return false; } foreach ($category_cache[$cid] as $key => $cats) { $class = "tablerow2"; if ($cats['cat_parent_id'] == 0) { $class = "tablerow"; } echo "<tr class=\"$class\">\n<td>\n"; if ($depth > 1) { echo str_repeat(" ", $depth - 1)."<img src=\"images/folder_path.gif\" alt=\"\">\n"; } echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\" target=\"_blank\">".$cats['cat_name']."</a>\n</b> (ID: ".$cats['cat_id'].") "; show_text_link($lang['edit'], "categories.php?action=editcat&cat_id=".$cats['cat_id']); show_text_link($lang['delete'], "categories.php?action=removecat&cat_id=".$cats['cat_id']); show_text_link($lang['add_subcategory'], "categories.php?action=addcat&cat_parent_id=".$cats['cat_id']); echo "\n</td>\n<td align=\"center\">"; echo "<a href=\"".$site_sess->url("categories.php?action=ordercat&move=up&cat_id=".$cats['cat_id'])."\"><img src=\"images/arrow_up.gif\" border=\"0\"></a>\n"; echo "<a href=\"".$site_sess->url("categories.php?action=ordercat&move=down&cat_id=".$cats['cat_id'])."\"><img src=\"images/arrow_down.gif\" border=\"0\"></a>\n"; echo "</td>\n</tr>\n"; show_category_rows($cats['cat_id'], $depth + 1); } unset($category_cache[$cid]); }
function update_cat_order($parent_id = 0) { global $site_db; $sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE cat_parent_id = $parent_id ORDER BY cat_order ASC"; $result = $site_db->query($sql); $i = 10; while ($row = $site_db->fetch_array($result)) { $sql = "UPDATE ".CATEGORIES_TABLE." SET cat_order = $i WHERE cat_id = ".$row['cat_id']; $site_db->query($sql); $i += 10; } }
function get_cat_order_dropdown($parent_id = 0) { global $cat_cache, $cat_parent_cache, $lang, $HTTP_POST_VARS; $category_list = "\n<select name=\"cat_order\" class=\"categoryselect\">\n"; $category_list .= "<option value=\"0\""; if (isset($HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == 0) { $category_list .= " selected=\"selected\""; } $category_list .= ">".$lang['at_end']."</option>\n"; $category_list .= "<option value=\"5\""; if (isset($HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == 5) { $category_list .= " selected=\"selected\""; } $category_list .= ">".$lang['at_beginning']."</option>\n"; foreach ($cat_parent_cache[$parent_id] as $key => $val) { $category_list .= "<option value=\"".($cat_cache[$val]['cat_order'] + 5)."\""; if (isset($HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == ($cat_cache[$val]['cat_order'] + 5)) { $category_list .= " selected=\"selected\""; } $category_list .= ">".$lang['after']." ".$cat_cache[$val]['cat_name']."</option>\n"; } $category_list .= "</select>\n"; return $category_list; }
show_admin_header();
if ($action == "ordercat") { $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']); $move = (isset($HTTP_POST_VARS['move'])) ? trim($HTTP_POST_VARS['move']) : trim($HTTP_GET_VARS['move']);
$number = ($move == "up") ? -15 : 15;
$sql = "UPDATE ".CATEGORIES_TABLE." SET cat_order = cat_order + $number WHERE cat_id = $cat_id"; $site_db->query($sql);
update_cat_order($cat_cache[$cat_id]['cat_parent_id']); $action = "modifycats"; }
if ($action == "deletecat") { $error_log = array(); show_table_header($lang['main_category'], 1); $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);
$sql = "SELECT cat_id, cat_name, cat_parent_id FROM ".CATEGORIES_TABLE." ORDER BY cat_order, cat_name ASC"; $result = $site_db->query($sql); $category_cache = array(); while ($row = $site_db->fetch_array($result)) { $category_cache[$row['cat_parent_id']][$row['cat_id']] = $row; }
echo "<tr><td class=\"tablerow\">\n"; echo "<table border=\"0\" cellpadding=\"2\" cellspacing=0><tr><td> </td><td>\n";
$sql = "DELETE FROM ".GROUP_ACCESS_TABLE." WHERE cat_id = ".$cat_id; $site_db->query($sql);
$sql = "DELETE FROM ".CATEGORIES_TABLE." WHERE cat_id = ".$cat_id;
if ($site_db->query($sql)) { echo $lang['cat_delete_success']." <b>".$cat_cache[$cat_id]['cat_name']."</b> (ID: ".$cat_id.")<br />\n"; } else { $error_log[] = $lang['cat_delete_error']." <b>".$cat_cache[$cat_id]['cat_name']."</b> (ID: ".$cat_id.")"; }
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE cat_id = ".$cat_id; $img_result = $site_db->query($sql);
$image_ids_sql = 0; while ($image_row = $site_db->fetch_array($img_result)) { $image_ids_sql .= (($image_ids_sql != "") ? ", " : "").$image_row['image_id']; }
$sql = "DELETE FROM ".IMAGES_TABLE." WHERE image_id IN ($image_ids_sql)"; if ($site_db->query($sql)) { echo "-» ".$lang['image_delete_success']."<br />\n"; } else { $error_log[] = $lang['image_delete_error']." (".$cat_cache[$cat_id]['cat_name'].", ID: ".$cat_id.")"; }
if (!empty($cat_id)) { if (remove_cat_folder(MEDIA_PATH."/".$cat_id)) { echo "-» ".$lang['file_delete_success']."<br />\n"; } else { $error_log[] = $lang['file_delete_error']." (".$cat_cache[$cat_id]['cat_name'].", ID: ".$cat_id.")"; } if (remove_cat_folder(THUMB_PATH."/".$cat_id)) { echo "-» ".$lang['thumb_delete_success']."<br />\n"; } else { $error_log[] = $lang['thumb_delete_error']." (".$cat_cache[$cat_id]['cat_name'].", ID: ".$cat_id.")"; } }
$sql = "DELETE FROM ".COMMENTS_TABLE." WHERE image_id IN ($image_ids_sql)"; if ($site_db->query($sql)) { echo "-» ".$lang['comments_delete_success']."<br />\n"; } else { $error_log[] = $lang['comments_delete_error']." (".$cat_cache[$cat_id]['cat_name'].", ID: ".$cat_id.")"; }
remove_searchwords($image_ids_sql);
echo "<br /></td></tr></table>\n"; echo "</td></tr>\n"; show_table_separator($lang['sub_categories'], 1); echo "<tr><td class=\"tablerow\">\n"; if (!remove_subcategories($cat_id)) { echo $lang['no_subcategories']; } echo "</td></tr>\n"; show_table_footer(); if (!empty($error_log)) { show_table_header("Error Log:", 1); echo "<tr><td class=\"tablerow\">\n"; echo "<table border=\"0\" cellpadding=\"\"2 cellspacing=\"0\"><tr><td> </td><td>\n"; echo "<b>".$lang['error_log_desc']."</b>\n<ul>\n"; foreach ($error_log as $key => $val) { printf ("<li>%s</li>\n", $val); } echo "</ul>\n</td></tr></table>\n"; echo "</td></tr>\n"; show_table_footer(); } echo "<p>"; show_text_link($lang['back_overview'],"categories.php?action=modifycats"); }
if ($action == "removecat") { $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);
show_form_header("categories.php", "deletecat"); show_hidden_input("cat_id", $cat_id); show_table_header($lang['delete'].": ".$cat_cache[$cat_id]['cat_name'], 2); show_description_row($lang['delete_cat_confirm']); show_form_footer($lang['yes'], "", 2, $lang['no']); }
if ($action == "savecat") { $error = array(); $cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name'])); $cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description'])); $cat_parent_id = intval($HTTP_POST_VARS['cat_parent_id']); $cat_order = (isset($HTTP_POST_VARS['cat_order'])) ? intval($HTTP_POST_VARS['cat_order']) : 0;
$auth_viewcat = $HTTP_POST_VARS['auth_viewcat']; $auth_viewimage = $HTTP_POST_VARS['auth_viewimage']; $auth_download = $HTTP_POST_VARS['auth_download']; $auth_upload = $HTTP_POST_VARS['auth_upload']; $auth_directupload = $HTTP_POST_VARS['auth_directupload']; $auth_vote = $HTTP_POST_VARS['auth_vote']; $auth_sendpostcard = $HTTP_POST_VARS['auth_sendpostcard']; $auth_readcomment = $HTTP_POST_VARS['auth_readcomment']; $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
if ($cat_name == "") { $error['cat_name'] = 1; }
if (empty($error)) { if (!$cat_order) { $sql = "SELECT cat_order FROM ".CATEGORIES_TABLE." WHERE cat_parent_id = $cat_parent_id ORDER BY cat_order DESC LIMIT 1"; $catorder = $site_db->query_firstrow($sql); $cat_order = $catorder['cat_order'] + 10; $do_updat_cat_order = 0; } else { $do_updat_cat_order = 1; }
$sql = "INSERT INTO ".CATEGORIES_TABLE." (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment) VALUES ('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)"; $result = $site_db->query($sql); $cat_id = $site_db->get_insert_id();
if ($result && $cat_id) { if ($do_updat_cat_order) { update_cat_order($cat_parent_id); } $msg = $lang['cat_add_success']; create_cat_folder(MEDIA_PATH."/".$cat_id, CHMOD_DIRS); create_cat_folder(THUMB_PATH."/".$cat_id, CHMOD_DIRS); } else { $msg = $lang['cat_add_error']; } $action = "modifycats"; } else { $msg = sprintf("<span class=\"marktext\">%s</span>", $lang['lostfield_error']); $action = "addcat"; } }
if ($action == "addcat") { if ($msg != "") { printf("<b>%s</b>\n", $msg); }
show_form_header("categories.php", "savecat"); show_table_header($lang['nav_categories_add'], 2); show_input_row($lang['field_category_name'], "cat_name", "", $textinput_size); show_textarea_row($lang['field_description_ext'], "cat_description", "", $textarea_size); $cat_parent_id = (isset($HTTP_GET_VARS['cat_parent_id'])) ? $HTTP_GET_VARS['cat_parent_id'] : 0; show_cat_select_row($lang['field_parent'], $cat_parent_id, 1);
//show_custom_row($lang['cat_order'], get_cat_order_dropdown($cat_parent_id));
$permission_headline = $lang['permissions']; if ($cat_parent_id != 0) { $new_access_field_array = array();
$sql = "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment FROM ".CATEGORIES_TABLE." WHERE cat_id = $cat_parent_id"; $row = $site_db->query_firstrow($sql);
foreach ($access_field_array as $key => $val) { $new_access_field_array[$key] = $row[$key]; } unset($access_field_array); $access_field_array = $new_access_field_array; $permission_headline .= "<span class=\"smalltext\"><br>".$lang['permissions_inherited']." (".$row['cat_name'].")</span>"; }
show_table_separator($permission_headline, 2); foreach ($access_field_array as $key => $val) { show_access_select($lang[$key], $key, $val); }
show_form_footer($lang['add'], $lang['reset'], 2); }
if ($action == "updatecat") { $error = array(); $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);
$cat_parent_id = intval($HTTP_POST_VARS['cat_parent_id']); $cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name'])); $cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description'])); $cat_hits = intval(trim($HTTP_POST_VARS['cat_hits']));
$auth_viewcat = $HTTP_POST_VARS['auth_viewcat']; $auth_viewimage = $HTTP_POST_VARS['auth_viewimage']; $auth_download = $HTTP_POST_VARS['auth_download']; $auth_upload = $HTTP_POST_VARS['auth_upload']; $auth_directupload = $HTTP_POST_VARS['auth_directupload']; $auth_vote = $HTTP_POST_VARS['auth_vote']; $auth_sendpostcard = $HTTP_POST_VARS['auth_sendpostcard']; $auth_readcomment = $HTTP_POST_VARS['auth_readcomment']; $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
if ($cat_parent_id == $cat_id) { $msg .= sprintf("<span class=\"marktext\">%s</span><br />", $lang['parent_cat_error']); $error['cat_parent_id'] = 1; } if ($cat_name == "") { $error['cat_name'] = 1; }
if (empty($error)) { $sql = "UPDATE ".CATEGORIES_TABLE." SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment WHERE cat_id = $cat_id"; $result = $site_db->query($sql);
$msg = ($result) ? $lang['cat_edit_success'] : $lang['cat_edit_error']; $action = "modifycats"; } else { $msg .= sprintf("<span class=\"marktext\">%s</span>", $lang['lostfield_error']); $action = "editcat"; } }
if ($action == "editcat") { if ($msg != "") { printf("<b>%s</b>\n", $msg); } $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);
$sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment FROM ".CATEGORIES_TABLE." WHERE cat_id = $cat_id"; $result = $site_db->query_firstrow($sql);
show_form_header("categories.php", "updatecat"); show_hidden_input("cat_id", $cat_id); show_table_header($lang['nav_categories_edit'], 2); show_input_row($lang['field_category_name'], "cat_name", htmlspecialchars($result['cat_name']), $textinput_size); show_textarea_row($lang['field_description_ext'], "cat_description", htmlspecialchars($result['cat_description']), $textarea_size); show_cat_select_row($lang['field_parent'], $result['cat_parent_id'], 1); show_input_row($lang['field_hits'], "cat_hits", $result['cat_hits'], 5);
show_table_separator($lang['permissions'], 2); foreach ($access_field_array as $key => $val) { show_access_select($lang[$key], $key, $result[$key]); }
show_form_footer($lang['save_changes'], $lang['reset'], 2, $lang['back']); }
if ($action == "modifycats") { if ($msg != "") { printf("<b>%s</b>\n<p>", $msg); }
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment FROM ".CATEGORIES_TABLE." ORDER BY cat_order, cat_name ASC"; $result = $site_db->query($sql);
$category_cache = array(); while ($row = $site_db->fetch_array($result)) { $category_cache[$row['cat_parent_id']][$row['cat_id']] = $row; }
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n"; echo "<tr class=\"tableseparator\">\n"; echo "<td class=\"tableseparator\">".$lang['nav_categories_edit']."</td>\n<td class=\"tableseparator\" align=\"center\">".$lang['cat_order']."</td>\n</tr>\n"; if (sizeof($category_cache) == 0) { echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"2\">".$lang['no_categories']."</td></tr>"; } else { show_category_rows(); } show_table_footer(); } show_admin_footer(); ?>
|