Beispiel #1
0
/**
 * Note to anyone feeling the need to edit this file...
 * You MUST declare $db as global inside your functions in order access MySQL from here.
 */
function changePassword()
{
    echo "<script type=\"text/javascript\" src=\"scripts/mocha.js\"></script>";
    global $db;
    if (isset($_POST['processed'])) {
        $password = $_POST['password'];
        $confirm = $_POST['confirm'];
        if ($password != $confirm) {
            ReportError("The passwords you entered did not match.");
            PageRedirect(3, "?op=settings&change=password");
            return;
        } else {
            if (strlen($password) < 6) {
                ReportError("The password you entered is less than 6 characters.");
                PageRedirect(3, "?op=settings&change=password");
                return;
            }
        }
        $newpassword = crypt(md5($password), 'iamnotadirtywhorebitch');
        $username = $_SESSION['username'];
        $db->Query("UPDATE `bayonet_users` SET `password` = '{$newpassword}' WHERE `username` = '{$username}' LIMIT 1");
        echo "Your password has successfully been changed.";
        PageRedirect(3, "?op=settings");
        return;
    }
    ?>
<div id="pwordCont">
<form method="POST" action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
">
<h1>Change Your Password</h1>
	<table>
	<tr>
		<td class="right">Password: </td>
		<td><input type="password" id="inputPassword" name="password" style="width:200px;" /></td>
		<td>
			<table cellspacing="0">
			<tr><td>Password Strength:</td><td id="complexity"></td></tr>
			<tr><td colspan="2"><div class="outer"><div id="rating"></div></div></td></tr>
			</table>
		</td>
	</tr>
	<tr><td></td><td style="text-align:center; color:#626262;">Minimum of 6 Characters</td><td></td></tr>
	<tr>
		<td>Confirm Password: </td>
		<td><input type="password" name="confirm" style="width:200px;" /></td>
	</tr>
	<tr><td colspan="2"><input type="submit" value="Change Password" name="processed" /></td>
	</table>
</form>
</div>
<?php 
}
Beispiel #2
0
function EditPoints2()
{
    global $db;
    $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  ORDER BY rudi_ranks.weight DESC , rudi_unit_members.date_promotion ASC , rudi_unit_members.date_enlisted ASC");
    $row = $db->Fetch($result);
    if (isset($_POST['processed'])) {
        echo "Updating data... Please wait.";
        foreach ($row as $soldier) {
            $mID = $soldier['member_id'];
            $missed = $_POST[$mID . 'missed'];
            $attended = $_POST[$mID . 'attended'];
            $points = $_POST[$mID . 'points'];
            if ($missed != "" && $points != "") {
                $db->Query("UPDATE `rudi_unit_members` SET `points` = {$points}, `drillcount` = {$missed}, `attendcount` = {$attended} WHERE `member_id` = {$mID} LIMIT 1");
            } else {
                ReportError("Error updating points for soldier id# '{$mID}'. Please contact administrator.");
            }
        }
        PageRedirect(1, "?op=adjutant&edit=pointsnew");
        return;
    }
    ?>
                <form method="POST" action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
">
                <table style="text-align:center;" width="100%" cellspacing="0">
                <?php 
    //OpenTable();
    ?>
                <tr><th>Rank</th><th>Soldier</th><th>Status</th><th>Points</th><th>Drills Missed</th><th>Drills Attended</th></tr>
<?php 
    foreach ($row as $soldier) {
        $memberID = $soldier['member_id'];
        if ($soldier['status_id'] != 1) {
            echo "<tr class=\"inactive\">";
        } else {
            echo "<tr>";
        }
        echo "<td>{$soldier['shortname']}</td>\n          <td>{$soldier['first_name']} {$soldier['last_name']}</td>\n          <td>" . getStatus($soldier['status_id']) . "</td>\n          <td><input type=\"text\" class=\"lrg\" value=\"{$soldier['points']}\" name=\"{$memberID}points\" size=\"1\" maxlength=\"3\" />/100</td>\n          <td><input type=\"text\" class=\"lrg\" value=\"{$soldier['drillcount']}\" name=\"{$memberID}missed\" size=\"1\" maxlength=\"1\" />/3</td>\n          <td><input type=\"text\" class=\"lrg\" value=\"{$soldier['attendcount']}\" name=\"{$memberID}attended\" size=\"1\" maxlength=\"1\" />/3</td>";
        echo "<input type=\"hidden\" value=\"{$memberID}\" name=\"{$memberID}id\" />\n";
    }
    CloseTable();
    echo "<input type=\"submit\" name=\"processed\" value=\"Update Points\" /></form>";
}
Beispiel #3
0
function SendSimpleMessage($Owner, $Sender, $Time, $Type, $From, $Subject, $Message)
{
    global $messfields;
    if ($Time == '') {
        $Time = time();
    }
    //explode(",",$user['messages']) = array(0 => PM,1 => ALLY, 2 => EXP, 3 => BATTLE,4 => ESP,5 => GENERAL);
    $newtype = array('t1' => 0, 't2' => 1, 't15' => 2, 't3' => 3, 't0' => 4, 't99' => 5);
    if ($newtype['t' . $Type]) {
        $messtype = $newtype['t' . $Type];
    } else {
        $messtype = 5;
    }
    PM($Owner, $Sender, $Message, $Subject, $Sender, $messtype);
    //now report this rogue function
    $error = 'The function SendSimpleMessage has been called. This function is no longer in use, please ammend the file to use the new PM function instead.';
    ReportError($error, 'Deprecated Function', 1);
}
function login()
{
    global $db;
    if (isset($_SESSION['username']) || isset($_SESSION['password'])) {
        return true;
    }
    if (isset($_POST['processed'])) {
        $username = addslashes($_POST['username']);
        $password = addslashes($_POST['password']);
        $password = crypt(md5($password), 'iamnotadirtywhorebitch');
        $result = $db->Query("SELECT * FROM bayonet_users WHERE username = '******' AND password = '******' LIMIT 1");
        $rows = $db->Rows($result);
        $row = $db->FetchRow($result);
        if ($rows > 0) {
            $_SESSION['username'] = stripslashes($username);
            $_SESSION['password'] = stripslashes($password);
            $_SESSION['level'] = $row['level'];
            return true;
        } else {
            ReportError("Login incorrect.");
            //NOT CORRECT LOGIN, DEFAULT TO LOGIN PAGE
            //echo "<meta http-equiv=\"Refresh\" content=\"1;url=index.php\">";
            PageRedirect(1, "index.php");
            return false;
        }
    } else {
        echo "<form action=\"\" method=\"post\">\n";
        //OpenTable();
        echo "<table style=\"width:100%; height:600px;\">";
        echo "<tr><td><table width=\"450px\" style=\"background-color:white;\" align=\"center\">\n\n      <tr><td colspan=\"2\" style=\"text-align:center;\"><img src=\"images/bayonet_logo.jpg\" /></td></tr>\n\n      <tr><th colspan=\"2\">Administrative Login</th></tr>\n\n      <tr><th style=\"text-align:right;\">Username</th><td><input size=\"20\" type=\"text\" name=\"username\"></td></tr>\n\n      <tr><th style=\"text-align:right;\">Password</th><td><input size=\"20\" type=\"password\" name=\"password\"></td></tr>\n\n      <tr><th colspan=\"2\" align=\"center\"><input type=\"Submit\" name=\"processed\" value=\"Login\"></th></tr></td></tr>\n\n      </table>\n";
        //CloseTable();
        echo "</table>";
        echo "</form>\n";
        return false;
    }
}
Beispiel #5
0
 *
 * 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/>.
 */
