Example #1
0
 public function showSMSqueue()
 {
     $smsPath = 'content/tsms/';
     $tsms_host = $this->settings['WATCHDOG_TSMS_GATEWAY'];
     $tsms_db = 'users';
     $tsms_login = $this->settings['WATCHDOG_TSMS_LOGIN'];
     $tsms_password = $this->settings['WATCHDOG_TSMS_PASSWORD'];
     $tsms_table = $this->settings['WATCHDOG_TSMS_LOGIN'];
     $smsArray = array();
     $TsmsDB = new DbConnect($tsms_host, $tsms_login, $tsms_password, $tsms_db, $error_reporting = true, $persistent = false);
     $TsmsDB->open() or die($TsmsDB->error());
     $TsmsDB->query('SET NAMES utf8;');
     if (wf_CheckPost(array('showdate'))) {
         $date = mysql_real_escape_string($_POST['showdate']);
     } else {
         $date = '';
     }
     if (!empty($date)) {
         $where = " WHERE `send_time` LIKE '" . $date . "%' ORDER BY `id` DESC;";
     } else {
         $where = '  ORDER BY `id` DESC LIMIT 50;';
     }
     $query = "SELECT * from `" . $tsms_table . "`" . $where;
     $TsmsDB->query($query);
     while ($row = $TsmsDB->fetchassoc()) {
         $smsArray[] = $row;
     }
     //close old datalink
     $TsmsDB->close();
     //rendering result
     $inputs = wf_DatePickerPreset('showdate', curdate());
     $inputs .= wf_Submit(__('Show'));
     $dateform = wf_Form("", 'POST', $inputs, 'glamour');
     $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" ';
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Msg ID'));
     $cells .= wf_TableCell(__('Mobile'));
     $cells .= wf_TableCell(__('Sign'));
     $cells .= wf_TableCell(__('Message'));
     $cells .= wf_TableCell(__('WAP'));
     $cells .= wf_TableCell(__('Cost'));
     $cells .= wf_TableCell(__('Send time'));
     $cells .= wf_TableCell(__('Sended'));
     $cells .= wf_TableCell(__('Status'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($smsArray)) {
         foreach ($smsArray as $io => $each) {
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['msg_id']);
             $cells .= wf_TableCell($each['number']);
             $cells .= wf_TableCell($each['sign']);
             $msg = wf_modal(__('Show'), __('SMS'), $each['message'], '', '300', '200');
             $cells .= wf_TableCell($msg);
             $cells .= wf_TableCell($each['wappush']);
             $cells .= wf_TableCell($each['cost']);
             $cells .= wf_TableCell($each['send_time']);
             $cells .= wf_TableCell($each['sended']);
             $cells .= wf_TableCell($each['status']);
             $rows .= wf_tag('tr', false, 'row3', $lighter);
             $rows .= $cells;
             $rows .= wf_tag('tr', true);
         }
     }
     $result = $dateform;
     $result .= wf_TableBody($rows, '100%', '0', 'sortable');
     return $result;
 }
Example #2
0
 function zb_AsteriskQuery($query)
 {
     global $asteriskHost, $asteriskDb, $asteriskTable, $asteriskLogin, $asteriskPassword, $asteriskCacheTime;
     $asteriskDB = new DbConnect($asteriskHost, $asteriskLogin, $asteriskPassword, $asteriskDb, $error_reporting = true, $persistent = false);
     $asteriskDB->open() or die($asteriskDB->error());
     $result = array();
     $asteriskDB->query('SET NAMES utf8;');
     $asteriskDB->query($query);
     while ($row = $asteriskDB->fetchassoc()) {
         $result[] = $row;
     }
     $asteriskDB->close();
     return $result;
 }
Example #3
0
 /**
  * Sends all sms storage via TurboSMS service
  *  
  * @return void
  */
 protected function turbosmsPushMessages()
 {
     $sign = $this->safeEscapeString($this->settings['TSMS_SIGN']);
     //time shift settings
     $timezone = '2';
     $tz_offset = (2 - $timezone) * 3600;
     $date = date("Y-m-d H:i:s", time() + $tz_offset);
     $allSmsQueue = $this->smsQueue->getQueueData();
     if (!empty($allSmsQueue)) {
         //open new database connection
         $TsmsDB = new DbConnect($this->settings['TSMS_GATEWAY'], $this->settings['TSMS_LOGIN'], $this->settings['TSMS_PASSWORD'], 'users', $error_reporting = true, $persistent = false);
         $TsmsDB->open() or die($TsmsDB->error());
         $TsmsDB->query('SET NAMES utf8;');
         foreach ($allSmsQueue as $eachsms) {
             if (isset($eachsms['number']) and isset($eachsms['message'])) {
                 $query = "INSERT INTO `" . $this->settings['TSMS_LOGIN'] . "` ( `number`, `sign`, `message`, `wappush`,  `send_time`) VALUES\n                    ('" . $eachsms['number'] . "', '" . $sign . "', '" . $eachsms['message'] . "', '', '" . $date . "');\n                ";
                 //push new sms to database
                 $TsmsDB->query($query);
             }
             //remove old sent message
             $this->smsQueue->deleteSms($eachsms['filename']);
         }
         //close old datalink
         $TsmsDB->close();
     }
 }
Example #4
0
 function tsms_query($query)
 {
     global $tsms_host, $tsms_db, $tsms_login, $tsms_password, $tsms_table;
     $TsmsDB = new DbConnect($tsms_host, $tsms_login, $tsms_password, $tsms_db, $error_reporting = true, $persistent = false);
     $TsmsDB->open() or die($TsmsDB->error());
     $result = array();
     $TsmsDB->query('SET NAMES utf8;');
     $TsmsDB->query($query);
     while ($row = $TsmsDB->fetchassoc()) {
         $result[] = $row;
     }
     $TsmsDB->close();
     return $result;
 }