public static function listFilesWithCategory($cat)
 {
     $renderer = new DA_Renderer();
     $files = DA_DatabaseHandler::findInTable(FILES_TABLE, "categories", "%" . $cat . "%");
     foreach ($files as $key => $file) {
         if (self::checkFileForPic($file["filename"])) {
             $files[$key]["thumbnail"] = 1;
         }
         if (self::getThumbForPdf($file["id"])) {
             $files[$key]["thumbnail"] = 2;
         }
         $folder = current(DA_DatabaseHandler::findInTable(FOLDERS_TABLE, "id", $file["parent_id"]));
         $files[$key]["parentname"] = $folder["filename"];
     }
     $renderer->templatename = "catfrontend.html";
     $renderer->setTemplate();
     $renderer->arr["files"] = $files;
     $renderer->arr["dapath"] = "/wp-content/";
     $renderer->arr["subpath"] = "uploads/downloadarea/";
     return $renderer->renderArr();
 }
 public function updatePositions()
 {
     $this->table = FILES_TABLE;
     foreach ($_POST["sorting"] as $key => $file) {
         $folderinfo = current(DA_DatabaseHandler::findInTable(FOLDERS_TABLE, "id", $file["parent_id"]));
         $fileinfo = current(DA_DatabaseHandler::findInTable($this->table, "id", $file["id"]));
         DA_DatabaseHandler::updateTableRow(array($this->table => array("position" => $file["position"], "parent_id" => $file["parent_id"], "filepath" => $folderinfo["filepath"] . "/" . $fileinfo["filename"])), "id", $file["id"]);
         rename(DA_WP_PATH . $fileinfo["filepath"], DA_WP_PATH . $folderinfo["filepath"] . "/" . $fileinfo["filename"]);
     }
     echo "sorted!";
 }