mirror of
https://github.com/jakejarvis/spoons.git
synced 2025-09-15 02:15:33 -04:00
Merge branch 'master' of https://github.com/jakejarvis/spoons
This commit is contained in:
28
.htaccess
28
.htaccess
@@ -1,18 +1,20 @@
|
||||
Options -indexes
|
||||
|
||||
ErrorDocument 403 /error.html
|
||||
ErrorDocument 404 /error.html
|
||||
#AddType application/x-httpd-php5 .pdf
|
||||
|
||||
RewriteEngine on
|
||||
RewriteRule ^login/?$ login.php
|
||||
RewriteRule ^logout/?$ logout.php
|
||||
RewriteRule ^sms/?$ sms.php
|
||||
RewriteRule ^print.pdf print.php
|
||||
RewriteRule ^shuffle/?$ index.php?shuffle
|
||||
RewriteRule ^shuffle/confirmed/?$ index.php?shuffle&confirmed
|
||||
RewriteRule ^shuffle/done/?$ index.php?shuffle&done
|
||||
RewriteRule ^clear/?$ index.php?clear
|
||||
RewriteRule ^clear/confirmed/?$ index.php?clear&confirmed
|
||||
RewriteRule ^clear/done/?$ index.php?clear&done
|
||||
RewriteRule ^add/?$ add.php
|
||||
RewriteRule ^spoon/([^/.]+)/?$ index.php?spoon=$1
|
||||
RewriteRule ^revive/([^/.]+)/?$ index.php?revive=$1
|
||||
RewriteRule ^login/?$ login.php [L]
|
||||
RewriteRule ^logout/?$ logout.php [L]
|
||||
RewriteRule ^sms/?$ sms.php [L]
|
||||
RewriteRule ^print.pdf print.php [L]
|
||||
RewriteRule ^shuffle/?$ index.php?shuffle [L]
|
||||
RewriteRule ^shuffle/confirmed/?$ index.php?shuffle&confirmed [L]
|
||||
RewriteRule ^shuffle/done/?$ index.php?shuffle&done [L]
|
||||
RewriteRule ^clear/?$ index.php?clear [L]
|
||||
RewriteRule ^clear/confirmed/?$ index.php?clear&confirmed [L]
|
||||
RewriteRule ^clear/done/?$ index.php?clear&done [L]
|
||||
RewriteRule ^add/?$ add.php [L]
|
||||
RewriteRule ^spoon/([^/.]+)/?$ index.php?spoon=$1 [L]
|
||||
RewriteRule ^revive/([^/.]+)/?$ index.php?revive=$1 [L]
|
Binary file not shown.
Before Width: | Height: | Size: 3.7 KiB |
BIN
assets/img/scrabble-40.jpg
Normal file
BIN
assets/img/scrabble-40.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
@@ -1,30 +1,11 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 3.3.10.4
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: mysql.jakejarvis.dreamhosters.com
|
||||
-- Generation Time: May 19, 2013 at 08:43 AM
|
||||
-- Server version: 5.1.56
|
||||
-- PHP Version: 5.2.17
|
||||
|
||||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
--
|
||||
-- Database: `spoons`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `spooners`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `spooners` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`order_num` int(11) NOT NULL,
|
||||
@@ -36,4 +17,17 @@ CREATE TABLE IF NOT EXISTS `spooners` (
|
||||
`spooned_by` int(11) NOT NULL DEFAULT '0',
|
||||
`target_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `texts` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`message` text COLLATE utf8_unicode_ci NOT NULL,
|
||||
`response` text COLLATE utf8_unicode_ci NOT NULL,
|
||||
`phone_number` text COLLATE utf8_unicode_ci NOT NULL,
|
||||
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
|
160
error.html
Normal file
160
error.html
Normal file
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
||||
<p>Baked with <span style="color:#79ad36">♥</span> by <a href="http://scrabble.io/" target="_blank">scribscrab</a>.</p>
|
||||
</div>
|
||||
<div class="span4 align-center">
|
||||
<a href="http://www.internaldrive.com/" target="_blank"><img src="<?php echo $site_url ?>/assets/img/id.png" alt="internalDrive"></a>
|
||||
<a href="http://scrabble.io/" target="_blank"><img src="<?php echo $site_url ?>/assets/img/scrabble-40.jpg" alt="scrabble"></a>
|
||||
</div>
|
||||
<div class="span4 align-right">
|
||||
<p><a href="#">Back to top!</a></p>
|
||||
@@ -23,7 +23,7 @@
|
||||
<p>Baked with <span style="color:#79ad36">♥</span> by <a href="http://scrabble.io/" target="_blank">scribscrab</a>.</p>
|
||||
</div>
|
||||
<div class="span12 align-center">
|
||||
<p><a href="http://www.internaldrive.com/" target="_blank"><img src="<?php echo $site_url ?>/assets/img/id.png" alt="internalDrive"></a></p>
|
||||
<p><a href="http://scrabble.io/" target="_blank"><img src="<?php echo $site_url ?>/assets/img/scrabble-40.jpg" alt="scrabble"></a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
function logSMS($message, $response, $number) {
|
||||
mysql_query('INSERT INTO texts (message, response, phone_number) VALUES ("' . mysql_real_escape_string($message) . '", "' . mysql_real_escape_string($response) . '", "' . mysql_real_escape_string($number) . '")');
|
||||
}
|
||||
|
||||
function getNumTotalSpooners() {
|
||||
$result = mysql_query("SELECT id FROM spooners");
|
||||
return mysql_num_rows($result);
|
||||
|
@@ -110,9 +110,9 @@
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title><?php echo $page ?> — Spoons</title>
|
||||
<title><?php echo $page ?> · Spoons</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <!-- Disable mobile pinch zoom -->
|
||||
|
||||
<!-- Le styles -->
|
||||
<link href="<?php echo $site_url ?>/assets/css/bootstrap.css" rel="stylesheet">
|
||||
|
12
index.php
12
index.php
@@ -198,7 +198,7 @@ $(document).ready(function() {
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$result = mysql_query("SELECT id, first, last FROM spooners WHERE spooned = 0 ORDER BY order_num") or die(mysql_error());
|
||||
$result = mysql_query("SELECT id, first, last, staff FROM spooners WHERE spooned = 0 ORDER BY order_num") or die(mysql_error());
|
||||
?>
|
||||
|
||||
<h4>Active Spooners (<?php echo mysql_num_rows($result) ?>)</h4>
|
||||
@@ -216,7 +216,9 @@ $result = mysql_query("SELECT id, first, last FROM spooners WHERE spooned = 0 OR
|
||||
<tbody>
|
||||
<?php
|
||||
while($spooner = mysql_fetch_array($result)) {
|
||||
echo ' <tr id="' . $spooner['id'] . '" class="row">
|
||||
echo ' <tr id="' . $spooner['id'] . '" class="row';
|
||||
if($spooner['staff']) echo ' success'; // highlight staff with green row
|
||||
echo '">
|
||||
<td class="align-center"><a href="' . $site_url . '/spoon/' . $spooner['id'] . '" class="btn btn-danger hidden-phone"><img src="' . $site_url . '/assets/img/spoon-white-14px.png"> Spoon</a><a href="' . $site_url . '/spoon/' . $spooner['id'] . '" class="btn btn-danger visible-phone" style="padding:4px !important; width:40px !important;"><img src="' . $site_url . '/assets/img/spoon-white-14px.png" style="margin:2px 0px !important;"></a></td>
|
||||
<td>' . $spooner['first'] . '</td>
|
||||
<td>' . $spooner['last'] . '</td>
|
||||
@@ -235,7 +237,7 @@ $result = mysql_query("SELECT id, first, last FROM spooners WHERE spooned = 0 OR
|
||||
<hr>
|
||||
|
||||
<?php
|
||||
$result = mysql_query("SELECT id, first, last, spooned_by, time_spooned FROM spooners WHERE spooned = 1 ORDER BY time_spooned DESC") or die(mysql_error());
|
||||
$result = mysql_query("SELECT id, first, last, staff, spooned_by, time_spooned FROM spooners WHERE spooned = 1 ORDER BY time_spooned DESC") or die(mysql_error());
|
||||
?>
|
||||
|
||||
<h4>Dead Spooners (<?php echo mysql_num_rows($result) ?>)</h4>
|
||||
@@ -253,7 +255,9 @@ $result = mysql_query("SELECT id, first, last, spooned_by, time_spooned FROM spo
|
||||
<tbody>
|
||||
<?php
|
||||
while($spooner = mysql_fetch_array($result)) {
|
||||
echo ' <tr id="' . $spooner['id'] . '" class="row">
|
||||
echo ' <tr id="' . $spooner['id'] . '" class="row';
|
||||
if($spooner['staff']) echo ' success'; // highlight staff with green row
|
||||
echo '">
|
||||
<td class="align-center" style="min-width:40px;"><a href="' . $site_url . '/revive/' . $spooner['id'] . '" class="btn hidden-phone" type="submit"><i class="icon-arrow-up"></i> Revive</a><a href="' . $site_url . '/revive/' . $spooner['id'] . '" class="btn visible-phone" style="padding-left:10px !important; width:40px !important;"> <i class="icon-arrow-up"></i></a></td>
|
||||
<td>' . $spooner['first'] . ' ' . $spooner['last'] . '</td>
|
||||
<td class="hidden-phone"><small>Spooned by <strong>' . getNameByID($spooner['spooned_by']) . '</strong> on <strong>' . date('l', strtotime($spooner['time_spooned'])) . '</strong> at <strong>' . date('g:i A', strtotime($spooner['time_spooned'])) . '</strong>.</small></td>
|
||||
|
@@ -137,9 +137,9 @@ if(isset($_POST['password'])) {
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Sign in — Spoons</title>
|
||||
<title>Sign in · Spoons</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <!-- Disable mobile pinch zoom -->
|
||||
|
||||
<!-- Le styles -->
|
||||
<link href="<?php echo $site_url ?>/assets/css/bootstrap.css" rel="stylesheet">
|
||||
|
2
sms.php
2
sms.php
@@ -50,7 +50,7 @@ blockquote {
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Help:</strong> To get a list of commands on-the-go, just send <strong>Help</strong> (or any command not listed here).
|
||||
<strong>Help:</strong> To get a list of commands on-the-go, just send <strong>Commands</strong> (or any command not listed here).
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
15
sms_hook.php
15
sms_hook.php
@@ -8,6 +8,7 @@ header("content-type: text/xml");
|
||||
$text = $_REQUEST['Body'];
|
||||
//$text = "Spoon caJun.";
|
||||
|
||||
$text = str_replace("?", "", $text); // ignore question marks
|
||||
$text = trim($text);
|
||||
|
||||
if(strpos($text, " ") !== false)
|
||||
@@ -20,16 +21,16 @@ if(strlen($text) > strlen($command)) {
|
||||
$subject_id = getIDByLooseName($subject);
|
||||
}
|
||||
|
||||
$help = 'List of commands: "Spoon (name)" to spoon, "Status (name)" to check, "Remaining" to query number of alive spooners.';
|
||||
$help = 'List of commands:' . "\n" . '"Spoon (name)" to spoon.' . "\n" . '"Status (name)" to check.' . "\n" . '"Remaining" for number of alive spooners.';
|
||||
|
||||
if($subject_id == "multiple") {
|
||||
if($subject && $subject_id == "multiple") {
|
||||
$response = "There are multiple " . $subject . "s in the system. Please specify last name or last initial.";
|
||||
} else if($subject_id == "none") {
|
||||
} else if($subject && $subject_id == "none") {
|
||||
$response = "There were no spooners by the name " . $subject . " found in the system. Sorry (but not really).";
|
||||
} else if(strcasecmp($command, "spoon") == 0) {
|
||||
} else if($subject && strcasecmp($command, "spoon") == 0) {
|
||||
spoonByID($subject_id);
|
||||
$response = getNameByID($subject_id) . ' has been spooned! ' . getNameByID(getSpoonedByIDByID($subject_id)) . '\'s new target is ' . getNameByID(getTargetByID(getSpoonedByIDByID($subject_id))) . '.';
|
||||
} else if(strcasecmp($command, "status") == 0) {
|
||||
} else if($subject && strcasecmp($command, "status") == 0) {
|
||||
if(checkSpoonedByID($subject_id)) {
|
||||
$response = getNameByID($subject_id) . ' was spooned by ' . getNameByID(getSpoonedByIDByID($subject_id)) . ' on ' . date('l', strtotime(getTimeSpoonedByID($subject_id))) . ' at ' . date('g:i A', strtotime(getTimeSpoonedByID($subject_id))) . '.';
|
||||
} else {
|
||||
@@ -37,12 +38,14 @@ if($subject_id == "multiple") {
|
||||
}
|
||||
} else if(strcasecmp($command, "remaining") == 0) {
|
||||
$response = "There are " . getNumActiveSpooners() . " of " . getNumTotalSpooners() . " spooners remaining.";
|
||||
} else if(strcasecmp($command, "help") == 0) {
|
||||
} else if(strcasecmp($command, "commands") == 0 || strcasecmp($command, "command") == 0) {
|
||||
$response = $help;
|
||||
} else {
|
||||
$response = "Invalid command. " . $help;
|
||||
}
|
||||
|
||||
logSMS($_REQUEST['Body'], $response, $_REQUEST['From']);
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
?>
|
||||
<Response>
|
||||
|
Reference in New Issue
Block a user