public function init() { $conf = Core::conf(); $live = Live::getInstance(); if (empty($live->_theme_control)) { $live->_theme_control = !empty($live->_referer) && $live->_referer[0] == 'Control'; } /* ToDo * * Добавить выбор темы панели управления в настройки * Если _use_control_theme = true, значение $live->_theme брать из настроек */ if ($live->_theme_control) { $live->_theme = $theme_name = 'sky'; } else { $live->_theme = $theme_name = $conf->setting('site_theme'); } }
<?php require_once "config.inc.php"; require_once "Class.Parser.php"; require_once "Class.Live.php"; $live = new Live($config); if (empty($_GET['do'])) { $live->throwError(); } switch ($_GET['do']) { case 'closestupdate': if (empty($_GET['time'])) { $live->throwError(); } else { echo $live->getClosestData($_GET['time'] / 1000); } break; case 'lastbatch': if (empty($_GET['time'])) { $live->throwError(); } else { echo $live->getLastBatch($_GET['time'] / 1000); } break; case 'time': $date = date_create(); echo json_encode(array("time" => date_timestamp_get($date) * 1000)); break; case 'lastupdate': echo $live->getOldestData(); break;
<?php require_once "config.inc.php"; require_once "Class.Parser.php"; require_once "Class.Live.php"; $live = new Live($config); echo $live->getJSON(); $live->cleanUp();
private function isXMLHttpRequest() { $live = Live::getInstance(); return isset($live->_server['HTTP_X_REQUESTED_WITH']) && $live->_server['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || $live->_requestType == 'ajaj'; }
<?php require_once "config.inc.php"; require_once "Class.Parser.php"; require_once "Class.Live.php"; $live = new Live($config); $headers = getallheaders(); if ($headers['Authorisation'] !== $live->credentials) { $out = array('result' => 0, 'error' => 'Invalid Authorisation'); echo json_encode($out); die; } print_r($_GET); if (!$_GET['name'] || !$_GET['from'] || !$_GET['to']) { $out = array('result' => 0, 'error' => 'Invalid Request'); echo json_encode($out); die; } $live->createEvent($_GET['name'], $_GET['from'], $_GET['to']); $out = array('result' => 1, 'error' => null); echo json_encode($out);
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Live the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Live::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php require_once "config.inc.php"; require_once "Class.Parser.php"; require_once "Class.Live.php"; $live = new Live($config); $headers = getallheaders(); if ($headers['Authorisation'] !== $live->credentials) { $out = array('result' => 0, 'error' => 'Invalid Authorisation'); echo json_encode($out); die; } $raw = gzdecode($HTTP_RAW_POST_DATA); $data = json_decode($raw); if (count($data) < 1) { $out = array('result' => 0, 'error' => 'Invalid Data'); echo json_encode($out); die; } $live->insertData($data); $live->cleanUp(); $out = array('result' => 1, 'error' => null); echo json_encode($out); function gzdecode($data, &$filename = '', &$error = '', $maxlength = null) { $len = strlen($data); if ($len < 18 || strcmp(substr($data, 0, 2), "‹")) { $error = "Not in GZIP format."; return null; // Not GZIP format (See RFC 1952) }
<?php require_once "config.inc.php"; require_once "Class.Parser.php"; require_once "Class.Live.php"; $live = new Live($config); $res = opendir("images/"); while ($file = readdir($res)) { if ($file == "." || $file == "..") { continue; } $data = exif_read_data("images/{$file}"); $time = @strtotime($data["DateTimeOriginal"]); $latlongs = $live->getClosestLatLng($time); $in = array('photo_name' => $file, 'time' => $latlongs[0]['timestamp']); $live->AppendDBWithPhotos($in); }