table_header_bg>$printmessage ");
- foreach($group_perm as $fp) {
+ foreach($group_perm as $fp)
+ {
print("owl_root_url . "/index.php?login=1");
diff --git a/lib/readhd.php b/lib/readhd.php
index f875cff..e8215af 100755
--- a/lib/readhd.php
+++ b/lib/readhd.php
@@ -1,32 +1,76 @@
".") and ($file <> "..")) {
- if (!is_file($PathFile)) { //check if it is a folder (dir) or file (dont check if it is a link)
+ if(($file <> ".") and ($file <> ".."))
+ {
+ if (!is_file($PathFile))
+ { //check if it is a folder (dir) or file (dont check if it is a link)
$DirCount++;
$Dirs[$DirCount] = $file;
- }else{
+ }
+ else
+ {
$FileCount++;
$Files[$FileCount] = $file;
}
}
}
- if ($GetWhat == 'file') {
+ // if it is a file add it to an array of files and return it
+ if ($GetWhat == 'file')
+ {
$FileCount++;
$Files[$FileCount] = "[END]"; //stop looping @ this
return $Files;
}
-
- if ($GetWhat == 'folder') {
+
+ // if it is a folder add it to the array of folders and return it
+ if ($GetWhat == 'folder')
+ {
$DirCount++;
$Dirs[$DirCount] = "[END]"; //stop looping @ this
return $Dirs;
@@ -35,6 +79,20 @@ function GetFromHD($GetWhat, $ThePath) {
}
}
+//-------------------------------------------------------------
+/**
+ * Function GetFileInfo($PathFile)
+ *
+ * Gets the information on the specified file i.e. modification
+ * and file size
+ *
+ * @param $PathFile
+ * The Path to the File
+ * @Return $FileInfo
+ * Returns an array with the information of the file
+*/
+//-------------------------------------------------------------
+// Usable
function GetFileInfo($PathFile) {
$TheFileSize = filesize($PathFile); //get filesize
$TheFileTime = date("Y-m-d H:i:s", filemtime($PathFile)); //get and fix time of last modifikation
@@ -48,46 +106,103 @@ function GetFileInfo($PathFile) {
return $FileInfo;
}
+
+//-------------------------------------------------------------
+/**
+ * Function CompareDBnHD($GetWhat, $ThePath, $DBList, $parent, $DBTable)
+ *
+ * Compare files or folders in database with files on harddrive
+ *
+ * @param $GetWhat
+ * The File/Folder(s) that will be compared
+ * @param $ThePath
+ * The Path of the File/Folder(s)
+ * @param $DBList
+ * The List of files in the DB
+ * @param $Parent
+ * The parent folder id
+ * @param $DBTable
+ * The DBTable to compare to
+ * @Return $RefreshPage
+ * Return true or false if page needs to be refreshed
+*/
+//-------------------------------------------------------------
+// Usable
+
function CompareDBnHD($GetWhat, $ThePath, $DBList, $parent, $DBTable) { //compare files or folders in database with files on harddrive
+
+ // get from HD the relevant Files/Folders, store in array
$F = GetFromHD($GetWhat, $ThePath);
-$RefreshPage = false; //if filez/Folderz are found the page need to be refreshed in order to see them.
+$RefreshPage = false; //if filez/Folders are found the page need to be refreshed in order to see them.
-if(is_array($F)) {
+// if array exists
+if(is_array($F))
+{
- for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++) {
+// loop through file/folderarray and Dblist array to compare them
+ for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++)
+ {
- for($DBLoopCount = 1; $DBList[$DBLoopCount] !== "[END]";$DBLoopCount++) {
- if($F[$HDLoopCount] == $DBList[$DBLoopCount]) {
+ for($DBLoopCount = 1; $DBList[$DBLoopCount] !== "[END]";$DBLoopCount++)
+ {
+ if($F[$HDLoopCount] == $DBList[$DBLoopCount])
+ {
unset($F[$HDLoopCount]); //removing file/folder that is in db from list of filez on disc (leaving list of filez on disc but not in db)
break;
}
}
}
- for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++) {
- if(ord($F[$HDLoopCount]) !== 0) { //if not the file/folder name is empty...
- if($GetWhat == "file") {
+// if certain files/Folders are not in the DB but are on the list, add them to the DB
+ for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++)
+ {
+ if(ord($F[$HDLoopCount]) !== 0)
+ { //if not the file/folder name is empty...
+ if($GetWhat == "file")
+ {
$RefreshPage = true;
- InsertHDFilezInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the filez-on-disc-but-not-in-db into the db.
- }else{
+ InsertHDFilezInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the files-on-disc-but-not-in-db into the db.
+
+ }
+ else
+ {
$RefreshPage = false;
}
- if($GetWhat == "folder") {
+ if($GetWhat == "folder")
+ {
$RefreshPage = true;
- InsertHDFolderzInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the folderz-on-disc-but-not-in-db into the db.
+ InsertHDFolderzInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the folders-on-disc-but-not-in-db into the db.
}
}
}
}
-
+ // return true or false
return $RefreshPage;
}
-function InsertHDFolderzInDB($TheFolder, $parent, $ThePath, $DBTable) {
+//-------------------------------------------------------------
+/**
+ * Function InsertHDFolderzInDB($TheFolder, $parent, $ThePath, $DBTable)
+ *
+ * Compare files or folders in database with files on harddrive
+ *
+ * @param $TheFolder
+ * The Folder to be inserted
+ * @param $Parent
+ * The parent folder id
+ * @param $ThePath
+ * The Path of the Folder
+ * @param $DBTable
+ * The DBTable to insert into
+ */
+//-------------------------------------------------------------
+// Usable
+function InsertHDFolderzInDB($TheFolder, $parent, $ThePath, $DBTable)
+{
global $default;
$sql = new Owl_DB; //create new db connection
@@ -98,6 +213,23 @@ function InsertHDFolderzInDB($TheFolder, $parent, $ThePath, $DBTable) {
}
+//-------------------------------------------------------------
+/**
+ * Function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable)
+ *
+ * Compare files or folders in database with files on harddrive
+ *
+ * @param $TheFile
+ * The Folder to be inserted
+ * @param $Parent
+ * The parent folder id
+ * @param $ThePath
+ * The Path of the File
+ * @param $DBTable
+ * The DBTable to insert into
+ */
+//-------------------------------------------------------------
+// Usable
function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable) {
global $default;
@@ -105,6 +237,7 @@ function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable) {
$FileInfo = GetFileInfo($ThePath . "/" . $TheFile); //get file size etc. 2=File size, 2=File time (smodified), 3=File time 2 (modified)
+ // if there is no file title assign it to default file title
if ($default->owl_def_file_title == "")
{
$title_name = $TheFile;
@@ -114,6 +247,7 @@ function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable) {
$title_name = $default->owl_def_file_title;
}
+// insert into DB
$SQL = "insert into $DBTable (name,filename,size,creatorid,parent,modified,description,metadata,security,groupid,smodified) values ('$title_name', '$TheFile', '$FileInfo[1]', '$default->owl_def_file_owner', '$parent', '$FileInfo[3]', '$TheFile', '$default->owl_def_file_meta', '$default->owl_def_file_security', '$default->owl_def_file_group_owner','$FileInfo[2]')";
$sql->query($SQL);
diff --git a/log.php b/log.php
index b8776c8..6bb5b0c 100755
--- a/log.php
+++ b/log.php
@@ -1,14 +1,18 @@
table_expand_width BGCOLOR=$default->main_header_b
?>
");
}
print uid_to_name($userid);
@@ -68,13 +75,13 @@ print("table_expand_width BGCOLOR=$default->main_header_b
");
-
+ // generates a navigation bar and provides details for the docs
print("table_expand_width BORDER=$default->table_border>");
print("$lang_viewlog ".gen_navbar($parent)."/".flid_to_name($id)." ");
print("
table_expand_width> $filename");
print ("table_expand_width border=$default->table_border cellpadding=3 cellspacing=0>
- $lang_ver
+ $lang_ver
$lang_user
$lang_log_file
$lang_modified ");
@@ -116,31 +123,29 @@ if ($default->owl_use_fs)
else
{
// name based query -- assuming that the given name for the file doesn't change...
-// at some point, we should really look into creating a "revision_id" field so that all revisions can be linked.
-// in the meanwhile, the code for changing the Title of the file has been altered to go back and
$name = flid_to_name($id);
$sql->query("select * from $default->owl_files_table where name='$name' AND parent='$parent' order by major_revision desc, minor_revision desc");
}
//global $sess;
-
-
- while($sql->next_record()) {
- $choped = split("\.", $sql->f("filename"));
- $pos = count($choped);
- $ext = strtolower($choped[$pos-1]);
-
-print("".$sql->f("major_revision").".".$sql->f("minor_revision")."
+// prints out all the relevant information on the specific document
+ while($sql->next_record())
+ {
+ $choped = split("\.", $sql->f("filename"));
+ $pos = count($choped);
+ $ext = strtolower($choped[$pos-1]);
+
+ print("".$sql->f("major_revision").".".$sql->f("minor_revision")."
".uid_to_name($sql->f("creatorid"))."
");
printFileIcons($sql->f("id"),$sql->f("filename"),$sql->f("checked_out"),$sql->f("url"),$default->owl_version_control,$ext);
print("  [ ".$sql->f("filename")." ]
".$sql->f("description").">
".$sql->f("modified")." ");
-}
+ }
-// print("".$sql->f("major_revision").".".$sql->f("minor_revision")."
+ //print("".$sql->f("major_revision").".".$sql->f("minor_revision")."
//".uid_to_name($sql->f("creatorid"))."
//[ ".$sql->f("filename")." ]
//".$sql->f("description").">
diff --git a/modify.php b/modify.php
index 9e48450..db19558 100755
--- a/modify.php
+++ b/modify.php
@@ -1,19 +1,12 @@
MODIFY Sess: $sess Loginname: $loginname Login:$login");
@@ -22,36 +15,39 @@ require("./config/owl.php");
require("./lib/owl.lib.php");
require("./config/html.php");
require("./lib/security.lib.php");
-include("./lib/header.inc");
+include("./lib/header.inc");
// Begin 496814 Column Sorts are not persistant
// + ADDED &order=$order&$sortorder=$sortname to
// all browse.php? header and HREF LINES
+
+
switch ($order) {
- case "name":
- $sortorder = 'sortname';
- break;
- case "major_revision":
- $sortorder = 'sortver';
- break;
- case "filename" :
- $sortorder = 'sortfilename';
- break;
- case "size" :
- $sortorder = 'sortsize';
- break;
- case "creatorid" :
- $sortorder = 'sortposted';
- break;
- case "smodified" :
- $sortorder = 'sortmod';
- break;
- case "checked_out":
- $sortorder = 'sortcheckedout';
- break;
- default:
- break;
+ case "name":
+ $sortorder = 'sortname';
+ break;
+ case "major_revision":
+ $sortorder = 'sortver';
+ break;
+ case "filename" :
+ $sortorder = 'sortfilename';
+ break;
+ case "size" :
+ $sortorder = 'sortsize';
+ break;
+ case "creatorid" :
+ $sortorder = 'sortposted';
+ break;
+ case "smodified" :
+ $sortorder = 'sortmod';
+ break;
+ case "checked_out":
+ $sortorder = 'sortcheckedout';
+ break;
+ default:
+ break;
}
+
// END 496814 Column Sorts are not persistant
print("table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>");
@@ -76,37 +72,36 @@ print("table_expand_width BGCOLOR=$default->main_header_b
print("");
if ($action == "file_update") {
- if(check_auth($id, "file_modify", $userid) == 1) {
+ if(check_auth($id, "file_modify", $userid) == 1) {
print(" ");
$expand = 1;
print("table_expand_width BORDER=$default->table_border>");
print("$lang_updating ".gen_navbar($parent)."/".flid_to_name($id)." ");
print("
table_expand_width> ");
print("");
+// BUG FIX: #449395 expanded/collapse view bugs
+ print(" ");
+// END BUG FIX: #449395 expanded/collapse view bugs
+ print(" ");
include("./lib/footer.inc");
} else {
print($lang_noupload);
@@ -127,60 +122,60 @@ if ($action == "file_upload") {
$sql->query("select id,name from $default->owl_groups_table");
$i=0;
while($sql->next_record()) {
- $groups[$i][0] = $sql->f("id");
- $groups[$i][1] = $sql->f("name");
- $i++;
+ $groups[$i][0] = $sql->f("id");
+ $groups[$i][1] = $sql->f("name");
+ $i++;
}
- } else {
- $sql = new Owl_DB;
- $sql->query("select userid,groupid from $default->owl_users_grpmem_table where userid = $userid ");
- if ($sql->num_rows($sql) == 0) {
- $sql->query("SELECT u.groupid as groupid, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id");
- }
- $i=0;
- while($sql->next_record()) {
- $groups[$i][0] = $sql->f("groupid");
- $groups[$i][1] = group_to_name($sql->f("groupid"));
- $i++;
- }
- }
+ }
+ else {
+ $sql = new Owl_DB;
+ $sql->query("select userid,groupid from $default->owl_users_grpmem_table where userid = $userid ");
+ if ($sql->num_rows($sql) == 0)
+ $sql->query("SELECT u.groupid as groupid, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id");
+ $i=0;
+ while($sql->next_record()) {
+ $groups[$i][0] = $sql->f("groupid");
+ $groups[$i][1] = group_to_name($sql->f("groupid"));
+ $i++;
+ }
+ }
/* END Bozz Change */
print("table_expand_width BORDER=$default->table_border>");
print("$lang_addingfile".gen_navbar($parent)." ");
print("
table_expand_width> ");
print("
-
-
-
-
-
-
-
- ");
include("./lib/footer.inc");
} else {
print($lang_noupload);
@@ -194,99 +189,102 @@ if ($action == "file_modify") {
/* BEGIN Bozz Change
Retrieve Group information if the user is in the
Administrator group */
+
if ( owlusergroup($userid) == 0 ) {
- $sql = new Owl_DB;
- $sql->query("select id,name from $default->owl_groups_table");
- $i=0;
- while($sql->next_record()) {
- $groups[$i][0] = $sql->f("id");
- $groups[$i][1] = $sql->f("name");
- $i++;
- }
- $sql->query("select id,name from $default->owl_users_table");
- $i=0;
- while($sql->next_record()) {
- $users[$i][0] = $sql->f("id");
- $users[$i][1] = $sql->f("name");
- $i++;
- }
- } else {
- if (uid_to_name($userid) == fid_to_creator($id)) {
- $sql = new Owl_DB;
- $sql->query("select userid,groupid from $default->owl_users_grpmem_table where userid = $userid ");
- if ($sql->num_rows($sql) == 0) {
- $sql->query("SELECT u.groupid as groupid, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id");
- }
- $i=0;
- while($sql->next_record()) {
- $groups[$i][0] = $sql->f("groupid");
- $groups[$i][1] = group_to_name($sql->f("groupid"));
- $i++;
- }
- $mygroup = owlusergroup($userid);
- $sql->query("select id,name from $default->owl_users_table where groupid='$mygroup'");
- $i=0;
- while($sql->next_record()) {
+ $sql = new Owl_DB;
+ $sql->query("select id,name from $default->owl_groups_table");
+ $i=0;
+ while($sql->next_record()) {
+ $groups[$i][0] = $sql->f("id");
+ $groups[$i][1] = $sql->f("name");
+ $i++;
+ }
+ $sql->query("select id,name from $default->owl_users_table");
+ $i=0;
+ while($sql->next_record()) {
$users[$i][0] = $sql->f("id");
$users[$i][1] = $sql->f("name");
$i++;
- }
- }
- }
+ }
+ }
+ else {
+ if (uid_to_name($userid) == fid_to_creator($id)) {
+ $sql = new Owl_DB;
+ $sql->query("select userid,groupid from $default->owl_users_grpmem_table where userid = $userid ");
+ if ($sql->num_rows($sql) == 0)
+ $sql->query("SELECT u.groupid as groupid, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id");
+ $i=0;
+ while($sql->next_record()) {
+ $groups[$i][0] = $sql->f("groupid");
+ $groups[$i][1] = group_to_name($sql->f("groupid"));
+ $i++;
+ }
+ $mygroup = owlusergroup($userid);
+ $sql->query("select id,name from $default->owl_users_table where groupid='$mygroup'");
+ $i=0;
+ while($sql->next_record()) {
+ $users[$i][0] = $sql->f("id");
+ $users[$i][1] = $sql->f("name");
+ $i++;
+ }
+ }
+ }
+
/* END Bozz Change */
print("table_expand_width BORDER=$default->table_border>");
print("$lang_modifying".gen_navbar($parent)."/".flid_to_name($id)." ");
print("
table_expand_width> ");
- $sql = new Owl_DB;
- $sql->query("select * from $default->owl_files_table where id = '$id'");
-
+ $sql = new Owl_DB; $sql->query("select * from $default->owl_files_table where id = '$id'");
while($sql->next_record()) {
- print("table_border>table_header_bg>
- $lang_title: f("name")."\">
+ print("
@@ -295,7 +293,7 @@ if ($action == "file_modify") {
include("./lib/footer.inc");
}
} else {
- print(" ".$lang_nofilemod);
+ print(" ".$lang_nofilemod);
}
}
@@ -306,21 +304,25 @@ if ($action == "folder_create") {
/* BEGIN Bozz Change
Retrieve Group information if the user is in the
Administrator group */
+
+
+
$sql = new Owl_DB;
if ( owlusergroup($userid) == 0 ) {
- $sql->query("SELECT id,name from $default->owl_groups_table");
- } else {
- $sql->query("SELECT * from $default->owl_users_grpmem_table join $default->owl_groups_table where id = groupid and userid = $userid");
- if ($sql->num_rows($sql) == 0) {
- $sql->query("SELECT u.groupid as id, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id");
- }
+ $sql->query("SELECT id,name from $default->owl_groups_table");
}
- $i=0;
- while($sql->next_record()) {
- $groups[$i][0] = $sql->f("id");
- $groups[$i][1] = $sql->f("name");
- $i++;
- }
+ else {
+ $sql->query("SELECT * from $default->owl_users_grpmem_table join $default->owl_groups_table where id = groupid and userid = $userid");
+ if ($sql->num_rows($sql) == 0)
+ $sql->query("SELECT u.groupid as id, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id");
+ }
+ $i=0;
+ while($sql->next_record()) {
+ $groups[$i][0] = $sql->f("id");
+ $groups[$i][1] = $sql->f("name");
+ $i++;
+ }
+
/* END Bozz Change */
print("table_expand_width BORDER=$default->table_border>$lang_addingfolder ".gen_navbar($parent)."
table_expand_width>
@@ -328,25 +330,23 @@ if ($action == "folder_create") {
-
-
+
+
");
- /* BEGIN Bozz Change
- Display Retrieved Group information if the user is in the
- Administrator group */
- print("table_header_bg>$lang_ownergroup: ");
- foreach($groups as $g) {
- print("$g[1]");
- }
- if ( owlusergroup($userid) == 0 ) {
- printgroupperm(54, "policy", $lang_policy, "admin");
- } else {
- printgroupperm(54, "policy", $lang_policy, "user");
- }
- /* END Bozz Change */
-
- print("
");
+ /* BEGIN Bozz Change
+ Display Retrieved Group information if the user is in the
+ Administrator group */
+ print("table_header_bg>$lang_ownergroup: ");
+ foreach($groups as $g) {
+ print("$g[1]");
+ }
+ if ( owlusergroup($userid) == 0 )
+ printgroupperm(54, "policy", $lang_policy, "admin");
+ else
+ printgroupperm(54, "policy", $lang_policy, "user");
+ /* END Bozz Change */
+ print("
");
include("./lib/footer.inc");
} else {
print($lang_nosubfolder);
@@ -357,101 +357,105 @@ if ($action == "folder_modify") {
if(check_auth($id, "folder_property", $userid) == 1) {
$expand=1;
- /* BEGIN Bozz Change
- Retrieve Group information if the user is in the
- Administrator group */
- if ( owlusergroup($userid) == 0 ) {
- $sql = new Owl_DB;
- $sql->query("select id,name from $default->owl_groups_table");
- $i=0;
- while($sql->next_record()) {
- $groups[$i][0] = $sql->f("id");
- $groups[$i][1] = $sql->f("name");
- $i++;
- }
- }
- /* END Bozz Change */
+ /* BEGIN Bozz Change
+ Retrieve Group information if the user is in the
+ Administrator group */
+
+ if ( owlusergroup($userid) == 0 ) {
+ $sql = new Owl_DB;
+ $sql->query("select id,name from $default->owl_groups_table");
+ $i=0;
+ while($sql->next_record()) {
+ $groups[$i][0] = $sql->f("id");
+ $groups[$i][1] = $sql->f("name");
+ $i++;
+ }
+ }
+ /* END Bozz Change */
print("table_expand_width BORDER=$default->table_border>");
print("$lang_modifying ".gen_navbar($id)." ");
print("
table_expand_width>
+
+
+
+ ");
+
+ /* BEGIN Bozz Change
+ Display Retrieved Group information if the user is in the
+ Administrator group */
+ if ( owlusergroup($userid) == 0 )
+ {
+ print("table_header_bg>$lang_ownergroup: ");
+ print("".group_to_name($sql->f("groupid")));
+ foreach($groups as $g) {
+ print(" $g[1]");
+ }
+ printgroupperm($security, "policy", $lang_policy, "admin");
+ }
+ else
+ {
+ printgroupperm($security, "policy", $lang_policy, "user");
+ }
+ /* END Bozz Change */
+
+ print("
");
include("./lib/footer.inc");
- } // end while
- } else {
- print($lang_nofoldermod);
- }
+
+ }
+ } else {
+ print($lang_nofoldermod);
+ }
}
if ($action == "file_email") {
- if(check_auth($id, "file_modify", $userid) == 1) {
- print(" ");
- $expand = 1;
+ if(check_auth($id, "file_modify", $userid) == 1) {
+ print(" ");
+ $expand = 1;
$sql = new Owl_DB;
- $sql->query("select * from $default->owl_users_table where id = '$userid'");
+ $sql->query("select * from $default->owl_users_table where id = '$userid'");
$sql->next_record();
- $default_reply_to = $sql->f("email");
-
- print("");
- print(" ");
-
- print("table_expand_width BORDER=$default->table_border>");
- print("$lang_emailing ".gen_navbar($parent)."/".flid_to_name($id)." ");
- print("
table_expand_width> ");
- print("
-
-
-
-
-
-
-
- ");
-
- print(" ");
- print(" ");
- include("./lib/footer.inc");
- } else {
- print($lang_noemail);
- }
+ $default_reply_to = $sql->f("email");
+
+ print("");
+ print(" ");
+
+ print("table_expand_width BORDER=$default->table_border>");
+ print("$lang_emailing ".gen_navbar($parent)."/".flid_to_name($id)." ");
+ print("
table_expand_width> ");
+ print("
+
+
+
+
+
+
+
+ ");
+
+ print(" ");
+ print(" ");
+ include("./lib/footer.inc");
+ } else {
+ print($lang_noemail);
+ }
}
?>
diff --git a/move.php b/move.php
index f85df35..17438d6 100755
--- a/move.php
+++ b/move.php
@@ -3,8 +3,6 @@
/*
* move.php
*
- * Move a folder or a file to a new destination
- *
* Copyright (c) 1999-2002 The Owl Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
@@ -48,18 +46,14 @@ switch ($order) {
if($action == "file") {
- //if the user does not have permission to modify the file
if(check_auth($id, "file_modify", $userid) == 0) {
include("./lib/header.inc");
print("table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>");
?>
");
+ print("");
}
print uid_to_name($userid);
print (" ");
@@ -75,18 +69,14 @@ if($action == "file") {
exit($lang_nofilemod);
}
} else {
- //if the user does not have permission to modify the folder
if(check_auth($id, "folder_modify", $userid) == 0) {
include("./lib/header.inc");
print("table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>");
?>
");
+ print("");
}
print uid_to_name($userid);
print (" ");
@@ -102,17 +92,9 @@ if($action == "file") {
}
}
-
-/**
-* Check for new folders. Sets $newFolder to the new folder id
-*/
function checkForNewFolder() {
global $HTTP_POST_VARS, $newFolder;
- if (!is_array($HTTP_POST_VARS))
- {
- return;
- }
-
+ if (!is_array($HTTP_POST_VARS)) return;
while (list($key, $value) = each ($HTTP_POST_VARS)) {
if (substr($key,0,2)=="ID") {
$newFolder = intval(substr($key,2));
@@ -121,58 +103,27 @@ function checkForNewFolder() {
}
}
-/**
-* Display all the sub-folders in a folder
-*
-* @param $fid folder id
-* @param $folder folder name
-*
-*/
function showFoldersIn($fid, $folder) {
global $folderList, $fCount, $fDepth, $excludeID, $action, $id, $default, $userid ;
for ($c=0 ;$c < ($fDepth-1) ; $c++) print " ";
if ($fDepth) print " ";
$gray=0; // Work out when to gray out folders ...
-
- //current parent for all moves
- if ($fid==$excludeID)
- {
- $gray=1;
- }
- //subtree for folder moves
- //can't move a folder to itself
- if (($action=="folder") && ($fid==$id))
- {
- $gray=1;
- }
- //check for permissions
- //if you don't have folder modify permissions
- if (check_auth($fid, "folder_modify", $userid) == 0)
- {
- $gray = 1;
- }
+ if ($fid==$excludeID) $gray=1; // current parent for all moves
+ if (($action=="folder") && ($fid==$id)) $gray=1; // subtree for folder moves
+ if (check_auth($fid, "folder_modify", $userid) == 0) $gray = 1; // check for permissions
+
-
if ($gray) {
print " ";
print " $folder \n";
- }
- else
- {
+ } else {
print " $folder \n";
}
- //Don't show subtree of selected folder as target for folder move
- if (($action=="folder") && ($fid==$id))
- {
- return;
- }
-
- //recurse through all the folders in the current folder and
- //display their sub-folders
- for ($c=0; $c < $fCount; $c++) {
+ if (($action=="folder") && ($fid==$id)) return; // Don't show subtree of selected folder as target for folder move
+ for ($c=0; $c<$fCount; $c++) {
if ($folderList[$c][2]==$fid) {
$fDepth++;
showFoldersIn( $folderList[$c][0] , $folderList[$c][1] );
@@ -187,14 +138,12 @@ if ($action=="$lang_cancel_button") {
}
checkForNewFolder();
-//if there is a new folder
if (isset($newFolder)) {
$sql = new Owl_DB;
$source="";
$fID=$parent;
do {
- //build the directory path from the root folder to the current parent folder
$sql->query("select name,parent from $default->owl_folders_table where id='$fID'");
while($sql->next_record()) {
$tName = $sql->f("name");
@@ -206,7 +155,6 @@ if (isset($newFolder)) {
$dest="";
$fID=$newFolder;
do {
- //build the directory path from the root folder to the new folder
$sql->query("select name,parent from $default->owl_folders_table where id='$fID'");
while($sql->next_record()) {
$tName = $sql->f("name");
@@ -232,8 +180,6 @@ if (isset($newFolder)) {
}
- //if we're using the file system
- //then move the file
if($default->owl_use_fs) {
if ($type != "url") {
if (!file_exists("$default->owl_FileDir/$dest$fname")) {
diff --git a/prefs.php b/prefs.php
index 7a4b992..a761109 100755
--- a/prefs.php
+++ b/prefs.php
@@ -1,12 +1,20 @@
table_expand_width BGCOLOR=$default->main_header_b
?>
-$lang_logout");?>
+
+ php print("$lang_logout ");
+?>
- ");?>
+ ");?>
+
-
");
+
+ if(isset($change))
+ {
+ print("$lang_saved ");
+ }
+
+ // get the id and name from the groups table
$sql = new Owl_DB;
$sql->query("select id,name from $default->owl_groups_table");
$i=0;
- while($sql->next_record()) {
+
+ // store in a double array
+ while($sql->next_record())
+ {
$groups[$i][0] = $sql->f("id");
$groups[$i][1] = $sql->f("name");
$i++;
}
+
+ //get all information from the users table based on the group id
$sql->query("select * from $default->owl_users_table where id = '$id'");
- while($sql->next_record()) {
+ // loop through the recordset
+ while($sql->next_record())
+ {
print("");
print(" ");
print(" ");
@@ -86,11 +130,14 @@ function printuser($id) {
print(" ");
print(" ");
print(" ");
- print(" "); }
+ print("");
+ }
}
-if($action) {
- if(isset($owluser)) printuser($owluser);
-} else {
+//-------------------------------------------------------------
+// if an action has occurred, check if user is set and then print out user preferences
+if($action)
+{
+ if(isset($owluser))
+ {
+ printuser($owluser);
+ }
+}
+else
+{
exit("$lang_err_general");
}
diff --git a/search.php b/search.php
index 5f7c24b..4f31171 100755
--- a/search.php
+++ b/search.php
@@ -1,12 +1,14 @@
query("select parent from $default->owl_folders_table where id = '$parent'");
- while($sql->next_record()) {
+ while($sql->next_record())
+ {
$path = fid_to_name($sql->f("parent"))."/".$path;
$parent = $sql->f("parent");
}
@@ -28,6 +47,8 @@ function find_path($parent) {
return $path;
}
+// This Layout section will not be needed as it is going to change
+
// BEGIN patch Scott Tigr
// patch for layout
include("./lib/header.inc");
@@ -45,9 +66,12 @@ include("./lib/header.inc");
print "";
print " ";
-if ($expand == 1) { // long view
+if ($expand == 1)
+{ // long view
print("\t\ttable_expand_width."\" border=\"0\">\n");
-} else {
+}
+else
+{
print("\t\ttable_collapse_width>\n");
}
@@ -67,18 +91,23 @@ $sql->query("SELECT id,creatorid,groupid,security FROM $default->owl_folders_tab
//
// get all the folders that the user can read
-while($sql->next_record()) {
+while($sql->next_record())
+{
$id = $sql->f("id");
if(check_auth($id, "folder_view", $userid) == 1) $folders[$id] = $id;
}
//
// get all the files in those folders that the user can read
-foreach($folders as $item) {
+foreach($folders as $item)
+{
$sql->query("SELECT * FROM $default->owl_files_table where parent = '$item'");
- while($sql->next_record()) {
+ while($sql->next_record())
+ {
$id = $sql->f("id");
- if(check_auth($id, "file_download", $userid) == 1) {
+
+ if(check_auth($id, "file_download", $userid) == 1)
+ {
$files[$id][id] = $id;
$files[$id][n] = $sql->f("name");
$files[$id][m] = explode(" ", $sql->f("metadata"));
@@ -109,21 +138,48 @@ $query = explode(" ", $query);
//
// the is the meat of the matching
if(sizeof($files) > 0) {
-foreach($query as $keyword) {
- foreach(array_keys($files) as $key) {
+foreach($query as $keyword)
+ {
+ foreach(array_keys($files) as $key)
+ {
// BEGIN enhancement Sunil Savkar
// if the $parent string contains a keyword to be searched, then the score is
// adjusted. This takes into account the hierarchy.
- if(eregi("$keyword", find_path($files[$key][p]))) $files[$key][score] = $files[$key][score] + 4;
- if(eregi("$keyword", $files[$key][n])) $files[$key][score] = $files[$key][score] + 4;
- if(eregi("$keyword", $files[$key][f])) $files[$key][score] = $files[$key][score] + 3;
- foreach($files[$key][m] as $metaitem) {
+
+ // if keyword is found in the path
+ if(eregi("$keyword", find_path($files[$key][p])))
+ {
+ $files[$key][score] = $files[$key][score] + 4;
+ }
+
+ //if keyword is found in the files array
+ if(eregi("$keyword", $files[$key][n]))
+ {
+ $files[$key][score] = $files[$key][score] + 4;
+ }
+
+ if(eregi("$keyword", $files[$key][f]))
+ {
+ $files[$key][score] = $files[$key][score] + 3;
+ }
+ // if keyword is found in metadata
+ foreach($files[$key][m] as $metaitem)
+ {
// add 2 to the score if we find it in metadata (key search items)
- if(eregi("$keyword", $metaitem)) $files[$key][score] = $files[$key][score] + 2;
+ if(eregi("$keyword", $metaitem))
+ {
+ $files[$key][score] = $files[$key][score] + 2;
+ }
}
- foreach($files[$key][d] as $descitem) {
+
+ // if keyword is found in description
+ foreach($files[$key][d] as $descitem)
+ {
// only add 1 for regular description matches
- if(eregi("$keyword", $descitem)) $files[$key][score] = $files[$key][score] + 1;
+ if(eregi("$keyword", $descitem))
+ {
+ $files[$key][score] = $files[$key][score] + 1;
+ }
}
}
}
@@ -136,11 +192,16 @@ $hit = 1;
$CountLines = 0;
$iconfiles = array("html","htm","gif","jpg","bmp","zip","tar","doc","mdb","xls","ppt","pdf","gz","mp3","tgz");
-
-if(sizeof($files) > 0) {
- while($max > 0) {
- foreach(array_keys($files) as $key) {
- if($files[$key][score] == $max) {
+//if array exists print out the results based on their score of relavence
+// This section will have to change as the interface is changing
+if(sizeof($files) > 0)
+{
+ while($max > 0)
+ {
+ foreach(array_keys($files) as $key)
+ {
+ if($files[$key][score] == $max)
+ {
$name = find_path($files[$key][p])."/".$files[$key][n];
$filename = $files[$key][f];
$choped = split("\.", $filename);
@@ -151,22 +212,32 @@ if(sizeof($files) > 0) {
$CountLines++;
$PrintLines = $CountLines % 2;
if ($PrintLines == 0)
+ {
print("");
+ }
else
print(" ");
print "";
//for ($i=$max; $i>0; $i--) {
//}
+
+ // display results based on relevance (different graphics) and score
$t_score = $max;
- for ($c=$max; $c>=1; $c--) {
- if ( $t_score >= 10) {
- if ( 0 == ($c % 10)) {
+ for ($c=$max; $c>=1; $c--)
+ {
+ if ( $t_score >= 10)
+ {
+ if ( 0 == ($c % 10))
+ {
print " ";
$t_score = $t_score - 10;
}
- } else {
- if ( (0 == ($t_score % 2)) && $t_score > 0 ) {
+ }
+ else
+ {
+ if ( (0 == ($t_score % 2)) && $t_score > 0 )
+ {
print " ";
}
$t_score = $t_score - 1;
diff --git a/view.php b/view.php
index 2127dc6..4980a01 100755
--- a/view.php
+++ b/view.php
@@ -3,8 +3,6 @@
/*
* view.php
*
- * Displays file details, image previews, zip previews depending on the current action
- *
* Copyright (c) 1999-2002 The Owl Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
@@ -54,13 +52,7 @@ switch ($order) {
}
// END 496814 Column Sorts are not persistant
-/**
-* Finds the path from the root folder to the required folder
-*
-* @param $parent required folder
-*
-* @returns string containing path from root folder to required folder
-*/
+
function find_path($parent) {
global $default;
$path = fid_to_name($parent);
@@ -75,13 +67,6 @@ function find_path($parent) {
return $path;
}
-/**
-* Get a file name for a file id
-*
-* @paramater $id file id
-*
-* @return string file name
-*/
function fid_to_filename($id) {
global $default;
$sql = new Owl_DB;
@@ -90,14 +75,11 @@ function fid_to_filename($id) {
}
if($action == "image_show") {
- //if the user has permission to download the file
if(check_auth($id, "file_download", $userid) == 1) {
- //if the file is stored on the file system
if ($default->owl_use_fs) {
$path = $default->owl_FileDir."/".find_path($parent)."/".fid_to_filename($id);
readfile("$path");
}
- //else the file is stored in the database
else {
$sql = new Owl_DB;
$filename = fid_to_filename($id);
@@ -145,17 +127,12 @@ print("table_expand_width BGCOLOR=$default->main_header_b
");?>
table_expand_width BORDER=$default->table_border>");
print(" ".gen_navbar($parent)."/".flid_to_name($id)." ");
print("
table_expand_width> ");
-
- //get the file information
$sql = new Owl_DB; $sql->query("select * from $default->owl_files_table where id = '$id'");
while($sql->next_record()) {
$security = $sql->f("security");
@@ -183,9 +160,7 @@ if($action == "file_details") {
}
}
-//preview an image
if($action == "image_preview") {
- //if the current user has permission to dowload the file
if(check_auth($id, "file_download", $userid) == 1) {
$path = find_path($parent)."/".fid_to_filename($id);
print("$lang_viewing". gen_navbar($parent) . "/" . fid_to_filename($id) ." ");
@@ -195,18 +170,13 @@ if($action == "image_preview") {
}
}
-//preview a zip file
if($action == "zip_preview") {
- //if the current user has permission to download the file
if(check_auth($id, "file_download", $userid) == 1) {
$name = fid_to_filename($id);
- //if the file is stored on the file system
if ($default->owl_use_fs) {
$path = find_path($parent)."/".$name;
- }
- //else the file is stored in the database
- else {
+ } else {
$path = $name;
if (file_exists($default->owl_FileDir. "/$path")) unlink($default->owl_FileDir. "/$path");
$file = fopen($default->owl_FileDir. "/$path", 'wb');
@@ -254,18 +224,13 @@ if($action == "zip_preview") {
// BEGIN wes change
if($action == "html_show" || $action == "text_show") {
- //if the current user has permission to download the file
if(check_auth($id, "file_download", $userid) == 1) {
- //if the file is stored on the file system
if ($default->owl_use_fs) {
$path = $default->owl_FileDir."/".find_path($parent)."/".fid_to_filename($id);
print(" $lang_viewing". gen_navbar($parent) . "/" . fid_to_filename($id) ." ");
if ($action == "text_show") print("");
readfile("$path");
- }
- //else the file is stored in the database
- else
- {
+ } else {
print("$lang_viewing /".find_path($parent)."/".fid_to_filename($id)." ");
if ($action == "text_show") print("");