Beispiel #1
0
<?php

include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/tm4b.php';
include dirname(__FILE__) . '/classes/Tm4bSms.php';
if (!Configuration::get('TM4B_DAILY_REPORT_ACTIVE')) {
    die('Daily report not active');
}
if (Configuration::get('TM4B_LAST_REPORT') == date('Y-m-d')) {
    die('Report already sent');
}
Configuration::updateValue('TM4B_LAST_REPORT', date('Y-m-d'));
$module = new Tm4b();
$sms = new Tm4bSms(Configuration::get('TM4B_USER'), Configuration::get('TM4B_PASSWORD'), Configuration::get('TM4B_ROUTE'));
$sms->msg = $module->getStatsBody();
$numbers = explode(',', Configuration::get('TM4B_NEW_ORDER_NUMBERS'));
foreach ($numbers as $number) {
    if ($number != '') {
        $sms->addRecipient($number);
    }
}
$sms->Send(Configuration::get('TM4B_SIM'));
die('OK');
Beispiel #2
0
 public function getContent()
 {
     include_once dirname(__FILE__) . '/classes/Tm4bSms.php';
     $this->_html = '<h2>' . $this->displayName . '</h2>';
     if (!empty($_POST)) {
         if (isset($_POST['btnTestSms'])) {
             if (!empty($this->_user) and !empty($this->_password) and !empty($_POST['test_number']) and is_numeric($_POST['test_number'])) {
                 $sms = new Tm4bSms($this->_user, $this->_password, $this->_route, $this->_originator);
                 $sms->msg = 'Test SMS for your PrestaShop website';
                 $sms->addRecipient($_POST['test_number']);
                 $ret = $sms->Send($this->_simulation);
                 if ($sms->isSent()) {
                     $this->_html .= $this->displayConfirmation($this->l('Message successfully sent'));
                 } else {
                     $this->_html .= $this->displayError($this->l('Error while sending message'));
                 }
             } else {
                 $this->_html .= $this->displayError($this->l('Login and phone number'));
             }
         } else {
             $this->_postValidation();
             if (!sizeof($this->_postErrors)) {
                 $this->_postProcess();
             } else {
                 foreach ($this->_postErrors as $err) {
                     $this->_html .= $this->displayError($err);
                 }
             }
         }
     }
     $this->_displayTm4b();
     $this->_displayForm();
     return $this->_html;
 }