コード例 #1
0
ファイル: scheduler.php プロジェクト: 5haman/knowledgetree
    } else {
        $cmd .= strtolower($sTask) == 'openoffice test' ? ' >/dev/null &' : ' 2>&1';
        $default->log->debug("Scheduler cmd: {$cmd}");
        $res = shell_exec($cmd);
    }
    // On completion - reset run time
    $iEnd = KTUtil::getBenchmarkTime();
    $iDuration = number_format($iEnd - $iStart, 2);
    $ignore = array('openoffice test');
    if (!empty($res)) {
        $func = in_array(strtolower($sTask), $ignore) ? 'debug' : 'info';
        $default->log->{$func}("Scheduler - Task: {$sTask}");
        $default->log->{$func}("Scheduler - Command: {$cmd}");
        $default->log->{$func}("Scheduler - Output: {$res}");
        $default->log->{$func}("Scheduler - Background tasks should not produce output. Please review why this is producing output.");
    } else {
        $default->log->debug("Scheduler - Task: {$sTask} completed in {$iDuration}s.");
    }
    if (($sFreq == 'once' || empty($sFreq)) && $retval !== FALSE) {
        // Set is_complete to true
        $aUpdate['is_complete'] = '1';
    } else {
        $iNextTime = calculateRunTime($sFreq, $iTime);
        $aUpdate['run_time'] = date('Y-m-d H:i:s', $iNextTime);
    }
    $aUpdate['previous_run_time'] = date('Y-m-d H:i:s', $iTime);
    $aUpdate['run_duration'] = $iDuration;
    updateTask($aUpdate, $item['id']);
}
$default->log->debug('Scheduler: stopping');
exit(0);
コード例 #2
0
 /**
  * Function for editing a task.
  *
  * @uses ManageScheduledTasks template, edit_scheduled_tasks sub-template
  */
 public function action_edit()
 {
     global $context, $txt;
     // Just set up some lovely context stuff.
     $context[$context['admin_menu_name']]['current_subsection'] = 'tasks';
     $context['sub_template'] = 'edit_scheduled_tasks';
     $context['page_title'] = $txt['scheduled_task_edit'];
     $context['server_time'] = standardTime(time(), false, 'server');
     // We'll need this to calculate the next event.
     require_once SUBSDIR . '/ScheduledTasks.subs.php';
     // Cleaning...
     if (!isset($_GET['tid'])) {
         fatal_lang_error('no_access', false);
     }
     $_GET['tid'] = (int) $_GET['tid'];
     // Saving?
     if (isset($_GET['save'])) {
         checkSession();
         validateToken('admin-st');
         // Do we have a valid offset?
         preg_match('~(\\d{1,2}):(\\d{1,2})~', $_POST['offset'], $matches);
         // If a half is empty then assume zero offset!
         if (!isset($matches[2]) || $matches[2] > 59) {
             $matches[2] = 0;
         }
         if (!isset($matches[1]) || $matches[1] > 23) {
             $matches[1] = 0;
         }
         // Now the offset is easy; easy peasy - except we need to offset by a few hours...
         $offset = $matches[1] * 3600 + $matches[2] * 60 - date('Z');
         // The other time bits are simple!
         $interval = max((int) $_POST['regularity'], 1);
         $unit = in_array(substr($_POST['unit'], 0, 1), array('m', 'h', 'd', 'w')) ? substr($_POST['unit'], 0, 1) : 'd';
         // Don't allow one minute intervals.
         if ($interval == 1 && $unit == 'm') {
             $interval = 2;
         }
         // Is it disabled?
         $disabled = !isset($_POST['enabled']) ? 1 : 0;
         // Do the update!
         $_GET['tid'] = (int) $_GET['tid'];
         updateTask($_GET['tid'], $disabled, $offset, $interval, $unit);
         // Check the next event.
         calculateNextTrigger($_GET['tid'], true);
         // Return to the main list.
         redirectexit('action=admin;area=scheduledtasks');
     }
     // Load the task, understand? Que? Que?
     $_GET['tid'] = (int) $_GET['tid'];
     $context['task'] = loadTaskDetails($_GET['tid']);
     createToken('admin-st');
 }
