public function __construct() { cacheFile(URL . 'datafiles/events.json', 'http://api.vateud.net/events/vacc/IRL.json'); $this->_events = json_decode(file_get_contents(URL . 'datafiles/events.json')); foreach ($this->_events as $event) { $starts_date = date('j-M-y', strtotime($event->starts)); $starts_time = date('H:i', strtotime($event->starts)); $ends_date = date('j-M-y', strtotime($event->ends)); $ends_time = date('H:i', strtotime($event->ends)); if (date('Y-m-d') > strtotime($event->ends) && $ends_time > date('H:i')) { $this->current[$event->id] = array('id' => $event->id, 'title' => $event->title, 'subtitle' => $event->subtitle, 'banner_url' => $event->banner_url, 'description' => $event->description, 'short_description' => substr($event->description, 0, 200) . '...', 'starts_date' => $starts_date, 'starts_time' => $starts_time, 'ends_date' => $ends_date, 'ends_time' => $ends_time); } else { $this->past[$event->id] = array('title' => $event->title, 'subtitle' => $event->subtitle, 'banner_url' => $event->banner_url, 'description' => $event->description, 'short_description' => substr($event->description, 0, 200) . '...', 'starts_date' => $starts_date, 'starts_time' => $starts_time, 'ends_date' => $ends_date, 'ends_time' => $ends_time); } } }
public function notams() { foreach ($this->_airports as $airport) { $icao[] = strtolower($airport['icao']); } $airports = implode(',', array_reverse($icao)); cacheFile(URL . 'datafiles/notams.json', 'http://api.vateud.net/notams/' . $airports . '.json'); $this->_notams = json_decode(file_get_contents(URL . 'datafiles/notams.json'), true); foreach ($this->_notams as $notam) { preg_match("/ B\\) (.{10})/", $notam['raw'], $time); $start = '20' . $time[1] . '00'; preg_match("/ C\\) (.{10})/", $notam['raw'], $times); $end = '20' . $times[1] . '00'; $this->notams[] = ['icao' => $notam['icao'], 'raw' => $notam['raw'], 'message' => $notam['message'], 'start' => $start, 'end' => $end]; } return $this->notams; }
public function atcHours($cid) { $cid = intval($cid); cacheFile(URL . 'datafiles/profiles/' . $cid . '.xml', 'https://cert.vatsim.net/cert/vatsimnet/idstatusrat.php?cid=' . $cid, 604800); $xml = new SimpleXMLElement(file_get_contents(URL . 'datafiles/profiles/' . $cid . '.xml')); return o2a($xml->user); }
<td>' . $pilot->name . '</td> <td>' . $pilot->origin . '</td> <td>' . $pilot->destination . '</td> </tr>'; } } else { echo '<div class="text-danger text-center" style="font-size:16px;"><br>No Inbound Traffic to EISN</div><br>'; } unset($pilots); ?> </table> </div> <div class="tab-pane fade" id="outbound"> <table class="table table-striped table-condensed" style="margin:0;"> <?php cacheFile("datafiles/out.json", "http://api.vateud.net/online/departures/ei.json"); $pilots = json_decode(file_get_contents("datafiles/out.json")); if ($pilots) { echo '<tr> <td>Callsign</td> <td>Name</td> <td>From</td> <td>To</td> </tr>'; foreach ($pilots as $pilot) { if (strpos($pilot->planned_altitude, "FL") !== false) { $planAlt = $pilot->planned_altitude; } else { $planAlt = 'FL' . substr($pilot->planned_altitude, 0, 3); } //<strong>Map: </strong><a target=\'_blank\' href=\''.htmlentities($pilot->gcmap).'\'>Click</a><br>
/** * Downloads the addons images like the icon * * @param string $addonId * @param string $repositoryId * @param boolean $forceUpdate * @return void */ function cacheAddonData($addonId, $repositoryId, $forceUpdate = FALSE) { global $configuration; $repoConfig = getRepositoryConfiguration($repositoryId); if ($repoConfig) { $addonWritePath = $configuration['cache']['pathWrite'] . 'Addons' . DIRECTORY_SEPARATOR . $addonId . DIRECTORY_SEPARATOR; $imageTypes = array('icon.png', 'fanart.jpg'); foreach ($imageTypes as $imageType) { $addonThumbnailPath = $addonWritePath . $imageType; $downloadUrl = $repoConfig['dataUrl'] . $addonId . '/' . $imageType; cacheFile($downloadUrl, $addonThumbnailPath, $forceUpdate); } } }
<?php $pagetitle = "Staff List"; require_once "includes/header.php"; cacheFile("../datafiles/staff.json", "http://api.vateud.net/staff_members/vacc/IRL.json"); $staff = json_decode(file_get_contents("../datafiles/staff.json")); //print_r($staff); ?> <h3 class="text-center">Staff</h3> <br> <div class="row"> <div class="col-md-10 col-md-offset-1"> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">List of Staff Members</h3> </div> <div class="panel-body"> <?php if (count($staff)) { ?> <table class="table table-responsive table-striped table-condensed"> <tr> <td><strong>Name</strong></td> <td><strong>CID</strong></td> <td><strong>Callsign</strong></td> <td><strong>Position</strong></td> <td><strong>Contact</strong></td> </tr> <?php foreach ($staff as $s) {
function publishPage($uri, $with_imgs) { $_PEFI = $GLOBALS['_PEFI']; $tr = $_PEFI->tr; $files = array(); // publish current page $edit = $_PEFI->tr->getEdit(); $tr->setEdit(false); // publishing has to be done as anonymous user $vlog = $tr->get('log.visitor'); // log.visitor = visitor tracking $setlog = $vlog->getData(); $vlog->setData('1'); $tr->save($vlog); include_once 'pefi_Router.class.php'; $route = new Pefi_Router($uri, $tr); $imgsdir = 'images/' . $route->page->getKey(); $files[$uri] = cacheFile($route); if ($with_imgs) { foreach (discoverFiles($imgsdir, array('jpg', 'gif', 'png')) as $f) { $files[$f] = $f; } } $server = $tr->get('ftp.server')->getData(); $ret = '<div>Cached file ' . $files[$uri] . '</div>'; if (!empty($server) && $server != 'server_address_goes_here') { $ret .= ftpFilesToServer($files, $tr->get('ftp.filepref')->getData(), $server, $tr->get('ftp.user')->getData(), $tr->get('ftp.pass')->getData()); } // publishing had to be done as anonymous user, now revert $tr->setEdit($edit); $vlog->setData($setlog); $tr->save($vlog); return $ret; }
} elseif ($todo == 'build') { $edit = $tr->getEdit(); $tr->setEdit(False); $log = $tr->get('log.visitor'); $tr->save($tr->get('log.visitor')->setData(1)); unlinkRecursive('_cache'); $_PEFI->view->messages[] = 'Cache Cleaned'; $nr = 1; $content = '<ol>'; foreach (discoverFiles('_pages', '') as $fName) { // shouldn't end with ~ if (!in_array(substr($fName, strlen($fName) - 1, 1), array('~')) && !in_array(substr($fName, 7, 1), array('_'))) { $content .= "<li><p>{$fName}</p><ul>"; foreach ($_PEFI->route->langs as $lang) { $route = new Pefi_Router(createURL(basename($fName), $lang), $tr); $content .= '<li>' . $lang . ' - ' . cacheFile($route) . '</li>'; } $content .= '</ul></li>'; } } $content .= '</ol>'; $_PEFI->view->content = $content; $tr->setEdit($edit); $tr->save($log); } elseif ($todo == 'clearcache') { unlinkRecursive('_cache'); $_PEFI->view->messages[] = '<p>Cache Cleaned</p>'; } elseif ($todo == 'editbfile') { $r = new Pefi_Router($_REQUEST['page'], $tr); $editedFile = $r->pageFile; $editedAction = createActionURL('site', 'savefile');
public function bookings() { cacheFile(URL . 'datafiles/bookings.xml', 'http://vatbook.euroutepro.com/xml.php?fir=EISN'); $xml = new SimpleXMLElement(file_get_contents(URL . 'datafiles/bookings.xml')); return $xml; }