コード例 #1
0
ファイル: content.php プロジェクト: rumi55/openbulksms
 public function Save()
 {
     $content = new OpenSms_Model_Content([0 => $this->Key]);
     if ($content->Id > 0) {
         $this->Id = $content->Id;
     }
     $sql = !$this->Id > 0 ? "insert into " . $this->getTableName() . "(`key`, `type`, `body`, `host`) value('" . StringMethods::MakeSave($this->Key) . "', '" . StringMethods::MakeSave($this->Type) . "', '" . StringMethods::MakeSave($this->Body) . "', '" . StringMethods::MakeSave($this->Host) . "');" : "update " . $this->getTableName() . " set `body` = '" . StringMethods::MakeSave($this->Body) . "'\r\n            where `key` = '" . StringMethods::MakeSave($this->Key) . "';";
     //die($sql);
     return OpenSms_Helper_Db::executeNonQuery($sql);
 }
コード例 #2
0
ファイル: contact.php プロジェクト: rumi55/openbulksms
 public function Delete()
 {
     $sql = "delete from " . OpenSms::getTableName('contact') . " where id = '" . StringMethods::MakeSave($this->Id) . "'";
     //die($sql);
     if (OpenSms_Helper_Db::executeNonQuery($sql)) {
         return 'One number deleted';
     } else {
         return 'Error in deleting number';
     }
 }
コード例 #3
0
ファイル: message.php プロジェクト: rumi55/openbulksms
 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;
         }
     }
 }
コード例 #4
0
ファイル: bulksms.php プロジェクト: rumi55/openbulksms
 public function SaveMessages($messages)
 {
     $sql = 'insert into ' . OpenSms::getTableName('sms') . '(bulkSMSId, number, message, sender, refId, status) value';
     $i = 0;
     foreach ($messages as $message) {
         $i += 1;
         $count = count($messages);
         $sql .= "('" . StringMethods::MakeSave($message->BulkSMSId) . "', '" . StringMethods::MakeSave($message->Number) . "', '" . StringMethods::MakeSave($message->Message) . "', '" . StringMethods::MakeSave($message->Sender) . "', '" . StringMethods::MakeSave($message->RefId) . "', '" . StringMethods::MakeSave($message->Status) . "')";
         if ($i == $count) {
             $sql .= ';';
         } else {
             $sql .= ',';
         }
     }
     OpenSms_Helper_Db::executeNonQuery($sql);
 }
コード例 #5
0
ファイル: install.php プロジェクト: rumi55/openbulksms
 public function save()
 {
     if (!isset($_POST[OpenSms::DB_HOST])) {
         OpenSms::redirectToAction('index');
     }
     //if installed goto dashboard
     if ($this->getSystemSetting(OpenSms::INSTALLATION_STATUS)) {
         OpenSms::redirectToAction('index', 'dashboard');
     }
     //var_dump($_POST);die();
     // CREATE
     $config = new SimpleXmlElement('<settings/>');
     $config->{OpenSms::VERSION} = $this->getSystemSetting(OpenSms::VERSION);
     $config->{OpenSms::SITE_NAME} = $this->getFormData(OpenSms::SITE_NAME);
     $config->{OpenSms::SITE_URL} = $this->getFormData(OpenSms::SITE_URL);
     $config->{OpenSms::DB_TYPE} = 'mysql';
     $config->{OpenSms::DB_HOST} = $this->getFormData(OpenSms::DB_HOST);
     $config->{OpenSms::DB_NAME} = $this->getFormData(OpenSms::DB_NAME);
     $config->{OpenSms::DB_TABLE_PREFIX} = $this->getFormData(OpenSms::DB_TABLE_PREFIX);
     $config->{OpenSms::DB_USERNAME} = $this->getFormData(OpenSms::DB_USERNAME);
     $config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
     $config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
     $config->{OpenSms::CURRENT_THEME_KEY} = 'default';
     $config->{OpenSms::OPEN_PRICE_PER_UNIT} = $this->getFormData(OpenSms::OPEN_PRICE_PER_UNIT);
     $config->{OpenSms::OPEN_UNITS_PER_SMS} = $this->getFormData(OpenSms::OPEN_UNITS_PER_SMS);
     $config->{OpenSms::INSTALLATION_STATUS} = 'installed';
     //unlink(OpenSms::SETTINGS_FILE_PATH);
     $config->saveXML(OpenSms::SETTINGS_FILE_PATH);
     $this->loadSystemSettings();
     //create tables
     OpenSms_Helper_Db::executeNonQuery($this->getDbScript());
     //create admin account
     $user = $this->loadModel('OpenSms_Model_User');
     $user->LoginId = $this->getFormData('admin_username');
     $user->Password = $this->getFormData('admin_password');
     $user->Role = OpenSms_Model_User::ADMIN;
     $saved = $user->save();
     OpenSms::redirectToAction('complete', 'install', 'admin', [0 => $saved == true ? 1 : 0]);
 }
