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();
 }
Example #2
0
 /**
  * adds a new file to our db
  */
 public function addFileToDB()
 {
     DA_DatabaseHandler::insertMySQL(array(FILES_TABLE => array("filename" => $this->filename, "metaname" => $this->metaname, "filepath" => $this->path, "type" => $this->type, "level" => $this->level, "parent_id" => $this->parentid))) or die("<br/>could not insert into db");
     $this->id = mysql_insert_id();
 }
 public function updateCategories()
 {
     $this->table = FILES_TABLE;
     DA_DatabaseHandler::updateTableRow(array($this->table => array("categories" => strip_tags($_POST["categories"]))), "id", strip_tags($_POST["id"]));
     echo "updated categories for " . $_POST["id"];
 }