Exemple #1
0
  function extmail() {
   $req = new stdClass;
   $req->Get  = $_GET;
   $req->Post = $_POST;
   
//   ajax_echo_r ($req);
   
   $subject       = getvariablereq('subject');
   $mail_template = getvariablereq('mail_template');
   $email         = getvariablereq('email');
   $from_name     = getvariablereq('from_name');
   $from_mail     = getvariablereq('from_mail');
   
   $ret = sendmail ($subject, $mail_template, $email, $from_name, $from_mail);
   $req->Result = $ret;
   setCache('request-'.date('Y-m-d-H-i-s'), $req);
   echo json_encode($req);
  }
Exemple #2
0
  public function sms() {                                                      // the main sub in our application
   include_once("model/transport.php");       // connect to the Settings 
   
   if(!isset($_SESSION)) session_start();
   
   $action = getvariablereq('action');          // get action from the request
   $data   = getvariablereq('data'  );          // get JSON data from the request
   
   $t = $this->model->getStats('common');
   
   echo "Report date: ".date("Y-m-d H:i:s")."<br>";
   
   $phones_first  = array();	
   $phones_second = array();	
   $users=$this->model->getUsersSms();
   $this->model->resetUsersFirstSms();
   
//   ajax_echo_r ($users);
   
   foreach ($users as $user) {
    if ($user->Phone) {
     $user->Phone = str_replace("+7", "8", $user->Phone);
     $user->Phone = str_replace( "-",  "", $user->Phone);
     
     if ($user->FirstSms) {
      $phones_first[]  .= $user->Phone;
     } else {
      $phones_second[] .= $user->Phone;
     }
    }
   }
   
   $info = "Всего собственников ".$t->objects_total.", из них новых ".$t->objects_yesterday.". Всего покупателей ".$t->customers_total.", из них новых ".$t->customers_yesterday.". ";
//   $info.= "Потенциальных сделок ".$t->handshakes_auto.". ";
   $info.= "Сделок на этой неделе ".$t->handshakes_thisweek." (осталось сделать  ".($t->handshakes_thisweek_plan - $t->handshakes_thisweek).").";
   
   echo $info;
   
   $api = new Transport($this->settings);
   $params_first  = array(
    "text" => "Привет, это СМСка от Изума. ".$info
   );
   $params_second = array(
    "text" => "Доброе утро. Изум-информ сообщает: ".$info
   );
   
//   $phones_first  = array('89376411426');
//   $phones_second = array('89276047754');
   
   ajax_echo_r ($phones_first);
   ajax_echo_r ($phones_second);
   
   $send_first  = $api->send($params_first  ,$phones_first);
   $send_second = $api->send($params_second ,$phones_second);
   
   ajax_echo_r ($send_first);
   ajax_echo_r ($send_second);
   
   if ($send['code'] == 1) {
//    echo 'Отправлено '.$send['colSendAbonent'].', не отправлено';
   } else {
//    echo $send['descr'];
   }
   
   
   
  }
Exemple #3
0
  public function util() {
   $action = getvariablereq   ('action');          // get action from the request
   $data   = getvariablereq   ('data'  );          // get JSON data from the request
   switch ($action) {
    case ('latestversion'):
     $ret = sdir('data/dbconvert','*.zip');
     
     $latestversion = 0;
//     ajax_echo_r ($ret);
     if ($ret) {
      foreach ($ret as $file) {
       $p0 = strpos($file,".")+1;
       $p1 = strrpos($file,".");
       
       $thisversion = substr($file, $p0, $p1-$p0);
       
       $thisver = explode(".",$thisversion);
       $ma = (int)$thisver[0];
       $mi = (int)$thisver[1];
       $re = (int)$thisver[2];
       
       $v = $ma*100000 + $mi*1000 + $re;
       if ($v>$latestversion) $latestversion = $v;
       
      }
      echo $latestversion;
     }
     
    break;
    case ('getlatestversion'):
     $ret = sdir('data/dbconvert','*.zip');
     
     $latestversion = 0;
     
     if ($ret) {
      foreach ($ret as $file) {
       $p0 = strpos($file,".")+1;
       $p1 = strrpos($file,".");
       
       $thisversion = substr($file, $p0, $p1-$p0);
       
       $thisver = explode(".",$thisversion);
       $ma = (int)$thisver[0];
       $mi = (int)$thisver[1];
       $re = (int)$thisver[2];
       
       $v = $ma*100000 + $mi*1000 + $re;
       if ($v==$data) {
        $fileext = strtolower(substr($file,strrpos($file,".")+1));
        $type    = mimetype($fileext);
        header("Content-type: ".$type);
        
        $today = date("F j, Y, g:i a");
        $time  = time();
        
        header("Content-Disposition: attachment;filename=".$file);
        header("Content-Transfer-Encoding: binary");
        header("Content-Length: ".filesize($file));
        header('Pragma: no-cache');
        header('Expires: 0'); 
        
        echo file_get_contents(getrootdirsrv().$file);
       }
       
      }
//      echo $latestversion;
     }
     
    break;
   }
   
//   ajax_echo_r ($ret);
  }