Example #1
0
 public function testDeleteTask()
 {
     deleteTask('Test');
     $monfichier = fopen(__DIR__ . "/../src/files/todo.json", "r");
     $line = fgets($monfichier);
     fclose($monfichier);
     $arr = json_decode($line, true);
     $this->assertNotArrayHasKey('Test', $arr[0]);
 }
Example #2
0
             }
         } else {
             if (checkTask($user_login, $action, $param)) {
                 createTask($date, $user_login, $action, $param, $note);
             }
         }
         rcms_redirect('?module=adservice&action=add&wait=true');
     }
 }
 if (isset($_GET['delete_shedule'])) {
     if (!empty($_GET['delete_shedule'])) {
         $tag = preg_replace('/\\0/s', '', $_GET['delete_shedule']);
         $tag = strip_tags($tag);
         $tag = mysql_real_escape_string($tag);
         $tag = vf($tag, 3);
         deleteTask($user_login, $tag);
         rcms_redirect('?module=adservice&action=delete&wait=true');
     }
 }
 if (isset($_GET['action'])) {
     if (isset($_GET['wait'])) {
         show_window(__('Success'), __('Your order was sheduled') . '. ' . __('Please wait for') . ' ' . $waitDays);
     }
 }
 if (isset($_GET['delete_service'])) {
     if (!empty($_GET['delete_service'])) {
         $date = GetFullApplyDate();
         $action = 'tagdel';
         $param = vf($_GET['delete_service'], 3);
         $param = preg_replace('/\\0/s', '', $param);
         $param = strip_tags($param);
Example #3
0
//kopeerime header.php sisu
// ../ -tähistab, et fail asub ühe võrra kõrgemal kaustas
require_once "../header.php";
require_once "functions.php";
if (!isset($_SESSION["logged_in_user_id"])) {
    header("Location: login.php");
}
//kasutaja tahab välja logida
if (isset($_GET["logout"])) {
    //aadressireal on olemas muutuja logout
    //kustutame kõik session muutujad ja peatame sessiooni
    session_destroy();
    header("Location: login.php");
}
if (isset($_GET["delete"])) {
    deleteTask($_GET["delete"]);
}
if (isset($_GET["done"])) {
    doneTask($_GET["done"]);
}
if (isset($_GET["edit"])) {
    editTask($_GET["edit"]);
}
$tasks = tasks();
?>
<html>
<table border=1 >
	<tr>
		<th>Aine nimetus</th>
		<th>Õppejõud</th>
		<th>Ülesande kirjeldus</th>
Example #4
0
<?php

session_start();
require_once 'lib.php';
if (isset($_SESSION['name']) && isset($_GET['task'])) {
    deleteTask($_GET['task']);
    header('Location: todo.php');
}
Example #5
0
    if ($tags != '') {
        $aTags = prepareTags($tags);
        if ($aTags) {
            addTaskTags($id, $aTags['ids'], $listId);
            $db->ex("UPDATE {mytinytodo_todos} SET tags=?,tags_ids=? WHERE id={$id}", array(implode(',', $aTags['tags']), implode(',', $aTags['ids'])));
        }
    }
    $db->ex("COMMIT");
    $r = prepareTaskRow($db->sqa("SELECT * FROM {mytinytodo_todos} WHERE id={$id}"));
    module_invoke_all('mytinytodo_new_task', $r);
    $t['list'][] = $r;
    $t['total'] = 1;
    jsonExit($t);
} elseif (isset($_GET['deleteTask'])) {
    $id = (int) _post('id');
    $deleted = deleteTask($id);
    module_invoke_all('mytinytodo_delete_task', $id);
    $t = array();
    $t['total'] = $deleted;
    $t['list'][] = array('id' => $id);
    jsonExit($t);
} elseif (isset($_GET['completeTask'])) {
    check_write_access();
    $id = (int) _post('id');
    $compl = _post('compl') ? 1 : 0;
    $listId = (int) $db->sq("SELECT list_id FROM {mytinytodo_todos} WHERE id={$id}");
    if ($compl) {
        $ow = 1 + (int) $db->sq("SELECT MAX(ow) FROM {mytinytodo_todos} WHERE list_id={$listId} AND compl=1");
    } else {
        $ow = 1 + (int) $db->sq("SELECT MAX(ow) FROM {mytinytodo_todos} WHERE list_id={$listId} AND compl=0");
    }
Example #6
0
File: agenda.php Project: IMR18/web
            $group = isset($_GET["group"]) && !empty($_GET["group"]) ? $_GET["group"] : 0;
            $from = isset($_GET["from"]) && !empty($_GET["from"]) ? $_GET["from"] : 0;
            $res = get_tasks($db, $group, $from);
            break;
        case "addTask":
            if (!isset($p->title)) {
                $res = array('status' => false, 'msg' => "NO PARAMETERS");
            } else {
                $res = array('status' => add_task($db, issetor($p->title), issetor($p->description), issetor($p->deadline), issetor($p->worklevel), issetor($p->groupe), issetor($p->UID)), 'msg' => "{$p->title} est ajouté");
            }
            break;
        case "deleteTask":
            if (!isset($p->id)) {
                $res = array('status' => false, 'msg' => "NO PARAMETERS");
            } else {
                $res = array('status' => deleteTask($db, issetor($p->id)), 'msg' => "{$p->title} est supprimée");
            }
            break;
        case "editTask":
            if (!isset($p->id)) {
                $res = array('status' => false, 'msg' => "NO PARAMETERS");
            } else {
                $res = array('status' => editTask($db, issetor($p->title), issetor($p->description), issetor($p->deadline), issetor($p->worklevel), issetor($p->groupe), issetor($p->UID), $p->id), 'msg' => "{$p->title} est modifiée");
            }
            break;
        default:
            $res = array("ACTION NOT FOUND");
    }
    echo json_encode($res);
} else {
    $res = array("NO ACTION SET");
Example #7
0
    $file1 = "createtask";
    createTask($_POST['name'], $_POST['del'], $_POST['des']);
    $done = $TXT_CREATED;
    header("Location: " . $file1 . ".php?done=" . $done);
    exit;
} else {
    if (isset($_POST['Delete'])) {
        $file1 = "deletetask";
        deleteTask($_POST['name']);
        $done = $TXT_DELETED;
        header("Location: " . $file1 . ".php?done=" . $done);
        exit;
    } else {
        if (isset($_POST['Update'])) {
            $file1 = "updatetask";
            deleteTask($_POST['oldname']);
            createTask($_POST['newname'], $_POST['del'], $_POST['des']);
            $done = $TXT_UPDATED;
            header("Location: " . $file1 . ".php?done=" . $done);
            exit;
        }
    }
}
function createTask($name, $deadline, $description)
{
    global $TXT_ERROR, $file1;
    $dir = opendir(__DIR__ . "/files/projects_file/");
    while (($file = readdir($dir)) !== false && $file != $name . ".json") {
    }
    closedir($dir);
    if ($file == $name . ".json") {
Example #8
0
include "../inc/ui.php";
$params = json_decode(file_get_contents("php://input"));
$response = array();
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    $rows = selectTasks('*');
    foreach ($rows as $row) {
        $task = array();
        $task['task_id'] = $row['task_id'];
        $task['task_html'] = buildTaskHtml($row['task_id'], $row['completed'], $row['description'], $row['due_date']);
        $response[] = $task;
    }
} else {
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        $new_row = insertTask($params->{'description'}, $params->{'due_date'});
        $response['task_id'] = $new_row['task_id'];
        $response['task_html'] = buildTaskHtml($new_row['task_id'], $new_row['completed'], $new_row['description'], $new_row['due_date']);
    } else {
        if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
            $row = updateTaskCompletion($params->{'task_id'}, $params->{'completed'});
            $response['task_id'] = $row['task_id'];
            $response['task_html'] = buildTaskHtml($row['task_id'], $row['completed'], $row['description'], $row['due_date']);
        } else {
            if ($_SERVER['REQUEST_METHOD'] === 'DELETE') {
                deleteTask($params->{'task_id'});
                $response['task_id'] = $params->{'task_id'};
                $response['task_html'] = NULL;
            }
        }
    }
}
echo json_encode($response);
Example #9
0
<?php

