aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin/admins/functions.php69
-rw-r--r--admin/calendar/index.php1
-rw-r--r--admin/news/functions.php2
-rw-r--r--admin/news/index.php6
-rw-r--r--blocks/mini_calendar/functions.php5
-rw-r--r--footer.php2
-rw-r--r--includes/debug.php42
-rw-r--r--includes/sql.class.php5
-rw-r--r--index.php2
9 files changed, 106 insertions, 28 deletions
diff --git a/admin/admins/functions.php b/admin/admins/functions.php
index c44d05a..413c0fe 100644
--- a/admin/admins/functions.php
+++ b/admin/admins/functions.php
@@ -62,12 +62,55 @@
function NewAdmin()
{
+
+ global $db;
$maxLevel = $_SESSION['level'];
if(isset($_POST['processed'])){
- echo GeneratePassword(8);
- return;
+ $username = addslashes($_POST['username']);
+ $level = addslashes($_POST['level']);
+ $email = addslashes($_POST['email']);
+ $first = addslashes($_POST['first']);
+ $last = addslashes($_POST['last']);
+
+ $all = $_POST['all'];
+ $squadleader = $_POST['squadleader'];
+ $adjutant = $_POST['adjutant'];
+ $quartermaster = $_POST['quartermaster'];
+
+ $password = GeneratePassword(8);
+ $cryptpassword = crypt(md5($password),'iamnotadirtywhorebitch');
+
+ if(empty($username))
+ {
+ ReportError("This user must have a username to continue.");
+ 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);
+ if(!$sent){
+ ReportError("Error validating email. This user was not saved.");
+ //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'");
+
+
+ echo "Admin, '$username' level '$level' has been added. An email has been sent to him with his username and password.\n <br /><br />
+ Please wait while you are redirected. <br /><br />
+ <a href=\"?op=admins\">Click here if you don't feel like waiting.</a>";
+
+ // 3 second redirect to go back to the edit page
+ //PageRedirect(2, "?op=admins");
+ return;
}
?>
<div style="text-align:right"><img src="images/cancel.png" />Cancel</div>
@@ -103,14 +146,14 @@
<?php
}
- function GetPermissions($user)
+ function GetPermissions($user = NULL)
{
?>
<div class="slidepanel">
<table width="100%" style="text-align:center;">
- <tr><th>Everything else</th><th>Adjutant</th><th>Quartermaster</th></tr>
+ <tr><th>Everything else</th><th>Squad Leader</th><th>Adjutant</th><th>Quartermaster</th></tr>
<tr>
- <td>
+ <td width="25%">
<input type="hidden" name="all" value="0" />
<?php
if(isset($user['all']) && $user['all'] == 1)
@@ -119,7 +162,16 @@
echo "<input type=\"checkbox\" name=\"all\" value=\"1\" />";
?>
</td>
- <td>
+ <td width="25%">
+ <input type="hidden" name="squadleader" value="0" />
+ <?php
+ if(isset($user['squadleader']) && $user['squadleader'] == 1)
+ echo "<input type=\"checkbox\" name=\"squadleader\" value=\"1\" checked/>";
+ else
+ echo "<input type=\"checkbox\" name=\"squadleader\" value=\"1\" />";
+ ?>
+ </td>
+ <td width="25%">
<input type="hidden" name="adjutant" value="0" />
<?php
if(isset($user['adjutant']) && $user['adjutant'] == 1)
@@ -128,7 +180,7 @@
echo "<input type=\"checkbox\" name=\"adjutant\" value=\"1\" />";
?>
</td>
- <td>
+ <td width="25%">
<input type="hidden" name="quartermaster" value="0" />
<?php
if(isset($user['quartermaster']) && $user['quartermaster'] == 1)
@@ -167,6 +219,7 @@
$level = addslashes($_POST['level']);
$all = $_POST['all'];
+ $squadleader = $_POST['squadleader'];
$adjutant = $_POST['adjutant'];
$quartermaster = $_POST['quartermaster'];
@@ -176,7 +229,7 @@
return;
}
- $db->Query("UPDATE `bayonet_users` SET `username` = '$username', `level` = '$level', `all` = '$all', `adjutant` = '$adjutant', `quartermaster` = '$quartermaster' WHERE `user_id` = '$user_id' LIMIT 1");
+ $db->Query("UPDATE `bayonet_users` SET `username` = '$username', `level` = '$level', `all` = '$all', `squadleader` = '$squadleader', `adjutant` = '$adjutant', `quartermaster` = '$quartermaster' WHERE `user_id` = '$user_id' LIMIT 1");
echo "Admin, '$username' level '$level' has been edited.\n <br /><br />
Please wait while you are redirected. <br /><br />
diff --git a/admin/calendar/index.php b/admin/calendar/index.php
index a61424f..1197990 100644
--- a/admin/calendar/index.php
+++ b/admin/calendar/index.php
@@ -19,7 +19,6 @@
?>
<div style="text-align:left;"><h2>- Manage Calendar & Events</h2></div>
- -Edit events needs to be completed.
<?php
if(!defined("ADMIN_FILE"))
diff --git a/admin/news/functions.php b/admin/news/functions.php
index a098e46..f98c4e2 100644
--- a/admin/news/functions.php
+++ b/admin/news/functions.php
@@ -94,7 +94,7 @@ function EditNews($news_id){
global $db;
echo "<select name=\"author\">";
- $result = $db->Query("SELECT `user_id`, `lastname` FROM `bayonet_users` WHERE `active` = 1 ORDER BY `username` ASC");
+ $result = $db->Query("SELECT `user_id`, `lastname` FROM `bayonet_users` ORDER BY `username` ASC");
while(($row = $db->Fetch($result))!= false){
if($author_id == $row['user_id'])
echo "<option value=\"{$row['user_id']}\" selected>{$row['lastname']}</option>";
diff --git a/admin/news/index.php b/admin/news/index.php
index 2b7dca1..43baf81 100644
--- a/admin/news/index.php
+++ b/admin/news/index.php
@@ -16,7 +16,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+ ?>
+ <div style="text-align:left;"><h2>- Manage News</h2></div>
+ -Everything needs to be completed.
+<?php
+
if(!defined("ADMIN_FILE"))
{
die("Access denied.");
@@ -30,7 +35,6 @@ echo "<table class=\"panel\" width=\"100%\">
if(isset($_GET['edit'])){
$news_id = $_GET['edit'];
EditNews($news_id);
- return;
}
diff --git a/blocks/mini_calendar/functions.php b/blocks/mini_calendar/functions.php
index 3291e6b..0dee840 100644
--- a/blocks/mini_calendar/functions.php
+++ b/blocks/mini_calendar/functions.php
@@ -252,7 +252,7 @@
$isEvent=false;
global $db;
- $result = $db->Query("SELECT title,color FROM `bayonet_events` WHERE `date` = '$sqlDate' ORDER BY `date` DESC");
+ $result = $db->Query("SELECT title,color,date,time FROM `bayonet_events` WHERE `date` = '$sqlDate' ORDER BY `date` DESC");
while(($row = $db->Fetch($result))!=false)
{
$isEvent = true;
@@ -301,7 +301,8 @@
if(count($todaysEvents)>0){
echo "<h3>Today's Events</h3>";
foreach($todaysEvents as $event){
- echo "<span style=\"background-color: {$event['color']}\">&nbsp;&nbsp;</span>&nbsp;{$event['title']}<br />";
+ $time = date("g:i a", strtotime($event['date']." ".$event['time']));
+ echo "<span style=\"background-color: {$event['color']}\">&nbsp;&nbsp;</span>&nbsp;{$event['title']} @ {$time}<br />";
}
}
}
diff --git a/footer.php b/footer.php
index df7d61a..8437681 100644
--- a/footer.php
+++ b/footer.php
@@ -35,7 +35,7 @@ $debug_output = sprintf("Page generated in %.3f seconds | Memory: real(%.3fmb) p
<a href="admin/">Administrative Control Panel</a><br />
<?php echo $config['product']['name'] . ' ' . $config['product']['version'] . ' ' . $config['product']['release'] ?><br />
<?php echo $config['product']['copyright']; ?><br />
-<?php if($config['debug']) echo $debug_output ?><br />
+<?php if($config['debug']['enabled']) echo $debug_output ?><br />
<a href="http://www.dreamhost.com/r.cgi?145892" target="_blank"><img src="http://www.dreamhost.com/images/rewards/80x15-e.png" /></a><br /><br />
diff --git a/includes/debug.php b/includes/debug.php
index 875ba8d..75e0d0f 100644
--- a/includes/debug.php
+++ b/includes/debug.php
@@ -16,11 +16,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
+global $config;
define("RUDI_DEBUG",true);
define("RUDI_DEBUG_LEVEL",true);
-define('NO_REPEAT','norepeat');
-define('REPEAT','repeat');
+define('NO_REPEAT',false);
+define('REPEAT',true);
static $last_message = NULL;
static $last_message_count = 0;
@@ -28,18 +30,23 @@ static $last_message_count = 0;
static $log_message_last = NULL;
static $log_message_queue = array();
static $log_message_pos = 0;
+
function decho2($message)
{
- global $log_message_last, $log_message_queue, $log_message_pos;
+ global $log_message_last, $log_message_queue, $log_message_pos, $config;
+ date_default_timezone_set($config['logs']['timezone']);
+ $timestamp = date('Y-M-d H:i:s T');
+ $message = "[$timestamp]: $message";
array_push($log_message_queue, $message);
$log_message_pos++;
}
function logQueueFlush()
{
- global $log_message_queue;
+ global $log_message_queue, $config;
$messageCount = 0;
static $log_message_last_count = 0;
+ static $next = false;
echo "<div class=\"contentHeading\">Bayonet Debug Messages</div>";
echo "<div class=\"content\">";
@@ -49,20 +56,29 @@ function logQueueFlush()
{
echo "{$messageCount}: $message<br/>\n";
}
- else
+ elseif($message == $log_message_queue[$messageCount - 1])
{
- if($message == $log_message_queue[$messageCount - 1])
- {
- echo "incrementing</br>\n";
- $log_message_last_count++;
- }
- else
+ $log_message_last_count++;
+ if($config['debug']['repeat_messages'] == false)
{
- echo "Previous message received $log_message_last_count times<br/>\n";
- $log_message_last_count = 0;
+ echo "{$messageCount}: $message<br/>\n";
+ if($config['debug']['repeat_messages'] == true)
+ {
+ if($log_message_queue[$messageCount + 1] != $message)
+ {
+ $next = true;
+ }
+ }
}
}
+ if($next == true)
+ {
+ echo "$messageCount: <b>Last message recieved $log_message_last_count times</b><br/>\n";
+ $log_message_last_count = 0;
+ $next = false;
+ }
+
$messageCount++;
}
echo "</div>";
diff --git a/includes/sql.class.php b/includes/sql.class.php
index 141a7ae..57fdd5d 100644
--- a/includes/sql.class.php
+++ b/includes/sql.class.php
@@ -42,6 +42,11 @@ class Bayonet_SQL
//return mysql_close($link);
}
+ public function Stat()
+ {
+ return mysql_stat();
+ }
+
public function Select_db($db)
{
decho("Selecting database ('$db')");
diff --git a/index.php b/index.php
index 3687f0d..4f6d84b 100644
--- a/index.php
+++ b/index.php
@@ -11,8 +11,8 @@
/* Begin try/catch block */
try {
-include './includes/debug.php';
include './includes/config.php';
+include './includes/debug.php';
include './includes/sql.class.php';
include './includes/functions.php';