-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_category.php
executable file
·72 lines (54 loc) · 1.95 KB
/
admin_category.php
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
<?php
session_start();
require_once "Cs/Post.php";
require_once "Cs/Database.php";
require_once "Cs/HTML.php";
require_once "Cs/Forms.php";
// OBJECT FACTORY
$base = new Cs_Database;
$ht = new Cs_HTML; // Object for working with HTML tags
$post = new Cs_Post; // What is required to work with posts
$form = new Cs_Forms;
// -- END OF OBJECT FACTORY
$base->conBase(); // Connect to database
$ht->htmlStart();
$ht->htmlHead();
echo "<div class=\"main\">";
echo "<div class=\"content\">";
echo "<div class=\"small_content\">";
$base->userCheck($_SESSION['userid']);
echo "<h1>Manage categories</h1>";
if(isset($_GET['mcid'])) {
$post->modifyCatForm($_GET['mcid']);
}
else {
$form->addFormStart("admin_category.php","post","modify_form");
$form->addInput("text", "acid");
$form->addInput("submit", "Create");
$form->addFormEnd();
}
$post->getCategories();
// Check if category is being removed
(isset($_GET['rcid'])) ? $post->removeCat($_GET['rcid']) : '';
// Check if category is being added
(isset($_POST['acid'])) ? $post->addCat($_POST['acid']) : '';
// Check if category is being modified
(isset($_POST['cat_name'])) ? $post->modifyCat($_POST['cat_id'],$_POST['cat_name']) : '';
echo "</div>";
echo "<div class=\"sidebar2\">";
// Elements in left sidebar - existing ones: search, recent_posts, recent_comments, tag_cloud, twitter, register
$elements2 = array('register','search');
$ht->sidebar($elements2);
echo "</div>";
$ht->cleaner();
echo "</div>";
echo "<div class=\"sidebar\">";
// Elements in right sidebar - existing ones: search, recent_posts, recent_comments, tag_cloud, twitter, register
$elements = array('popular','recent_posts','recent_comments','tag_cloud');
$ht->sidebar($elements);
echo "</div>";
$ht->cleaner();
echo "</div>";
echo "</div>";
$ht->htmlEnd();
?>