Newer
Older
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
<?php
//include our admin functions
include("../lib/blog/admin.lib.php");
$admin = new admin();
//make our command list from the path
$request=$pathlist;
array_shift($request);
array_shift($request);
array_shift($request);
$smarty->assign("title", "Blog Admin");
if ($session->loggedin) $admin->menu(); else {
header("Location: {$admin->httpPath}");
exit;
}
ob_start();
//alter the debuging state on request
if ($request[0] == "debug") {
$_SESSION[debug] = $request[1];
}
//if logged in
if($session->loggedin && blogger($session->username)) {
//call appropriate functions..
switch (array_shift($request)) {
case "newentry":
$admin->printEntryForm() ;
$smarty->assign("subselect", _("Write new entry"));
if ($admin->blog->editor) $smarty->assign("action", "edit");
break;
case "Settings":
if ($_REQUEST['submit'] == "Save Settings") {
$admin->updateSettings();
} else {
$admin->printSettingsForm() ;
}
$smarty->assign("subselect", _("Settings"));
break;
case "postentry":
$admin->postEntry() ;
break;
case "postupdate":
$admin->updateEntry(array_shift($request)) ;
break;
case "update":
$admin->updateForm(array_shift($request)) ;
$smarty->assign("subselect", _("Edit entries"));
if ($admin->blog->editor) $smarty->assign("action", "edit");
break;
case "showentries":
$admin->printEntries() ;
$smarty->assign("subselect", _("Edit entries"));
break;
case "deleteentry":
$admin->deleteEntry(array_shift($request)) ;
break;
case "confirmdeleteentries":
$admin->confirmDeleteEntries();
break;
case "deleteentries":
$admin->deleteEntries();
break;
case "moderatecomments":
$admin->printComments();
$admin->printAuthorisedUsers();
$comments=_("Comments");
$result = $BlogDB->GetOne("SELECT count(comments.id) from comments join entries on comments.post = entries.id where moderated = false and entries.user_id = ".$admin->id.";");
if($result){
$comments .= " (".$result[0].")";
}
$smarty->assign("subselect", $comments);
break;
case "updatecomments":
$admin->updateComments();
break;
case "deletecomments":
$admin->deleteComments(array_shift($request));
break;
case "updateauthusers":
$admin->updateAuthorisedUsers();
break;
default:
$admin->mainPage();
}
}
else {
//run appropriate functions
switch (array_shift($request)) {
case "signup":
$admin->addUserForm();
$smarty->assign("subselect", _("Start a Blog"));
break;
case "adduser":
$admin->addUser();
break;
//or offer login box
default:
$admin->addUserForm();
$smarty->assign("subselect", _("Start a Blog"));
break;
}
}
?>
<div id="bottompanel">
<p><? echo _("Validate"); ?> : <a href="http://validator.w3.org/check?uri=referer">XHTML</a> / <a href="http://jigsaw.w3.org/css-validator/check/referer/">CSS</a></p>
</div>
<?php
$page = ob_get_contents();
ob_end_clean();
$smarty->assign("body", $page);
$smarty->assign("extra_styles", "/css/blog.css");
//if we are in debug mode display a bunch of stuff
if($_SESSION[debug]){
echo "<div class=\"debug\"><h2>"._("Debug Info")."</h2><pre>\n";
echo "**"._("Session")."**\n";
print_r($_SESSION);
echo "**"._("Request")."**\n";
print_r($_REQUEST);
echo "**"._("Class")."**\n";
print_r($admin);
echo "</pre></div>";
}
?>