Example #1
0
     }
     // Generate the reference cache
     if ($has_compression) {
         $final = gzdeflate($output, 9);
     } else {
         $final = $output;
     }
     // Write it!
     genCache($final, $is_developer, $cache_hash);
 }
 // Filter the JS
 if ($type == 'javascripts') {
     // Set the JS locales
     $output = setLocales($output, $locale);
     // Set the JS configuration
     $output = setConfiguration($output, $hash, $locale, $version, uploadMaxSize());
     // Set the Get API paths
     $output = setPath($output, $hash, HOST_STATIC, $type, $locale);
     // Translate the JS script
     require_once './gettext.php';
     includeTranslation($locale, 'main');
     $output = setTranslation($output);
     // Generate the cache
     if ($has_compression) {
         $final = gzdeflate($output, 9);
     } else {
         $final = $output;
     }
     // Write it!
     genCache($final, $is_developer, $cache_lang);
 }
Example #2
0
function test_getDateForTimezoneOffset()
{
    appendTestMessage(NEW_LINE_LOG . " >> Tests with timezone offset..." . NEW_LINE_LOG);
    $testUser = '******';
    setConfiguration($testUser, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, '');
    appendTestMessage("time=nowknown, offset=''");
    $ret = getDateForTimezoneOffset($testUser, "nowknown", false);
    $expected = "";
    if ($ret == $expected) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("time=2013-03-25_14:43:01Z+01, offset=''");
    $ret = getDateForTimezoneOffset($testUser, "2013-03-25_14:43:01Z+01", false);
    $expected = "2013-03-25T14:43:01";
    if ($ret == $expected) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    appendTestMessage("time=2013-03-25_14:43:01Z+01, offset='', date only");
    $ret = getDateForTimezoneOffset($testUser, "2013-03-25_14:43:01Z+01", true);
    $expected = "2013-03-25";
    if ($ret == $expected) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // timezone offset Berlin summer
    setConfiguration($testUser, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, '-120');
    appendTestMessage("time=2013-03-25_14:43:01Z+01, offset='-120'");
    $ret = getDateForTimezoneOffset($testUser, "2013-03-25_14:43:01Z+01", false);
    $expected = "2013-03-25T16:43:01";
    if ($ret == $expected) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    setConfiguration($testUser, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, '120');
    appendTestMessage("time=2013-03-25_14:43:01Z+01, offset='120'");
    $ret = getDateForTimezoneOffset($testUser, "2013-03-25_14:43:01Z+01", false);
    $expected = "2013-03-25T12:43:01";
    if ($ret == $expected) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    setConfiguration($testUser, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, 'not_a_number');
    appendTestMessage("time=2013-03-25_14:43:01Z+01, offset='not_a_number'");
    $ret = getDateForTimezoneOffset($testUser, "2013-03-25_14:43:01Z+01", false);
    $expected = "2013-03-25T14:43:01";
    if ($ret == $expected) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    setConfiguration($testUser, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, '0');
    appendTestMessage("time=2013-03-25_14:43:01Z+01, offset='0'");
    $ret = getDateForTimezoneOffset($testUser, "2013-03-25_14:43:01Z+01", false);
    $expected = "2013-03-25T14:43:01";
    if ($ret == $expected) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // DateTime as milliseconds
    setConfiguration($testUser, CONFIG_KEY_TIMEZONE_OFFSET_MINUTES, '-120');
    appendTestMessage("time=1364225224111, offset='-120'");
    $ret = getDateForTimezoneOffset($testUser, "1364225224111", false);
    $expected = "2013-03-25T17:27:04";
    if ($ret == $expected) {
        appendTestMessage("- ok");
    } else {
        appendTestMessage("- failed");
        return false;
    }
    // The next line is just for debugging
    $ret = getDateForTimezoneOffset($testUser, "", false);
    resetConfig($testUser);
    resetConfig(ADMIN_NAME);
    return true;
}
Example #3
0
geschrieben. Diese Datensammlung wird abschließend im Projektverzeichnis unter dem Dateinamen
data-{projektspezifische Endung} serialisiert.
*/
include 'classDefinition.php';
include 'makeEntry.php';
include 'ingest.php';
include 'encode.php';
include 'makeIndex.php';
//include('makeSection.php');
include 'makeNavigation.php';
include 'makeHead.php';
include 'makeGeoDataSheet.php';
include 'storeBeacon.php';
include 'setConfiguration.php';
//$thisCatalogue = setConfiguration('bahn');
$thisCatalogue = setConfiguration('rehl');
$facets = $thisCatalogue->facets;
// Erstelle ein Verzeichnis für das Projekt
$folderName = fileNameTrans($thisCatalogue->heading);
if (is_dir($folderName) == FALSE) {
    mkdir($folderName, 0700);
}
// Lade die Daten aus der Datenbank in die Variable $data
$data = load_data_mysql('localhost', 'root', '', $thisCatalogue->database, 'zusammenfassung');
// Suche in BEACON-Dateien nach Einträgen zu den erwähnten Personen und füge diese den Daten hinzu
//storeBeacon($data, $folderName, $thisCatalogue->key);
$data = addBeacon($data, $folderName, $thisCatalogue->key);
// Speichere die Daten im Projektverzeichnis
$serialize = serialize($data);
file_put_contents($folderName . '/data-' . $thisCatalogue->key, $serialize);
var_dump($data);
Example #4
0
     $message = sprintf("Link to you new site is %s/api.php. <br> Link to push2press page is <a href=\"push2press://?url=%s\">%s</a> ", getConfiguration("url", ""), getConfiguration("url", ""), getConfiguration("sitename", ""));
     $messageplain = sprintf("Link to you new site is %s/api.php. Link to push2press page is &lt;a href=\"push2press://?url=%s\"&gt;%s&lt;/a&gt; ", getConfiguration("url", ""), getConfiguration("url", ""), getConfiguration("sitename", ""));
     $msuccess = mail($emailadminlinkto, 'Push2press Email Link', $message, $headers);
     $h = sprintf("<div> Email sent to %s %s </div>", $emailadminlinkto, $msuccess);
     $h = "";
     require_once "api-newsite.php";
     $h .= $hh;
     if ($msuccess === false) {
         $h = sprintf("<div> There was a sending error to %s - send yourself this link <pre>%s</pre></div>", $emailadminlinkto, $messageplain);
     }
 }
 if (getConfiguration("isthismyfirsttime_ihaveeditednow", "n") == "y") {
     if (getConfiguration("isthismyfirsttime", "") != "n") {
         require "api-newedit.php";
         $h .= $hh;
         setConfiguration("isthismyfirsttime", "n");
     }
 }
 //	require("api-newedit.php");
 //	require("api-newsite.php");
 //	$h .= $hh;
 $c1 = sqlcount("select count(*) as c from message");
 $c2 = sqlcount("select count(*) as c from log_phone where uid != ''");
 $h = $h . '<link href="github/ribbons.css" rel="stylesheet" type="text/css" />';
 $h = $h . "<br>";
 $h = $h . "<br>";
 $h = $h . '<div class="container">';
 $h = $h . '      <div class="row-fluid">';
 $h = $h . '			<div class="span5">';
 $db = mysql_connect($dbhost, $username, $password);
 mysql_select_db($database) or die("Unable to select database");
Example #5
0
/**
 * Writes configurations en bloc
 *
 * @param unknown_type $user
 * @param unknown_type $configCSV for exampe<br>
 *   timezone_offset_minutes=-60
 *   track_expiration_days=30
 *   write_track=false
 */
function setConfigurationEnBloc($user, $configCSV)
{
    // Iterate through all lines
    $lines = explode(PHP_EOL, $configCSV);
    $count = count($lines);
    for ($i = 0; $i < $count; $i++) {
        $line = trim($lines[$i]);
        $keyValue = explode('=', $line);
        $countKeyValue = count($keyValue);
        if ($countKeyValue != 2) {
            logMessage("Failed to read config key-value-pair (en bloc) {$line} for user {$user}");
            continue;
        }
        $key = $keyValue[0];
        $value = $keyValue[1];
        if (!setConfiguration($user, $key, $value)) {
            logMessage("Failed to read set config key-value-pair (en bloc) {$line} for user {$user}");
            return false;
        }
    }
    return true;
}