コード例 #1
0
ファイル: websms.class.php プロジェクト: jhalendra/classmandu
 public static function newInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: functions.php プロジェクト: jhalendra/classmandu
function comment_post_sms($comment_id = null)
{
    if ($comment_id != null) {
        $item_id = Params::getParam('id');
        $author = Params::getParam('authorEmail');
        $user = User::newInstance()->findByEmail($author);
        $item = Item::newInstance()->findByPrimaryKey($item_id);
        $author_phone = $user['s_phone_mobile'];
        $msg = "Someone commented on " . $item['s_title'];
        $_credentials = WebSMS::newInstance()->selectWebSMSData();
        $token = $_credentials['pk_ws_token'];
        $signature = $_credentials['ws_signature'];
        $sa = new smsAPI();
        $sa->setCredentials($token, $signature);
        $res = $sa->sendSms($author_phone, $msg);
    }
}
コード例 #3
0
ファイル: websms.php プロジェクト: jhalendra/classmandu
    $status = Params::getParam('status');
    if ($status == "on") {
        $enable = TRUE;
    } else {
        $enable = FALSE;
    }
    ////Check If EveryThing is OK////
    /////////////////////////////////
    $_credentials = WebSMS::newInstance()->selectWebSMSData();
    if ($_credentials == null) {
        WebSMS::newInstance()->insertWebSMSData($token, $signature, $server);
    } else {
        WebSMS::newInstance()->updateWebSMSData($token, $signature, $server, $enable, $_credentials['pk_ws_token']);
    }
}
$_credentials = WebSMS::newInstance()->selectWebSMSData();
$token = null;
$signature = null;
$server = null;
if ($_credentials != null) {
    $token = $_credentials['pk_ws_token'];
    $signature = $_credentials['ws_signature'];
    $server = $_credentials['ws_server'];
    $enable = $_credentials['ws_status'];
    if ($enable == TRUE) {
        $checked = "checked";
    } else {
        $checked = "";
    }
}
if ($enable == null) {