Merge branch 'master' of https://github.com/crunchbutton/crunchbutton
This commit is contained in:
commit
b3c2a640a8
@ -3,7 +3,7 @@ class Controller_api_twilio_error extends Crunchbutton_Controller_Rest {
|
||||
|
||||
public function init() {
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
switch ( c::getPagePiece( 3 ) ) {
|
||||
|
||||
@ -45,7 +45,7 @@ class Controller_api_twilio_error extends Crunchbutton_Controller_Rest {
|
||||
|
||||
public function processErrorMessage( $error_message, $callto ){
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$twilio = new Services_Twilio( c::config()->twilio->{ $env }->sid, c::config()->twilio->{ $env }->token );
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ class Controller_api_twilio_sms extends Crunchbutton_Controller_Rest {
|
||||
|
||||
$phone = str_replace('+1','',$_REQUEST['From']);
|
||||
$body = trim($_REQUEST['Body']);
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
$twilio = new Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
$tsess = Session_Twilio::get();
|
||||
$tsess->data = json_encode($_REQUEST);
|
||||
@ -216,7 +216,7 @@ class Controller_api_twilio_sms extends Crunchbutton_Controller_Rest {
|
||||
|
||||
$nums[] = $rsess->phone;
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
// Log
|
||||
Log::debug( [ 'action' => 'replying message', 'rep' => $rep, 'session id' => $rsess->id_session_twilio, 'num' => $nums, 'message' => $message, 'type' => 'sms' ] );
|
||||
|
||||
@ -146,7 +146,7 @@ class Controller_api_user extends Crunchbutton_Controller_Rest {
|
||||
else {
|
||||
$phone = $email;
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$twilio = new Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ class Cana extends Cana_Model {
|
||||
$sleep = ' -s='.$ms;
|
||||
}
|
||||
|
||||
$env = ' -e=' . ( c::env() == 'live' ? 'live' : c::env() );
|
||||
$env = ' -e=' . ( c::getEnv(false) );
|
||||
|
||||
$cmd = c::config()->dirs->root.'cli/timeout.php'.$sleep.' -c='.str_replace("'",'"',escapeshellarg($encoded)) . $env;
|
||||
|
||||
|
||||
@ -421,10 +421,22 @@ class Crunchbutton_App extends Cana_App {
|
||||
return $config;
|
||||
}
|
||||
|
||||
public function getEnv($d = true) {
|
||||
if (c::user()->debug) {
|
||||
$env = 'dev';
|
||||
} elseif (c::env() == 'live') {
|
||||
$env = 'live';
|
||||
} elseif ($d) {
|
||||
$env = 'dev';
|
||||
} else {
|
||||
$env = c::env();
|
||||
}
|
||||
return $env;
|
||||
}
|
||||
|
||||
public function balanced() {
|
||||
if (!$this->_balanced) {
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
\Balanced\Settings::$api_key = c::config()->balanced->{$env}->secret;
|
||||
\Balanced\Settings::$api_key = c::config()->balanced->{c::getEnv()}->secret;
|
||||
$marketplace = Balanced\Marketplace::mine();
|
||||
$this->_balanced = $marketplace;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ class Crunchbutton_Charge_Stripe extends Crunchbutton_Charge {
|
||||
}
|
||||
|
||||
public function charge($params = []) {
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
Stripe::setApiKey(c::config()->stripe->{$env}->secret);
|
||||
$success = false;
|
||||
$reason = false;
|
||||
|
||||
@ -34,7 +34,7 @@ class Crunchbutton_Hipchat_Notification extends Cana_Model {
|
||||
|
||||
public static function sendNotification($msg) {
|
||||
$msg = urlencode(str_replace('\n', ' ', $msg));
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
$msg = "[env:$env]+" . $msg;
|
||||
$url = self::$api_url.
|
||||
'?auth_token='.self::$auth_token.
|
||||
|
||||
@ -12,7 +12,7 @@ class Crunchbutton_Log extends Cana_Table {
|
||||
if ($log->level == 'critical') {
|
||||
// send notifications
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
$twilio = new Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
|
||||
foreach (c::config()->text as $supportName => $supportPhone) {
|
||||
|
||||
@ -10,7 +10,7 @@ class Crunchbutton_Notification extends Cana_Table
|
||||
|
||||
public function send(Crunchbutton_Order $order) {
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
if ($_SESSION['admin'] && c::admin()->testphone) {
|
||||
c::config()->twilio->testnumber = c::admin()->testphone;
|
||||
}
|
||||
@ -157,7 +157,7 @@ class Crunchbutton_Notification extends Cana_Table
|
||||
$date = $order->date();
|
||||
$date = $date->format( 'M jS Y' ) . ' - ' . $date->format( 'g:i:s A' );
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$message = 'FAX Error: O# ' . $order->id_order . ' for ' . $order->restaurant()->name . ' (' . $date . ').';
|
||||
$message .= "\n";
|
||||
|
||||
@ -30,7 +30,7 @@ class Crunchbutton_Notification_Log extends Cana_Table {
|
||||
}
|
||||
|
||||
// Issue #1250 - make Max CB a phone call in addition to a text
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$twilio = new Services_Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
|
||||
@ -93,7 +93,7 @@ class Crunchbutton_Notification_Log extends Cana_Table {
|
||||
}
|
||||
|
||||
// Issue #1250 - make Max CB a phone call in addition to a text
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$twilio = new Services_Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
|
||||
|
||||
@ -284,7 +284,7 @@ class Crunchbutton_Order extends Cana_Table {
|
||||
$user->delivery_type = $this->delivery_type;
|
||||
$user->tip = $this->tip;
|
||||
|
||||
$this->env = c::env();
|
||||
$this->env = c::getEnv(false);
|
||||
$this->processor = c::config()->processor;
|
||||
|
||||
$user->save();
|
||||
@ -690,7 +690,7 @@ class Crunchbutton_Order extends Cana_Table {
|
||||
return;
|
||||
}
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
$num = ($env == 'live' ? $this->restaurant()->phone : c::config()->twilio->testnumber);
|
||||
|
||||
$log = new Notification_Log;
|
||||
@ -721,7 +721,7 @@ class Crunchbutton_Order extends Cana_Table {
|
||||
}
|
||||
|
||||
public function receipt() {
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
//$num = ($env == 'live' ? $this->phone : c::config()->twilio->testnumber);
|
||||
$num = $this->phone;
|
||||
|
||||
@ -877,7 +877,7 @@ class Crunchbutton_Order extends Cana_Table {
|
||||
$date = $order->date();
|
||||
$date = $date->format( 'M jS Y' ) . ' - ' . $date->format( 'g:i:s A' );
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$message = 'O# ' . $order->id_order . ' for ' . $order->restaurant()->name . ' (' . $date . ') not confirmed.';
|
||||
$message .= "\n";
|
||||
@ -1241,7 +1241,7 @@ class Crunchbutton_Order extends Cana_Table {
|
||||
switch ($this->processor) {
|
||||
case 'stripe':
|
||||
default:
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
Stripe::setApiKey(c::config()->stripe->{$env}->secret);
|
||||
$ch = Stripe_Charge::retrieve($this->txn);
|
||||
try {
|
||||
|
||||
@ -6,7 +6,7 @@ class Crunchbutton_Payment extends Cana_Table {
|
||||
$payment->date = date('Y-m-d H:i:s');
|
||||
$credit = Crunchbutton_Balanced_Credit::credit($payment->restaurant(), $payment->amount, $payment->note);
|
||||
$payment->balanced_id = $credit->id;
|
||||
$payment->env = c::env();
|
||||
$payment->env = c::getEnv(false);
|
||||
$payment->save();
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* ghetto verion */
|
||||
class Crunchbutton_Phaxio {
|
||||
public function __construct($params = []) {
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
$cmd = 'curl https://api.phaxio.com/v1/send '
|
||||
.'-F "to='.$params['to'].'" '
|
||||
.'-F "filename=@'.$params['file'].'" ';
|
||||
@ -40,7 +40,7 @@ class Crunchbutton_Phaxio {
|
||||
}
|
||||
|
||||
public function fax_html($fax_number, $html_string) {
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
$html_string = str_replace('"','\"',$html_string);
|
||||
$html_string = str_replace('$','\$',$html_string);
|
||||
$cmd = 'curl '
|
||||
|
||||
@ -254,7 +254,7 @@ class Crunchbutton_Promo extends Cana_Table
|
||||
|
||||
if( $this->notify_phone ){
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$twilio = new Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
|
||||
@ -316,7 +316,7 @@ class Crunchbutton_Promo extends Cana_Table
|
||||
'type' => 'promo_email'
|
||||
]);
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
if( $env == 'live' ){
|
||||
$serverUrl = '_DOMAIN_';
|
||||
@ -366,7 +366,7 @@ class Crunchbutton_Promo extends Cana_Table
|
||||
'type' => 'promo_sms'
|
||||
]);
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$twilio = new Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
$phone = $gift->phone;
|
||||
@ -375,8 +375,6 @@ class Crunchbutton_Promo extends Cana_Table
|
||||
return false;
|
||||
}
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
|
||||
if( $env == 'live' ){
|
||||
$serverUrl = '_DOMAIN_';
|
||||
} else {
|
||||
|
||||
@ -18,7 +18,7 @@ class Crunchbutton_Suggestion extends Cana_Table {
|
||||
}
|
||||
|
||||
public function notify() {
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
$phones = c::config()->suggestion->{$env}->phone;
|
||||
$twilio = new Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class Crunchbutton_Support extends Cana_Table {
|
||||
|
||||
$support = $this;
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$twilio = new Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
|
||||
@ -190,7 +190,7 @@ class Crunchbutton_Support extends Cana_Table {
|
||||
// Issue #1100 - Call David if CB receives a support after 1AM
|
||||
if( $hour >= 1 && $hour <= 7 ){
|
||||
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
|
||||
$twilio = new Services_Twilio(c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token);
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ class Crunchbutton_Support_Note extends Cana_Table {
|
||||
}
|
||||
|
||||
public function notify_by_sms() {
|
||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||
$env = c::getEnv();
|
||||
$twilio = new Twilio(
|
||||
c::config()->twilio->{$env}->sid,
|
||||
c::config()->twilio->{$env}->token
|
||||
|
||||
BIN
www/assets/images/micro/appicon-finger-cartoon.png
Normal file
BIN
www/assets/images/micro/appicon-finger-cartoon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
BIN
www/assets/images/micro/appicon-finger-red.png
Normal file
BIN
www/assets/images/micro/appicon-finger-red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
www/assets/images/micro/appicon-finger.png
Normal file
BIN
www/assets/images/micro/appicon-finger.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Loading…
x
Reference in New Issue
Block a user