From bb0ae76176433c2cfcbe32f5f5d8152ade7fcc3e Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 21 Feb 2003 15:33:29 +0000 Subject: [PATCH] removing owl sources --- lib/footer.inc | 44 -------------------------------------------- lib/header.inc | 33 --------------------------------- lib/owl.lib.php | 1730 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- lib/readhd.php | 256 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- lib/security.lib.php | 426 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ lib/styles.css | 79 ------------------------------------------------------------------------------- 6 files changed, 0 insertions(+), 2568 deletions(-) delete mode 100755 lib/footer.inc delete mode 100755 lib/header.inc delete mode 100755 lib/owl.lib.php delete mode 100755 lib/readhd.php delete mode 100755 lib/security.lib.php delete mode 100755 lib/styles.css diff --git a/lib/footer.inc b/lib/footer.inc deleted file mode 100755 index 69dee3c..0000000 --- a/lib/footer.inc +++ /dev/null @@ -1,44 +0,0 @@ - - - You should have received a copy of the GNU Public - License along with this package; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - -*/ - -if ($expand == "1") { - echo "\t
table_expand_width>"; -} else { - echo "\t
table_collapse_width>"; -} - -?> - -$lang_engine
"); -print("Version: $default->version"); -// END -?> -$lang_admin
"); -} -print "
- -
"; -?> - - - diff --git a/lib/header.inc b/lib/header.inc deleted file mode 100755 index 20a053d..0000000 --- a/lib/header.inc +++ /dev/null @@ -1,33 +0,0 @@ - - - You should have received a copy of the GNU Public - License along with this package; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - -*/ - -?> - - - - Owl Intranet - - - - -
-
-
diff --git a/lib/owl.lib.php b/lib/owl.lib.php deleted file mode 100755 index d0ee61b..0000000 --- a/lib/owl.lib.php +++ /dev/null @@ -1,1730 +0,0 @@ -Host = $default->owl_db_host; - $this->Database = $default->owl_db_name; - $this->User = $default->owl_db_user; - $this->Password = $default->owl_db_pass; - } - // END wes changes - - /** - * Create a query from the provided paramaters. The ID column - * is seleted by default - * - * @param $sTableName Table to query - * @param $aColumns Columns in table - * @param $sWhereClause Where clause (optional) - * @param $sOrderByClause Order by clause (optional) - */ - function createSQLQuery($sTableName, $aColumns, $sWhereClause = null, $sOrderByClause = null) { - $this->sLastTableName = $sTableName; - $this->sLastWhereCluase = $sWhereClause; - $this->sLastOrderByClause = $sOrderByClause; - - $this->sQuery = "SELECT ID, "; - - for( $i = 0; $i < count($aColumns) - 1; $i++ ) { - $this->sQuery = $this->sQuery . $aColumns[$i] . ","; - } - - $this->sQuery .= $aColumns[count($aColumns) - 1] . " "; - $this->sQuery .= "FROM " . $sTableName . " "; - - if (isset($sWhereClause)) { - $this->sQuery .= "WHERE " . $sWhereClause . " "; - } - - if (isset($sOrderByClause)) { - $this->sQuery .= "ORDER BY " . $sOrderByClause . " "; - } - - $this->query($this->sQuery); - - } - - /** - Create a query from the provided paramaters, specifying a limit and an offset. - The ID column is selected by default - - @param $sTableName Table to query - @param $aColumns Columns in table - @param $iOffset Offset - @param $iLimit Limit - @param $sWhereClause Where clause (optional) - @param $sOrderByClause Order by clause (optional) - */ - - function createSQLQueryWithOffset($sTableName, $aColumns, $iOffset, $iLimit, $sWhereClause = null, $sOrderByClause = null) { - $this->sLastTableName = $sTableName; - $this->sLastWhereCluase = $sWhereClause; - $this->sLastOrderByClause = $sOrderByClause; - - $this->sQuery = "SELECT ID, "; - - for( $i = 0; $i < count($aColumns) - 1; $i++ ) { - $this->sQuery = $this->sQuery . $aColumns[$i] . ","; - } - - $this->sQuery .= $aColumns[count($aColumns) - 1] . " "; - $this->sQuery .= "FROM " . $sTableName . " "; - - - - if (isset($sWhereClause)) { - $this->sQuery .= "WHERE " . $sWhereClause . " "; - } - - if (isset($sOrderByClause)) { - $this->sQuery .= "ORDER BY " . $sOrderByClause . " "; - } - - $this->sQuery .= "LIMIT " . $iOffset . ", " . $iLimit; - $this->query($this->sQuery); - } - - /** - * Get the result count for the previously executed query. Meant - * to be used in conjuction with createSSQLQueryWithOffset so that - * the total number of results can be calculated - * - * @return int row count - */ - function & getLastQueryResultCount() { - if (isset($this->sLastTableName)) { - $sCountResultQuery = "SELECT COUNT(*) AS ResultCount FROM " . $this->sLastTableName; - - if (isset($this->sLastWhereClause)) { - sCountResultQuery . " WHERE " . $this->sLastWhereClause; - } - $this->query($sCountResultQuery); - $this->next_record(); - return $this->f("ResultCount"); - } else { - return 0; - } - } - - /** - * Execute the query and return the results - * - * @returns Results of query - */ - function & getQueryResults() { - $result = null; - if (isset($this->sQuery)) { - $result = $this->query($this->sQuery); - } - return $result; - } - - /** - * Display any database errors encountered - */ - function haltmsg($msg) { - printf("Database error: %s
\n", $msg); - printf("SQL Error: %s (%s)
\n",$this->Errno, $this->Error); - } -} - -/** - * class Owl_Session - * - * This class is used for opening and closing sessions - * - * @version v 1.1.1.1 2002/12/04 - * @author michael - * @package Owl -*/ -class Owl_Session { - var $sessid; - var $sessuid; - var $sessdata; - -//------------------------------------------------------------ -/** - * Function Open_Session($sessid=0, $sessuid=0) - * - * Opens a session - * - * @param $sessid - * The Session id - * @param ssessuid - * The user session id - * @return $this - * Return the session - * -*/ -//------------------------------------------------------------ -// Usable - function Open_Session($sessid=0, $sessuid=0) { - global $default; - $this->sessid = $sessid; - $this->sessuid = $sessuid; - - // if there is no user loged in, then create a session for them - if($sessid == "0") - { - $current = time(); - $random = $this->sessuid . $current; - $this->sessid = md5($random); - $sql = new Owl_DB; - - if(getenv("HTTP_CLIENT_IP")) - { - $ip = getenv("HTTP_CLIENT_IP"); - } - elseif(getenv("HTTP_X_FORWARDED_FOR")) - { - $forwardedip = getenv("HTTP_X_FORWARDED_FOR"); - list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip); - } - else - { - $ip = getenv("REMOTE_ADDR"); - } - //$result = $sql->query("insert into active_sessions values ('$this->sessid', '$this->sessuid', '$current', '$ip')"); - $result = $sql->query("insert into $default->owl_sessions_table values ('$this->sessid', '$this->sessuid', '$current', '$ip')"); - - if(!'result') - { - die("$lang_err_sess_write"); - } - } - - // else we have a session id, try to validate it... - $sql = new Owl_DB; - $sql->query("select * from $default->owl_sessions_table where sessid = '$this->sessid'"); - - // any matching session ids? - $numrows = $sql->num_rows($sql); - if(!$numrows) die("$lang_err_sess_notvalid"); - - // return if we are a.o.k. - while($sql->next_record()) { - $this->sessdata["sessid"] = $sql->f("sessid"); - } - return $this; - } -} - - -//------------------------------------------------------------ -/** - * Function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) - * - * Used to notify users - * - * @param $groupid - * The Id of the group - * @param $flag - * The relvant flag - * @param $filename - * The relevant filename - * @param $title - * The relevant title - * @param $desc - * The description - * @param $type - * the Relevant type - */ -//------------------------------------------------------------- -// Semi-Usable Some Interface based code -function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) -{ - global $default; - global $lang_notif_subject_new, $lang_notif_subject_upd, $lang_notif_msg; - global $lang_title, $lang_description; - $sql = new Owl_DB; -// BEGIN BUG 548994 - // get the fileid - $path = find_path($parent); - $sql->query("select id from $default->owl_files_table where filename='$filename' AND parent='$parent'"); - $sql->next_record(); - $fileid = $sql->f("id"); -// END BUG 548994 More Below - $sql->query("select distinct id, email,language,attachfile from $default->owl_users_table as u, $default->owl_users_grpmem_table as m where notify = 1 and (u.groupid = $groupid or m.groupid = $groupid)"); - - // loop through records - while($sql->next_record()) - { -// BEGIN BUG 548994 - // check authentication rights - if ( check_auth($fileid, "file_download", $sql->f(id)) == 1 ) - { -// END BUG 548994 More Below - $newpath = ereg_replace(" ","%20",$path); - $newfilename = ereg_replace(" ","%20",$filename); - $DefUserLang = $sql->f("language"); - require("$default->owl_fs_root/locale/$DefUserLang/language.inc"); - - $r=preg_split("(\;|\,)",$sql->f("email")); - reset ($r); - while (list ($occ, $email) = each ($r)) - { - $mail = new phpmailer(); - // Create a temporary session id, the user - // will need to get to this file before - // the default session timeout - $session = new Owl_Session; - $uid = $session->Open_Session(0,$sql->f("id")); - $tempsess = $uid->sessdata["sessid"]; - - // if flag set to 0 - if ( $flag == 0 ) { - $mail->IsSMTP(); // set mailer to use SMTP - $mail->Host = "$default->owl_email_server"; // specify main and backup server - $mail->From = "$default->owl_email_from"; - $mail->FromName = "$default->owl_email_fromname"; - $mail->AddAddress($email); - $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet"); - $mail->WordWrap = 50; // set word wrap to 50 characters - $mail->IsHTML(true); // set email format to HTML - $mail->Subject = "$lang_notif_subject_new"; - - // as long as its not a url - if ($type != "url") - { - // if attachfile is true - if ($sql->f("attachfile") == 1) - { - $mail->Body = "$lang_notif_msg