// if "id" parameter is setted
if (isset($_GET['id'])) {
    deleteTask($_GET['id'], getUsername());
}
redirect('listTask');
Example #10
0
        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 = "";
    for ($i = 0; $i < count($string); $i++) {
        if ($string[$i] != "'") {
            $holder = $holder . $string[$i];
        } else {
            $holder = $holder . "/";
        }
Example #11
0
     if (!$users->hasAccess('staff_panel_tasks_add')) {
         $mtg->error('You don\'t have access');
     }
     addTask($db, $mtg, $items, $logs);
     break;
 case 'edit':
     if (!$users->hasAccess('staff_panel_tasks_edit')) {
         $mtg->error('You don\'t have access');
     }
     editTask($db, $mtg, $items, $logs);
     break;
 case 'del':
     if (!$users->hasAccess('staff_panel_tasks_delete')) {
         $mtg->error('You don\'t have access');
     }
     deleteTask($db, $mtg, $logs);
     break;
 case 'groups':
     if (!$users->hasAccess('staff_panel_tasks_groups_manage')) {
         $mtg->error('You don\'t have access');
     }
     manageTaskGroups($db, $mtg);
     break;
 case 'gadd':
     if (!$users->hasAccess('staff_panel_tasks_groups_add')) {
         $mtg->error('You don\'t have access');
     }
     addTaskGroup($db, $mtg, $logs);
     break;
 case 'gedit':
     if (!$users->hasAccess('staff_panel_tasks_groups_edit')) {
Example #12
0
 public function testDeleteTask()
 {
     global $app;
     $goodId = 0;
     $badId = 58;
     $userWithPerm = 'user_with_allPermissions';
     $userWithoutPerm = 'user_with_nonepermissions';
     // check with good id BUT user without permission
     // -> exception
     $caught = false;
     try {
         deleteTask($goodId, $userWithoutPerm);
     } catch (\Exception $e) {
         $caught = true;
     }
     $this->assertTrue($caught);
     // check with bad id BUT user with permission
     // -> exception
     $caught = false;
     try {
         deleteTask($badId, $userWithPerm);
     } 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 {
         deleteTask($goodId, $userWithPerm);
     } catch (\Exception $e) {
         $caught = true;
     }
     $this->assertFalse($caught);
     $this->assertEquals(count($app['tasks']), 0);
     // 2 task
 }
Example #13
0
<?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"];
    }