From 44a18f3e13077138af782f96cffb39294bca6283 Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Thu, 24 Dec 2009 21:39:09 +0000 Subject: (OC) fixed some display stuff for the debug console git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@398 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- admin/admins/functions.php | 34 ++++++++++++++++++----------- admin/index.php | 4 ++-- admin/news/functions.php | 25 +++++++++++++++++++++- admin/news/index.php | 7 +++++- admin/newsreel/index.php | 1 + admin/pages/functions.php | 53 +++++++++++++++++++++++----------------------- 6 files changed, 81 insertions(+), 43 deletions(-) (limited to 'admin') diff --git a/admin/admins/functions.php b/admin/admins/functions.php index 413c0fe..68b9bc7 100644 --- a/admin/admins/functions.php +++ b/admin/admins/functions.php @@ -69,16 +69,22 @@ if(isset($_POST['processed'])){ $username = addslashes($_POST['username']); - $level = addslashes($_POST['level']); $email = addslashes($_POST['email']); $first = addslashes($_POST['first']); $last = addslashes($_POST['last']); - + + $level = $_POST['level']; $all = $_POST['all']; $squadleader = $_POST['squadleader']; $adjutant = $_POST['adjutant']; $quartermaster = $_POST['quartermaster']; + $level = (int)$level; + $all = (int)$all; + $squadleader = (int)$squadleader; + $adjutant = (int)$adjutant; + $quartermaster = (int)$quartermaster; + $password = GeneratePassword(8); $cryptpassword = crypt(md5($password),'iamnotadirtywhorebitch'); @@ -88,28 +94,32 @@ return; } + $result = $db->Query("SELECT `level` FROM `bayonet_users` WHERE `username` = '$username' OR `email` = '$email'"); + if($db->Rows($result) > 0){ + ReportError("The email and or username you entered is already in use."); + return; + } + + $Name = "Rocky the Marne Dog"; $subject = "3rd ID Admin Password"; $header = "From: ". $Name . " < DO NOT RESPOND >\r\n"; //optional headerfields $mail_body = "Do not respond to this email.\n\n------------------------------\nUsername: ".$username."\nPassword: ".$password."\n------------------------------\n\nTo login click on this link. http://testbed.3rd-infantry-division.org/cms/admin/ \n\nIt is recommended that you change your password once you login. To do so, click on Account Settings>Change Password."; - //$sent = mail($email, $subject, $mail_body, $header); + $sent = mail($email, $subject, $mail_body, $header); if(!$sent){ ReportError("Error validating email. This user was not saved."); - //return; - } + return; + } - // $db->Query("INSERT INTO `bayonet_users` (`user_id` ,`username` ,`password` ,`lastname` ,`firstname` ,`email` ,`joined` ,`level` ,`all` ,`squadleader` ,`adjutant` ,`quartermaster`) VALUES (NULL, '$username', '$cryptpassword', '$last', '$first', '$email', '', $level, $all, $squadleader, $adjutant, $quartermaster)"); - - $db->Query("INSERT INTO `bayonet_users` SET `username` = '$username'"); - - + $db->Query("INSERT INTO `bayonet_users` (`user_id` ,`username` ,`password` ,`lastname` ,`firstname` ,`email` ,`joined` ,`level` ,`all` ,`squadleader` ,`adjutant` ,`quartermaster`) VALUES (NULL, '$username', '$cryptpassword', '$last', '$first', '$email', CURRENT_TIMESTAMP, $level, $all, $squadleader, $adjutant, $quartermaster)"); + echo "Admin, '$username' level '$level' has been added. An email has been sent to him with his username and password.\n

Please wait while you are redirected.