" . "$lang_title: $title" . "

$lang_description: $desc"; - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; - - // use file system - if (!$default->owl_use_fs) - { - //check if file exits - if (file_exists("$default->owl_FileDir/$filename")) - { - unlink("$default->owl_FileDir/$filename"); - } - $file = fopen("$default->owl_FileDir$filename", 'wb'); - $getfile = new Owl_DB; - $getfile->query("select data,compressed from $default->owl_files_data_table where id='$fileid'"); - while ($getfile->next_record()) - { - //check if compressed ..and uncompress it - if ($getfile->f("compressed")) { - - $tmpfile = $default->owl_FileDir . "owltmp.$fileid.gz"; - $uncomptmpfile = $default->owl_FileDir . "owltmp.$fileid"; - if (file_exists($tmpfile)) unlink($tmpfile); - - $fp=fopen($tmpfile,"w"); - fwrite($fp, $getfile->f("data")); - fclose($fp); - - system($default->gzip_path . " -df $tmpfile"); - - $fsize = filesize($uncomptmpfile); - $fd = fopen($uncomptmpfile, 'rb'); - $filedata = fread($fd, $fsize); - fclose($fd); - - fwrite($file, $filedata); - unlink($uncomptmpfile); - } - else - { // otherwise just write the file - fwrite($file, $getfile->f("data")); - } - } - fclose($file); - // add a mail attachment - $mail->AddAttachment("$default->owl_FileDir$newfilename"); - } else - { - $mail->AddAttachment("$default->owl_FileDir/$newpath/$newfilename"); - } - } - else - { // set up mail body - $mail->Body = "$lang_notif_msg

" . "$lang_title: $title" . "

URL: $default->owl_notify_link" . "browse.php?sess=$tempsess&parent=$parent&expand=1&fileid=$fileid" . "

$lang_description: $desc"; - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; - } - } - else - { - $mail->Body = "URL: $newfilename

$lang_notif_msg

" . "$lang_title: $title" . "

$lang_description: $desc"; - $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; - } - - } - else - // set up mailer - { - $mail = new phpmailer(); - $mail->IsSMTP(); // set mailer to use SMTP - $mail->Host = "$default->owl_email_server"; // specify main and backup server - $mail->From = "$default->owl_email_from"; - $mail->FromName = "$default->owl_email_fromname"; - $mail->AddAddress($email); - $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet"); - $mail->WordWrap = 50; // set word wrap to 50 characters - $mail->IsHTML(true); // set email format to HTML - $mail->Subject = "$lang_notif_subject_upd"; - - // if type not a url - if ($type != "url") - { - // if attachfile is true..go through process of attaching file..simarly to previous - if ($sql->f("attachfile") == 1) - { - $mail->Body = "$lang_notif_msg

" . "$lang_title: $title" . "

$lang_description: $desc"; - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; - if (!$default->owl_use_fs) - { - // check existence of file - if (file_exists("$default->owl_FileDir/$filename")) - { - unlink("$default->owl_FileDir/$filename"); - } - - $file = fopen("$default->owl_FileDir$filename", 'wb'); - $getfile = new Owl_DB; - $getfile->query("select data,compressed from $default->owl_files_data_table where id='$fileid'"); - - // get file check if compressed, if so uncompress - // otherwise write away - while ($getfile->next_record()) - { - if ($getfile->f("compressed")) { - - $tmpfile = $default->owl_FileDir . "owltmp.$fileid.gz"; - $uncomptmpfile = $default->owl_FileDir . "owltmp.$fileid"; - if (file_exists($tmpfile)) unlink($tmpfile); - - $fp=fopen($tmpfile,"w"); - fwrite($fp, $getfile->f("data")); - fclose($fp); - - system($default->gzip_path . " -df $tmpfile"); - - $fsize = filesize($uncomptmpfile); - $fd = fopen($uncomptmpfile, 'rb'); - $filedata = fread($fd, $fsize); - fclose($fd); - - fwrite($file, $filedata); - unlink($uncomptmpfile); - } - else - { - fwrite($file, $getfile->f("data")); - } - } - fclose($file); - $mail->AddAttachment("$default->owl_FileDir$newfilename"); - } - else - { - $mail->AddAttachment("$default->owl_FileDir/$newpath/$newfilename"); - } - - } - else - { - $mail->Body = "$lang_notif_msg

" . "$lang_title: $title" . "

URL: $default->owl_notify_link" . "browse.php?sess=$tempsess&parent=$parent&expand=1&fileid=$fileid" . "

$lang_description: $desc"; - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; - } - } - else - { - $mail->Body = "URL: $newfilename

$lang_notif_msg

" . "$lang_title: $title" . "