コード例 #3
0
ファイル: todoList.php プロジェクト: samueleyre/Simplon
        // echo "ho";
    }
}
function updateAListName($list, $updatelist)
{
    if ($connexion = mysqli_connect('localhost', 'root', '', 'samirello')) {
        $requete = "UPDATE lists SET `listname`='{$updatelist}' WHERE `listname`='{$list}'";
        $resultat = mysqli_query($connexion, $requete);
    }
    if ($connexion = mysqli_connect('localhost', 'root', '', 'samirello')) {
        $requete = "UPDATE users SET `listname`='{$updatelist}' WHERE `listname`='{$list}'";
        $resultat = mysqli_query($connexion, $requete);
    }
}
// $updateVerif = "resultat : ".($resultat ? 'ok':'false');
// } else {
// $updateVerif = "erreur BDD !";
// }
if (isset($_GET['listValue']) && isset($_GET['updatedListName'])) {
    updateAListName($_GET['listValue'], $_GET['updatedListName']);
}
function updateTask($Id, $taskOption, $option)
{
    if ($connexion = mysqli_connect('localhost', 'root', '', 'samirello')) {
        $requete = "UPDATE users SET `{$option}`='{$taskOption}' WHERE `id`='{$Id}'";
        $resultat = mysqli_query($connexion, $requete);
    }
}
if (isset($_GET['taskOptionId']) && isset($_GET['updatedOption']) && isset($_GET['option'])) {
    updateTask($_GET['taskOptionId'], $_GET['updatedOption'], $_GET['option']);
}
コード例 #4
0
ファイル: page_update.php プロジェクト: jacksinn/taskreporter
<?php

include $VERSION_PATH . "core/header.php";
if (isset($_GET['tid'])) {
    $row = mysql_fetch_array(getTask($_GET['tid']));
    echo "Working on Task: " . $row['TID'];
} else {
    //echo "NO TASK SELECTED";
}
if (isset($_POST['description'])) {
    $description = cleanInput($_POST['description']);
    if ($description) {
        $comments = cleanInput($_POST['comments']);
        $completed = isset($_POST['completed']) ? 1 : 0;
        if (updateTask(cleanInput($_POST['tid']), $description, $comments, $completed)) {
            echo "TASK SUCCESSFULLY UPDATED";
        } else {
            echo "THERE WAS AN ERROR UPDATING YOUR TASK. PLEASE TRY AGAIN LATER.";
        }
    } else {
        echo "PLEASE FILL OUT ALL REQUIRED FIELDS.";
    }
}
?>
			<h1 class="title">Update Task</h1>
			<div class="entry">
				<form name="input" action="/update/index.php" method="post">
				<table>
					<tr><td colspan="3"><hr /></td></tr>
					<tr>
						<td align="left"><b>TASK DETAILS</b></td>
コード例 #5
0
ファイル: Unit_Tests.php プロジェクト: zakariamegza/TodoList
 public function updateTask()
 {
     echo "test updateTask is running \n";
     $res = updateTask();
     $this->assertEquals('true', $res);
 }
コード例 #6
0
ファイル: home.php プロジェクト: Simplon-lyon/donatello-basic
 * SELF ACTIONS
