Ejemplo n.º 1
0
        }
    }
    //updates name for notebook
    $sqlupdate = "UPDATE notebooks SET notebookname = '{$name}', shared = {$isshared} WHERE NotebookID = '{$notebookid}'";
    query($conn, $sqlupdate);
    //removes all current read and write users
    $sqldelete = "DELETE FROM users_has_notebooks WHERE NoteBookID = '{$notebookid}'";
    query($conn, $sqldelete);
    //adds write users
    foreach ($userswrite as $user) {
        $sqladd = "CALL add_shared_notebook('{$user}', '{$notebookid}', 1)";
        queryInsert($conn, $sqladd);
    }
    //adds read users
    foreach ($usersread as $user) {
        $sqladd = "CALL add_shared_notebook('{$user}', '{$notebookid}', 0)";
        queryInsert($conn, $sqladd);
    }
    echo "success";
}
//used to remove a lock from a file
if ($_POST['action'] === 'removelock') {
    $id = $_SESSION['recordlocked'];
    unlockfile($conn, $id);
}
//removes a notebook shared with the user
if ($_POST['action'] === 'removenotebook') {
    $id = $_POST['notebookid'];
    $sqlremove = "DELETE FROM users_has_notebooks WHERE NoteBookID = '{$id}' AND UserName = '******'";
    query($conn, $sqlremove);
}
Ejemplo n.º 2
0
<?php

session_start();
include "../config/connection.php";
include "helperFunctionsDatabase.php";
$select = $_POST['select'];
//indicates type of notebooks to be loaded, 1 = sharednotebooks, 0 = creatednotebooks
$username = $_SESSION['username'];
$order = $_POST['order'];
$rs;
if (isset($_SESSION['recordlocked'])) {
    $id = $_SESSION['recordlocked'];
    unlockfile($conn, $username, $id);
}
//creates query to get shared notebooks
if ($select == 1) {
    $getnotebooks = "SELECT NotebookID FROM users_has_notebooks WHERE username = '******' ORDER BY SharedNotebookCounter {$order}";
    $rs = query($conn, $getnotebooks);
    $_SESSION['notebookstype'] = 'shared';
} else {
    if ($select == 0) {
        $sqlquery = "SELECT NotebookID FROM notebooks WHERE UserName = '******' ORDER BY NotebookCounter {$order}";
        $rs = query($conn, $sqlquery);
        $_SESSION['notebookstype'] = 'created';
    }
}
//echos back all of the notebooks for the particular choice the user choice
if ($rs->num_rows > 0) {
    echo "<ul id='loadfiles'>";
    while ($row = $rs->fetch_assoc()) {
        $notebookid = $row['NotebookID'];
Ejemplo n.º 3
0
			$output[] = "Impossible d'archiver $p";
		}
	} else {
		$output[] = "$p n'existe pas.";
	}
}

if (($action == "idx") or ($postaction == "idx")) {
	if (@is_dir($cf_datadir.$p)) {
      	$rebuilt = rebuild_index($p);
	} else {
		$rebuilt = rebuild_index(dirname($p));
	}
	$output[] = ".idx $p reconstruit.";
}

if ($p and ($action == "dit")) {
  $locked = lockfile("$p");
	$output[] = "Fichier $p en mode edition.";
} elseif ($p and ($action == "dix")) {
  $locked = lockfile("$p");
	$output[] = "Fichier $p en mode edition brute.";
} elseif ($action == "ulk") {
  unlockfile("$p");
	$output[] = "Fichier $p dévérouillé.";
} elseif ($action == "lok") {
  lockfile("$p");
	$output[] = "Fichier $p vérouillé.";
}
?>