Commit bb0ae76176433c2cfcbe32f5f5d8152ade7fcc3e

Authored by michael
1 parent 9a2c0ecb

removing owl sources


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1058 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/footer.inc deleted
1   -<?php
2   -
3   -/*
4   -
5   - File: footer.inc
6   - Author: Chris
7   - Date: 2000/12/14
8   -
9   - Owl: Copyright Chris Vincent <cvincent@project802.net>
10   -
11   - You should have received a copy of the GNU Public
12   - License along with this package; if not, write to the
13   - Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14   - Boston, MA 02111-1307, USA.
15   -
16   -*/
17   -
18   -if ($expand == "1") {
19   - echo "\t<HR ALIGN=CENTER WIDTH=$default->table_expand_width>";
20   -} else {
21   - echo "\t<HR ALIGN=CENTER WIDTH=$default->table_collapse_width>";
22   -}
23   -
24   -?>
25   -
26   -<?php
27   -// BUG Number: 457588
28   -// This is to display the version inforamation
29   -// BEGIN
30   -print("<BR>$lang_engine<BR>");
31   -print("Version: $default->version");
32   -// END
33   -?>
34   -<?php
35   -if (owlusergroup($userid) == 0) {
36   - print("<BR><A HREF='$default->owl_root_url/admin/index.php?sess=$sess'>$lang_admin</A><BR>");
37   -}
38   -print "<FORM ACTION='$default->owl_root_url/search.php' METHOD=POST><INPUT TYPE=TEXT NAME=query>
39   -<INPUT TYPE=HIDDEN NAME=sess VALUE=$sess><INPUT TYPE=HIDDEN NAME=parent VALUE=$parent>
40   -<INPUT TYPE=HIDDEN NAME=expand VALUE=$expand><INPUT TYPE=SUBMIT VALUE=$lang_search></FORM>";
41   -?>
42   -</BODY>
43   -</HTML>
44   -
lib/header.inc deleted
1   -<?php
2   -
3   -/*
4   -
5   - File: header.inc
6   - Author: Chris
7   - Date: 2000/12/14
8   -
9   - Owl: Copyright Chris Vincent <cvincent@project802.net>
10   -
11   - You should have received a copy of the GNU Public
12   - License along with this package; if not, write to the
13   - Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14   - Boston, MA 02111-1307, USA.
15   -
16   -*/
17   -
18   -?>
19   -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
20   - "http://www.w3.org/TR/REC-html40/loose.dtd">
21   -<HTML>
22   - <HEAD>
23   - <TITLE>Owl Intranet</TITLE>
24   -<LINK REL="stylesheet" TYPE="text/css" TITLE="style1" HREF="<?php echo($default->styles)?>">
25   - </HEAD>
26   -
27   - <BODY BGCOLOR="<?php echo($default->body_bgcolor) ?>"
28   - TEXT="<?php echo($default->body_textcolor) ?>"
29   - LINK="<?php echo($default->body_link) ?>"
30   - VLINK="<?php echo($default->body_vlink) ?>">
31   - <CENTER>
32   - <BR>
33   - <BR>
lib/owl.lib.php deleted
1   -<?php
2   -
3   -/**
4   - * $Id$
5   - *
6   - * Contains the major owl classes and functions.
7   - *
8   - * Copyright (c) 1999-2002 The Owl Project Team
9   - * Licensed under the GNU GPL. For full terms see the file COPYING.
10   - * @version $Revision$
11   - * @author michael
12   - * @package Owl
13   - */
14   -
15   -/**
16   - * class Owl_DB extends DB_Sql
17   - *
18   - * This class is used for DB connections
19   - *
20   - * @version v 1.1.1.1 2002/12/04
21   - * @author michael
22   - * @package Owl
23   - */
24   -
25   -class Owl_DB extends DB_Sql {
26   -
27   - /** Class name */
28   - var $classname = "Owl_DB";
29   -
30   - // BEGIN wes changes -- moved these settings to config/owl.php
31   - // Server where the database resides
32   -
33   - /** Host name. Retrieved from config/owl.php */
34   - var $Host = "";
35   - /** Database name */
36   - var $Database = "";
37   - /** Database user */
38   - var $User = "";
39   - /** Database user password */
40   - var $Password = "";
41   - /** Query to execute */
42   - var $sQuery;
43   - /** Name of table last query was executed on*/
44   - var $sLastTableName;
45   - /** Where clause last used in query execution */
46   - var $sLastWhereClause;
47   - /** Order by clause last used in query execution */
48   - var $sLastOrderByClause;
49   -
50   - /** Default Constructor */
51   - function Owl_DB() {
52   - global $default;
53   - $this->Host = $default->owl_db_host;
54   - $this->Database = $default->owl_db_name;
55   - $this->User = $default->owl_db_user;
56   - $this->Password = $default->owl_db_pass;
57   - }
58   - // END wes changes
59   -
60   - /**
61   - * Create a query from the provided paramaters. The ID column
62   - * is seleted by default
63   - *
64   - * @param $sTableName Table to query
65   - * @param $aColumns Columns in table
66   - * @param $sWhereClause Where clause (optional)
67   - * @param $sOrderByClause Order by clause (optional)
68   - */
69   - function createSQLQuery($sTableName, $aColumns, $sWhereClause = null, $sOrderByClause = null) {
70   - $this->sLastTableName = $sTableName;
71   - $this->sLastWhereCluase = $sWhereClause;
72   - $this->sLastOrderByClause = $sOrderByClause;
73   -
74   - $this->sQuery = "SELECT ID, ";
75   -
76   - for( $i = 0; $i < count($aColumns) - 1; $i++ ) {
77   - $this->sQuery = $this->sQuery . $aColumns[$i] . ",";
78   - }
79   -
80   - $this->sQuery .= $aColumns[count($aColumns) - 1] . " ";
81   - $this->sQuery .= "FROM " . $sTableName . " ";
82   -
83   - if (isset($sWhereClause)) {
84   - $this->sQuery .= "WHERE " . $sWhereClause . " ";
85   - }
86   -
87   - if (isset($sOrderByClause)) {
88   - $this->sQuery .= "ORDER BY " . $sOrderByClause . " ";
89   - }
90   -
91   - $this->query($this->sQuery);
92   -
93   - }
94   -
95   - /**
96   - Create a query from the provided paramaters, specifying a limit and an offset.
97   - The ID column is selected by default
98   -
99   - @param $sTableName Table to query
100   - @param $aColumns Columns in table
101   - @param $iOffset Offset
102   - @param $iLimit Limit
103   - @param $sWhereClause Where clause (optional)
104   - @param $sOrderByClause Order by clause (optional)
105   - */
106   -
107   - function createSQLQueryWithOffset($sTableName, $aColumns, $iOffset, $iLimit, $sWhereClause = null, $sOrderByClause = null) {
108   - $this->sLastTableName = $sTableName;
109   - $this->sLastWhereCluase = $sWhereClause;
110   - $this->sLastOrderByClause = $sOrderByClause;
111   -
112   - $this->sQuery = "SELECT ID, ";
113   -
114   - for( $i = 0; $i < count($aColumns) - 1; $i++ ) {
115   - $this->sQuery = $this->sQuery . $aColumns[$i] . ",";
116   - }
117   -
118   - $this->sQuery .= $aColumns[count($aColumns) - 1] . " ";
119   - $this->sQuery .= "FROM " . $sTableName . " ";
120   -
121   -
122   -
123   - if (isset($sWhereClause)) {
124   - $this->sQuery .= "WHERE " . $sWhereClause . " ";
125   - }
126   -
127   - if (isset($sOrderByClause)) {
128   - $this->sQuery .= "ORDER BY " . $sOrderByClause . " ";
129   - }
130   -
131   - $this->sQuery .= "LIMIT " . $iOffset . ", " . $iLimit;
132   - $this->query($this->sQuery);
133   - }
134   -
135   - /**
136   - * Get the result count for the previously executed query. Meant
137   - * to be used in conjuction with createSSQLQueryWithOffset so that
138   - * the total number of results can be calculated
139   - *
140   - * @return int row count
141   - */
142   - function & getLastQueryResultCount() {
143   - if (isset($this->sLastTableName)) {
144   - $sCountResultQuery = "SELECT COUNT(*) AS ResultCount FROM " . $this->sLastTableName;
145   -
146   - if (isset($this->sLastWhereClause)) {
147   - sCountResultQuery . " WHERE " . $this->sLastWhereClause;
148   - }
149   - $this->query($sCountResultQuery);
150   - $this->next_record();
151   - return $this->f("ResultCount");
152   - } else {
153   - return 0;
154   - }
155   - }
156   -
157   - /**
158   - * Execute the query and return the results
159   - *
160   - * @returns Results of query
161   - */
162   - function & getQueryResults() {
163   - $result = null;
164   - if (isset($this->sQuery)) {
165   - $result = $this->query($this->sQuery);
166   - }
167   - return $result;
168   - }
169   -
170   - /**
171   - * Display any database errors encountered
172   - */
173   - function haltmsg($msg) {
174   - printf("</td></table><b>Database error:</b> %s<br>\n", $msg);
175   - printf("<b>SQL Error</b>: %s (%s)<br>\n",$this->Errno, $this->Error);
176   - }
177   -}
178   -
179   -/**
180   - * class Owl_Session
181   - *
182   - * This class is used for opening and closing sessions
183   - *
184   - * @version v 1.1.1.1 2002/12/04
185   - * @author michael
186   - * @package Owl
187   -*/
188   -class Owl_Session {
189   - var $sessid;
190   - var $sessuid;
191   - var $sessdata;
192   -
193   -//------------------------------------------------------------
194   -/**
195   - * Function Open_Session($sessid=0, $sessuid=0)
196   - *
197   - * Opens a session
198   - *
199   - * @param $sessid
200   - * The Session id
201   - * @param ssessuid
202   - * The user session id
203   - * @return $this
204   - * Return the session
205   - *
206   -*/
207   -//------------------------------------------------------------
208   -// Usable
209   - function Open_Session($sessid=0, $sessuid=0) {
210   - global $default;
211   - $this->sessid = $sessid;
212   - $this->sessuid = $sessuid;
213   -
214   - // if there is no user loged in, then create a session for them
215   - if($sessid == "0")
216   - {
217   - $current = time();
218   - $random = $this->sessuid . $current;
219   - $this->sessid = md5($random);
220   - $sql = new Owl_DB;
221   -
222   - if(getenv("HTTP_CLIENT_IP"))
223   - {
224   - $ip = getenv("HTTP_CLIENT_IP");
225   - }
226   - elseif(getenv("HTTP_X_FORWARDED_FOR"))
227   - {
228   - $forwardedip = getenv("HTTP_X_FORWARDED_FOR");
229   - list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip);
230   - }
231   - else
232   - {
233   - $ip = getenv("REMOTE_ADDR");
234   - }
235   - //$result = $sql->query("insert into active_sessions values ('$this->sessid', '$this->sessuid', '$current', '$ip')");
236   - $result = $sql->query("insert into $default->owl_sessions_table values ('$this->sessid', '$this->sessuid', '$current', '$ip')");
237   -
238   - if(!'result')
239   - {
240   - die("$lang_err_sess_write");
241   - }
242   - }
243   -
244   - // else we have a session id, try to validate it...
245   - $sql = new Owl_DB;
246   - $sql->query("select * from $default->owl_sessions_table where sessid = '$this->sessid'");
247   -
248   - // any matching session ids?
249   - $numrows = $sql->num_rows($sql);
250   - if(!$numrows) die("$lang_err_sess_notvalid");
251   -
252   - // return if we are a.o.k.
253   - while($sql->next_record()) {
254   - $this->sessdata["sessid"] = $sql->f("sessid");
255   - }
256   - return $this;
257   - }
258   -}
259   -
260   -
261   -//------------------------------------------------------------
262   -/**
263   - * Function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type)
264   - *
265   - * Used to notify users
266   - *
267   - * @param $groupid
268   - * The Id of the group
269   - * @param $flag
270   - * The relvant flag
271   - * @param $filename
272   - * The relevant filename
273   - * @param $title
274   - * The relevant title
275   - * @param $desc
276   - * The description
277   - * @param $type
278   - * the Relevant type
279   - */
280   -//-------------------------------------------------------------
281   -// Semi-Usable Some Interface based code
282   -function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type)
283   -{
284   - global $default;
285   - global $lang_notif_subject_new, $lang_notif_subject_upd, $lang_notif_msg;
286   - global $lang_title, $lang_description;
287   - $sql = new Owl_DB;
288   -// BEGIN BUG 548994
289   - // get the fileid
290   - $path = find_path($parent);
291   - $sql->query("select id from $default->owl_files_table where filename='$filename' AND parent='$parent'");
292   - $sql->next_record();
293   - $fileid = $sql->f("id");
294   -// END BUG 548994 More Below
295   - $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)");
296   -
297   - // loop through records
298   - while($sql->next_record())
299   - {
300   -// BEGIN BUG 548994
301   - // check authentication rights
302   - if ( check_auth($fileid, "file_download", $sql->f(id)) == 1 )
303   - {
304   -// END BUG 548994 More Below
305   - $newpath = ereg_replace(" ","%20",$path);
306   - $newfilename = ereg_replace(" ","%20",$filename);
307   - $DefUserLang = $sql->f("language");
308   - require("$default->owl_fs_root/locale/$DefUserLang/language.inc");
309   -
310   - $r=preg_split("(\;|\,)",$sql->f("email"));
311   - reset ($r);
312   - while (list ($occ, $email) = each ($r))
313   - {
314   - $mail = new phpmailer();
315   - // Create a temporary session id, the user
316   - // will need to get to this file before
317   - // the default session timeout
318   - $session = new Owl_Session;
319   - $uid = $session->Open_Session(0,$sql->f("id"));
320   - $tempsess = $uid->sessdata["sessid"];
321   -
322   - // if flag set to 0
323   - if ( $flag == 0 ) {
324   - $mail->IsSMTP(); // set mailer to use SMTP
325   - $mail->Host = "$default->owl_email_server"; // specify main and backup server
326   - $mail->From = "$default->owl_email_from";
327   - $mail->FromName = "$default->owl_email_fromname";
328   - $mail->AddAddress($email);
329   - $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet");
330   - $mail->WordWrap = 50; // set word wrap to 50 characters
331   - $mail->IsHTML(true); // set email format to HTML
332   - $mail->Subject = "$lang_notif_subject_new";
333   -
334   - // as long as its not a url
335   - if ($type != "url")
336   - {
337   - // if attachfile is true
338   - if ($sql->f("attachfile") == 1)
339   - {
340   - $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc";
341   - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc";
342   -
343   - // use file system
344   - if (!$default->owl_use_fs)
345   - {
346   - //check if file exits
347   - if (file_exists("$default->owl_FileDir/$filename"))
348   - {
349   - unlink("$default->owl_FileDir/$filename");
350   - }
351   - $file = fopen("$default->owl_FileDir$filename", 'wb');
352   - $getfile = new Owl_DB;
353   - $getfile->query("select data,compressed from $default->owl_files_data_table where id='$fileid'");
354   - while ($getfile->next_record())
355   - {
356   - //check if compressed ..and uncompress it
357   - if ($getfile->f("compressed")) {
358   -
359   - $tmpfile = $default->owl_FileDir . "owltmp.$fileid.gz";
360   - $uncomptmpfile = $default->owl_FileDir . "owltmp.$fileid";
361   - if (file_exists($tmpfile)) unlink($tmpfile);
362   -
363   - $fp=fopen($tmpfile,"w");
364   - fwrite($fp, $getfile->f("data"));
365   - fclose($fp);
366   -
367   - system($default->gzip_path . " -df $tmpfile");
368   -
369   - $fsize = filesize($uncomptmpfile);
370   - $fd = fopen($uncomptmpfile, 'rb');
371   - $filedata = fread($fd, $fsize);
372   - fclose($fd);
373   -
374   - fwrite($file, $filedata);
375   - unlink($uncomptmpfile);
376   - }
377   - else
378   - { // otherwise just write the file
379   - fwrite($file, $getfile->f("data"));
380   - }
381   - }
382   - fclose($file);
383   - // add a mail attachment
384   - $mail->AddAttachment("$default->owl_FileDir$newfilename");
385   - } else
386   - {
387   - $mail->AddAttachment("$default->owl_FileDir/$newpath/$newfilename");
388   - }
389   - }
390   - else
391   - { // set up mail body
392   - $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>URL: $default->owl_notify_link" . "browse.php?sess=$tempsess&parent=$parent&expand=1&fileid=$fileid" . "<BR><BR>$lang_description: $desc";
393   - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc";
394   - }
395   - }
396   - else
397   - {
398   - $mail->Body = "URL: $newfilename <BR><BR>$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc";
399   - $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc";
400   - }
401   -
402   - }
403   - else
404   - // set up mailer
405   - {
406   - $mail = new phpmailer();
407   - $mail->IsSMTP(); // set mailer to use SMTP
408   - $mail->Host = "$default->owl_email_server"; // specify main and backup server
409   - $mail->From = "$default->owl_email_from";
410   - $mail->FromName = "$default->owl_email_fromname";
411   - $mail->AddAddress($email);
412   - $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet");
413   - $mail->WordWrap = 50; // set word wrap to 50 characters
414   - $mail->IsHTML(true); // set email format to HTML
415   - $mail->Subject = "$lang_notif_subject_upd";
416   -
417   - // if type not a url
418   - if ($type != "url")
419   - {
420   - // if attachfile is true..go through process of attaching file..simarly to previous
421   - if ($sql->f("attachfile") == 1)
422   - {
423   - $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc";
424   - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc";
425   - if (!$default->owl_use_fs)
426   - {
427   - // check existence of file
428   - if (file_exists("$default->owl_FileDir/$filename"))
429   - {
430   - unlink("$default->owl_FileDir/$filename");
431   - }
432   -
433   - $file = fopen("$default->owl_FileDir$filename", 'wb');
434   - $getfile = new Owl_DB;
435   - $getfile->query("select data,compressed from $default->owl_files_data_table where id='$fileid'");
436   -
437   - // get file check if compressed, if so uncompress
438   - // otherwise write away
439   - while ($getfile->next_record())
440   - {
441   - if ($getfile->f("compressed")) {
442   -
443   - $tmpfile = $default->owl_FileDir . "owltmp.$fileid.gz";
444   - $uncomptmpfile = $default->owl_FileDir . "owltmp.$fileid";
445   - if (file_exists($tmpfile)) unlink($tmpfile);
446   -
447   - $fp=fopen($tmpfile,"w");
448   - fwrite($fp, $getfile->f("data"));
449   - fclose($fp);
450   -
451   - system($default->gzip_path . " -df $tmpfile");
452   -
453   - $fsize = filesize($uncomptmpfile);
454   - $fd = fopen($uncomptmpfile, 'rb');
455   - $filedata = fread($fd, $fsize);
456   - fclose($fd);
457   -
458   - fwrite($file, $filedata);
459   - unlink($uncomptmpfile);
460   - }
461   - else
462   - {
463   - fwrite($file, $getfile->f("data"));
464   - }
465   - }
466   - fclose($file);
467   - $mail->AddAttachment("$default->owl_FileDir$newfilename");
468   - }
469   - else
470   - {
471   - $mail->AddAttachment("$default->owl_FileDir/$newpath/$newfilename");
472   - }
473   -
474   - }
475   - else
476   - {
477   - $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>URL: $default->owl_notify_link" . "browse.php?sess=$tempsess&parent=$parent&expand=1&fileid=$fileid" . "<BR><BR>$lang_description: $desc";
478   - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc";
479   - }
480   - }
481   - else
482   - {
483   - $mail->Body = "URL: $newfilename <BR><BR>$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc";
484   - $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc";
485   - }
486   - }
487   - // send the email
488   - $mail->Send();
489   - if (!$default->owl_use_fs && $sql->f("attachfile") == 1)
490   - {
491   - unlink("$default->owl_FileDir$newfilename");
492   - }
493   -
494   - }
495   - }
496   -// BEGIN BUG 548994
497   - }
498   -// END BUG 548994
499   -}
500   -
501   -//------------------------------------------------------------
502   -/**
503   - * Function verify_login($username, $password)
504   - *
505   - * Used to verify a users login name and password
506   - *
507   - * @param $username
508   - * The username to verfiy
509   - * @param $password
510   - * The password to verify
511   - */
512   -//-------------------------------------------------------------
513   -// Usable
514   -function verify_login($username, $password)
515   -{
516   - global $default;
517   - $sql = new Owl_DB;
518   - $query = "select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'";
519   - $sql->query("select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'");
520   - $numrows = $sql->num_rows($sql);
521   - // Bozz Begin added Password Encryption above, but for now
522   - // I will allow admin to use non crypted password untile he
523   - // upgrades all users
524   - if ($numrows == "1")
525   - {
526   - while($sql->next_record()) {
527   - if ( $sql->f("disabled") == 1 )
528   - $verified["bit"] = 2;
529   - else
530   - $verified["bit"] = 1;
531   - $verified["user"] = $sql->f("username");
532   - $verified["uid"] = $sql->f("id");
533   - $verified["group"] = $sql->f("groupid");
534   - $maxsessions = $sql->f("maxsessions") + 1;
535   - }
536   - }
537   - // Remove this else in a future version
538   - else {
539   - // username admin check password
540   - if ($username == "admin")
541   - {
542   - $sql->query("select * from $default->owl_users_table where username = '$username' and password = '$password'");
543   - $numrows = $sql->num_rows($sql);
544   - if ($numrows == "1")
545   - {
546   - while($sql->next_record())
547   - {
548   - $verified["bit"] = 1;
549   - $verified["user"] = $sql->f("username");
550   - $verified["uid"] = $sql->f("id");
551   - $verified["group"] = $sql->f("groupid");
552   - $maxsessions = $sql->f("maxsessions") + 1;
553   - }
554   - }
555   - }
556   - }
557   -
558   - // remove stale sessions from the database for the user
559   - // that is signing on.
560   - //
561   - $time = time() - $default->owl_timeout;
562   - $sql = new Owl_DB;
563   - $sql->query("delete from $default->owl_sessions_table where uid = '".$verified["uid"]."' and lastused <= $time ");
564   - // Check if Maxsessions has been reached
565   - //
566   -
567   - $sql = new Owl_DB;
568   - $sql->query("select * from $default->owl_sessions_table where uid = '".$verified["uid"]."'");
569   -
570   - if ($sql->num_rows($sql) >= $maxsessions && $verified["bit"] != 0) {
571   - if ( $verified["group"] == 0)
572   - $verified["bit"] = 1;
573   - else
574   - $verified["bit"] = 3;
575   - }
576   - return $verified;
577   -}
578   -
579   -//------------------------------------------------------------
580   -/**
581   - * Function verify_session($username, $password)
582   - *
583   - * Used to verify a users session
584   - *
585   - * @param $username
586   - * The username to check
587   - * @param $password
588   - * The password to check
589   - */
590   -//-------------------------------------------------------------
591   -// Usable
592   -
593   -function verify_session($sess) {
594   - getprefs();
595   - global $default, $lang_sesstimeout, $lang_sessinuse, $lang_clicklogin;
596   - $sess = ltrim($sess);
597   - $verified["bit"] = 0;
598   -
599   - $sql = new Owl_DB;
600   - $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'");
601   - $numrows = $sql->num_rows($sql);
602   - $time = time();
603   -
604   - if ($numrows == "1")
605   - {
606   - while($sql->next_record())
607   - {
608   - if(getenv("HTTP_CLIENT_IP"))
609   - {
610   - $ip = getenv("HTTP_CLIENT_IP");
611   - }
612   - elseif(getenv("HTTP_X_FORWARDED_FOR"))
613   - {
614   - $forwardedip = getenv("HTTP_X_FORWARDED_FOR");
615   - list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip);
616   - }
617   - else
618   - {
619   - $ip = getenv("REMOTE_ADDR");
620   - }
621   - if ($ip == $sql->f("ip"))
622   - {
623   - // if timeout not exceeded
624   - if(($time - $sql->f("lastused")) <= $default->owl_timeout)
625   - {
626   - $verified["bit"] = 1;
627   - $verified["userid"] = $sql->f("uid");
628   - $sql->query("select * from $default->owl_users_table where id = '".$verified["userid"]."'");
629   - while($sql->next_record()) $verified["groupid"] = $sql->f("groupid");
630   - }
631   - else
632   - {
633   - // Bozz Bug Fix begin
634   - if (file_exists("./lib/header.inc"))
635   - {
636   - include("./lib/header.inc");
637   - } else {
638   - include("../lib/header.inc");
639   - }
640   - // Bozz Buf Fix End
641   - print("<BR><BR><CENTER>".$lang_sesstimeout);
642   - if ($parent == "" || $fileid == "")
643   - print("<A HREF='$default->owl_root_url/index.php'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>");
644   - else
645   - print("<A HREF='$default->owl_root_url/index.php?parent=$parent&fileid=$fileid'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>");
646   - exit();
647   - }
648   - } else {
649   - // Bozz Bug Fix begin
650   - if (file_exists("./lib/header.inc")) {
651   - include("./lib/header.inc");
652   - } else {
653   - include("../lib/header.inc");
654   - }
655   - // Bozz Bug Fix End
656   - print("<BR><BR><CENTER>".$lang_sessinuse);
657   - exit;
658   - }
659   - }
660   - }
661   - return $verified;
662   -}
663   -
664   -//------------------------------------------------------------
665   -/**
666   - * Function fid_to_name($parent)
667   - *
668   - * used to get the folder name
669   - *
670   - * @param $parent
671   - * The parent id
672   - * @return $sql->f("name");
673   - * Return the name of the folder
674   -*/
675   -//-------------------------------------------------------------
676   -// Usable
677   -function fid_to_name($parent)
678   -{
679   - global $default;
680   - $sql = new Owl_DB;
681   - $sql->query("select name from $default->owl_folders_table where id = $parent");
682   - while($sql->next_record())
683   - {
684   - return $sql->f("name");
685   - }
686   -}
687   -
688   -//------------------------------------------------------------
689   -/**
690   - * Function flid_to_name($id)
691   - *
692   - * Gets the filename corresponding to the file id
693   - *
694   - * @param $id
695   - * The file id
696   - * @return $sql->f("name");
697   - * Return the name of the file
698   -*/
699   -//-------------------------------------------------------------
700   -// Usable
701   -function flid_to_name($id)
702   -{
703   - global $default;
704   - $sql = new Owl_DB;
705   - $sql->query("select name from $default->owl_files_table where id = $id");
706   - while($sql->next_record())
707   - {
708   - return $sql->f("name");
709   - }
710   -}
711   -
712   -//------------------------------------------------------------
713   -/**
714   - * Function fid_to_filename($id)
715   - *
716   - * gets filename based on id
717   - *
718   - * @param $id
719   - * file id
720   - * @return $sql->f("name");
721   - * Return the name of the file
722   -*/
723   -//-------------------------------------------------------------
724   -// Usable
725   -function flid_to_filename($id) {
726   - global $default;
727   - $sql = new Owl_DB;
728   - $sql->query("select filename from $default->owl_files_table where id = $id");
729   - while($sql->next_record())
730   - {
731   - return $sql->f("filename");
732   - }
733   -}
734   -//------------------------------------------------------------
735   -/**
736   - * Function owlusergroup($userid)
737   - *
738   - * Gets the group id that the user blongs to
739   - *
740   - * @param $userid
741   - * The user id
742   - * @return $groupid
743   - * Return the groupId
744   -*/
745   -//-------------------------------------------------------------
746   -// Usable
747   -function owlusergroup($userid)
748   -{
749   - global $default;
750   - $sql = new Owl_DB;
751   - $sql->query("select group_id from $default->owl_users_table where id = '$userid'");
752   - while($sql->next_record())
753   - {
754   - $groupid = $sql->f("group_id");
755   - return $groupid;
756   - }
757   -}
758   -//------------------------------------------------------------
759   -/**
760   - * Function owlfilecreator($fileid)
761   - *
762   - * used to find the file creator
763   - *
764   - * @param $fileid
765   - * The parent id
766   - * @return $filecreator
767   - * Return the creatorid of the file
768   -*/
769   -//-------------------------------------------------------------
770   -// Usable
771   -function owlfilecreator($fileid) {
772   - global $default;
773   - $sql = new Owl_DB;
774   - $sql->query("select creatorid from ".$default->owl_files_table." where id = '$fileid'");
775   - while($sql->next_record())
776   - {
777   - $filecreator = $sql->f("creatorid");
778   - return $filecreator;
779   - }
780   -}
781   -//------------------------------------------------------------
782   -/**
783   - * Function owlfoldercreator($fileid) {
784   - *
785   - * Used to get the folder creator
786   - *
787   - * @param $fileid
788   - * The file id
789   - * @return $foldercreator
790   - * Return the creatorid of the folder
791   -*/
792   -//-------------------------------------------------------------
793   -// Usable
794   -function owlfoldercreator($folderid)
795   -{
796   - global $default;
797   - $sql = new Owl_DB;
798   - $sql->query("select creatorid from ".$default->owl_folders_table." where id = '$folderid'");
799   - while($sql->next_record())
800   - {
801   - $foldercreator = $sql->f("creatorid");
802   - return $foldercreator;
803   - }
804   -}
805   -//-------------------------------------------------------------
806   -/**
807   - * Function owlfilegroup($fileid)
808   - *
809   - * Used to get the file group id
810   - *
811   - * @param $fileid
812   - * The file id
813   - * @return $filegroup;
814   - * Returns the group id of the file group
815   -*/
816   -//-------------------------------------------------------------
817   -// Usable
818   -function owlfilegroup($fileid)
819   - {
820   - global $default;
821   - $sql = new Owl_DB;
822   - $sql->query("select groupid from $default->owl_files_table where id = '$fileid'");
823   - while($sql->next_record())
824   - {
825   - $filegroup = $sql->f("groupid");
826   - return $filegroup;
827   - }
828   -
829   -}
830   -//-------------------------------------------------------------
831   -/**
832   - * Function owlfoldergroup($folderid)
833   - *
834   - * Used to get the folder group id
835   - *
836   - * @param $folderid
837   - * The folder id
838   - * @return $foldergroup;
839   - * Returns the group id of the folder group
840   -*/
841   -//-------------------------------------------------------------
842   -// Usable
843   -function owlfoldergroup($folderid) {
844   - global $default;
845   - $sql = new Owl_DB;
846   - $sql->query("select groupid from $default->owl_folders_table where id = '$folderid'");
847   - while($sql->next_record())
848   - {
849   - $foldergroup = $sql->f("groupid");
850   - return $foldergroup;
851   - }
852   -
853   -}
854   -//-------------------------------------------------------------
855   -/**
856   - * Function owlfolderparent($folderid)
857   - *
858   - * Used to get the folder parent
859   - *
860   - * @param $folderid
861   - * The folder id
862   - * @return $folderparent
863   - * Returns the folderparent of from the folder
864   -*/
865   -//-------------------------------------------------------------
866   -// Usable
867   -function owlfolderparent($folderid)
868   - {
869   - global $default;
870   - $sql = new Owl_DB;
871   - $sql->query("select parent from $default->owl_folders_table where id = '$folderid'");
872   - while($sql->next_record())
873   - {
874   - $folderparent = $sql->f("parent");
875   - return $folderparent;
876   - }
877   -
878   -}
879   -//-------------------------------------------------------------
880   -/**
881   - * Function owlfileparent($fileid)
882   - *
883   - * Used to get the file parent
884   - *
885   - * @param $fileid
886   - * The file id
887   - * @return $fileparent
888   - * Returns the file parent of from the files
889   -*/
890   -//-------------------------------------------------------------
891   -// Usable
892   -function owlfileparent($fileid)
893   -{
894   - global $default;
895   - $sql = new Owl_DB; $sql->query("select parent from $default->owl_files_table where id = '$fileid'");
896   - while($sql->next_record())
897   - {
898   - $fileparent = $sql->f("parent");
899   -
900   - return $fileparent;
901   - }
902   -}
903   -//------------------------------------------------------------
904   -/**
905   - * Function fid_to_creator($id)
906   - *
907   - * Used to get the creator of the files
908   - *
909   - * @param $id
910   - * The id
911   - * @return $name;
912   - * Return the name of the creator
913   -*/
914   -//-------------------------------------------------------------
915   -// Usable
916   -function fid_to_creator($id) {
917   -
918   - global $default;
919   - $sql = new Owl_DB;
920   - $sql->query("select creatorid from ".$default->owl_files_table." where id = '$id'");
921   - $sql2 = new Owl_DB;
922   - while($sql->next_record())
923   - {
924   - $creatorid = $sql->f("creatorid");
925   - $sql2->query("select name from $default->owl_users_table where id = '".$creatorid."'");
926   - $sql2->next_record();
927   - $name = $sql2->f("name");
928   - }
929   - return $name;
930   -}
931   -//------------------------------------------------------------
932   -/**
933   - * Function group_to_name($id)
934   - *
935   - * select name from the group
936   - *
937   - * @param $id
938   - * The id
939   - * @return $sql->f("name");
940   - * Return the name of the group
941   -*/
942   -//-------------------------------------------------------------
943   -// Usable
944   -function group_to_name($id)
945   -{
946   - global $default;
947   - $sql = new Owl_DB;
948   - $sql->query("select name from $default->owl_groups_table where id = '$id'");
949   - while($sql->next_record())
950   - {
951   - return $sql->f("name");
952   - }
953   -}
954   -
955   -
956   -//------------------------------------------------------------
957   -/**
958   - * Function uid_to_name($id)
959   - *
960   - * name from the users
961   - *
962   - * @param $id
963   - * The id
964   - * @return $name
965   - * Return the name of the user
966   -*/
967   -//-------------------------------------------------------------
968   -// Usable
969   -function uid_to_name($id)
970   -{
971   - global $default;
972   - $sql = new Owl_DB;
973   - $sql->query("select name from $default->owl_users_table where id = '$id'");
974   - while($sql->next_record())
975   - {
976   - $name = $sql->f("name");
977   - if ($name == "")
978   - {
979   - $name = "Owl";
980   - }
981   - return $name;
982   - }
983   -}
984   -//------------------------------------------------------------
985   -/**
986   - * Function prefaccess($id)
987   - *
988   - * get the noprefaccess from the users to compare if access granted
989   - *
990   - * @param $id
991   - * The id
992   - * @return prefaccess;
993   - * Return the name of the folder
994   -*/
995   -//-------------------------------------------------------------
996   -// Usable
997   -
998   -function prefaccess($id) {
999   - global $default;
1000   - $prefaccess = 1;
1001   - $sql = new Owl_DB; $sql->query("select noprefaccess from $default->owl_users_table where id = '$id'");
1002   - while($sql->next_record())
1003   - {
1004   - $prefaccess = !($sql->f("noprefaccess"));
1005   - return $prefaccess;
1006   - }
1007   -}
1008   -//------------------------------------------------------------
1009   -/**
1010   - * Function gen_navbar($parent)
1011   - *
1012   - * Used to generate a nav bar
1013   - *
1014   - * @param $parent
1015   - * The parent id
1016   - * @return $Navbar
1017   - * Return the navbar that has been generated
1018   -*/
1019   -//-------------------------------------------------------------
1020   -// NOT Usable -> Interface based
1021   -function gen_navbar($parent)
1022   -{
1023   - global $default;
1024   - global $sess, $expand, $sort, $sortorder, $order;
1025   - $name = fid_to_name($parent);
1026   - $navbar = "<A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sort'>$name</A>";
1027   - $new = $parent;
1028   - while ($new != "1")
1029   - {
1030   - $sql = new Owl_DB; $sql->query("select parent from $default->owl_folders_table where id = '$new'");
1031   - while($sql->next_record()) $newparentid = $sql->f("parent");
1032   - $name = fid_to_name($newparentid);
1033   - $navbar = "<A HREF='browse.php?sess=$sess&parent=$newparentid&expand=$expand&order=$order&$sortorder=$sort'>$name</A>/" . $navbar;
1034   - $new = $newparentid;
1035   - }
1036   - return $navbar;
1037   -}
1038   -//------------------------------------------------------------
1039   -/**
1040   - * Function get_dirpath($parent)
1041   - *
1042   - * Get the directory path from the db
1043   - *
1044   - * @param $parent
1045   - * The parent id
1046   - * @return $Navbar;
1047   - * Return the navbar with directory path
1048   -*/
1049   -//-------------------------------------------------------------
1050   -// NOT Usable if used in ocnjunction with navbar
1051   -//only get dir path from db
1052   -function get_dirpath($parent) {
1053   - global $default;
1054   - global $sess, $expand;
1055   - $name = fid_to_name($parent);
1056   - $navbar = "$name";
1057   - $new = $parent;
1058   - while ($new != "1") {
1059   - $sql = new Owl_DB; $sql->query("select parent from $default->owl_folders_table where id = '$new'");
1060   - while($sql->next_record()) $newparentid = $sql->f("parent");
1061   - $name = fid_to_name($newparentid);
1062   - $navbar = "$name/" . $navbar;
1063   - $new = $newparentid;
1064   - }
1065   - return $navbar;
1066   -}
1067   -
1068   -//------------------------------------------------------------
1069   -/**
1070   - * Function gen_filesze($filesize)
1071   - *
1072   - * generates the file size
1073   - *
1074   - * @param $filesize
1075   - * The size of the file
1076   - * @return $file_size;
1077   - * Return the rounded off file size
1078   -*/
1079   -//-------------------------------------------------------------
1080   -// Usable
1081   -function gen_filesize($file_size)
1082   -{
1083   - if(ereg("[^0-9]", $file_size))
1084   - {
1085   - return $file_size;
1086   - }
1087   -
1088   - if ($file_size >= 1073741824)
1089   - {
1090   - $file_size = round($file_size / 1073741824 * 100) / 100 . "g";
1091   - }
1092   - elseif ($file_size >= 1048576)
1093   - {
1094   - $file_size = round($file_size / 1048576 * 100) / 100 . "m";
1095   - }
1096   - elseif ($file_size >= 1024)
1097   - {
1098   - $file_size = round($file_size / 1024 * 100) / 100 . "k";
1099   - }
1100   - else
1101   - {
1102   - $file_size = $file_size . "b";
1103   - }
1104   - return $file_size;
1105   -}
1106   -//------------------------------------------------------------
1107   -/**
1108   - * Function unloadCompat($varname)
1109   - *
1110   - * used to upload
1111   - *
1112   - * @param $varname
1113   - * The parent id
1114   - * @return $sql->f("name");
1115   - * Return the name of the folder
1116   -*/
1117   -//-------------------------------------------------------------
1118   -// Usable
1119   -function uploadCompat($varname) {
1120   -
1121   - if ($_FILES[$varname]) return $_FILES[$varname];
1122   - if ($HTTP_POST_FILES[$varname]) return $HTTP_POST_FILES[$varname];
1123   - $tmp = "$varname_name"; global $$tmp; $retfile['name'] = $$tmp;
1124   - $tmp = "$varname_type"; global $$tmp; $retfile['type'] = $$tmp;
1125   - $tmp = "$varname_size"; global $$tmp; $retfile['size'] = $$tmp;
1126   - $tmp = "$varname_error"; global $$tmp; $retfile['error'] = $$tmp;
1127   - $tmp = "$varname_tmp_name"; global $$tmp; $retfile['tmp_name'] = $$tmp;
1128   - return $retfile;
1129   -}
1130   -
1131   -//------------------------------------------------------------
1132   -/**
1133   - * Function checkrequirements()
1134   - *
1135   - * Used to check requirments
1136   - *
1137   - * @return 1
1138   - * Returns 1
1139   -*/
1140   -//-------------------------------------------------------------
1141   -// Usable
1142   -function checkrequirements()
1143   -{
1144   - global $default, $lang_err_bad_version_1, $lang_err_bad_version_2, $lang_err_bad_version_3;
1145   -
1146   - if (substr(phpversion(),0,5) < $default->phpversion)
1147   - {
1148   - print("<CENTER><H3>$lang_err_bad_version_1<BR>");
1149   - print("$default->phpversion<BR>");
1150   - print("$lang_err_bad_version_2<BR>");
1151   - print phpversion();
1152   - print("<BR>$lang_err_bad_version_3</H3></CENTER>");
1153   - return 1;
1154   - }
1155   - else
1156   - {
1157   - return 0;
1158   - }
1159   -}
1160   -//------------------------------------------------------------
1161   -/**
1162   - * Function myExec($cmd, &$lines, &$errco)
1163   - *
1164   - *
1165   - *
1166   - * @param $cmd
1167   - * The command
1168   - * @param $lines
1169   - *
1170   - * @param $errco
1171   - * The error code
1172   - * @return "";
1173   - * Return empty string
1174   - * @return $lines[count($lines)-1]
1175   - * Returns numba of lines
1176   -*/
1177   -//-------------------------------------------------------------
1178   -// Usable
1179   -function myExec($_cmd, &$lines, &$errco)
1180   -{
1181   - $cmd = "$_cmd ; echo $?";
1182   - exec($cmd, $lines);
1183   - // Get rid of the last errco line...
1184   - $errco = (integer) array_pop($lines);
1185   - if (count($lines) == 0)
1186   - {
1187   - return "";
1188   - }
1189   - else
1190   - {
1191   - return $lines[count($lines) - 1];
1192   - }
1193   -}
1194   -//------------------------------------------------------------
1195   -/**
1196   - * Function my_delete($file)
1197   - *
1198   - * used to delete a file if it exists
1199   - *
1200   - * @param $file
1201   - * The file to be deleted
1202   -*/
1203   -//-------------------------------------------------------------
1204   -// Usable
1205   -function myDelete($file) {
1206   - if (file_exists($file))
1207   - {
1208   - chmod($file,0777);
1209   - if (is_dir($file))
1210   - {
1211   - $handle = opendir($file);
1212   - while($filename = readdir($handle))
1213   - {
1214   - if ($filename != "." && $filename != "..")
1215   - {
1216   - myDelete($file."/".$filename);
1217   - }
1218   - }
1219   - closedir($handle);
1220   - rmdir($file);
1221   - }
1222   - else
1223   - {
1224   - unlink($file);
1225   - }
1226   - }
1227   -}
1228   -//------------------------------------------------------------
1229   -/**
1230   - * Function printError($message, $submessage)
1231   - *
1232   - * Prints out error messages
1233   - *
1234   - * @param $message
1235   - * The message
1236   - * @param $submessage
1237   - * The submessage
1238   -*/
1239   -//-------------------------------------------------------------
1240   -// Not Usable -> INTERFACE Based
1241   -function printError($message, $submessage) {
1242   - global $default;
1243   - global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid;
1244   - global $language;
1245   -
1246   - require("$default->owl_fs_root/locale/$default->owl_lang/language.inc");
1247   - include("./lib/header.inc");
1248   -
1249   - if(check_auth($parent, "folder_view", $userid) != "1") {
1250   - $sql = new Owl_DB;
1251   - $sql->query("select * from $default->owl_folders_table where id = '$parent'");
1252   - $sql->next_record();
1253   - $parent = $sql->f("parent");
1254   - }
1255   -
1256   - echo("<TABLE WIDTH=$default->table_expand_width BGCOLOR=\"#d0d0d0\" CELLSPACING=0 CELLPADDING=0 BORDER=0 HEIGHT=30>");
1257   - echo("<TR><TD ALIGN=LEFT>");
1258   - print("$lang_user: ");
1259   - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&sortname=$sortname'>");
1260   - print uid_to_name($userid);
1261   - print ("</A><FONT SIZE=-1>");
1262   - print("<A HREF='index.php?login=logout&sess=$sess'> $lang_logout</A>");
1263   - print("</FONT></TD>");
1264   - print("<TD ALIGN=RIGHT><A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname'><IMG SRC='$default->owl_root_url/locale/$language/graphics/btn_browse.gif' BORDER=0></A>");
1265   - print("</TD></TR></TABLE><BR><BR><CENTER>");
1266   - print $message;
1267   - print("<BR>");
1268   - print $submessage;
1269   - include("./lib/footer.inc");
1270   - exit();
1271   -}
1272   -//------------------------------------------------------------
1273   -/**
1274   - * Function getprefs()
1275   - *
1276   - * gets all the preferences
1277   - *
1278   -*/
1279   -//-------------------------------------------------------------
1280   -// Usable
1281   -function getprefs ( )
1282   -{
1283   - global $default;
1284   -
1285   - $sql = new Owl_DB;
1286   - $sql->query("select * from $default->owl_prefs_table");
1287   - $sql->next_record();
1288   -
1289   - $default->owl_email_from = $sql->f("email_from");
1290   - $default->owl_email_fromname = $sql->f("email_fromname");
1291   - $default->owl_email_replyto = $sql->f("email_replyto");
1292   - $default->owl_email_server = $sql->f("email_server");
1293   - $default->owl_LookAtHD = $sql->f("lookathd");
1294   - $default->owl_def_file_security = $sql->f("def_file_security");
1295   - $default->owl_def_file_group_owner= $sql->f("def_file_group_owner");
1296   - $default->owl_def_file_owner = $sql->f("def_file_owner");
1297   - $default->owl_def_file_title = $sql->f("def_file_title");
1298   - $default->owl_def_file_meta = $sql->f("def_file_meta");
1299   - $default->owl_def_fold_security = $sql->f("def_fold_security");
1300   - $default->owl_def_fold_group_owner= $sql->f("def_fold_group_owner");
1301   - $default->owl_def_fold_owner = $sql->f("def_fold_owner");
1302   - $default->max_filesize = $sql->f("max_filesize");
1303   - $default->owl_timeout = $sql->f("timeout");
1304   - $default->expand = $sql->f("expand");
1305   - $default->owl_version_control = $sql->f("version_control");
1306   - $default->restrict_view = $sql->f("restrict_view");
1307   - $default->dbdump_path = $sql->f("dbdump_path");
1308   - $default->gzip_path = $sql->f("gzip_path");
1309   - $default->tar_path = $sql->f("tar_path");
1310   -
1311   -
1312   -};
1313   -
1314   -//------------------------------------------------------------
1315   -/**
1316   - * Function gethtmlprefs()
1317   - *
1318   - * get html preferences
1319   - *
1320   -*/
1321   -//-------------------------------------------------------------
1322   -// Usable
1323   -
1324   -function gethtmlprefs ( )
1325   -{
1326   - global $default;
1327   -
1328   - $sql = new Owl_DB;
1329   - $sql->query("select * from $default->owl_html_table");
1330   - $sql->next_record();
1331   -
1332   - $default->table_border = $sql->f("table_border");
1333   - $default->table_header_bg = $sql->f("table_header_bg");
1334   - $default->table_cell_bg = $sql->f("table_cell_bg");
1335   - $default->table_cell_bg_alt = $sql->f("table_cell_bg_alt");
1336   - $default->table_expand_width = $sql->f("table_expand_width");
1337   - $default->table_collapse_width = $sql->f("table_collapse_width");
1338   - $default->main_header_bgcolor = $sql->f("main_header_bgcolor");
1339   - $default->body_bgcolor = $sql->f("body_bgcolor");
1340   - $default->body_textcolor = $sql->f("body_textcolor");
1341   - $default->body_link = $sql->f("body_link");
1342   - $default->body_vlink = $sql->f("body_vlink");
1343   -
1344   -};
1345   -//------------------------------------------------------------
1346   -/**
1347   - * Function printfileperm($currentval, $namevariable, $printmessage, $type)
1348   - *
1349   - * Print file permissions
1350   - *
1351   - * @param $currentval
1352   - * The current value
1353   - * @param $namevariable
1354   - * The name of the file
1355   - * @param $pringmessage
1356   - * The message to be printed
1357   - * @param $type
1358   - * The type of file
1359   -*/
1360   -//-------------------------------------------------------------
1361   -// SEMI-Usable Interface based
1362   -function printfileperm($currentval, $namevariable, $printmessage, $type) {
1363   - global $default;
1364   - global $lang_everyoneread, $lang_everyonewrite, $lang_everyonewrite_nod, $lang_groupread, $lang_groupwrite, $lang_groupwrite_nod, $lang_groupwrite_worldread, $lang_groupwrite_worldread_nod, $lang_onlyyou;
1365   - 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;
1366   -
1367   -
1368   - $file_perm[0][0] = 0;
1369   - $file_perm[1][0] = 1;
1370   - $file_perm[2][0] = 2;
1371   - $file_perm[3][0] = 3;
1372   - $file_perm[4][0] = 4;
1373   - $file_perm[5][0] = 5;
1374   - $file_perm[6][0] = 6;
1375   - $file_perm[7][0] = 7;
1376   - $file_perm[8][0] = 8;
1377   -
1378   - // show admin permissions
1379   - if ($type == "admin")
1380   - {
1381   - $file_perm[0][1] = "$lang_everyoneread_ad";
1382   - $file_perm[1][1] = "$lang_everyonewrite_ad";
1383   - $file_perm[2][1] = "$lang_groupread_ad";
1384   - $file_perm[3][1] = "$lang_groupwrite_ad";
1385   - $file_perm[4][1] = "$lang_onlyyou_ad";
1386   - $file_perm[5][1] = "$lang_groupwrite_ad_nod";
1387   - $file_perm[6][1] = "$lang_everyonewrite_ad_nod";
1388   - $file_perm[7][1] = "$lang_groupwrite_worldread_ad";
1389   - $file_perm[8][1] = "$lang_groupwrite_worldread_ad_nod";
1390   - }
1391   - else {// otherwise show other permissions
1392   - $file_perm[0][1] = "$lang_everyoneread";
1393   - $file_perm[1][1] = "$lang_everyonewrite";
1394   - $file_perm[2][1] = "$lang_groupread";
1395   - $file_perm[3][1] = "$lang_groupwrite";
1396   - $file_perm[4][1] = "$lang_onlyyou";
1397   - $file_perm[5][1] = "$lang_groupwrite_nod";
1398   - $file_perm[6][1] = "$lang_everyonewrite_nod";
1399   - $file_perm[7][1] = "$lang_groupwrite_worldread";
1400   - $file_perm[8][1] = "$lang_groupwrite_worldread_nod";
1401   - }
1402   -
1403   - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$printmessage</TD><TD align=left><SELECT NAME=$namevariable>");
1404   - foreach($file_perm as $fp) {
1405   - print("<OPTION VALUE=$fp[0] ");
1406   - if($fp[0] == $currentval)
1407   - print("SELECTED");
1408   - print(">$fp[1]");
1409   - }
1410   - print("</SELECT></TD></TR>");
1411   -
1412   -
1413   -};
1414   -//------------------------------------------------------------
1415   -/**
1416   - * Function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext)
1417   - *
1418   - *prints the file icons
1419   - *
1420   - * @param $fid
1421   - * The folder id
1422   - * @param $filename
1423   - * The name of the file
1424   - * @param $check_out
1425   - * checkout status
1426   - * @param $url
1427   - * The relevant url
1428   - * @param $allicons
1429   - *
1430   - * @param $ext
1431   - * The extension of the file
1432   - * @return $sql->f("name");
1433   - * Return the name of the folder
1434   -*/
1435   -//-------------------------------------------------------------
1436   -// NOT Usable INTERFACE based
1437   -function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext)
1438   -{
1439   - global $default;
1440   - global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid;
1441   - global $lang_log_file, $lang_reallydelete, $lang_del_file_alt, $lang_mod_file_alt;
1442   - global $lang_move_file_alt,$lang_upd_file_alt,$lang_get_file_alt,$lang_lock_file,$lang_email_alt,$lang_view_file_alt;
1443   -
1444   - if ($allicons == 1)
1445   - {
1446   - if ($url != "1")
1447   - print("<a href='log.php?sess=$sess&id=".$fid."&filename=".$filename."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/log.gif' BORDER=0 ALT='$lang_log_file' TITLE='$lang_log_file'></a>");
1448   - }
1449   -
1450   - if (($checked_out == 0) || ($checked_out == $userid)) {
1451   - // *****************************************************************************
1452   - // Don't Show the delete icon if the user doesn't have delete access to the file
1453   - // *****************************************************************************
1454   -
1455   - if (check_auth($fid, "file_delete", $userid) == 1)
1456   - if ($url == "1")
1457   - print("\t<A HREF='dbmodify.php?sess=$sess&action=file_delete&type=url&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'\tonClick='return confirm(\"$lang_reallydelete ".$filename."?\");'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/trash.gif' ALT='$lang_del_file_alt' TITLE='$lang_del_file_alt'\tBORDER=0></A>");
1458   - else
1459   - print("\t<A HREF='dbmodify.php?sess=$sess&action=file_delete&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'\tonClick='return confirm(\"$lang_reallydelete ".$filename."?\");'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/trash.gif' ALT='$lang_del_file_alt' TITLE='$lang_del_file_alt'\tBORDER=0></A>");
1460   -
1461   - // *****************************************************************************
1462   - // Don't Show the modify icon if the user doesn't have modify access to the file
1463   - // *****************************************************************************
1464   -
1465   - if(check_auth($fid, "file_modify", $userid) == 1)
1466   - print("<A HREF='modify.php?sess=$sess&action=file_modify&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/edit.gif' BORDER=0 ALT='$lang_mod_file_alt' TITLE='$lang_mod_file_alt'></A>");
1467   -
1468   - // *****************************************************************************
1469   - // Don't Show the move modify icon if the user doesn't have move access to the file
1470   - // *****************************************************************************
1471   -
1472   - if(check_auth($fid, "file_modify", $userid) == 1)
1473   - if ($url == "1")
1474   - print("<A HREF='move.php?sess=$sess&id=".$fid."&parent=$parent&expand=$expand&action=file&type=url&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/move.gif' BORDER=0 ALT='$lang_move_file_alt' TITLE='$lang_move_file_alt'></A>");
1475   - else
1476   - print("<A HREF='move.php?sess=$sess&id=".$fid."&parent=$parent&expand=$expand&action=file&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/move.gif' BORDER=0 ALT='$lang_move_file_alt' TITLE='$lang_move_file_alt'></A>");
1477   - // *****************************************************************************
1478   - // Don't Show the file update icon if the user doesn't have update access to the file
1479   - // *****************************************************************************
1480   -
1481   - if(check_auth($fid, "file_modify", $userid) == 1)
1482   - if ($url != "1")
1483   - print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_update&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/update.gif' BORDER=0 ALT='$lang_upd_file_alt' TITLE='$lang_upd_file_alt'></A>");
1484   -
1485   - // *****************************************************************************
1486   - // Don't Show the file dowload icon if the user doesn't have download access to the file
1487   - // *****************************************************************************
1488   -
1489   - if(check_auth($fid, "file_download", $userid) == 1)
1490   - if ($url != "1")
1491   - print("<A HREF='$default->owl_root_url/download.php?sess=$sess&id=".$fid."&parent=".$parent."&binary=1'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/bin.gif' BORDER=0 ALT='$lang_get_file_alt' TITLE='$lang_get_file_alt'></A>");
1492   -
1493   - if ($allicons == 1)
1494   - {
1495   - // *****************************************************************************
1496   - // Don't Show the lock icon if the user doesn't have access to the file
1497   - // *****************************************************************************
1498   - if(check_auth($fid, "file_modify", $userid) == 1)
1499   - if ($url != "1")
1500   - print("<A HREF='dbmodify.php?sess=$sess&action=file_lock&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/lock.gif' BORDER=0 ALT='$lang_lock_file' TITLE='$lang_lock_file'></a>");
1501   - }
1502   -
1503   - // *****************************************************************************
1504   - // Don't Show the email icon if the user doesn't have access to email the file
1505   - // *****************************************************************************
1506   -
1507   - if(check_auth($fid, "file_modify", $userid) == 1)
1508   - if ($url == "1")
1509   - print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_email&type=url&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/email.gif' BORDER=0 ALT='$lang_email_alt' TITLE='$lang_email_alt'></A>");
1510   - else
1511   - print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_email&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/email.gif' BORDER=0 ALT='$lang_email_alt' TITLE='$lang_email_alt'></A>");
1512   -
1513   - // *****************************************************************************
1514   - // Don't Show the view icon if the user doesn't have download access to the file
1515   - // *****************************************************************************
1516   -
1517   - if(check_auth($fid, "file_download", $userid) == 1)
1518   - if ($url != "1") {
1519   - $imgfiles = array("jpg","gif");
1520   - if ($ext != "" && preg_grep("/$ext/", $imgfiles)) {
1521   - print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=image_preview&expand=$expand&order=$order&sortname=$sortname'>&nbsp;<IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>");
1522   - }
1523   - $htmlfiles = array("html","htm",xml);
1524   - if ($ext != "" && preg_grep("/$ext/", $htmlfiles)) {
1525   - print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=html_show&expand=$expand&order=$order&sortname=$sortname'>&nbsp;<IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>");
1526   - }
1527   - $txtfiles = array("txt","text","README", "readme", "sh", "c", "cpp", "php", "php3", "pl", "perl", "sql", "py");
1528   - if ($ext != "" && preg_grep("/$ext/", $txtfiles)) {
1529   - print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=text_show&expand=$expand&order=$order&sortname=$sortname'>&nbsp;<IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>");
1530   - }
1531   - if (substr(php_uname(), 0, 7) != "Windows") {
1532   - $zipfiles = array("tar.gz", "tgz", "tar", "gz");
1533   - if ($ext != "" && preg_grep("/$ext/", $zipfiles))
1534   - print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=zip_preview&expand=$expand&order=$order&sortname=$sortname'>&nbsp;<IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>");
1535   - }
1536   - }
1537   - }
1538   -};
1539   -
1540   -//------------------------------------------------------------
1541   -/**
1542   - * Function printgroupperm($currentval, $namevariable, $printmessage, $type)
1543   - *
1544   - * Prints group permissions
1545   - *
1546   - * @param $currentval
1547   - * The current value
1548   - * @param $namevariable
1549   - * The name of the group
1550   - * @param $printmessage
1551   - * The message to be printed
1552   - * @param $type
1553   - * The type of group
1554   -*/
1555   -//-------------------------------------------------------------
1556   -// NOT Usable INTERFACE based
1557   -function printgroupperm($currentval, $namevariable, $printmessage, $type) {
1558   - global $default;
1559   - global $lang_geveryoneread, $lang_geveryonewrite, $lang_geveryonewrite_nod, $lang_ggroupread, $lang_ggroupwrite, $lang_ggroupwrite_nod, $lang_ggroupwrite_worldread, $lang_ggroupwrite_worldread_nod, $lang_gonlyyou;
1560   - 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;
1561   -
1562   -
1563   - $group_perm[0][0] = 50;
1564   - $group_perm[1][0] = 51;
1565   - $group_perm[2][0] = 52;
1566   - $group_perm[3][0] = 53;
1567   - $group_perm[4][0] = 54;
1568   - $group_perm[5][0] = 55;
1569   - $group_perm[6][0] = 56;
1570   - $group_perm[7][0] = 57;
1571   - $group_perm[8][0] = 58;
1572   - if ($type == "admin")
1573   - {
1574   - $group_perm[0][1] = "$lang_geveryoneread_ad";
1575   - $group_perm[1][1] = "$lang_geveryonewrite_ad";
1576   - $group_perm[2][1] = "$lang_ggroupread_ad";
1577   - $group_perm[3][1] = "$lang_ggroupwrite_ad";
1578   - $group_perm[4][1] = "$lang_gonlyyou_ad";
1579   - $group_perm[5][1] = "$lang_ggroupwrite_ad_nod";
1580   - $group_perm[6][1] = "$lang_geveryonewrite_ad_nod";
1581   - $group_perm[7][1] = "$lang_ggroupwrite_worldread_ad";
1582   - $group_perm[8][1] = "$lang_ggroupwrite_worldread_ad_nod";
1583   -
1584   - }
1585   - else
1586   - {
1587   - $group_perm[0][1] = "$lang_geveryoneread";
1588   - $group_perm[1][1] = "$lang_geveryonewrite";
1589   - $group_perm[2][1] = "$lang_ggroupread";
1590   - $group_perm[3][1] = "$lang_ggroupwrite";
1591   - $group_perm[4][1] = "$lang_gonlyyou";
1592   - $group_perm[5][1] = "$lang_ggroupwrite_nod";
1593   - $group_perm[6][1] = "$lang_geveryonewrite_nod";
1594   - $group_perm[7][1] = "$lang_ggroupwrite_worldread";
1595   - $group_perm[8][1] = "$lang_ggroupwrite_worldread_nod";
1596   - }
1597   -
1598   - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$printmessage</TD><TD align=left><SELECT NAME=$namevariable>");
1599   - foreach($group_perm as $fp)
1600   - {
1601   - print("<OPTION VALUE=$fp[0] ");
1602   - if($fp[0] == $currentval)
1603   - print("SELECTED");
1604   - print(">$fp[1]");
1605   - }
1606   - print("</SELECT></TD></TR>");
1607   -
1608   -};
1609   -
1610   -// ----------------------
1611   -// page start
1612   -// ----------------------
1613   -
1614   -/**
1615   - * Initialises the web application by making current
1616   - * request parameters global, performing session checking
1617   - * and loading the default language
1618   - */
1619   -// make request parameters global
1620   -
1621   -if (substr(phpversion(),0,5) >= "4.1.0") {
1622   - // if supported by the installed version of PHP
1623   - import_request_variables('pgc');
1624   -} else {
1625   - // do it manually
1626   - if (!EMPTY($_POST)) {
1627   - extract($_POST);
1628   - } else {
1629   - extract($HTTP_POST_VARS);
1630   - }
1631   -
1632   - if (!EMPTY($_GET)) {
1633   - extract($_GET);
1634   - } else {
1635   - extract($HTTP_GET_VARS);
1636   - }
1637   -
1638   - if (!EMPTY($_FILE)) {
1639   - extract($_FILE);
1640   - } else {
1641   - extract($HTTP_POST_FILES);
1642   - }
1643   -}
1644   -
1645   -/*
1646   -// initialise session var
1647   -if(!isset($sess)) {
1648   - $sess = 0;
1649   -}
1650   -// initialise loginname
1651   -if(!isset($loginname)) {
1652   - $loginname = 0;
1653   -}
1654   -// initialise login var
1655   -if(!isset($login)) {
1656   - $login = 0;
1657   -}
1658   -*/
1659   -
1660   -// set default language
1661   -if(isset($default->owl_lang)) {
1662   -
1663   - $langdir = "$default->owl_fs_root/locale/$default->owl_lang";
1664   -
1665   - if(is_dir("$langdir") != 1) {
1666   - die("$lang_err_lang_1 $langdir $lang_err_lang_2");
1667   - } else {
1668   -
1669   - $sql = new Owl_DB;
1670   - $sql->query("select * from $default->owl_sessions_table where id = '$sess'");
1671   - $sql->next_record();
1672   - $numrows = $sql->num_rows($sql);
1673   - $getuid = $sql->f("uid");
1674   - if($numrows == 1) {
1675   - $sql->query("select * from $default->owl_users_table where id = $getuid");
1676   - $sql->next_record();
1677   - $language = $sql->f("language");
1678   - // BEGIN wes fix
1679   - if(!$language) {
1680   - $language = $default->owl_lang;
1681   - }
1682   - // END wes fix
1683   - require("$default->owl_fs_root/locale/$language/language.inc");
1684   - $default->owl_lang = $language;
1685   - } else {
1686   - require("$default->owl_fs_root/locale/$default->owl_lang/language.inc");
1687   - }
1688   - }
1689   -} else {
1690   - die("$lang_err_lang_notfound");
1691   -}
1692   -/*
1693   -if ($sess) {
1694   - gethtmlprefs();
1695   - $ok = verify_session($sess);
1696   - $temporary_ok = $ok["bit"];
1697   - $userid = $ok["userid"];
1698   - $usergroupid = $ok["groupid"];
1699   -
1700   - if ($ok["bit"] != "1") {
1701   - // Bozz Bug Fix begin
1702   - if (file_exists("./lib/header.inc")) {
1703   - include("./lib/header.inc");
1704   - } else {
1705   - include("../lib/header.inc");
1706   - }
1707   - // Bozz Bug Fix end
1708   - print("<BR><BR><CENTER>".$lang_invalidsess);
1709   - if ($parent == "" || $fileid == "") {
1710   - print("<A HREF='$default->owl_root_url/index.php'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>");
1711   - } else {
1712   - print("<A HREF='$default->owl_root_url/index.php?parent=$parent&fileid=$fileid'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>");
1713   - }
1714   - exit;
1715   - } else {
1716   - $lastused = time();
1717   - $sql = new Owl_DB;
1718   - $sql->query("update $default->owl_sessions_table set lastused = '$lastused' where uid = '$userid'");
1719   - }
1720   -}
1721   -
1722   -if (!$sess && !$loginname && !$login) {
1723   - if(!isset($fileid)) {
1724   - header("Location: " . $default->owl_root_url . "/index.php?login=1");
1725   - } else {
1726   - header("Location: " . $default->owl_root_url . "/index.php?login=1&fileid=$fileid&parent=$parent");
1727   - }
1728   -}
1729   -*/
1730   -?>
lib/readhd.php deleted
1   -<?php
2   -
3   -/**
4   - * ReadHD.php
5   - *
6   - * this is used for file system manipulation
7   - *
8   - * Copyright (c) 1999-2002 The Owl Project Team
9   - * Licensed under the GNU GPL. For full terms see the file COPYING.
10   - * @version v 1.1.1.1 2002/12/04
11   - * @author michael
12   - * @package Owl
13   - */
14   -
15   -
16   -#Ugly code by Anders Axesson.
17   -# Adapted to OWL global config file by B0zz
18   -
19   -
20   -//-------------------------------------------------------------
21   -/**
22   - * Function GetFromHD($GetWhat, $ThePath)
23   - *
24   - * Retrieves files/folders from the Hard Drive, given
25   - * a file/folder to get and a path
26   - *
27   - * @param $GetWhat
28   - * The File/Folder(s) that needs to be retrieved
29   - * @param $ThePath
30   - * The Path to Search for the File/Folder(s)
31   - * @return $Files
32   - * Returns an array of Files that needs to be retrieved
33   - * @return $Folders
34   - * Returns an array Folder(s) that needs to be retrieved
35   -*/
36   -//-------------------------------------------------------------
37   -// Usable
38   -
39   -function GetFromHD($GetWhat, $ThePath)
40   - {
41   - if ($Dir = opendir($ThePath))
42   - {
43   - $FileCount = 0;
44   - $DirCount = 0;
45   - while($file = readdir($Dir))
46   - {
47   - $PathFile = $ThePath . "/" . $file; //must test with full path (is_file etc)
48   -
49   - if(($file <> ".") and ($file <> ".."))
50   - {
51   - if (!is_file($PathFile))
52   - { //check if it is a folder (dir) or file (dont check if it is a link)
53   - $DirCount++;
54   - $Dirs[$DirCount] = $file;
55   - }
56   - else
57   - {
58   - $FileCount++;
59   - $Files[$FileCount] = $file;
60   - }
61   - }
62   - }
63   - // if it is a file add it to an array of files and return it
64   - if ($GetWhat == 'file')
65   - {
66   - $FileCount++;
67   - $Files[$FileCount] = "[END]"; //stop looping @ this
68   - return $Files;
69   - }
70   -
71   - // if it is a folder add it to the array of folders and return it
72   - if ($GetWhat == 'folder')
73   - {
74   - $DirCount++;
75   - $Dirs[$DirCount] = "[END]"; //stop looping @ this
76   - return $Dirs;
77   - }
78   -
79   - }
80   -}
81   -
82   -//-------------------------------------------------------------
83   -/**
84   - * Function GetFileInfo($PathFile)
85   - *
86   - * Gets the information on the specified file i.e. modification
87   - * and file size
88   - *
89   - * @param $PathFile
90   - * The Path to the File
91   - * @return $FileInfo
92   - * Returns an array with the information of the file
93   -*/
94   -//-------------------------------------------------------------
95   -// Usable
96   -function GetFileInfo($PathFile) {
97   - $TheFileSize = filesize($PathFile); //get filesize
98   - $TheFileTime = date("Y-m-d H:i:s", filemtime($PathFile)); //get and fix time of last modifikation
99   - $TheFileTime2 = date("M d, Y \a\\t h:i a", filemtime($PathFile)); //get and fix time of last modifikation
100   -
101   -
102   - $FileInfo[1] = $TheFileSize;
103   - $FileInfo[2] = $TheFileTime; //s$modified
104   - $FileInfo[3] = $TheFileTime2; //modified
105   -
106   - return $FileInfo;
107   -}
108   -
109   -
110   -//-------------------------------------------------------------
111   -/**
112   - * Function CompareDBnHD($GetWhat, $ThePath, $DBList, $parent, $DBTable)
113   - *
114   - * Compare files or folders in database with files on harddrive
115   - *
116   - * @param $GetWhat
117   - * The File/Folder(s) that will be compared
118   - * @param $ThePath
119   - * The Path of the File/Folder(s)
120   - * @param $DBList
121   - * The List of files in the DB
122   - * @param $Parent
123   - * The parent folder id
124   - * @param $DBTable
125   - * The DBTable to compare to
126   - * @return $RefreshPage
127   - * Return true or false if page needs to be refreshed
128   -*/
129   -//-------------------------------------------------------------
130   -// Usable
131   -
132   -function CompareDBnHD($GetWhat, $ThePath, $DBList, $parent, $DBTable) { //compare files or folders in database with files on harddrive
133   -
134   - // get from HD the relevant Files/Folders, store in array
135   - $F = GetFromHD($GetWhat, $ThePath);
136   -
137   -$RefreshPage = false; //if filez/Folders are found the page need to be refreshed in order to see them.
138   -
139   -// if array exists
140   -if(is_array($F))
141   -{
142   -
143   -// loop through file/folderarray and Dblist array to compare them
144   - for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++)
145   - {
146   -
147   - for($DBLoopCount = 1; $DBList[$DBLoopCount] !== "[END]";$DBLoopCount++)
148   - {
149   - if($F[$HDLoopCount] == $DBList[$DBLoopCount])
150   - {
151   - 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)
152   - break;
153   - }
154   - }
155   - }
156   -
157   -// if certain files/Folders are not in the DB but are on the list, add them to the DB
158   - for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++)
159   - {
160   - if(ord($F[$HDLoopCount]) !== 0)
161   - { //if not the file/folder name is empty...
162   - if($GetWhat == "file")
163   - {
164   - $RefreshPage = true;
165   - InsertHDFilezInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the files-on-disc-but-not-in-db into the db.
166   -
167   - }
168   - else
169   - {
170   - $RefreshPage = false;
171   - }
172   -
173   - if($GetWhat == "folder")
174   - {
175   - $RefreshPage = true;
176   - InsertHDFolderzInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the folders-on-disc-but-not-in-db into the db.
177   - }
178   - }
179   - }
180   -
181   -}
182   - // return true or false
183   - return $RefreshPage;
184   -
185   -}
186   -
187   -//-------------------------------------------------------------
188   -/**
189   - * Function InsertHDFolderzInDB($TheFolder, $parent, $ThePath, $DBTable)
190   - *
191   - * Compare files or folders in database with files on harddrive
192   - *
193   - * @param $TheFolder
194   - * The Folder to be inserted
195   - * @param $Parent
196   - * The parent folder id
197   - * @param $ThePath
198   - * The Path of the Folder
199   - * @param $DBTable
200   - * The DBTable to insert into
201   - */
202   -//-------------------------------------------------------------
203   -// Usable
204   -function InsertHDFolderzInDB($TheFolder, $parent, $ThePath, $DBTable)
205   -{
206   - global $default;
207   -
208   - $sql = new Owl_DB; //create new db connection
209   -
210   - $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')";
211   -
212   - $sql->query($SQL);
213   -}
214   -
215   -
216   -//-------------------------------------------------------------
217   -/**
218   - * Function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable)
219   - *
220   - * Compare files or folders in database with files on harddrive
221   - *
222   - * @param $TheFile
223   - * The Folder to be inserted
224   - * @param $Parent
225   - * The parent folder id
226   - * @param $ThePath
227   - * The Path of the File
228   - * @param $DBTable
229   - * The DBTable to insert into
230   - */
231   -//-------------------------------------------------------------
232   -// Usable
233   -function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable) {
234   -
235   - global $default;
236   - $sql = new Owl_DB; //create new db connection
237   -
238   - $FileInfo = GetFileInfo($ThePath . "/" . $TheFile); //get file size etc. 2=File size, 2=File time (smodified), 3=File time 2 (modified)
239   -
240   - // if there is no file title assign it to default file title
241   - if ($default->owl_def_file_title == "")
242   - {
243   - $title_name = $TheFile;
244   - }
245   - else
246   - {
247   - $title_name = $default->owl_def_file_title;
248   - }
249   -
250   -// insert into DB
251   - $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]')";
252   - $sql->query($SQL);
253   -
254   -}
255   -
256   -?>
lib/security.lib.php deleted
1   -<?php
2   -
3   -/*
4   -
5   - File: security.lib.php
6   - Author: Chris
7   - Date: 2000/12/14
8   -
9   - Owl: Copyright Chris Vincent <cvincent@project802.net>
10   -
11   - You should have received a copy of the GNU Public
12   - License along with this package; if not, write to the
13   - Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14   - Boston, MA 02111-1307, USA.
15   -
16   -*/
17   -
18   -/**
19   -* Get the security policy for a specified folder
20   -*
21   -* @param id folder id
22   -*
23   -* @return int 1 = permission granted, 0 = permission denied
24   -*/
25   -function getfolderpolicy($id) {
26   - global $default;
27   - $sql = new Owl_DB; $sql->query("select security from $default->owl_folders_table where id = '$id'");
28   - while ($sql->next_record()) return $sql->f("security");
29   -}
30   -
31   -/**
32   -* Get the security policy for a specified file
33   -*
34   -* @param id file id
35   -*
36   -* @return int security policy
37   -*/
38   -function getfilepolicy($id) {
39   - global $default;
40   - $sql = new Owl_DB; $sql->query("select security from $default->owl_files_table where id = '$id'");
41   - while ($sql->next_record()) return $sql->f("security");
42   -}
43   -
44   -/**
45   -* This function is simple...it returns either a 1 or 0
46   -* If the authentication is good, it returns 1
47   -* If the authentication is bad, it returns 0
48   -*
49   -* Policy key for FILES:
50   -*
51   -* 0 = World read
52   -* 1 = World edit
53   -* 2 = Group read
54   -* 3 = Group edit
55   -* 4 = Creator edit
56   -* 5 = Group edit no delete
57   -* 6 = World edit no delete
58   -* 7 = Group edit, World read
59   -* 8 = Group edit, World read - no delete
60   -*
61   -* Policy key for FOLDERS:
62   -*
63   -* 50 = Anyone can read
64   -* 51 = Anyone can upload/create folders
65   -* 56 = Anyone can upload/create folders but not delete
66   -* 52 = Only the group can read
67   -* 53 = Only the group can upload/create folders
68   -* 55 = Only the group can upload/create folders but not delete; except the creator
69   -* 54 = Only the creator can upload/create folders
70   -* 57 = Only the group can upload/create folders but anyone can read
71   -* 58 = Only the group can upload/create folders (no delete) but anyone can read
72   -*/
73   -
74   -function check_auth($id, $action, $userid) {
75   - global $default;
76   - $usergroup = owlusergroup($userid);
77   - $filecreator = owlfilecreator($id);
78   - $foldercreator = owlfoldercreator($id);
79   - $filegroup = owlfilegroup($id);
80   - $foldergroup = owlfoldergroup($id);
81   -
82   - if (($action == "folder_modify") ||
83   - ($action == "folder_view") ||
84   - ($action == "folder_delete") ||
85   - ($action == "folder_property")) {
86   - $policy = getfolderpolicy($id);
87   - } else {
88   - $policy = getfilepolicy($id);
89   - }
90   -
91   - //if policy is: world read
92   - if ($policy == "0") {
93   - //if the user want to delete/modify
94   - if (($action == "file_delete") || ($action == "file_modify")) {
95   - //if the user is not the file create
96   - if ($userid != $filecreator) {
97   - $authorization = "0";
98   - } else {
99   - $authorization = "1";
100   - }
101   - } else {
102   - $authorization = "1";
103   - }
104   - }
105   - //if the policy is: world edit
106   - if ($policy == "1") {
107   - $authorization = "1";
108   - }
109   - //if the policy is: group read
110   - if ($policy == "2") {
111   - //if the user wants to delete/modify the file
112   - if (($action == "file_delete") || ($action == "file_modify")) {
113   - if ($userid != $filecreator) {
114   - $authorization = "0";
115   - } else {
116   - $authorization = "1";
117   - }
118   - } else {
119   - // Bozz Change Begin
120   - $sql = new Owl_DB;
121   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'");
122   - //if the user is in the group
123   - if ($filegroup == $usergroup || $sql->num_rows($sql) > 0) {
124   - // Bozz Change End
125   - $authorization = "1";
126   - } else {
127   - $authorization = "0";
128   - }
129   - }
130   -
131   - }
132   - //if the policy is: group edit
133   - if ($policy == "3") {
134   - if (($action == "file_delete") || ($action == "file_modify") || ($action == "file_download")) {
135   - // Bozz Change Begin
136   - $sql = new Owl_DB;
137   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'");
138   - // Bozz Change End
139   - //if the user is not in the group
140   - if ($usergroup != $filegroup && $sql->num_rows($sql) == 0) {
141   - $authorization = "0";
142   - } else {
143   - $authorization = "1";
144   - }
145   - }
146   - }
147   - //if the policy is: creator edit
148   - if ($policy == "4") {
149   - //if the user is the creator
150   - if ($filecreator == $userid) {
151   - $authorization = "1";
152   - } else {
153   - $authorization = "0";
154   - }
155   - }
156   - //if the policy is: group edit no delete
157   - if ($policy == "5") {
158   - if (($action == "file_modify") || ($action == "file_download")) {
159   - // Bozz Change Begin
160   - $sql = new Owl_DB;
161   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'");
162   - // Bozz Change End
163   - //if the user is in the group
164   - if ($usergroup != $filegroup && $sql->num_rows($sql) == 0) {
165   - $authorization = "0";
166   - } else {
167   - $authorization = "1";
168   - }
169   - }
170   - if ($action == "file_delete") {
171   - //if the user is the file creator
172   - if ($filecreator == $userid) {
173   - $authorization = "1";
174   - } else {
175   - $authorization = "0";
176   - }
177   - }
178   - }
179   - //if the policy is: world edit no delete
180   - if ($policy == "6") {
181   - $authorization = "1";
182   - if ($action == "file_delete") {
183   - //if the user is the creator
184   - if ($filecreator == $userid) {
185   - $authorization = "1";
186   - } else {
187   - $authorization = "0";
188   - }
189   - }
190   - }
191   - //if the policy is: group edit world read
192   - if ($policy == "7") {
193   - if (($action == "file_delete") || ($action == "file_modify")) {
194   - $sql = new Owl_DB;
195   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'");
196   - //if the user is not in the group
197   - if ($usergroup != $filegroup && $sql->num_rows($sql) == 0) {
198   - $authorization = "0";
199   - } else {
200   - $authorization = "1";
201   - }
202   - }
203   - if ($action == "file_download") {
204   - $authorization = "1";
205   - }
206   - }
207   - //if the policy is: group edit, world read, no delete
208   - if ($policy == "8") {
209   - if ($action == "file_modify") {
210   - $sql = new Owl_DB;
211   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$filegroup'");
212   - //if the user is not in the group
213   - if ($usergroup != $filegroup && $sql->num_rows($sql) == 0) {
214   - $authorization = "0";
215   - } else {
216   - $authorization = "1";
217   - }
218   - }
219   - if ($action == "file_download") {
220   - $authorization = "1";
221   - }
222   - if ($action == "file_delete") {
223   - //if the user is the creator
224   - if ($filecreator == $userid) {
225   - $authorization = "1";
226   - } else {
227   - $authorization = "0";
228   - }
229   - }
230   - }
231   - //if the policy is: anyone can read
232   - if ($policy == "50") {
233   - if (($action == "folder_delete") ||
234   - ($action == "folder_property") ||
235   - ($action == "folder_modify")) {
236   - //if the user is not the creator
237   - if ($userid != $foldercreator) {
238   - $authorization = "0";
239   - } else {
240   - $authorization = "1";
241   - }
242   - } else {
243   - $authorization = "1";
244   - }
245   - }
246   -
247   - //if the policy is: anyone can upload/create folders
248   - if ($policy == "51") {
249   - $authorization = "1";
250   - }
251   -
252   - //if the policy is: only the group can read folders
253   - if ($policy == "52") {
254   - if (($action == "folder_delete") ||
255   - ($action == "folder_property") ||
256   - ($action == "folder_modify")) {
257   - if ($userid != $foldercreator) {
258   - $authorization = "0";
259   - } else {
260   - $authorization = "1";
261   - }
262   - } else {
263   - // Bozz Change Begin
264   - $sql = new Owl_DB;
265   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'");
266   - if ($foldergroup == $usergroup || $sql->num_rows($sql) > 0) {
267   - // Bozz Change End
268   - $authorization = "1";
269   - } else {
270   - $authorization = "0";
271   - }
272   - }
273   -
274   - }
275   -
276   - //if the policy is: only the group can upload/create folders
277   - if ($policy == "53") {
278   - if (($action == "folder_delete") ||
279   - ($action == "folder_modify") ||
280   - ($action == "folder_property") ||
281   - ($action == "folder_view")) {
282   - // Bozz Change Begin
283   - $sql = new Owl_DB;
284   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'");
285   - //if the user is not in the group
286   - if ($usergroup != $foldergroup && $sql->num_rows($sql) == 0) {
287   - // Bozz Change End
288   - $authorization = "0";
289   - } else {
290   - $authorization = "1";
291   - }
292   - }
293   - }
294   -
295   - //if the policy is: only the creator can upload/change files
296   - if ($policy == "54") {
297   - //if the user is the creator
298   - if ($foldercreator == $userid) {
299   - $authorization = "1";
300   - } else {
301   - $authorization = "0";
302   - }
303   - }
304   -
305   - //if the policy is: only the group can upload/create folders but not delete; except the creator
306   - if ($policy == "55") {
307   - if (($action == "folder_modify") || ($action == "folder_view")) {
308   - // Bozz Change Begin
309   - $sql = new Owl_DB;
310   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'");
311   - if ($usergroup != $foldergroup && $sql->num_rows($sql) == 0) {
312   - // Bozz Change End
313   - $authorization = "0";
314   - } else {
315   - $authorization = "1";
316   - }
317   - }
318   - if (($action == "folder_delete") ||
319   - ($action == "folder_property")) {
320   - if ($foldercreator == $userid) {
321   - $authorization = "1";
322   - } else {
323   - $authorization = "0";
324   - }
325   - }
326   - }
327   - //if the policy is: anyone can upload/create folders but not delete
328   - if ($policy == "56") {
329   - $authorization = "1";
330   - if (($action == "folder_delete") ||
331   - ($action == "folder_property")) {
332   - //if the user is the creator
333   - if ($foldercreator == $userid) {
334   - $authorization = "1";
335   - } else {
336   - $authorization = "0";
337   - }
338   - }
339   - }
340   -
341   - //if the policy is: only the group can upload/create folders but anyone can read
342   - if ($policy == "57") {
343   - if (($action == "folder_modify") || ($action == "folder_delete")) {
344   - $sql = new Owl_DB;
345   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'");
346   - //if the user is not in the group
347   - if (($usergroup != $foldergroup) && ($sql->num_rows($sql) == 0)) {
348   - $authorization = "0";
349   - } else {
350   - $authorization = "1";
351   - }
352   - }
353   - if ($action == "folder_property") {
354   - //if the user is the creator
355   - if ($foldercreator == $userid) {
356   - $authorization = "1";
357   - } else {
358   - $authorization = "0";
359   - }
360   - }
361   - if ($action == "folder_view") {
362   - $authorization = "1";
363   - }
364   - }
365   - //if the policy is: only the group can upload/create folders (no delete) but anyone can read
366   - if ($policy == "58") {
367   - if ($action == "folder_modify") {
368   - $sql = new Owl_DB;
369   - $sql->query("SELECT * FROM $default->owl_users_grpmem_table WHERE userid = '$userid' and groupid = '$foldergroup'");
370   - //if the user is not in the group
371   - if ($usergroup != $foldergroup && $sql->num_rows($sql) == 0) {
372   - $authorization = "0";
373   - } else {
374   - $authorization = "1";
375   - }
376   - }
377   - if ($action == "folder_property") {
378   - //if the user is the creator
379   - if ($foldercreator == $userid) {
380   - $authorization = "1";
381   - } else {
382   - $authorization = "0";
383   - }
384   - }
385   - if ($action == "folder_delete") {
386   - //if the user is the creator
387   - if ($foldercreator == $userid) {
388   - $authorization = "1";
389   - } else {
390   - $authorization = "0";
391   - }
392   - }
393   - if ($action == "folder_view") {
394   - $authorization = "1";
395   - }
396   - }
397   -
398   -// Bozz Change Begin
399   -// I Think that the Admin Group should
400   -// have the same rights as the admin user
401   - if ($userid == 1 || $usergroup == 0) {
402   -// Bozz Change End
403   - $authorization = "1";
404   - }
405   -// cv change bug #504298
406   -// this call must be recursive through the parent directories
407   -
408   - // continue recursion?
409   - if( $authorization == 1 ) {
410   - if( ($policy > 49) && ($id == 1) ) {
411   - // stop if we are at the doc root
412   - return $authorization;
413   - } else {
414   - // continue;
415   - if($policy < 50) {
416   - $parent = owlfileparent($id);
417   - } else {
418   - $parent = owlfolderparent($id);
419   - }
420   - return check_auth($parent, "folder_view", $userid);
421   - }
422   - } else {
423   - // dont continue because authorization is 0
424   - return $authorization;
425   - }
426   -}
lib/styles.css deleted
1   -. {
2   -font-size : 9pt;
3   -font-family : Verdana, sans-serif;
4   -font-weight : lighter;
5   -font-style : normal;
6   -color : #000000;
7   -text-decoration: none;
8   -}
9   -
10   -P {
11   -font-size : 9pt;
12   -font-family : Verdana, sans-serif;
13   -font-weight : lighter;
14   -font-style : normal;
15   -color : #000000;
16   -text-decoration: none;
17   -
18   -
19   -}
20   -
21   -P.footer {
22   -font-size : 9pt;
23   -font-family : Verdana, sans-serif;
24   -font-weight : lighter;
25   -font-style : normal;
26   -color : #999999;
27   -text-decoration: none;
28   -
29   -
30   -}
31   -
32   -P.title {
33   -font-size : 9pt;
34   -font-family : Verdana, sans-serif;
35   -font-weight : inherit;
36   -font-style : normal;
37   -color : #ffffff;
38   -text-decoration: none;
39   -}
40   -
41   -
42   -A {
43   -font-size : 10pt;
44   -font-family : Verdana, sans-serif;
45   -font-style : normal;
46   -color : #000000;
47   -text-decoration: none;
48   -}
49   -
50   -
51   -A:Visited {
52   -font-size : 10pt;
53   -font-family : Verdana, sans-serif;
54   -font-style : normal;
55   -color : #000000;
56   -text-decoration: none;
57   -}
58   -
59   -A:Active {
60   -color : #000000;
61   -font-size : 10pt;
62   -font-family : Verdana, sans-serif;
63   -font-style : normal;
64   -text-decoration: none;
65   -}
66   -
67   -A:hover {
68   -color : #000000;
69   -font-size : 10pt;
70   -font-family : Verdana,sans-serif;
71   -font-style : normal;
72   -text-decoration: none;
73   -background-color : #FFFACD;
74   -}
75   -
76   -INPUT:active {
77   - font-size : 9pt;
78   - font-family : Verdana,sans-serif;
79   -}