*/
if (isset($_POST["action"])) {
    switch ($_POST["action"]) {
        case 'new_task':
            if (isset($_POST["task_title"]) && isset($_POST["id_category"])) {
                if (addTask($_POST["task_title"], $_POST["id_category"])) {
                    header("HTTP/1.1 302 Redirect");
                    header("location:home.php");
                }
            }
            break;
        case 'update_task_state':
            if (isset($_POST["id_task"])) {
                error_log('update task » ' . $_POST["id_task"] . " " . isset($_POST["is_complete"]));
                updateTask($_POST["id_task"], isset($_POST["is_complete"]));
            }
            break;
        case 'clear_completed':
            if (isset($_POST["id_project"])) {
                error_log('clear_completed task » ' . $_POST["id_project"]);
                clearArchives($_POST["id_project"]);
            }
            break;
        case 'delete_project':
            if (isset($_POST["id_project"])) {
                error_log('delete_project task » ' . $_POST["id_project"]);
                if (deleteProject($_POST["id_project"])) {
                    error_log("project deleted");
                    deselectProject();
                    header("HTTP/1.1 302 Redirect");
コード例 #7
0
ファイル: updateTask.php プロジェクト: vmizoules/ZZTasksPHP
<?php

// read global var $app
global $app;
// get id (check isset & tasks exists)
if (!isset($_GET['id']) || !isset($app["tasks"][$_GET['id']])) {
    throw new Exception("No id given or bad id...", 1);
}
$id = $_GET['id'];
$formError = false;
// check form is submitted
if (isset($_POST["submit"])) {
    $formError = true;
    // check all field given
    if (isset($_POST["category"]) && isset($_POST["title"]) && isset($_POST["affectedUser"]) && isset($_POST["description"])) {
        $formError = false;
        updateTask($_POST["category"], $_POST["title"], getUsername(), $_POST["affectedUser"], $_POST["description"], $id);
        redirect('listTask');
    }
}
// fill form with task datas
$task["category"] = $app["tasks"][$id]["category"];
$task["affectedUser"] = $app["tasks"][$id]["affectedUser"];
$task["title"] = $app["tasks"][$id]["title"];
$task["description"] = $app["tasks"][$id]["description"];
// include view
include_once 'views/updateTaskForm.php';
コード例 #8
0
ファイル: responseList.php プロジェクト: kennethCarl/quick
        getStatusTypes();
        break;
    case "getStatusTypesAdd":
        getStatusTypesAdd();
        break;
    case "save":
        saveData();
        break;
    case "signUp":
        saveUser();
        break;
    case "updateProject":
        updateProject();
        break;
    case "updateTask":
        updateTask();
        break;
    case "deleteProject":
        deleteProject();
        break;
    case "deleteTask":
        deleteTask();
        break;
    case "logout":
        logout();
        break;
}
function check_input($value)
{
    $string = str_split($value, 1);
    $holder = "";
コード例 #9
0
 public function testUpdateTask()
 {
     global $app;
     $id = 0;
     $userWithPerm = 'user_with_allPermissions';
     $userWithoutPerm = 'user_with_nonepermissions';
     $goodCategory = 'todo';
     $badCategory = 'unknow_cat';
     // check with good values BUT user without permission
     // -> exception
     $caught = false;
     try {
         updateTask($goodCategory, 'mybesttitle', $userWithoutPerm, 'user_with_nonepermissions', 'desc', $id);
     } catch (\Exception $e) {
         $caught = true;
     }
     $this->assertTrue($caught);
     // check with good values and user with permission BUT bad id
     // -> exception
     $caught = false;
     try {
         updateTask($goodCategory, 'mybesttitle', $userWithoutPerm, 'user_with_nonepermissions', 'desc', 99);
     } catch (\Exception $e) {
         $caught = true;
     }
     $this->assertTrue($caught);
     // check with bad value BUT user with permission
     // -> exception
     $caught = false;
     try {
         updateTask($badCategory, 'mybesttitle', $userWithPerm, 'user_with_nonepermissions', 'desc', $id);
     } catch (\Exception $e) {
         $caught = true;
     }
     $this->assertTrue($caught);
     // check with good values and good user permissions
     // -> should work !
     $this->assertEquals(count($app['tasks']), 1);
     // 1 task
     $caught = false;
     try {
         updateTask($goodCategory, 'mybesttitle', $userWithPerm, 'user_with_nonepermissions', 'desc', $id);
     } catch (\Exception $e) {
         $caught = true;
     }
     $this->assertFalse($caught);
     $this->assertEquals(count($app['tasks']), 1);
     // 2 task
 }
コード例 #10
0
ファイル: response.php プロジェクト: swedenonline/todo
<?php

if (isset($_POST) && $_POST != null) {
    $method = $_POST["do"];
    $task = isset($_POST["task"]) ? $_POST["task"] : null;
    if ($method == "fetchTask") {
        fetchTask();
    } else {
        if ($method == "deleteTask") {
            deleteTask($task);
        } else {
            if ($method == "addTask") {
                addTask($task);
            } else {
                if ($method == "updateTask") {
                    updateTask($task);
                }
            }
        }
    }
}
function fetchTask()
{
    //fetch task
    $task = array();
    $temp = array();
    //calling db api to fetch tasks...
    //creating dummy array data
    for ($i = 0; $i < 5; $i++) {
        $temp[$i] = ["id" => $i, "text" => "This is task # " . $i, "checked" => "false"];
    }
コード例 #11
0
ファイル: todo.php プロジェクト: JXHZY/webDeveloper
            $taskId = $_POST["taskId"];
            $_SESSION["taskId"] = $taskId;
            redirect(VIEWS . "/update_task.php");
        } else {
            $_SESSION["error"] = "Select a task";
            redirect(VIEWS . "/home.php");
        }
    } else {
        if ($action == "Delete") {
            if (isset($_POST["taskId"])) {
                $taskId = $_POST["taskId"];
                delete_todo($taskId);
            } else {
                $_SESSION["error"] = "Select a task";
            }
            redirect(VIEWS . "/home.php");
        } else {
            if ($action == "Update") {
                if (isset($_POST["taskId"])) {
                    $taskId = $_POST["taskId"];
                    $description = $_POST["description"];
                    $status = $_POST["status"];
                    updateTask($description, $status, $taskId);
                } else {
                    $_SESSION["error"] = "Select a task";
                }
                redirect(VIEWS . "/home.php");
            }
        }
    }
}