Exemplo n.º 1
0
function autoloadClasses($classname)
{
    switch ($classname) {
        // CONTROLLERS
        case 'AnnouncementController':
        case 'SessionController':
        case 'UserController':
            $classpath = 'controllers/';
            break;
            // DOMAIN CORE
        // DOMAIN CORE
        case 'Announcement':
        case 'Encryptor':
        case 'Role':
        case 'Roles':
        case 'Session':
        case 'User':
        case 'Validator':
            $classpath = 'domain/core/';
            break;
            // DOMAIN CORE SEEDS
        // DOMAIN CORE SEEDS
        case 'AnnouncementsRepository':
        case 'RolesRepository':
        case 'UserRepository':
            $classpath = 'domain/core/seeds/';
            break;
            // INFRASTRUCTURE
        // INFRASTRUCTURE
        case 'DBConnection':
            $classpath = 'infrastructure/';
            break;
        default:
            //an option is to search the classes directory for the class using readdir(), opendir(), and is_dir(). Should switch below to E_USER_WARNING if this is implemented
            trigger_error("{$classname} was not found in the list of classes. Please add {$classname} to autoloadClasses()", E_USER_ERROR);
    }
    gtRequireOnce('classes/' . $classpath . $classname . '.class.php');
}
Exemplo n.º 2
0
<?php

require $_SERVER['DOCUMENT_ROOT'] . "/resources/scripts/initialize.php";
gtRequireOnce("scripts/requireAdmin.php");
if (isset($_POST)) {
}
?>

<!DOCTYPE html>

<html>
<head>
	<title>Login</title>
	<?php 
gtInclude("includes/head.php");
?>
</head>
<body>
<div id="main">
	<?php 
gtInclude("includes/top.php");
?>
	<div class="primaryFGColor contentBox">
		<h2>Add Announcement</h2>
		<form id="frmAnnouncement" name="frmAnnouncement" method="post" action="add-announcement.php">
			<table>
				<tr>
					<td>Title:</td>
					<td><input id="title" name="title" type="text" size="100" maxlength="255" autofocus="autofocus" /></td>
				</tr>
				<tr>
Exemplo n.º 3
0
<?php

require $_SERVER['DOCUMENT_ROOT'] . "/resources/scripts/initialize.php";
gtRequireOnce("scripts/requireLogin.php");
?>

<!DOCTYPE html>

<html>
<head>
	<title>Login</title>
	<?php 
gtInclude("includes/head.php");
?>
</head>
<body>
<div id="main">
	<?php 
gtInclude("includes/top.php");
?>
	<div class="primaryFGColor contentBox">
		Welcome <?php 
print SessionController::getCurrentUsersUsername();
?>
!
	</div>
	<?php 
gtInclude("includes/foot.php");
?>
</div>
</body>
Exemplo n.º 4
0
<?php

if (!SessionController::userIsLoggedIn()) {
    gtRequireOnce("constants.php");
    global $SERVER;
    header("Location: http://" . $SERVER . "/users/login.php?returnURL=" . $_SERVER['PHP_SELF']);
}
Exemplo n.º 5
0
<?php

//receives the post data from /suggest.php then redirects to /suggest.php with a response
require $_SERVER['DOCUMENT_ROOT'] . "/resources/scripts/initialize.php";
gtRequireOnce('scripts/startSession.php');
gtRequireOnce('constants.php');
extract($_POST);
$mailSuccessful = mail("*****@*****.**", $subject, $message);
$_SESSION['success'] = $mailSuccessful;
if ($mailSuccessful) {
    $_SESSION['message'] = "Your suggestion was successfully sent!\n\t\t\t\t\t\t\t\tNote: abusing this suggestion system will result in a permanent ban on your account.";
} else {
    $_SESSION['message'] = "An error occurred while sending your suggestion.\n\t\t\t\t\t\t\t\tPlease try again later or contact the web developer if the problem persists.";
}
header("Location: http://" . $SERVER . "/suggest.php");