$return['firstline'] = " "; $fileid = $_POST['fileid']; $return['lock'] = 'true'; //if the user only has read access their is no need to place any locks on any files if ($_SESSION['access'] != 'Read') { $sqlcheck = "SELECT `Lock` FROM files WHERE FileID = '{$fileid}'"; $resultset = query($conn, $sqlcheck); $resultset->data_seek(0); $row = $resultset->fetch_assoc(); $user = $row['Lock']; if ($user != "") { $return['firstline'] = "Write access granted to " . $user . "\n"; $return['lock'] = 'true'; } else { $return['lock'] = 'false'; lockfile($conn, $username, $fileid); $_SESSION['recordlocked'] = $fileid; } } //gets the content for the particular file $getcontent = "SELECT FileContent, Output FROM files WHERE FileID = '{$fileid}'"; $rs = query($conn, $getcontent); while ($row = $rs->fetch_assoc()) { $return['content'] = $row['FileContent']; $return['output'] = $row['Output']; } $return["json"] = json_encode($return); echo json_encode($return); //returns json object } //saving the content or code of a file to the database
$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é."; } ?>