/**
     * @NoAdminRequired
     * @CORS
     * @NoCSRFRequired
     */
    public function create() {
	require_once 'ownnote/lib/backend.php';
	if (isset($_GET["note"]))
		return createNote("Notes", $_GET["note"]);
	if (isset($_POST["note"]))
		return createNote("Notes", $_POST["note"]);
    }
Example #2
0
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!";
    } else {
        $title = cleanInput($_GET["title"]);
    }
Example #3
0
<?php

\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('ownnote');

require_once 'ownnote/lib/backend.php';

if (isset($_GET['id']) && $_GET['id'] != '' && $_GET['id'] != 'note title') {
	echo createNote("Notes", $_GET['id']);
}

?>
Example #4
0
 */
require '../vendor/autoload.php';
$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;
        }