Example #1
0
/*
	---- VALUE ----
	.Get name
	.Get id
	.Get action
		Set :			Get :			GetLast :	GetAll :
		.Get note 		.Get matiere 	nil 		nil
		.Get date
		.Get matiere
*/
include 'co_Bdd.php';
try {
    if (checkArgument() && checkUser($_GET['name'], $_GET['id'], $bdd)) {
        switch ($_GET['action']) {
            case 'set':
                $disp = setNote($bdd);
                break;
            case 'get':
                $disp = getNote($bdd);
                break;
            case 'getLast':
                $disp = getLast($bdd);
                break;
            case 'getAll':
                $disp = getAll($bdd);
                break;
            default:
                throw new Exception('ActionNotFound', 04);
                break;
        }
        echo json_encode($disp, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
Example #2
0
    $bLogged = true;
    $defaultNote = "default";
}
$note = $defaultNote;
$filename = $filePath . $defaultNote . ".txt";
$bEnd = false;
$editor_visible = false;
if (isset($_POST['note'])) {
    $params = parseArgs(stripslashes($_POST['note']));
    if (count($params) > 0) {
        foreach ($params as $key => $value) {
            switch ((string) $key) {
                case '0':
                    //A note name was specified
                    if ($bLogged && $value != "") {
                        $arrayNote = setNote($value, $filePath);
                        if (count($arrayNote) == 0) {
                            $page_content .= '<p class="error">No note matching ' . $value . '</p>';
                            $bEnd = true;
                            $note = "";
                            break 2;
                        } elseif (count($arrayNote) > 1) {
                            $page_content .= '<p>Notes matching ' . $value . '</p>';
                            $page_content .= '<ul>';
                            foreach ($arrayNote as $f) {
                                $page_content .= '<li>' . $f . '</li>';
                            }
                            $page_content .= '</ul>';
                            $bEnd = true;
                            $note = "";
                            break 2;