if (!defined(NO_ACCESS)) {
    ReportError("Access denied.");
}
define("RUDI_DEBUG", true);
define("RUDI_DEBUG_LEVEL", true);
define(NO_REPEAT, 'norepeat');
define(REPEAT, 'repeat');
static $last_message = NULL;
static $last_message_count = 0;
/*
function decho($message)
{
  echo "<pre>\n";
  if(is_array($message))
  {
    print_r($message);
  }  
Beispiel #6
0
    require_once 'modules.php';
    ?>
 		</td>
 		
	  <!-- block area RIGHT -->
	  <?php 
    if (!defined('BLOCK_RIGHT_DISABLE')) {
        ?>
	    <td class="rightcol" style="padding-left: 15px;">
	      	<?php 
        GetBlocks(BLOCK_RIGHT);
        ?>
	    </td>    
	  <?php 
    }
    ?>
  		
	</tr>
</table>

</div>
<?php 
    include self::$footer;
    /* Flushing is needed by the error handler */
    ob_end_flush();
} catch (Exception $e) {
    ReportError("<style>td.short{width:100%;}</style><table style=\"width:0;\"><tr><th>Code</th>" . "<td class=\"short\">" . $e->getCode() . "</td>" . "</tr><tr><th>In File</th>" . "<td class=\"short\">" . $e->getFile() . "</td>" . "</tr></table>" . $e->getLine() . " - " . $e->getMessage() . "<br/>");
}
?>
 