コード例 #6
0
ファイル: user.php プロジェクト: rumi55/openbulksms
 public function GetScheduledMessages()
 {
     $drafts = array();
     $sql = "select * from `draft` where loginId = '" . StringMethods::MakeSave($this->LoginId) . "' and deliveryType = 'scheduled'";
     $result = OpenSms_Helper_Db::executeNonQuery($sql);
     foreach ($result as $d) {
         $drafts[] = OpenSms_Model_Draft::copyFromPDO($d);
     }
     return $drafts;
 }
コード例 #7
0
ファイル: login.php プロジェクト: rumi55/openbulksms
 public function Delete()
 {
     unset($_COOKIE[$this->cookieName]);
     $sql = "delete from logins where id = '" . StringMethods::MakeSave($this->Id) . "'";
     return OpenSms_Helper_Db::executeNonQuery($sql);
 }
コード例 #8
0
ファイル: card.php プロジェクト: rumi55/openbulksms
 public static function GenerateCard($no, $unit)
 {
     $cards = array();
     for ($i = 1; $i <= $no; $i++) {
         //get the s/n
         $snExist = FALSE;
         while (!$snExist) {
             $sn = StringMethods::GetRandomString(5);
             $sql = 'select count(*) as num from ' . OpenSms::getTableName('cards') . ' where serialNumber = "$sn";';
             $result = OpenSms_Helper_Db::executeReader($sql);
             foreach ($result as $r) {
                 if ($r->num == 0) {
                     $snExist = TRUE;
                 }
             }
         }
         //get the pin
         $pinExist = FALSE;
         while (!$pinExist) {
             $pin = StringMethods::GetRandomString(10);
             $sql = 'select count(*) as num from ' . OpenSms::getTableName('cards') . ' where pin = "' . $pin . '";';
             $result = OpenSms_Helper_Db::executeReader($sql);
             foreach ($result as $r) {
                 if ($r->num == 0) {
                     $pinExist = TRUE;
                 }
             }
         }
         //insert the pin
         $sql = 'insert into ' . OpenSms::getTableName('cards') . ' (serialNumber, pin, unit) value("' . $sn . '", "' . $pin . '", "' . $unit . '");';
         $inserted = OpenSms_Helper_Db::executeNonQuery($sql);
         if ($inserted) {
             $card = new OpenSms_Model_Card();
             $card->SerialNumber = $sn;
             $card->Pin = $pin;
             $card->Unit = $unit;
             $cards[] = $card;
         }
     }
     return $cards;
 }
コード例 #9
0
ファイル: transaction.php プロジェクト: rumi55/openbulksms
 public function Delete()
 {
     $sql = "delete from " . OpenSms::getTableName('transactions') . " where id = '{$this->Id}'";
     return OpenSms_Helper_Db::executeNonQuery($sql);
 }
コード例 #10
0
ファイル: page.php プロジェクト: rumi55/openbulksms
 public function Delete()
 {
     $sql = "delete * from " . $this->getTableName() . " where permalink = '{$this->Permalink}'";
     return OpenSms_Helper_Db::executeNonQuery($sql);
 }