Exemple #1
0
         $action_message = "<div class='alert alert-success'>{$langDirMv}</div><br>";
     } else {
         $action_message = "<div class='alert alert-danger'>{$langImpossible}</div><br>";
         /*             * * return to step 1 ** */
         $move = $source;
         unset($moveTo);
     }
 }
 /* -------------------------------------
    MOVE FILE OR DIRECTORY : STEP 1
    -------------------------------------- */
 if (isset($_GET['move'])) {
     $move = $_GET['move'];
     // h $move periexei to onoma tou arxeiou. anazhthsh onomatos arxeiou sth vash
     $moveFileNameAlias = Database::get()->querySingle("SELECT filename FROM document\n                                                WHERE {$group_sql} AND path=?s", $move)->filename;
     $dialogBox .= directory_selection($move, 'moveTo', dirname($move));
 }
 /*     * ************************************
       DELETE FILE OR DIRECTORY
      * ************************************ */
 if (isset($_GET['delete']) and isset($_GET['filePath']) and $_SERVER['REQUEST_METHOD'] == 'POST') {
     $filePath = $_GET['filePath'];
     // Check if file actually exists
     $r = Database::get()->querySingle("SELECT path, extra_path, format, filename FROM document\n                                        WHERE {$group_sql} AND path = ?s", $filePath);
     $delete_ok = true;
     if ($r) {
         // remove from index if relevant (except non-main sysbsystems and metadata)
         Database::get()->queryFunc("SELECT id FROM document WHERE course_id >= 1 AND subsystem = 0\n                                            AND format <> '.meta' AND path LIKE ?s", function ($r2) {
             Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_DOCUMENT, $r2->id);
         }, $filePath . '%');
         if (empty($r->extra_path)) {
Exemple #2
0
            unset($moveTo);
        }
    }

    // Move file or directory: Step 1
    if (isset($_GET['move'])) {
        $move = $_GET['move'];
        $curDirPath = my_dirname($move);
        $navigation[] = array('url' => documentBackLink($curDirPath), 'name' => $pageName);

        // $move contains file path - search for filename in db
        $q = Database::get()->querySingle("SELECT filename, format FROM document
                                                WHERE $group_sql AND path=?s", $move);
        $moveFileNameAlias = $q->filename;
        $exclude = ($q->format == '.dir')? $move: '';
        $dialogBox .= directory_selection($move, 'moveTo', $curDirPath, $exclude);
    }

    // Delete file or directory
    if (isset($_GET['delete']) and isset($_GET['filePath'])) {
        $filePath = $_GET['filePath'];
        $curDirPath = my_dirname($_GET['filePath']);
        // Check if file actually exists
        $r = Database::get()->querySingle("SELECT id, path, extra_path, format, filename FROM document
                                        WHERE $group_sql AND path = ?s", $filePath);
        $delete_ok = true;
        if ($r) {
            // remove from index if relevant (except non-main sysbsystems and metadata)
            Database::get()->queryFunc("SELECT id FROM document WHERE course_id >= 1 AND subsystem = 0
                                            AND format <> '.meta' AND path LIKE ?s",
                function ($r2) {