aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-21 00:40:20 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-21 00:40:20 -0500
commit4565a86946464f124110db11e3ba7331018d8664 (patch)
tree7ee6d097eed26a56fb872b4d3175ee37acc155a0
parent716e58df8d4c4889bfaf574e231c0cc14479454f (diff)
downloadbayonetcms-4565a86946464f124110db11e3ba7331018d8664.tar.gz
added working login script and announcment block
git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@386 c5b2fb0a-d05d-0410-98c8-828840a80ff6
-rw-r--r--admin/admins/functions.php4
-rw-r--r--admin/admins/index.php35
-rw-r--r--admin/blocks/functions.php1
-rw-r--r--admin/index.php1
-rw-r--r--admin/modules/functions.php178
-rw-r--r--admin/modules/index.php59
-rw-r--r--blocks/soldier_info/index.php48
-rw-r--r--modules/tsviewer/index.php15
8 files changed, 311 insertions, 30 deletions
diff --git a/admin/admins/functions.php b/admin/admins/functions.php
index 495dfdd..0cc6513 100644
--- a/admin/admins/functions.php
+++ b/admin/admins/functions.php
@@ -40,6 +40,10 @@
function NewAdmin()
{
$maxLevel = $_SESSION['level'];
+
+ if(isset($_POST['processed'])){
+
+ }
?>
<div style="text-align:right"><img src="images/cancel.png" />Cancel</div>
<center>
diff --git a/admin/admins/index.php b/admin/admins/index.php
index b000111..1223d3a 100644
--- a/admin/admins/index.php
+++ b/admin/admins/index.php
@@ -25,29 +25,30 @@ if(!defined("ADMIN_FILE"))
}
include $basedir.'admins/functions.php';
+?>
-if(isset($_GET['edit']))
-{
+<table class="panel" width="100%" cellspacing="0">
+ <tr>
+ <td class="panel-none">
+ <table align="center" width="200px">
+ <tr><th><?php echo LinkInternal('<img src="images/add.png" />Add New Admin','?op=admins&create=true'); ?></th></tr>
+ </table>
+ <?php ListAdmins(); ?>
+ </td>
+ <td class="panel-box">
+<?php
+if(isset($_GET['edit'])){
$user_id = $_GET['edit'];
EditAdmin($user_id);
- return;
}
-
-if(isset($_GET['delete']))
-{
+else if(isset($_GET['delete'])){
$user_id = $_GET['delete'];
DeleteAdmin($user_id);
- return;
}
-
-if(isset($_GET['create']))
-{
+else if(isset($_GET['create'])){
NewAdmin();
- return;
}
-
-echo "<table align=\"center\" width=\"200px\"><tr><th>".LinkInternal('<img src="images/add.png" />Add New Admin','?op=admins&create=true')."</th></tr></table>";
-
-ListAdmins();
-
-?> \ No newline at end of file
+?>
+ </td>
+ </tr>
+</table>
diff --git a/admin/blocks/functions.php b/admin/blocks/functions.php
index 2ef951c..ad7daa0 100644
--- a/admin/blocks/functions.php
+++ b/admin/blocks/functions.php
@@ -102,6 +102,7 @@ function EditBlock($block_id)
$dir_name = addslashes($_POST['dir_name']);
$position = (int) addslashes($_POST['position']);
$active = addslashes($_POST['active']);
+ $title = addslashes($_POST['title']);
if(!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position))
{
diff --git a/admin/index.php b/admin/index.php
index 06f68d9..feed2ca 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -93,6 +93,7 @@ include 'header.php';
$th = array('Module Administration','');
$td = array(
LinkInternal('<img src="images/editpage.png" /><br />Pages','?op=pages'),
+ LinkInternal('<img src="images/image.png" /><br />News Reel','?op=newsreel'),
LinkInternal('<img src="images/news.png" /><br />News','?op=news'),
LinkInternal('<img src="images/calendar.png" /><br />Calendar','?op=calendar'),
LinkInternal('<img src="images/box_download.png" /><br />Downloads', '?op=downloads'),
diff --git a/admin/modules/functions.php b/admin/modules/functions.php
index e69de29..619efc7 100644
--- a/admin/modules/functions.php
+++ b/admin/modules/functions.php
@@ -0,0 +1,178 @@
+<?php
+/**
+ * Bayonet Content Management System
+ * Copyright (C) 2008 Joseph Hunkeler
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+function ListModules()
+{
+ global $db;
+ $result = $db->Query("SELECT * FROM `bayonet_blocks` ORDER BY `active` DESC, `weight` ASC, `position`");
+ while(($rows = $db->fetch($result))!=false)
+ {
+ $blocks[] = $rows;
+ }
+
+ echo "<table align=\"center\"><tr><th colspan=\"3\">Existing Blocks</th></tr>";
+ foreach($blocks as $block)
+ {
+ echo "<tr><td>{$block['weight']} : {$block['dir_name']}</td><td><a href=\"?load=admin&op=blocks&edit={$block['block_id']}\">Edit</a></td><td><a href=\"?load=admin&op=blocks&delete={$block['block_id']}\">Delete</a></td></tr>";
+ }
+ echo "</table>";
+}
+
+function NewModule()
+{
+ global $db;
+ if(isset($_POST['processed']))
+ {
+ //Secure our data to prevent injection attacks.
+ $weight = addslashes($_POST['weight']);
+ $dir_name = addslashes($_POST['dir_name']);
+ $position = addslashes($_POST['position']);
+ $active = addslashes($_POST['active']);
+ $title = addslashes($_POST['title']);
+
+ if(!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position))
+ {
+ echo "You must fill everything out before proceeding.";
+ return;
+ }
+ //Update the database with the new data.
+ $db->Query("INSERT INTO `bayonet_blocks` SET `weight` = '$weight', `dir_name` = '$dir_name', `title` = '$title', `position` = '$position', `active` = '$active'");
+ //die, because we have completed what we wanted to do.
+ echo "New block, '$dir_name', at position '$weight' added.\n";
+ return;
+ }
+
+ ?>
+ <form action="<?php $_SERVER['PHP_SELF']?>" method="post">
+ <table align="center">
+ <tr><th>Title</th><td><input type="text" name="title" value="<?php echo $block['title'] ?>"></td></tr>
+ <tr><th>Weight</th><td><input type="text" name="weight" value="<?php echo $block['weight'] ?>"></td></tr>
+ <tr><th>Position</th><td><input type="text" name="position" value="<?php echo $block['position'] ?>"></td></tr>
+ <tr><th>Directory Name</th><td><input type="text" name="dir_name" value="<?php echo $block['dir_name'] ?>"></td>
+ <tr><th>Active</th><td>
+ <select name="active">
+ <option value="1">Yes</option>
+ <option value="0">No</option>
+ </select></td>
+ <tr><th colspan="2"><input type="submit" name="processed" value="Submit"></th></tr>
+ </table>
+ </form>
+ <?php
+}
+
+function GetActive($module_id, &$active)
+{
+ $options = array(1 => 'Yes',0 => 'No');
+ foreach($options as $option => $value)
+ {
+ $selected = NULL;
+ if($active == $option)
+ {
+ $selected = "selected";
+ }
+ echo "<option " . $selected . " value=\"". $option ."\">" . $value . "</option>\n";
+ }
+
+
+}
+
+function EditModule($module_id)
+{
+ global $db;
+ if(isset($_POST['processed']))
+ {
+ //Secure our data to prevent injection attacks.
+ $weight = (int) addslashes($_POST['weight']);
+ $dir_name = addslashes($_POST['dir_name']);
+ $position = (int) addslashes($_POST['position']);
+ $active = addslashes($_POST['active']);
+ $title = addslashes($_POST['title']);
+
+ if(!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position))
+ {
+ echo "You must fill everything out before proceeding.";
+ return;
+ }
+
+ //Update the database with the new data.
+ $db->Query("UPDATE bayonet_blocks SET weight = '$weight', dir_name = '$dir_name', position = '$position', active = '$active' WHERE block_id = '$block_id'");
+ //$isActive = $active ? "IS" : "IS NOT";
+ echo "Block, '$dir_name', at position '$weight' has been edited.\n";
+ PageRedirect(3, "?op=blocks");
+ //die, because we have completed what we wanted to do.
+ return;
+ }
+
+ //Grab the page from the database according to the $page_id passed to the function.
+ $result = $db->Query("SELECT weight,dir_name,position,active,title FROM bayonet_blocks WHERE block_id = '$block_id'");
+ while(($row = $db->Fetch($result))!=false)
+ {
+ //We only want one row, so we don't have to $block[]... No foreach necessary.
+ $block = $row;
+ }
+
+ ?>
+ <form action="<?php $_SERVER['PHP_SELF']?>" method="post">
+ <table align="center">
+ <tr><th>Title</th><td><input type="text" name="title" value="<?php echo $block['title'] ?>" /></td></tr>
+ <tr><th>Weight</th><td><input type="text" name="weight" value="<?php echo $block['weight'] ?>" /></td></tr>
+ <tr><th>Position</th><td><input type="text" name="position" value="<?php echo $block['position'] ?>" /></td></tr>
+ <tr><th>Directory Name</th><td><input type="text" name="dir_name" value="<?php echo $block['dir_name'] ?>" /></td>
+ <tr><th>Active</th><td>
+ <select name="active">
+ <?php GetActive($block_id, $block['active']) ?>
+ </select>
+ </td>
+
+ <tr><th colspan="2"><input type="submit" name="processed" value="Submit"></th></tr>
+ </table>
+ </form>
+ <?php
+}
+
+function DeleteModule($module_id)
+{
+ global $db;
+
+ $result = $db->Query("SELECT dir_name FROM bayonet_blocks WHERE block_id = '$block_id'");
+ $block = $db->Fetch($result);
+
+ if(isset($_POST['proceed']))
+ {
+ echo "Block '{$block['dir_name']}', was deleted.";
+ $db->Query("DELETE FROM bayonet_blocks WHERE block_id = '$block_id' LIMIT 1");
+ return;
+ }
+ if(isset($_POST['cancel']))
+ {
+ echo "User cancelled deletion of page: '{$block['dir_name']}'";
+ return;
+ }
+
+ ?>
+ <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
+ <table align="center">
+ <th>Are you SURE you want to delete the block titled: '<?php echo $block['dir_name']?>'?</th>
+ <tr><th><button name="proceed">Yes</button>&nbsp;&nbsp;&nbsp;<button name="cancel">No</button></th></tr>
+ </table>
+ </form>
+ <?php
+}
+
+?> \ No newline at end of file
diff --git a/admin/modules/index.php b/admin/modules/index.php
index e69de29..94e2814 100644
--- a/admin/modules/index.php
+++ b/admin/modules/index.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Bayonet Content Management System
+ * Copyright (C) 2008 Joseph Hunkeler
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * This file administers the site modules.
+ *
+ * -weight
+ * -directory name
+ */
+
+if(!defined("ADMIN_FILE"))
+{
+ die("Access denied.");
+}
+
+echo "Do a database for the index modules, thats all this really is anyway.<br />";
+include $basedir.'modules/functions.php';
+
+if(isset($_GET['edit']))
+{
+ $module_id = $_GET['edit'];
+ EditModule($module_id);
+ return;
+}
+
+if(isset($_GET['delete']))
+{
+ $module_id = $_GET['delete'];
+ DeleteModule($module_id);
+ return;
+}
+
+if(isset($_GET['create']))
+{
+ NewModule();
+ return;
+}
+
+//echo "<table align=\"center\" width=\"200px\"><tr><th>".LinkInternal('Create a Module','?load=admin&op=modules&create=true')."</th></tr></table>";
+
+//ListModules();
+
+?> \ No newline at end of file
diff --git a/blocks/soldier_info/index.php b/blocks/soldier_info/index.php
index f40f528..4db230d 100644
--- a/blocks/soldier_info/index.php
+++ b/blocks/soldier_info/index.php
@@ -1,10 +1,44 @@
+<?php
+if($_COOKIE['mybbuser'] != '')
+{
+ global $db;
+ $logged_in = 'true';
+
+ $username = stripslashes($_COOKIE['mybbuser']);
+ $login_cookie = explode('_', $username);
+ $result = $db->Query("SELECT `uid`, `username`, `unreadpms`, `totalpms`, `postnum`, `usergroup`, `additionalgroups` FROM `mybb_users` WHERE `uid` = '".$login_cookie['0']."' AND `loginkey` = '".$login_cookie['1']."'");
+ $check_num = $db->Rows($result);
+ if ($check_num != '1')
+ {
+ $past = time() - 100;
+ $logged_in = '';
+ setcookie('mybbuser', gone, $past);
+ header("location: index.php");
+ }
+ while(($row = $db->Fetch($result))!==false)
+ {
+ $logged_uid = $row['uid'];
+ $logged_username = $row['username'];
+ $avatar_type = $row['avatartype'];
+ $pm_unread = $row['unreadpms'];
+ $pm_total = $row['totalpms'];
+ $postnum = $row['postnum'];
+
+ $main_usergroup = $row['usergroup'];
+ $add_usergroup = $row['additionalgroups'];
+
+ $add_usergroups= explode(',', $add_usergroup);
+ }
+}
+?>
<center>
Your IP: <?php echo $_SERVER['REMOTE_ADDR']; ?><br />
<?php
if ($logged_in == 'true'){
- echo '<img src="'.$avatar.'" alt="'.$logged_username.'"/><br /><br />'.$postnum.' post(s)<br /><br />
- </center>
+ //echo '<img src="'.$avatar.'" alt="'.$logged_username.'"/><br /><br />
+ echo $postnum.' post(s)<br /><br />';
+ echo '</center>
Welcome, '.$logged_username.' <br />
@@ -16,10 +50,12 @@
<br />';
}
if ($logged_in == 'true'){
- echo'<hr />
- <img src="images/email-y.gif" />Private Messages <br />
- <img src="images/email-r.gif" />Unread: <a href="forums/private.php">'.$pm_unread.'</a><br />
- <img src="images/email-g.gif" />Total: <a href="forums/private.php">'.$pm_total.'</a><br /><hr />';
+ ?>
+ <hr />
+ <!-- <img src="images/email-y.gif" /> -->Private Messages <br />
+ <!-- <img src="images/email-r.gif" /> -->Unread: <a href="forums/private.php"><?php echo $pm_unread; ?></a><br />
+ <!-- <img src="images/email-g.gif" /> -->Total: <a href="forums/private.php"><?php echo $pm_total; ?></a><br /><hr />
+ <?php
}
?>
</center> \ No newline at end of file
diff --git a/modules/tsviewer/index.php b/modules/tsviewer/index.php
index 18ee7c5..afbc83f 100644
--- a/modules/tsviewer/index.php
+++ b/modules/tsviewer/index.php
@@ -24,19 +24,20 @@ if(!defined("MODULE_FILE"))
}
OpenTable();
-echo "<tr><th>How to Connect</th></tr><tr><td style=\"text-align:center;\"><p>IP: 64.214.185.50:9004</p><p>Password: Garand</p></td></tr>";
+echo "<div class=\"contentHeader\">How to Connect</div><div class=\"content\"><p>IP: 64.214.185.50:9004</p><p>Password: Garand</p></div>";
CloseTable();
OpenTable();
-echo "<tr><th>Teamspeak Server</th></tr><tr><td>";
+echo "<div class=\"contentHeader\">Teamspeak Server</div>";
/*echo "<div style=\"vertical-align:middle; margin-left:40%; margin-right:auto;\">\n";*/
-echo "<div style=\"width: 30%; margin-left: auto; margin-right: auto;\">\n";
-?>
-<script language="javascript" type="text/javascript" src="http://www.tsviewer.com/ts_viewer_pur.php?ID=58659&bg=transparent&type=eee&type_size=11&type_family=1&info=1&channels=1&users=1&js=1&type_s_weight=normal&type_s_style=normal&type_s_variant=normal&type_s_decoration=none&type_s_weight_h=normal&type_s_style_h=normal&type_s_variant_h=normal&type_s_decoration_h=none&type_i_weight=normal&type_i_style=normal&type_i_variant=normal&type_i_decoration=none&type_i_weight_h=normal&type_i_style_h=normal&type_i_variant_h=normal&type_i_decoration_h=none&type_c_weight=normal&type_c_style=normal&type_c_variant=normal&type_c_decoration=none&type_c_weight_h=normal&type_c_style_h=normal&type_c_variant_h=normal&type_c_decoration_h=none&type_u_weight=normal&type_u_style=normal&type_u_variant=normal&type_u_decoration=none&type_u_weight_h=normal&type_u_style_h=normal&type_u_variant_h=normal&type_u_decoration_h=none"></script><NOSCRIPT>Enable JavaScript to see TeamSpeak Viewer or click <a href="http://www.tsviewer.com/index.php?page=ts_viewer&ID=58659">here</a>.</NOSCRIPT>
-<?php
+//echo "<div style=\"width: 30%; margin-left: auto; margin-right: auto;\">\n";
+echo "<div style=\"display:block; margin-left:40%;margin-right:auto;\">";
+
+$ts = implode('',file("http://www.tsviewer.com/ts_viewer_pur.php?ID=902437&bg=&type=8f8f8f&type_size=11&type_family=5&info=1&channels=1&users=1&type_s_color=000000&type_s_weight=bold&type_s_style=normal&type_s_variant=normal&type_s_decoration=none&type_s_color_h=525284&type_s_weight_h=bold&type_s_style_h=normal&type_s_variant_h=normal&type_s_decoration_h=underline&type_i_color=000000&type_i_weight=normal&type_i_style=normal&type_i_variant=normal&type_i_decoration=none&type_i_color_h=525284&type_i_weight_h=normal&type_i_style_h=normal&type_i_variant_h=normal&type_i_decoration_h=underline&type_c_color=000000&type_c_weight=normal&type_c_style=normal&type_c_variant=normal&type_c_decoration=none&type_c_color_h=525284&type_c_weight_h=normal&type_c_style_h=normal&type_c_variant_h=normal&type_c_decoration_h=underline&type_u_color=000000&type_u_weight=normal&type_u_style=normal&type_u_variant=normal&type_u_decoration=none&type_u_color_h=525284&type_u_weight_h=normal&type_u_style_h=normal&type_u_variant_h=normal&type_u_decoration_h=none"));
+echo $ts;
+
echo "</div>\n";
-echo "</td></tr>";
CloseTable();