header();
$theme->box("Login", "
");
$theme->footer();
}
function logout() {
setcookie("admin");
include "theme.inc";
$theme->header();
?>
You are now logged out!
You have been logged out of the system. Since authentication details are stored by using cookies, logging out is only necessary to prevent those who have access to your computer from abusing your account.
$theme->footer();
}
function backup() {
include "config.inc";
if ($system == 0) {
exec("mysqldump -h $dbhost -u $dbuname -p$dbpass $dbname | mail -s \"[$sitename] MySQL backup\" $notify_email");
exec("mysqldump -h $dbhost -u $dbuname -p$dbpass $dbname > ../$sitename-backup-". date("Ymd", time()).".mysql");
}
else print "Warning: the backup feature is only supported on UNIX systems. Check your configuration file if you are using a UNIX system.
";
}
function main() {
include "config.inc";
include "theme.inc";
$theme->header();
dbconnect();
$result = mysql_query("SELECT qid, subject, timestamp FROM queue order by timestamp");
echo "";
mysql_free_result($result);
?>
Edit global blocks on main page.
Allows you to update the content blocks on the main page.
Edit user accounts.
Add, delete, block, view and update user accounts.
Edit adminstrators accounts.
Backup MySQL tables.
Will mail a backup of the MySQL database to ' echo $notify_email; ?>'.
Webboard manager.
Allows you to delete flamebait post or threads from the webboard.
Poll manager.
Install, delete or update polls.
Referring site manager.
Edit, block or delete sites that participate with the referring site program.
Resource manager. (not implemented yet)
Allows admins to maintain a list of resources, news sites and other interesting start points to start their search for news.
Logout
footer();
}
/*********************************************************/
/* block functions */
/*********************************************************/
function block_overview() {
include "theme.inc";
$theme->header();
dbconnect();
$result = mysql_query("SELECT id, title, content FROM blocks");
if (mysql_num_rows($result) > 0) {
while(list($id, $title, $content) = mysql_fetch_array($result)) {
echo "";
}
}
?>
Title:
Content:
footer();
}
function block_add($title, $content) {
dbconnect();
mysql_query("INSERT INTO blocks VALUES (NULL,'$aid','$title','$content')");
header("Location: admin.php?op=main");
}
function block_update($id, $title, $content) {
dbconnect();
mysql_query("update blocks set title='$title', content='$content' where id=$id");
header("Location: admin.php?op=main");
}
function block_delete($id) {
dbconnect();
mysql_query("DELETE FROM blocks WHERE id = '$id'");
header("Location: admin.php?op=main");
}
/*********************************************************/
/* user account functions */
/*********************************************************/
function user_overview() {
include "theme.inc";
$theme->header();
dbconnect();
$result = mysql_query("SELECT * FROM users");
while ($account = mysql_fetch_object($result)) {
$count++;
print "$count. $account->uname [ uname\">view | edit | block | delete ] ";
}
$theme->footer();
}
/*********************************************************/
/* article functions */
/*********************************************************/
function news_queue_delete($qid) {
dbconnect();
$result = mysql_query("DELETE FROM queue WHERE qid = $qid");
header("Location: admin.php?op=main");
}
function news_display($qid) {
global $user, $subject, $article;
include "config.inc";
include "header.inc";
dbconnect();
if (isset($qid)) $result = mysql_query("SELECT qid, uid, uname, timestamp, subject, abstract, article, category FROM queue WHERE qid = $qid");
else $result = mysql_query("SELECT qid, uid, uname, timestamp, subject, abstract, article, category FROM queue LIMIT 1");
list($qid, $uid, $uname, $timestamp, $subject, $abstract, $article, $category) = mysql_fetch_row($result);
mysql_free_result($result);
$subject = stripslashes($subject);
$abstract = stripslashes($abstract);
$article = stripslashes($article);
$theme->preview("", $uname, $timestamp, $subject, "", $abstract, "", $article);
?>
Author or poster:
">
Subject:
">
Department:
dept.
Example departments:
we-saw-it-coming dept.
don't-get-your-panties-in-a-knot dept.
brain-melt dept.
beats-the-heck-out-of-me dept.
Category:
$categories[$i]\n";
}
?>
Author's abstract:
Will be displayed on the main page!
Editor's comments:
Will be displayed on the main page after the abstract.
Extended article:
Will be displayed on the article's page when following the 'read more'-link.
">
">
footer();
}
function news_preview($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article) {
global $user, $boxstuff, $aid;
include "config.inc";
include "theme.inc";
$theme->header();
$subject = stripslashes($subject);
$agstract = stripslashes($abstract);
$comments = stripslashes($comments);
$article = stripslashes($article);
$theme->preview($aid, $author, time(), $subject, $department, $abstract, $comments, $article);
$theme->footer();
?>
Author or poster:
">
Subject:
">
Department:
"> dept.
Example departments:
we-saw-it-coming dept.
don't-get-your-panties-in-a-knot dept.
brain-melt dept.
beats-the-heck-out-of-me dept.
Category:
$categories[$i]\n";
}
?>
Author's abstract:
Will be displayed on the main page!
Editor's comments:
echo "$comments"; ?>
Will be displayed on the main page after the abstract.
Extended article:
echo "$article"; ?>
Will be displayed on the article's page when following the 'read more'-link.
">
">
footer();
}
function news_post($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article) {
global $aid;
dbconnect();
if ($uid == -1) $author = "";
$subject = stripslashes(FixQuotes($subject));
$abstract = stripslashes(FixQuotes($abstract));
$comments = stripslashes(FixQuotes($comments));
$article = stripslashes(FixQuotes($article));
$result = mysql_query("INSERT INTO stories (sid, aid, subject, time, abstract, comments, article, category, informant, department) VALUES (NULL, '$aid', '$subject', '". time() ."', '$abstract', '$comments', '$article', '$category', '$author', '$department')");
### remove article from queue:
news_queue_delete($qid);
}
function news_edit($sid) {
global $user, $subject, $abstract, $comments, $article;
include "theme.inc";
include "config.inc";
$theme->header();
dbconnect();
$result = mysql_query("SELECT * FROM stories where sid = $sid");
$article = mysql_fetch_object($result);
mysql_free_result($result);
$theme->preview($article->author, $article->informant, $article->time, $article->subject, $article->department, $article->abstract, $article->comments, $article->article);
?>
Author or poster:
aid"; ?>">
Subject:
subject"; ?>">
Department:
department"; ?>"> dept.
Example departments:
we-saw-it-coming dept.
don't-get-your-panties-in-a-knot dept.
brain-melt dept.
beats-the-heck-out-of-me dept.
Category:
category == $categories[$i]) echo "SELECTED";
echo ">$categories[$i]\n";
}
?>
Author's abstract:
abstract"; ?>
Will be displayed on the main page!
Editor's comments:
echo "$article->comments"; ?>
Will be displayed on the main page after the abstract.
Extended article:
echo "$article->article"; ?>
Will be displayed on the article's page when following the 'read more'-link.
">
footer();
}
function news_update($sid, $subject, $category, $department, $abstract, $comments, $article) {
global $aid;
dbconnect();
$subject = stripslashes(FixQuotes($subject));
$department = stripslashes(FixQuotes($department));
$abstract = stripslashes(FixQuotes($abstract));
$comments = stripslashes(FixQuotes($comments));
$article = stripslashes(FixQuotes($article));
mysql_query("UPDATE stories SET subject = '$subject', category = '$category', department = '$department', abstract = '$abstract', comments = '$comments', article = '$article' WHERE sid = $sid");
header("Location: admin.php?op=main");
}
function news_admin_write() {
include "theme.inc";
include "config.inc";
dbconnect();
$theme->header();
?>
Subject:
Department:
dept.
Example departments:
we-saw-it-coming dept.
don't-get-your-panties-in-a-knot dept.
brain-melt dept.
beats-the-heck-out-of-me dept.
Category:
$categories[$i]\n";
}
?>
Introduction of article:
Will be displayed on the main page.
Rest of article:
Will be displayed on the article's page when following the 'read more'-link.
$theme->footer();
}
function news_admin_preview($subject, $category, $department, $abstract, $article) {
global $aid;
include "theme.inc";
include "config.inc";
$subject = stripslashes($subject);
$intro = stripslashes($intro);
$rest = stripslashes($rest);
$theme->header();
$theme->preview("", $aid, $time, $subject, "", $abstract, "", $article);
?>
Subject:
">
Department:
"> dept.
Example departments:
we-saw-it-coming dept.
don't-get-your-panties-in-a-knot dept.
brain-melt dept.
beats-the-heck-out-of-me dept.
Category:
$categories[$i]\n";
}
?>
Introduction of article:
echo "$abstract"; ?>
Will be displayed on the main page.
Rest of article:
echo "$article"; ?>
Will be displayed on the article's page when following the 'read more'-link.
$theme->footer();
}
function news_admin_post($subject, $category, $department, $abstract, $article, $category) {
global $aid;
dbconnect();
$subject = stripslashes(FixQuotes($subject));
$intro = stripslashes(FixQuotes($intro));
$rest = stripslashes(FixQuotes($rest));
$result = mysql_query("INSERT INTO stories VALUES (NULL, '$aid', '$subject', '". time() ."', '$abstract', '', '$article', '$category', '$aid', '$department')");
if (!$result) {
echo mysql_errno(). ": ".mysql_error(). " ";
exit();
}
header("Location: admin.php?op=main");
}
/*********************************************************/
/* admin admining */
/*********************************************************/
function displayadmins() {
$titlebar = "current authors ";
include "header.inc";
dbconnect();
$result = mysql_query("select aid from authors");
echo "";
echo "";
echo "Handle: ";
echo "Name: ";
echo "Email: ";
echo "URL: ";
echo "Password: ";
echo " ";
include "footer.inc";
}
function modifyadmin($chng_aid) {
$titlebar = "update $chng_aid ";
include "header.inc";
dbconnect();
$result = mysql_query("select aid, name, url, email, pwd from authors where aid='$chng_aid'");
list($chng_aid, $chng_name, $chng_url, $chng_email, $chng_pwd) = mysql_fetch_row($result);
echo "";
echo "Name: $chng_name ";
echo "Handle: ";
echo "Email: ";
echo "URL: ";
echo "Password: ";
echo "Retype Password: (for changes only) ";
echo " ";
include "footer.inc";
}
function updateadmin($chng_aid, $chng_name, $chng_email, $chng_url, $chng_pwd, $chng_pwd2) {
if ($chng_pwd2 != "") {
if($chng_pwd != $chng_pwd2) {
$titlebar = "bad pass ";
include "header.inc";
echo "Sorry, the new passwords do not match. Click back and try again";
include "footer.inc";
exit;
}
dbconnect();
$result = mysql_query("update authors set aid='$chng_aid', email='$chng_email', url='$chng_url', pwd='$chng_pwd' where NAME='$chng_name'");
header("Location: admin.php?op=main");
} else {
dbconnect();
$result = mysql_query("update authors set aid='$chng_aid', email='$chng_email', url='$chng_url' where NAME='$chng_name'");
header("Location: admin.php?op=main");
}
}
if ($admin) {
switch($op) {
case "main":
main();
break;
case "blocks":
block_overview();
break;
case "Add new block":
block_add($title, $content);
break;
case "Delete block":
block_delete($id);
break;
case "Update block":
block_update($id, $title, $content);
break;
case "submission":
// fall through
case "View article":
news_display($qid);
break;
case "Preview article":
news_preview($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article);
break;
case "Post article":
news_post($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article);
break;
case "Edit article":
news_edit($sid);
break;
case "Update article":
news_update($sid, $subject, $category, $department, $abstract, $comments, $article);
break;
case "Delete article":
news_queue_delete($qid);
break;
case "news_admin_write":
news_admin_write($sid);
break;
case "Preview admin article":
news_admin_preview($subject, $category, $department, $abstract, $article);
break;
case "Post admin article":
news_admin_post($subject, $category, $department, $abstract, $article);
break;
case "mod_authors":
displayadmins();
break;
case "modifyadmin":
modifyadmin($chng_aid);
break;
case "Update author":
updateadmin($chng_aid, $chng_name, $chng_email, $chng_url, $chng_pwd, $chng_pwd2);
break;
case "Add author":
dbconnect();
$result = mysql_query("INSERT INTO authors VALUES ('$add_aid','$add_name','$add_url','$add_email','$add_pwd')");
if (!$result) {
echo mysql_errno(). ": ".mysql_error(). " "; return;
}
header("Location: $that_url/admin.php?op=main");
break;
case "deladmin":
include "header.inc";
echo "Are you sure you want to delete $del_aid? ";
echo "Yes No ";
include "footer.inc";
break;
case "deladminconf":
dbconnect();
mysql_query("delete from authors where aid='$del_aid'");
header("Location: $that_url/admin.php?op=main");
break;
case "create":
poll_createPoll();
break;
case "createPosted":
poll_createPosted();
break;
case "remove":
poll_removePoll();
break;
case "removePosted":
poll_removePosted();
break;
case "user_overview":
user_overview();
break;
case "backup":
backup();
main();
break;
case "view":
poll_viewPoll();
break;
case "viewPosted":
poll_viewPosted();
break;
case "logout":
logout();
break;
default:
main();
break;
}
} else {
login();
}
?>