Click here if you don't feel like waiting."; // 3 second redirect to go back to the edit page - //PageRedirect(2, "?op=admins"); + PageRedirect(2, "?op=admins"); return; } ?> @@ -300,7 +310,7 @@ if(isset($_POST['cancel'])) { echo "User cancelled deletion of admin: '{$admin['username']}'"; - PageRedirect(3,"?op=admins"); + PageRedirect(1,"?op=admins"); return; } ?> diff --git a/admin/index.php b/admin/index.php index feed2ca..fea8112 100644 --- a/admin/index.php +++ b/admin/index.php @@ -57,8 +57,8 @@ include 'header.php'; ?>
-
- +
+ diff --git a/admin/news/functions.php b/admin/news/functions.php index f98c4e2..1f9e34a 100644 --- a/admin/news/functions.php +++ b/admin/news/functions.php @@ -16,6 +16,29 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +date_default_timezone_set("America/New_York"); +function ListNews(){ + + global $db; + + $result = $db->Query("SELECT n.news_id, n.title, n.message, n.date, n.category_id, u.username AS author, c.name AS catname, c.image AS catimage ". + "FROM `bayonet_news` AS n ". + "INNER JOIN `bayonet_news_categories` AS c ON c.category_id = n.category_id ". + "LEFT OUTER JOIN `mybb_users` AS u ON u.uid = n.author_id ORDER BY `date` DESC"); + while($row = $db->Fetch($result)){ + + $newsBody = $row['message']; + echo ""; + echo "{$row['title']} | {$row['catname']}  
"; + if(($len = strlen($newsBody))>150) + echo substr($newsBody, 0, 150)."..."; + else + echo $newsBody; + echo '
'; + echo "Posted By: {$row['author']} on ".date('D M j, Y g:i a T', strtotime($row['date'])); + echo '

'; + } +} function EditNews($news_id){ @@ -31,7 +54,7 @@ function EditNews($news_id){ $row = $db->Fetch($result); ?> -

Edit Event

+

Edit News

bayonet online web admin
diff --git a/admin/news/index.php b/admin/news/index.php index 43baf81..ec78089 100644 --- a/admin/news/index.php +++ b/admin/news/index.php @@ -19,7 +19,8 @@ ?>

- Manage News

- -Everything needs to be completed. + -Add/Edit(-)/Delete news + -Add/Edit/Delete categories diff --git a/admin/newsreel/index.php b/admin/newsreel/index.php index 35bed28..0b97deb 100644 --- a/admin/newsreel/index.php +++ b/admin/newsreel/index.php @@ -25,6 +25,7 @@ if(!defined("ADMIN_FILE")) include $basedir.'newsreel/functions.php'; ?>

- Manage News Reel

+ -Add/Edit/Delete needs to be completed.
Author
diff --git a/admin/pages/functions.php b/admin/pages/functions.php index 3f8f59f..c4d4369 100644 --- a/admin/pages/functions.php +++ b/admin/pages/functions.php @@ -111,6 +111,11 @@ function NewArticle($page_id) Query("SELECT title FROM bayonet_articles WHERE article_id = '$article_id'"); + $result = $db->Query("SELECT `title` FROM `bayonet_articles` WHERE `article_id` = '$article_id'"); $article = $db->Fetch($result); if(isset($_POST['proceed'])) { echo "Article '{$article['title']}', was deleted."; $db->Query("DELETE FROM bayonet_articles WHERE article_id = '$article_id' LIMIT 1"); - PageRedirect(2, "?op=pages"); + PageRedirect(2, "?op=pages&edit={$_GET['edit']}"); return; } if(isset($_POST['cancel'])) @@ -219,48 +224,42 @@ function ListPages($pid = NULL) foreach($pages as $page) { - if($pid == $page['page_id']) + $edit = false; + if($pid == $page['page_id']){ + $edit = true; echo ''; - else + }else echo ''; ?> - - - - - + - - + + + "; } -- cgit
- + + + +
+  View this Page','../index.php?load=page&id='.$pid.'" target=\"blank'); ?>
+ +  Edit this Page','?op=pages&edit=true&pid='.$pid); ?> +
 Delete this Page','?op=pages&delete='.$pid); ?>