Beispiel #7
0
    $PostId = $Array['article']['id'];
}
$query = "SELECT * FROM page_function WHERE active='1' AND trash='0' AND dynamic='{$Dynamic_Setup}' AND page='{$PostId}' AND template='{$theme}' ORDER BY list ASC";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
    $Function_Type = $row['function'];
    if ($row['contents'] == "") {
    } else {
        $row['contents'] = unserialize($row['contents']);
    }
    if ($row['contents']['category'] == "") {
        $row['contents']['category'] = "all";
    }
    $Function_Array = $row['contents'];
    $Array['function'] = $Function_Array;
    if (function_exists("{$Function_Type}")) {
        $Function_Type($Array);
    } else {
        $Error[message] = "A Function is being requested that does not exist";
        $Error["file"] = $Function_Type;
        $Error[type] = "function";
        $Error[source] = "homepage1";
        ReportError($Array, $Error);
    }
}
if ($Function_Type == "") {
    $Error_404 = 1;
}
if ($Error_404 == 1) {
    Error404($Array);
}
Beispiel #8
0
 public static function test()
 {
     ReportInfo("Testing DAWidgetConfig");
     ReportInfo("Creating a new widget config");
     $newWidgetConfig = new be_widget_config();
     $newWidgetConfig->widget_id = 1;
     $newWidgetConfig->vse_label = "TEST";
     $newWidgetConfig->simple_object_property = "";
     $newWidgetConfig->friendly_label = "PRUEBA";
     $newWidgetConfig->options_json = "";
     ReportInfo("Widget to create:");
     print_r($newWidgetConfig);
     $savedWidgetConfig = da_widget_config::InsertWidgetConfig($newWidgetConfig);
     if (is_numeric($savedWidgetConfig->widget_config_id) && $savedWidgetConfig->widget_config_id != $newWidgetConfig->widget_config_id && $savedWidgetConfig->widget_config_id > 0) {
         ReportSuccess("Widget Config Created Successfully");
         print_r($savedWidgetConfig);
         $savedWidgetConfig->vse_label = "MODIFIED";
         $savedWidgetConfig->options_json = "{'color':'red'}";
         //sleep(2);
         ReportInfo("Widget Config Modification:");
         print_r($savedWidgetConfig);
         $modifiedWidgetConfig = da_widget_config::UpdateWidgetConfig($savedWidgetConfig);
         if ($modifiedWidgetConfig->vse_label == "MODIFIED" && $modifiedWidgetConfig->options_json == "{'color':'red'}") {
             ReportSuccess("Widget Modified Sucessfully");
             $deletedResult = da_widget_config::DeleteWidgetConfig($modifiedWidgetConfig->widget_config_id);
             print_r($deletedResult);
         } else {
             ReportError("Modification failed :(");
         }
         ReportInfo("Modification Result:");
         print_r($modifiedWidgetConfig);
     } else {
         ReportError("Insertion failed :(");
     }
 }
Beispiel #9
0
/**
 * displayNews($data)
 * Function that takes an array of news and displays it as html
 * @param data - associative array of news from the database
 */
