コード例 #1
0
require_once './gametool.inc.php';
require_once './ServerVersion.inc.php';
require_once './config.php';
require_once './timelineCfg.inc.php';
function datetimeToTimestamp($dateTime)
{
    $ts = strtotime($dateTime);
    if ($ts < 0 || $ts === FALSE || strftime("%Y-%m-%d %H:%M:%S", $ts) != $dateTime) {
        die("Failed to parse from datettime: " . $dateTime);
    }
    return $ts;
}
$url = $url = 'http://' . $config['gametool_host'] . ':' . $config['gametool_port'] . '/gametool';
// gametool is protected by username/pwd
$options = array('username' => $config['gametool_user'], 'password' => $config['gametool_pwd']);
$version = 2;
$serverVer = new ServerVersion($url, 'hessian/account.api', $options);
$path = $serverVer->getVersionPath($version);
if (empty($path)) {
    die("Failed to determine path to account api version {$version}");
}
$proxy = new HessianClient($url . $path, $options);
registerGametoolMethods($url);
$fromTs = datetimeToTimestamp($timelineCfg['from']);
$tillTs = datetimeToTimestamp($timelineCfg['till']);
$result = $proxy->getShardCCUTimeline($timelineCfg['shard_name'], $fromTs, $tillTs, $timelineCfg['step_seconds']);
$csv = fopen($timelineCfg['csv_file_name'], "w");
foreach ($result as $sample) {
    fputs($csv, strftime("%Y-%m-%d %H:%M:%S", $sample->timeSeconds) . $timelineCfg['separator'] . ' ' . $sample->ccu . "\n");
}
fclose($csv);
コード例 #2
0
ファイル: submit.php プロジェクト: s-a-r-id/geograph-project
 //Submit Step 3..
 if (isset($_POST['goback'])) {
     $step = 2;
 } else {
     //preserve the upload id
     if ($uploadmanager->validUploadId($_POST['upload_id'])) {
         $smarty->assign('upload_id', $_POST['upload_id']);
         $uploadmanager->setUploadId($_POST['upload_id']);
     }
     $ok = true;
     //preserve the meta info
     $smarty->reassignPostedDate('imagetaken');
     if ($smarty->get_template_vars('imagetaken') == '0000-00-00') {
         $ok = false;
         $error['imagetaken'] = "Please specify a date for when the photo was taken (even approximate)";
     } elseif (datetimeToTimestamp($smarty->get_template_vars('imagetaken')) > datetimeToTimestamp(date("Y-m-d"))) {
         $ok = false;
         $error['imagetaken'] = "Time machines are not allowed on Planet Geograph";
     }
     if (($_POST['imageclass'] == 'Other' || empty($_POST['imageclass'])) && !empty($_POST['imageclassother'])) {
         $imageclass = stripslashes($_POST['imageclassother']);
     } else {
         if ($_POST['imageclass'] != 'Other') {
             $imageclass = stripslashes($_POST['imageclass']);
         }
     }
     if (strlen($imageclass) == 0) {
         $ok = false;
         $error['imageclass'] = "Please choose a geographical feature";
     } else {
         $smarty->assign_by_ref('imageclass', $imageclass);
コード例 #3
0
ファイル: load_gameplan.php プロジェクト: khanab85/InterOlpe
        $verlegtdatum = $parts[4];
        $zusatzinfo = "";
        $schiri = "";
    } elseif ($parts[0] != "" && $parts[1] == "") {
        if (strpos($parts[0], "//") === false) {
            // schiri
            $schiri = $parts[0];
            $printOne = true;
        } else {
            // zusatzinfos
            $zusatzinfo = $parts[0];
            $printOne = true;
        }
    }
}
echo "VALUES ('{$spielnummer}', '{$heim_team}', '{$gast_team}', '{$zusatzinfo}', '{$schiri}', '" . dateToTimestamp($spieldatum_plan, $anfiff_plan) . "', '" . getSpieltag($spielnummer) . "', '0', '0', '0', NULL, NULL, '" . isFree($gast_team) . "', '" . datetimeToTimestamp($verlegtdatum) . "');\n";
fclose($hfile);
function isFree($gast)
{
    if ($gast === "SPIELFREI") {
        return 1;
    } else {
        return 0;
    }
}
function dateToTimestamp($date, $time)
{
    if ($time === "") {
        $time = "00:00";
    }
    $datePart = explode(" ", $date);