<?php include_once '../lib/_functions.inc.php'; // app functions include_once '../lib/classes/Db.class.php'; // db connector, queries include_once '../lib/classes/Station.class.php'; // model include_once '../lib/classes/StationView.class.php'; // view // set default values so page loads without passing params $station = safeParam('station', 'aoa1'); $network = safeParam('network', 'Pacific'); if (!isset($TEMPLATE)) { $TITLE = 'GPS Station ' . strtoupper($station) . " ({$network} Network)"; $NAVIGATION = true; $HEAD = '<link rel="stylesheet" href="' . $MOUNT_PATH . '/css/station.css" />'; $FOOT = '<script src="' . $MOUNT_PATH . '/js/station.js"></script>'; include 'template.inc.php'; } $db = new Db(); // Db query result: all "non-hidden" networks that selected station belongs to $rsNetworkList = $db->queryNetworkList($station); // Create an array of networks $networkList = array(); while ($row = $rsNetworkList->fetch(PDO::FETCH_ASSOC)) { array_push($networkList, $row['network']); } // Add currently selected network if it's not already in the list // (this would happen if user is viewing a "hidden" network) if (!in_array($network, $networkList)) {
<?php include_once '../conf/config.inc.php'; // app config include_once '../lib/_functions.inc.php'; // app functions include_once '../lib/classes/Db.class.php'; // db connector, queries include_once '../lib/classes/Photo.class.php'; // model include_once '../lib/classes/PhotoCollection.class.php'; // collection include_once '../lib/classes/PhotoView.class.php'; // view // set default value so page loads without passing params $station = safeParam('station', '7adl'); if (!isset($TEMPLATE)) { $TITLE = 'GPS Station ' . strtoupper($station) . ' Photos'; $NAVIGATION = true; $HEAD = '<link rel="stylesheet" href="' . $MOUNT_PATH . '/css/photos.css" />'; $FOOT = ''; include 'template.inc.php'; } $db = new Db(); // Db query result: station details for selected station $rsStation = $db->queryStation($station); $station_exists = $rsStation->fetch(); if ($station_exists) { // Get a list of photos for selected station $dir = sprintf('%s/stations/%s.dir/%s/photos/screen', $DATA_DIR, substr($station, 0, 1), $station); $files = getDirContents($dir);
<?php include_once '../conf/config.inc.php'; // app config include_once '../lib/_functions.inc.php'; // app functions include_once '../lib/classes/Db.class.php'; // db connector, queries date_default_timezone_set('UTC'); $callback = safeParam('callback'); $now = date(DATE_RFC2822); $db = new Db(); // Db query result: all "non-hidden" networks $rsNetworks = $db->queryNetworks(); // Initialize array template for json feed $output = ['generated' => $now, 'count' => $rsNetworks->rowCount(), 'type' => 'FeatureCollection', 'features' => []]; // Store results from db into features array while ($row = $rsNetworks->fetch(PDO::FETCH_ASSOC)) { // Points $feature = ['geometry' => ['coordinates' => [floatval($row['lon']), floatval($row['lat'])], 'type' => 'Point'], 'id' => 'point' . intval($row['id']), 'properties' => ['name' => $row['name'], 'type' => $row['type']], 'type' => 'Feature']; array_push($output['features'], $feature); // Polygons if ($row['polygon']) { // not all networks necessarily have a polygon defined $poly = array('geometry' => array('coordinates' => array(json_decode($row['polygon'], true)), 'type' => 'Polygon'), 'id' => 'poly' . intval($row['id']), 'properties' => [], 'type' => 'Feature'); array_push($output['features'], $poly); } } // Send json stream to browser showJson($output, $callback);
<?php include_once '../conf/config.inc.php'; // app config include_once '../lib/_functions.inc.php'; // app functions include_once '../lib/classes/Db.class.php'; // db connector, queries date_default_timezone_set('UTC'); $callback = safeParam('callback'); $days = safeParam('days', 30); $mag = safeParam('mag', 2.5); $now = date(DATE_RFC2822); $time = time(); $db = new Db(); // Db query result: real-time earthquakes, mag>=$mag, past $days days $rsEarthquakes = $db->queryEarthquakes($mag, $days); // Initialize array template for json feed $output = array('count' => $rsEarthquakes->rowCount(), 'generated' => $now, 'type' => 'FeatureCollection', 'features' => []); // Store results from db into features array while ($row = $rsEarthquakes->fetch(PDO::FETCH_ASSOC)) { $timestamp = strtotime($row['datetime (GMT)']); // Convert to roman numerals $dyfi = $row['dyfi_maxcdi']; if ($dyfi) { $dyfi = toNumeral(intval(round($dyfi))); } $shakemap = $row['shakemap_maxmmi']; if ($shakemap) { $shakemap = toNumeral(intval(round($shakemap))); }
<?php /* TODO: 1 add links above Map 2 add mouseover labels for list below map 3 add alert for network not found 4 add legend */ include_once '../conf/config.inc.php'; // app config include_once '../lib/_functions.inc.php'; // app functions // set default value so page loads without passing params $network = safeParam('network', 'Alaska'); if (!isset($TEMPLATE)) { $TITLE = $network . ' Network'; $NAVIGATION = true; $HEAD = ' <link rel="stylesheet" href="/lib/leaflet-0.7.7/leaflet.css" /> <link rel="stylesheet" href="' . $MOUNT_PATH . '/css/network.css" /> '; $FOOT = ' <script>var NETWORK = "' . $network . '";</script> <script>var MOUNT_PATH = "' . $MOUNT_PATH . '";</script> <script src="/lib/leaflet-0.7.7/leaflet.js"></script> <script src="' . $MOUNT_PATH . '/js/network.js"></script> '; // importJsonToArray() sets headers -> needs to run before including template $stations = importJsonToArray(__DIR__ . "/_getStations.json.php", $network); include 'template.inc.php';
<?php include_once '../conf/config.inc.php'; // app config include_once '../lib/_functions.inc.php'; // app functions include_once '../lib/classes/Db.class.php'; // db connector, queries date_default_timezone_set('UTC'); $direction = safeParam('direction'); $station = safeParam('station', '157p'); $now = date(DATE_RFC2822); $db = new Db(); // Db query result: time series data for given station $rsTimeSeries = $db->queryTimeSeries($station); // Set header if (preg_match('/^north|east|vertical$/', $direction)) { $header = sprintf("Datetime-UTC, %s\n", ucfirst($direction)); } else { $header = "Datetime-UTC, Datetime-J2000, North, East, Vertical\n"; } $output = $header; // Add timeseries data while ($row = $rsTimeSeries->fetch(PDO::FETCH_ASSOC)) { // J2000 time (epoch field) starts at 12 noon on 1 January 2000 UTC $secs_1970_2000 = mktime(12, 0, 0, 01, 01, 2000); $timestamp = $row['epoch'] + $secs_1970_2000; $date = date('Y/m/d H:i:s', $timestamp); // show only chosen component - for timeseries plot if ($direction) { $values = floatval($row[$direction]);
<?php include_once '../conf/config.inc.php'; // app config include_once '../lib/_functions.inc.php'; // app functions include_once '../lib/classes/Db.class.php'; // db connector, queries if (!isset($TEMPLATE)) { $TITLE = 'GPS Station List'; $NAVIGATION = true; $HEAD = '<link rel="stylesheet" href="' . $MOUNT_PATH . '/css/stationlist.css" />'; $FOOT = ''; include 'template.inc.php'; } $filter = safeParam('filter'); $db = new Db(); // Db query result: first char for all stations in db $rsStationChars = $db->queryStationChars(); // Create html for jumplist $nav_html = '<nav class="jumplist">'; while ($row = $rsStationChars->fetch(PDO::FETCH_ASSOC)) { $link_html = '<a href="%s/stations/%s/">%s</a>'; // highlight current selection if ($row['alphanum'] === $filter) { $link_html = '<a href="%s/stations/%s/"><strong>%s</strong></a>'; } $nav_html .= sprintf($link_html, $MOUNT_PATH, $row['alphanum'], strtoupper($row['alphanum'])); } $nav_html .= '</nav>'; // Db query result: station list
<?php include_once '../conf/config.inc.php'; // app config include_once '../lib/_functions.inc.php'; // app functions include_once '../lib/classes/Db.class.php'; // db connector, queries date_default_timezone_set('UTC'); $callback = safeParam('callback'); $station = safeParam('station', 'coco'); $now = date(DATE_RFC2822); $db = new Db(); // Db query result: all qc data for a given station $rsQcData = $db->queryQcData($station); // Initialize array template for json feed $output = ['count' => $rsQcData->rowCount(), 'generated' => $now]; // Create a nested array for each type of data to store $fields = ['comp_obs', 'date', 'mp1', 'mp2', 'pos_obs', 'slips', 'sn1', 'sn2']; foreach ($fields as $field) { $output[$field] = []; } // Store results from db into output array while ($row = $rsQcData->fetch(PDO::FETCH_ASSOC)) { foreach ($fields as $field) { $value = $row[$field]; if ($field === 'date') { $value = date('Y-m-d', strtotime($value)); } else { if ($field === 'slips') { // convert slips to log base 10