1
mirror of https://github.com/jakejarvis/spoons.git synced 2025-09-15 04:35:34 -04:00

set Twilio number in env variables so app is now truly 100% portable!

This commit is contained in:
2017-07-17 11:10:24 -04:00
parent a670665895
commit 861173314f
4 changed files with 15 additions and 6 deletions

View File

@@ -18,7 +18,13 @@ Easily deployable (for free!) to [Heroku](https://www.heroku.com/) as of Summer
- `SITE_PASSWORD`: the password that allows staff members past the login page
- `TZ`: time zone in [TZ format](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones); ex: America/New_York
Optional (but really [**awesome**](http://synonymsforawesome.com)) SMS reporting capabilities can be added for very little cost — just a few bucks should get you through the whole summer. [Sign up for a Twilio account](https://www.twilio.com/), add some credit, claim a catchy phone number, and point its text webhook callback to `http://{your domain}/sms_hook.php` via HTTP POST. Don't forget to change the phone number that's displayed in the `sms.php` how-to page.
Optional (but really [**awesome**](http://synonymsforawesome.com)) SMS reporting capabilities can be added for very little cost — just a few bucks should get you through the whole summer. [Sign up for a Twilio account](https://www.twilio.com/), add some credit, claim a catchy phone number, and point its text webhook callback to `http://{your domain}/sms_hook.php` via HTTP POST. Set the following additional [environment variables](https://devcenter.heroku.com/articles/config-vars#setting-up-config-vars-for-a-deployed-application) so the header knows to show a link to the SMS how-to page (`sms.php`) and what number to show on that page:
- `PHONENUM`: numeric phone number claimed through Twilio; ex: +1 (917) 477-6667
- `PHONENUM_FRIENDLY` (optional): phone number in text-based format if you [searched for one containing SPOONS on Twilio](https://support.twilio.com/hc/en-us/articles/223135247-How-to-search-for-phone-numbers); ex: +1 (917) 4-SPOONS
Don't forget to change the phone number that's displayed in the `sms.php` how-to page.
---

View File

@@ -20,6 +20,9 @@
$db_name = "spoons";
}
$phonenum = getenv('PHONENUM');
$phonenum_friendly = getenv('PHONENUM_FRIENDLY');
$timezone_name = getenv('TZ');
date_default_timezone_set($timezone_name);

View File

@@ -140,7 +140,7 @@
<div class="masthead hidden-phone">
<ul class="nav nav-pills pull-right">
<?php if($page == "Home") { ?><li><a href="<?php echo $site_url ?>/sms">How do I report via SMS?</a></li><?php } ?>
<?php if($page == "Home" && $phonenum != null) { ?><li><a href="<?php echo $site_url ?>/sms">How do I report via SMS?</a></li><?php } ?>
<?php if($page != "Home") { ?><li><a href="<?php echo $site_url ?>/">&laquo; Back Home</a></li><?php } ?>
<li style="margin-left:10px;"><a href="<?php echo $site_url ?>/logout">Logout</a></li>
</ul>
@@ -149,7 +149,7 @@
<div class="masthead visible-phone">
<ul class="nav nav-pills pull-right">
<?php if($page == "Home") { ?><li><a href="<?php echo $site_url ?>/sms">SMS</a></li><?php } ?>
<?php if($page == "Home" && $phonenum != null) { ?><li><a href="<?php echo $site_url ?>/sms">SMS</a></li><?php } ?>
<?php if($page != "Home") { ?><li><a href="<?php echo $site_url ?>/">Home</a></li><?php } ?>
<li><a href="<?php echo $site_url ?>/logout">Logout</a></li>
</ul>

View File

@@ -14,10 +14,10 @@ blockquote {
<h3>How to use the SMS system</h3>
<p class="hidden-phone" style="color:#79ad36;font-size:70px;line-height:80px;text-align:center;">+1 (407) 4-SPOONS</p>
<p class="hidden-phone" style="color:#999999;font-size:50px;line-height:50px;text-align:center;margin-bottom:20px;">+1 (407) 477-6667</p>
<p class="hidden-phone" style="color:#79ad36;font-size:70px;line-height:80px;text-align:center;"><?php if($phonenum_friendly) echo $phonenum_friendly; else echo $phonenum; ?></p>
<p class="hidden-phone" style="color:#999999;font-size:50px;line-height:50px;text-align:center;margin-bottom:20px;"><?php if($phonenum_friendly) echo $phonenum ?></p>
<p class="visible-phone" style="color:#79ad36;font-size:35px;line-height:45px;text-align:center;margin-bottom:10px;font-weight:bold;">+1 (407) 477-6667</p>
<p class="visible-phone" style="color:#79ad36;font-size:35px;line-height:45px;text-align:center;margin-bottom:10px;font-weight:bold;"><?php echo $phonenum ?></p>
<img src="<?php $site_url ?>/assets/img/sms-screenshot.jpg" class="hidden-phone" style="float:right;margin:20px 0px 20px 20px;">
<p style="margin:20px 0px;"><strong>To interact with the spooning management interface via SMS, use the following commands:</strong></p>