aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin/images/bayonet_logo.jpgbin36192 -> 38851 bytes
-rw-r--r--admin/rudi/index.php1
-rw-r--r--admin/rudi/views/view.awards.edit.php15
-rw-r--r--admin/rudi/views/view.awards.php6
-rw-r--r--admin/rudi/views/view.members.php4
-rw-r--r--admin/rudi/views/view.members.profile.php2
-rw-r--r--admin/rudi/views/view.units.php22
-rw-r--r--include/classes.php347
-rw-r--r--include/debug.php4
-rw-r--r--include/functions.php54
-rw-r--r--index.php108
-rw-r--r--modules/index/index.php2
-rw-r--r--modules/news/functions.php19
-rw-r--r--modules/news/index.php42
-rw-r--r--modules/rudi/includes/common.class.php4
-rw-r--r--modules/rudi/views/view.roster.php2
-rw-r--r--themes/default/include/primary.css4
-rw-r--r--themes/default/index.php2
18 files changed, 348 insertions, 290 deletions
diff --git a/admin/images/bayonet_logo.jpg b/admin/images/bayonet_logo.jpg
index d957c7d..5127ad2 100644
--- a/admin/images/bayonet_logo.jpg
+++ b/admin/images/bayonet_logo.jpg
Binary files differ
diff --git a/admin/rudi/index.php b/admin/rudi/index.php
index 3d93bf0..2e4a42a 100644
--- a/admin/rudi/index.php
+++ b/admin/rudi/index.php
@@ -49,6 +49,7 @@
$th = array('Rudi Options','');
$td = array(
LinkInternal('Roster','?op=rudi&show=members'),
+ LinkInternal('Units','?op=rudi&show=units'),
LinkInternal('Awards', '?op=rudi&show=awards')
);
diff --git a/admin/rudi/views/view.awards.edit.php b/admin/rudi/views/view.awards.edit.php
index 09f041c..21ec156 100644
--- a/admin/rudi/views/view.awards.edit.php
+++ b/admin/rudi/views/view.awards.edit.php
@@ -3,19 +3,22 @@
$form = new BayonetForm("", "POST");
if($form->verifySubmit('processed'))
{
- echo "Key states<br/>\n";
- $keydump = print_r($form->getKeyStates($form->request), true);
- echo "<pre>{$keydump}</pre>\n";
-
- echo "<p>Transaction processed</p>\n";
-
+ global $db;
+ $name = $form->request['name'];
+ $text = $form->request['text'];
+ $db->Query("UPDATE `rudi_awards` SET `name` = '$name', `description` = '$text' WHERE `award_id` = '$award_id' LIMIT 1");
+
+ PageRedirect(1, "?op=rudi&show=awards&award={$award_id}");
+ return;
}
+ echo LinkInternal("Cancel","?op=rudi&show=awards&cid={$award['class_id']}");
OpenTable();
?>
<tr><th>Name:</th><td><?php $form->textField('name', $award['name'], false, "50"); ?></td><tr>
<tr><th>Image:</th><td><?php ?></td></tr>
<tr><th>Text:</th><td><?php $form->textArea('text',10,30,$award['description']); ?></td></tr>
+<tr><td><?php $form->submitButton('processed', 'Update'); ?></td></tr>
<?php
CloseTable();
diff --git a/admin/rudi/views/view.awards.php b/admin/rudi/views/view.awards.php
index 2455018..b4c912f 100644
--- a/admin/rudi/views/view.awards.php
+++ b/admin/rudi/views/view.awards.php
@@ -3,6 +3,11 @@
if(isset($_GET['award'])){
$award_id = $_GET['award'];
include 'view.awards.edit.php';
+ }else if(isset($_GET['add'])){
+ include 'view.awards.add.php';
+ }else if(isset($_GET['delete'])){
+ $award_id = $_GET['delete'];
+ include 'view.awards.delete.php';
}else{
echo "<h3>Award Classes</h3>";
$classes = getAwardClasses();
@@ -18,6 +23,7 @@
$class_id = $_GET['cid'];
$awards = getAwardsByClass($class_id);
echo "<h3>Awards</h3>";
+ echo LinkInternal('<img src="images/add.png" />&nbsp;Add New Award','?op=rudi&show=awards&cid={$class_id}&add=true');
OpenTable();
foreach($awards as $award){
echo "<tr><td>".$award['name']."</td>
diff --git a/admin/rudi/views/view.members.php b/admin/rudi/views/view.members.php
index 659ef2b..38929df 100644
--- a/admin/rudi/views/view.members.php
+++ b/admin/rudi/views/view.members.php
@@ -16,7 +16,7 @@
echo "<h3>Current Members</h3>";
echo "<table width=\"100%\" style=\"text-align:center;\">";
echo "<tr><th>Rank</th><th>Soldier</th><th>Main Info</th><th>Service Record</th><th>Medal Record</th></tr>";
- $result = $db->Query("SELECT * FROM `rudi_unit_members` JOIN `rudi_ranks` ON rudi_unit_members.rank_id=rudi_ranks.rank_id WHERE rudi_unit_members.status_id != 4 AND rudi_unit_members.status_id != 5 ORDER BY rudi_ranks.weight DESC , rudi_unit_members.date_promotion ASC , rudi_unit_members.date_enlisted ASC");
+ $result = $db->Query("SELECT * FROM `rudi_unit_members` JOIN `rudi_ranks` ON rudi_unit_members.rank_id=rudi_ranks.rank_id WHERE rudi_unit_members.status_id <= 3 ORDER BY rudi_ranks.weight DESC , rudi_unit_members.date_promotion ASC , rudi_unit_members.date_enlisted ASC");
$row = $db->Fetch($result);
foreach($row as $member){
@@ -32,7 +32,7 @@
echo "<h3>Previous Members</h3>";
echo "<table width=\"100%\" style=\"text-align:center;\">";
echo "<tr><th>Rank</th><th>Soldier</th><th>Main Info</th><th>Service Record</th><th>Medal Record</th></tr>";
- $result = $db->Query("SELECT * FROM `rudi_unit_members` JOIN `rudi_ranks` ON rudi_unit_members.rank_id=rudi_ranks.rank_id WHERE rudi_unit_members.status_id = 4 OR rudi_unit_members.status_id = 5 ORDER BY rudi_ranks.weight DESC, rudi_unit_members.date_promotion ASC, rudi_unit_members.date_enlisted ASC");
+ $result = $db->Query("SELECT * FROM `rudi_unit_members` JOIN `rudi_ranks` ON rudi_unit_members.rank_id=rudi_ranks.rank_id WHERE rudi_unit_members.status_id > 3 ORDER BY rudi_ranks.weight DESC, rudi_unit_members.date_promotion ASC, rudi_unit_members.date_enlisted ASC");
$row = $db->Fetch($result);
foreach($row as $member){
diff --git a/admin/rudi/views/view.members.profile.php b/admin/rudi/views/view.members.profile.php
index fedabdd..bd776d7 100644
--- a/admin/rudi/views/view.members.profile.php
+++ b/admin/rudi/views/view.members.profile.php
@@ -51,6 +51,8 @@
decho($query);
$db->Query($query);
+ $db->Query("UPDATE `rudi_roles_container` SET `role_id` = '$role_id' WHERE `member_id` = '$member_id' LIMIT 1");
+
/* do the role query as well */
PageRedirect(1, "?op=rudi&show=members&profile={$member_id}");
return;
diff --git a/admin/rudi/views/view.units.php b/admin/rudi/views/view.units.php
index e69de29..2ccf35a 100644
--- a/admin/rudi/views/view.units.php
+++ b/admin/rudi/views/view.units.php
@@ -0,0 +1,22 @@
+<?php
+ include $basedir.'rudi/includes/functions.units.php';
+ if(isset($_GET['unit'])){
+
+ }else{
+ //list units
+ DisplayUnits();
+
+ }
+
+
+?>
+<div style="text-align:left;">
+<img src="images/tree_branch.gif" />&nbsp;Kilo Company<br />
+<img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" />&nbsp;1st Platoon<br />
+<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" />&nbsp;1st Squad<br />
+<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_leaf.gif" /><img src="images/tree_branch.gif" />&nbsp;Fireteam Alpha<br />
+<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_leaf.gif" /><img src="images/tree_branch.gif" />&nbsp;Fireteam Bravo<br />
+<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" />&nbsp;2nd Squad<br />
+<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" />&nbsp;Fireteam Alpha<br />
+<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" />&nbsp;Fireteam Bravo<br />
+</div> \ No newline at end of file
diff --git a/include/classes.php b/include/classes.php
index 0042c95..5f51e99 100644
--- a/include/classes.php
+++ b/include/classes.php
@@ -1,131 +1,238 @@
<?php
+abstract class Bayonet_Layout
+{
+ function OpenContent()
+ {
+ echo "<div class=\"contentBorder1\">";
+ echo "<div class=\"contentBorder2\">";
+ }
+
+ function CloseContent()
+ {
+ echo "</div>";
+ echo "</div>";
+ }
+}
+
+class Bayonet_Theme extends Bayonet_Layout
+{
+ static public $index;
+ static public $header;
+ static public $footer;
+
+ static public $name;
+ static public $root_path;
+ static public $include_path;
+ static public $image_path;
+ static public $config_path;
+ static public $config;
+ static public $primary_css;
+
+ static function init()
+ {
+ if (!isset($_GET['theme']))
+ {
+ self::$name = Bayonet_Config::$ini['site']['theme'];
+ }
+ else
+ {
+ self::$name = $_GET['theme'];
+ }
+
+ decho('Initializing theme variables for \'' . self::$name . '\'');
+ self::$root_path = dirname(BAYONET_ROOT) . '/themes/' . self::$name;
+ self::$include_path = self::$root_path . '/include';
+ self::$image_path = self::$root_path . '/images';
+ self::$primary_css = self::$include_path . '/primary.css';
+ self::$config_path = self::$include_path . '/theme.ini';
+
+ if (!self::is_valid())
+ {
+ die('Theme failed during initialization.');
+ }
+ self::$config = parse_ini_file(self::$config_path, true);
+
+ self::$index = self::$root_path . '/index.php';
+ self::$header = self::$root_path . '/header.php';
+ self::$footer = self::$root_path . '/footer.php';
+
+ //decho(get_class_vars(Bayonet_Theme)); //do not re-enable this
+ self::load();
+ }
+
+ static private function is_valid()
+ {
+ if (file_exists(self::$root_path) && file_exists(self::$include_path) &&
+ file_exists(self::$config_path)) return true;
+ else return false;
+ }
+
+ static function load()
+ {
+ global $db, $config;
+ decho("Loading theme: '" . self::$name . "'");
+ require self::$index;
+ }
+}
+
+class Bayonet_Config
+{
+ static $ini;
+ static function init()
+ {
+ decho('Parsing configuration data');
+ if (file_exists(BAYONET_CONFIG))
+ {
+ self::$ini = parse_ini_file(BAYONET_CONFIG, true);
+ decho(self::$ini);
+ }
+ else die(BAYONET_CONFIG . ' not found');
+ }
+}
+
+class Bayonet
+{
+ static function init()
+ {
+ global $db, $config;
+ Bayonet_Config::init();
+
+ // Set globally referenced configuration and database variables
+ $config = Bayonet_Config::$ini;
+ $db = new Bayonet_SQL();
+
+ //Connect to the MySQL server
+ $db->Connect($config['sql']['hostname'], $config['sql']['username'], $config['sql']['password']);
+ $db->Select_db($config['sql']['database']);
+
+ decho('Initializing Bayonet');
+ Bayonet_Theme::init();
+ }
+}
+
+
define('PASSWORD', true);
define('NO_PASSWORD', false);
define('CHECKED', true);
class BayonetForm
{
- static public $request;
-
- public function __construct($action, $method)
- {
- $this->request = $_POST;
- echo "<form action=\"$action\" method=\"$method\">\n";
- }
-
- public function __destruct()
- {
- echo "</form>\n";
- }
-
- function getKeyStates($keys)
- {
- $good = array();
- $bad = array();
-
- if(!is_array($keys))
- return array();
-
- foreach($keys as $key => $value)
- {
- if(!empty($value))
- $good[$key] = $value;
- else
- $bad[$key] = $value;
- }
-
- $data = array(
- 'set' => $good,
- 'unset' => $bad
- );
-
- return $data;
- }
-
- function verify($submit_key)
- {
- return $this->verifySubmit($submit_key);
- }
-
- function verifySubmit($submit_key)
- {
- return isset($this->request[$submit_key]) ? true : false;
- }
-
- function button($extern_name, $value, $text = "Button")
- {
- echo "<button name=\"{$extern_name}\" value=\"{$value}\">{$text}</button>\n";
- }
-
- function submitButton($extern_name, $value = "Submit")
- {
- echo "<input type=\"submit\" name=\"{$extern_name}\" value=\"{$value}\" />\n";
- }
-
- function reset($value = "Reset")
- {
- echo "<input type=\"reset\" value=\"{$value}\" />\n";
- }
-
- function textField($extern_name, $value = NULL, $isPassword = false, $size = NULL, $max = NULL)
- {
- $type = 'text';
- if($isPassword) $type = 'password';
-
- $value = filter_var($value, FILTER_SANITIZE_STRING);
- echo "<input type=\"{$type}\" name=\"{$extern_name}\" value=\"$value\" size=\"{$size}\" maxLength=\"{$max}\" />\n";
- }
-
- function radioButton($extern_name, $value, $isChecked = false)
- {
- if($isChecked)
- {
- echo "<input type=\"radio\" name=\"{$extern_name}\" value=\"$value\" checked=\"checked\"/>\n";
- }
- else
- {
- echo "<input type=\"radio\" name=\"{$extern_name}\" value=\"$value\" />\n";
- }
- }
-
- function checkBox($extern_name, $value, $isChecked = false)
- {
- if($isChecked)
- {
- echo "<input type=\"checkbox\" name=\"{$extern_name}\" value=\"$value\" checked=\"checked\"/>\n";
- }
- else
- {
- echo "<input type=\"checkbox\" name=\"{$extern_name}\" value=\"$value\" />\n";
- }
- }
-
- function dropDown($extern_name, $values = array('None'), $select = NULL)
- {
- $selectIterator = 1;
-
- echo "<select name=\"{$extern_name}\">\n";
- foreach($values as $option => $text)
- {
- if(!is_null($select) && $selectIterator !== (int)$select)
- {
- echo "<option value=\"{$option}\">{$text}</option>\n";
- }
- else
- {
- echo "<option value=\"{$option}\" selected=\"selected\">{$text}</option>\n";
- }
- $selectIterator++;
- }
- echo "</select>\n";
- }
-
- function textArea($extern_name, $rows = 10, $cols = 30, $value = NULL)
- {
- $value = filter_var($value, FILTER_SANITIZE_STRING);
- echo "<textarea name=\"{$extern_name}\" rows=\"$rows\" cols=\"$cols\">{$value}</textarea>\n";
- }
+ static public $request;
+
+ public function __construct($action, $method)
+ {
+ $this->request = $_POST;
+ echo "<form action=\"$action\" method=\"$method\">\n";
+ }
+
+ public function __destruct()
+ {
+ echo "</form>\n";
+ }
+
+ function getKeyStates($keys)
+ {
+ $good = array();
+ $bad = array();
+
+ if (!is_array($keys)) return array();
+
+ foreach ($keys as $key => $value)
+ {
+ if (!empty($value)) $good[$key] = $value;
+ else $bad[$key] = $value;
+ }
+
+ $data = array('set' => $good, 'unset' => $bad);
+
+ return $data;
+ }
+
+ function verify($submit_key)
+ {
+ return $this->verifySubmit($submit_key);
+ }
+
+ function verifySubmit($submit_key)
+ {
+ return isset($this->request[$submit_key]) ? true : false;
+ }
+
+ function button($extern_name, $value, $text = "Button")
+ {
+ echo "<button name=\"{$extern_name}\" value=\"{$value}\">{$text}</button>\n";
+ }
+
+ function submitButton($extern_name, $value = "Submit")
+ {
+ echo "<input type=\"submit\" name=\"{$extern_name}\" value=\"{$value}\" />\n";
+ }
+
+ function reset($value = "Reset")
+ {
+ echo "<input type=\"reset\" value=\"{$value}\" />\n";
+ }
+
+ function textField($extern_name, $value = null, $isPassword = false, $size = null,
+ $max = null)
+ {
+ $type = 'text';
+ if ($isPassword) $type = 'password';
+
+ $value = filter_var($value, FILTER_SANITIZE_STRING);
+ echo "<input type=\"{$type}\" name=\"{$extern_name}\" value=\"$value\" size=\"{$size}\" maxLength=\"{$max}\" />\n";
+ }
+
+ function radioButton($extern_name, $value, $isChecked = false)
+ {
+ if ($isChecked)
+ {
+ echo "<input type=\"radio\" name=\"{$extern_name}\" value=\"$value\" checked=\"checked\"/>\n";
+ }
+ else
+ {
+ echo "<input type=\"radio\" name=\"{$extern_name}\" value=\"$value\" />\n";
+ }
+ }
+
+ function checkBox($extern_name, $value, $isChecked = false)
+ {
+ if ($isChecked)
+ {
+ echo "<input type=\"checkbox\" name=\"{$extern_name}\" value=\"$value\" checked=\"checked\"/>\n";
+ }
+ else
+ {
+ echo "<input type=\"checkbox\" name=\"{$extern_name}\" value=\"$value\" />\n";
+ }
+ }
+
+ function dropDown($extern_name, $values = array('None'), $select = null)
+ {
+ $selectIterator = 1;
+
+ echo "<select name=\"{$extern_name}\">\n";
+ foreach ($values as $option => $text)
+ {
+ if (!is_null($select) && $selectIterator !== (int)$select)
+ {
+ echo "<option value=\"{$option}\">{$text}</option>\n";
+ }
+ else
+ {
+ echo "<option value=\"{$option}\" selected=\"selected\">{$text}</option>\n";
+ }
+ $selectIterator++;
+ }
+ echo "</select>\n";
+ }
+
+ function textArea($extern_name, $rows = 10, $cols = 30, $value = null)
+ {
+ $value = filter_var($value, FILTER_SANITIZE_STRING);
+ echo "<textarea name=\"{$extern_name}\" rows=\"$rows\" cols=\"$cols\">{$value}</textarea>\n";
+ }
}
?> \ No newline at end of file
diff --git a/include/debug.php b/include/debug.php
index 29f4195..a0c2236 100644
--- a/include/debug.php
+++ b/include/debug.php
@@ -115,7 +115,7 @@ function logQueueFlush($force = false)
static $log_message_last_count = 0;
static $next = false;
- OpenContent();
+ //OpenContent();
echo "<div class=\"contentHeading\">Bayonet Debug Messages</div>";
echo "<div class=\"content\">";
@@ -168,7 +168,7 @@ function logQueueFlush($force = false)
}
echo "</div>";
- CloseContent();
+ //CloseContent();
error_reporting(1);
}
diff --git a/include/functions.php b/include/functions.php
index 3f1c3d2..109f11c 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -330,26 +330,27 @@ if(!defined("CALLED_FROM_ADMIN"))
/**
* OpenContent()
* Begins a Bayonet site table.
+ * MOVE FOR CUSTOMIZED USE FOR THEMES
* @return
*/
- function OpenContent()
+/* function OpenContent()
{
echo "<div class=\"contentBorder1\">";
echo "<div class=\"contentBorder2\">";
- }
+ } */
/**
* CloseContent()
* Closes a Bayonet site table.
* @return
*/
- function CloseContent()
+ /* function CloseContent()
{
echo "</div>";
echo "</div>";
- }
+ } */
}
-
+/* MOVED TO THEMES
function OpenBlock($title = 'New Block')
{
OpenContent();
@@ -361,7 +362,7 @@ function CloseBlock()
{
echo "</div>";
CloseContent();
-}
+} */
static $error_stack_messages = array(); //global stack of errors accumulated throughout execution
function push_error_stack($message)
@@ -404,9 +405,9 @@ function handle_error ($errno, $errstr, $errfile, $errline)
function ReportError($message)
{
//WriteLog($message,BAYONET_LOG_ERROR);
- OpenContent();
+ //OpenContent();
echo "<div class=\"contentHeading\">Error Message</div><div class=\"content\">{$message}</div>";
- CloseContent();
+ //CloseContent();
}
/**
@@ -421,9 +422,9 @@ function ReportError($message)
function ReportHack($message)
{
//WriteLog($message,BAYONET_LOG_HACK);
- OpenContent();
+ //OpenContent();
echo "<div class=\"contentHeading\">Hacking Attempt</div><div class=\"content\">{$message}</div>";
- CloseContent();
+ //CloseContent();
}
/**
@@ -553,39 +554,6 @@ function WriteLogBayonet($message,$flag)
}
/**
- * UnderConstruction()
- *
- * Displays a site-wide message across the page header.
- *
- * @param mixed $message
- * @param mixed $flag Acceptable flags are BAYONET_SITE, and BAYONET_SECTION
- * @return
- */
-define('BAYONET_SITE','bayonet_site');
-define('BAYONET_SECTION','bayonet_section');
-function UnderConstruction($message = NULL, $flag = BAYONET_SITE)
-{
- $timestamp = date("Y-M-d h:m:s");
- OpenTable();
- switch($flag)
- {
- case BAYONET_SITE:
- echo "<tr><th>Site is currently under construction : $timestamp</th></tr>";
- break;
- case BAYONET_SECTION:
- echo "<tr><th>Section currently under construction : $timestamp</th></tr>";
- }
-
- if(!is_null($message))
- {
- echo "<tr><td><i>$message</i></td></tr>";
- }
-
- CloseTable();
- echo "<br>";
-}
-
-/**
* valid_result()
*
* Determine if a mysqli result is valid.
diff --git a/index.php b/index.php
index 01fe58b..d6280da 100644
--- a/index.php
+++ b/index.php
@@ -10,114 +10,10 @@ define('BAYONET_CONFIG', BAYONET_ROOT . '/include/config.ini');
require BAYONET_INCLUDE . '/debug.php';
require BAYONET_INCLUDE . '/sql.class.php';
require BAYONET_INCLUDE . '/functions.php';
+require_once BAYONET_INCLUDE . '/classes.php';
-
-class Bayonet_Theme
-{
- static public $index;
- static public $header;
- static public $footer;
-
- static public $name;
- static public $root_path;
- static public $include_path;
- static public $image_path;
- static public $config_path;
- static public $config;
- static public $primary_css;
-
- static function init()
- {
- if(!isset($_GET['theme']))
- {
- self::$name = Bayonet_Config::$ini['site']['theme'];
- }
- else
- {
- self::$name = $_GET['theme'];
- }
-
- decho('Initializing theme variables for \'' . self::$name . '\'');
- self::$root_path = dirname(BAYONET_ROOT) . '/themes/' . self::$name;
- self::$include_path = self::$root_path . '/include';
- self::$image_path = self::$root_path . '/images';
- self::$primary_css = self::$include_path . '/primary.css';
- self::$config_path = self::$include_path . '/theme.ini';
-
- if(!self::is_valid())
- {
- die('Theme failed during initialization.');
- }
- self::$config = parse_ini_file(self::$config_path, true);
-
- self::$index = self::$root_path . '/index.php';
- self::$header = self::$root_path . '/header.php';
- self::$footer = self::$root_path . '/footer.php';
-
- //decho(get_class_vars(Bayonet_Theme)); //do not re-enable this
- self::load();
- }
-
- static private function is_valid()
- {
- if(
- file_exists(self::$root_path) &&
- file_exists(self::$include_path) &&
- file_exists(self::$config_path)
- )
- return true;
- else
- return false;
- }
-
- static function load()
- {
- global $db, $config;
-
- // Globally referenced configuration and database variables
- $config = Bayonet_Config::$ini;
- $db = new Bayonet_SQL();
-
- $db->Connect(
- $config['sql']['hostname'],
- $config['sql']['username'],
- $config['sql']['password']
- );
- $db->Select_db($config['sql']['database']);
-
- decho("Loading theme: '" . self::$name . "'");
- require self::$index;
- }
-}
-
-class Bayonet_Config
-{
- static $ini;
- static function init()
- {
- decho('Parsing configuration data');
- if(file_exists(BAYONET_CONFIG))
- {
- self::$ini = parse_ini_file(BAYONET_CONFIG, true);
- decho(self::$ini);
- }
- else
- die(BAYONET_CONFIG . ' not found');
- }
-}
-
-class Bayonet
-{
- static function init()
- {
- decho('Initializing Bayonet');
- Bayonet_Config::init();
- Bayonet_Theme::init();
- }
-}
-
+/* Initialize Bayonet CMS */
Bayonet::init();
-
?> \ No newline at end of file
diff --git a/modules/index/index.php b/modules/index/index.php
index 9847cb5..54c8dbd 100644
--- a/modules/index/index.php
+++ b/modules/index/index.php
@@ -8,6 +8,8 @@
*
*/
+define('INDEX_MODULE', true);
+
$result = $db->Query("SELECT `dir_name` FROM `bayonet_modules` ORDER BY `weight` ASC");
$modules = $db->Fetch($result);
foreach($modules as $module)
diff --git a/modules/news/functions.php b/modules/news/functions.php
index 22952af..f3505df 100644
--- a/modules/news/functions.php
+++ b/modules/news/functions.php
@@ -127,7 +127,7 @@ function getNumOfComments($id){
* Function that gets the desired news from the database and returns it as an array
* @param id - (optional) news_id cooresponding to `bayonet_news`
*/
-function getNews($id = NULL){
+function getNews($id = NULL, $limit = NULL, $index = 0){
global $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 ".
@@ -138,11 +138,12 @@ function getNews($id = NULL){
$query = $query."WHERE n.news_id = '$id' ";
}else{
$query = $query."ORDER BY date DESC";
- if($limit !=NULL){
- $query = $query." LIMIT '$limit'";
- }
+ if($index > 0)
+ $query = $query." LIMIT $index, $limit";
+ else if($limit !=NULL)
+ $query = $query." LIMIT $limit";
}
-
+ decho($query);
$result = $db->Query($query);
$data = $db->Fetch($result);
@@ -159,6 +160,12 @@ function displayNews($data){
date_default_timezone_set("America/New_York");
+ if(empty($data)){
+ ReportError("Sorry, we found no news using these parameters.");
+ echo "<br />";
+ }
+
+
foreach($data as $news)
{
$numComments = getNumOfComments($news['news_id']);
@@ -235,7 +242,7 @@ function commentForm(){
echo "Guest";
}
?>
- <br><span><?php echo date('F jS', time()); ?></span></p>
+ <br /><span><?php echo date('F jS', time()); ?></span></p>
</div>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST" id="comment_form">
<!-- <fieldset> -->
diff --git a/modules/news/index.php b/modules/news/index.php
index 6aaec2d..1dfd98a 100644
--- a/modules/news/index.php
+++ b/modules/news/index.php
@@ -27,6 +27,20 @@ include 'modules/news/functions.php';
$logged_id = 2;
+if(!defined('INDEX_MODULE')){
+ $page_num = 1;
+ $page_num = $_GET['page']; //get variable for page number
+
+ $page_num --; //so the $index can be calculated easier while keeping [1,n] page numbers
+
+ $limit = 3; //number of items per page
+ $index = $page_num * $limit;
+
+}else{
+ //only do the limit
+ $limit = 3;
+}
+
if(isset($_GET['id']))
{
$news_id = $_GET['id'];
@@ -36,9 +50,35 @@ if(isset($_GET['id']))
}
else
{
- displayNews(getNews());
+ $news = getNews(null, $limit, $index);
+ displayNews($news);
+ OpenContent();
+ if(defined('INDEX_MODULE')){
+?>
+ <div style="float:right;">
+ <a href="?load=news">Read All</a>&nbsp;
+ </div>
+
+<?php
+ }else{
+ if($page_num > 0)
+ echo "&nbsp;<a href=\"?load=news&page={$page_num}\">More Recent News</a>";
+
+ decho("count: ".count($news));
+ if(count($news) == $limit){
+?>
+ <div style="float:right;">
+ <a href="?load=news&page=<?php echo ($page_num+2); ?>">Older News</a>&nbsp;
+ </div>
+<?php
+ }
+ }
+ echo "<div class=\"clear\"></div>";
+ CloseContent();
return;
}
+
+
?> \ No newline at end of file
diff --git a/modules/rudi/includes/common.class.php b/modules/rudi/includes/common.class.php
index 2e64e48..2112853 100644
--- a/modules/rudi/includes/common.class.php
+++ b/modules/rudi/includes/common.class.php
@@ -708,10 +708,10 @@ class RUDI_Common
* @param int $unit_id
*/
public function displayUnitsRec($unit_id){
- $result = $this->db->Query("SELECT * FROM `rudi_combat_units` WHERE `detachment` = '$unit_id'");
+ $result = $this->db->Query("SELECT * FROM `rudi_combat_units` WHERE `detachment` = '$unit_id' ORDER BY `weight`");
$row = $this->db->FetchObject($result,'UnitInfo');
foreach($row as $unit){
- echo "<tr><th colspan=\"5\">{$unit->name}</th></tr>";
+ echo "<tr><th colspan=\"5\">{$unit->name} : {$unit->callsign}</th></tr>";
$this->printRoster($unit->unit_id, $unit->leader_id);
$this->displayUnitsRec($unit->unit_id);
}
diff --git a/modules/rudi/views/view.roster.php b/modules/rudi/views/view.roster.php
index 01da5ea..c0ee92d 100644
--- a/modules/rudi/views/view.roster.php
+++ b/modules/rudi/views/view.roster.php
@@ -3,7 +3,7 @@
$result = $this->db->query("SELECT * FROM `rudi_combat_units` WHERE `detachment` = 0");
$row = $this->db->fetch($result);
foreach($row as $unit){
- echo "<tr><th colspan=\"5\">{$unit['name']}</th></tr>";
+ echo "<tr><th colspan=\"5\">{$unit['name']} : {$unit['callsign']}</th></tr>";
?>
<tr>
<!-- Table header -->
diff --git a/themes/default/include/primary.css b/themes/default/include/primary.css
index 93aa1ab..7bed7ce 100644
--- a/themes/default/include/primary.css
+++ b/themes/default/include/primary.css
@@ -100,6 +100,10 @@
font-size: 10px;
}
+ .clear {
+ clear: both;
+ }
+
/*********************************
** Nav Links Styles **
*********************************/
diff --git a/themes/default/index.php b/themes/default/index.php
index 1004e0a..3d02ec1 100644
--- a/themes/default/index.php
+++ b/themes/default/index.php
@@ -15,7 +15,7 @@ try {
ob_start("fatal_error_handler");
set_error_handler("handle_error");
-
+require_once self::$root_path . '/include/functions.php';
include self::$header;
//session_start();