Start of IT Club Source Code
This commit is contained in:
commit
d68d16a9f5
1
License.txt
Normal file
1
License.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1
Readme.md
Normal file
1
Readme.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is the source code for https://it.gec.im which is Calhoun's IT Club website. Anyone is free to use as long as the license is followed.
|
6
code/.htaccess
Normal file
6
code/.htaccess
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Options -Indexes
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteRule . ../index.php [L]
|
||||||
|
</IfModule>
|
79
code/announcements.php
Normal file
79
code/announcements.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// announcements.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This is the announcements management page.
|
||||||
|
//
|
||||||
|
|
||||||
|
require_once("header.php");
|
||||||
|
?>
|
||||||
|
<div id="announcement_add" class="modal hide fade" tabindex="-1" role="dialog" style="width: 260px; margin-left: -130px;">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h3 id="myModalLabel">Send Announcement</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="text" id="announcement_add_subject" placeholder="Subject" /><br />
|
||||||
|
<label for="announcement_add_message">Message</label>
|
||||||
|
<textarea id="announcement_add_message" placeholder="Message"></textarea>
|
||||||
|
<label for="announcement_add_smsmessage">SMS Message</label>
|
||||||
|
<textarea id="announcement_add_smsmessage" placeholder="SMS Message" disabled></textarea>
|
||||||
|
<br /><span id="announcement_add_sms_limit" class="pull-right">160</span>
|
||||||
|
<span id="announcement_add_load"></span>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button class="btn btn-primary" id="announcement_add_create">Send</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary" id="add">Send Announcement</button>
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="announcement_list">
|
||||||
|
<thead>
|
||||||
|
<tr><th>#</th><th>Email</th><th>Subject</th><th>Message</th><th>SMS Message</th><th>Date</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function loadAnnouncements() {
|
||||||
|
$("#announcement_list tbody").load("<?=generateURL("api/announcements/list")?>/", function(response, status, xhr) {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#add").click(function() {
|
||||||
|
$("#announcement_add").modal();
|
||||||
|
});
|
||||||
|
$("#announcement_add_create").click(function() {
|
||||||
|
if ($("#announcement_add_smsmessage").val().length>160) {
|
||||||
|
alert("SMS Message is too big, cannot send.");
|
||||||
|
} else {
|
||||||
|
$("#announcement_add_load").load("<?=generateURL("api/announcements/send")?>/", {subject: $("#announcement_add_subject").val(), message: $("#announcement_add_message").val(), smsmessage: $("#announcement_add_smsmessage").val()}, function(response, status, xhr) {
|
||||||
|
if ($("#announcement_add_load").text()=="Successfully Sent.") {
|
||||||
|
$("#announcement_add_subject").val("");
|
||||||
|
$("#announcement_add_message").val("");
|
||||||
|
$("#announcement_add_smsmessage").val("");
|
||||||
|
$("#announcement_add").modal("hide");
|
||||||
|
}
|
||||||
|
loadAnnouncements();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
loadAnnouncements();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#announcement_add_smsmessage").bind("input propertychange", function() {
|
||||||
|
$("#announcement_add_sms_limit").text(160-$(this).val().length);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
?>
|
411
code/api.php
Normal file
411
code/api.php
Normal file
@ -0,0 +1,411 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// api.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// The main API for managing different sections of the site.
|
||||||
|
//
|
||||||
|
|
||||||
|
if ($_REQUEST['authentication']==$_MGM['apiAuthentication'] && $_MGM['path'][1]=="email") {
|
||||||
|
$results = databaseQuery("SELECT * FROM members WHERE preferredMethod='Email' OR preferredMethod='Both'");
|
||||||
|
$members = array();
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
array_push($members, $result);
|
||||||
|
}
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
echo json_encode($members);
|
||||||
|
}
|
||||||
|
if ($_REQUEST['authentication']==$_MGM['apiAuthentication'] && $_MGM['path'][1]=="text") {
|
||||||
|
$results = databaseQuery("SELECT * FROM members WHERE preferredMethod='Text' OR preferredMethod='Both'");
|
||||||
|
$members = array();
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
array_push($members, $result);
|
||||||
|
}
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
echo json_encode($members);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][1]=="settings") {
|
||||||
|
if ($_MGM['path'][2]=="save") {
|
||||||
|
$email = (isset($_REQUEST['email']) ? trim($_REQUEST['email']) : "");
|
||||||
|
$replyToEmail = (isset($_REQUEST['replyToEmail']) ? trim($_REQUEST['replyToEmail']) : "");
|
||||||
|
|
||||||
|
setSetting("email", $email);
|
||||||
|
setSetting("replyToEmail", $replyToEmail);
|
||||||
|
}
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][1]=="sidebar") {
|
||||||
|
if ($_MGM['path'][2]=="list") {
|
||||||
|
$results = databaseQuery("SELECT * FROM `sidebar` ORDER BY `order`");
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
?><tr><td class="id"><?=htmlspecialchars($result['id'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="title"><?=htmlspecialchars($result['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="url"><?=htmlspecialchars($result['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="order"><?=htmlspecialchars($result['order'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td></tr><?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_MGM['path'][2]=="update") {
|
||||||
|
$id = (isset($_REQUEST['id']) ? trim($_REQUEST['id']) : "");
|
||||||
|
$title = (isset($_REQUEST['title']) ? trim($_REQUEST['title']) : "");
|
||||||
|
$url = (isset($_REQUEST['url']) ? trim($_REQUEST['url']) : "");
|
||||||
|
$order = (isset($_REQUEST['order']) ? trim($_REQUEST['order']) : "");
|
||||||
|
$results = databaseQuery("SELECT * FROM `sidebar` WHERE `id`=%s", $id);
|
||||||
|
$result = databaseFetchAssoc($results);
|
||||||
|
if ($result!=NULL) {
|
||||||
|
databaseQuery("UPDATE `sidebar` SET `title`=%s,`url`=%s,`order`=%s WHERE `id`=%s", $title, $url, $order, $id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_MGM['path'][2]=="delete") {
|
||||||
|
$id = (isset($_REQUEST['id']) ? trim($_REQUEST['id']) : "");
|
||||||
|
$results = databaseQuery("SELECT * FROM `sidebar` WHERE `id`=%s", $id);
|
||||||
|
$result = databaseFetchAssoc($results);
|
||||||
|
if ($result!=NULL) {
|
||||||
|
databaseQuery("DELETE FROM `sidebar` WHERE `id`=%s", $id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_MGM['path'][2]=="add") {
|
||||||
|
$title = (isset($_REQUEST['title']) ? trim($_REQUEST['title']) : "");
|
||||||
|
$url = (isset($_REQUEST['url']) ? trim($_REQUEST['url']) : "");
|
||||||
|
$order = (isset($_REQUEST['order']) ? trim($_REQUEST['order']) : "");
|
||||||
|
if (!empty($title) && !empty($url)) {
|
||||||
|
databaseQuery("INSERT INTO `sidebar` (`title`, `url`, `order`) VALUES (%s,%s,%s)", $title, $url, $order);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][1]=="users") {
|
||||||
|
if ($_MGM['path'][2]=="list") {
|
||||||
|
$results = databaseQuery("SELECT * FROM users");
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
$level = "Normal";
|
||||||
|
if ($result['level']==0)
|
||||||
|
$level = "Disabled";
|
||||||
|
if ($result['level']==1)
|
||||||
|
$level = "Administrator";
|
||||||
|
?><tr><td class="id"><?=htmlspecialchars($result['docid'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="email"><?=htmlspecialchars($result['email'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="level" value="<?=htmlspecialchars($result['level'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?>"><?=$level?></td></tr><?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_MGM['path'][2]=="update") {
|
||||||
|
$id = (isset($_REQUEST['id']) ? trim($_REQUEST['id']) : "");
|
||||||
|
$email = (isset($_REQUEST['email']) ? trim($_REQUEST['email']) : "");
|
||||||
|
$password = (isset($_REQUEST['password']) ? trim($_REQUEST['password']) : "");
|
||||||
|
$level = (isset($_REQUEST['level']) ? trim($_REQUEST['level']) : "");
|
||||||
|
$results = databaseQuery("SELECT * FROM users WHERE docid=%s", $id);
|
||||||
|
$result = databaseFetchAssoc($results);
|
||||||
|
if ($result!=NULL) {
|
||||||
|
if (empty($email))
|
||||||
|
$email = $result['email'];
|
||||||
|
$epassword = $result['password'];
|
||||||
|
if (!empty($password)) {
|
||||||
|
$salt = substr(sha1(rand()),0,12);
|
||||||
|
$epassword = $salt.hashPassword($password,hex2bin($salt));
|
||||||
|
}
|
||||||
|
if ($level=="")
|
||||||
|
$level = $result['level'];
|
||||||
|
databaseQuery("UPDATE users SET email=%s,password=%s,level=%s WHERE docid=%s", $email, $epassword, $level, $id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_MGM['path'][2]=="create") {
|
||||||
|
$email = (isset($_REQUEST['email']) ? trim($_REQUEST['email']) : "");
|
||||||
|
$password = (isset($_REQUEST['password']) ? trim($_REQUEST['password']) : "");
|
||||||
|
$level = (isset($_REQUEST['level']) ? trim($_REQUEST['level']) : "");
|
||||||
|
if (!empty($email) && !empty($level)) {
|
||||||
|
$salt = substr(sha1(rand()),0,12);
|
||||||
|
$epassword = $salt.hashPassword($password,hex2bin($salt));
|
||||||
|
databaseQuery("INSERT INTO users (email, password, time, level) VALUES (%s,%s,%s,%s)", $email, $epassword, $_MGM['time'], $level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
if (isset($_MGM['user']) && $_MGM['path'][1]=="members") {
|
||||||
|
if ($_MGM['path'][2]=="list") {
|
||||||
|
$results = databaseQuery("SELECT * FROM members");
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
?><tr><td class="id"><?=htmlspecialchars($result['id'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="name"><?=htmlspecialchars($result['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="position"><?=htmlspecialchars($result['position'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="phone"><?=htmlspecialchars($result['phone'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="email"><?=htmlspecialchars($result['email'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="preferredMethod"><?=htmlspecialchars($result['preferredMethod'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td></tr><?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_MGM['path'][2]=="download") {
|
||||||
|
function csvQuote($text) {
|
||||||
|
return "\"".str_replace("\"", "\"\"", $text)."\"";
|
||||||
|
}
|
||||||
|
echo "#,Name,Position,Phone,Email,Preferred Method\n";
|
||||||
|
|
||||||
|
$results = databaseQuery("SELECT * FROM data");
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
header("Pragma: public");
|
||||||
|
header("Expires: 0");
|
||||||
|
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||||
|
header("Content-Description: File Transfer");
|
||||||
|
header("Content-Disposition: inline; filename=\"".date("Y m d")." Data.csv\";" );
|
||||||
|
header("Content-Transfer-Encoding: binary");
|
||||||
|
header("Content-Type: application/csv");
|
||||||
|
|
||||||
|
$shirts = "";
|
||||||
|
$selectedShirts = json_decode($result['shirts']);
|
||||||
|
for ($i=0; $i<count($selectedShirts); $i++) {
|
||||||
|
if ($i!=0)
|
||||||
|
$shirts .= ", ";
|
||||||
|
$shirts .= $allShirts[$selectedShirts[$i]];
|
||||||
|
}
|
||||||
|
echo $result['id'].",".csvQuote($result['name']).",".csvQuote($result['position']).",".csvQuote($result['phone']).",".csvQuote($result['email']).",".csvQuote($result['preferredMethod']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_MGM['path'][2]=="upload") {
|
||||||
|
$uploadPath = "/tmp/itmembersupload.csv";
|
||||||
|
$input = fopen("php://input", "r");
|
||||||
|
if (file_exists($uploadPath))
|
||||||
|
unlink($uploadPath);
|
||||||
|
$output = fopen($uploadPath, "w");
|
||||||
|
|
||||||
|
while ($data = fread($input, 1024))
|
||||||
|
fwrite($output, $data);
|
||||||
|
|
||||||
|
fclose($output);
|
||||||
|
fclose($input);
|
||||||
|
|
||||||
|
$handle = fopen($uploadPath, "r");
|
||||||
|
$headers = array();
|
||||||
|
$readHeaders = false;
|
||||||
|
$entries = array();
|
||||||
|
while (($data = fgetcsv($handle, 1000, ",")) !== false) {
|
||||||
|
if (count($data)==5) {
|
||||||
|
if (!$readHeaders) {
|
||||||
|
for ($i=0; $i<count($data); $i++) {
|
||||||
|
if (preg_match("/Name/i", $data[$i])) {
|
||||||
|
$headers['name'] = $i;
|
||||||
|
} else if (preg_match("/Position/i", $data[$i])) {
|
||||||
|
$headers['position'] = $i;
|
||||||
|
} else if (preg_match("/Phone/i", $data[$i])) {
|
||||||
|
$headers['phone'] = $i;
|
||||||
|
} else if (preg_match("/Email/i", $data[$i])) {
|
||||||
|
$headers['email'] = $i;
|
||||||
|
} else if (preg_match("/Preferred/i", $data[$i])) {
|
||||||
|
$headers['preferredMethod'] = $i;
|
||||||
|
} else {
|
||||||
|
echo "Unknown column header: ".$data[$i]."\n";
|
||||||
|
unlink($uploadPath);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$readHeaders = true;
|
||||||
|
} else {
|
||||||
|
if (count($headers)!=5) {
|
||||||
|
echo "Bad header count: ".count($headers)."\n";
|
||||||
|
unlink($uploadPath);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$entry = array();
|
||||||
|
$entry['name'] = $data[$headers['name']];
|
||||||
|
$entry['position'] = $data[$headers['position']];
|
||||||
|
$entry['phone'] = preg_replace("/[^0-9]/", "", $data[$headers['phone']]);
|
||||||
|
$entry['email'] = $data[$headers['email']];
|
||||||
|
$entry['preferredMethod'] = $data[$headers['preferredMethod']];
|
||||||
|
array_push($entries, $entry);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Bad column count: ".count($data)."\n";
|
||||||
|
unlink($uploadPath);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
databaseQuery("DELETE FROM members");
|
||||||
|
databaseQuery("ALTER TABLE members AUTO_INCREMENT=1");
|
||||||
|
for ($i=0; $i<count($entries); $i++) {
|
||||||
|
$entry = $entries[$i];
|
||||||
|
databaseQuery("INSERT INTO members (name,position,phone,email,preferredMethod) VALUES(%s,%s,%s,%s,%s)", $entry['name'], $entry['position'], $entry['phone'], $entry['email'], $entry['preferredMethod']);
|
||||||
|
}
|
||||||
|
|
||||||
|
unlink($uploadPath);
|
||||||
|
echo "uploaded";
|
||||||
|
}
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
if (isset($_MGM['user']) && $_MGM['path'][1]=="meetings") {
|
||||||
|
if ($_MGM['path'][2]=="list") {
|
||||||
|
$results = databaseQuery("SELECT * FROM meetings");
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
$rsvps = databaseQuery("SELECT SUM(IF(choice=0,1,0)) AS going,SUM(IF(choice=1,1,0)) AS maybe,SUM(1) AS responses FROM rsvp WHERE meeting=%s", $result['id']);
|
||||||
|
$rsvp = databaseFetchAssoc($rsvps);
|
||||||
|
?><tr><td class="id"><?=htmlspecialchars($result['id'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="date"><?=date("l M j, h:i A", $result['date'])?></td><td class="location"><?=htmlspecialchars($result['location'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="rsvp">G <?=$rsvp['going']?> M <?=$rsvp['maybe']?> R <?=$rsvp['responses']?></td><td class="options"><button class="btn btn-info edit">Edit</button><button class="btn btn-success view">View RSVP</button><button class="btn btn-primary rsvp">RSVP</button></td></tr><?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_MGM['path'][2]=="add") {
|
||||||
|
$date = (isset($_REQUEST['date']) ? trim($_REQUEST['date']) : "");
|
||||||
|
$location = (isset($_REQUEST['location']) ? trim($_REQUEST['location']) : "");
|
||||||
|
|
||||||
|
$time = strtotime($date);
|
||||||
|
if ($time==0) {
|
||||||
|
echo "Bad date.";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($location)) {
|
||||||
|
databaseQuery("INSERT INTO meetings (date, location) VALUES (%s,%s)", $time, $location);
|
||||||
|
echo "Successfully Added.";
|
||||||
|
} else {
|
||||||
|
echo "Missing Data.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_MGM['path'][2]=="save") {
|
||||||
|
$id = (isset($_REQUEST['id']) ? trim($_REQUEST['id']) : "");
|
||||||
|
$date = (isset($_REQUEST['date']) ? trim($_REQUEST['date']) : "");
|
||||||
|
$location = (isset($_REQUEST['location']) ? trim($_REQUEST['location']) : "");
|
||||||
|
|
||||||
|
$time = strtotime($date);
|
||||||
|
if ($time==0) {
|
||||||
|
echo "Bad date.";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($id) && intVal($id)!=0 && !empty($location)) {
|
||||||
|
databaseQuery("UPDATE meetings SET date=%s,location=%s WHERE id=%s", $time, $location, $id);
|
||||||
|
echo "Successfully Saved.";
|
||||||
|
} else {
|
||||||
|
echo "Missing Data.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_MGM['path'][2]) && intVal($_MGM['path'][2])!=0) {
|
||||||
|
$id = intVal($_MGM['path'][2]);
|
||||||
|
if ($_MGM['path'][3]=="list") {
|
||||||
|
$results = databaseQuery("SELECT * FROM rsvp WHERE meeting=%s", $id);
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
?><tr><td class="id"><?=htmlspecialchars($result['id'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="date"><?=date("m/d/y h:i:s A", $result['date'])?></td><td class="name"><?=htmlspecialchars($result['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="contact"><?=htmlspecialchars($result['contact'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="rsvp"><?=($result['choice']==0 ? "Going" : ($result['choice']==1 ? "Maybe" : "Not Attending"))?></td><td class="options"><button class="btn btn-success going">Going</button><button class="btn btn-info maybe">Maybe</button><button class="btn btn-danger not_attending">Not Attending</button></td></tr><?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_MGM['path'][3]=="going") {
|
||||||
|
$rsvpID = (isset($_REQUEST['id']) ? trim($_REQUEST['id']) : "");
|
||||||
|
|
||||||
|
if (!empty($rsvpID) && intVal($id)!=0) {
|
||||||
|
databaseQuery("UPDATE rsvp SET choice=0 WHERE id=%s", $rsvpID);
|
||||||
|
} else {
|
||||||
|
echo "Missing Data.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_MGM['path'][3]=="maybe") {
|
||||||
|
$rsvpID = (isset($_REQUEST['id']) ? trim($_REQUEST['id']) : "");
|
||||||
|
|
||||||
|
if (!empty($rsvpID) && intVal($id)!=0) {
|
||||||
|
databaseQuery("UPDATE rsvp SET choice=1 WHERE id=%s", $rsvpID);
|
||||||
|
} else {
|
||||||
|
echo "Missing Data.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_MGM['path'][3]=="not_attending") {
|
||||||
|
$rsvpID = (isset($_REQUEST['id']) ? trim($_REQUEST['id']) : "");
|
||||||
|
|
||||||
|
if (!empty($rsvpID) && intVal($rsvpID)!=0) {
|
||||||
|
databaseQuery("UPDATE rsvp SET choice=3 WHERE id=%s", $rsvpID);
|
||||||
|
} else {
|
||||||
|
echo "Missing Data.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($_MGM['user']) && $_MGM['path'][1]=="announcements") {
|
||||||
|
if ($_MGM['path'][2]=="list") {
|
||||||
|
$results = databaseQuery("SELECT *,(SELECT email FROM users WHERE user=docid) AS email FROM announcements");
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
?><tr><td class="id"><?=htmlspecialchars($result['id'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="email"><?=htmlspecialchars($result['email'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="subject"><?=htmlspecialchars($result['subject'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="message"><?=str_replace("\n","<br />",htmlspecialchars($result['message'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true))?></td><td class="sms"><?=htmlspecialchars($result['sms'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="date"><?=date("m/d/y h:i:s A", $result['date'])?></td></tr><?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_MGM['path'][2]=="send") {
|
||||||
|
$subject = (isset($_REQUEST['subject']) ? trim($_REQUEST['subject']) : "");
|
||||||
|
$message = (isset($_REQUEST['message']) ? trim($_REQUEST['message']) : "");
|
||||||
|
$smsmessage = (isset($_REQUEST['smsmessage']) ? trim($_REQUEST['smsmessage']) : "");
|
||||||
|
|
||||||
|
if (strlen($smsmessage)>160) {
|
||||||
|
echo "SMS Message it too long.";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!empty($subject) && !empty($message)) || !empty($smsmessage)) {
|
||||||
|
databaseQuery("INSERT INTO announcements (user, subject, message, sms, date) VALUES (%s,%s,%s,%s,%s)", $_MGM['user']['docid'], $subject, $message, $smsmessage, $_MGM['time']);
|
||||||
|
|
||||||
|
$email = getSetting("email");
|
||||||
|
$replyToEmail = getSetting("replyToEmail");
|
||||||
|
|
||||||
|
if (!empty($subject) && !empty($message)) {
|
||||||
|
$headers = "From: ".$email."\r\n";
|
||||||
|
$headers .= "Reply-to: ".$replyToEmail."\r\n";
|
||||||
|
|
||||||
|
$results = databaseQuery("SELECT * FROM members WHERE preferredMethod='Email' OR preferredMethod='Both'");
|
||||||
|
$oneSuccessful = false;
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
$address = $result['email'];
|
||||||
|
if (mail($address, $subject, $message, $headers)) {
|
||||||
|
$oneSuccessful = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($oneSuccessful) {
|
||||||
|
echo "Successfully Sent.";
|
||||||
|
} else {
|
||||||
|
echo "Failure sending email.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($smsmessage)) {
|
||||||
|
echo "SMS not implemented.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Missing Data.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_MGM['path'][1]=="rsvp") {
|
||||||
|
if ($_MGM['path'][2]=="list") {
|
||||||
|
$results = databaseQuery("SELECT * FROM meetings WHERE date>=%d", $_MGM['time']);
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
?><tr><td class="id"><?=htmlspecialchars($result['id'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td><td class="date"><?=date("l M j, h:i A", $result['date'])?></td><td class="location"><?=htmlspecialchars($result['location'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></td></tr><?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_MGM['path'][2]) && intVal($_MGM['path'][2])!=0) {
|
||||||
|
$id = intVal($_MGM['path'][2]);
|
||||||
|
|
||||||
|
if ($_MGM['path'][3]=="submit") {
|
||||||
|
$name = (isset($_REQUEST['name']) ? trim($_REQUEST['name']) : "");
|
||||||
|
$contact = (isset($_REQUEST['contact']) ? trim($_REQUEST['contact']) : "");
|
||||||
|
$choice = (isset($_REQUEST['choice']) ? trim($_REQUEST['choice']) : "");
|
||||||
|
|
||||||
|
if ((empty($choice) && $choice!=0) || empty($name)) {
|
||||||
|
?><span style="color: #ff0000">Missing fields.</span><?
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!filter_var($contact, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$contact = preg_replace("/[^0-9]/", "", $contact);
|
||||||
|
if (strlen($contact)==7) {
|
||||||
|
$contact = "256".$contact;
|
||||||
|
} else if (strlen($contact)!=10) {
|
||||||
|
?><span style="color: #ff0000">Invalid contact info.</span><?
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rsvps = databaseQuery("SELECT * FROM rsvp WHERE meeting=%s AND contact=%s", $id, $contact);
|
||||||
|
$rsvp = databaseFetchAssoc($rsvps);
|
||||||
|
if ($rsvp!=NULL) {
|
||||||
|
databaseQuery("UPDATE rsvp SET choice=%s WHERE meeting=%s AND contact=%s", $choice, $id, $contact);
|
||||||
|
?><span style="color: #00ff00">Your RSVP was updated.</span><?
|
||||||
|
} else {
|
||||||
|
databaseQuery("INSERT INTO rsvp (meeting,name,contact,choice,date) VALUES (%s,%s,%s,%s,%s)", $id, $name, $contact, $choice, $_MGM['time']);
|
||||||
|
?><span style="color: #00ff00">Your RSVP was submitted.</span><?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit();
|
||||||
|
?>
|
0
code/index.html
Normal file
0
code/index.html
Normal file
49
code/login.php
Normal file
49
code/login.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// login.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// The log in page.
|
||||||
|
//
|
||||||
|
|
||||||
|
$error = "";
|
||||||
|
if (isset($_REQUEST['login'])) {
|
||||||
|
$email = (isset($_REQUEST['email']) ? trim($_REQUEST['email']) : "");
|
||||||
|
$password = (isset($_REQUEST['password']) ? trim($_REQUEST['password']) : "");
|
||||||
|
|
||||||
|
$result = databaseQuery("SELECT * FROM users WHERE email=%s AND level!=0", $email);
|
||||||
|
$user = databaseFetchAssoc($result);
|
||||||
|
if ($user==NULL) {
|
||||||
|
$error = "Invalid login credentials.";
|
||||||
|
} else {
|
||||||
|
$salt = substr($user['password'], 0, 12);
|
||||||
|
$epassword = $salt.hashPassword($password,hex2bin($salt));
|
||||||
|
if ($epassword!=$user['password']) {
|
||||||
|
$error = "Invalid login credentials.";
|
||||||
|
} else {
|
||||||
|
databaseQuery("UPDATE users SET time=%d WHERE email=%s", $_MGM['time'], $email);
|
||||||
|
setcookie("{$_MGM['CookiePrefix']}user_email", $email, $_MGM['time']+31536000, $_MGM['CookiePath'], $_MGM['CookieDomain']);
|
||||||
|
setcookie("{$_MGM['CookiePrefix']}user_password", hash("sha512", $epassword.$_MGM['time']), $_MGM['time']+31536000, $_MGM['CookiePath'], $_MGM['CookieDomain']);
|
||||||
|
header("location: ".generateURL("members"));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
require_once("header.php");
|
||||||
|
if (!empty($error)) {
|
||||||
|
?><div style="color: #ff0000; font-weight: bold;"><?=$error?></div><?
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<form action="<?=generateURL("login")?>" method="POST">
|
||||||
|
<input type="hidden" name="login" value="true" />
|
||||||
|
<input type="email" placeholder="Email" name="email" /><br />
|
||||||
|
<input type="password" placeholder="Password" name="password" /><br />
|
||||||
|
<input type="submit" value="Login" class="btn" />
|
||||||
|
</form>
|
||||||
|
<?
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
?>
|
17
code/logout.php
Normal file
17
code/logout.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// logout.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// The log out page.
|
||||||
|
//
|
||||||
|
|
||||||
|
databaseQuery("UPDATE users SET time=%d WHERE docid=%s", $_MGM['time'], $_MGM['user']['docid']);
|
||||||
|
setcookie("{$_MGM['CookiePrefix']}user_email", "", $_MGM['time'], $_MGM['CookiePath'], $_MGM['CookieDomain']);
|
||||||
|
setcookie("{$_MGM['CookiePrefix']}user_password", "", $_MGM['time'], $_MGM['CookiePath'], $_MGM['CookieDomain']);
|
||||||
|
header("location: ".generateURL("login"));
|
||||||
|
exit();
|
||||||
|
?>
|
150
code/meetings.php
Normal file
150
code/meetings.php
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// meetings.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Meeting management page.
|
||||||
|
//
|
||||||
|
|
||||||
|
require_once("header.php");
|
||||||
|
if (!empty($_MGM['path'][1]) && intVal($_MGM['path'][1])!=0) {
|
||||||
|
?>
|
||||||
|
<span id="update_rsvp"></span>
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="meting_list">
|
||||||
|
<thead>
|
||||||
|
<tr><th>#</th><th>Date</th><th>Name</th><th>Contact</th><th>RSVP</th><th>Options</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function loadMeeting() {
|
||||||
|
$("#meting_list tbody").load("<?=generateURL("api/meetings/".$_MGM['path'][1]."/list")?>/", function(response, status, xhr) {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#meting_list").on("click", ".going", function() {
|
||||||
|
$("#update_rsvp").load("<?=generateURL("api/meetings/".$_MGM['path'][1]."/going")?>", {id: $(this).parent().parent().find(".id").text()}, function(response, status, xhr) {
|
||||||
|
loadMeeting();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#meting_list").on("click", ".maybe", function() {
|
||||||
|
$("#update_rsvp").load("<?=generateURL("api/meetings/".$_MGM['path'][1]."/maybe")?>", {id: $(this).parent().parent().find(".id").text()}, function(response, status, xhr) {
|
||||||
|
loadMeeting();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#meting_list").on("click", ".not_attending", function() {
|
||||||
|
$("#update_rsvp").load("<?=generateURL("api/meetings/".$_MGM['path'][1]."/not_attending")?>", {id: $(this).parent().parent().find(".id").text()}, function(response, status, xhr) {
|
||||||
|
loadMeeting();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
loadMeeting();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<div id="meeting_edit" class="modal hide fade" tabindex="-1" role="dialog" style="width: 260px; margin-left: -130px;">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h3 id="myModalLabel">Edit Meeting</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div style="display: none;" id="meeting_edit_id"></div>
|
||||||
|
<input type="text" id="meeting_edit_date" placeholder="Date" /><br />
|
||||||
|
<input type="text" id="meeting_edit_location" placeholder="Location" />
|
||||||
|
<span id="meeting_edit_load"></span>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button class="btn btn-primary" data-dismiss="modal" id="meeting_edit_save">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="meeting_add" class="modal hide fade" tabindex="-1" role="dialog" style="width: 260px; margin-left: -130px;">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h3 id="myModalLabel">Add Meeting</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="text" id="meeting_add_date" placeholder="Date" /><br />
|
||||||
|
<input type="text" id="meeting_add_location" placeholder="Location" />
|
||||||
|
<span id="meeting_add_load"></span>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button class="btn btn-primary" id="meeting_add_create">Add</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span class="pull-right">G = Going, M = Maybe, R = Responses</span>
|
||||||
|
<button class="btn btn-primary" id="add">Add Meeting</button>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
#meting_list .options {
|
||||||
|
width: 240px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="meting_list">
|
||||||
|
<thead>
|
||||||
|
<tr><th>#</th><th>Date</th><th>Location</th><th>RSVP</th><th>Options</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function loadMeetings() {
|
||||||
|
$("#meting_list tbody").load("<?=generateURL("api/meetings/list")?>/", function(response, status, xhr) {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#add").click(function() {
|
||||||
|
$("#meeting_add").modal();
|
||||||
|
});
|
||||||
|
$("#meeting_add_create").click(function() {
|
||||||
|
$("#meeting_add_load").load("<?=generateURL("api/meetings/add")?>/", {date: $("#meeting_add_date").val(), location: $("#meeting_add_location").val()}, function(response, status, xhr) {
|
||||||
|
if ($("#meeting_add_load").text()=="Successfully Added.") {
|
||||||
|
$("#meeting_add_date").val("");
|
||||||
|
$("#meeting_add_location").val("");
|
||||||
|
$("#meeting_add").modal("hide");
|
||||||
|
}
|
||||||
|
loadMeetings();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#meting_list").on("click", ".edit", function() {
|
||||||
|
$("#meeting_edit_id").text($(this).parent().parent().find(".id").text());
|
||||||
|
$("#meeting_edit_date").val($(this).parent().parent().find(".date").text());
|
||||||
|
$("#meeting_edit_location").val($(this).parent().parent().find(".location").text());
|
||||||
|
$("#meeting_edit").modal();
|
||||||
|
});
|
||||||
|
$("#meeting_edit_save").click(function() {
|
||||||
|
$("#meeting_edit_load").load("<?=generateURL("api/meetings/save")?>/", {id: $("#meeting_edit_id").text(), date: $("#meeting_edit_date").val(), location: $("#meeting_edit_location").val()}, function(response, status, xhr) {
|
||||||
|
if ($("#meeting_edit_load").text()=="Successfully Saved.") {
|
||||||
|
$("#meeting_edit").modal("hide");
|
||||||
|
}
|
||||||
|
loadMeetings();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#meting_list").on("click", ".view", function() {
|
||||||
|
window.location = "<?=generateURL("meetings/")?>"+$(this).parent().parent().find(".id").text();
|
||||||
|
});
|
||||||
|
$("#meting_list").on("click", ".rsvp", function() {
|
||||||
|
window.location = "<?=generateURL("rsvp/")?>"+$(this).parent().parent().find(".id").text();
|
||||||
|
});
|
||||||
|
|
||||||
|
loadMeetings();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
}
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
?>
|
88
code/members.php
Normal file
88
code/members.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// members.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Memeber management page.
|
||||||
|
//
|
||||||
|
|
||||||
|
require_once("header.php");
|
||||||
|
?>
|
||||||
|
<div id="entries_upload" class="modal fade" tabindex="-1" role="dialog" style="width: 270px; margin-left: -140px;">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3>Upload Entries</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form>
|
||||||
|
<input type="file" id="upload_files" />
|
||||||
|
</form>
|
||||||
|
<span id="entries_upload_load"></span>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button class="btn btn-primary" id="entries_upload_create">Upload</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-primary" id="upload">Upload updated list</button>
|
||||||
|
<button class="btn" id="download">Download as Spreadsheet</button>
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="member_list">
|
||||||
|
<thead>
|
||||||
|
<tr><th>#</th><th>Name</th><th>Position</th><th>Phone</th><th>Email</th><th>Preferred Method</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function loadMembers() {
|
||||||
|
$("#member_list tbody").load("<?=generateURL("api/members/list")?>/", function(response, status, xhr) {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#download").click(function() {
|
||||||
|
window.location = "<?=generateURL("api/members/download")?>";
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#upload").click(function() {
|
||||||
|
$("#entries_upload").modal();
|
||||||
|
});
|
||||||
|
$("#entries_upload_create").click(function() {
|
||||||
|
$("#upload_files").attr("disabled", "true");
|
||||||
|
$("#entries_upload_create").attr("disabled", "true");
|
||||||
|
var file = $("#upload_files")[0].files[0];
|
||||||
|
if (file.name==undefined) {
|
||||||
|
alert("Error: Browser unsupported.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var request = new XMLHttpRequest;
|
||||||
|
request.onreadystatechange = function() {
|
||||||
|
if (request.readyState==4) {
|
||||||
|
$("#entries_upload_load").text(request.responseText);
|
||||||
|
$("#upload_files")[0].form.reset();
|
||||||
|
$("#upload_files").removeAttr("disabled");
|
||||||
|
$("#entries_upload_create").removeAttr("disabled");
|
||||||
|
loadMembers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
request.open("post", "<?=generateURL("api/members/upload")?>", true);
|
||||||
|
request.setRequestHeader("Cache-Control", "no-cache");
|
||||||
|
request.setRequestHeader("X-FILENAME", file.name);
|
||||||
|
request.setRequestHeader("Content-Type", "multipart/form-data");
|
||||||
|
request.send(file);
|
||||||
|
});
|
||||||
|
loadMembers();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
?>
|
87
code/rsvp.php
Normal file
87
code/rsvp.php
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// rsvp.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// RSVP Center.
|
||||||
|
//
|
||||||
|
|
||||||
|
require_once("header.php");
|
||||||
|
if (!empty($_MGM['path'][1]) && intVal($_MGM['path'][1])!=0) {
|
||||||
|
$meetings = databaseQuery("SELECT * FROM meetings WHERE id=%s", $_MGM['path'][1]);
|
||||||
|
$meeting = databaseFetchAssoc($meetings);
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
#rsvp_form {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 280px;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
.rsvp_option {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<br />
|
||||||
|
<div id="rsvp_form">
|
||||||
|
<h4 style="text-align: center;">Meeting RSVP for<br /><?=date("l M j Y, h:i A", $meeting['date'])?><br /><?=$meeting['location']?></h4>
|
||||||
|
<input type="text" placeholder="Your name" id="rsvp_name" /><br />
|
||||||
|
<input type="text" placeholder="Your email or phone number" id="rsvp_contact" /><br />
|
||||||
|
<input type="radio" name="rsvp_option" id="rsvp_option_0" value="0" checked /> <label for="rsvp_option_0" class="rsvp_option">Attending</label><br />
|
||||||
|
<input type="radio" name="rsvp_option" id="rsvp_option_1" value="1" /> <label for="rsvp_option_1" class="rsvp_option">Maybe Attending</label><br />
|
||||||
|
<input type="radio" name="rsvp_option" id="rsvp_option_2" value="2" /> <label for="rsvp_option_2" class="rsvp_option">Not Attending</label><br />
|
||||||
|
<button class="btn btn-primary pull-right" id="rsvp_submit">Submit</button><br />
|
||||||
|
<span id="rsvp_load"></span>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#rsvp_submit").click(function() {
|
||||||
|
$("#rsvp_load").text("");
|
||||||
|
$("#rsvp_load").load("<?=generateURL("api/rsvp/".$_MGM['path'][1]."/submit")?>/", {name: $("#rsvp_name").val(), contact: $("#rsvp_contact").val(), choice: $("input:radio[name='rsvp_option']:checked").val()}, function(response, status, xhr) {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<header class="content-header">
|
||||||
|
<h1>
|
||||||
|
Meetings RSVP
|
||||||
|
</h1>
|
||||||
|
</header>
|
||||||
|
<p>
|
||||||
|
Click or touch the meetings you will be attending and fill out the form.
|
||||||
|
</p>
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="meting_list">
|
||||||
|
<thead>
|
||||||
|
<tr><th>#</th><th>Date</th><th>Location</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function loadMeetings() {
|
||||||
|
$("#meting_list tbody").load("<?=generateURL("api/rsvp/list")?>/", function(response, status, xhr) {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#meting_list").on("click", "tbody tr", function() {
|
||||||
|
window.location = "<?=generateURL("rsvp/")?>"+$(this).find(".id").text();
|
||||||
|
});
|
||||||
|
|
||||||
|
loadMeetings();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
}
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
?>
|
32
code/settings.php
Normal file
32
code/settings.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// settings.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Settings management page.
|
||||||
|
//
|
||||||
|
|
||||||
|
require_once("header.php");
|
||||||
|
?>
|
||||||
|
<lable for="settings_email">Email Address: </label><input type="text" id="settings_email" value="<?=getSetting("email")?>" /> <span>The email address which emails (electronic mail (telegrams (long distance tranmission of messages)) messages) are sent from.</span><br />
|
||||||
|
<lable for="settings_replyToEmail">Reply to Address: </label><input type="text" id="settings_replyToEmail" value="<?=getSetting("replyToEmail")?>" /> <span>The email address which replies are sent to.</span><br />
|
||||||
|
<button class="btn btn-primary" id="settings_save">Save</button><br /><br />
|
||||||
|
<span id="settings_save_load">
|
||||||
|
<script type="text/javascript">
|
||||||
|
function loadUsers() {
|
||||||
|
$("#users_list tbody").load("<?=generateURL("api/users/list")?>/");
|
||||||
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#settings_save").click(function() {
|
||||||
|
$("#settings_save_load").load("<?=generateURL("api/settings/save")?>/", {email: $("#settings_email").val(), replyToEmail: $("#settings_replyToEmail").val()});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
?>
|
94
code/sidebar.php
Normal file
94
code/sidebar.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// sidebar.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Side bar management page.
|
||||||
|
//
|
||||||
|
|
||||||
|
require_once("header.php");
|
||||||
|
?>
|
||||||
|
<div id="sidebar_edit" class="modal hide fade" tabindex="-1" role="dialog" style="width: 260px; margin-left: -130px;">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h3 id="myModalLabel">Edit Item</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div style="display: none;" id="sidebar_edit_id"></div>
|
||||||
|
<input type="text" id="sidebar_edit_title" placeholder="Title" /><br />
|
||||||
|
<input type="text" id="sidebar_edit_url" placeholder="URL" /><br />
|
||||||
|
<input type="text" id="sidebar_edit_order" placeholder="Order" /><br />
|
||||||
|
<div style="display: none;" id="sidebar_edit_load"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-danger pull-left" data-dismiss="modal" id="sidebar_edit_delete">Delete</button>
|
||||||
|
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button class="btn btn-primary" data-dismiss="modal" id="sidebar_edit_save">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="sidebar_add" class="modal hide fade" tabindex="-1" role="dialog" style="width: 260px; margin-left: -130px;">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h3 id="myModalLabel">Create Item</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="text" id="sidebar_add_title" placeholder="Title" /><br />
|
||||||
|
<input type="text" id="sidebar_add_url" placeholder="URL" /><br />
|
||||||
|
<input type="text" id="sidebar_add_order" placeholder="Order" /><br />
|
||||||
|
<div style="display: none;" id="sidebar_add_load"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button class="btn btn-primary" data-dismiss="modal" id="sidebar_add_button">Add</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary" id="add_sidebar_item">Add Item</button><br /><br />
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="sidebar_list">
|
||||||
|
<thead>
|
||||||
|
<tr><th>#</th><th>Title</th><th>URL</th><th>Order</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function loadSidebar() {
|
||||||
|
$("#sidebar_list tbody").load("<?=generateURL("api/sidebar/list")?>/");
|
||||||
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#sidebar_list").on("click", "tbody tr", function() {
|
||||||
|
$("#sidebar_edit_id").text($(this).find(".id").text());
|
||||||
|
$("#sidebar_edit_title").val($(this).find(".title").text());
|
||||||
|
$("#sidebar_edit_url").val($(this).find(".url").text());
|
||||||
|
$("#sidebar_edit_order").val($(this).find(".order").text());
|
||||||
|
$("#sidebar_edit").modal();
|
||||||
|
});
|
||||||
|
$("#sidebar_edit_save").click(function() {
|
||||||
|
$("#sidebar_edit_load").load("<?=generateURL("api/sidebar/update")?>/", {id: $("#sidebar_edit_id").text(), title: $("#sidebar_edit_title").val(), url: $("#sidebar_edit_url").val(), order: $("#sidebar_edit_order").val()}, function(response, status, xhr) {
|
||||||
|
loadSidebar();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#sidebar_edit_delete").click(function() {
|
||||||
|
$("#sidebar_edit_load").load("<?=generateURL("api/sidebar/delete")?>/", {id: $("#sidebar_edit_id").text()}, function(response, status, xhr) {
|
||||||
|
loadSidebar();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#add_sidebar_item").click(function() {
|
||||||
|
$("#sidebar_add").modal();
|
||||||
|
});
|
||||||
|
$("#sidebar_add_button").click(function() {
|
||||||
|
$("#sidebar_add_load").load("<?=generateURL("api/sidebar/add")?>/", {title: $("#sidebar_edit_title").val(), url: $("#sidebar_edit_url").val(), order: $("#sidebar_edit_order").val()}, function(response, status, xhr) {
|
||||||
|
loadSidebar();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
loadSidebar();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
?>
|
95
code/users.php
Normal file
95
code/users.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// users.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// User management page.
|
||||||
|
//
|
||||||
|
|
||||||
|
require_once("header.php");
|
||||||
|
?>
|
||||||
|
<div id="user_edit" class="modal hide fade" tabindex="-1" role="dialog" style="width: 260px; margin-left: -130px;">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h3 id="myModalLabel">Edit User</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div style="display: none;" id="user_edit_id"></div>
|
||||||
|
<input type="text" id="user_edit_email" placeholder="Email" /><br />
|
||||||
|
<input type="password" id="user_edit_password" placeholder="Password" /><br />
|
||||||
|
<select id="user_edit_level">
|
||||||
|
<option value="2">Normal</option>
|
||||||
|
<option value="1">Administrator</option>
|
||||||
|
<option value="0">Disabled</option>
|
||||||
|
</select>
|
||||||
|
<div style="display: none;" id="user_edit_load"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button class="btn btn-primary" data-dismiss="modal" id="user_edit_save">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="user_add" class="modal hide fade" tabindex="-1" role="dialog" style="width: 260px; margin-left: -130px;">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h3 id="myModalLabel">Create User</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="text" id="user_add_email" placeholder="Email" /><br />
|
||||||
|
<input type="password" id="user_add_password" placeholder="Password" /><br />
|
||||||
|
<select id="user_add_level">
|
||||||
|
<option value="2">Normal</option>
|
||||||
|
<option value="1">Administrator</option>
|
||||||
|
<option value="0">Disabled</option>
|
||||||
|
</select>
|
||||||
|
<div style="display: none;" id="user_add_load"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button class="btn btn-primary" data-dismiss="modal" id="user_add_create">Create</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary" id="add_user">Create User</button><br /><br />
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="users_list">
|
||||||
|
<thead>
|
||||||
|
<tr><th>#</th><th>Email</th><th>Level</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function loadUsers() {
|
||||||
|
$("#users_list tbody").load("<?=generateURL("api/users/list")?>/");
|
||||||
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#users_list").on("click", "tbody tr", function() {
|
||||||
|
$("#user_edit_id").text($(this).find(".id").text());
|
||||||
|
$("#user_edit_email").val($(this).find(".email").text());
|
||||||
|
$("#user_edit_level").val($(this).find(".level").attr("value"));
|
||||||
|
$("#user_edit").modal();
|
||||||
|
});
|
||||||
|
$("#user_edit_save").click(function() {
|
||||||
|
$("#user_edit_load").load("<?=generateURL("api/users/update")?>/", {id: $("#user_edit_id").text(), email: $("#user_edit_email").val(), password: $("#user_edit_password").val(), level: $("#user_edit_level").val()}, function(response, status, xhr) {
|
||||||
|
loadUsers();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#add_user").click(function() {
|
||||||
|
$("#user_add").modal();
|
||||||
|
});
|
||||||
|
$("#user_add_create").click(function() {
|
||||||
|
$("#user_add_load").load("<?=generateURL("api/users/create")?>/", {email: $("#user_add_email").val(), password: $("#user_add_password").val(), level: $("#user_add_level").val()}, function(response, status, xhr) {
|
||||||
|
loadUsers();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
loadUsers();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
?>
|
1109
css/bootstrap-responsive.css
vendored
Normal file
1109
css/bootstrap-responsive.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
css/bootstrap-responsive.min.css
vendored
Normal file
9
css/bootstrap-responsive.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
6167
css/bootstrap.css
vendored
Normal file
6167
css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
css/bootstrap.min.css
vendored
Normal file
9
css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
112
dbMYSQLPDO.php
Normal file
112
dbMYSQLPDO.php
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
//
|
||||||
|
// dbMYSQLPDO.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This file contains information on connecting to an MySQL database.
|
||||||
|
//
|
||||||
|
|
||||||
|
function connectToDatabase() {
|
||||||
|
global $_MGM;
|
||||||
|
if (isset($_MGM['DBConnection'])) closeDatabase();
|
||||||
|
$_MGM['DBConnection'] = NULL;
|
||||||
|
$options = array();
|
||||||
|
if ($_MGM['DBPersistent'])
|
||||||
|
$options = array(PDO::ATTR_PERSISTENT => true);
|
||||||
|
try {
|
||||||
|
$_MGM['DBConnection'] = new PDO("mysql:host={$_MGM['DBHost']};dbname={$_MGM['DBName']};charset=utf8", $_MGM['DBUser'], $_MGM['DBPassword'], $options);
|
||||||
|
$_MGM['DBConnection']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
mail("Server Admin <{$_SU['adminEmail']}>", "MySQL Error", "URL: ".$_SERVER['SERVER_NAME'].$_SU['installPath'].$_SU['fullPath']."\n\nError ".$e->getMessage().": ".mysql_error());
|
||||||
|
//echo $e->getMessage()."<br />\n";
|
||||||
|
error("Failed to connect to database");
|
||||||
|
}
|
||||||
|
if ($_MGM['DBConnection']==NULL) error("Database Connection Failed");
|
||||||
|
}
|
||||||
|
function closeDatabase() {
|
||||||
|
global $_MGM;
|
||||||
|
if (isset($_MGM['DBConnection'])) {
|
||||||
|
$_MGM['DBConnection'] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function escapeString($theString) {
|
||||||
|
global $_MGM;
|
||||||
|
return $_MGM['DBConnection']->quote($theString);
|
||||||
|
}
|
||||||
|
function quoteObject($theObject) {
|
||||||
|
global $_MGM;
|
||||||
|
if (is_null($theObject)) {
|
||||||
|
return "''";
|
||||||
|
} else if (is_string($theObject)) {
|
||||||
|
return escapeString($theObject);
|
||||||
|
} else if (is_float($theObject) || is_integer($theObject)) {
|
||||||
|
return $theObject;
|
||||||
|
} else if (is_bool($theObject)) {
|
||||||
|
return ($theObject ? 1 : 0);
|
||||||
|
}
|
||||||
|
return "''";
|
||||||
|
}
|
||||||
|
function databaseQuery($format) {
|
||||||
|
global $_MGM;
|
||||||
|
$result = NULL;
|
||||||
|
try {
|
||||||
|
if (isset($_MGM['DBConnection'])) {
|
||||||
|
$args = func_get_args();
|
||||||
|
array_shift($args);
|
||||||
|
$args = array_map("quoteObject", $args);
|
||||||
|
$query = vsprintf($format, $args);
|
||||||
|
//echo $query."\n";
|
||||||
|
$result = $_MGM['DBConnection']->query($query);
|
||||||
|
}
|
||||||
|
//if ($result==NULL) error("Failed to run query on database");
|
||||||
|
} catch (Exception $e) {
|
||||||
|
mail("Server Admin <{$_MGM['adminEmail']}>", "MySQL Error", "URL: ".$_SERVER['SERVER_NAME'].$_MGM['installPath'].$_MGM['fullPath']."\n\nError ".$e->getMessage().": ".mysql_error());
|
||||||
|
//echo $e->getMessage()."<br />\n";
|
||||||
|
//error("Failed to run query on database");
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
function databaseRowCount($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
if ($theResult==NULL)
|
||||||
|
return 0;
|
||||||
|
return $theResult->rowCount();
|
||||||
|
}
|
||||||
|
function databaseFieldCount($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
if ($theResult==NULL)
|
||||||
|
return 0;
|
||||||
|
return $theResult->columnCount();
|
||||||
|
}
|
||||||
|
function databaseLastID() {
|
||||||
|
global $_MGM;
|
||||||
|
$result = 0;
|
||||||
|
if (isset($_MGM['DBConnection'])) {
|
||||||
|
$result = $_MGM['DBConnection']->lastInsertId();
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
function databaseFetch($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
return $theResult->fetch();
|
||||||
|
}
|
||||||
|
function databaseFetchNum($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
return $theResult->fetch(PDO::FETCH_NUM);
|
||||||
|
}
|
||||||
|
function databaseFetchAssoc($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
return $theResult->fetch(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
function databaseResultSeek($theResult, $theLocation) {
|
||||||
|
global $_MGM;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function databaseFreeResult($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
$theResult = NULL;
|
||||||
|
}
|
||||||
|
?>
|
104
dbSQLITE.php
Normal file
104
dbSQLITE.php
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
//
|
||||||
|
// dbSQLITE.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This file contains information on connecting to an SQLite database.
|
||||||
|
//
|
||||||
|
|
||||||
|
function connectToDatabase() {
|
||||||
|
global $_MGM;
|
||||||
|
if (isset($_MGM['DBConnection'])) closeDatabase();
|
||||||
|
$_MGM['DBConnection'] = NULL;
|
||||||
|
$_MGM['DBConnection'] = new PDO("sqlite:".$_MGM['DBName']);
|
||||||
|
$_MGM['DBConnection']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
if ($_MGM['DBPersistent'])
|
||||||
|
$_MGM['DBConnection']->setAttribute(PDO::ATTR_PERSISTENT, TRUE);
|
||||||
|
if ($_MGM['DBConnection']==NULL) error("Database Connection Failed");
|
||||||
|
}
|
||||||
|
function closeDatabase() {
|
||||||
|
global $_MGM;
|
||||||
|
if (isset($_MGM['DBConnection'])) {
|
||||||
|
$_MGM['DBConnection'] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function escapeString($theString) {
|
||||||
|
global $_MGM;
|
||||||
|
return $_MGM['DBConnection']->quote($theString);
|
||||||
|
}
|
||||||
|
function quoteObject($theObject) {
|
||||||
|
global $_MGM;
|
||||||
|
if (is_null($theObject)) {
|
||||||
|
return "NULL";
|
||||||
|
} else if (is_string($theObject)) {
|
||||||
|
return escapeString($theObject);
|
||||||
|
} else if (is_float($theObject) || is_integer($theObject)) {
|
||||||
|
return $theObject;
|
||||||
|
} else if (is_bool($theObject)) {
|
||||||
|
return ($theObject ? 1 : 0);
|
||||||
|
}
|
||||||
|
return "NULL";
|
||||||
|
}
|
||||||
|
function databaseQuery($format) {
|
||||||
|
global $_MGM;
|
||||||
|
$result = NULL;
|
||||||
|
try {
|
||||||
|
if (isset($_MGM['DBConnection'])) {
|
||||||
|
$args = func_get_args();
|
||||||
|
array_shift($args);
|
||||||
|
$args = array_map("quoteObject", $args);
|
||||||
|
$query = vsprintf($format, $args);
|
||||||
|
|
||||||
|
$result = $_MGM['DBConnection']->query($query);
|
||||||
|
}
|
||||||
|
//if ($result==NULL) error("Failed to run query on database");
|
||||||
|
} catch (Exception $e) {
|
||||||
|
//echo $e->getMessage()."<br />\n";
|
||||||
|
//error("Failed to run query on database");
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
function databaseRowCount($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
if ($theResult==NULL)
|
||||||
|
return 0;
|
||||||
|
return $theResult->rowCount();
|
||||||
|
}
|
||||||
|
function databaseFieldCount($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
if ($theResult==NULL)
|
||||||
|
return 0;
|
||||||
|
return $theResult->columnCount();
|
||||||
|
}
|
||||||
|
function databaseLastID() {
|
||||||
|
global $_MGM;
|
||||||
|
$result = 0;
|
||||||
|
if (isset($_MGM['DBConnection'])) {
|
||||||
|
$result = $_MGM['DBConnection']->lastInsertId();
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
function databaseFetch($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
return $theResult->fetch();
|
||||||
|
}
|
||||||
|
function databaseFetchNum($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
return $theResult->fetch(PDO::FETCH_NUM);
|
||||||
|
}
|
||||||
|
function databaseFetchAssoc($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
return $theResult->fetch(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
function databaseResultSeek($theResult, $theLocation) {
|
||||||
|
global $_MGM;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function databaseFreeResult($theResult) {
|
||||||
|
global $_MGM;
|
||||||
|
$theResult = NULL;
|
||||||
|
}
|
||||||
|
?>
|
15
footer.php
Normal file
15
footer.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// index.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// The site footer.
|
||||||
|
//
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
174
header.php
Normal file
174
header.php
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// index.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// The site header.
|
||||||
|
//
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>Calhoun IT Club</title>
|
||||||
|
<link rev="made" href="mailto:james@coleman.io" />
|
||||||
|
<meta name="Copyright" content="Copyright (c) 2015, Mr. Gecko's Media (James Coleman)" />
|
||||||
|
<meta name="Author" content="James Coleman" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link href="<?=$_MGM['installPath']?>css/bootstrap.min.css" rel="stylesheet" />
|
||||||
|
<link href="<?=$_MGM['installPath']?>css/bootstrap-responsive.min.css" rel="stylesheet" />
|
||||||
|
<script type="text/javascript" src="<?=$_MGM['installPath']?>js/jquery.min.js"></script>
|
||||||
|
<script type="text/javascript" src="<?=$_MGM['installPath']?>js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
padding-left: 0px;
|
||||||
|
background: #f8f8f8;
|
||||||
|
}
|
||||||
|
#wrapper {
|
||||||
|
padding-left: 350px;
|
||||||
|
transition: all 0.4s ease 0s;
|
||||||
|
}
|
||||||
|
#page-content-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#page-content-wrapper p {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
#sidebar-wrapper {
|
||||||
|
margin-left: -350px;
|
||||||
|
left: 350px;
|
||||||
|
width: 350px;
|
||||||
|
background: #e6e6e6;
|
||||||
|
position: fixed;
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
z-index: 1000;
|
||||||
|
transition: all 0.4s ease 0s;
|
||||||
|
}
|
||||||
|
.sidebar-nav {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
width: 350px;
|
||||||
|
list-style: outside none none;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
#sidebar-logo {
|
||||||
|
width: 321px;
|
||||||
|
height: 165px;
|
||||||
|
}
|
||||||
|
.sidebar-link {
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
background: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.sidebar-link:hover {
|
||||||
|
background: #dfdfdf;
|
||||||
|
}
|
||||||
|
.sidebar-link a {
|
||||||
|
color: #000;
|
||||||
|
font-size: 18pt;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
.sidebar-link a:link {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-link a:visited {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-link a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-link a:active {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.content-header {
|
||||||
|
height: auto;
|
||||||
|
background-color: #ededed;
|
||||||
|
}
|
||||||
|
.content-header h1 {
|
||||||
|
font-size: 32px;
|
||||||
|
color: #000;
|
||||||
|
display: block;
|
||||||
|
margin: 0px 20px 20px;
|
||||||
|
line-height: normal;
|
||||||
|
border-bottom: medium none;
|
||||||
|
}
|
||||||
|
@media only screen and (max-device-width : 800px) {
|
||||||
|
#wrapper {
|
||||||
|
padding-left: 0px;
|
||||||
|
}
|
||||||
|
#sidebar-wrapper {
|
||||||
|
margin-left: 0px;
|
||||||
|
left: 0px;
|
||||||
|
width: 100%;
|
||||||
|
background: #e6e6e6;
|
||||||
|
position: relative;
|
||||||
|
height: auto;
|
||||||
|
overflow-y: visible;
|
||||||
|
z-index: auto;
|
||||||
|
transition: all 0.4s ease 0s;
|
||||||
|
}
|
||||||
|
.sidebar-nav {
|
||||||
|
position: relative;
|
||||||
|
top: 0px;
|
||||||
|
width: 100%;
|
||||||
|
list-style: outside none none;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
#sidebar-logo {
|
||||||
|
max-width: 100%;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.sidebar-link a {
|
||||||
|
font-size: 14pt;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
.content-header h1 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="wrapper">
|
||||||
|
<nav id="sidebar-wrapper">
|
||||||
|
<ul class="sidebar-nav">
|
||||||
|
<li class="sidebar-brand">
|
||||||
|
<a href="<?=$_MGM['installPath']?>"><img src="<?=$_MGM['installPath']?>logo.png" alt="logo" id="sidebar-logo" /></a>
|
||||||
|
</li>
|
||||||
|
<?
|
||||||
|
$results = databaseQuery("SELECT * FROM `sidebar` ORDER BY `order`");
|
||||||
|
while ($result = databaseFetchAssoc($results)) {
|
||||||
|
?><li class="sidebar-link"><a <?=(substr($result['url'], 0, 1)=="/" ? "" : "target=\"_blank\"")?> href="<?=htmlspecialchars($result['url'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?>"><?=htmlspecialchars($result['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8', true)?></a></li><?
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?if (isset($_MGM['user'])) {?>
|
||||||
|
<li><h3>Admin Stuff</h3></li>
|
||||||
|
<li class="sidebar-link"><a href="<?=$_MGM['installPath']?>members">Members</a></li>
|
||||||
|
<li class="sidebar-link"><a href="<?=$_MGM['installPath']?>meetings">Meetings</a></li>
|
||||||
|
<li class="sidebar-link"><a href="<?=$_MGM['installPath']?>announcements">Announcements</a></li>
|
||||||
|
<?if ($_MGM['user']['level']==1) {?>
|
||||||
|
<li class="sidebar-link"><a href="<?=$_MGM['installPath']?>users/">User Management</a></li>
|
||||||
|
<li class="sidebar-link"><a href="<?=$_MGM['installPath']?>sidebar/">Sidebar Links</a></li>
|
||||||
|
<li class="sidebar-link"><a href="<?=$_MGM['installPath']?>settings/">Settings</a></li>
|
||||||
|
<?}?>
|
||||||
|
<li class="sidebar-link"><a href="<?=$_MGM['installPath']?>logout">Logout</a></li>
|
||||||
|
<?}?>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<div id="page-content-wrapper">
|
BIN
img/glyphicons-halflings-white.png
Normal file
BIN
img/glyphicons-halflings-white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
img/glyphicons-halflings.png
Normal file
BIN
img/glyphicons-halflings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
150
index.php
Normal file
150
index.php
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
<?
|
||||||
|
//
|
||||||
|
// index.php
|
||||||
|
// IT Club
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// The main code of the site.
|
||||||
|
//
|
||||||
|
|
||||||
|
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT);
|
||||||
|
|
||||||
|
$_MGM = array();
|
||||||
|
$_MGM['version'] = "1";
|
||||||
|
$_MGM['title'] = "IT Club";
|
||||||
|
$_MGM['DBType'] = "MYSQLPDO"; // MYSQL, SQLITE.
|
||||||
|
$_MGM['DBPersistent'] = NO;
|
||||||
|
$_MGM['DBHost'] = "localhost";
|
||||||
|
$_MGM['DBUser'] = "itclub";
|
||||||
|
$_MGM['DBPassword'] = "";
|
||||||
|
$_MGM['DBName'] = "itclub"; // File location for SQLite.
|
||||||
|
$_MGM['DBPort'] = 0; // 3306 = MySQL Default, 5432 = PostgreSQL Default.
|
||||||
|
$_MGM['DBPrefix'] = "";
|
||||||
|
$_MGM['adminEmail'] = "admin@example.com";
|
||||||
|
require_once("db{$_MGM['DBType']}.php");
|
||||||
|
|
||||||
|
$_MGM['apiAuthentication'] = "putrandomstring";
|
||||||
|
|
||||||
|
putenv("TZ=US/Central");
|
||||||
|
$_MGM['time'] = time();
|
||||||
|
$_MGM['domain'] = $_SERVER['HTTP_HOST'];
|
||||||
|
$_MGM['domainname'] = str_replace("www.", "", $_MGM['domain']);
|
||||||
|
$_MGM['port'] = $_SERVER['SERVER_PORT'];
|
||||||
|
$_MGM['ssl'] = ($_MGM['port']==443);
|
||||||
|
|
||||||
|
if ($_SERVER['REMOTE_ADDR'])
|
||||||
|
$_MGM['ip'] = $_SERVER['REMOTE_ADDR'];
|
||||||
|
if ($_SERVER['HTTP_PC_REMOTE_ADDR'])
|
||||||
|
$_MGM['ip'] = $_SERVER['HTTP_PC_REMOTE_ADDR'];
|
||||||
|
if ($_SERVER['HTTP_CLIENT_IP'])
|
||||||
|
$_MGM['ip'] = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
|
if ($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||||
|
$_MGM['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
|
||||||
|
$_MGM['installPath'] = substr($_SERVER['SCRIPT_NAME'], 0, strlen($_SERVER['SCRIPT_NAME'])-strlen(end(explode("/", $_SERVER['SCRIPT_NAME']))));
|
||||||
|
if (!isset($_GET['d'])) {
|
||||||
|
$tmp = explode("?", substr($_SERVER['REQUEST_URI'], strlen($_MGM['installPath'])));
|
||||||
|
$tmp = urldecode($tmp[0]);
|
||||||
|
if (substr($tmp, 0, 9)=="index.php")
|
||||||
|
$tmp = substr($tmp, 10, strlen($tmp)-10);
|
||||||
|
$_MGM['fullPath'] = $tmp;
|
||||||
|
} else {
|
||||||
|
$tmp = $_GET['d'];
|
||||||
|
if (substr($tmp, 0, 1)=="/")
|
||||||
|
$tmp = substr($tmp, 1, strlen($tmp)-1);
|
||||||
|
$_MGM['fullPath'] = $tmp;
|
||||||
|
}
|
||||||
|
if (strlen($_MGM['fullPath'])>255) error("The URI you entered is to large");
|
||||||
|
$_MGM['path'] = explode("/", strtolower($_MGM['fullPath']));
|
||||||
|
|
||||||
|
$_MGM['CookiePrefix'] = "";
|
||||||
|
$_MGM['CookiePath'] = $_MGM['installPath'];
|
||||||
|
$_MGM['CookieDomain'] = ".".$_MGM['domainname'];
|
||||||
|
|
||||||
|
function generateURL($path) {
|
||||||
|
global $_MGM;
|
||||||
|
return "http".($_MGM['ssl'] ? "s" : "")."://".$_MGM['domain'].(((!$_MGM['ssl'] && $_MGM['port']==80) || ($_MGM['ssl'] && $_MGM['port']==443)) ? "" : ":{$_MGM['port']}").$_MGM['installPath'].$path;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hashPassword($password, $salt) {
|
||||||
|
$hashed = hash("sha512", $salt.$password);
|
||||||
|
for ($i=0; $i<10000; $i++) {
|
||||||
|
$hashed = hash("sha512", $salt.hex2bin($hashed));
|
||||||
|
}
|
||||||
|
return $hashed;
|
||||||
|
}
|
||||||
|
function error($error) {
|
||||||
|
echo $error."<br />\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
connectToDatabase();
|
||||||
|
|
||||||
|
function getSetting($name) {
|
||||||
|
$results = databaseQuery("SELECT value FROM settings WHERE name=%s", $name);
|
||||||
|
if ($results==NULL) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
$result = databaseFetchAssoc($results);
|
||||||
|
return $result['value'];
|
||||||
|
}
|
||||||
|
function setSetting($name, $value) {
|
||||||
|
$results = databaseQuery("SELECT value FROM settings WHERE name=%s", $name);
|
||||||
|
if ($results==NULL || databaseRowCount($results)==0) {
|
||||||
|
databaseQuery("INSERT INTO settings (name,value) VALUES (%s,%s)", $name, $value);
|
||||||
|
} else {
|
||||||
|
databaseQuery("UPDATE settings SET value=%s WHERE name=%s", $value, $name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_COOKIE["{$_MGM['CookiePrefix']}user_email"])) {
|
||||||
|
$result = databaseQuery("SELECT * FROM users WHERE email=%s AND level!=0", $_COOKIE["{$_MGM['CookiePrefix']}user_email"]);
|
||||||
|
$user = databaseFetchAssoc($result);
|
||||||
|
if ($user!=NULL && hash("sha512", $user['password'].$user['time'])==$_COOKIE["{$_MGM['CookiePrefix']}user_password"]) {
|
||||||
|
$_MGM['user'] = $user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_MGM['user']) && $_MGM['path'][0]=="login") {
|
||||||
|
require("code/login.php");
|
||||||
|
}
|
||||||
|
if (isset($_MGM['user']) && $_MGM['path'][0]=="logout") {
|
||||||
|
require("code/logout.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][0]=="sidebar") {
|
||||||
|
require("code/sidebar.php");
|
||||||
|
} else if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][0]=="users") {
|
||||||
|
require("code/users.php");
|
||||||
|
} else if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][0]=="settings") {
|
||||||
|
require("code/settings.php");
|
||||||
|
} else if (isset($_MGM['user']) && $_MGM['path'][0]=="members") {
|
||||||
|
require("code/members.php");
|
||||||
|
} else if (isset($_MGM['user']) && $_MGM['path'][0]=="meetings") {
|
||||||
|
require("code/meetings.php");
|
||||||
|
} else if (isset($_MGM['user']) && $_MGM['path'][0]=="announcements") {
|
||||||
|
require("code/announcements.php");
|
||||||
|
} else if ($_MGM['path'][0]=="rsvp") {
|
||||||
|
require("code/rsvp.php");
|
||||||
|
} else if ($_MGM['path'][0]=="api") {
|
||||||
|
require("code/api.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
$page = str_replace("..", "", $_MGM['fullPath']);
|
||||||
|
if ($page=="" || substr($page, strlen($page)-1, 1)=="/") {
|
||||||
|
$page .= "index";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file_exists("pages/".$page.".html")) {
|
||||||
|
header("HTTP/1.0 404 Not Found");
|
||||||
|
require_once("header.php");
|
||||||
|
readfile("pages/404.html");
|
||||||
|
require_once("footer.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once("header.php");
|
||||||
|
readfile("pages/".$page.".html");
|
||||||
|
require_once("footer.php");
|
||||||
|
?>
|
104
itclub.sql
Normal file
104
itclub.sql
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
itclub.sql
|
||||||
|
IT Club
|
||||||
|
|
||||||
|
Copyright (c) 2015, Mr. Gecko's Media (James Coleman)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
The structure of the MySQL database.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
SET NAMES utf8;
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `announcements`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `announcements`;
|
||||||
|
CREATE TABLE `announcements` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`user` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`subject` varchar(255) NOT NULL,
|
||||||
|
`message` blob NOT NULL,
|
||||||
|
`sms` varchar(161) NOT NULL DEFAULT '',
|
||||||
|
`date` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=Aria AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `meetings`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `meetings`;
|
||||||
|
CREATE TABLE `meetings` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`date` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`location` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=Aria AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `members`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `members`;
|
||||||
|
CREATE TABLE `members` (
|
||||||
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`position` varchar(25) NOT NULL DEFAULT '',
|
||||||
|
`phone` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`email` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`preferredMethod` varchar(10) NOT NULL DEFAULT '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=Aria AUTO_INCREMENT=59 DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `rsvp`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `rsvp`;
|
||||||
|
CREATE TABLE `rsvp` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`meeting` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`name` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`contact` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`choice` int(1) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`date` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=Aria AUTO_INCREMENT=39 DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `settings`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `settings`;
|
||||||
|
CREATE TABLE `settings` (
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`value` varchar(255) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`name`)
|
||||||
|
) ENGINE=Aria DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `sidebar`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `sidebar`;
|
||||||
|
CREATE TABLE `sidebar` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` varchar(255) NOT NULL,
|
||||||
|
`url` varchar(255) NOT NULL,
|
||||||
|
`order` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=Aria AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `users`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `users`;
|
||||||
|
CREATE TABLE `users` (
|
||||||
|
`docid` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`email` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`password` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`time` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`level` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`docid`)
|
||||||
|
) ENGINE=Aria AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=1;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
2280
js/bootstrap.js
vendored
Normal file
2280
js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
js/bootstrap.min.js
vendored
Normal file
6
js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9789
js/jquery.js
vendored
Normal file
9789
js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
js/jquery.min.js
vendored
Normal file
6
js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
pages/404.html
Normal file
6
pages/404.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<br />
|
||||||
|
<center>
|
||||||
|
<h1>File Not Found</h1><br />
|
||||||
|
<img src="/photos/404.jpg" /><br />
|
||||||
|
<span>I'm going to use this drill and hammer and somehow this computer will work!<br />Don't worry, I am a computer repair expert!</span>
|
||||||
|
</center>
|
1
pages/index.html
Normal file
1
pages/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
Example index page.
|
1
pages/info.txt
Normal file
1
pages/info.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Create folders and html files to make new pages. The files named index.html will show as the index page for a folder.
|
BIN
photos/404.jpg
Normal file
BIN
photos/404.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 163 KiB |
Loading…
Reference in New Issue
Block a user