Ejemplo n.º 1
0
$oldend = $_POST['oldend'];
if (isset($formsend, $newstart, $newend, $oldstart, $oldend)) {
    $success = true;
    if ($oldstart != $newstart) {
        $success = $timetrack->updateFile($oldstart, $newstart);
    }
    if ($oldend != $newend) {
        $success = $timetrack->updateFile($oldend, $newend);
    }
    if (!$success) {
        die("Update not successful");
    } else {
        $forward = true;
    }
}
if (isset($_POST['daysize']) && isset($_POST['date'])) {
    $timetrack->changeDailyWorkingTimeForADay($_POST['date'], $_POST['daysize']);
    $oldstart = strtotime($_POST['date']);
    $forward = true;
}
if ($forward === true) {
    $month = date("Ym", $oldstart);
    header('Location: show.php?m=' . $month);
}
$timetrack->setMonth(date("Ym", strtotime($curdate)));
$data = $timetrack->parseData();
$day = $data['days'][$curdate];
if (!isset($day)) {
    die('Day not found!');
}
include "views/correct.phtml";
Ejemplo n.º 2
0
$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);
        }
    }