function displayNews($data, $short = false)
{
    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']);
        OpenContent();
        ?>
	
			<div class="contentHeading">
					<table width="100%">
						<tr>
							<td style="text-align:left;"><?php 
        echo $news['title'];
        ?>
</td>
							<td style="text-align:right;">Posted by: <?php 
        echo $news['author'];
        ?>
</td>
						</tr>
					</table>
			</div>
			<div class="content news">
				<img src="modules/news/categories/<?php 
        echo $news['catimage'];
        ?>
" alt="<?php 
        echo $news['catname'];
        ?>
" align="right" />
				<?php 
        if ($short) {
            echo substr(bbcode_format($news['message']), 0, 1000) . "...";
            echo '<br /><br /><a href="?load=news&id=' . $news['news_id'] . '">Continue reading.</a>';
        } else {
            echo bbcode_format($news['message']);
        }
        if (!is_null($news['eauthor'])) {
            echo "<br /><div style=\"text-align:right; font-size: 10px; font-style:italic;\">Last edit: " . date('F j, Y, g:i a T', strtotime($news['edited'])) . " by " . $news['eauthor'] . "</div>";
        }
        ?>
			</div>	
			<div class="contentFooter">
				<table width="100%">
					<tr>
						<td style="text-align:left;">
							View Comments: <a href="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?load=news&amp;id=<?php 
        echo $news['news_id'];
        ?>
"><?php 
        echo $numComments;
        ?>
 Comments</a>
						</td>
						<td style="text-align:right;">Posted: <?php 
        echo date('D F j, Y, g:i a T', strtotime($news['date']));
        ?>
</td>
					</tr>
				</table>
			</div>
	
	<?php 
        CloseContent();
        echo "<br />";
    }
}
 function ShowTemplate($s_name, $a_specs)
 {
     global $TEMPLATEURL, $TEMPLATEDIR, $bIsUserError, $bAlerted, $aGetVars;
     global $php_errormsg;
     if (empty($TEMPLATEDIR) && empty($TEMPLATEURL)) {
         ReportError("neither TEMPLATEDIR nor TEMPLATEURL is set");
         return false;
     }
     if (!empty($TEMPLATEDIR)) {
         $s_name = "{$TEMPLATEDIR}/" . basename($s_name);
         @($fp = fopen($s_name, "r"));
         if ($fp === false) {
             ReportError("Cannot open template '{$s_name}': {$php_errormsg}");
             return false;
         }
         //
         // load the whole template into a string
         //
         $s_buf = fread($fp, filesize($s_name));
         fclose($fp);
     } else {
         $s_name = AddUserAgent("{$TEMPLATEURL}/" . basename($s_name));
         if (session_id() !== "") {
             $s_name = AddURLParam($s_name, "sessid=" . urlencode(session_id()));
         }
         if (defined("SID")) {
             $s_name = AddURLParam($s_name, SID);
         }
         @($fp = fopen($s_name, "r"));
         if ($fp === false) {
             ReportError("Cannot open template '{$s_name}': {$php_errormsg}");
             return false;
         }
         //
         // load the whole template into a string
         //
         $s_buf = "";
         while (!feof($fp)) {
             $s_buf .= fread($fp, 4096);
         }
         fclose($fp);
     }
     //
     // now look for the tags to replace
     //
     foreach ($a_specs as $s_tag => $s_value) {
         //
         // search for
         //		<tagname/>
         // with optional whitespace
         //
         $s_buf = preg_replace('/<\\s*' . preg_quote($s_tag, "/") . '\\s*\\/\\s*>/ims', nl2br($s_value), $s_buf);
     }
     if ($bIsUserError) {
         //
         // put the form link just before the </body> end tag or replace
         // a <return_link/> tag
         //
         $s_link = GetFormLink($s_url);
         if (!empty($s_link)) {
             //
             // Replace any "$return_link" strings with the
             // return link URL.
             //
             if (preg_match('/\\$return_link\\b/ms', $s_buf) > 0) {
                 $s_buf = preg_replace('/\\$return_link\\b/ms', "{$s_url}", $s_buf);
             } else {
                 //
                 // Look for a "<return_link/>" tag and replace that.
                 // If it doesn't exist, put the return link before
                 // the body end tag.
                 //
                 if (preg_match('/<\\s*return_link\\s*\\/\\s*>/ims', $s_buf) > 0) {
                     $s_buf = preg_replace('/<\\s*return_link\\s*\\/\\s*>/ims', "{$s_link}\n", $s_buf);
                 } else {
                     $s_buf = preg_replace('/<\\s*\\/\\s*body\\s*>/ims', "{$s_link}\n" . '$0', $s_buf);
                 }
             }
         }
         // strip any <fmusererror> and </fmusererror> tags
         //
         // You can show information that's specific to user
         // errors between these special tags.
         //
         $s_buf = preg_replace('/<\\s*\\/?\\s*fmusererror\\s*>/ims', '', $s_buf);
         //
         // since this isn't a system error, strip anything between
         // <fmsyserror> and </fmsyserror>
         //
         $s_buf = preg_replace('/<\\s*fmsyserror\\s*>.*<\\s*\\/\\s*fmsyserror\\s*>/ims', '', $s_buf);
     } else {
         // strip any <fmsyserror> and </fmsyserror> tags
         //
         // You can show information that's specific to system
         // errors between these special tags.
         //
         $s_buf = preg_replace('/<\\s*\\/?\\s*fmsyserror\\s*>/ims', '', $s_buf);
         //
         // since this isn't a user error, strip anything between
         // <fmusererror> and </fmusererror>
         //
         $s_buf = preg_replace('/<\\s*fmusererror\\s*>.*<\\s*\\/\\s*fmusererror\\s*>/ims', '', $s_buf);
     }
     //
     // output the modified page
     //
     echo $s_buf;
     return true;
 }
