public function testSearchTask() { newtask("Test3", "23/25/2016", ""); $lignes = searchtask("Test3"); $this->assertEquals("1;:!:;Test3;:!:;23/25/2016\n", $lignes); $lignes = searchtask("tache et plus"); $this->assertEquals("1;:!:;tache et plus;:!:;23/25/2016\n", $lignes); $lignes = searchtask("Test"); $this->assertEquals("1;:!:;Test;:!:;23-01-2016;:!:;This is a test\n", $lignes); }
<?php include 'sessionstarter.php'; include 'function_task.php'; if (!checkParam($_POST['nom']) || !checkParam($_POST['deadline'])) { $_SESSION['error'] = 10; header('location: newtask.php'); } elseif (strpbrk($_POST['nom'], ";:!") || strpbrk($_POST['deadline'], ";:!")) { $_SESSION['error'] = 40; header('location: newtask.php'); } else { if (0 == newtask($_POST['nom'], $_POST['deadline'], $_POST['content'])) { header('location:tasklist.php'); } else { $_SESSION['error'] = 30; header('location: newtask.php'); } }
function edittask($code, $nom, $deadline, $content, $oldname) { deletetask($oldname); newtask($nom, $deadline, $content); uptask($nom, $code - 1); }