/** * @NoAdminRequired * @CORS * @NoCSRFRequired */ public function del() { require_once 'ownnote/lib/backend.php'; if (isset($_GET["note"])) return deleteNote("Notes", $_GET["note"].".htm"); if (isset($_POST["note"])) return deleteNote("Notes", $_POST["note"].".htm"); }
if (!isset($_SESSION['logged_in_user_username'])) { header("Location: login.php"); } if (isset($_GET["logout"])) { session_destroy(); header("Location: login.php"); } function cleanInput($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } if (isset($_GET["delete"])) { deleteNote($_GET["delete"]); } if (isset($_GET["addnew"])) { createNote($_SESSION["logged_in_user_username"], $_GET["title"], $_GET["text"]); } if (isset($_GET["update"])) { updateNote($_GET["id"], $_SESSION["logged_in_user_username"], $_GET["title"], $_GET["text"]); } // muutujad väärtuste jaoks $title = ""; $text = ""; $title_error = ""; $text_error = ""; if (isset($_GET["title"])) { if (empty($_GET["title"])) { $title_error = "See väli on kohustuslik!";
$datadir = dirname(__FILE__) . '/notes'; switch (getParam('method')) { case "list": $response = readNotesList($datadir); break; case "get": $response = readNote($datadir, getParam('id'), true); break; case "update": $response = writeNote($datadir, getParam('id'), getParam('title'), getParam('text')); break; case "add": $response = addNote($datadir, getParam('title'), getParam('text')); break; case "delete": $response = deleteNote($datadir, getParam('id')); break; default: error('Unknown method'); } echo json_encode($response); exit; function readNotesList($datadir) { $notes = array(); $handle = opendir($datadir); if ($handle) { while (($filename = readdir($handle)) !== false) { $pathinfo = pathinfo($filename); if ('md' == $pathinfo['extension']) { $id = $pathinfo['filename'];
$base = "http://docent.cmi.hro.nl/bootb/restdemo/notes/"; $client = new GuzzleHttp\Client(); switch ($_SERVER["REQUEST_METHOD"]) { case "GET": if (isset($_GET["id"]) && !empty($_GET["id"])) { getNote($client, $base, $_GET["id"]); exit; } getNotes($client, $base); exit; case "POST": if (isset($_POST["note"]) && !empty($_POST["note"])) { $body = $_POST["note"]; createNote($client, $base, $body); exit; } exit; case "PUT": if (isset($_POST["id"]) && !empty($_POST["id"] && isset($_POST["body"]) && !empty($_POST["body"]))) { $id = $_GET["id"]; $body = $_POST["body"]; editNote($client, $base, $id, $body); } exit; case "DELETE": if (isset($_GET["id"]) && !empty($_GET["id"])) { deleteNote($client, $base, $_GET["id"]); exit; } exit; }
<?php /** * Created by PhpStorm. * User: Karlos * Date: 3/10/2016 * Time: 9:00 PM */ session_start(); include 'Connection.php'; include '_database_access.php'; if (isset($_SESSION['username'])) { if (isset($_POST['action'])) { switch ($_POST['action']) { case 'create': addNote($conn); break; case 'delete': deleteNote($conn); break; default: break; } } }
<?php /****************************************************************** editannotations.php Called by deleteTag, deleteNote, editNote, deleteNote, and deleteAnnotation in annotate.js in service of view.js in service of view.php Contains utilities for deleting and editing annotations *******************************************************************/ include 'dbsetup.php'; include 'util.php'; if ($_GET['event'] == 'delete-tag') { deleteTag($_GET['tag'], $_GET['highlight']); } else { if ($_GET['event'] == 'delete-note') { deleteNote($_GET['note'], $_GET['highlight']); } else { if ($_GET['event'] == 'edit-note') { editNote($_GET['note'], mysql_real_escape_string($_GET['text'])); } else { if ($_GET['event'] == 'add-note') { addNote(mysql_real_escape_string($_GET['text']), $_GET['highlight'], $_GET['user']); } else { if ($_GET['event'] == 'add-tags') { addTags(mysql_real_escape_string($_GET['tags']), $_GET['highlight'], $_GET['user']); } else { if ($_GET['event'] == 'delete-annotation') { deleteAnnotation($_GET['highlight']); } } }
<?php \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('ownnote'); require_once 'ownnote/lib/backend.php'; if (isset($_GET['id']) && $_GET['id'] != '') { echo deleteNote("Notes", $_GET['id']); } ?>