Beispiel #11
0
 * 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/>.
 */
/**
 * MODULE - INDEX >>
 * This page is a module that displays multiple modules
 * Database should store a list of module names in the order they are to be displayed
 * This should be fairly simple to produce -- Dont forget to set this as the default
 * in the config.php array
 * 
 */
define('INDEX_MODULE', true);
$result = $db->Query("SELECT `dir_name` FROM `bayonet_modules` WHERE `status` = 'Active' ORDER BY `weight` ASC");
$modules = $db->Fetch($result);
foreach ($modules as $module) {
    $indexModules[] = $module['dir_name'];
}
foreach ($indexModules as $module) {
    if (file_exists("modules/" . $module)) {
        include 'modules/' . $module . '/index.php';
        decho("Index module loaded: '{$module}'");
    } else {
        OpenContent();
        ReportError("Cannot load module '{$module}' directory.<br>\n");
        CloseContent();
    }
    echo "<br />";
}
Beispiel #12
0
function GetBlocks($position = BLOCK_LEFT)
{
    global $config;
    global $db;
    $query = sprintf("SELECT block_id, active, weight, position, dir_name, title FROM bayonet_blocks WHERE active = 1 AND position = %d ORDER BY weight", (int) $position);
    $result = $db->Query($query);
    $blocks = $db->Fetch($result);
    if (empty($blocks)) {
        return;
    }
    foreach ($blocks as $block) {
        $load = 'blocks/' . $block['dir_name'] . '/index.php';
        if (file_exists($load)) {
            OpenBlock($block['title']);
            include_once $load;
            CloseBlock();
            decho("'{$block['dir_name']}' block loaded");
        } else {
            ReportError("Failed to load block, '{$block['dir_name']}'.  Check block config.");
        }
        if ($config['blocks']['spacer']) {
            echo "<br />";
        }
    }
}
<?php

global $db;
$result = $db->Query("SELECT CONCAT(last_name,', ',first_name) AS name FROM `rudi_unit_members` WHERE `member_id` = '{$member_id}' LIMIT 1");
$member = $db->FetchRow($result);
$form = new BayonetForm("", "POST");
if (isset($_POST['proceed'])) {
    //echo "Soldier '{$member['name']}', was deleted.";
    ReportError("This is not completed yet.");
    // DELETE unit_members, service_record, award_record FOR member_id
    //DeleteMember($member_id);
    PageRedirect(2, "?op=rudi&show=members");
    return;
}
if (isset($_POST['cancel'])) {
    echo "User cancelled deletion of soldier: '{$member['name']}'";
    PageRedirect(2, "?op=rudi&show=members&profile={$member_id}");
    return;
}
OpenTable();
?>
  <th>Are you <u>SURE</u> you want to delete soldier: '<?php 
