예제 #1
0
 public function Save()
 {
     $sql = "insert into " . OpenSms::getTableName('sms') . "(bulkSMSId, number, message, sender, refId, Status)\r\n\t\t\t\t value('" . StringMethods::MakeSave($this->BulkSMSId) . "', '" . StringMethods::MakeSave($this->Number) . "', '" . StringMethods::MakeSave($this->Message) . "', '" . StringMethods::MakeSave($this->Sender) . "', '" . StringMethods::MakeSave($this->RefId) . "', '" . StringMethods::MakeSave($this->Status) . "');";
     OpenSms_Helper_Db::executeNonQuery($sql);
     if ($this->Id == -1) {
         $sql = "select MAX(id) as no from `" . OpenSms::getTableName('sms') . "`";
         $result = OpenSms_Helper_Db::executeReader($sql);
         foreach ($result as $r) {
             $this->Id = $r->no;
             return $r->no;
         }
     }
 }
예제 #2
0
 public function getById($id = -1)
 {
     $this->Id = $id;
     if ($id != '') {
         $sql = "select * from " . OpenSms::getTableName('contact') . " where id = '" . StringMethods::MakeSave($id) . "';";
         $result = OpenSms_Helper_Db::executeReader($sql);
         foreach ($result as $r) {
             $this->GroupId = $r->groupId;
             $this->Name = StringMethods::GetRaw($r->name);
             $this->Number = StringMethods::GetRaw($r->number);
             $this->Id = $r->id;
         }
     }
 }
예제 #3
0
파일: page.php 프로젝트: rumi55/openbulksms
 public static function GetAll($role = '')
 {
     $pageObj = new OpenSms_Model_Page();
     $tableName = $pageObj->getTableName();
     $sql = "select * from {$tableName}" . (empty($role) ? ';' : " where role = {$role}");
     $results = OpenSms_Helper_Db::executeReader($sql);
     $pages = array();
     foreach ($results as $r) {
         $page = new OpenSms_Model_Page();
         $page->copy([$r]);
         $pages[] = $page;
     }
     return $pages;
 }
예제 #4
0
 public function Save()
 {
     if (!empty($this->Id)) {
         $sql = "update logins set loginId = '" . StringMethods::MakeSave($this->LoginId) . "', token = '" . StringMethods::MakeSave($this->Token) . "', date = now() where id = '{$this->Id}';";
     } else {
         $sql = "insert into logins(loginId, token)\r\n\t\t\t\t value('" . StringMethods::MakeSave($this->LoginId) . "', '" . StringMethods::MakeSave($this->Token) . "');";
     }
     //die($sql);
     //$this->db->SendQuery($sql);
     OpenSms_Helper_Db::executeNonQuery($sql);
     setcookie($this->cookieName, $this->Token, time() + 86400 * 30 * 12 * 10, '/');
     if ($this->Id == -1) {
         $sql = "select MAX(id) as no from `logins`";
         $result = OpenSms_Helper_Db::executeReader($sql);
         return $result[0]->no;
     }
 }
예제 #5
0
파일: user.php 프로젝트: rumi55/openbulksms
 public static function getMobileNos()
 {
     $sql = "select mobileNo from users where mobileNo <> ''";
     $result = OpenSms_Helper_Db::executeReader($sql);
     $nos = '';
     foreach ($result as $r) {
         $fChar = substr($r->mobileNo, 0, 1);
         if (trim($r->mobileNo) != '' && ($fChar == '2' || $fChar == '0' || $fChar == '8')) {
             $nos .= trim($r->mobileNo) . ',';
         }
     }
     return $nos;
 }
예제 #6
0
파일: card.php 프로젝트: rumi55/openbulksms
 public static function GetCard($offset, $limit)
 {
     $sql = "select * from " . OpenSms::getTableName('cards') . " {$offset}, {$limit}";
     $result = OpenSms_Helper_Db::executeReader($sql);
     $cards = array();
     foreach ($result as $r) {
         $card = new OpenSms_Model_Card();
         $card->Id = $r->id;
         $card->Pin = $r->pin;
         $card->Unit = $r->unit;
         $card->IsValid = true;
         $cards[] = $card;
     }
     return $cards;
 }
예제 #7
0
 public static function GetBulkSMS($loginId, $offset, $limit)
 {
     $bulkSMSs = array();
     $sql = "select * from " . OpenSms::getTableName('bulksms') . " where loginId = '{$loginId}' ORDER BY id DESC LIMIT {$offset}, {$limit};";
     $result = OpenSms_Helper_Db::executeReader($sql);
     foreach ($result as $r) {
         $bulkSMS = new OpenSms_Model_BulkSms();
         $bulkSMS->Id = $r->id;
         $bulkSMS->LoginId = StringMethods::GetRaw($r->loginId);
         $bulkSMS->DateCreated = $r->dateCreated;
         $bulkSMS->Message = StringMethods::GetRaw($r->message);
         $bulkSMS->Sender = StringMethods::GetRaw($r->sender);
         $bulkSMS->Status = StringMethods::GetRaw($r->status);
         $bulkSMS->Count = $r->count;
         $bulkSMSs[] = $bulkSMS;
     }
     return $bulkSMSs;
 }
예제 #8
0
 public function getById($key)
 {
     $sql = "select * from " . $this->getTableName() . " where `key` = '{$key}'";
     $result = OpenSms_Helper_Db::executeReader($sql);
     $this->copy($result);
 }
예제 #9
0
 public static function GetRange($offset, $limit, $loginId = '')
 {
     $trans = array();
     $sql = "select * from " . OpenSms::getTableName('transactions') . (empty($loginId) ? "" : "where loginId = '{$loginId}'") . " ORDER BY id DESC LIMIT {$offset}, {$limit};";
     $result = OpenSms_Helper_Db::executeReader($sql);
     foreach ($result as $r) {
         $tran = new OpenSms_Model_Transaction();
         $tran->Id = $r->id;
         $tran->LoginId = StringMethods::GetRaw($r->loginId);
         $tran->Date = $r->date;
         $tran->Amount = StringMethods::GetRaw($r->amount);
         $tran->Unit = StringMethods::GetRaw($r->unit);
         $tran->Status = StringMethods::GetRaw($r->status);
         $tran->Description = StringMethods::GetRaw($r->description);
         $tran->PaymentMethod = StringMethods::GetRaw($r->paymentMethod);
         $tran->IsValid = StringMethods::GetRaw(TRUE);
         $tran->Type = $r->type;
         $tran->Committed = $r->committed;
         $trans[] = $tran;
     }
     return $trans;
 }