function testShouldGetNonPrivateForumAsUnsignedClient() { $config = readConfiguration('test/config.yml'); $client = new UserVoice\Client($config['subdomain_name'], $config['api_key'], $config); $forums = $client->get_collection("/api/v1/forums", array('limit' => 1)); $this->assertFalse($forums[0]['private']); }
function testShouldGet10FirstUsers() { $config = readConfiguration('test/config.yml'); $token = \UserVoice\SSO::generate_token($config['subdomain_name'], $config['sso_key'], array('email' => '*****@*****.**')); // Try it out here: // echo $config['protocol'] . '://' . $config['subdomain_name'] . '.' . $config['uservoice_domain'] . '?sso='.$token; $this->assertTrue(strlen($token) > 0); }
$reference[$pathElement] = "undefined"; $reference =& $reference[$pathElement]; } } //$accessor = implode( "' ][ '", $variablePath ); //$variable = "\$GLOBALS[ '". $accessor . "' ]"; //echo $variable . " = " . $reference . "\n"; if ("" != $GET_VARIABLE) { // Get a variable echo $reference . "\n"; exit(0); } else { // Set a variable if ("" == $VARIABLE_VALUE) { $reference = null; } else { $reference = $VARIABLE_VALUE; } } } else { readConfiguration(); } } // If needed, write the configuration back to disk if ("" != $SET_VARIABLE || "true" == $MERGE) { echo "<?php\n"; echo "return "; var_export($GLOBALS["TYPO3_CONF_VARS"]); echo ";"; } # vim:ts=2:sw=2:expandtab:
} $files = array(978 => "/dev/shm/978data/aircraft.json"); function getProperty($obj, $prop) { if (property_exists($obj, $prop)) { return trim($obj->{$prop}); } else { return ""; } } $nowArr = array(); foreach ($files as $freq => $file) { $nowArr[$file] = ""; } while (true) { $config = readConfiguration(); $output = ""; $files = array(); if ($config->adsbFreq0 == '978' || $config->adsbFreq1 == '978') { $files['978'] = $filesSrc['978']; } if ($config->adsbFreq0 == '1090' || $config->adsbFreq1 == '1090') { $files['1090'] = $filesSrc['1090']; } foreach ($files as $freq => $filename) { $file = file_get_contents($filename); $json = json_decode($file); // echo "*************************************$filename*********************************\n"; $now = floor($json->now); if ($now > $nowArr[$filename]) { $nowArr[$filename] = $now;
function changeSettings() { global $config; logMessage("Starting to check settings"); $post = array('action' => 'getSettings', 'PID' => $config->PID); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $config->serverurl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); $output = gzdecode($result); if (!$output) { logMessage("Output not GZ format: {$output}; {$result}"); } $jsonout = json_decode($output); logMessage("Settings read from server are: {$output}"); $time = time(); foreach ($jsonout as $value) { $filename = $value->FileName; rename($filename, $filename . $time); file_put_contents($filename, $value->Value); } $config = readConfiguration(); killprocess('motion'); killprocess('rtl_sdr'); killprocess('dump1090'); check978Running(); check1090Running(); checkMotionRunning(); }
/** * Look for the configuration value in the configuration file of the user (in the * user directory). If not found in the user directory then look what is set fot the server. * @param unknown_type $user * @param unknown_type $key * @param unknown_type $allowServerConfig if true the config of the server can be used if the * user has not set this key-value-pair. */ function getConfiguration($user, $key, $allowServerConfig) { $value = ''; if (isAdmin($user)) { // user is the admin > read the server config $value = readConfiguration(CONFIG_FILE, $key); return $value; } $configFile = USER_DIR . DIRECTORY_SEPARATOR . $user . DIRECTORY_SEPARATOR . CONFIG_FILE; $value = readConfiguration($configFile, $key); if ($allowServerConfig) { if (isNullOrEmptyString($value)) { $value = readConfiguration(CONFIG_FILE, $key); } } return $value; }