echo $member['name'];
?>
'?<br />All records for this soldier will be permenantly removed.</th>
  <tr><th><button name="proceed">Yes</button>&nbsp;&nbsp;&nbsp;<button name="cancel">No</button></th></tr>
<?php 
CloseTable();
$form->__destruct();
Beispiel #14
0
 *
 * 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/>.
 */
if (!defined("ADMIN_FILE")) {
    die("Access denied.");
    return;
}
if (!isset($_GET['op'])) {
    echo "<center>No operation selected</center>\n";
    return;
}
$op = $_GET['op'];
$basedir = './';
if (file_exists($basedir)) {
    if (file_exists($basedir . $op)) {
        include $basedir . $op . '/index.php';
    } else {
        ReportError("Administrative operation '{$op}' does not exist.");
    }
} else {
    ReportError("Administrative base directory path does not exist.");
}
?>
 
Beispiel #15
0
function EnableSlide($slide_id)
{
    global $db;
    $lastspot = GetLastPosition();
    if ($lastspot >= MAX_SLIDES) {
        ReportError("There are already 6 active slides. You must disable one in order to enable another.");
        PageRedirect(3, "?op=newsreel");
        return;
    }
    $weight = $lastspot + 1;
    $db->Query("UPDATE `bayonet_newsreel` SET `visible` = 1, `weight` = '{$weight}' WHERE `slide_id` = '{$slide_id}' LIMIT 1");
    PageRedirect(0, "?op=newsreel");
}
Beispiel #16
0
function GetFleetConsumption($FleetArray, $SpeedFactor, $MissionDuration, $MissionDistance, $FleetMaxSpeed, $Player)
{
    $consumption = 0;
    $basicConsumption = 0;
    if (!is_array($FleetArray)) {
        ReportError("\$FleetArray is not an array, line 108, unlocalised.php", 'Invalid argument supplied for foreach()', 1);
    }
    foreach ($FleetArray as $Ship => $Count) {
        if ($Ship > 0) {
            $ShipSpeed = GetFleetMaxSpeed("", $Ship, $Player);
            $ShipConsumption = GetShipConsumption($Ship, $Player);
            $spd = 35000 / ($MissionDuration * $SpeedFactor - 10) * sqrt($MissionDistance * 10 / $ShipSpeed);
            $basicConsumption = $ShipConsumption * $Count;
            $consumption += $basicConsumption * $MissionDistance / 35000 * ($spd / 10 + 1) * ($spd / 10 + 1);
        }
    }
    $consumption = round($consumption) + 1;
    return $consumption;
}
 *
 * 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/>.
 */
