function newUpdates($force) { // No need to check if developer mode if (isDeveloper()) { return false; } $cache_path = JAPPIX_BASE . '/store/updates/version.xml'; // No cache, obsolete one or refresh forced if (!file_exists($cache_path) || file_exists($cache_path) && time() - filemtime($cache_path) >= 86400 || $force) { // Get the content $last_version = read_url('http://codingteam.net/project/jappix/upload/briefcase/version.xml'); // Write the content file_put_contents($cache_path, $last_version); } else { $last_version = file_get_contents($cache_path); } // Parse the XML $xml = @simplexml_load_string($last_version); // No data? if ($xml === FALSE) { return false; } // Get the version numbers $current_version = getVersion(); $last_version = $xml->id; // Check if we have the latest version $current_version = versionNumber($current_version); $last_version = versionNumber($last_version); if ($current_version < $last_version) { return true; } return false; }
hideErrors(); compressThis(); // Not allowed for a special node if (isStatic() || isUpload()) { exit; } // If valid data was sent if (isset($_GET['searchquery']) && !empty($_GET['searchquery']) && (isset($_GET['location']) && !empty($_GET['location']))) { // Set a XML header header('Content-Type: text/xml; charset=utf-8'); // Get the values $searchquery = $_GET['searchquery']; $location = $_GET['location']; // Jamendo search? if ($location == 'jamendo') { exit(read_url('http://api.jamendo.com/get2/name+id+duration+url/track/xml/?searchquery=' . urlencode($searchquery) . '&order=searchweight_desc')); } // Local music search $xml = '<data>'; $searchquery = strtolower($searchquery); // Escape the regex special characters $searchquery = escapeRegex($searchquery); // Search in the directory $repertory = '../store/music/'; $scan = scandir($repertory); foreach ($scan as $current) { // This file match our query! if (is_file($repertory . $current) && $current && preg_match('/(^|\\s|\\[)(' . $searchquery . ')(.+)?(\\.(og(g|a)|mp3|wav))$/i', strtolower($current))) { // Get the basic informations $title = preg_replace('/^(.+)(\\.)(og(g|a)|mp3|wav)$/i', '$1', $current); $url = $location . 'store/music/' . $current;
console_write("\n", '', false); console_write('locationanddirectories', 'install'); console_write("\n", '', false); console_write("\n", '', false); } //input the web directory if ($interactive == CLI_FULL || $interactive == CLI_SEMI && !isset($INSTALL['dirroot'])) { console_write('inputwebdirectory', 'install'); //if directories validation lib is found change this to read_dir() and //edit read_dir() in lib/installlib.php to point to validation code $INSTALL['dirroot'] = read(); } //input the web adress if ($interactive == CLI_FULL || $interactive == CLI_SEMI && !isset($INSTALL['wwwroot'])) { console_write('inputwebadress', 'install'); $INSTALL['wwwroot'] = read_url(); } //input data directory if ($interactive == CLI_FULL || $interactive == CLI_SEMI && !isset($INSTALL['dataroot'])) { console_write('inputdatadirectory', 'install'); //if directories validation lib is found change this to read_dir() and //edit read_dir() in lib/installlib.php to point to validation code $INSTALL['dataroot'] = read(); } /// check wwwroot if (ini_get('allow_url_fopen') && false) { /// This was not reliable if (($fh = @fopen($INSTALL['wwwroot'] . "/{$CFG->admin}/cliupgrade.php", 'r')) === false) { console_write_error(get_string('wwwrooterror'), 'install', false); } }
<?php /* Jappix - An open social platform This is the Jappix geolocation script ------------------------------------------------- License: AGPL Author: Vanaryon Last revision: 15/01/12 */ // PHP base define('JAPPIX_BASE', '..'); // Get the needed files require_once './functions.php'; require_once './read-main.php'; require_once './read-hosts.php'; // Optimize the page rendering hideErrors(); compressThis(); // Not allowed for a special node if (isStatic() || isUpload()) { exit; } // If valid data was sent if (isset($_GET['latitude']) && !empty($_GET['latitude']) && (isset($_GET['longitude']) && !empty($_GET['longitude'])) && (isset($_GET['language']) && !empty($_GET['language']))) { // Set a XML header header('Content-Type: text/xml; charset=utf-8'); // Get the XML content $xml = read_url('http://maps.googleapis.com/maps/api/geocode/xml?latlng=' . urlencode($_GET['latitude']) . ',' . urlencode($_GET['longitude']) . '&language=' . urlencode($_GET['language']) . '&sensor=true'); exit($xml); }
compressThis(); // Not allowed for a special node if (isStatic() || isUpload()) { exit; } // Set a JSON header header('Content-Type: application/json'); // If valid data was sent if (isset($_GET['username']) && !empty($_GET['username'])) { // Read remote IP (secures passwords that are passed there) $remote_ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; // Generate cache values $cache_hash = md5($_GET['username'] . '@' . $remote_ip); $cache_path = JAPPIX_BASE . '/tmp/jingle/' . $cache_hash . '.cache'; $cache_life = $remote_ip ? 3600 : 0; // Cache missing or obsolete? $filemtime = @filemtime($cache_path); if (!$filemtime or time() - $filemtime >= $cache_life) { // Note: we use a Google API there, so fallback TURNs will be using Google's TURN server through an encrypted channel // we know this won't satisfy everyone, but this is the best compromise we could find for the end-user // if you are concerned about privacy, rather setup your TURN and add it to Jappix hosts configuration // Get the JSON content $json = read_url('https://computeengineondemand.appspot.com/turn?username='******'username'])); if ($json && strpos($json, 'uris') !== false) { file_put_contents($cache_path, $json); } } else { $json = file_get_contents($cache_path); } exit($json); }