示例#1
0
 public function grabEventsFromEmailAction()
 {
     //echo phpinfo();
     $m = new manage_model_event();
     $m->emailGrab();
     core_debug::dump($m);
     core_debug::dump(imap_errors());
     die('at ctrl');
 }
示例#2
0
文件: log.php 项目: vgalitsky/moze
 static function log($message, $logfile = 'core.log')
 {
     if (!is_string($message)) {
         $message = core_debug::dump($message, false);
     }
     $message = date('[m-d-Y H:i:s]:') . $message;
     $fpath = app::getConfig('dir/sd') . DS . self::LOG_DIR . DS . $logfile;
     core_fs::createDirIfNotExists(dirname($fpath));
     $fh = fopen($fpath, 'a+');
     fputs($fh, $message . "\n");
     fclose($fh);
     return $message;
 }
示例#3
0
 public function rndAction()
 {
     for ($i = 0; $i < 100; $i++) {
         $lt = rand(1, 10);
         $lng = rand(1, 10);
         $a = rand(1, 3);
         $u = rand(24, 27);
         $c = rand(1, 4);
         $e = new manage_model_event();
         $data = array('lat' => 49.26 + $lt / 10, 'long' => 27.69 + $lng / 10, 'user_id' => $u, 'activity_id' => $a, 'city_id' => $c, 'date' => strtotime(rand(1, 29) . '.' . rand(1, 7) . '.' . '2015'), 'marker_color' => '#efefef');
         $e->setData($data);
         core_debug::dump($e);
         $e->save();
     }
 }
示例#4
0
 /**
  * F*****G SHIT FUNCTION . SORRY FOR THS F**K
  * @param $csv
  * @param $orig
  * @return array
  * @throws Exception
  */
 protected function _pareseEmailBodyCsv($csv, $orig)
 {
     //$orig = $this->_prepareCsvString($csv);
     $csv = $this->_prepareCsvString($orig);
     $array = explode(';', $csv);
     if (!is_array($array) || !isset($array[0]) || !isset($array[1]) || !isset($array[2]) || !isset($array[3]) || !isset($array[4])) {
         $csv = $this->tryEncodeUtf8($orig);
         $csv = $this->_prepareCsvString($csv);
         core_debug::dump($csv);
         $array = str_getcsv($csv, ';');
     }
     if (!is_array($array) || !isset($array[0]) || !isset($array[1]) || !isset($array[2]) || !isset($array[3]) || !isset($array[4])) {
         $csv = $this->tryEncodebase64($orig);
         $csv = $this->_prepareCsvString($csv);
         core_debug::dump($csv);
         $array = str_getcsv($csv, ';');
     }
     if (!is_array($array) || !isset($array[0]) || !isset($array[1]) || !isset($array[2]) || !isset($array[3]) || !isset($array[4])) {
         throw new Exception('Error while parsing email body');
     }
     $lat = $array[1];
     $long = $array[2];
     $user_id = $this->_getUserByImei($array[0]);
     $user = new manage_model_user();
     $user->load($user_id);
     $city_name = core_google_geo::findCityName($lat, $long);
     if (!$city_name) {
         $city_id = $user->getData('city_id');
     } else {
         $city_id = $this->_getCityIdByName($city_name);
     }
     $data = array('imei' => $array[0], 'user_id' => $user_id, 'lat' => $lat, 'long' => $long, 'date' => $array[3] / 1000, 'activity_id' => $array[4], 'city_id' => $city_id);
     core_log::log($data, self::$grabtime . '.event.imap.log');
     return $data;
 }