$unit_id = $_GET['unit_id'];
$platoon_id = $_GET['platoon_id'];
switch ($_GET['info']) {
    case 'unit':
        if (isset($unit_id)) {
            include_once 'view.unit.php';
        }
        break;
    case 'platoon':
        if (isset($unit_id, $platoon_id)) {
            include_once 'view.platoon.php';
        }
        break;
    default:
        ReportError('Invalid info entry');
        return;
}
Beispiel #18
0
function GetBlocks($position = BLOCK_LEFT)
{
    global $config;
    /** 
     * I had to reconnect to the database for some f*****g reason at this point.
     * I have no idea why, but I was recieving errors telling me that $db was no longer
     * an object.  This is/was bullshit.
     */
    $db = new Bayonet_SQL();
    $db->Connect($config['sql']['hostname'], $config['sql']['username'], $config['sql']['password']);
    $db->Select_db($config['sql']['database']);
    $result = $db->Query("SELECT * FROM `bayonet_blocks` ORDER BY weight, position");
    $blocks = $db->Fetch($result);
    foreach ($blocks as $block) {
        if ($block['position'] == $position && $block['active'] == true) {
            $load = 'blocks/' . $block['dir_name'] . '/index.php';
            if (file_exists($load)) {
                OpenBlock($block['title']);
                include $load;
                CloseBlock();
            } else {
                ReportError("Failed to load block, '{$block['dir_name']}'.  Check block config.");
            }
            if ($config['blocks']['spacer']) {
                echo "<br />";
            }
        }
    }
}
Beispiel #19
0
function ResetPassword($user_id)
{
    global $db;
    $result = $db->Query("SELECT `username`, `email` FROM `bayonet_users` WHERE `user_id` = '{$user_id}' LIMIT 1");
    $admin = $db->FetchRow($result);
    decho($admin);
    if (isset($_POST['proceed'])) {
        $password = GeneratePassword(8);
        $cryptpassword = crypt(md5($password), 'iamnotadirtywhorebitch');
        $status = EmailPassword($admin['username'], $password, $admin['email']);
        if ($status) {
            $db->Query("UPDATE `bayonet_users` SET `password` = '{$cryptpassword}' WHERE `user_id` = '{$user_id}' LIMIT 1");
            echo "Password has been reset and emailed to '{$admin['username']}'";
            PageRedirect(3, "?op=admins");
        } else {
            ReportError("An error has occured emailing the new password. It will not take effect.");
        }
        return;
    }
    if (isset($_POST['cancel'])) {
        echo "The password <b>WILL NOT</b> be reset for '{$admin['username']}'";
        PageRedirect(3, "?op=admins");
        return;
    }
    ?>
	<center>
	<form action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
" method="post">
	<table>
	<th>Are you SURE you want to reset this user's password: '******'username'];
    ?>
'?</th>
	<tr><th><button name="proceed">Yes</button>&nbsp;&nbsp;&nbsp;<button name="cancel">No</button></th></tr>
	</table>
	</form>
	</center>
	<?php 
}
Beispiel #20
0
    }
    if (is_link($module_internal_file)) {
        decho("Refusing to follow symbolic link to '{$file}'");
        exit(1);
    }
}
/** Sanity Check
 * Determine if the module or file passed into $load actually exists
 * If everything checks out, load the module or file, else commit suicide.
 */
if (isset($load) && !empty($load) && !isset($file)) {
    if (file_exists($module_path)) {
        include $module_index;
        decho("'{$load}' module loaded");
    } else {
        ReportError("Cannot load module directory.<br>\n");
    }
} elseif (isset($load) && isset($file)) {
    if (file_exists($module_path)) {
        if (file_exists($module_internal_file)) {
            include $module_internal_file;
            decho("Loaded '{$file}' file from {$load} module");
        } else {
            ReportError("Cannot load module directory.<br>\n");
        }
    } else {
        ReportError("Cannot load module file.<br>\n");
    }
} else {
    ReportError("Failure to load module.<br>\n");
}
function DbUpdateVersion($con, $message)
{
    date_default_timezone_set('America/New_York');
    $version = date("Ymd_His");
    $message = rtrim($message);
    $sql_version_update = "INSERT INTO `version` (`id`,`version`,`update`) VALUES (NULL,'" . $version . "','" . $message . "');";
    if (!mysqli_query($con, $sql_version_update)) {
        ReportError("Error inserting version:" . mysqli_error($con), $con);
    }
    return;
}
Beispiel #22
0
} else {
    $id = $_GET['id'];
}
// {{{ XXX: FIXME -- Needs to be re-written
$result = $db->Query("SELECT u.username AS author, p.page_created, p.title, p.text FROM `bayonet_pages` AS p LEFT OUTER JOIN `bayonet_users` AS u ON u.user_id = p.author_id WHERE p.page_id = '{$id}'");
$proceed = $db->Rows($result);
if ($proceed > 0) {
    $page = $db->FetchRow($result);
    OpenContent();
    echo "<div class=\"contentHeading\">{$page['title']}</div>";
    echo "<div class=\"content\">";
    //echo "<h3>".$article['title']."</h3>";
    echo bbcode_format($page['text']);
    echo "</div>";
    echo "</div>";
    CloseContent();
    ?>
  <?php 
    // echo bbcode_format($page['text'])
    ?>
  <!-- <tr><th><?php 
    echo $page['author'];
    ?>
</th></tr> -->
  <?php 
} else {
    ReportError("Page does not exist.<br>\n");
}
?>