mirror of
https://github.com/cwinfo/envayasms.git
synced 2025-07-03 21:57:43 +00:00
rename to EnvayaSMS; add icon
This commit is contained in:
@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__DIR__)."/config.php";
|
||||
require_once dirname(dirname(__DIR__))."/KalSMS.php";
|
||||
require_once dirname(dirname(__DIR__))."/EnvayaSMS.php";
|
||||
|
||||
ini_set('display_errors','0');
|
||||
|
||||
// this example implementation uses the filesystem to store outgoing SMS messages,
|
||||
// but presumably a production implementation would use another storage method
|
||||
|
||||
$kalsms = KalSMS::new_from_request();
|
||||
$request = EnvayaSMS::get_request();
|
||||
|
||||
$phone_number = $kalsms->get_request_phone_number();
|
||||
$phone_number = $request->get_phone_number();
|
||||
|
||||
$password = @$PASSWORDS[$phone_number];
|
||||
|
||||
if (!isset($password) || !$kalsms->is_validated_request($password))
|
||||
if (!isset($password) || !$request->is_validated($password))
|
||||
{
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
error_log("Invalid request signature");
|
||||
@ -22,14 +22,14 @@ if (!isset($password) || !$kalsms->is_validated_request($password))
|
||||
return;
|
||||
}
|
||||
|
||||
$action = $kalsms->get_request_action();
|
||||
$action = $request->get_action();
|
||||
|
||||
switch ($action->type)
|
||||
{
|
||||
case KalSMS::ACTION_INCOMING:
|
||||
case EnvayaSMS::ACTION_INCOMING:
|
||||
error_log("Received SMS from {$action->from}");
|
||||
|
||||
$reply = new KalSMS_OutgoingMessage();
|
||||
$reply = new EnvayaSMS_OutgoingMessage();
|
||||
$reply->message = "You said: {$action->message}";
|
||||
|
||||
error_log("Sending reply: {$reply->message}");
|
||||
@ -38,7 +38,7 @@ switch ($action->type)
|
||||
echo $action->get_response_xml(array($reply));
|
||||
return;
|
||||
|
||||
case KalSMS::ACTION_OUTGOING:
|
||||
case EnvayaSMS::ACTION_OUTGOING:
|
||||
$messages = array();
|
||||
|
||||
$dir = opendir($OUTGOING_DIR_NAME);
|
||||
@ -49,7 +49,7 @@ switch ($action->type)
|
||||
$data = json_decode(file_get_contents("$OUTGOING_DIR_NAME/$file"), true);
|
||||
if ($data && @$data['from'] == $phone_number)
|
||||
{
|
||||
$sms = new KalSMS_OutgoingMessage();
|
||||
$sms = new EnvayaSMS_OutgoingMessage();
|
||||
$sms->id = $data['id'];
|
||||
$sms->to = $data['to'];
|
||||
$sms->from = $data['from'];
|
||||
@ -64,7 +64,7 @@ switch ($action->type)
|
||||
echo $action->get_response_xml($messages);
|
||||
return;
|
||||
|
||||
case KalSMS::ACTION_SEND_STATUS:
|
||||
case EnvayaSMS::ACTION_SEND_STATUS:
|
||||
|
||||
$id = $action->id;
|
||||
|
||||
|
Reference in New Issue
Block a user