public static function newInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
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); } }
$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) {