$lang_description: $desc"; - $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; - } - } - // send the email - $mail->Send(); - if (!$default->owl_use_fs && $sql->f("attachfile") == 1) - { - unlink("$default->owl_FileDir$newfilename"); - } - - } - } -// BEGIN BUG 548994 - } -// END BUG 548994 -} - -//------------------------------------------------------------ -/** - * Function verify_login($username, $password) - * - * Used to verify a users login name and password - * - * @param $username - * The username to verfiy - * @param $password - * The password to verify - */ -//------------------------------------------------------------- -// Usable -function verify_login($username, $password) -{ - global $default; - $sql = new Owl_DB; - $query = "select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'"; - $sql->query("select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'"); - $numrows = $sql->num_rows($sql); - // Bozz Begin added Password Encryption above, but for now - // I will allow admin to use non crypted password untile he - // upgrades all users - if ($numrows == "1") - { - while($sql->next_record()) { - if ( $sql->f("disabled") == 1 ) - $verified["bit"] = 2; - else - $verified["bit"] = 1; - $verified["user"] = $sql->f("username"); - $verified["uid"] = $sql->f("id"); - $verified["group"] = $sql->f("groupid"); - $maxsessions = $sql->f("maxsessions") + 1; - } - } - // Remove this else in a future version - else { - // username admin check password - if ($username == "admin") - { - $sql->query("select * from $default->owl_users_table where username = '$username' and password = '$password'"); - $numrows = $sql->num_rows($sql); - if ($numrows == "1") - { - while($sql->next_record()) - { - $verified["bit"] = 1; - $verified["user"] = $sql->f("username"); - $verified["uid"] = $sql->f("id"); - $verified["group"] = $sql->f("groupid"); - $maxsessions = $sql->f("maxsessions") + 1; - } - } - } - } - - // remove stale sessions from the database for the user - // that is signing on. - // - $time = time() - $default->owl_timeout; - $sql = new Owl_DB; - $sql->query("delete from $default->owl_sessions_table where uid = '".$verified["uid"]."' and lastused <= $time "); - // Check if Maxsessions has been reached - // - - $sql = new Owl_DB; - $sql->query("select * from $default->owl_sessions_table where uid = '".$verified["uid"]."'"); - - if ($sql->num_rows($sql) >= $maxsessions && $verified["bit"] != 0) { - if ( $verified["group"] == 0) - $verified["bit"] = 1; - else - $verified["bit"] = 3; - } - return $verified; -} - -//------------------------------------------------------------ -/** - * Function verify_session($username, $password) - * - * Used to verify a users session - * - * @param $username - * The username to check - * @param $password - * The password to check - */ -//------------------------------------------------------------- -// Usable - -function verify_session($sess) { - getprefs(); - global $default, $lang_sesstimeout, $lang_sessinuse, $lang_clicklogin; - $sess = ltrim($sess); - $verified["bit"] = 0; - - $sql = new Owl_DB; - $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'"); - $numrows = $sql->num_rows($sql); - $time = time(); - - if ($numrows == "1") - { - while($sql->next_record()) - { - if(getenv("HTTP_CLIENT_IP")) - { - $ip = getenv("HTTP_CLIENT_IP"); - } - elseif(getenv("HTTP_X_FORWARDED_FOR")) - { - $forwardedip = getenv("HTTP_X_FORWARDED_FOR"); - list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip); - } - else - { - $ip = getenv("REMOTE_ADDR"); - } - if ($ip == $sql->f("ip")) - { - // if timeout not exceeded - if(($time - $sql->f("lastused")) <= $default->owl_timeout) - { - $verified["bit"] = 1; - $verified["userid"] = $sql->f("uid"); - $sql->query("select * from $default->owl_users_table where id = '".$verified["userid"]."'"); - while($sql->next_record()) $verified["groupid"] = $sql->f("groupid"); - } - else - { - // Bozz Bug Fix begin - if (file_exists("./lib/header.inc")) - { - include("./lib/header.inc"); - } else { - include("../lib/header.inc"); - } - // Bozz Buf Fix End - print("

".$lang_sesstimeout); - if ($parent == "" || $fileid == "") - print(""); - else - print(""); - exit(); - } - } else { - // Bozz Bug Fix begin - if (file_exists("./lib/header.inc")) { - include("./lib/header.inc"); - } else { - include("../lib/header.inc"); - } - // Bozz Bug Fix End - print("

".$lang_sessinuse); - exit; - } - } - } - return $verified; -} - -//------------------------------------------------------------ -/** - * Function fid_to_name($parent) - * - * used to get the folder name - * - * @param $parent - * The parent id - * @return $sql->f("name"); - * Return the name of the folder -*/ -//------------------------------------------------------------- -// Usable -function fid_to_name($parent) -{ - global $default; - $sql = new Owl_DB; - $sql->query("select name from $default->owl_folders_table where id = $parent"); - while($sql->next_record()) - { - return $sql->f("name"); - } -} - -//------------------------------------------------------------ -/** - * Function flid_to_name($id) - * - * Gets the filename corresponding to the file id - * - * @param $id - * The file id - * @return $sql->f("name"); - * Return the name of the file -*/ -//------------------------------------------------------------- -// Usable -function flid_to_name($id) -{ - global $default; - $sql = new Owl_DB; - $sql->query("select name from $default->owl_files_table where id = $id"); - while($sql->next_record()) - { - return $sql->f("name"); - } -} - -//------------------------------------------------------------ -/** - * Function fid_to_filename($id) - * - * gets filename based on id - * - * @param $id - * file id - * @return $sql->f("name"); - * Return the name of the file -*/ -//------------------------------------------------------------- -// Usable -function flid_to_filename($id) { - global $default; - $sql = new Owl_DB; - $sql->query("select filename from $default->owl_files_table where id = $id"); - while($sql->next_record()) - { - return $sql->f("filename"); - } -} -//------------------------------------------------------------ -/** - * Function owlusergroup($userid) - * - * Gets the group id that the user blongs to - * - * @param $userid - * The user id - * @return $groupid - * Return the groupId -*/ -//------------------------------------------------------------- -// Usable -function owlusergroup($userid) -{ - global $default; - $sql = new Owl_DB; - $sql->query("select group_id from $default->owl_users_table where id = '$userid'"); - while($sql->next_record()) - { - $groupid = $sql->f("group_id"); - return $groupid; - } -} -//------------------------------------------------------------ -/** - * Function owlfilecreator($fileid) - * - * used to find the file creator - * - * @param $fileid - * The parent id - * @return $filecreator - * Return the creatorid of the file -*/ -//------------------------------------------------------------- -// Usable -function owlfilecreator($fileid) { - global $default; - $sql = new Owl_DB; - $sql->query("select creatorid from ".$default->owl_files_table." where id = '$fileid'"); - while($sql->next_record()) - { - $filecreator = $sql->f("creatorid"); - return $filecreator; - } -} -//------------------------------------------------------------ -/** - * Function owlfoldercreator($fileid) { - * - * Used to get the folder creator - * - * @param $fileid - * The file id - * @return $foldercreator - * Return the creatorid of the folder -*/ -//------------------------------------------------------------- -// Usable -function owlfoldercreator($folderid) -{ - global $default; - $sql = new Owl_DB; - $sql->query("select creatorid from ".$default->owl_folders_table." where id = '$folderid'"); - while($sql->next_record()) - { - $foldercreator = $sql->f("creatorid"); - return $foldercreator; - } -} -//------------------------------------------------------------- -/** - * Function owlfilegroup($fileid) - * - * Used to get the file group id - * - * @param $fileid - * The file id - * @return $filegroup; - * Returns the group id of the file group -*/ -//------------------------------------------------------------- -// Usable -function owlfilegroup($fileid) - { - global $default; - $sql = new Owl_DB; - $sql->query("select groupid from $default->owl_files_table where id = '$fileid'"); - while($sql->next_record()) - { - $filegroup = $sql->f("groupid"); - return $filegroup; - } - -} -//------------------------------------------------------------- -/** - * Function owlfoldergroup($folderid) - * - * Used to get the folder group id - * - * @param $folderid - * The folder id - * @return $foldergroup; - * Returns the group id of the folder group -*/ -//------------------------------------------------------------- -// Usable -function owlfoldergroup($folderid) { - global $default; - $sql = new Owl_DB; - $sql->query("select groupid from $default->owl_folders_table where id = '$folderid'"); - while($sql->next_record()) - { - $foldergroup = $sql->f("groupid"); - return $foldergroup; - } - -} -//------------------------------------------------------------- -/** - * Function owlfolderparent($folderid) - * - * Used to get the folder parent - * - * @param $folderid - * The folder id - * @return $folderparent - * Returns the folderparent of from the folder -*/ -//------------------------------------------------------------- -// Usable -function owlfolderparent($folderid) - { - global $default; - $sql = new Owl_DB; - $sql->query("select parent from $default->owl_folders_table where id = '$folderid'"); - while($sql->next_record()) - { - $folderparent = $sql->f("parent"); - return $folderparent; - } - -} -//------------------------------------------------------------- -/** - * Function owlfileparent($fileid) - * - * Used to get the file parent - * - * @param $fileid - * The file id - * @return $fileparent - * Returns the file parent of from the files -*/ -//------------------------------------------------------------- -// Usable -function owlfileparent($fileid) -{ - global $default; - $sql = new Owl_DB; $sql->query("select parent from $default->owl_files_table where id = '$fileid'"); - while($sql->next_record()) - { - $fileparent = $sql->f("parent"); - - return $fileparent; - } -} -//------------------------------------------------------------ -/** - * Function fid_to_creator($id) - * - * Used to get the creator of the files - * - * @param $id - * The id - * @return $name; - * Return the name of the creator -*/ -//------------------------------------------------------------- -// Usable -function fid_to_creator($id) { - - global $default; - $sql = new Owl_DB; - $sql->query("select creatorid from ".$default->owl_files_table." where id = '$id'"); - $sql2 = new Owl_DB; - while($sql->next_record()) - { - $creatorid = $sql->f("creatorid"); - $sql2->query("select name from $default->owl_users_table where id = '".$creatorid."'"); - $sql2->next_record(); - $name = $sql2->f("name"); - } - return $name; -} -//------------------------------------------------------------ -/** - * Function group_to_name($id) - * - * select name from the group - * - * @param $id - * The id - * @return $sql->f("name"); - * Return the name of the group -*/ -//------------------------------------------------------------- -// Usable -function group_to_name($id) -{ - global $default; - $sql = new Owl_DB; - $sql->query("select name from $default->owl_groups_table where id = '$id'"); - while($sql->next_record()) - { - return $sql->f("name"); - } -} - - -//------------------------------------------------------------ -/** - * Function uid_to_name($id) - * - * name from the users - * - * @param $id - * The id - * @return $name - * Return the name of the user -*/ -//------------------------------------------------------------- -// Usable -function uid_to_name($id) -{ - global $default; - $sql = new Owl_DB; - $sql->query("select name from $default->owl_users_table where id = '$id'"); - while($sql->next_record()) - { - $name = $sql->f("name"); - if ($name == "") - { - $name = "Owl"; - } - return $name; - } -} -//------------------------------------------------------------ -/** - * Function prefaccess($id) - * - * get the noprefaccess from the users to compare if access granted - * - * @param $id - * The id - * @return prefaccess; - * Return the name of the folder -*/ -//------------------------------------------------------------- -// Usable - -function prefaccess($id) { - global $default; - $prefaccess = 1; - $sql = new Owl_DB; $sql->query("select noprefaccess from $default->owl_users_table where id = '$id'"); - while($sql->next_record()) - { - $prefaccess = !($sql->f("noprefaccess")); - return $prefaccess; - } -} -//------------------------------------------------------------ -/** - * Function gen_navbar($parent) - * - * Used to generate a nav bar - * - * @param $parent - * The parent id - * @return $Navbar - * Return the navbar that has been generated -*/ -//------------------------------------------------------------- -// NOT Usable -> Interface based -function gen_navbar($parent) -{ - global $default; - global $sess, $expand, $sort, $sortorder, $order; - $name = fid_to_name($parent); - $navbar = "$name"; - $new = $parent; - while ($new != "1") - { - $sql = new Owl_DB; $sql->query("select parent from $default->owl_folders_table where id = '$new'"); - while($sql->next_record()) $newparentid = $sql->f("parent"); - $name = fid_to_name($newparentid); - $navbar = "$name/" . $navbar; - $new = $newparentid; - } - return $navbar; -} -//------------------------------------------------------------ -/** - * Function get_dirpath($parent) - * - * Get the directory path from the db - * - * @param $parent - * The parent id - * @return $Navbar; - * Return the navbar with directory path -*/ -//------------------------------------------------------------- -// NOT Usable if used in ocnjunction with navbar -//only get dir path from db -function get_dirpath($parent) { - global $default; - global $sess, $expand; - $name = fid_to_name($parent); - $navbar = "$name"; - $new = $parent; - while ($new != "1") { - $sql = new Owl_DB; $sql->query("select parent from $default->owl_folders_table where id = '$new'"); - while($sql->next_record()) $newparentid = $sql->f("parent"); - $name = fid_to_name($newparentid); - $navbar = "$name/" . $navbar; - $new = $newparentid; - } - return $navbar; -} - -//------------------------------------------------------------ -/** - * Function gen_filesze($filesize) - * - * generates the file size - * - * @param $filesize - * The size of the file - * @return $file_size; - * Return the rounded off file size -*/ -//------------------------------------------------------------- -// Usable -function gen_filesize($file_size) -{ - if(ereg("[^0-9]", $file_size)) - { - return $file_size; - } - - if ($file_size >= 1073741824) - { - $file_size = round($file_size / 1073741824 * 100) / 100 . "g"; - } - elseif ($file_size >= 1048576) - { - $file_size = round($file_size / 1048576 * 100) / 100 . "m"; - } - elseif ($file_size >= 1024) - { - $file_size = round($file_size / 1024 * 100) / 100 . "k"; - } - else - { - $file_size = $file_size . "b"; - } - return $file_size; -} -//------------------------------------------------------------ -/** - * Function unloadCompat($varname) - * - * used to upload - * - * @param $varname - * The parent id - * @return $sql->f("name"); - * Return the name of the folder -*/ -//------------------------------------------------------------- -// Usable -function uploadCompat($varname) { - - if ($_FILES[$varname]) return $_FILES[$varname]; - if ($HTTP_POST_FILES[$varname]) return $HTTP_POST_FILES[$varname]; - $tmp = "$varname_name"; global $$tmp; $retfile['name'] = $$tmp; - $tmp = "$varname_type"; global $$tmp; $retfile['type'] = $$tmp; - $tmp = "$varname_size"; global $$tmp; $retfile['size'] = $$tmp; - $tmp = "$varname_error"; global $$tmp; $retfile['error'] = $$tmp; - $tmp = "$varname_tmp_name"; global $$tmp; $retfile['tmp_name'] = $$tmp; - return $retfile; -} - -//------------------------------------------------------------ -/** - * Function checkrequirements() - * - * Used to check requirments - * - * @return 1 - * Returns 1 -*/ -//------------------------------------------------------------- -// Usable -function checkrequirements() -{ - global $default, $lang_err_bad_version_1, $lang_err_bad_version_2, $lang_err_bad_version_3; - - if (substr(phpversion(),0,5) < $default->phpversion) - { - print("

$lang_err_bad_version_1
"); - print("$default->phpversion
"); - print("$lang_err_bad_version_2
"); - print phpversion(); - print("
$lang_err_bad_version_3

"); - return 1; - } - else - { - return 0; - } -} -//------------------------------------------------------------ -/** - * Function myExec($cmd, &$lines, &$errco) - * - * - * - * @param $cmd - * The command - * @param $lines - * - * @param $errco - * The error code - * @return ""; - * Return empty string - * @return $lines[count($lines)-1] - * Returns numba of lines -*/ -//------------------------------------------------------------- -// Usable -function myExec($_cmd, &$lines, &$errco) -{ - $cmd = "$_cmd ; echo $?"; - exec($cmd, $lines); - // Get rid of the last errco line... - $errco = (integer) array_pop($lines); - if (count($lines) == 0) - { - return ""; - } - else - { - return $lines[count($lines) - 1]; - } -} -//------------------------------------------------------------ -/** - * Function my_delete($file) - * - * used to delete a file if it exists - * - * @param $file - * The file to be deleted -*/ -//------------------------------------------------------------- -// Usable -function myDelete($file) { - if (file_exists($file)) - { - chmod($file,0777); - if (is_dir($file)) - { - $handle = opendir($file); - while($filename = readdir($handle)) - { - if ($filename != "." && $filename != "..") - { - myDelete($file."/".$filename); - } - } - closedir($handle); - rmdir($file); - } - else - { - unlink($file); - } - } -} -//------------------------------------------------------------ -/** - * Function printError($message, $submessage) - * - * Prints out error messages - * - * @param $message - * The message - * @param $submessage - * The submessage -*/ -//------------------------------------------------------------- -// Not Usable -> INTERFACE Based -function printError($message, $submessage) { - global $default; - global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid; - global $language; - - require("$default->owl_fs_root/locale/$default->owl_lang/language.inc"); - include("./lib/header.inc"); - - if(check_auth($parent, "folder_view", $userid) != "1") { - $sql = new Owl_DB; - $sql->query("select * from $default->owl_folders_table where id = '$parent'"); - $sql->next_record(); - $parent = $sql->f("parent"); - } - - echo("table_expand_width BGCOLOR=\"#d0d0d0\" CELLSPACING=0 CELLPADDING=0 BORDER=0 HEIGHT=30>"); - echo(""); - print("
"); - print("$lang_user: "); - print(""); - print uid_to_name($userid); - print (""); - print(" $lang_logout"); - print(""); - print("


"); - print $message; - print("
"); - print $submessage; - include("./lib/footer.inc"); - exit(); -} -//------------------------------------------------------------ -/** - * Function getprefs() - * - * gets all the preferences - * -*/ -//------------------------------------------------------------- -// Usable -function getprefs ( ) -{ - global $default; - - $sql = new Owl_DB; - $sql->query("select * from $default->owl_prefs_table"); - $sql->next_record(); - - $default->owl_email_from = $sql->f("email_from"); - $default->owl_email_fromname = $sql->f("email_fromname"); - $default->owl_email_replyto = $sql->f("email_replyto"); - $default->owl_email_server = $sql->f("email_server"); - $default->owl_LookAtHD = $sql->f("lookathd"); - $default->owl_def_file_security = $sql->f("def_file_security"); - $default->owl_def_file_group_owner= $sql->f("def_file_group_owner"); - $default->owl_def_file_owner = $sql->f("def_file_owner"); - $default->owl_def_file_title = $sql->f("def_file_title"); - $default->owl_def_file_meta = $sql->f("def_file_meta"); - $default->owl_def_fold_security = $sql->f("def_fold_security"); - $default->owl_def_fold_group_owner= $sql->f("def_fold_group_owner"); - $default->owl_def_fold_owner = $sql->f("def_fold_owner"); - $default->max_filesize = $sql->f("max_filesize"); - $default->owl_timeout = $sql->f("timeout"); - $default->expand = $sql->f("expand"); - $default->owl_version_control = $sql->f("version_control"); - $default->restrict_view = $sql->f("restrict_view"); - $default->dbdump_path = $sql->f("dbdump_path"); - $default->gzip_path = $sql->f("gzip_path"); - $default->tar_path = $sql->f("tar_path"); - - -}; - -//------------------------------------------------------------ -/** - * Function gethtmlprefs() - * - * get html preferences - * -*/ -//------------------------------------------------------------- -// Usable - -function gethtmlprefs ( ) -{ - global $default; - - $sql = new Owl_DB; - $sql->query("select * from $default->owl_html_table"); - $sql->next_record(); - - $default->table_border = $sql->f("table_border"); - $default->table_header_bg = $sql->f("table_header_bg"); - $default->table_cell_bg = $sql->f("table_cell_bg"); - $default->table_cell_bg_alt = $sql->f("table_cell_bg_alt"); - $default->table_expand_width = $sql->f("table_expand_width"); - $default->table_collapse_width = $sql->f("table_collapse_width"); - $default->main_header_bgcolor = $sql->f("main_header_bgcolor"); - $default->body_bgcolor = $sql->f("body_bgcolor"); - $default->body_textcolor = $sql->f("body_textcolor"); - $default->body_link = $sql->f("body_link"); - $default->body_vlink = $sql->f("body_vlink"); - -}; -//------------------------------------------------------------ -/** - * Function printfileperm($currentval, $namevariable, $printmessage, $type) - * - * Print file permissions - * - * @param $currentval - * The current value - * @param $namevariable - * The name of the file - * @param $pringmessage - * The message to be printed - * @param $type - * The type of file -*/ -//------------------------------------------------------------- -// SEMI-Usable Interface based -function printfileperm($currentval, $namevariable, $printmessage, $type) { - global $default; - global $lang_everyoneread, $lang_everyonewrite, $lang_everyonewrite_nod, $lang_groupread, $lang_groupwrite, $lang_groupwrite_nod, $lang_groupwrite_worldread, $lang_groupwrite_worldread_nod, $lang_onlyyou; - global $lang_everyoneread_ad, $lang_everyonewrite_ad, $lang_everyonewrite_ad_nod, $lang_groupread_ad, $lang_groupwrite_ad, $lang_groupwrite_ad_nod, $lang_groupwrite_worldread_ad, $lang_groupwrite_worldread_ad_nod, $lang_onlyyou_ad; - - - $file_perm[0][0] = 0; - $file_perm[1][0] = 1; - $file_perm[2][0] = 2; - $file_perm[3][0] = 3; - $file_perm[4][0] = 4; - $file_perm[5][0] = 5; - $file_perm[6][0] = 6; - $file_perm[7][0] = 7; - $file_perm[8][0] = 8; - - // show admin permissions - if ($type == "admin") - { - $file_perm[0][1] = "$lang_everyoneread_ad"; - $file_perm[1][1] = "$lang_everyonewrite_ad"; - $file_perm[2][1] = "$lang_groupread_ad"; - $file_perm[3][1] = "$lang_groupwrite_ad"; - $file_perm[4][1] = "$lang_onlyyou_ad"; - $file_perm[5][1] = "$lang_groupwrite_ad_nod"; - $file_perm[6][1] = "$lang_everyonewrite_ad_nod"; - $file_perm[7][1] = "$lang_groupwrite_worldread_ad"; - $file_perm[8][1] = "$lang_groupwrite_worldread_ad_nod"; - } - else {// otherwise show other permissions - $file_perm[0][1] = "$lang_everyoneread"; - $file_perm[1][1] = "$lang_everyonewrite"; - $file_perm[2][1] = "$lang_groupread"; - $file_perm[3][1] = "$lang_groupwrite"; - $file_perm[4][1] = "$lang_onlyyou"; - $file_perm[5][1] = "$lang_groupwrite_nod"; - $file_perm[6][1] = "$lang_everyonewrite_nod"; - $file_perm[7][1] = "$lang_groupwrite_worldread"; - $file_perm[8][1] = "$lang_groupwrite_worldread_nod"; - } - - print("table_header_bg>$printmessage"); - - -}; -//------------------------------------------------------------ -/** - * Function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) - * - *prints the file icons - * - * @param $fid - * The folder id - * @param $filename - * The name of the file - * @param $check_out - * checkout status - * @param $url - * The relevant url - * @param $allicons - * - * @param $ext - * The extension of the file - * @return $sql->f("name"); - * Return the name of the folder -*/ -//------------------------------------------------------------- -// NOT Usable INTERFACE based -function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) -{ - global $default; - global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid; - global $lang_log_file, $lang_reallydelete, $lang_del_file_alt, $lang_mod_file_alt; - global $lang_move_file_alt,$lang_upd_file_alt,$lang_get_file_alt,$lang_lock_file,$lang_email_alt,$lang_view_file_alt; - - if ($allicons == 1) - { - if ($url != "1") - print("$lang_log_file"); - } - - if (($checked_out == 0) || ($checked_out == $userid)) { - // ***************************************************************************** - // Don't Show the delete icon if the user doesn't have delete access to the file - // ***************************************************************************** - - if (check_auth($fid, "file_delete", $userid) == 1) - if ($url == "1") - print("\t$lang_del_file_alt"); - else - print("\t$lang_del_file_alt"); - - // ***************************************************************************** - // Don't Show the modify icon if the user doesn't have modify access to the file - // ***************************************************************************** - - if(check_auth($fid, "file_modify", $userid) == 1) - print("$lang_mod_file_alt"); - - // ***************************************************************************** - // Don't Show the move modify icon if the user doesn't have move access to the file - // ***************************************************************************** - - if(check_auth($fid, "file_modify", $userid) == 1) - if ($url == "1") - print("$lang_move_file_alt"); - else - print("$lang_move_file_alt"); - // ***************************************************************************** - // Don't Show the file update icon if the user doesn't have update access to the file - // ***************************************************************************** - - if(check_auth($fid, "file_modify", $userid) == 1) - if ($url != "1") - print("$lang_upd_file_alt"); - - // ***************************************************************************** - // Don't Show the file dowload icon if the user doesn't have download access to the file - // ***************************************************************************** - - if(check_auth($fid, "file_download", $userid) == 1) - if ($url != "1") - print("$lang_get_file_alt"); - - if ($allicons == 1) - { - // ***************************************************************************** - // Don't Show the lock icon if the user doesn't have access to the file - // ***************************************************************************** - if(check_auth($fid, "file_modify", $userid) == 1) - if ($url != "1") - print("$lang_lock_file"); - } - - // ***************************************************************************** - // Don't Show the email icon if the user doesn't have access to email the file - // ***************************************************************************** - - if(check_auth($fid, "file_modify", $userid) == 1) - if ($url == "1") - print("$lang_email_alt"); - else - print("$lang_email_alt"); - - // ***************************************************************************** - // Don't Show the view icon if the user doesn't have download access to the file - // ***************************************************************************** - - if(check_auth($fid, "file_download", $userid) == 1) - if ($url != "1") { - $imgfiles = array("jpg","gif"); - if ($ext != "" && preg_grep("/$ext/", $imgfiles)) { - print(" $lang_view_file_alt"); - } - $htmlfiles = array("html","htm",xml); - if ($ext != "" && preg_grep("/$ext/", $htmlfiles)) { - print(" $lang_view_file_alt"); - } - $txtfiles = array("txt","text","README", "readme", "sh", "c", "cpp", "php", "php3", "pl", "perl", "sql", "py"); - if ($ext != "" && preg_grep("/$ext/", $txtfiles)) { - print(" $lang_view_file_alt"); - } - if (substr(php_uname(), 0, 7) != "Windows") { - $zipfiles = array("tar.gz", "tgz", "tar", "gz"); - if ($ext != "" && preg_grep("/$ext/", $zipfiles)) - print(" $lang_view_file_alt"); - } - } - } -}; - -//------------------------------------------------------------ -/** - * Function printgroupperm($currentval, $namevariable, $printmessage, $type) - * - * Prints group permissions - * - * @param $currentval - * The current value - * @param $namevariable - * The name of the group - * @param $printmessage - * The message to be printed - * @param $type - * The type of group -*/ -//------------------------------------------------------------- -// NOT Usable INTERFACE based -function printgroupperm($currentval, $namevariable, $printmessage, $type) { - global $default; - global $lang_geveryoneread, $lang_geveryonewrite, $lang_geveryonewrite_nod, $lang_ggroupread, $lang_ggroupwrite, $lang_ggroupwrite_nod, $lang_ggroupwrite_worldread, $lang_ggroupwrite_worldread_nod, $lang_gonlyyou; - global $lang_geveryoneread_ad, $lang_geveryonewrite_ad, $lang_geveryonewrite_ad_nod, $lang_ggroupread_ad, $lang_ggroupwrite_ad, $lang_ggroupwrite_ad_nod, $lang_ggroupwrite_worldread_ad, $lang_ggroupwrite_worldread_ad_nod, $lang_gonlyyou_ad; - - - $group_perm[0][0] = 50; - $group_perm[1][0] = 51; - $group_perm[2][0] = 52; - $group_perm[3][0] = 53; - $group_perm[4][0] = 54; - $group_perm[5][0] = 55; - $group_perm[6][0] = 56; - $group_perm[7][0] = 57; - $group_perm[8][0] = 58; - if ($type == "admin") - { - $group_perm[0][1] = "$lang_geveryoneread_ad"; - $group_perm[1][1] = "$lang_geveryonewrite_ad"; - $group_perm[2][1] = "$lang_ggroupread_ad"; - $group_perm[3][1] = "$lang_ggroupwrite_ad"; - $group_perm[4][1] = "$lang_gonlyyou_ad"; - $group_perm[5][1] = "$lang_ggroupwrite_ad_nod"; - $group_perm[6][1] = "$lang_geveryonewrite_ad_nod"; - $group_perm[7][1] = "$lang_ggroupwrite_worldread_ad"; - $group_perm[8][1] = "$lang_ggroupwrite_worldread_ad_nod"; - - } - else - { - $group_perm[0][1] = "$lang_geveryoneread"; - $group_perm[1][1] = "$lang_geveryonewrite"; - $group_perm[2][1] = "$lang_ggroupread"; - $group_perm[3][1] = "$lang_ggroupwrite"; - $group_perm[4][1] = "$lang_gonlyyou"; - $group_perm[5][1] = "$lang_ggroupwrite_nod"; - $group_perm[6][1] = "$lang_geveryonewrite_nod"; - $group_perm[7][1] = "$lang_ggroupwrite_worldread"; - $group_perm[8][1] = "$lang_ggroupwrite_worldread_nod"; - } - - print("table_header_bg>$printmessage"); - -}; - -// ---------------------- -// page start -// ---------------------- - -/** - * Initialises the web application by making current - * request parameters global, performing session checking - * and loading the default language - */ -// make request parameters global - -if (substr(phpversion(),0,5) >= "4.1.0") { - // if supported by the installed version of PHP - import_request_variables('pgc'); -} else { - // do it manually - if (!EMPTY($_POST)) { - extract($_POST); - } else { - extract($HTTP_POST_VARS); - } - - if (!EMPTY($_GET)) { - extract($_GET); - } else { - extract($HTTP_GET_VARS); - } - - if (!EMPTY($_FILE)) { - extract($_FILE); - } else { - extract($HTTP_POST_FILES); - } -} - -/* -// initialise session var -if(!isset($sess)) { - $sess = 0; -} -// initialise loginname -if(!isset($loginname)) { - $loginname = 0; -} -// initialise login var -if(!isset($login)) { - $login = 0; -} -*/ - -// set default language -if(isset($default->owl_lang)) { - - $langdir = "$default->owl_fs_root/locale/$default->owl_lang"; - - if(is_dir("$langdir") != 1) { - die("$lang_err_lang_1 $langdir $lang_err_lang_2"); - } else { - - $sql = new Owl_DB; - $sql->query("select * from $default->owl_sessions_table where id = '$sess'"); - $sql->next_record(); - $numrows = $sql->num_rows($sql); - $getuid = $sql->f("uid"); - if($numrows == 1) { - $sql->query("select * from $default->owl_users_table where id = $getuid"); - $sql->next_record(); - $language = $sql->f("language"); - // BEGIN wes fix - if(!$language) { - $language = $default->owl_lang; - } - // END wes fix - require("$default->owl_fs_root/locale/$language/language.inc"); - $default->owl_lang = $language; - } else { - require("$default->owl_fs_root/locale/$default->owl_lang/language.inc"); - } - } -} else { - die("$lang_err_lang_notfound"); -} -/* -if ($sess) { - gethtmlprefs(); - $ok = verify_session($sess); - $temporary_ok = $ok["bit"]; - $userid = $ok["userid"]; - $usergroupid = $ok["groupid"]; - - if ($ok["bit"] != "1") { - // Bozz Bug Fix begin - if (file_exists("./lib/header.inc")) { - include("./lib/header.inc"); - } else { - include("../lib/header.inc"); - } - // Bozz Bug Fix end - print("

".$lang_invalidsess); - if ($parent == "" || $fileid == "") { - print(""); - } else { - print(""); - } - exit; - } else { - $lastused = time(); - $sql = new Owl_DB; - $sql->query("update $default->owl_sessions_table set lastused = '$lastused' where uid = '$userid'"); - } -} - -if (!$sess && !$loginname && !$login) { - if(!isset($fileid)) { - header("Location: " . $default->owl_root_url . "/index.php?login=1"); - } else { - header("Location: " . $default->owl_root_url . "/index.php?login=1&fileid=$fileid&parent=$parent"); - } -} -*/ -?> diff --git a/lib/readhd.php b/lib/readhd.php deleted file mode 100755 index e79d350..0000000 --- a/lib/readhd.php +++ /dev/null @@ -1,256 +0,0 @@ - ".") 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 - { - $FileCount++; - $Files[$FileCount] = $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 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; - } - - } -} - -//------------------------------------------------------------- -/** - * 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 - $TheFileTime2 = date("M d, Y \a\\t h:i a", filemtime($PathFile)); //get and fix time of last modifikation - - - $FileInfo[1] = $TheFileSize; - $FileInfo[2] = $TheFileTime; //s$modified - $FileInfo[3] = $TheFileTime2; //modified - - 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/Folders are found the page need to be refreshed in order to see them. - -// if array exists -if(is_array($F)) -{ - -// 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]) - { - 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; - } - } - } - -// 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 files-on-disc-but-not-in-db into the db. - - } - else - { - $RefreshPage = false; - } - - if($GetWhat == "folder") - { - $RefreshPage = true; - 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) - * - * 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 - - $SQL = "insert into $DBTable (name,parent,security,groupid,creatorid) values ('$TheFolder', '$parent', '$default->owl_def_fold_security', '$default->owl_def_fold_group_owner', '$default->owl_def_fold_owner')"; - - $sql->query($SQL); -} - - -//------------------------------------------------------------- -/** - * 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; - $sql = new Owl_DB; //create new db connection - - $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; - } - else - { - $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/lib/security.lib.php b/lib/security.lib.php deleted file mode 100755 index ed63adf..0000000 --- a/lib/security.lib.php +++ /dev/null @@ -1,426 +0,0 @@ - - - You should have received a copy of the GNU Public - License along with this package; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - -*/ - -/** -* Get the security policy for a specified folder -* -* @param id folder id -* -* @return int 1 = permission granted, 0 = permission denied -*/ -function getfolderpolicy($id) { - global $default; - $sql = new Owl_DB; $sql->query("select security from $default->owl_folders_table where id = '$id'"); - while ($sql->next_record()) return $sql->f("security"); -} - -/** -* Get the security policy for a specified file -* -* @param id file id -* -* @return int security policy -*/ -function getfilepolicy($id) { - global $default; - $sql = new Owl_DB; $sql->query("select security from $default->owl_files_table where id = '$id'"); - while ($sql->next_record()) return $sql->f("security"); -} - -/** -* This function is simple...it returns either a 1 or 0 -* If the authentication is good, it returns 1 -* If the authentication is bad, it returns 0 -* -* Policy key for FILES: -* -* 0 = World read -* 1 = World edit -* 2 = Group read -* 3 = Group edit -* 4 = Creator edit -* 5 = Group edit no delete -* 6 = World edit no delete -* 7 = Group edit, World read -* 8 = Group edit, World read - no delete -* -* Policy key for FOLDERS: -* -* 50 = Anyone can read -* 51 = Anyone can upload/create folders -* 56 = Anyone can upload/create folders but not delete -* 52 = Only the group can read -* 53 = Only the group can upload/create folders -* 55 = Only the group can upload/create folders but not delete; except the creator -* 54 = Only the creator can upload/create folders -* 57 = Only the group can upload/create folders but anyone can read -* 58 = Only the group can upload/create folders (no delete) but anyone can read -*/ - -function check_auth($id, $action, $userid) { - global $default; - $usergroup = owlusergroup($userid); - $filecreator = owlfilecreator($id); - $foldercreator = owlfoldercreator($id); - $filegroup = owlfilegroup($id); - $foldergroup = owlfoldergroup($id); - - if (($action == "folder_modify") || - ($action == "folder_view") || - ($action == "folder_delete") || - ($action == "folder_property")) { - $policy = getfolderpolicy($id); - } else { - $policy = getfilepolicy($id); - } - - //if policy is: world read - if ($policy == "0") { - //if the user want to delete/modify - if (($action == "file_delete") || ($action == "file_modify")) { - //if the user is not the file create - if ($userid != $filecreator) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } else { - $authorization = "1"; - } - } - //if the policy is: world edit - if ($policy == "1") { - $authorization = "1"; - } - //if the policy is: group read - if ($policy == "2") { - //if the user wants to delete/modify the file - if (($action == "file_delete") || ($action == "file_modify")) { - if ($userid != $filecreator) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } else { - // Bozz Change Begin - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'"); - //if the user is in the group - if ($filegroup == $usergroup || $sql->num_rows($sql) > 0) { - // Bozz Change End - $authorization = "1"; - } else { - $authorization = "0"; - } - } - - } - //if the policy is: group edit - if ($policy == "3") { - if (($action == "file_delete") || ($action == "file_modify") || ($action == "file_download")) { - // Bozz Change Begin - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'"); - // Bozz Change End - //if the user is not in the group - if ($usergroup != $filegroup && $sql->num_rows($sql) == 0) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } - } - //if the policy is: creator edit - if ($policy == "4") { - //if the user is the creator - if ($filecreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - //if the policy is: group edit no delete - if ($policy == "5") { - if (($action == "file_modify") || ($action == "file_download")) { - // Bozz Change Begin - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'"); - // Bozz Change End - //if the user is in the group - if ($usergroup != $filegroup && $sql->num_rows($sql) == 0) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } - if ($action == "file_delete") { - //if the user is the file creator - if ($filecreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - } - //if the policy is: world edit no delete - if ($policy == "6") { - $authorization = "1"; - if ($action == "file_delete") { - //if the user is the creator - if ($filecreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - } - //if the policy is: group edit world read - if ($policy == "7") { - if (($action == "file_delete") || ($action == "file_modify")) { - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'"); - //if the user is not in the group - if ($usergroup != $filegroup && $sql->num_rows($sql) == 0) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } - if ($action == "file_download") { - $authorization = "1"; - } - } - //if the policy is: group edit, world read, no delete - if ($policy == "8") { - if ($action == "file_modify") { - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'"); - //if the user is not in the group - if ($usergroup != $filegroup && $sql->num_rows($sql) == 0) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } - if ($action == "file_download") { - $authorization = "1"; - } - if ($action == "file_delete") { - //if the user is the creator - if ($filecreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - } - //if the policy is: anyone can read - if ($policy == "50") { - if (($action == "folder_delete") || - ($action == "folder_property") || - ($action == "folder_modify")) { - //if the user is not the creator - if ($userid != $foldercreator) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } else { - $authorization = "1"; - } - } - - //if the policy is: anyone can upload/create folders - if ($policy == "51") { - $authorization = "1"; - } - - //if the policy is: only the group can read folders - if ($policy == "52") { - if (($action == "folder_delete") || - ($action == "folder_property") || - ($action == "folder_modify")) { - if ($userid != $foldercreator) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } else { - // Bozz Change Begin - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'"); - if ($foldergroup == $usergroup || $sql->num_rows($sql) > 0) { - // Bozz Change End - $authorization = "1"; - } else { - $authorization = "0"; - } - } - - } - - //if the policy is: only the group can upload/create folders - if ($policy == "53") { - if (($action == "folder_delete") || - ($action == "folder_modify") || - ($action == "folder_property") || - ($action == "folder_view")) { - // Bozz Change Begin - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'"); - //if the user is not in the group - if ($usergroup != $foldergroup && $sql->num_rows($sql) == 0) { - // Bozz Change End - $authorization = "0"; - } else { - $authorization = "1"; - } - } - } - - //if the policy is: only the creator can upload/change files - if ($policy == "54") { - //if the user is the creator - if ($foldercreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - - //if the policy is: only the group can upload/create folders but not delete; except the creator - if ($policy == "55") { - if (($action == "folder_modify") || ($action == "folder_view")) { - // Bozz Change Begin - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'"); - if ($usergroup != $foldergroup && $sql->num_rows($sql) == 0) { - // Bozz Change End - $authorization = "0"; - } else { - $authorization = "1"; - } - } - if (($action == "folder_delete") || - ($action == "folder_property")) { - if ($foldercreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - } - //if the policy is: anyone can upload/create folders but not delete - if ($policy == "56") { - $authorization = "1"; - if (($action == "folder_delete") || - ($action == "folder_property")) { - //if the user is the creator - if ($foldercreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - } - - //if the policy is: only the group can upload/create folders but anyone can read - if ($policy == "57") { - if (($action == "folder_modify") || ($action == "folder_delete")) { - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'"); - //if the user is not in the group - if (($usergroup != $foldergroup) && ($sql->num_rows($sql) == 0)) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } - if ($action == "folder_property") { - //if the user is the creator - if ($foldercreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - if ($action == "folder_view") { - $authorization = "1"; - } - } - //if the policy is: only the group can upload/create folders (no delete) but anyone can read - if ($policy == "58") { - if ($action == "folder_modify") { - $sql = new Owl_DB; - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'"); - //if the user is not in the group - if ($usergroup != $foldergroup && $sql->num_rows($sql) == 0) { - $authorization = "0"; - } else { - $authorization = "1"; - } - } - if ($action == "folder_property") { - //if the user is the creator - if ($foldercreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - if ($action == "folder_delete") { - //if the user is the creator - if ($foldercreator == $userid) { - $authorization = "1"; - } else { - $authorization = "0"; - } - } - if ($action == "folder_view") { - $authorization = "1"; - } - } - -// Bozz Change Begin -// I Think that the Admin Group should -// have the same rights as the admin user - if ($userid == 1 || $usergroup == 0) { -// Bozz Change End - $authorization = "1"; - } -// cv change bug #504298 -// this call must be recursive through the parent directories - - // continue recursion? - if( $authorization == 1 ) { - if( ($policy > 49) && ($id == 1) ) { - // stop if we are at the doc root - return $authorization; - } else { - // continue; - if($policy < 50) { - $parent = owlfileparent($id); - } else { - $parent = owlfolderparent($id); - } - return check_auth($parent, "folder_view", $userid); - } - } else { - // dont continue because authorization is 0 - return $authorization; - } -} diff --git a/lib/styles.css b/lib/styles.css deleted file mode 100755 index 98d3f23..0000000 --- a/lib/styles.css +++ /dev/null @@ -1,79 +0,0 @@ -. { -font-size : 9pt; -font-family : Verdana, sans-serif; -font-weight : lighter; -font-style : normal; -color : #000000; -text-decoration: none; -} - -P { -font-size : 9pt; -font-family : Verdana, sans-serif; -font-weight : lighter; -font-style : normal; -color : #000000; -text-decoration: none; - - -} - -P.footer { -font-size : 9pt; -font-family : Verdana, sans-serif; -font-weight : lighter; -font-style : normal; -color : #999999; -text-decoration: none; - - -} - -P.title { -font-size : 9pt; -font-family : Verdana, sans-serif; -font-weight : inherit; -font-style : normal; -color : #ffffff; -text-decoration: none; -} - - -A { -font-size : 10pt; -font-family : Verdana, sans-serif; -font-style : normal; -color : #000000; -text-decoration: none; -} - - -A:Visited { -font-size : 10pt; -font-family : Verdana, sans-serif; -font-style : normal; -color : #000000; -text-decoration: none; -} - -A:Active { -color : #000000; -font-size : 10pt; -font-family : Verdana, sans-serif; -font-style : normal; -text-decoration: none; -} - -A:hover { -color : #000000; -font-size : 10pt; -font-family : Verdana,sans-serif; -font-style : normal; -text-decoration: none; -background-color : #FFFACD; -} - -INPUT:active { - font-size : 9pt; - font-family : Verdana,sans-serif; -} -- libgit2 0.21.4