Ejemplo n.º 1
0
  public function addSpider($json) {
   ajax_echo_r ($json);
   
   if ($json->ID>0) {
    foreach ($json as $k=>$v) {
     if ($k!="ID") {
      $sql_set .= "`".$k."`='".$v."', ";
     }
    }
    $sql_set = substr($sql_set,0,strlen($sql_set)-2);
    
    $sql = "
     UPDATE `spiderman`
     SET    ".$sql_set."
     WHERE  `ID` = '".$json->ID."'
     ; 
    ";
    $ret=$this->db->exec($sql);                                   // save the new GalleryID to the parent object's table
    $this->addEvent('SpiderUpdated','tasks','ID',$json->ID,$json->ID);
   } else {
    foreach ($json as $k=>$v) {
     if ($k!="ID") {
      $sql_insert .= "`".$k."`, ";
      $sql_values .= "'".$v."', ";
     }
    }
    $sql_insert = substr($sql_insert,0,strlen($sql_insert)-2);
    $sql_values = substr($sql_values,0,strlen($sql_values)-2);
    
    $sql="
     INSERT INTO `spiderman`
      (".$sql_insert.")
     VALUES
      (".$sql_values.") ; 
    ";
    $ret=$this->db->exec($sql);                                   // save the new GalleryID to the parent object's table
    $this->addEvent('SpiderAdded','tasks','ID',$ret->lastInsertID,$ret->lastInsertID);
   }
   
//   echo $sql;
   
   
   echo_r ($ret);
   return $ret->lastInsertID;
  }
Ejemplo n.º 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'];
   }
   
   
   
  }
Ejemplo n.º 3
0
 ini_set('max_execution_time', 1800);
 
 include_once ("../model/legacy.php");
 session_start();
 
 $f = unserialize(file_get_contents('data/rb_project_916609_livetmr.dat'));
 
 foreach ($f->tasklists as $tl) {
  echo "<div><a href='javascript:;' onclick='toggle(".$tl->id.");'>".$tl->id."-".$tl->name."</a><br><div class=content id='".$tl->id."'><hr>";
  if ($tl->tasks) {
   foreach ($tl->tasks as $t) {
    echo "<div>".$t->name."<br>".$t->first_comment->body_html;
    foreach ($t->recent_comments as $c) {
     echo "<div>".$c->body_html."</div>";
    }
    echo "</div><hr>";
   }
  }
  echo "</div></div>";
//  echo "<hr>";
 }
 
 
 echo "<hr>";
 
 ajax_echo_r($f);
 
?>

</body>
</html>
Ejemplo n.º 4
0
 function counter() {
  $this->model->addVisit($_REQUEST);
  
  ajax_echo_r ($_REQUEST);
  addtologEx($_REQUEST, "counter.log");
 }
Ejemplo n.º 5
0
  public function exec($sql) {                            // execute query
   $this->openConnection();
   if ($this->DBH) {                                       // if we connected
    $ret = new stdClass();
    $sql = $this->sqlreplace($sql);
    try {
//     echo ("SQL:--".$sql."--");
//     file_put_contents('data/logs/SQL-exec.txt', $sql."\n", FILE_APPEND);  // write to log in case of errors
     $ret->rowsAffected = $this->DBH->exec($sql);  
    } catch(PDOException $e) {
     if ($settings->displaydberrors!="0") {
      echo "exec - Error in SQL: <br>\n".nl2br($sql)."<br>\n".$e->getMessage()."<br>";
      ajax_echo_r ($e->getMessage()."<br>\n");
      debug_print_backtrace();
     }
     @mkdirr('data/logs');
     file_put_contents('data/logs/PDOErrors.txt', $e->getMessage()."\n", FILE_APPEND);  // write to log in case of errors
    }
    $ret->lastInsertID = $this->DBH->lastInsertId();
    return $ret;
   }
   $this->closeConnection();
  }
Ejemplo n.º 6
0
 function preview() {
  ajax_echo_r(htmlentities($this->template));
 }