From 8a9ef2151b3098db2a7b2ab9ab02a9eb948bd120 Mon Sep 17 00:00:00 2001 From: rob Date: Sun, 19 Jan 2003 14:57:08 +0000 Subject: [PATCH] Moved functionality into Folder.inc --- lib/foldermanagement/FolderLib.inc | 105 --------------------------------------------------------------------------------------------------------- lib/foldermanagement/FolderManager.inc | 132 ------------------------------------------------------------------------------------------------------------------------------------ 2 files changed, 0 insertions(+), 237 deletions(-) delete mode 100644 lib/foldermanagement/FolderLib.inc delete mode 100644 lib/foldermanagement/FolderManager.inc diff --git a/lib/foldermanagement/FolderLib.inc b/lib/foldermanagement/FolderLib.inc deleted file mode 100644 index b00b9d4..0000000 --- a/lib/foldermanagement/FolderLib.inc +++ /dev/null @@ -1,105 +0,0 @@ -query("SELECT is_public FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); - if ($sql->next_record()) { - return $sql->f("is_public"); - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } - //error message set by FolderManager::folderExists - return false; - } - - /** - * Get the document type for a folder - * - * @param $iFolderID - * - * @return integer document type primary key, false otherwise and set $_SESSION["errorMessage"] - */ - function getFolderDocumentType($iFolderID) { - global $default, $lang_err_database; - if (FolderManager::folderExistsID($iFolderID)) { - $sql = new Owl_DB(); - $sql->query("SELECT document_type_id FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); - if ($sql->next_record()) { - return $sql->f("document_type_id"); - } - $_SESSION["errorMessage"] = $lang_err_database; - - } - //error message set by FolderManager::folderExists - return false; - } - - /** - * Get the folder name using the primary key - * - * @param $iFolderID Primary key of folder to get name for - * - * @return String name on success, false otherwise and set $_SESSION["errorMessage"] - */ - function getFolderName($iFolderID) { - global $default, $lang_err_database; - $sql = new Owl_DB(); - $sql->query("SELECT name FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); - if ($sql->next_record()) { - return stripslashes($sql->f("name")); - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } - - /** - * Get the primary key of the parent folder - * - * @param $iFolderID Primary key of folder to get parent for - * - * @return integer primary key of parent folder - */ - function getParentFolderID($iFolderID) { - global $default; - $sql = new Owl_DB(); - $sql->query("SELECT parent_id FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); - $sql->next_record(); - return $sql->f("parent_id"); - } - - /** - * Get the full path for a folder - * - * @param Primary key of folder to generate path for - * - * @return String full path of folder - */ - function getFolderPath($iFolderID) { - global $default; - //if the folder has a parent - if (FolderLib::getParentFolderID($iFolderID) != 0) { - $sCurrentPath = FolderLib::getFolderPath(FolderLib::getParentFolderID($iFolderID), FolderLib::getFolderName($iFolderID)) . "/" . $sCurremtPath; - } - return $default->owl_FileDir . "/" . FolderLib::getFolderName($iFolderID); - - } -} -?> diff --git a/lib/foldermanagement/FolderManager.inc b/lib/foldermanagement/FolderManager.inc deleted file mode 100644 index 347bb2f..0000000 --- a/lib/foldermanagement/FolderManager.inc +++ /dev/null @@ -1,132 +0,0 @@ -query("INSERT INTO " . $default->owl_folders_table . " (name, description, parent_id, creator_id, document_type_id, unit_id, is_public) " . - "VALUES ('" . $sName . "', '" . $sDescription . "', " . $iParentID . ", " . $iCreatorID . ", " . $iDocumentTypeID . ", " . $iUnitID . ", " . $bIsPublic . ")"); - if (!$result) { - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } - return true; - } - //error message set in folderExistsName - return false; - - } - - /** - * Delete and existing folder - * - * $iFolderID Primary key of folder to delete - * - * @return true on successfuly deletion, false otherwise and set $_SESSION["errorMessage"] - */ - function deleteFolder($iFolderID) { - global $default,$lang_err_folder_not_exist; - //if the folder exists - if (FolderManager::folderExistsID($iFolderID)) { - $sql = new Owl_DB(); - $result = $sql->query("DELETE FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); - if (!$result) { - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } - return true; - } - $_SESSION["errorMessage"] = $lang_err_folder_not_exist . "id " . $iFolderID; - return false; - } - - - /** - * Checks if a given folder already exists using the folder name - * - * @param $sName Name of folder - * @param $iParentID Primary key of parent folder - * - * @return true if the folder exists, false otherwise and set $_SESSION["errorMessage"] - */ - function folderExistsName($sName, $iParentID) { - $sName = addslashes($sName); - global $default, $lang_err_folder_exist; - $sql = new Owl_DB(); - $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE name = '" . $sName . "' AND parent_id = " . $iParentID); - if ($sql->next_record()) { - return true; - } - $_SESSION["errorMessage"] = $lang_err_folder_exist . $sName . " parent_id " . $iParentID; - return false; - } - - /** - * Checks if a given folder already exists using the folder name - * - * @param $iFolderID Primary key of folder - * - * @return true if the folder exists, false otherwise and set $_SESSION["errorMessage"] - */ - function folderExistsID($iFolderID) { - global $default, $lang_err_folder_exist; - $sql = new Owl_DB(); - $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); - if ($sql->next_record()) { - return true; - } - $_SESSION["errorMessage"] =$lang_err_folder_exist . "id " . $iFolderID; - return false; - } - - /** - * Get a folder's primary key using the folder name and the parent id - * - * @param $sName Name of folder - * @param $iParentID Primary key of parent folder - * - * @return id integer on successful lookup, false otherwise and set $_SESSION["errorMessage"] - * - */ - function getFolderID($sName, $iParentID) { - $sName = addslashes($sName); - global $default, $lang_err_folder_exist; - $sql = new Owl_DB(); - $sql->query("SELECT id FROM " . $default->owl_folders_table . " WHERE name = '" . $sName . "' AND parent_id = " . $iParentID); - if ($sql->next_record()) { - return $sql->f("id"); - } - $_SESSION["errorMessage"] = $lang_err_folder_exist . $sName; - return false; - } -} -?> -- libgit2 0.21.4