Example #1
0
<?php

include "functions_GRML.php";
include "TimeTrack.class.php";
session_start();
$timetrack = new TimeTrack();
TimeTrack::$migrationMode = true;
$mobiledevice = detectMobileDevices();
$loggedin = false;
$loggedin = $timetrack->login($_POST['u'], $_POST['p'], $_GET['h']);
$hash = $timetrack->hash;
if (!$loggedin) {
    unset($_SESSION['userhash']);
    header("Location: index.php?e=1");
    exit;
}
if (isset($_POST['migrate'])) {
    $res = $timetrack->migrateFileToDir($hash);
    if ($res['error'] === false) {
        header("Location: show.php");
        die;
    }
}
$filename = pathinfo(__FILE__, PATHINFO_FILENAME);
include "views/{$filename}.phtml";
Example #2
0
function getTimes($tt)
{
    $tt->parseData();
    $ld = $tt->getLastDay();
    //print_r($ld);
    echo (isset($ld['diff']) ? $ld['diff'] : 0) . "\n";
    echo (isset($ld['monthdiff']) ? $ld['monthdiff'] : 0) . "\n";
    echo (isset($ld['laststateIn']) ? (int) $ld['laststateIn'] : 0) . "\n";
    echo (isset($ld['start']) ? $ld['start'] : 0) . "\n";
    echo (isset($ld['pause']) ? $ld['pause'] : 0) . "\n";
}
error_reporting(E_ALL);
ini_set("display_errors", 1);
$action = isset($_GET['a']) ? $_GET['a'] : '';
$hash = isset($_GET['h']) ? $_GET['h'] : '';
if (!$tt->login(null, null, $hash)) {
    die('INVALID LOGIN');
}
$curmonth = date("Ym");
if (isset($_GET['m'])) {
    $curmonth = $_GET['m'];
}
$tt->setMonth($curmonth);
if ($action == "times") {
    getTimes($tt);
}
if ($action == "login") {
    getTimes($tt);
}
if ($action == "logout") {
    getTimes($tt);
Example #3
0
<?php

include "application/TTDropbox.php";
include "TimeTrack.class.php";
$timetrack = new TimeTrack();
$id = session_id();
if (empty($id)) {
    session_start();
}
$loggedin = false;
$u = isset($_POST['u']) ? $_POST['u'] : null;
$p = isset($_POST['p']) ? $_POST['p'] : null;
$h = isset($_GET['h']) ? $_GET['h'] : null;
$loggedin = $timetrack->login($u, $p, $h);
$hash = $timetrack->hash;
if (!$loggedin) {
    unset($hash);
    unset($_SESSION['userhash']);
}
if (!$loggedin) {
    if ($hash != "") {
        unset($_SESSION['userhash']);
        header("Location: download.php?h=" . $hash);
        exit;
    } else {
        unset($_SESSION['userhash']);
        header("Location: index.php?e=1");
        exit;
    }
}
$options = $timetrack->getOptions();
Example #4
0
$core = new TimeTrack();
$core->setMonth(date("Ym"));
foreach ($files as $optionFileName) {
    $options = json_decode(file_get_contents($optionFileName));
    $hash = basename(dirname($optionFileName));
    if (isset($options->notifications)) {
        writeLog("'{$hash}': Found notification");
        if (!isset($options->notifications->when) || !isset($options->notifications->what) || !isset($options->notifications->how)) {
            writeLog("'{$hash}': Notification settings are incomplete. Skipping.");
            continue;
        }
        if (!isset($options->notifications->enabled) || $options->notifications->enabled == false) {
            writeLog("'{$hash}': Notification is disabled. Skipping.");
            continue;
        }
        $core->login(null, null, $hash);
        $core->parseData();
        $lastdayData = $core->getLastDay();
        if (date('Y-m-d') != $lastdayData['date']) {
            writeLog('Last day is not today, skipping');
            continue;
        }
        $compareDate = $core->getNormalDayEnd();
        if ($options->notifications->what == "earliest") {
            $compareDate = $core->getEarliestDayEnd();
        }
        $neededMaxGap = $options->notifications->when * 60;
        $actualGap = $compareDate - time();
        if ($actualGap <= $neededMaxGap + 120 && $actualGap >= $neededMaxGap) {
            sendNotification($options->notifications, $compareDate, $lastdayData);
        }