The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ
1
0
Fork 0
A JSON-RPC based SMS Gateway
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
smsgateway/smsSender.php

62 lines
1.7 KiB

<?php
class smsSender
{
protected $sessionId = null;
protected $backend;
public function __construct($backend, $sessionId)
{
$this->sessionId = $sessionId;
$this->backend = $backend;
}
public function login($username, $password)
{
try
{
$token = $this->backend->getToken($username, $password, $_SERVER['REMOTE_ADDR'], $this->sessionId);
}
catch (Exception $e)
{
throw new Exception('Authentication failed. Reason: ' . $e->getMessage());
}
$this->backend->auditLog($_SERVER['REMOTE_ADDR'], 'login', 'Successful login by ' . $username);
return $token;
}
public function send($token, $recipient, $message, $passwordLocations)
{
/*
if (valid_token($token)
{
if (send_sms($recipient, $message))
{
audit_log('Successful message sending by $token->username at $ip');
message_log('$message successfully sent to $recipient');
}
else
{
audit_log('Message sending failed for $token->username at $ip');
}
}
else
{
audit_log('Message sending attempt from $ip with invalid token');
throw new Exception('Authentication failed. Reason: Invalid Token');
}
*/
/* TODO: implement */
throw new Exception('This feature is not yet implemented');
}
public function logout($token)
{
/*
delete_token($token);
audit_log('$token->username logged out at $ip');
return 'success';
*/
/* TODO: implement */
throw new Exception('This feature is not yet implemented');
}
}