Commit ded28f014f610056a7498e6add256d95f531f46a
1 parent
383456fb
phpdocumentation completed
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@31 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
15 changed files
with
2846 additions
and
1717 deletions
admin/admin_dbmodify.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/* | |
| 4 | - * admin_dbmodify.php | |
| 3 | +/* admin_dbmodify.php | |
| 4 | + * | |
| 5 | + * this is used to modify the db | |
| 5 | 6 | * |
| 6 | 7 | * Copyright (c) 1999-2002 The Owl Project Team |
| 7 | 8 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | - * | |
| 9 | - * $Id$ | |
| 10 | - */ | |
| 9 | + * @version v 1.1.1.1 2002/12/04 | |
| 10 | + * @author michael | |
| 11 | + * @package Owl | |
| 12 | +*/ | |
| 13 | + | |
| 11 | 14 | require("../config/owl.php"); |
| 12 | 15 | require("../lib/owl.lib.php"); |
| 13 | 16 | require("../config/html.php"); |
| 14 | 17 | |
| 15 | -if(owlusergroup($userid) != 0) exit("$lang_err_unauth_area"); | |
| 16 | - | |
| 18 | +// if not authorised exit from area | |
| 19 | +if(owlusergroup($userid) != 0) | |
| 20 | +{ | |
| 21 | + exit("$lang_err_unauth_area"); | |
| 22 | +} | |
| 17 | 23 | |
| 18 | -if($action == "user") { | |
| 24 | +// action selected is user | |
| 25 | +if($action == "user") | |
| 26 | +{ | |
| 27 | + //increment sessions | |
| 19 | 28 | $maxsessions = $maxsessions - 1; // always is stored - 1 |
| 29 | + //open connection | |
| 20 | 30 | $sql = new Owl_DB; |
| 21 | 31 | $sql->query("SELECT * FROM $default->owl_users_table WHERE id = '$id'"); |
| 22 | 32 | $sql->next_record(); |
| 23 | 33 | $newpass = $sql->f("password"); |
| 24 | - if ($newpass == $password) { | |
| 34 | + | |
| 35 | + // update password | |
| 36 | + if ($newpass == $password) | |
| 37 | + { | |
| 25 | 38 | $sql->query("UPDATE $default->owl_users_table SET groupid='$groupid',username='$loginname',name='$name',password='$password',quota_max='$quota', email='$email',notify='$notify',email='$email',attachfile='$attachfile',disabled='$disabled',noprefaccess='$noprefaccess',language='$newlanguage',maxsessions='$maxsessions' where id = '$id'"); |
| 26 | 39 | } |
| 27 | 40 | else |
| ... | ... | @@ -31,13 +44,14 @@ if($action == "user") { |
| 31 | 44 | // Bozz Change BEGIN |
| 32 | 45 | |
| 33 | 46 | // Clean Up the member group table first |
| 34 | - | |
| 35 | 47 | $sql->query("DELETE FROM $default->owl_users_grpmem_table WHERE userid = $id"); |
| 36 | 48 | |
| 37 | 49 | // Insert the new Choices the member group table with selected groups |
| 38 | - for ( $i = 0 ; $i <= $no_groups_displayed; $i++ ) { | |
| 50 | + for ( $i = 0 ; $i <= $no_groups_displayed; $i++ ) | |
| 51 | + { | |
| 39 | 52 | $checkboxfields = 'group' . $i; |
| 40 | - if($$checkboxfields != '') { | |
| 53 | + if($$checkboxfields != '') | |
| 54 | + { | |
| 41 | 55 | $checkboxvalue = $$checkboxfields; |
| 42 | 56 | $sql->query("INSERT INTO $default->owl_users_grpmem_table (userid,groupid) VALUES ('$id', '$checkboxvalue')"); |
| 43 | 57 | } |
| ... | ... | @@ -46,7 +60,10 @@ if($action == "user") { |
| 46 | 60 | header("Location: index.php?sess=$sess&action=users&owluser=$id&change=1"); |
| 47 | 61 | } |
| 48 | 62 | |
| 49 | -if($action == "group") { | |
| 63 | +// if action selected is group | |
| 64 | +if($action == "group") | |
| 65 | +{ | |
| 66 | + //update the group table | |
| 50 | 67 | global $default; |
| 51 | 68 | $sql = new Owl_DB; |
| 52 | 69 | $sql->query("UPDATE $default->owl_groups_table SET name='$name' where id = '$id'"); |
| ... | ... | @@ -54,8 +71,13 @@ if($action == "group") { |
| 54 | 71 | } |
| 55 | 72 | |
| 56 | 73 | // BEGIN BUG FIX: #448232 mistake in admin_dbmodify.php |
| 57 | -if($action == $lang_deleteuser) { | |
| 74 | + | |
| 75 | +// if action is delete user | |
| 76 | +if($action == $lang_deleteuser) | |
| 77 | +{ | |
| 58 | 78 | // END BUG FIX: #448232 mistake in admin_dbmodify.php |
| 79 | + | |
| 80 | + //delete the user | |
| 59 | 81 | $sql = new Owl_DB; |
| 60 | 82 | $sql->query("DELETE FROM $default->owl_users_table WHERE id = '$id'"); |
| 61 | 83 | // Bozz Change Begin |
| ... | ... | @@ -65,7 +87,10 @@ if($action == $lang_deleteuser) { |
| 65 | 87 | header("Location: index.php?sess=$sess&action=users"); |
| 66 | 88 | } |
| 67 | 89 | |
| 68 | -if($action == "edhtml") { | |
| 90 | +// if action is edit html | |
| 91 | +if($action == "edhtml") | |
| 92 | +{ | |
| 93 | + //update html settings | |
| 69 | 94 | $sql = new Owl_DB; |
| 70 | 95 | $sql->query("UPDATE $default->owl_html_table SET table_border='$border', table_header_bg='$header_bg', table_cell_bg='$cell_bg',table_cell_bg_alt='$cell_bg_alt',body_bgcolor='$body_bgcolor',body_textcolor='$body_textcolor',body_link='$body_link',body_vlink='$body_vlink',table_expand_width='$expand_width',table_collapse_width='$collapse_width', main_header_bgcolor='$main_header_bgcolor' "); |
| 71 | 96 | |
| ... | ... | @@ -73,9 +98,11 @@ if($action == "edhtml") { |
| 73 | 98 | |
| 74 | 99 | } |
| 75 | 100 | |
| 101 | +//if action is edit prefernces | |
| 76 | 102 | if($action == "edprefs") { |
| 77 | 103 | $sql = new Owl_DB; |
| 78 | 104 | |
| 105 | + //update the preferences | |
| 79 | 106 | if ($lookAtHD != "false" ) |
| 80 | 107 | $lookAtHD = "true"; |
| 81 | 108 | if ($owl_expand != "1") |
| ... | ... | @@ -89,42 +116,64 @@ if($action == "edprefs") { |
| 89 | 116 | } |
| 90 | 117 | |
| 91 | 118 | // BEGIN BUG FIX: #448232 mistake in admin_dbmodify.php |
| 92 | -if($action == $lang_deletegroup ) { | |
| 119 | +// if action is delete group | |
| 120 | +if($action == $lang_deletegroup ) | |
| 121 | +{ | |
| 93 | 122 | // END BUG FIX: #448232 mistake in admin_dbmodify.php |
| 123 | + | |
| 124 | + //delete specified group | |
| 94 | 125 | global $default; |
| 95 | 126 | $sql = new Owl_DB; |
| 96 | 127 | $sql->query("DELETE FROM $default->owl_groups_table WHERE id = '$id'"); |
| 97 | 128 | header("Location: index.php?sess=$sess&action=groups"); |
| 98 | 129 | } |
| 99 | 130 | |
| 100 | -if($action == "add") { | |
| 101 | - if($type == "user") { | |
| 131 | +// if action selected is add | |
| 132 | +if($action == "add") | |
| 133 | +{ | |
| 134 | + // if user to be added insert user into db | |
| 135 | + if($type == "user") | |
| 136 | + { | |
| 102 | 137 | $maxsessions = $maxsessions - 1; // always is stored - 1 |
| 103 | 138 | $sql = new Owl_DB; |
| 104 | 139 | $sql->query("SELECT * FROM $default->owl_users_table WHERE username = '$loginname'"); |
| 105 | - if($sql->num_rows($sql) > 0) die ("$lang_err_user_exists"); | |
| 140 | + | |
| 141 | + //check if user exists | |
| 142 | + if($sql->num_rows($sql) > 0) | |
| 143 | + { | |
| 144 | + die ("$lang_err_user_exists"); | |
| 145 | + } | |
| 146 | + | |
| 106 | 147 | $sql->query("INSERT INTO $default->owl_users_table (groupid,username,name,password,quota_max,quota_current,email,notify,attachfile,disabled,noprefaccess,language,maxsessions) VALUES ('$groupid', '$loginname', '$name', '" . md5($password) . "', '$quota', '0', '$email', '$notify','$attachfile', '$disabled', '$noprefaccess', '$newlanguage', '$maxsessions')"); |
| 107 | 148 | // Bozz Change BEGIN |
| 108 | 149 | // Populated the member group table with selected groups |
| 109 | 150 | $sql->query("SELECT id FROM $default->owl_users_table WHERE username = '$loginname'"); |
| 110 | 151 | $sql->next_record(); |
| 111 | 152 | $newuid = $sql->f("id"); |
| 112 | - for ( $i = 0 ; $i <= $no_groups_displayed; $i++ ) { | |
| 113 | - $checkboxfields = 'group' . $i; | |
| 114 | - if($$checkboxfields != '') { | |
| 115 | - $checkboxvalue = $$checkboxfields; | |
| 116 | - $sql->query("INSERT INTO $default->owl_users_grpmem_table (userid,groupid) VALUES ('$newuid', '$checkboxvalue')"); | |
| 117 | - } | |
| 153 | + | |
| 154 | + for ( $i = 0 ; $i <= $no_groups_displayed; $i++ ) | |
| 155 | + { | |
| 156 | + $checkboxfields = 'group' . $i; | |
| 157 | + if($$checkboxfields != '') | |
| 158 | + { | |
| 159 | + $checkboxvalue = $$checkboxfields; | |
| 160 | + $sql->query("INSERT INTO $default->owl_users_grpmem_table (userid,groupid) VALUES ('$newuid', '$checkboxvalue')"); | |
| 161 | + } | |
| 118 | 162 | } |
| 119 | 163 | /* Bozz Change END */ |
| 120 | - if($home == "1") { | |
| 164 | + | |
| 165 | + // set home folder???? | |
| 166 | + if($home == "1") | |
| 167 | + { | |
| 121 | 168 | $sql->query("select * from $default->owl_users_table where username = '$loginname'"); |
| 122 | 169 | while($sql->next_record()) $id = $sql->f("id"); |
| 123 | 170 | $sql->query("insert into $default->owl_folders_table values (0, '$loginname', '2', '54', '$groupid', '$id')"); |
| 124 | 171 | mkdir($default->owl_fs_root."/".fid_to_name("1")."/Home/$loginname", 0777); |
| 125 | 172 | } |
| 126 | 173 | header("Location: index.php?sess=$sess"); |
| 127 | - } elseif($type == "group") { | |
| 174 | + } | |
| 175 | + elseif($type == "group") | |
| 176 | + { | |
| 128 | 177 | $sql = new Owl_DB; |
| 129 | 178 | $sql->query("INSERT INTO $default->owl_groups_table (name) VALUES ('$name')"); |
| 130 | 179 | header("Location: index.php?sess=$sess"); | ... | ... |
admin/index.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/* | |
| 3 | +/** | |
| 4 | 4 | * index.php |
| 5 | 5 | * |
| 6 | + * This is the index page for the admin | |
| 7 | + * | |
| 6 | 8 | * Copyright (c) 1999-2002 The Owl Project Team |
| 7 | 9 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | - * | |
| 9 | - * $Id$ | |
| 10 | + * @version v 1.1.1.1 2002/12/04 | |
| 11 | + * @author michael | |
| 12 | + * @package Owl | |
| 10 | 13 | */ |
| 14 | + | |
| 11 | 15 | |
| 12 | 16 | require("../config/owl.php"); |
| 13 | 17 | require("../lib/owl.lib.php"); |
| 14 | 18 | require("../config/html.php"); |
| 15 | 19 | |
| 16 | - | |
| 17 | -if($action == "backup") dobackup(); | |
| 20 | +// action selected is to backup then doBackup function is called | |
| 21 | +if($action == "backup") | |
| 22 | +{ | |
| 23 | + dobackup(); | |
| 24 | +} | |
| 18 | 25 | |
| 19 | 26 | include("../lib/header.inc"); |
| 20 | 27 | print("<CENTER>"); |
| 21 | 28 | |
| 22 | -if($usergroupid != "0") die("$lang_err_unauthorized"); | |
| 29 | +// if usergroupid invalid then unauthorised view and exit | |
| 30 | +if($usergroupid != "0") | |
| 31 | +{ | |
| 32 | + die("$lang_err_unauthorized"); | |
| 33 | +} | |
| 23 | 34 | |
| 24 | -if(!isset($action)) $action = "users"; | |
| 35 | +// if not action set ..set action to users | |
| 36 | +if(!isset($action)) | |
| 37 | +{ | |
| 38 | + $action = "users"; | |
| 39 | +} | |
| 25 | 40 | |
| 26 | -function printusers() { | |
| 41 | +//------------------------------------------------------------- | |
| 42 | +/** | |
| 43 | + * Function PrintUsers | |
| 44 | + * | |
| 45 | + * Prints the users out | |
| 46 | + * | |
| 47 | + */ | |
| 48 | +//------------------------------------------------------------- | |
| 49 | +// Semi-Usable - Interface based | |
| 50 | +function printusers() | |
| 51 | +{ | |
| 27 | 52 | global $sess, $default, $lang_users; |
| 28 | 53 | |
| 54 | + //create a new connection | |
| 29 | 55 | $sql = new Owl_DB; |
| 56 | + // create a new active session | |
| 30 | 57 | $sql_active_sess = new Owl_DB; |
| 31 | 58 | |
| 59 | + | |
| 32 | 60 | $sql->query("select username,name,id,maxsessions from $default->owl_users_table order by name"); |
| 33 | 61 | |
| 34 | 62 | |
| ... | ... | @@ -64,18 +92,21 @@ function printusers() { |
| 64 | 92 | |
| 65 | 93 | print("<TABLE BORDER=$default->table_border><TR><TD BGCOLOR=$default->table_header_bg>$lang_users</TD><TD BGCOLOR=$default->table_header_bg> </TD></TR>"); |
| 66 | 94 | |
| 67 | - | |
| 95 | + | |
| 68 | 96 | while($sql->next_record()) { |
| 97 | + // loop through record getting user information | |
| 69 | 98 | $uid = $sql->f("id"); |
| 70 | 99 | $username = $sql->f("username"); |
| 71 | 100 | $name = $sql->f("name"); |
| 72 | 101 | $maxsess = $sql->f("maxsessions") + 1; |
| 73 | 102 | $numrows = 0; |
| 74 | 103 | |
| 104 | + // find active sessions | |
| 75 | 105 | $sql_active_sess->query("select * from $default->owl_sessions_table where uid = $uid"); |
| 76 | 106 | $sql_active_sess->next_record(); |
| 77 | 107 | $numrows = $sql_active_sess->num_rows($sql_active_sess); |
| 78 | 108 | |
| 109 | + // print out information ->not usable | |
| 79 | 110 | if ($name == "") |
| 80 | 111 | print("<TR><TD align=left><A HREF='index.php?sess=$sess&action=users&owluser=".$uid."'>".$username."</A></TD>"); |
| 81 | 112 | else |
| ... | ... | @@ -85,24 +116,53 @@ function printusers() { |
| 85 | 116 | print("</TABLE>"); |
| 86 | 117 | } |
| 87 | 118 | |
| 88 | -function printgroups() { | |
| 119 | +//------------------------------------------------------------- | |
| 120 | +/** | |
| 121 | + * Function PrintGroups | |
| 122 | + * | |
| 123 | + * Prints the Groups out | |
| 124 | + * | |
| 125 | + */ | |
| 126 | +//------------------------------------------------------------- | |
| 127 | +// Semi-Usable -> Interface Based | |
| 128 | +function printgroups() | |
| 129 | +{// print out all groups | |
| 89 | 130 | global $sess, $lang_groups, $default; |
| 90 | 131 | $sql = new Owl_DB; |
| 91 | 132 | $sql->query("select name,id from $default->owl_groups_table order by name"); |
| 92 | 133 | print("<TABLE BORDER=$default->table_border><TR><TD BGCOLOR=$default->table_header_bg>$lang_groups</TD></TR>"); |
| 93 | - while($sql->next_record()) { | |
| 134 | + | |
| 135 | + while($sql->next_record()) | |
| 136 | + { | |
| 94 | 137 | print("<TR><TD align=left><A HREF='index.php?sess=$sess&action=groups&group=".$sql->f("id")."'>".$sql->f("name")."</A></TD></TR>"); |
| 95 | 138 | } |
| 96 | 139 | print("</TABLE>"); |
| 97 | 140 | } |
| 98 | 141 | |
| 99 | -function printuser($id) { | |
| 142 | +//------------------------------------------------------------- | |
| 143 | +/** | |
| 144 | + * Function PrintUsr($id) | |
| 145 | + * | |
| 146 | + * Prints the User out | |
| 147 | + * | |
| 148 | + * @param $id | |
| 149 | + * The Id of the user who's info is to be printed | |
| 150 | + * | |
| 151 | + */ | |
| 152 | +//------------------------------------------------------------- | |
| 153 | +// Semi-Usable -> Interface Based | |
| 154 | +function printuser($id) | |
| 155 | +{ //declare globals | |
| 100 | 156 | global $sess,$change,$lang_saved,$lang_title,$lang_group,$lang_username,$lang_password,$lang_change,$lang_quota,$lang_groupmember,$lang_noprefaccess,$lang_disableuser, $lang_userlang, $lang_maxsessions, $lang_attach_file; |
| 101 | 157 | global $lang_flush_sessions_alt, $lang_flushed, $lang_deleteuser, $lang_email, $lang_notification, $default, $flush; |
| 102 | 158 | |
| 103 | - if($change == 1) print("$lang_saved<BR>"); | |
| 159 | + if($change == 1) | |
| 160 | + { | |
| 161 | + print("$lang_saved<BR>"); | |
| 162 | + } | |
| 104 | 163 | |
| 105 | - if ($flush == 1) { | |
| 164 | + if ($flush == 1) | |
| 165 | + { | |
| 106 | 166 | flushsessions($id, $sess); |
| 107 | 167 | print($lang_flushed); |
| 108 | 168 | } |
| ... | ... | @@ -110,13 +170,19 @@ function printuser($id) { |
| 110 | 170 | $sql = new Owl_DB; |
| 111 | 171 | $sql->query("select id,name from $default->owl_groups_table order by name"); |
| 112 | 172 | $i=0; |
| 113 | - while($sql->next_record()) { | |
| 173 | + | |
| 174 | + // store groups in array | |
| 175 | + while($sql->next_record()) | |
| 176 | + { | |
| 114 | 177 | $groups[$i][0] = $sql->f("id"); |
| 115 | 178 | $groups[$i][1] = $sql->f("name"); |
| 116 | 179 | $i++; |
| 117 | 180 | } |
| 118 | 181 | $sql->query("select * from $default->owl_users_table where id = '$id'"); |
| 119 | - while($sql->next_record()) { | |
| 182 | + | |
| 183 | + //post to dbmodify any changes and their values | |
| 184 | + while($sql->next_record()) | |
| 185 | + { | |
| 120 | 186 | print("<FORM ACTION='admin_dbmodify.php' METHOD=POST>"); |
| 121 | 187 | print("<INPUT TYPE=HIDDEN NAME=id VALUE=".$sql->f("id").">"); |
| 122 | 188 | print("<INPUT TYPE=HIDDEN NAME=sess VALUE=$sess>"); |
| ... | ... | @@ -124,7 +190,8 @@ function printuser($id) { |
| 124 | 190 | print("<TABLE BORDER=$default->table_border><TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_title</TD><TD align=left><INPUT TYPE=text NAME=name VALUE='".$sql->f("name")."'></TD></TR>"); |
| 125 | 191 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_group</TD><TD align=left><SELECT NAME=groupid>"); |
| 126 | 192 | print("<OPTION VALUE=".$sql->f("groupid").">".group_to_name($sql->f("groupid"))); |
| 127 | - foreach($groups as $g) { | |
| 193 | + foreach($groups as $g) | |
| 194 | + { | |
| 128 | 195 | print("<OPTION VALUE=$g[0]>$g[1]"); |
| 129 | 196 | } |
| 130 | 197 | print("</SELECT></TD></TR>"); |
| ... | ... | @@ -146,17 +213,22 @@ function printuser($id) { |
| 146 | 213 | // Bozz Change begin |
| 147 | 214 | //This is to allow a user to be part of more than one group |
| 148 | 215 | |
| 216 | + // assign a user to more than one group | |
| 149 | 217 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_groupmember</TD><TD align=left>"); |
| 150 | 218 | $i=0; |
| 151 | 219 | $sqlmemgroup = new Owl_DB; |
| 152 | - foreach($groups as $g) { | |
| 220 | + foreach($groups as $g) | |
| 221 | + { | |
| 153 | 222 | $is_set_gid = $g[0]; |
| 154 | 223 | $sqlmemgroup->query("select userid from $default->owl_users_grpmem_table where userid = '$id' and groupid = '$is_set_gid'"); |
| 155 | 224 | $sqlmemgroup->next_record(); |
| 156 | - if ($sqlmemgroup->num_rows($sqlmemgroup) > 0) { | |
| 225 | + | |
| 226 | + if ($sqlmemgroup->num_rows($sqlmemgroup) > 0) | |
| 227 | + { | |
| 157 | 228 | print("<input type='checkbox' name='group$i' value=$g[0] checked>$g[1]<BR>"); |
| 158 | 229 | } |
| 159 | - else { | |
| 230 | + else | |
| 231 | + { | |
| 160 | 232 | print("<input type='checkbox' name='group$i' value=$g[0]>$g[1]<BR>"); |
| 161 | 233 | } |
| 162 | 234 | $i++; |
| ... | ... | @@ -171,29 +243,59 @@ function printuser($id) { |
| 171 | 243 | print("<TR><TD BGCOLOR=$default->table_header_bg ALIGN=RIGHT>$lang_username</TD><TD align=left><INPUT TYPE=TEXT NAME=loginname VALUE='".$sql->f("username")."'></TD></TR>"); |
| 172 | 244 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_quota</TD><TD align=left>".$sql->f("quota_current")." / <INPUT TYPE=TEXT NAME=quota VALUE=".$sql->f("quota_max")."></TD></TR>"); |
| 173 | 245 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_maxsessions</TD><TD align=left>".($sql->f("maxsessions") + 1)." / <INPUT TYPE=TEXT NAME=maxsessions VALUE=".($sql->f("maxsessions") + 1)."> |
| 174 | -<a href=\"index.php?sess=$sess&action=user&owluser=$id&change=0&flush=1\"><IMG SRC='$default->owl_root_url/graphics/admin_flush.gif' BORDER=0 ALT='$lang_flush_sessions_alt' TITLE='$lang_flush_sessions_alt'></a></TD></TR>"); | |
| 246 | + <a href=\"index.php?sess=$sess&action=user&owluser=$id&change=0&flush=1\"><IMG SRC='$default->owl_root_url/graphics/admin_flush.gif' BORDER=0 ALT='$lang_flush_sessions_alt' TITLE='$lang_flush_sessions_alt'></a></TD></TR>"); | |
| 175 | 247 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_password</TD><TD align=left><INPUT TYPE=PASSWORD NAME=password VALUE='".$sql->f("password")."'></TD></TR>"); |
| 176 | 248 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_email</TD><TD align=left><INPUT TYPE=TEXT NAME=email VALUE='".$sql->f("email")."'></TD></TR>"); |
| 249 | + | |
| 250 | + // if notify is on ..set its value to checked | |
| 177 | 251 | if ( $sql->f("notify") == 1) |
| 178 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_notification</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=notify VALUE=1 checked></TD></TR>"); | |
| 252 | + { | |
| 253 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_notification</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=notify VALUE=1 checked></TD></TR>"); | |
| 254 | + } | |
| 179 | 255 | else |
| 256 | + { | |
| 180 | 257 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_notification</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=notify VALUE=1></TD></TR>"); |
| 258 | + } | |
| 259 | + | |
| 260 | + // if attachfile is on ..set its value to checked | |
| 181 | 261 | if ( $sql->f("attachfile") == 1) |
| 262 | + { | |
| 182 | 263 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_attach_file</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=attachfile VALUE=1 checked></TD></TR>"); |
| 264 | + } | |
| 183 | 265 | else |
| 266 | + { | |
| 184 | 267 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_attach_file</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=attachfile VALUE=1></TD></TR>"); |
| 185 | - if ($id != 1) { | |
| 186 | - if ( $sql->f("disabled") == 1) | |
| 187 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_disableuser</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=disabled VALUE=1 checked></TD></TR>"); | |
| 188 | - else | |
| 189 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_disableuser</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=disabled VALUE=1></TD></TR>"); | |
| 190 | - if ( $sql->f("noprefaccess") == 1) | |
| 191 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_noprefaccess</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=noprefaccess VALUE=1 checked></TD></TR>"); | |
| 192 | - else | |
| 193 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_noprefaccess</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=noprefaccess VALUE=1></TD></TR>"); | |
| 268 | + } | |
| 269 | + | |
| 270 | + | |
| 271 | + if ($id != 1) | |
| 272 | + { | |
| 273 | + // if disabled is on ..set its value to checked | |
| 274 | + if ( $sql->f("disabled") == 1) | |
| 275 | + { | |
| 276 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_disableuser</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=disabled VALUE=1 checked></TD></TR>"); | |
| 277 | + } | |
| 278 | + else | |
| 279 | + { | |
| 280 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_disableuser</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=disabled VALUE=1></TD></TR>"); | |
| 281 | + } | |
| 282 | + | |
| 283 | + // if noprefaccess is on ..set its value to checked | |
| 284 | + if ( $sql->f("noprefaccess") == 1) | |
| 285 | + { | |
| 286 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_noprefaccess</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=noprefaccess VALUE=1 checked></TD></TR>"); | |
| 287 | + } | |
| 288 | + else | |
| 289 | + { | |
| 290 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_noprefaccess</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=noprefaccess VALUE=1></TD></TR>"); | |
| 291 | + } | |
| 194 | 292 | } |
| 293 | + | |
| 195 | 294 | print("</TABLE><BR><INPUT TYPE=SUBMIT VALUE=$lang_change>"); |
| 196 | - if ($sql->f("id") != 1) { | |
| 295 | + | |
| 296 | + // delete user if id != 1 | |
| 297 | + if ($sql->f("id") != 1) | |
| 298 | + { | |
| 197 | 299 | print("<INPUT TYPE=SUBMIT NAME=action VALUE='$lang_deleteuser'>"); |
| 198 | 300 | } |
| 199 | 301 | |
| ... | ... | @@ -201,31 +303,83 @@ function printuser($id) { |
| 201 | 303 | } |
| 202 | 304 | } |
| 203 | 305 | |
| 204 | -function flushsessions($id, $sess) { | |
| 306 | +//------------------------------------------------------------- | |
| 307 | +/** | |
| 308 | + * Function flushsessions($id, $sess) | |
| 309 | + * | |
| 310 | + * Flushes the session variable form the db | |
| 311 | + * | |
| 312 | + * @param $id | |
| 313 | + * The Id of the user | |
| 314 | + * @param $sess | |
| 315 | + * The session variable | |
| 316 | +*/ | |
| 317 | +//------------------------------------------------------------- | |
| 318 | +// Usable | |
| 319 | +function flushsessions($id, $sess) | |
| 320 | +{ | |
| 205 | 321 | global $default; |
| 206 | 322 | $sql= new Owl_DB; |
| 207 | 323 | $sql->query("delete from $default->owl_sessions_table where uid='$id' AND sessid!='$sess'"); |
| 208 | 324 | } |
| 209 | 325 | |
| 210 | 326 | |
| 211 | -function printgroup($id) { | |
| 327 | +//------------------------------------------------------------- | |
| 328 | +/** | |
| 329 | + * Function printgroup($id) | |
| 330 | + * | |
| 331 | + * Prints out the group | |
| 332 | + * | |
| 333 | + * @param $id | |
| 334 | + * The Id of the user | |
| 335 | + * | |
| 336 | +*/ | |
| 337 | +//------------------------------------------------------------- | |
| 338 | +// Semi-Usable -> interface based | |
| 339 | + | |
| 340 | +function printgroup($id) | |
| 341 | +{ | |
| 212 | 342 | global $sess,$change,$lang_title,$lang_change,$lang_deletegroup,$lang_saved,$default; |
| 213 | - if(isset($change)) print("$lang_saved<BR>"); | |
| 343 | + | |
| 344 | + if(isset($change)) | |
| 345 | + { | |
| 346 | + print("$lang_saved<BR>"); | |
| 347 | + } | |
| 348 | + | |
| 214 | 349 | $sql = new Owl_DB; |
| 215 | 350 | $sql->query("select id,name from $default->owl_groups_table where id = '$id'"); |
| 216 | - while($sql->next_record()) { | |
| 351 | + | |
| 352 | + // post to dbmodify with several values | |
| 353 | + while($sql->next_record()) | |
| 354 | + { | |
| 217 | 355 | print("<FORM ACTION='admin_dbmodify.php' METHOD=POST>"); |
| 218 | 356 | print("<INPUT TYPE=HIDDEN NAME=id VALUE=".$sql->f("id").">"); |
| 219 | 357 | print("<INPUT TYPE=HIDDEN NAME=sess VALUE=$sess>"); |
| 220 | 358 | print("<INPUT TYPE=HIDDEN name=action VALUE=group>"); |
| 221 | 359 | print("<TABLE BORDER=$default->table_border><TR><TD BGCOLOR=$default->table_header_bg>$lang_title</TD><TD><INPUT TYPE=text NAME=name VALUE='".$sql->f("name")."'></TD></TR></TABLE>"); |
| 222 | 360 | print("<BR><INPUT TYPE=SUBMIT VALUE=$lang_change>"); |
| 223 | - if($sql->f("id") != 0) print("<INPUT TYPE=SUBMIT NAME=action VALUE='$lang_deletegroup'>"); | |
| 361 | + | |
| 362 | + // delete the group | |
| 363 | + if($sql->f("id") != 0) | |
| 364 | + { | |
| 365 | + print("<INPUT TYPE=SUBMIT NAME=action VALUE='$lang_deletegroup'>"); | |
| 366 | + } | |
| 224 | 367 | print("</FORM>"); |
| 225 | 368 | } |
| 226 | 369 | } |
| 227 | 370 | |
| 228 | -function printnewgroup() { | |
| 371 | +//------------------------------------------------------------- | |
| 372 | +/** | |
| 373 | + * Function printnewgroup() | |
| 374 | + * | |
| 375 | + * Prints out a new group | |
| 376 | + * | |
| 377 | + | |
| 378 | +*/ | |
| 379 | +//------------------------------------------------------------- | |
| 380 | +// NOT Usable | |
| 381 | +function printnewgroup() | |
| 382 | +{ | |
| 229 | 383 | global $default, $sess,$lang_title,$lang_add; |
| 230 | 384 | print("<FORM ACTION='admin_dbmodify.php' METHOD=post>"); |
| 231 | 385 | print("<INPUT TYPE=HIDDEN NAME=action VALUE=add>"); |
| ... | ... | @@ -234,13 +388,24 @@ function printnewgroup() { |
| 234 | 388 | print("<TABLE BORDER=$default->table_border><TR><TD BGCOLOR=$default->table_header_bg>$lang_title</TD><TD><INPUT TYPE=TEXT NAME=name></TD></TR></TABLE><BR><INPUT TYPE=SUBMIT VALUE=$lang_add></FORM>"); |
| 235 | 389 | } |
| 236 | 390 | |
| 391 | +//------------------------------------------------------------- | |
| 392 | +/** | |
| 393 | + * Function printnewuserr() | |
| 394 | + * | |
| 395 | + * Prints out a new user | |
| 396 | + * | |
| 397 | +*/ | |
| 398 | +//------------------------------------------------------------- | |
| 399 | +// Semi-Usable | |
| 237 | 400 | function printnewuser() { |
| 238 | 401 | global $sess,$lang_title,$lang_username,$lang_group,$lang_password,$lang_add,$default, $lang_quota,$lang_groupmember; |
| 239 | 402 | global $lang_email, $lang_notification, $lang_noprefaccess, $lang_disableuser, $lang_userlang, $lang_maxsessions, $lang_attach_file; |
| 240 | 403 | $sql = new Owl_DB; |
| 241 | 404 | $sql->query("select id,name from $default->owl_groups_table order by name"); |
| 242 | 405 | $i=0; |
| 243 | - while($sql->next_record()) { | |
| 406 | + // get all groups | |
| 407 | + while($sql->next_record()) | |
| 408 | + { | |
| 244 | 409 | $groups[$i][0] = $sql->f("id"); |
| 245 | 410 | $groups[$i][1] = $sql->f("name"); |
| 246 | 411 | $i++; |
| ... | ... | @@ -252,30 +417,32 @@ function printnewuser() { |
| 252 | 417 | print("<TABLE BORDER=$default->table_border><TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_title</TD><TD align=left><INPUT TYPE=TEXT NAME=name></TD></TR>"); |
| 253 | 418 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_username</TD><TD align=left><INPUT TYPE=TEXT NAME=loginname></TD></TR>"); |
| 254 | 419 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_group</TD><TD align=left><SELECT NAME=groupid>"); |
| 255 | - foreach($groups as $g) { | |
| 420 | + | |
| 421 | + foreach($groups as $g) | |
| 422 | + { | |
| 256 | 423 | print("<OPTION VALUE=$g[0]>$g[1]"); |
| 257 | 424 | } |
| 258 | 425 | print("</SELECT></TD></TR>"); |
| 259 | 426 | //******************************* |
| 260 | 427 | // Display the Language dropdown |
| 261 | 428 | //******************************* |
| 262 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_userlang</TD><TD align=left><SELECT NAME=newlanguage>"); | |
| 263 | - $dir = dir($default->owl_LangDir); | |
| 264 | - $dir->rewind(); | |
| 429 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_userlang</TD><TD align=left><SELECT NAME=newlanguage>"); | |
| 430 | + $dir = dir($default->owl_LangDir); | |
| 431 | + $dir->rewind(); | |
| 265 | 432 | |
| 266 | - while($file=$dir->read()) | |
| 267 | - { | |
| 268 | - if ($file != "." and $file != "..") | |
| 269 | - { | |
| 270 | - //janu's change BEGIN | |
| 271 | - print("<OPTION VALUE=$file"); | |
| 272 | - if ($file == $default->owl_lang) | |
| 273 | - print (" SELECTED"); | |
| 274 | - print(">$file"); | |
| 275 | - //janu's change END | |
| 276 | - } | |
| 277 | - } | |
| 278 | - $dir->close(); | |
| 433 | + while($file=$dir->read()) | |
| 434 | + { | |
| 435 | + if ($file != "." and $file != "..") | |
| 436 | + { | |
| 437 | + //janu's change BEGIN | |
| 438 | + print("<OPTION VALUE=$file"); | |
| 439 | + if ($file == $default->owl_lang) | |
| 440 | + print (" SELECTED"); | |
| 441 | + print(">$file"); | |
| 442 | + //janu's change END | |
| 443 | + } | |
| 444 | + } | |
| 445 | + $dir->close(); | |
| 279 | 446 | print("</SELECT></TD></TR>"); |
| 280 | 447 | |
| 281 | 448 | // Bozz Change begin |
| ... | ... | @@ -283,7 +450,8 @@ function printnewuser() { |
| 283 | 450 | |
| 284 | 451 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_groupmember</TD><TD align=left>"); |
| 285 | 452 | $i=0; |
| 286 | - foreach($groups as $g) { | |
| 453 | + foreach($groups as $g) | |
| 454 | + { | |
| 287 | 455 | print("<input type='checkbox' name='group$i' value=$g[0]>$g[1]<BR>"); |
| 288 | 456 | $i++; |
| 289 | 457 | } |
| ... | ... | @@ -302,6 +470,15 @@ function printnewuser() { |
| 302 | 470 | print("</TABLE><BR><INPUT TYPE=SUBMIT VALUE=$lang_add></FORM>"); |
| 303 | 471 | } |
| 304 | 472 | |
| 473 | +//------------------------------------------------------------- | |
| 474 | +/** | |
| 475 | + * Function printHTML() | |
| 476 | + * | |
| 477 | + * Prints out the required HTML | |
| 478 | + * | |
| 479 | + */ | |
| 480 | +//------------------------------------------------------------- | |
| 481 | +// NOT Usable | |
| 305 | 482 | function printhtml() { |
| 306 | 483 | global $default, $sess, $lang_add, $lang_change, $change, $lang_saved; |
| 307 | 484 | global $lang_ht_tbl_border_sz, $lang_ht_tbl_hd_bg, $lang_ht_tbl_cell_bg_cl, $lang_ht_tbl_cell_bg_al, $lang_ht_tbl_bg_cl, $lang_ht_expand_width, $lang_ht_collapse_width, $lang_ht_bd_bg_cl, $lang_ht_bd_txt_cl, $lang_ht_bd_lnk_cl, $lang_ht_bd_vlnk_cl, $lang_ht_bd_width; |
| ... | ... | @@ -335,7 +512,15 @@ function printhtml() { |
| 335 | 512 | <TD align=left><INPUT TYPE=TEXT NAME=body_vlink VALUE='$default->body_vlink'></TD></TR>"); |
| 336 | 513 | print("</TABLE><BR><INPUT TYPE=SUBMIT VALUE=$lang_change></FORM>"); |
| 337 | 514 | } |
| 338 | - | |
| 515 | +//------------------------------------------------------------- | |
| 516 | +/** | |
| 517 | + * Function printPrefs() | |
| 518 | + * | |
| 519 | + * Prints out the preferences in a specific format | |
| 520 | + * | |
| 521 | + */ | |
| 522 | +//------------------------------------------------------------- | |
| 523 | +// NOT Usable | |
| 339 | 524 | function printprefs() { |
| 340 | 525 | global $default, $sess, $lang_add, $lang_change, $change, $lang_saved; |
| 341 | 526 | global $lang_owl_title_email, $lang_owl_email_from, $lang_owl_email_fromname, $lang_owl_email_replyto , $lang_owl_email_server, $lang_owl_title_HD, $lang_owl_lookAtHD, $lang_owl_def_file_security, $lang_owl_def_file_group_owner, $lang_owl_def_file_owner, $lang_owl_def_file_title, $lang_owl_def_file_meta , $lang_owl_def_fold_sec, $lang_owl_def_fold_group_owner, $lang_owl_def_fold_owner, $lang_owl_title_other, $lang_owl_max_filesize, $lang_owl_owl_timeout, $lang_owl_owl_expand, $lang_owl_version_control, $lang_owl_restrict_view ; |
| ... | ... | @@ -358,7 +543,8 @@ function printprefs() { |
| 358 | 543 | <TD align=left><INPUT TYPE=TEXT NAME=email_server VALUE='$default->owl_email_server' size=30></TD></TR>"); |
| 359 | 544 | print("<TR><TD BGCOLOR=$default->main_header_bgcolor align=CENTER colspan=2>$lang_owl_title_HD</TD></TR>"); |
| 360 | 545 | |
| 361 | - if ( $default->owl_LookAtHD == "false" ){ | |
| 546 | + if ( $default->owl_LookAtHD == "false" ) | |
| 547 | + { | |
| 362 | 548 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_lookAtHD</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=lookAtHD VALUE='false' checked></TD></TR>"); |
| 363 | 549 | print("<INPUT TYPE=HIDDEN NAME=def_file_security VALUE='$default->owl_def_file_security'>"); |
| 364 | 550 | print("<INPUT TYPE=HIDDEN NAME=def_file_group_owner VALUE='$default->owl_def_file_group_owner'>"); |
| ... | ... | @@ -369,103 +555,138 @@ function printprefs() { |
| 369 | 555 | print("<INPUT TYPE=HIDDEN NAME=def_fold_group_owner VALUE='$default->owl_def_fold_group_owner'>"); |
| 370 | 556 | print("<INPUT TYPE=HIDDEN NAME=def_fold_owner VALUE='$default->owl_def_fold_owner'>"); |
| 371 | 557 | } |
| 372 | - else { | |
| 558 | + else | |
| 559 | + { | |
| 373 | 560 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_lookAtHD</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=lookAtHD VALUE='false'></TD></TR>"); |
| 374 | 561 | printfileperm($default->owl_def_file_security, "def_file_security", $lang_owl_def_file_security, "user"); |
| 375 | 562 | |
| 376 | - | |
| 377 | - | |
| 378 | 563 | $sql = new Owl_DB; |
| 379 | 564 | $sql->query("select id,name from $default->owl_groups_table"); |
| 380 | 565 | $i=0; |
| 381 | - while($sql->next_record()) { | |
| 566 | + // get all groups | |
| 567 | + while($sql->next_record()) | |
| 568 | + { | |
| 382 | 569 | $groups[$i][0] = $sql->f("id"); |
| 383 | 570 | $groups[$i][1] = $sql->f("name"); |
| 384 | 571 | $i++; |
| 385 | - } | |
| 572 | + } | |
| 386 | 573 | print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_owl_def_file_group_owner</TD><TD align=left><SELECT NAME=def_file_group_owner>"); |
| 387 | - foreach($groups as $g) { | |
| 388 | - print("<OPTION VALUE=$g[0] "); | |
| 389 | - if($g[0] == $default->owl_def_file_group_owner) | |
| 390 | - print("SELECTED"); | |
| 391 | - print(">$g[1]"); | |
| 392 | - } | |
| 574 | + | |
| 575 | + // loop through all groups | |
| 576 | + foreach($groups as $g) | |
| 577 | + { | |
| 578 | + print("<OPTION VALUE=$g[0] "); | |
| 579 | + if($g[0] == $default->owl_def_file_group_owner) | |
| 580 | + print("SELECTED"); | |
| 581 | + print(">$g[1]"); | |
| 582 | + } | |
| 393 | 583 | print("</SELECT></TD></TR>"); |
| 394 | 584 | $sql = new Owl_DB; |
| 395 | 585 | $sql->query("select id,name from $default->owl_users_table"); |
| 396 | 586 | $i=0; |
| 397 | - while($sql->next_record()) { | |
| 587 | + | |
| 588 | + // get all users | |
| 589 | + while($sql->next_record()) | |
| 590 | + { | |
| 398 | 591 | $users[$i][0] = $sql->f("id"); |
| 399 | 592 | $users[$i][1] = $sql->f("name"); |
| 400 | 593 | $i++; |
| 401 | 594 | } |
| 402 | 595 | print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_owl_def_file_owner</TD><TD align=left><SELECT NAME=def_file_owner>"); |
| 403 | - foreach($users as $g) { | |
| 404 | - print("<OPTION VALUE=$g[0] "); | |
| 405 | - if($g[0] == $default->owl_def_file_owner) | |
| 406 | - print("SELECTED"); | |
| 407 | - print(">$g[1]"); | |
| 408 | - } | |
| 409 | - print("</SELECT></TD></TR>"); | |
| 596 | + | |
| 597 | + loop through users | |
| 598 | + foreach($users as $g) | |
| 599 | + { | |
| 600 | + print("<OPTION VALUE=$g[0] "); | |
| 601 | + if($g[0] == $default->owl_def_file_owner) | |
| 602 | + print("SELECTED"); | |
| 603 | + print(">$g[1]"); | |
| 604 | + } | |
| 605 | + print("</SELECT></TD></TR>"); | |
| 410 | 606 | |
| 411 | 607 | |
| 412 | 608 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_def_file_title</TD> |
| 413 | - <TD align=left><INPUT TYPE=TEXT NAME=def_file_title VALUE='$default->owl_def_file_title' size=40></TD></TR>"); | |
| 609 | + <TD align=left><INPUT TYPE=TEXT NAME=def_file_title VALUE='$default->owl_def_file_title' size=40></TD></TR>"); | |
| 414 | 610 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_def_file_meta</TD> |
| 415 | - <TD align=left><INPUT TYPE=TEXT NAME=def_file_meta VALUE='$default->owl_def_file_meta' size=40></TD></TR>"); | |
| 416 | - | |
| 417 | - printgroupperm($default->owl_def_fold_security, "def_fold_security", $lang_owl_def_fold_sec, "user"); | |
| 418 | - | |
| 419 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_owl_def_fold_group_owner</TD><TD align=left><SELECT NAME=def_fold_group_owner>"); | |
| 420 | - foreach($groups as $g) { | |
| 421 | - print("<OPTION VALUE=$g[0] "); | |
| 422 | - if($g[0] == $default->owl_def_fold_group_owner) | |
| 423 | - print("SELECTED"); | |
| 424 | - print(">$g[1]"); | |
| 425 | - } | |
| 426 | - print("</SELECT></TD></TR>"); | |
| 611 | + <TD align=left><INPUT TYPE=TEXT NAME=def_file_meta VALUE='$default->owl_def_file_meta' size=40></TD></TR>"); | |
| 612 | + | |
| 613 | + printgroupperm($default->owl_def_fold_security, "def_fold_security", $lang_owl_def_fold_sec, "user"); | |
| 614 | + | |
| 615 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_owl_def_fold_group_owner</TD><TD align=left><SELECT NAME=def_fold_group_owner>"); | |
| 616 | + foreach($groups as $g) | |
| 617 | + { | |
| 618 | + print("<OPTION VALUE=$g[0] "); | |
| 619 | + if($g[0] == $default->owl_def_fold_group_owner) | |
| 620 | + print("SELECTED"); | |
| 621 | + print(">$g[1]"); | |
| 622 | + } | |
| 623 | + print("</SELECT></TD></TR>"); | |
| 427 | 624 | |
| 428 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_owl_def_fold_owner</TD><TD align=left><SELECT NAME=def_fold_owner>"); | |
| 429 | - foreach($users as $g) { | |
| 430 | - print("<OPTION VALUE=$g[0] "); | |
| 431 | - if($g[0] == $default->owl_def_fold_owner) | |
| 432 | - print("SELECTED"); | |
| 433 | - print(">$g[1]"); | |
| 434 | - } | |
| 435 | - print("</SELECT></TD></TR>"); | |
| 625 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_owl_def_fold_owner</TD><TD align=left><SELECT NAME=def_fold_owner>"); | |
| 626 | + foreach($users as $g) | |
| 627 | + { | |
| 628 | + print("<OPTION VALUE=$g[0] "); | |
| 629 | + if($g[0] == $default->owl_def_fold_owner) | |
| 630 | + print("SELECTED"); | |
| 631 | + print(">$g[1]"); | |
| 632 | + } | |
| 633 | + print("</SELECT></TD></TR>"); | |
| 436 | 634 | |
| 437 | 635 | } |
| 438 | 636 | print("<TR><TD BGCOLOR=$default->main_header_bgcolor align=CENTER colspan=2>$lang_owl_title_other</TD></TR>"); |
| 439 | 637 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_max_filesize</TD> |
| 440 | - <TD align=left><INPUT TYPE=TEXT NAME=max_filesize VALUE='$default->max_filesize'></TD></TR>"); | |
| 638 | + <TD align=left><INPUT TYPE=TEXT NAME=max_filesize VALUE='$default->max_filesize'></TD></TR>"); | |
| 441 | 639 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_owl_timeout</TD> |
| 442 | - <TD align=left><INPUT TYPE=TEXT NAME=owl_timeout VALUE='$default->owl_timeout'></TD></TR>"); | |
| 640 | + <TD align=left><INPUT TYPE=TEXT NAME=owl_timeout VALUE='$default->owl_timeout'></TD></TR>"); | |
| 443 | 641 | |
| 642 | + //if expansion is true | |
| 444 | 643 | if ( $default->expand == 1 ) |
| 445 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_owl_expand</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=owl_expand VALUE=1 checked></TD></TR>"); | |
| 446 | - else | |
| 447 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_owl_expand:</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=owl_expand VALUE=1></TD></TR>"); | |
| 448 | - | |
| 644 | + { | |
| 645 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_owl_expand</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=owl_expand VALUE=1 checked></TD></TR>"); | |
| 646 | + } | |
| 647 | + else | |
| 648 | + { | |
| 649 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_owl_expand:</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=owl_expand VALUE=1></TD></TR>"); | |
| 650 | + } | |
| 651 | + | |
| 652 | + // if version control checked | |
| 449 | 653 | if ( $default->owl_version_control == 1 ) |
| 450 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_version_control</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=version_control VALUE=1 checked></TD></TR>"); | |
| 451 | - else | |
| 452 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_version_control</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=version_control VALUE=1></TD></TR>"); | |
| 654 | + { | |
| 655 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_version_control</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=version_control VALUE=1 checked></TD></TR>"); | |
| 656 | + } | |
| 657 | + else | |
| 658 | + { | |
| 659 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_version_control</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=version_control VALUE=1></TD></TR>"); | |
| 660 | + } | |
| 453 | 661 | |
| 662 | + // restrict view checked if true | |
| 454 | 663 | if ( $default->restrict_view == 1 ) |
| 455 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_restrict_view</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=restrict_view VALUE=1 checked></TD></TR>"); | |
| 456 | - else | |
| 457 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_restrict_view</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=restrict_view VALUE=1></TD></TR>"); | |
| 664 | + { | |
| 665 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_restrict_view</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=restrict_view VALUE=1 checked></TD></TR>"); | |
| 666 | + } | |
| 667 | + else | |
| 668 | + { print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_restrict_view</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=restrict_view VALUE=1></TD></TR>"); | |
| 669 | + } | |
| 458 | 670 | |
| 459 | 671 | print("<TR><TD BGCOLOR=$default->main_header_bgcolor align=CENTER colspan=2>$lang_owl_title_tools</TD></TR>"); |
| 460 | 672 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_dbdump_path</TD> |
| 461 | - <TD align=left><INPUT TYPE=TEXT NAME=dbdump_path VALUE='$default->dbdump_path' size=30></TD></TR>"); | |
| 673 | + <TD align=left><INPUT TYPE=TEXT NAME=dbdump_path VALUE='$default->dbdump_path' size=30></TD></TR>"); | |
| 462 | 674 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_gzip_path</TD> |
| 463 | - <TD align=left><INPUT TYPE=TEXT NAME=gzip_path VALUE='$default->gzip_path' size=30></TD></TR>"); | |
| 675 | + <TD align=left><INPUT TYPE=TEXT NAME=gzip_path VALUE='$default->gzip_path' size=30></TD></TR>"); | |
| 464 | 676 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_owl_tar_path</TD> |
| 465 | - <TD align=left><INPUT TYPE=TEXT NAME=tar_path VALUE='$default->tar_path' size=30></TD></TR>"); | |
| 677 | + <TD align=left><INPUT TYPE=TEXT NAME=tar_path VALUE='$default->tar_path' size=30></TD></TR>"); | |
| 466 | 678 | print("</TABLE><BR><INPUT TYPE=SUBMIT VALUE=$lang_change></FORM>"); |
| 467 | 679 | } |
| 468 | 680 | |
| 681 | +//------------------------------------------------------------- | |
| 682 | +/** | |
| 683 | + * Function DoBackup() | |
| 684 | + * | |
| 685 | + * Does a backup by zipping relevant data | |
| 686 | + * | |
| 687 | + */ | |
| 688 | +//------------------------------------------------------------- | |
| 689 | +// NOT Usable | |
| 469 | 690 | function dobackup() { |
| 470 | 691 | global $default; |
| 471 | 692 | |
| ... | ... | @@ -484,7 +705,7 @@ function dobackup() { |
| 484 | 705 | } |
| 485 | 706 | |
| 486 | 707 | |
| 487 | - | |
| 708 | +// if action has been selected..do it.. | |
| 488 | 709 | if($action) { |
| 489 | 710 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| 490 | 711 | print("<TR><TD WIDTH=200 VALIGN=TOP>"); |
| ... | ... | @@ -503,26 +724,60 @@ if($action) { |
| 503 | 724 | print("<A HREF='index.php?sess=$sess&action=newgroup'><IMG SRC='$default->owl_root_url/graphics/admin_groups.gif' BORDER=0 ALT='$lang_newgroup_alt' TITLE='$lang_newgroup_alt'></A><BR>"); |
| 504 | 725 | print("<A HREF='index.php?sess=$sess&action=edhtml'><IMG SRC='$default->owl_root_url/graphics/admin_html_prefs.gif' BORDER=0 ALT='$lang_edthtml_alt' TITLE='$lang_edthtml_alt'></A><BR>"); |
| 505 | 726 | print("<A HREF='index.php?sess=$sess&action=edprefs'><IMG SRC='$default->owl_root_url/graphics/admin_site_prefs.gif' BORDER=0 ALT='$lang_edprefs_alt' TITLE='$lang_edprefs_alt'></A><BR>"); |
| 506 | - if (file_exists($default->dbdump_path) && file_exists($default->gzip_path)) { | |
| 727 | + | |
| 728 | + if (file_exists($default->dbdump_path) && file_exists($default->gzip_path)) | |
| 729 | + { | |
| 507 | 730 | print("<A HREF='index.php?sess=$sess&action=backup'><IMG SRC='$default->owl_root_url/graphics/admin_backup.gif' BORDER=0 ALT='$lang_backup_alt' TITLE='$lang_backup_alt'></A><BR><BR>"); |
| 508 | 731 | } |
| 509 | 732 | else { |
| 510 | 733 | print("<IMG SRC='$default->owl_root_url/graphics/admin_backup_disabled.gif' BORDER=0 ALT='$lang_backup_dis_alt' TITLE='$lang_backup_dis_alt'></A><BR><BR>"); |
| 511 | 734 | } |
| 735 | + | |
| 512 | 736 | // print("<A HREF='upgrade-users.php?sess=$sess'>$lang_upg_MD5</A><BR><BR>"); |
| 513 | 737 | printusers(); |
| 514 | 738 | print("<BR><BR>"); |
| 515 | 739 | printgroups(); |
| 516 | 740 | print("</TD></TR></TABLE>"); |
| 517 | 741 | print("</TD><TD VALIGN=TOP>"); |
| 518 | - if(isset($owluser)) printuser($owluser); | |
| 519 | - if(isset($group)) printgroup($group); | |
| 520 | - if($action == "newgroup") printnewgroup(); | |
| 521 | - if($action == "newuser") printnewuser(); | |
| 522 | - if($action == "edhtml") printhtml(); | |
| 523 | - if($action == "edprefs") printprefs(); | |
| 742 | + // if user action selected..print user | |
| 743 | + if(isset($owluser)) | |
| 744 | + { | |
| 745 | + printuser($owluser); | |
| 746 | + } | |
| 747 | + | |
| 748 | + //if group action selected print group | |
| 749 | + if(isset($group)) | |
| 750 | + { | |
| 751 | + printgroup($group); | |
| 752 | + } | |
| 753 | + | |
| 754 | + // if newgroup action slelected print the new group | |
| 755 | + if($action == "newgroup") | |
| 756 | + { | |
| 757 | + printnewgroup(); | |
| 758 | + } | |
| 759 | + | |
| 760 | + // if the newuser action print the new user | |
| 761 | + if($action == "newuser") | |
| 762 | + { | |
| 763 | + printnewuser(); | |
| 764 | + } | |
| 765 | + | |
| 766 | + //if the edit html action has been selected run the printHTML | |
| 767 | + if($action == "edhtml") | |
| 768 | + { | |
| 769 | + printhtml(); | |
| 770 | + } | |
| 771 | + | |
| 772 | + // if edit preferences selected print the preferences | |
| 773 | + if($action == "edprefs") | |
| 774 | + { | |
| 775 | + printprefs(); | |
| 776 | + } | |
| 524 | 777 | print("</TD></TR></TABLE>"); |
| 525 | -} else { | |
| 778 | +} | |
| 779 | +else | |
| 780 | +{ | |
| 526 | 781 | exit("$lang_err_general"); |
| 527 | 782 | } |
| 528 | 783 | ... | ... |
admin/upgrade-users.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/* | |
| 4 | - | |
| 5 | - File: upgrade-users.php | |
| 6 | - Author: Chris | |
| 7 | - Date: 2001/01/24 | |
| 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 | - | |
| 3 | +/** | |
| 4 | + * upgrade-users.php | |
| 5 | + * | |
| 6 | + * This is used to upgrade a user's password | |
| 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 | + | |
| 18 | 15 | require("../config/owl.php"); |
| 19 | 16 | require("../lib/owl.lib.php"); |
| 20 | 17 | require("../config/html.php"); |
| 21 | 18 | |
| 19 | +// this page is used to upgrade a user's password | |
| 22 | 20 | print("<CENTER>"); |
| 23 | 21 | print("********************** WARNING WARNING WARNING ****************************<BR>"); |
| 24 | 22 | print("********************** WARNING WARNING WARNING ****************************<BR>"); |
| ... | ... | @@ -30,13 +28,17 @@ print("Running through $default->owl_users_table<BR>"); |
| 30 | 28 | $sql = new Owl_DB; |
| 31 | 29 | $sql->query("select * from $default->owl_users_table"); |
| 32 | 30 | $sqlupd = new Owl_DB; |
| 33 | -while($sql->next_record()) { | |
| 31 | +while($sql->next_record()) | |
| 32 | +{ | |
| 34 | 33 | $userid = $sql->f("id"); |
| 35 | 34 | $password = $sql->f("password"); |
| 36 | - if (strlen($password) <> 32) { | |
| 35 | + if (strlen($password) <> 32) | |
| 36 | + { | |
| 37 | 37 | $sqlupd->query("update $default->owl_users_table set password='" . md5($password) . "' where id = '$userid'"); |
| 38 | 38 | print "Updated user id $userid: ".$sql->f("username")."<BR>"; |
| 39 | - } else { | |
| 39 | + } | |
| 40 | + else | |
| 41 | + { | |
| 40 | 42 | print "ALREADY UPGRADED -> $userid: ".$sql->f("username")."<BR>"; |
| 41 | 43 | } |
| 42 | 44 | } | ... | ... |
browse.php
| 1 | 1 | <?php |
| 2 | -/** | |
| 2 | +/* | |
| 3 | 3 | * browse.php -- Browse page |
| 4 | - * | |
| 5 | - * Browse a list of files/folders | |
| 6 | 4 | * |
| 7 | 5 | * Copyright (c) 1999-2002 The Owl Project Team |
| 8 | 6 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| ... | ... | @@ -24,7 +22,7 @@ if(!isset($sortname)) $sortname = "ASC"; |
| 24 | 22 | // Daphne change |
| 25 | 23 | if(!isset($sortver)) $sortver = "ASC, minor_revision ASC"; |
| 26 | 24 | if(!isset($sortcheckedout)) $sortcheckedout = "ASC"; |
| 27 | -// end Daphne change | |
| 25 | +// end daphne change | |
| 28 | 26 | if(!isset($sortfilename)) $sortfilename = "DESC"; |
| 29 | 27 | if(!isset($sortsize)) $sortsize = "DESC"; |
| 30 | 28 | if(!isset($sortposted)) $sortposted = "DESC"; |
| ... | ... | @@ -69,7 +67,6 @@ switch ($order) { |
| 69 | 67 | // END 496814 Column Sorts are not persistant |
| 70 | 68 | |
| 71 | 69 | |
| 72 | -//if the user does not have permission to view the folder | |
| 73 | 70 | if(check_auth($parent, "folder_view", $userid) != "1") { |
| 74 | 71 | printError($lang_nofolderaccess,""); |
| 75 | 72 | exit; |
| ... | ... | @@ -126,47 +123,40 @@ if ($expand == 1) { |
| 126 | 123 | print("\t\t<HR WIDTH=$default->table_collapse_width>\n"); |
| 127 | 124 | } |
| 128 | 125 | |
| 129 | -/** | |
| 130 | -* Creates links that can be sorted | |
| 131 | -* | |
| 132 | -* @param $column current column | |
| 133 | -* @param $sortname | |
| 134 | -* @param $sortvalue ASC or DESC | |
| 135 | -* @param $order column to order by | |
| 136 | -* @param $sess | |
| 137 | -* @param $expand | |
| 138 | -* @param $parent | |
| 139 | -* @param $lang_title | |
| 140 | -* @param $url | |
| 141 | -*/ | |
| 142 | - | |
| 126 | +// | |
| 127 | +// functions to create/show the links to be sorted on | |
| 128 | +// | |
| 143 | 129 | function show_link($column,$sortname,$sortvalue,$order,$sess,$expand,$parent,$lang_title,$url) { |
| 144 | 130 | |
| 145 | - if ($sortvalue == "ASC") { | |
| 146 | - print("\t\t\t\t<TD align=left><A HREF='browse.php?sess=$sess&expand=$expand&parent=$parent&order=$column&$sortname=DESC' STYLE='toplink'>$lang_title"); | |
| 147 | - if ($order == $column) | |
| 148 | - { | |
| 149 | - print("<img border='0' src='$url/graphics/asc.gif' width='16' height='16'></A></TD>"); | |
| 150 | - } | |
| 151 | - else | |
| 152 | - { | |
| 153 | - print("</A></TD>"); | |
| 154 | - } | |
| 155 | - | |
| 156 | - } | |
| 157 | - else { | |
| 158 | - print("\t\t\t\t<TD align=left><A HREF='browse.php?sess=$sess&expand=$expand&parent=$parent&order=$column&$sortname=ASC' STYLE='toplink'>$lang_title"); | |
| 159 | - if ($order == $column) | |
| 160 | - { | |
| 161 | - print("<img border='0' src='$url/graphics/desc.gif' width='16' height='16'></A></TD>"); | |
| 162 | - } | |
| 163 | - else { | |
| 164 | - print("</A></TD>"); | |
| 165 | - } | |
| 166 | - } | |
| 131 | + if ($sortvalue == "ASC") | |
| 132 | + { | |
| 133 | + print("\t\t\t\t<TD align=left><A HREF='browse.php?sess=$sess&expand=$expand&parent=$parent&order=$column&$sortname=DESC' STYLE='toplink'>$lang_title"); | |
| 134 | + if ($order == $column) | |
| 135 | + { | |
| 136 | + print("<img border='0' src='$url/graphics/asc.gif' width='16' height='16'></A></TD>"); | |
| 137 | + } | |
| 138 | + else | |
| 139 | + { | |
| 140 | + print("</A></TD>"); | |
| 141 | + } | |
| 142 | + | |
| 143 | + } | |
| 144 | + else | |
| 145 | + { | |
| 146 | + print("\t\t\t\t<TD align=left><A HREF='browse.php?sess=$sess&expand=$expand&parent=$parent&order=$column&$sortname=ASC' STYLE='toplink'>$lang_title"); | |
| 147 | + if ($order == $column) | |
| 148 | + { | |
| 149 | + print("<img border='0' src='$url/graphics/desc.gif' width='16' height='16'></A></TD>"); | |
| 150 | + } | |
| 151 | + else | |
| 152 | + { | |
| 153 | + print("</A></TD>"); | |
| 154 | + } | |
| 155 | + } | |
| 167 | 156 | } |
| 168 | 157 | |
| 169 | 158 | |
| 159 | + | |
| 170 | 160 | if ($expand == 1) { |
| 171 | 161 | print("\t\t\t<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border><TR BGCOLOR='$default->table_header_bg'>"); |
| 172 | 162 | show_link("name","sortname",$sortname,$order,$sess,$expand,$parent,$lang_title,$default->owl_root_url); |
| ... | ... | @@ -219,9 +209,7 @@ if ($order == "creatorid") { |
| 219 | 209 | //********************** |
| 220 | 210 | |
| 221 | 211 | while($sql->next_record()) { |
| 222 | - //if the current user has a restricted view | |
| 223 | 212 | if($default->restrict_view == 1) { |
| 224 | - //if the current user does not have permission to view the folder | |
| 225 | 213 | if(!check_auth($sql->f("id"), "folder_view", $userid)) |
| 226 | 214 | continue; |
| 227 | 215 | } | ... | ... |
dbmodify.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/** | |
| 3 | +/* | |
| 4 | 4 | * dbmodify.php |
| 5 | 5 | * |
| 6 | - * Performs all file (upload, update, modify, email) and folder (create, modify) | |
| 7 | - * maintenance and management. | |
| 8 | - * | |
| 9 | 6 | * Copyright (c) 1999-2002 The Owl Project Team |
| 10 | 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 11 | 8 | * |
| 12 | 9 | * $Id$ |
| 13 | - * @todo line 28, 47, 53- refactor | |
| 14 | 10 | */ |
| 15 | 11 | |
| 16 | 12 | require("./config/owl.php"); |
| ... | ... | @@ -19,591 +15,598 @@ require("./config/html.php"); |
| 19 | 15 | require("./lib/security.lib.php"); |
| 20 | 16 | require("phpmailer/class.phpmailer.php"); |
| 21 | 17 | |
| 22 | -/** | |
| 23 | - * Lookup the path to the parent of the passed folder. | |
| 24 | - * | |
| 25 | - * @param $folderID the id of the child folder | |
| 26 | - * @return string the name of the parent folder | |
| 27 | - */ | |
| 28 | -function find_path($folderID) { | |
| 29 | - global $default; | |
| 30 | - $path = fid_to_name($folderID); | |
| 31 | - $sql = new Owl_DB; | |
| 32 | - while($folderID != 1) { | |
| 33 | - $sql->query("select parent from $default->owl_folders_table where id = '$folderID'"); | |
| 34 | - while($sql->next_record()) { | |
| 35 | - $path = fid_to_name($sql->f("parent"))."/".$path; | |
| 36 | - $folderID = $sql->f("parent"); | |
| 37 | - } | |
| 18 | +function find_path($parent) { | |
| 19 | + global $default; | |
| 20 | + $path = fid_to_name($parent); | |
| 21 | + $sql = new Owl_DB; | |
| 22 | + while($parent != 1) { | |
| 23 | + $sql->query("select parent from $default->owl_folders_table where id = '$parent'"); | |
| 24 | + while($sql->next_record()) { | |
| 25 | + $path = fid_to_name($sql->f("parent"))."/".$path; | |
| 26 | + $parent = $sql->f("parent"); | |
| 27 | + } | |
| 38 | 28 | } |
| 39 | 29 | return $path; |
| 40 | 30 | } |
| 41 | 31 | |
| 42 | -/** | |
| 43 | - * Recursively deletes a folder from the database | |
| 44 | - * | |
| 45 | - * @param $folderID the ID of the folder to delete | |
| 46 | - */ | |
| 47 | -function delTree($folderID) { | |
| 32 | +function delTree($fid) { | |
| 48 | 33 | global $fCount, $folderList, $default; |
| 49 | 34 | //delete from database |
| 50 | 35 | $sql = new Owl_DB; |
| 51 | - $sql->query("delete from $default->owl_folders_table where id = '$folderID'"); | |
| 52 | - $sql->query("delete from $default->owl_files_table where parent = '$folderID'"); | |
| 53 | - for ($c=0; $c < $fCount; $c++) { | |
| 54 | - if ($folderList[$c][2]==$folderID) { | |
| 55 | - delTree($folderList[$c][0]); | |
| 56 | - } | |
| 57 | - } | |
| 36 | + $sql->query("delete from $default->owl_folders_table where id = '$fid'"); | |
| 37 | + $sql->query("delete from $default->owl_files_table where parent = '$fid'"); | |
| 38 | + for ($c=0; $c < $fCount; $c++) { | |
| 39 | + if ($folderList[$c][2]==$fid) { | |
| 40 | + delTree($folderList[$c][0]); | |
| 41 | + } | |
| 42 | + } | |
| 58 | 43 | } |
| 59 | 44 | |
| 60 | 45 | // Begin 496814 Column Sorts are not persistant |
| 61 | 46 | // + ADDED &order=$order&$sortorder=$sortname to |
| 62 | 47 | // all browse.php? header and HREF LINES |
| 48 | + | |
| 63 | 49 | switch ($order) { |
| 64 | - case "name": | |
| 65 | - $sortorder = 'sortname'; | |
| 66 | - break; | |
| 67 | - case "major_revision": | |
| 68 | - $sortorder = 'sortver'; | |
| 69 | - break; | |
| 70 | - case "filename" : | |
| 71 | - $sortorder = 'sortfilename'; | |
| 72 | - break; | |
| 73 | - case "size" : | |
| 74 | - $sortorder = 'sortsize'; | |
| 75 | - break; | |
| 76 | - case "creatorid" : | |
| 77 | - $sortorder = 'sortposted'; | |
| 78 | - break; | |
| 79 | - case "smodified" : | |
| 80 | - $sortorder = 'sortmod'; | |
| 81 | - break; | |
| 82 | - case "checked_out": | |
| 83 | - $sortorder = 'sortcheckedout'; | |
| 84 | - break; | |
| 85 | - default: | |
| 86 | - break; | |
| 50 | + case "name": | |
| 51 | + $sortorder = 'sortname'; | |
| 52 | + break; | |
| 53 | + case "major_revision": | |
| 54 | + $sortorder = 'sortver'; | |
| 55 | + break; | |
| 56 | + case "filename" : | |
| 57 | + $sortorder = 'sortfilename'; | |
| 58 | + break; | |
| 59 | + case "size" : | |
| 60 | + $sortorder = 'sortsize'; | |
| 61 | + break; | |
| 62 | + case "creatorid" : | |
| 63 | + $sortorder = 'sortposted'; | |
| 64 | + break; | |
| 65 | + case "smodified" : | |
| 66 | + $sortorder = 'sortmod'; | |
| 67 | + break; | |
| 68 | + case "checked_out": | |
| 69 | + $sortorder = 'sortcheckedout'; | |
| 70 | + break; | |
| 71 | + default: | |
| 72 | + break; | |
| 87 | 73 | } |
| 88 | -// END 496814 Column Sorts are not persistant | |
| 89 | 74 | |
| 75 | +// END 496814 Column Sorts are not persistant | |
| 90 | 76 | // BEGIN BUG FIX: #433932 Fileupdate and Quotas |
| 91 | 77 | if($action == "file_update") { |
| 92 | - if(check_auth($parent, "folder_modify", $userid) == 1) { | |
| 93 | - //if($title == "") exit($lang_specifyname); | |
| 94 | - $userfile = uploadCompat("userfile"); | |
| 95 | - $sql = new Owl_DB; | |
| 96 | - $sql->query("select * from $default->owl_users_table where id = '$userid'"); | |
| 78 | + if(check_auth($parent, "folder_modify", $userid) == 1) { | |
| 79 | + //if($title == "") exit($lang_specifyname); | |
| 80 | + $userfile = uploadCompat("userfile"); | |
| 81 | + $sql = new Owl_DB; | |
| 82 | + $sql->query("select * from $default->owl_users_table where id = '$userid'"); | |
| 97 | 83 | while($sql->next_record()) { |
| 98 | - $quota_max = $sql->f("quota_max"); | |
| 99 | - $quota_current = $sql->f("quota_current"); | |
| 100 | - //$new_quota = $quota_current + $userfile_size; | |
| 84 | + $quota_max = $sql->f("quota_max"); | |
| 85 | + $quota_current = $sql->f("quota_current"); | |
| 86 | + //$new_quota = $quota_current + $userfile_size; | |
| 101 | 87 | } |
| 102 | 88 | $new_name = ereg_replace("[^-A-Za-z0-9._]", "", ereg_replace(" ", "_", ereg_replace("%20|^-", "_", $userfile["name"]))); |
| 103 | 89 | $newpath = $default->owl_FileDir."/".find_path($parent)."/".$new_name; |
| 104 | 90 | |
| 105 | - /* Begin Daphne Change - backups of files | |
| 106 | - * If user requests automatic backups of files | |
| 107 | - * get current details from db and save file state information | |
| 108 | - */ | |
| 109 | - if ($default->owl_version_control == 1) { | |
| 110 | - if ($default->owl_use_fs) { | |
| 111 | - $sql->query("select * from $default->owl_files_table where filename='$new_name' and parent='$parent'"); | |
| 112 | - } else { | |
| 113 | - // this is guaranteed to get the ID of the most recent revision, just in case we're updating a previous rev. | |
| 114 | - $sql->query("select distinct b.* from $default->owl_files_table as a, $default->owl_files_table as b where b.id='$id' AND a.name=b.name AND a.parent=b.parent order by major_revision, minor_revision desc"); | |
| 115 | - } | |
| 91 | + /* Begin Daphne Change - backups of files | |
| 92 | + * If user requests automatic backups of files | |
| 93 | + * get current details from db and save file state information | |
| 94 | + */ | |
| 95 | + if ($default->owl_version_control == 1) { | |
| 96 | + | |
| 97 | + if ($default->owl_use_fs) | |
| 98 | + { | |
| 99 | + $sql->query("select * from $default->owl_files_table where filename='$new_name' and parent='$parent'"); | |
| 100 | + } | |
| 101 | + else | |
| 102 | + { | |
| 103 | + // this is guaranteed to get the ID of the most recent revision, just in case we're updating a previous rev. | |
| 104 | + $sql->query("select distinct b.* from $default->owl_files_table as a, $default->owl_files_table as b where b.id='$id' AND a.name=b.name AND a.parent=b.parent order by major_revision, minor_revision desc"); | |
| 105 | + } | |
| 116 | 106 | //$query = "select b.* from $default->owl_files_table as a, $default->owl_files_table as b where a.id='$id' AND a.name=b.name AND a.parent=b.parent order by major_revision, minor_revision desc"; |
| 117 | 107 | //printError("QU: $query"); |
| 118 | 108 | |
| 119 | - while($sql->next_record()) { | |
| 120 | - // save state information | |
| 121 | - $major_revision = $backup_major = $sql->f("major_revision"); | |
| 122 | - $minor_revision = $backup_minor = $sql->f("minor_revision"); | |
| 123 | - $backup_filename = $sql->f("filename"); | |
| 124 | - $backup_name = $sql->f("name"); | |
| 125 | - $backup_size = $sql->f("size"); | |
| 126 | - $backup_creatorid = $sql->f("creatorid"); | |
| 127 | - $backup_modified = $sql->f("modified"); | |
| 128 | - $backup_smodified = $sql->f("smodified"); | |
| 129 | - $backup_description = $sql->f("description"); | |
| 130 | - $backup_description = ereg_replace("'","\\'",$backup_description); | |
| 131 | - $backup_metadata = $sql->f("metadata"); | |
| 132 | - $backup_parent = $sql->f("parent"); | |
| 133 | - $backup_security = $sql->f("security"); | |
| 134 | - $backup_groupid = $groupid = $sql->f("groupid"); | |
| 135 | - | |
| 136 | - $new_quota = $quota_current - $backup_size + $userfile['size']; | |
| 137 | - $filename = $sql->f(filename); | |
| 138 | - $title = $sql->f(name); | |
| 139 | - $description = $sql->f(description); | |
| 140 | - | |
| 141 | - if ($default->owl_use_fs) { | |
| 142 | - if ($default->owl_FileDir."/".find_path($parent)."/".$sql->f(filename) != $newpath) { | |
| 143 | - printError("$lang_err_file_update",""); | |
| 144 | - } | |
| 109 | + while($sql->next_record()) { | |
| 110 | + // save state information | |
| 111 | + $major_revision = $backup_major = $sql->f("major_revision"); | |
| 112 | + $minor_revision = $backup_minor = $sql->f("minor_revision"); | |
| 113 | + $backup_filename = $sql->f("filename"); | |
| 114 | + $backup_name = $sql->f("name"); | |
| 115 | + $backup_size = $sql->f("size"); | |
| 116 | + $backup_creatorid = $sql->f("creatorid"); | |
| 117 | + $backup_modified = $sql->f("modified"); | |
| 118 | + $backup_smodified = $sql->f("smodified"); | |
| 119 | + $backup_description = $sql->f("description"); | |
| 120 | + $backup_description = ereg_replace("'","\\'",$backup_description); | |
| 121 | + $backup_metadata = $sql->f("metadata"); | |
| 122 | + $backup_parent = $sql->f("parent"); | |
| 123 | + $backup_security = $sql->f("security"); | |
| 124 | + $backup_groupid = $groupid = $sql->f("groupid"); | |
| 125 | + | |
| 126 | + $new_quota = $quota_current - $backup_size + $userfile['size']; | |
| 127 | + $filename = $sql->f(filename); | |
| 128 | + $title = $sql->f(name); | |
| 129 | + $description = $sql->f(description); | |
| 130 | + | |
| 131 | + if ($default->owl_use_fs) | |
| 132 | + { | |
| 133 | + if ($default->owl_FileDir."/".find_path($parent)."/".$sql->f(filename) != $newpath) | |
| 134 | + printError("$lang_err_file_update",""); | |
| 135 | + } | |
| 136 | + | |
| 137 | + } | |
| 145 | 138 | } |
| 146 | - } | |
| 147 | - } | |
| 148 | - // End Daphne Change | |
| 149 | - | |
| 139 | + | |
| 140 | + // End Daphne Change | |
| 141 | + | |
| 150 | 142 | //$newpath = $default->owl_fs_root."/".find_path($parent)."/".$new_name; |
| 151 | 143 | //$newpath = $default->owl_FileDir."/".find_path($parent)."/".$new_name; |
| 152 | - //***neller: Read data from database | |
| 153 | - //$sql->query("select * from $default->owl_files_table where id='$id'"); | |
| 154 | - //while($sql->next_record()) { | |
| 155 | - //if ($default->owl_fs_root."/".find_path($parent)."/".$sql->f(filename) != $newpath) { | |
| 156 | - //if ($default->owl_FileDir."/".find_path($parent)."/".$sql->f(filename) != $newpath) { | |
| 157 | - //printError("$lang_err_file_update",""); | |
| 158 | - //} | |
| 159 | - //$new_quota = $quota_current - $sql->f(size) + $userfile_size; | |
| 160 | - //$filename = $sql->f(filename); | |
| 161 | - //$title = $sql->f(name); | |
| 162 | - //$description = $sql->f(description); | |
| 163 | - //} | |
| 164 | - if (($new_quota > $quota_max) && ($quota_max != "0")) { | |
| 165 | - printError("$lang_err_quota".$new_quota."$lang_err_quota_needed".($quota_max - $quota_current)."$lang_err_quota_avail",""); | |
| 166 | - if(($quota_max - $quota_current) == "0") { | |
| 167 | - printError("$lang_err_quota_exceed"); | |
| 168 | - } | |
| 169 | - } | |
| 170 | - // End neller | |
| 171 | - | |
| 172 | - // BEGIN wes change | |
| 173 | - if ($default->owl_use_fs) { | |
| 174 | - /* Begin Daphne Change | |
| 175 | - * copy old version to backup folder | |
| 176 | - * change version numbers, | |
| 177 | - * update database entries | |
| 178 | - * upload new file over the old | |
| 179 | - * backup filename will be 'name_majorrev-minorrev' e.g. 'testing_1-2.doc' | |
| 180 | - */ | |
| 181 | - if ($default->owl_version_control == 1) { | |
| 182 | - if(!(file_exists($newpath)==1) || $backup_filename != $new_name){ | |
| 183 | - printError("$lang_err_file_update",""); | |
| 144 | + //***neller: Read data from database | |
| 145 | + //$sql->query("select * from $default->owl_files_table where id='$id'"); | |
| 146 | + //while($sql->next_record()) { | |
| 147 | + //if ($default->owl_fs_root."/".find_path($parent)."/".$sql->f(filename) != $newpath) | |
| 148 | + //if ($default->owl_FileDir."/".find_path($parent)."/".$sql->f(filename) != $newpath) | |
| 149 | + //printError("$lang_err_file_update",""); | |
| 150 | + //$new_quota = $quota_current - $sql->f(size) + $userfile_size; | |
| 151 | + //$filename = $sql->f(filename); | |
| 152 | + //$title = $sql->f(name); | |
| 153 | + //$description = $sql->f(description); | |
| 154 | + //} | |
| 155 | + if (($new_quota > $quota_max) && ($quota_max != "0")) { | |
| 156 | + printError("$lang_err_quota".$new_quota."$lang_err_quota_needed".($quota_max - $quota_current)."$lang_err_quota_avail",""); | |
| 157 | + if(($quota_max - $quota_current) == "0") | |
| 158 | + printError("$lang_err_quota_exceed"); | |
| 184 | 159 | } |
| 185 | - // Get the file extension. | |
| 186 | - $extension = explode(".",$new_name); | |
| 187 | - // rename the new, backed up (versioned) filename | |
| 188 | - $version_name = $extension[0]."_$major_revision-$minor_revision.$extension[1]"; | |
| 189 | - // specify path for new file in the /backup/ file of each directory. | |
| 190 | - $backuppath = $default->owl_FileDir."/".find_path($parent)."/backup/$version_name"; | |
| 191 | - | |
| 192 | - if(!is_dir("$default->owl_FileDir/".find_path($parent)."/backup")) { | |
| 193 | - // Danilo change | |
| 194 | - mkdir("$default->owl_FileDir/".find_path($parent)."/backup", 0777); | |
| 195 | - // End Danilo change | |
| 196 | - // is there already a backup directory for current dir? | |
| 197 | - if(is_dir("$default->owl_FileDir/".find_path($parent)."/backup")) { | |
| 198 | - $sql->query("INSERT into $default->owl_folders_table (name, parent, security, groupid, creatorid) values ('backup', '$parent', '50', '$groupid', '$userid')"); | |
| 199 | - } else { | |
| 200 | - printError("$lang_err_backup_folder_create",""); | |
| 201 | - } | |
| 202 | - } | |
| 203 | - copy($newpath,$backuppath); // copy existing file to backup folder | |
| 204 | - } | |
| 205 | - // End Daphne Change | |
| 206 | - | |
| 207 | - if(!file_exists($newpath) == 1) { | |
| 208 | - printError("$lang_err_file_update",""); | |
| 209 | - } | |
| 210 | - copy($userfile['tmp_name'], $newpath); | |
| 211 | - unlink($userfile['tmp_name']); | |
| 212 | - if(!file_exists($newpath)) { | |
| 213 | - if ($default->debug == true) { | |
| 214 | - printError($lang_err_upload,$newpath); | |
| 215 | - } else { | |
| 216 | - printError($lang_err_upload,""); | |
| 160 | + // End neller | |
| 161 | + | |
| 162 | + /* Begin Daphne Change | |
| 163 | + * copy old version to backup folder | |
| 164 | + * change version numbers, | |
| 165 | + * update database entries | |
| 166 | + * upload new file over the old | |
| 167 | + * backup filename will be 'name_majorrev-minorrev' e.g. 'testing_1-2.doc' | |
| 168 | + */ | |
| 169 | + | |
| 170 | + // BEGIN wes change | |
| 171 | + if ($default->owl_use_fs) | |
| 172 | + { | |
| 173 | + if ($default->owl_version_control == 1) { | |
| 174 | + if(!(file_exists($newpath)==1) || $backup_filename != $new_name) printError("$lang_err_file_update",""); | |
| 175 | + // Get the file extension. | |
| 176 | + $extension = explode(".",$new_name); | |
| 177 | + // rename the new, backed up (versioned) filename | |
| 178 | + $version_name = $extension[0]."_$major_revision-$minor_revision.$extension[1]"; | |
| 179 | + // specify path for new file in the /backup/ file of each directory. | |
| 180 | + $backuppath = $default->owl_FileDir."/".find_path($parent)."/backup/$version_name"; | |
| 181 | + | |
| 182 | + // Danilo change | |
| 183 | + | |
| 184 | + if(!is_dir("$default->owl_FileDir/".find_path($parent)."/backup")) { | |
| 185 | + mkdir("$default->owl_FileDir/".find_path($parent)."/backup", 0777); | |
| 186 | + | |
| 187 | + // End Danilo change | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + // is there already a backup directory for current dir? | |
| 192 | + if(is_dir("$default->owl_FileDir/".find_path($parent)."/backup")) { | |
| 193 | + $sql->query("INSERT into $default->owl_folders_table (name, parent, security, groupid, creatorid) values ('backup', '$parent', '50', '$groupid', '$userid')"); | |
| 194 | + } else { | |
| 195 | + printError("$lang_err_backup_folder_create",""); | |
| 196 | + } | |
| 197 | + } | |
| 198 | + copy($newpath,$backuppath); // copy existing file to backup folder | |
| 217 | 199 | } |
| 200 | + // End Daphne Change | |
| 201 | + | |
| 202 | + if(!file_exists($newpath) == 1) printError("$lang_err_file_update",""); | |
| 203 | + copy($userfile['tmp_name'], $newpath); | |
| 204 | + unlink($userfile['tmp_name']); | |
| 205 | + if(!file_exists($newpath)) | |
| 206 | + if ($default->debug == true) | |
| 207 | + printError($lang_err_upload,$newpath); | |
| 208 | + else | |
| 209 | + printError($lang_err_upload,""); | |
| 218 | 210 | // Begin Daphne Change |
| 219 | 211 | if ($default->owl_version_control == 1) { |
| 220 | - if(!file_exists($backuppath)) { | |
| 221 | - die ("$lang_err_backup_file"); | |
| 222 | - } | |
| 223 | - // find id of the backup folder you are saving the old file to | |
| 224 | - $sql->query("Select id from $default->owl_folders_table where name='backup' and parent='$parent'"); | |
| 225 | - while($sql->next_record()) { | |
| 226 | - $backup_parent = $sql->f("id"); | |
| 227 | - } | |
| 228 | - } | |
| 229 | - } | |
| 212 | + if(!file_exists($backuppath)) die ("$lang_err_backup_file"); | |
| 230 | 213 | |
| 231 | - if($versionchange == 'major_revision') { | |
| 232 | - // if someone requested a major revision, must | |
| 233 | - // make the minor revision go back to 0 | |
| 234 | - //$versionchange = "minor_revision='0', major_revision"; | |
| 235 | - //$new_version_num = $major_revision + 1; | |
| 236 | - $new_major = $major_revision + 1; | |
| 237 | - $new_minor = 0; | |
| 238 | - $versionchange = "minor_revision='0', major_revision"; | |
| 239 | - $new_version_num = $major_revision + 1; | |
| 240 | - } else { | |
| 241 | - // simply increment minor revision number | |
| 242 | - $new_version_num = $minor_revision + 1; | |
| 214 | + // find id of the backup folder you are saving the old file to | |
| 215 | + $sql->query("Select id from $default->owl_folders_table where name='backup' and parent='$parent'"); | |
| 216 | + while($sql->next_record()) { | |
| 217 | + $backup_parent = $sql->f("id"); | |
| 218 | + } | |
| 219 | + } | |
| 220 | + } | |
| 221 | + | |
| 222 | + if($versionchange == 'major_revision') { | |
| 223 | + // if someone requested a major revision, must | |
| 224 | + // make the minor revision go back to 0 | |
| 225 | + //$versionchange = "minor_revision='0', major_revision"; | |
| 226 | + //$new_version_num = $major_revision + 1; | |
| 227 | + $new_major = $major_revision + 1; | |
| 228 | + $new_minor = 0; | |
| 229 | + $versionchange = "minor_revision='0', major_revision"; | |
| 230 | + $new_version_num = $major_revision + 1; | |
| 231 | + | |
| 232 | + } | |
| 233 | + else { | |
| 234 | + // simply increment minor revision number | |
| 235 | + $new_version_num = $minor_revision + 1; | |
| 243 | 236 | $new_minor = $minor_revision + 1; |
| 244 | - $new_major = $major_revision; | |
| 245 | - } | |
| 246 | - // printError("old: $minor_revision", "New: $new_minor"); | |
| 247 | - // End Daphne Change | |
| 248 | - | |
| 249 | - $groupid = owlusergroup($userid); | |
| 250 | - $modified = date("M d, Y \a\\t h:i a"); | |
| 251 | - $smodified = date("Y-m-d g:i:s"); | |
| 252 | - | |
| 253 | - // Begin Daphne Change | |
| 254 | - if ($default->owl_version_control == 1) { | |
| 255 | - if ($default->owl_use_fs) { | |
| 256 | - // insert entry for backup file | |
| 257 | - // WORKING WORKING | |
| 258 | - $sql->query("INSERT into $default->owl_files_table (name,filename,size,creatorid,parent,modified, smodified,groupid,description,metadata,security,major_revision,minor_revision) values ('$backup_name','$version_name','$backup_size','$backup_creatorid','$backup_parent','$backup_modified', '$backup_smodified','$backup_groupid', '$backup_description','$backup_metadata','$backup_security','$backup_major','$backup_minor')") or unlink($backuppath); | |
| 259 | - | |
| 260 | - // update entry for existing file. Bozz's code is repeated underneath, | |
| 261 | - // without the versioning attribute included. | |
| 262 | - | |
| 263 | - // BEGIN Bozz Change | |
| 264 | - // Added this check, if the policy is allow Read Write NO DELETE | |
| 265 | - // we have to make sure that the Creator is not changed. | |
| 266 | - // in the case of an updated, that would then allow a user to | |
| 267 | - // delete the file. Only the original Creator should be allowed | |
| 268 | - // to delete the file. | |
| 269 | - if ( getfilepolicy($id) == 5 || getfilepolicy($id) == 6) { | |
| 270 | - // Daphne addition -- $versionchange = $new_version_num | |
| 271 | - $sql->query("UPDATE $default->owl_files_table set size='".$userfile['size']."',modified='$modified',smodified='$smodified', $versionchange='$new_version_num', description='$newdesc' where id='$id'") or unlink($newpath); | |
| 272 | - } else { | |
| 273 | - // Daphne addition -- $versionchange = $new_version_num | |
| 274 | - $sql->query("UPDATE $default->owl_files_table set size='".$userfile['size']."',creatorid='$userid',modified='$modified',smodified='$smodified', $versionchange='$new_version_num',description='$newdesc' where id='$id'") or unlink($newpath); | |
| 275 | - } | |
| 276 | - } else { | |
| 277 | - // BEGIN wes change | |
| 278 | - // insert entry for current version of file | |
| 279 | - $compressed = '0'; | |
| 280 | - $userfile = uploadCompat("userfile"); | |
| 281 | - $fsize = filesize($userfile['tmp_name']); | |
| 282 | - $sql->query("INSERT into $default->owl_files_table (name,filename,size,creatorid,parent,modified, smodified,groupid,description,metadata,security,major_revision,minor_revision) values ('$backup_name','".$userfile['name']."','".$userfile['size']."','$backup_creatorid','$parent','$modified', '$smodified','$backup_groupid', '$newdesc', '$backup_metadata','$backup_security','$new_major','$new_minor')"); | |
| 283 | - $id = $sql->insert_id(); | |
| 284 | - | |
| 285 | - if ($default->owl_compressed_database && file_exists($default->gzip_path)) { | |
| 286 | - system($default->gzip_path . " " . escapeshellarg($userfile['tmp_name'])); | |
| 287 | - $fd = fopen($userfile['tmp_name'] . ".gz", 'rb'); | |
| 288 | - $userfile['tmp_name'] = $userfile['tmp_name'] . ".gz"; | |
| 289 | - $fsize = filesize($userfile['tmp_name']); | |
| 290 | - $compressed = '1'; | |
| 291 | - } else { | |
| 292 | - $fd = fopen($userfile['tmp_name'], 'rb'); | |
| 293 | - } | |
| 294 | - $filedata = addSlashes(fread($fd, $fsize)); | |
| 295 | - fclose($fd); | |
| 296 | - | |
| 297 | - if ($id !== NULL && $filedata) { | |
| 298 | - $sql->query("insert into $default->owl_files_data_table (id, data, compressed) values ('$id', '$filedata','$compressed')"); | |
| 299 | - } | |
| 300 | - // END wes change | |
| 237 | + $new_major = $major_revision; | |
| 238 | + } | |
| 239 | + | |
| 240 | + // printError("old: $minor_revision", "New: $new_minor"); | |
| 241 | + // End Daphne Change | |
| 242 | + | |
| 243 | + $groupid = owlusergroup($userid); | |
| 244 | + $modified = date("M d, Y \a\\t h:i a"); | |
| 245 | + $smodified = date("Y-m-d g:i:s"); | |
| 246 | + | |
| 247 | + // Begin Daphne Change | |
| 248 | + if ($default->owl_version_control == 1) { | |
| 249 | + if ($default->owl_use_fs) | |
| 250 | + { | |
| 251 | + // insert entry for backup file | |
| 252 | + // WORKING WORKING | |
| 253 | + $sql->query("INSERT into $default->owl_files_table (name,filename,size,creatorid,parent,modified, smodified,groupid,description,metadata,security,major_revision,minor_revision) values ('$backup_name','$version_name','$backup_size','$backup_creatorid','$backup_parent','$backup_modified', '$backup_smodified','$backup_groupid', '$backup_description','$backup_metadata','$backup_security','$backup_major','$backup_minor')") or unlink($backuppath); | |
| 254 | + | |
| 255 | + // update entry for existing file. Bozz's code is repeated underneath, | |
| 256 | + // without the versioning attribute included. | |
| 257 | + | |
| 258 | + | |
| 259 | + // BEGIN Bozz Change | |
| 260 | + // Added this check, if the policy is allow Read Write NO DELETE | |
| 261 | + // we have to make sure that the Creator is not changed. | |
| 262 | + // in the case of an updated, that would then allow a user to | |
| 263 | + // delete the file. Only the original Creator should be allowed | |
| 264 | + // to delete the file. | |
| 265 | + if ( getfilepolicy($id) == 5 || getfilepolicy($id) == 6) | |
| 266 | + { | |
| 267 | + // Daphne addition -- $versionchange = $new_version_num | |
| 268 | + $sql->query("UPDATE $default->owl_files_table set size='".$userfile['size']."',modified='$modified',smodified='$smodified', $versionchange='$new_version_num', description='$newdesc' where id='$id'") or unlink($newpath); | |
| 269 | + } | |
| 270 | + else | |
| 271 | + { | |
| 272 | + // Daphne addition -- $versionchange = $new_version_num | |
| 273 | + $sql->query("UPDATE $default->owl_files_table set size='".$userfile['size']."',creatorid='$userid',modified='$modified',smodified='$smodified', $versionchange='$new_version_num',description='$newdesc' where id='$id'") or unlink($newpath); | |
| 274 | + } | |
| 275 | + } else { | |
| 276 | + // BEGIN wes change | |
| 277 | + // insert entry for current version of file | |
| 278 | + $compressed = '0'; | |
| 279 | + $userfile = uploadCompat("userfile"); | |
| 280 | + $fsize = filesize($userfile['tmp_name']); | |
| 281 | + $sql->query("INSERT into $default->owl_files_table (name,filename,size,creatorid,parent,modified, smodified,groupid,description,metadata,security,major_revision,minor_revision) values ('$backup_name','".$userfile['name']."','".$userfile['size']."','$backup_creatorid','$parent','$modified', '$smodified','$backup_groupid', '$newdesc', '$backup_metadata','$backup_security','$new_major','$new_minor')"); | |
| 282 | + $id = $sql->insert_id(); | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + if ($default->owl_compressed_database && file_exists($default->gzip_path)) { | |
| 289 | + system($default->gzip_path . " " . escapeshellarg($userfile['tmp_name'])); | |
| 290 | + $fd = fopen($userfile['tmp_name'] . ".gz", 'rb'); | |
| 291 | + $userfile['tmp_name'] = $userfile['tmp_name'] . ".gz"; | |
| 292 | + $fsize = filesize($userfile['tmp_name']); | |
| 293 | + $compressed = '1'; | |
| 294 | + } else { | |
| 295 | + $fd = fopen($userfile['tmp_name'], 'rb'); | |
| 296 | + } | |
| 297 | + $filedata = addSlashes(fread($fd, $fsize)); | |
| 298 | + fclose($fd); | |
| 299 | + | |
| 300 | + if ($id !== NULL && $filedata) { | |
| 301 | + $sql->query("insert into $default->owl_files_data_table (id, data, compressed) values ('$id', '$filedata','$compressed')"); | |
| 302 | + } | |
| 303 | + // END wes change | |
| 304 | + } | |
| 305 | + // END Bozz Change | |
| 306 | + | |
| 301 | 307 | } |
| 302 | - // END Bozz Change | |
| 303 | - } else { // versioning not included in the DB update | |
| 304 | - if ($default->owl_use_fs) { | |
| 305 | - // BEGIN Bozz Change | |
| 306 | - if ( getfilepolicy($id) == 5 || getfilepolicy($id) == 6) { | |
| 307 | - $sql->query("update $default->owl_files_table set size='".$userfile['size']."',modified='$modified',smodified='$smodified' where id='$id'") or unlink($newpath); | |
| 308 | - } else { | |
| 309 | - $sql->query("update $default->owl_files_table set size='".$userfile['size']."',creatorid='$userid',modified='$modified',smodified='$smodified' where id='$id'") or unlink($newpath); | |
| 308 | + | |
| 309 | + else { // versioning not included in the DB update | |
| 310 | + if ($default->owl_use_fs) | |
| 311 | + { | |
| 312 | + // BEGIN Bozz Change | |
| 313 | + if ( getfilepolicy($id) == 5 || getfilepolicy($id) == 6) | |
| 314 | + { | |
| 315 | + $sql->query("update $default->owl_files_table set size='".$userfile['size']."',modified='$modified',smodified='$smodified' where id='$id'") or unlink($newpath); | |
| 310 | 316 | } |
| 311 | - // END Bozz Change | |
| 312 | - } | |
| 313 | - } | |
| 314 | - // End Daphne Change | |
| 317 | + else | |
| 318 | + { | |
| 319 | + $sql->query("update $default->owl_files_table set size='".$userfile['size']."',creatorid='$userid',modified='$modified',smodified='$smodified' where id='$id'") or unlink($newpath); | |
| 320 | + } | |
| 321 | + // END Bozz Change | |
| 322 | + } | |
| 323 | + } | |
| 315 | 324 | |
| 316 | - if ($quota_max != "0") { | |
| 317 | - $sql->query("update $default->owl_users_table set quota_current = '$new_quota' where id = '$userid'"); | |
| 318 | - } | |
| 325 | + // End Daphne Change | |
| 326 | + | |
| 327 | + if ($quota_max != "0") $sql->query("update $default->owl_users_table set quota_current = '$new_quota' where id = '$userid'"); | |
| 319 | 328 | |
| 320 | - //notify_users($groupid,1, find_path($parent),$filename, $title, $newdesc); | |
| 321 | - notify_users($groupid,1,$parent,$filename, $title, $newdesc, $type); | |
| 322 | - header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); | |
| 323 | - // END BUG FIX: #433932 Fileupdate and Quotas | |
| 324 | - } else { | |
| 325 | - include("./lib/header.inc"); | |
| 326 | - print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30> | |
| 327 | - <TR><TD ALIGN=LEFT>"); | |
| 328 | - print("$lang_user: "); | |
| 329 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 330 | - print uid_to_name($userid); | |
| 331 | - print ("</A>"); | |
| 332 | - print ("<FONT SIZE=-1>"); | |
| 333 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A> | |
| 334 | - </FONT></TD> | |
| 335 | - <TD ALIGN=RIGHT> | |
| 336 | - <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> | |
| 337 | - </TD></TR></TABLE><BR><BR>"); | |
| 338 | - print($lang_noupload); | |
| 339 | - } | |
| 340 | - } | |
| 329 | + //notify_users($groupid,1, find_path($parent),$filename, $title, $newdesc); | |
| 330 | + notify_users($groupid,1,$parent,$filename, $title, $newdesc, $type); | |
| 331 | + header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); | |
| 332 | +// END BUG FIX: #433932 Fileupdate and Quotas | |
| 333 | + } else { | |
| 334 | + include("./lib/header.inc"); | |
| 335 | + print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); | |
| 336 | + ?> | |
| 337 | + <TR><TD ALIGN=LEFT> | |
| 338 | +<?php print("$lang_user: "); | |
| 339 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 340 | + print uid_to_name($userid); | |
| 341 | + print ("</A>"); | |
| 342 | +?> | |
| 343 | +<FONT SIZE=-1> | |
| 344 | + | |
| 345 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 346 | + </FONT></TD> | |
| 347 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 348 | + </TD></TR></TABLE><BR><BR> | |
| 349 | + <?php | |
| 350 | + print($lang_noupload); | |
| 351 | + } | |
| 341 | 352 | } |
| 342 | 353 | |
| 354 | + | |
| 343 | 355 | if($action == "file_upload") { |
| 344 | - if(check_auth($parent, "folder_modify", $userid) == 1) { | |
| 345 | - //if($title == "") exit($lang_specifyname); | |
| 346 | - $groupid = owlusergroup($userid); | |
| 347 | - $sql = new Owl_DB; | |
| 348 | - $userfile = uploadCompat("userfile"); | |
| 349 | - if ($type == "url") { | |
| 350 | - $modified = date("M d, Y \a\\t h:i a"); | |
| 351 | - $smodified = date("Y-m-d g:i:s"); | |
| 352 | - $new_name = $userfile["name"]; | |
| 353 | - if ($title == "") { | |
| 354 | - $title = $userfile["name"]; | |
| 355 | - } | |
| 356 | - $sql->query("insert into $default->owl_files_table (name,filename,size,creatorid,parent,modified,description,metadata,security,groupid,smodified,checked_out, major_revision, minor_revision, url) values ('$title', '".$userfile["name"]."', '".$userfile["size"]."', '$userid', '$parent', '$modified', '$description', '$metadata', '$security', '$groupid','$smodified','$checked_out','$major_revision','1','1')"); | |
| 357 | - } else { | |
| 358 | - $sql->query("select * from $default->owl_users_table where id = '$userid'"); | |
| 359 | - while($sql->next_record()) { | |
| 360 | - $quota_max = $sql->f("quota_max"); | |
| 361 | - $quota_current = $sql->f("quota_current"); | |
| 362 | - $new_quota = $quota_current + $userfile["size"]; | |
| 363 | - } | |
| 364 | - if (($new_quota > $quota_max) && ($quota_max != "0")) { | |
| 365 | - die("$lang_err_quota".$new_quota."$lang_err_quota_needed".($quota_max - $quota_current)."$lang_err_quota_avail"); | |
| 366 | - if(($quota_max - $quota_current) == "0") { | |
| 367 | - die("$lang_err_quota_exceed"); | |
| 368 | - } | |
| 369 | - } | |
| 370 | - $new_name = ereg_replace("[^-A-Za-z0-9._]", "", ereg_replace(" ", "_", ereg_replace("%20|^-", "_", $userfile["name"]))); | |
| 371 | - | |
| 372 | - if ($default->owl_use_fs) { | |
| 373 | - $newpath = $default->owl_FileDir."/".find_path($parent)."/".$new_name; | |
| 374 | - if(file_exists($newpath) == 1) { | |
| 375 | - if ($default->debug == true) { | |
| 376 | - printError($lang_fileexists,$newpath); | |
| 377 | - } else { | |
| 378 | - printError($lang_fileexists,""); | |
| 379 | - } | |
| 380 | - } | |
| 356 | + if(check_auth($parent, "folder_modify", $userid) == 1) { | |
| 357 | + //if($title == "") exit($lang_specifyname); | |
| 358 | + $groupid = owlusergroup($userid); | |
| 359 | + $sql = new Owl_DB; | |
| 360 | + $userfile = uploadCompat("userfile"); | |
| 361 | + if ($type == "url") { | |
| 362 | + $modified = date("M d, Y \a\\t h:i a"); | |
| 363 | + $smodified = date("Y-m-d g:i:s"); | |
| 364 | + $new_name = $userfile["name"]; | |
| 365 | + if ($title == "") | |
| 366 | + $title = $userfile["name"]; | |
| 367 | + $sql->query("insert into $default->owl_files_table (name,filename,size,creatorid,parent,modified,description,metadata,security,groupid,smodified,checked_out, major_revision, minor_revision, url) values ('$title', '".$userfile["name"]."', '".$userfile["size"]."', '$userid', '$parent', '$modified', '$description', '$metadata', '$security', '$groupid','$smodified','$checked_out','$major_revision','1','1')"); | |
| 368 | + } | |
| 369 | + else { | |
| 370 | + $sql->query("select * from $default->owl_users_table where id = '$userid'"); | |
| 371 | + while($sql->next_record()) { | |
| 372 | + $quota_max = $sql->f("quota_max"); | |
| 373 | + $quota_current = $sql->f("quota_current"); | |
| 374 | + $new_quota = $quota_current + $userfile["size"]; | |
| 375 | + } | |
| 376 | + if (($new_quota > $quota_max) && ($quota_max != "0")) { | |
| 377 | + | |
| 378 | + die("$lang_err_quota".$new_quota."$lang_err_quota_needed".($quota_max - $quota_current)."$lang_err_quota_avail"); | |
| 379 | + if(($quota_max - $quota_current) == "0") | |
| 380 | + die("$lang_err_quota_exceed"); | |
| 381 | + } | |
| 382 | + $new_name = ereg_replace("[^-A-Za-z0-9._]", "", ereg_replace(" ", "_", ereg_replace("%20|^-", "_", $userfile["name"]))); | |
| 381 | 383 | |
| 382 | - copy($userfile["tmp_name"], $newpath); | |
| 383 | - unlink($userfile["tmp_name"]); | |
| 384 | - if(!file_exists($newpath)) { | |
| 385 | - if ($default->debug == true) { | |
| 386 | - printError($lang_err_upload,$newpath); | |
| 387 | - } else { | |
| 388 | - printError($lang_err_upload,""); | |
| 389 | - } | |
| 390 | - } else { | |
| 384 | + if ($default->owl_use_fs) | |
| 385 | + { | |
| 386 | + $newpath = $default->owl_FileDir."/".find_path($parent)."/".$new_name; | |
| 387 | + if(file_exists($newpath) == 1) | |
| 388 | + if ($default->debug == true) | |
| 389 | + printError($lang_fileexists,$newpath); | |
| 390 | + else | |
| 391 | + printError($lang_fileexists,""); | |
| 392 | + | |
| 393 | + copy($userfile["tmp_name"], $newpath); | |
| 394 | + unlink($userfile["tmp_name"]); | |
| 395 | + if(!file_exists($newpath)) | |
| 396 | + if ($default->debug == true) | |
| 397 | + printError($lang_err_upload,$newpath); | |
| 398 | + else | |
| 399 | + printError($lang_err_upload,""); | |
| 400 | + } | |
| 401 | + else { | |
| 391 | 402 | // is name already used? |
| 392 | - //printError("SQL", "select filename from $default->owl_files_table where filename = '$new_name' and parent='$parent'"); | |
| 403 | + //printError("SQL", "select filename from $default->owl_files_table where filename = '$new_name' and parent='$parent'"); | |
| 393 | 404 | $sql->query("select filename from $default->owl_files_table where filename = '$new_name' and parent='$parent'"); |
| 394 | - while($sql->next_record()) { | |
| 405 | + while($sql->next_record()) | |
| 406 | + { | |
| 395 | 407 | if ($sql->f("filename")) { |
| 396 | 408 | // can't move... |
| 397 | 409 | printError("<b>File Exists:</b>","There is already a file with the name <i>$new_name</i> in this directory.",""); |
| 398 | - // print("<A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname'>$lang_return</A><P>"); | |
| 410 | + // print("<A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname'>$lang_return</A><P>"); | |
| 399 | 411 | // needs to be internationalized |
| 400 | 412 | //exit("<b>File Exists:</b> There is already a file with the name <i>$title</i> in this directory."); |
| 401 | 413 | } |
| 402 | - } | |
| 403 | - } | |
| 414 | + } | |
| 415 | + | |
| 416 | + } | |
| 404 | 417 | /* BEGIN Bozz Change |
| 405 | 418 | If your not part of the Administartor Group |
| 406 | 419 | the Folder will have your group ID assigned to it */ |
| 407 | - if ( owlusergroup($userid) != 0 ) { | |
| 408 | - $groupid = owlusergroup($userid); | |
| 420 | + | |
| 421 | + if ( owlusergroup($userid) != 0 ) | |
| 422 | + { | |
| 423 | + $groupid = owlusergroup($userid); | |
| 409 | 424 | } |
| 410 | 425 | // Bozz Change End |
| 411 | 426 | |
| 412 | - $modified = date("M d, Y \a\t h:i a"); | |
| 427 | + $modified = date("M d, Y \a\t h:i a"); | |
| 413 | 428 | $smodified = date("Y-m-d g:i:s"); |
| 414 | - if($title == "") { | |
| 415 | - $title = $new_name; | |
| 416 | - } | |
| 417 | - if($major_revision == "") { | |
| 418 | - $major_revision = 0; | |
| 419 | - } | |
| 420 | - if($minor_revision == "") { | |
| 421 | - $minor_revision = 1; | |
| 422 | - } | |
| 423 | - if($checked_out == "") { | |
| 424 | - $checked_out = 0; | |
| 425 | - } | |
| 429 | + if($title == "") $title = $new_name; | |
| 430 | + if($major_revision == "") $major_revision = 0; | |
| 431 | + if($minor_revision == "") $minor_revision = 1; | |
| 432 | + if($checked_out == "") $checked_out = 0; | |
| 426 | 433 | // WORKING WORKING |
| 427 | 434 | |
| 428 | - $compressed = '0'; | |
| 429 | - $userfile = uploadCompat("userfile"); | |
| 430 | - $fsize = $userfile['size']; | |
| 435 | + $compressed = '0'; | |
| 436 | + $userfile = uploadCompat("userfile"); | |
| 437 | + $fsize = $userfile['size']; | |
| 431 | 438 | if (!$default->owl_use_fs && $default->owl_compressed_database && file_exists($default->gzip_path)) { |
| 432 | - system($default->gzip_path . " " . escapeshellarg($userfile['tmp_name'])); | |
| 433 | - $userfile['tmp_name'] = $userfile['tmp_name'] . ".gz"; | |
| 434 | - $fsize = filesize($userfile['tmp_name']); | |
| 435 | - $compressed = '1'; | |
| 439 | + system($default->gzip_path . " " . escapeshellarg($userfile['tmp_name'])); | |
| 440 | + $userfile['tmp_name'] = $userfile['tmp_name'] . ".gz"; | |
| 441 | + $fsize = filesize($userfile['tmp_name']); | |
| 442 | + $compressed = '1'; | |
| 436 | 443 | } |
| 437 | 444 | $result = $sql->query("insert into $default->owl_files_table (name,filename,size,creatorid,parent,modified,description,metadata,security,groupid,smodified,checked_out, major_revision, minor_revision, url) values ('$title', '$new_name', '".$userfile['size']."', '$userid', '$parent', '$modified', '$description', '$metadata', '$security', '$groupid','$smodified','$checked_out','$major_revision','$minor_revision', '0')") or unlink($newpath); |
| 438 | 445 | |
| 439 | - if (!$result && $default->owl_use_fs) { | |
| 440 | - unlink($newpath); | |
| 441 | - } | |
| 446 | + if (!$result && $default->owl_use_fs) unlink($newpath); | |
| 442 | 447 | // BEGIN wes change |
| 443 | 448 | if (!$default->owl_use_fs) { |
| 444 | - $id = $sql->insert_id(); | |
| 445 | - $fd = fopen($userfile['tmp_name'], 'rb'); | |
| 446 | - $filedata = addSlashes(fread($fd, $fsize)); | |
| 447 | - fclose($fd); | |
| 448 | - | |
| 449 | - if ($id !== NULL && $filedata) { | |
| 450 | - $sql->query("insert into $default->owl_files_data_table (id, data, compressed) values ('$id', '$filedata', '$compressed')"); | |
| 451 | - } | |
| 449 | + $id = $sql->insert_id(); | |
| 450 | + $fd = fopen($userfile['tmp_name'], 'rb'); | |
| 451 | + $filedata = addSlashes(fread($fd, $fsize)); | |
| 452 | + fclose($fd); | |
| 453 | + | |
| 454 | + if ($id !== NULL && $filedata) { | |
| 455 | + $sql->query("insert into $default->owl_files_data_table (id, data, compressed) values ('$id', '$filedata', '$compressed')"); | |
| 456 | + } | |
| 452 | 457 | } |
| 453 | 458 | |
| 454 | - if ($quota_max != "0") { | |
| 455 | - $sql->query("update $default->owl_users_table set quota_current = '$new_quota' where id = '$userid'"); | |
| 459 | + | |
| 460 | + if ($quota_max != "0") $sql->query("update $default->owl_users_table set quota_current = '$new_quota' where id = '$userid'"); | |
| 456 | 461 | } |
| 457 | - } | |
| 458 | 462 | |
| 459 | - notify_users($groupid,0,$parent,$new_name, $title, $description, $type); | |
| 460 | - header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); | |
| 463 | + notify_users($groupid,0,$parent,$new_name, $title, $description, $type); | |
| 464 | + | |
| 465 | + header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); | |
| 461 | 466 | } else { |
| 462 | 467 | include("./lib/header.inc"); |
| 463 | 468 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| 464 | -?> | |
| 469 | + ?> | |
| 465 | 470 | <TR><TD ALIGN=LEFT> |
| 466 | -<?php | |
| 467 | - print("$lang_user: "); | |
| 468 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 469 | - print uid_to_name($userid); | |
| 470 | - print ("</A>"); | |
| 471 | -?> | |
| 472 | - <FONT SIZE=-1> | |
| 473 | -<?php | |
| 474 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 475 | -?> | |
| 476 | - </FONT></TD> | |
| 477 | - <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 478 | - </TD></TR></TABLE><BR><BR><CENTER> | |
| 479 | -<?php | |
| 471 | + <?php print("$lang_user: "); | |
| 472 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 473 | + print uid_to_name($userid); | |
| 474 | + print ("</A>"); | |
| 475 | + ?> | |
| 476 | +<FONT SIZE=-1> | |
| 477 | + | |
| 478 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 479 | + </FONT></TD> | |
| 480 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 481 | + </TD></TR></TABLE><BR><BR><CENTER> | |
| 482 | + <?php | |
| 480 | 483 | print($lang_noupload); |
| 481 | 484 | } |
| 482 | 485 | } |
| 483 | 486 | |
| 484 | 487 | if($action == "file_modify") { |
| 485 | - if(check_auth($id, "file_modify", $userid) == 1) { | |
| 486 | - $sql = new Owl_DB; | |
| 487 | - // Begin Bozz Change | |
| 488 | - if ( owlusergroup($userid) != 0 && $groupid == "" ) { | |
| 489 | - $groupid = owlusergroup($userid); | |
| 490 | - } | |
| 488 | + if(check_auth($id, "file_modify", $userid) == 1) { | |
| 489 | + $sql = new Owl_DB; | |
| 490 | + // Begin Bozz Change | |
| 491 | + if ( owlusergroup($userid) != 0 && $groupid == "" ) | |
| 492 | + { | |
| 493 | + $groupid = owlusergroup($userid); | |
| 494 | + } | |
| 495 | + | |
| 496 | + | |
| 491 | 497 | // BEGIN WES change |
| 492 | - if (!$default->owl_use_fs) { | |
| 493 | - $name = flid_to_name($id); | |
| 494 | - if ($name != $title) { | |
| 495 | - // we're changing the name ... need to roll this to other revisions | |
| 496 | - // is name already used? | |
| 497 | - $sql->query("select name from $default->owl_files_table where name = '$title' and parent='$parent'"); | |
| 498 | - while($sql->next_record()) { | |
| 499 | - if ($sql->f("name")) { | |
| 500 | - // can't move... | |
| 501 | - //print("<A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname'>$lang_return</A><P>"); | |
| 502 | - // needs to be internationalized | |
| 503 | - printError("<b>File Exists:</b> There is already a file with the name <i>$title</i> in this directory.",""); | |
| 504 | - } | |
| 498 | + if (!$default->owl_use_fs) | |
| 499 | + { | |
| 500 | + | |
| 501 | + $name = flid_to_name($id); | |
| 502 | + if ($name != $title) | |
| 503 | + { | |
| 504 | + // we're changing the name ... need to roll this to other revisions | |
| 505 | + // is name already used? | |
| 506 | + $sql->query("select name from $default->owl_files_table where name = '$title' and parent='$parent'"); | |
| 507 | + while($sql->next_record()) | |
| 508 | + { | |
| 509 | + if ($sql->f("name")) { | |
| 510 | + // can't move... | |
| 511 | + //print("<A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname'>$lang_return</A><P>"); | |
| 512 | + // needs to be internationalized | |
| 513 | + printError("<b>File Exists:</b> There is already a file with the name <i>$title</i> in this directory.",""); | |
| 514 | + } | |
| 505 | 515 | } |
| 506 | - $sql->query("update $default->owl_files_table set name='$title' where parent='$parent' AND name = '$name'"); | |
| 516 | + $sql->query("update $default->owl_files_table set name='$title' where parent='$parent' AND name = '$name'"); | |
| 507 | 517 | } |
| 508 | 518 | } |
| 509 | 519 | |
| 510 | 520 | $sql->query("update $default->owl_files_table set name='$title', security='$security', metadata='$metadata', description='$description',groupid='$groupid', creatorid ='$file_owner' where id = '$id'"); |
| 511 | - // End Bozz Change | |
| 521 | + // End Bozz Change | |
| 512 | 522 | header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); |
| 513 | 523 | } else { |
| 514 | 524 | include("./lib/header.inc"); |
| 515 | 525 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| 516 | -?> | |
| 526 | + ?> | |
| 517 | 527 | <TR><TD ALIGN=LEFT> |
| 518 | -<?php | |
| 519 | - print("$lang_user: "); | |
| 520 | - if(prefaccess($userid)) { | |
| 521 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&$sortorder=$sortname'>"); | |
| 522 | - } | |
| 523 | - print uid_to_name($userid); | |
| 524 | - print ("</A>"); | |
| 525 | -?> | |
| 526 | - <FONT SIZE=-1> | |
| 527 | - | |
| 528 | -<?php | |
| 529 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 530 | -?> | |
| 531 | - </FONT></TD> | |
| 532 | - <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 533 | - </TD></TR></TABLE><BR><BR><CENTER> | |
| 534 | -<?php | |
| 528 | + <?php print("$lang_user: "); | |
| 529 | + if(prefaccess($userid)) { | |
| 530 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&$sortorder=$sortname'>"); | |
| 531 | + } | |
| 532 | + print uid_to_name($userid); | |
| 533 | + print ("</A>"); | |
| 534 | + ?> | |
| 535 | +<FONT SIZE=-1> | |
| 536 | + | |
| 537 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 538 | + </FONT></TD> | |
| 539 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 540 | + </TD></TR></TABLE><BR><BR><CENTER> | |
| 541 | + <?php | |
| 535 | 542 | exit($lang_nofilemod); |
| 536 | 543 | } |
| 537 | 544 | } |
| 538 | 545 | |
| 539 | 546 | if($action == "file_delete") { |
| 540 | - if(check_auth($id, "file_delete", $userid) == 1) { | |
| 541 | - $sql = new Owl_DB; | |
| 542 | - if ($type == "url") { | |
| 543 | - $sql->query("delete from $default->owl_files_table where id = '$id'"); | |
| 544 | - } else { | |
| 547 | +if(check_auth($id, "file_delete", $userid) == 1) { | |
| 548 | + $sql = new Owl_DB; | |
| 549 | + if ($type == "url") | |
| 550 | + { | |
| 551 | + $sql->query("delete from $default->owl_files_table where id = '$id'"); | |
| 552 | + } | |
| 553 | + else { | |
| 545 | 554 | $sql->query("select * from $default->owl_files_table where id = '$id'"); |
| 546 | 555 | while($sql->next_record()) { |
| 547 | - $path = find_path($sql->f("parent")); | |
| 548 | - $filename = $sql->f("filename"); | |
| 549 | - $filesize = $sql->f("size"); | |
| 550 | - $owner = $sql->f("creatorid"); | |
| 556 | + $path = find_path($sql->f("parent")); | |
| 557 | + $filename = $sql->f("filename"); | |
| 558 | + $filesize = $sql->f("size"); | |
| 559 | + $owner = $sql->f("creatorid"); | |
| 551 | 560 | } |
| 552 | - | |
| 553 | 561 | $sql->query("select * from $default->owl_users_table where id = '$owner'"); |
| 554 | 562 | while($sql->next_record()) { |
| 555 | 563 | $quota_current = $sql->f("quota_current"); |
| 556 | 564 | $quota_max = $sql->f("quota_max"); |
| 557 | 565 | } |
| 558 | - | |
| 559 | 566 | $new_quota = $quota_current - $filesize; |
| 560 | - if($quota_max != "0") { | |
| 561 | - $sql->query("update $default->owl_users_table set quota_current = '$new_quota' where id = '$owner'"); | |
| 562 | - } | |
| 567 | + if($quota_max != "0") $sql->query("update $default->owl_users_table set quota_current = '$new_quota' where id = '$owner'"); | |
| 563 | 568 | |
| 564 | - if($default->owl_use_fs) { | |
| 565 | - unlink($default->owl_FileDir."/".$path."/".$filename); | |
| 566 | - } else { | |
| 567 | - $sql->query("delete from $default->owl_files_data_table where id = '$id'"); | |
| 568 | - } | |
| 569 | + if($default->owl_use_fs) { | |
| 570 | + unlink($default->owl_FileDir."/".$path."/".$filename); | |
| 571 | + } else { | |
| 572 | + $sql->query("delete from $default->owl_files_data_table where id = '$id'"); | |
| 573 | + } | |
| 569 | 574 | |
| 570 | 575 | $sql->query("delete from $default->owl_files_table where id = '$id'"); |
| 571 | 576 | sleep(.5); |
| 572 | - } | |
| 577 | + } | |
| 573 | 578 | header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); |
| 574 | 579 | } else { |
| 575 | 580 | include("./lib/header.inc"); |
| 576 | 581 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| 577 | -?> | |
| 582 | + ?> | |
| 578 | 583 | <TR><TD ALIGN=LEFT> |
| 579 | -<?php | |
| 580 | - print("$lang_user: "); | |
| 581 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 582 | - print uid_to_name($userid); | |
| 583 | - print ("</A>"); | |
| 584 | +<?php print("$lang_user: "); | |
| 585 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 586 | + print uid_to_name($userid); | |
| 587 | + print ("</A>"); | |
| 584 | 588 | ?> |
| 585 | - <FONT SIZE=-1> | |
| 586 | -<?php | |
| 587 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 588 | -?> | |
| 589 | - </FONT></TD> | |
| 590 | - <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 591 | - </TD></TR></TABLE><BR><BR><CENTER> | |
| 592 | -<?php | |
| 589 | +<FONT SIZE=-1> | |
| 590 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 591 | + </FONT></TD> | |
| 592 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 593 | + </TD></TR></TABLE><BR><BR><CENTER> | |
| 594 | + <?php | |
| 593 | 595 | exit($lang_nofiledelete); |
| 594 | 596 | } |
| 595 | 597 | } |
| 596 | - | |
| 597 | 598 | // Begin Daphne Change |
| 598 | 599 | // the file policy authorisation has been taken from file_modify |
| 599 | 600 | // (it's assumed that if you can't modify the file you can't check it out) |
| 601 | + | |
| 600 | 602 | if($action == "file_lock") { |
| 601 | - if(check_auth($id, "file_modify", $userid) == 1) { | |
| 602 | - $sql = new Owl_DB; | |
| 603 | - // Begin Bozz Change | |
| 604 | - if ( owlusergroup($userid) != 0 ) { | |
| 605 | - $groupid = owlusergroup($userid); | |
| 606 | - } | |
| 603 | + if(check_auth($id, "file_modify", $userid) == 1) { | |
| 604 | + $sql = new Owl_DB; | |
| 605 | + // Begin Bozz Change | |
| 606 | + if ( owlusergroup($userid) != 0 ) | |
| 607 | + { | |
| 608 | + $groupid = owlusergroup($userid); | |
| 609 | + } | |
| 607 | 610 | // check that file hasn't been reserved while updates have gone through |
| 608 | 611 | $sql->query("select checked_out from $default->owl_files_table where id = '$id'"); |
| 609 | 612 | |
| ... | ... | @@ -612,301 +615,299 @@ if($action == "file_lock") { |
| 612 | 615 | } |
| 613 | 616 | |
| 614 | 617 | if ($file_lock == 0) { |
| 615 | - // reserve the file | |
| 616 | - $sql->query("update $default->owl_files_table set checked_out='$userid' where id='$id'"); | |
| 618 | + // reserve the file | |
| 619 | + $sql->query("update $default->owl_files_table set checked_out='$userid' where id='$id'"); | |
| 620 | + } | |
| 621 | + else { | |
| 622 | + if ($file_lock == $userid) { | |
| 623 | + // check the file back in | |
| 624 | + $sql->query("update $default->owl_files_table set checked_out='0' where id='$id'"); | |
| 625 | + } | |
| 626 | + else { | |
| 627 | + // throw error; someone else is trying to lock the file! | |
| 628 | + include("./lib/header.inc"); | |
| 629 | + print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); | |
| 630 | + ?> | |
| 631 | + <TR><TD ALIGN=LEFT> | |
| 632 | + <?php print("$lang_user: "); | |
| 633 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 634 | + print uid_to_name($userid); | |
| 635 | + print ("</A>"); | |
| 636 | + ?> | |
| 637 | +<FONT SIZE=-1> | |
| 638 | + | |
| 639 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 640 | + </FONT></TD> | |
| 641 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 642 | + </TD></TR></TABLE><BR><BR><CENTER> | |
| 643 | + <?php | |
| 644 | + exit("$lang_err_file_lock ".uid_to_name($file_lock)."."); | |
| 645 | + } | |
| 646 | + } | |
| 647 | + | |
| 648 | + header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); | |
| 649 | + | |
| 650 | + | |
| 617 | 651 | } else { |
| 618 | - if ($file_lock == $userid) { | |
| 619 | - // check the file back in | |
| 620 | - $sql->query("update $default->owl_files_table set checked_out='0' where id='$id'"); | |
| 621 | - } else { | |
| 622 | - // throw error; someone else is trying to lock the file! | |
| 623 | 652 | include("./lib/header.inc"); |
| 624 | - print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30> | |
| 625 | - <TR><TD ALIGN=LEFT>"); | |
| 626 | - print("$lang_user: "); | |
| 627 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 628 | - print uid_to_name($userid); | |
| 629 | - print("</A>"); | |
| 630 | - print("<FONT SIZE=-1>" | |
| 631 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 632 | -?> | |
| 633 | - </FONT></TD> | |
| 634 | - <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 653 | + print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); | |
| 654 | + ?> | |
| 655 | + <TR><TD ALIGN=LEFT> | |
| 656 | + <?php print("$lang_user: "); | |
| 657 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 658 | + print uid_to_name($userid); | |
| 659 | + print ("</A>"); | |
| 660 | + ?> | |
| 661 | +<FONT SIZE=-1> | |
| 662 | + | |
| 663 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 664 | + </FONT></TD> | |
| 665 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 635 | 666 | </TD></TR></TABLE><BR><BR><CENTER> |
| 636 | -<?php | |
| 637 | - exit("$lang_err_file_lock ".uid_to_name($file_lock)."."); | |
| 638 | - } | |
| 667 | + <?php | |
| 668 | + exit($lang_nofilemod); | |
| 639 | 669 | } |
| 640 | - header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); | |
| 641 | - } else { | |
| 642 | - include("./lib/header.inc"); | |
| 643 | - print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); | |
| 644 | -?> | |
| 645 | - <TR><TD ALIGN=LEFT> | |
| 646 | -<?php | |
| 647 | - print("$lang_user: "); | |
| 648 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 649 | - print uid_to_name($userid); | |
| 650 | - print ("</A>"); | |
| 651 | -?> | |
| 652 | - <FONT SIZE=-1> | |
| 653 | -<?php | |
| 654 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 655 | -?> | |
| 656 | - </FONT></TD> | |
| 657 | - <TD ALIGN=RIGHT> | |
| 658 | -<?php | |
| 659 | - print("<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>"); | |
| 660 | -?> | |
| 661 | - </TD></TR></TABLE><BR><BR><CENTER> | |
| 662 | -<?php | |
| 663 | - exit($lang_nofilemod); | |
| 664 | - } | |
| 665 | 670 | } |
| 666 | 671 | // End Daphne Change |
| 667 | 672 | |
| 668 | 673 | if($action == "file_email") { |
| 669 | - if(check_auth($parent, "folder_modify", $userid) == 1) { | |
| 670 | - $sql = new Owl_DB; | |
| 674 | + | |
| 675 | + if(check_auth($parent, "folder_modify", $userid) == 1) { | |
| 676 | + | |
| 677 | + $sql = new Owl_DB; | |
| 671 | 678 | $path=""; |
| 672 | - $filename= flid_to_filename($id); | |
| 679 | + $filename= flid_to_filename($id); | |
| 673 | 680 | if ($default->owl_use_fs) { |
| 674 | - $fID=$parent; | |
| 675 | - do { | |
| 676 | - $sql->query("select name,parent from $default->owl_folders_table where id='$fID'"); | |
| 677 | - while($sql->next_record()) { | |
| 678 | - $tName = $sql->f("name"); | |
| 679 | - $fID = $sql->f("parent"); | |
| 680 | - } | |
| 681 | - $path=$tName."/".$path; | |
| 682 | - } while ($fID != 0); | |
| 681 | + $fID=$parent; | |
| 682 | + do { | |
| 683 | + $sql->query("select name,parent from $default->owl_folders_table where id='$fID'"); | |
| 684 | + while($sql->next_record()) { | |
| 685 | + $tName = $sql->f("name"); | |
| 686 | + $fID = $sql->f("parent"); | |
| 687 | + } | |
| 688 | + $path=$tName."/".$path; | |
| 689 | + } while ($fID != 0); | |
| 683 | 690 | } |
| 684 | - $sql->query("select name, filename, description from $default->owl_files_table where id='$id'"); | |
| 685 | - $sql->next_record(); | |
| 686 | - $name= $sql->f("name"); | |
| 687 | - $desc= $sql->f("description"); | |
| 691 | + $sql->query("select name, filename, description from $default->owl_files_table where id='$id'"); | |
| 692 | + $sql->next_record(); | |
| 693 | + $name= $sql->f("name"); | |
| 694 | + $desc= $sql->f("description"); | |
| 688 | 695 | $filename = $sql->f("filename"); |
| 689 | 696 | |
| 690 | 697 | $mail = new phpmailer(); |
| 698 | + | |
| 691 | 699 | $mail->IsSMTP(); // set mailer to use SMTP |
| 692 | 700 | $mail->Host = "$default->owl_email_server"; // specify main and backup server |
| 693 | 701 | $mail->From = "$default->owl_email_from"; |
| 694 | 702 | $mail->FromName = "$default->owl_email_fromname"; |
| 695 | 703 | |
| 696 | - $r=preg_split("(\;|\,)",$mailto); | |
| 697 | - reset ($r); | |
| 698 | - while (list ($occ, $email) = each ($r)) { | |
| 704 | + $r=preg_split("(\;|\,)",$mailto); | |
| 705 | + reset ($r); | |
| 706 | + while (list ($occ, $email) = each ($r)) | |
| 699 | 707 | $mail->AddAddress($email); |
| 700 | - } | |
| 701 | - if($replyto == "" ) { | |
| 708 | + if($replyto == "" ) | |
| 702 | 709 | $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet"); |
| 703 | - } else { | |
| 710 | + else | |
| 704 | 711 | $mail->AddReplyTo("$replyto"); |
| 705 | - } | |
| 706 | 712 | |
| 707 | - if($ccto != "") { | |
| 708 | - $mail->AddCC("$ccto"); | |
| 709 | - } | |
| 713 | + if($ccto != "") | |
| 714 | + $mail->AddCC("$ccto"); | |
| 715 | + | |
| 710 | 716 | |
| 711 | 717 | $mail->WordWrap = 50; // set word wrap to 50 characters |
| 712 | 718 | $mail->IsHTML(true); // set email format to HTML |
| 713 | 719 | |
| 714 | 720 | $mail->Subject = "$lang_file: $name -- $subject"; |
| 715 | - if ($type != "url") { | |
| 716 | - $mail->Body = "$mailbody" . "<BR><BR>" . "$lang_description: <BR><BR>$desc"; | |
| 717 | - $mail->altBody = "$mailbody" . "\n\n" . "$lang_description: \n\n $desc"; | |
| 721 | + if ($type != "url") { | |
| 722 | + $mail->Body = "$mailbody" . "<BR><BR>" . "$lang_description: <BR><BR>$desc"; | |
| 723 | + $mail->altBody = "$mailbody" . "\n\n" . "$lang_description: \n\n $desc"; | |
| 718 | 724 | // BEGIN wes change |
| 719 | - if (!$default->owl_use_fs) { | |
| 720 | - if (file_exists("$default->owl_FileDir/$path$filename")) { | |
| 721 | - unlink("$default->owl_FileDir/$path$filename"); | |
| 722 | - } | |
| 723 | - $file = fopen("$default->owl_FileDir/$path$filename", 'wb'); | |
| 724 | - $sql->query("select data,compressed from $default->owl_files_data_table where id='$id'"); | |
| 725 | - while ($sql->next_record()) { | |
| 726 | - if ($sql->f("compressed")) { | |
| 727 | - $tmpfile = $default->owl_FileDir . "owltmp.$id.gz"; | |
| 728 | - $uncomptmpfile = $default->owl_FileDir . "owltmp.$id"; | |
| 729 | - if (file_exists($tmpfile)) { | |
| 730 | - unlink($tmpfile); | |
| 731 | - } | |
| 732 | - | |
| 733 | - $fp=fopen($tmpfile,"w"); | |
| 734 | - fwrite($fp, $sql->f("data")); | |
| 735 | - fclose($fp); | |
| 736 | - | |
| 737 | - system($default->gzip_path . " -df $tmpfile"); | |
| 738 | - | |
| 739 | - $fsize = filesize($uncomptmpfile); | |
| 740 | - $fd = fopen($uncomptmpfile, 'rb'); | |
| 741 | - $filedata = fread($fd, $fsize); | |
| 742 | - fclose($fd); | |
| 743 | - | |
| 744 | - fwrite($file, $filedata); | |
| 745 | - unlink($uncomptmpfile); | |
| 746 | - } else { | |
| 747 | - fwrite($file, $sql->f("data")); | |
| 748 | - } | |
| 725 | + if (!$default->owl_use_fs) { | |
| 726 | + if (file_exists("$default->owl_FileDir/$path$filename")) { | |
| 727 | + unlink("$default->owl_FileDir/$path$filename"); | |
| 728 | + } | |
| 729 | + $file = fopen("$default->owl_FileDir/$path$filename", 'wb'); | |
| 730 | + $sql->query("select data,compressed from $default->owl_files_data_table where id='$id'"); | |
| 731 | + while ($sql->next_record()) { | |
| 732 | + if ($sql->f("compressed")) { | |
| 733 | + | |
| 734 | + $tmpfile = $default->owl_FileDir . "owltmp.$id.gz"; | |
| 735 | + $uncomptmpfile = $default->owl_FileDir . "owltmp.$id"; | |
| 736 | + if (file_exists($tmpfile)) unlink($tmpfile); | |
| 737 | + | |
| 738 | + $fp=fopen($tmpfile,"w"); | |
| 739 | + fwrite($fp, $sql->f("data")); | |
| 740 | + fclose($fp); | |
| 741 | + | |
| 742 | + system($default->gzip_path . " -df $tmpfile"); | |
| 743 | + | |
| 744 | + $fsize = filesize($uncomptmpfile); | |
| 745 | + $fd = fopen($uncomptmpfile, 'rb'); | |
| 746 | + $filedata = fread($fd, $fsize); | |
| 747 | + fclose($fd); | |
| 748 | + | |
| 749 | + fwrite($file, $filedata); | |
| 750 | + unlink($uncomptmpfile); | |
| 751 | + } else { | |
| 752 | + fwrite($file, $sql->f("data")); | |
| 753 | + } | |
| 749 | 754 | } |
| 750 | - fclose($file); | |
| 751 | - } | |
| 755 | + fclose($file); | |
| 756 | + } | |
| 752 | 757 | |
| 753 | 758 | $mail->AddAttachment("$default->owl_FileDir/$path$filename"); |
| 754 | - } else { | |
| 759 | + } | |
| 760 | + else { | |
| 755 | 761 | $mail->Body = "$filename" . "<BR><BR>" . "$mailbody" . "<BR><BR>" . "$lang_description: <BR><BR>$desc"; |
| 756 | 762 | $mail->altBody = "$filename" . "\n\n" ."$mailbody" . "\n\n" . "$lang_description: \n\n $desc"; |
| 757 | - } | |
| 763 | + } | |
| 758 | 764 | |
| 759 | - if(!$mail->Send()) { | |
| 760 | - printError($lang_err_email, $mail->ErrorInfo); | |
| 761 | - //printError("Server:$default->owl_email_server<BR>File:$default->owl_FileDir/$path$filename ", $mail->ErrorInfo); | |
| 765 | + if(!$mail->Send()) | |
| 766 | + { | |
| 767 | + printError($lang_err_email, $mail->ErrorInfo); | |
| 768 | + //printError("Server:$default->owl_email_server<BR>File:$default->owl_FileDir/$path$filename ", $mail->ErrorInfo); | |
| 762 | 769 | } |
| 763 | 770 | if (!$default->owl_use_fs) { |
| 764 | - unlink("$default->owl_FileDir/$path$filename"); | |
| 765 | - } | |
| 771 | + unlink("$default->owl_FileDir/$path$filename"); | |
| 772 | + } | |
| 773 | + | |
| 766 | 774 | } |
| 767 | 775 | } |
| 768 | 776 | |
| 777 | + | |
| 769 | 778 | if($action == "folder_create") { |
| 770 | 779 | if(check_auth($parent, "folder_modify", $userid) == 1) { |
| 771 | - $sql = new Owl_DB; | |
| 780 | + $sql = new Owl_DB; | |
| 772 | 781 | //we have to be careful with the name just like with the files |
| 773 | - //Comment this one out TRACKER : 603887, this was not done for renaming a folder | |
| 774 | - // So lets see if it causes problems while creating folders. | |
| 782 | + //Comment this one out TRACKER : 603887, this was not done for renaming a folder | |
| 783 | + // So lets see if it causes problems while creating folders. | |
| 775 | 784 | // Seems it causes a problem, so I put it back. |
| 776 | 785 | $name = ereg_replace("[^-A-Za-z0-9._[:space:]]", "", ereg_replace("%20|^-", " ", $name)); |
| 777 | 786 | $sql->query("select * from $default->owl_folders_table where name = '$name' and parent = '$parent'"); |
| 778 | - if($sql->num_rows() > 0) { | |
| 779 | - printError("$lang_err_folder_exist",""); | |
| 780 | - } | |
| 787 | + if($sql->num_rows() > 0) | |
| 788 | + printError("$lang_err_folder_exist",""); | |
| 781 | 789 | |
| 782 | - if ( $name == '') { | |
| 783 | - printError($lang_err_nameempty,""); | |
| 784 | - } | |
| 790 | + if ( $name == '') | |
| 791 | + printError($lang_err_nameempty,""); | |
| 785 | 792 | |
| 786 | 793 | if($default->owl_use_fs) { |
| 787 | 794 | $path = find_path($parent); |
| 788 | 795 | mkdir($default->owl_FileDir."/".$path."/".$name, 0777); |
| 789 | 796 | if(!is_dir("$default->owl_FileDir/$path/$name")) { |
| 790 | - if ($default->debug == true) { | |
| 791 | - printError($lang_err_folder_create,"$default->owl_FileDir/$path/$name"); | |
| 792 | - } else { | |
| 793 | - printError($lang_err_folder_create,""); | |
| 794 | - } | |
| 795 | - } | |
| 797 | + if ($default->debug == true) | |
| 798 | + printError($lang_err_folder_create,"$default->owl_FileDir/$path/$name"); | |
| 799 | + else | |
| 800 | + printError($lang_err_folder_create,""); | |
| 801 | + } | |
| 802 | + } | |
| 796 | 803 | $sql->query("insert into $default->owl_folders_table (name,parent,security,groupid,creatorid) values ('$name', '$parent', '$policy', '$groupid', '$userid')"); |
| 797 | - header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); | |
| 798 | - } | |
| 799 | - } else { | |
| 800 | - include("./lib/header.inc"); | |
| 801 | - print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); | |
| 802 | -?> | |
| 803 | - <TR><TD ALIGN=LEFT> | |
| 804 | -<?php | |
| 805 | - print("$lang_user: "); | |
| 806 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 807 | - print uid_to_name($userid); | |
| 808 | - print ("</A>"); | |
| 809 | -?> | |
| 810 | - <FONT SIZE=-1> | |
| 811 | -<?php | |
| 812 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 813 | -?> | |
| 814 | - </FONT></TD> | |
| 815 | - <TD ALIGN=RIGHT> | |
| 816 | -<?php | |
| 817 | - print("<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>"); | |
| 818 | -?> | |
| 819 | - </TD></TR></TABLE><BR><BR><CENTER> | |
| 820 | -<?php | |
| 821 | - exit($lang_nosubfolder); | |
| 822 | - } | |
| 804 | + header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); | |
| 805 | + } else { | |
| 806 | + include("./lib/header.inc"); | |
| 807 | + print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); | |
| 808 | + ?> | |
| 809 | + <TR><TD ALIGN=LEFT> | |
| 810 | + <?php print("$lang_user: "); | |
| 811 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 812 | + print uid_to_name($userid); | |
| 813 | + print ("</A>"); | |
| 814 | + ?> | |
| 815 | +<FONT SIZE=-1> | |
| 816 | + | |
| 817 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 818 | + </FONT></TD> | |
| 819 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 820 | + </TD></TR></TABLE><BR><BR><CENTER> | |
| 821 | + <?php | |
| 822 | + exit($lang_nosubfolder); | |
| 823 | + } | |
| 823 | 824 | } |
| 824 | 825 | |
| 825 | 826 | if($action == "folder_modify") { |
| 826 | - if(check_auth($id, "folder_modify", $userid) == 1) { | |
| 827 | - $sql = new Owl_DB; | |
| 828 | - $origname = fid_to_name($id); | |
| 827 | + if(check_auth($id, "folder_modify", $userid) == 1) { | |
| 828 | + $sql = new Owl_DB; | |
| 829 | + $origname = fid_to_name($id); | |
| 829 | 830 | $sql->query("select parent from $default->owl_folders_table where id = '$id'"); |
| 830 | - while($sql->next_record()) { | |
| 831 | - $parent = $sql->f("parent"); | |
| 832 | - } | |
| 831 | + while($sql->next_record()) $parent = $sql->f("parent"); | |
| 833 | 832 | $path = $default->owl_FileDir."/".find_path($parent)."/"; |
| 834 | - $source = $path . $origname; | |
| 833 | + $source = $path . $origname; | |
| 835 | 834 | $name = ereg_replace("[^-A-Za-z0-9._[:space:]]", "", ereg_replace("%20|^-", " ", $name)); |
| 836 | - $dest = $path . $name; | |
| 835 | + $dest = $path . $name; | |
| 837 | 836 | |
| 838 | 837 | if ($default->owl_use_fs) { |
| 839 | - if (!file_exists($path . $name) == 1 || $source == $dest) { | |
| 840 | - if (substr(php_uname(), 0, 7) != "Windows") { | |
| 841 | - if ($source != $dest) { | |
| 842 | - $cmd="mv \"$path$origname\" \"$path$name\" 2>&1"; | |
| 843 | - $lines=array();$errco=0; | |
| 844 | - $result = myExec($cmd,$lines,$errco); | |
| 845 | - if ( $errco != 0 ) { | |
| 846 | - printError($lang_err_movecancel, $result); | |
| 847 | - } | |
| 848 | - } | |
| 849 | - } else { | |
| 850 | - // IF Windows just do a rename and hope for the best | |
| 851 | - rename ("$path$origname", "$path$name"); | |
| 838 | + if (!file_exists($path . $name) == 1 || $source == $dest) { | |
| 839 | + if (substr(php_uname(), 0, 7) != "Windows") { | |
| 840 | + if ($source != $dest) { | |
| 841 | + $cmd="mv \"$path$origname\" \"$path$name\" 2>&1"; | |
| 842 | + $lines=array();$errco=0; | |
| 843 | + $result = myExec($cmd,$lines,$errco); | |
| 844 | + if ( $errco != 0 ) | |
| 845 | + printError($lang_err_movecancel, $result); | |
| 846 | + } | |
| 847 | + } | |
| 848 | + else { | |
| 849 | + // IF Windows just do a rename and hope for the best | |
| 850 | + rename ("$path$origname", "$path$name"); | |
| 851 | + } | |
| 852 | + | |
| 853 | + } | |
| 854 | + else | |
| 855 | + printError($lang_err_folderexists,""); | |
| 856 | + } | |
| 857 | + else { | |
| 858 | + $sql->query("select * from $default->owl_folders_table where parent = '$parent' and name = '$name'"); | |
| 859 | + if ($sql->num_rows($sql) != 0) | |
| 860 | + printError($lang_err_folderexists,""); | |
| 852 | 861 | } |
| 853 | - } else { | |
| 854 | - printError($lang_err_folderexists,""); | |
| 855 | - } | |
| 856 | - } else { | |
| 857 | - $sql->query("select * from $default->owl_folders_table where parent = '$parent' and name = '$name'"); | |
| 858 | - if ($sql->num_rows($sql) != 0) { | |
| 859 | - printError($lang_err_folderexists,""); | |
| 860 | - } | |
| 861 | - } | |
| 862 | - /* BEGIN Bozz Change | |
| 863 | - If your not part of the Administartor Group | |
| 864 | - the Folder will have your group ID assigned to it */ | |
| 865 | - if ( owlusergroup($userid) != 0 ) { | |
| 862 | + /* BEGIN Bozz Change | |
| 863 | + If your not part of the Administartor Group | |
| 864 | + the Folder will have your group ID assigned to it */ | |
| 865 | + if ( owlusergroup($userid) != 0 ) | |
| 866 | + { | |
| 866 | 867 | $sql->query("update $default->owl_folders_table set name='$name', security='$policy' where id = '$id'"); |
| 867 | - } else { | |
| 868 | + } | |
| 869 | + else | |
| 870 | + { | |
| 868 | 871 | $sql->query("update $default->owl_folders_table set name='$name', security='$policy', groupid='$groupid' where id = '$id'"); |
| 869 | - } | |
| 870 | - // Bozz change End | |
| 871 | - | |
| 872 | + } | |
| 873 | + | |
| 874 | + | |
| 875 | + // Bozz change End | |
| 872 | 876 | header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); |
| 873 | 877 | } else { |
| 874 | 878 | include("./lib/header.inc"); |
| 875 | 879 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| 876 | -?> | |
| 880 | + ?> | |
| 877 | 881 | <TR><TD ALIGN=LEFT> |
| 878 | -<?php | |
| 879 | - print("$lang_user: "); | |
| 880 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 881 | - print uid_to_name($userid); | |
| 882 | - print ("</A>"); | |
| 883 | -?> | |
| 884 | - <FONT SIZE=-1> | |
| 885 | -<?php | |
| 886 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 887 | -?> | |
| 888 | - </FONT></TD> | |
| 889 | - <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 890 | - </TD></TR></TABLE><BR><BR><CENTER> | |
| 891 | -<?php | |
| 882 | + <?php print("$lang_user: "); | |
| 883 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 884 | + print uid_to_name($userid); | |
| 885 | + print ("</A>"); | |
| 886 | + ?> | |
| 887 | +<FONT SIZE=-1> | |
| 888 | + | |
| 889 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 890 | + </FONT></TD> | |
| 891 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 892 | + </TD></TR></TABLE><BR><BR><CENTER> | |
| 893 | + <?php | |
| 892 | 894 | exit($lang_nofoldermod); |
| 893 | 895 | } |
| 894 | 896 | } |
| 895 | 897 | |
| 896 | 898 | if($action == "folder_delete") { |
| 897 | - if(check_auth($id, "folder_delete", $userid) == 1) { | |
| 898 | - $sql = new Owl_DB; | |
| 899 | - $sql->query("select id,name,parent from $default->owl_folders_table order by name"); | |
| 900 | - $fCount = ($sql->nf()); | |
| 901 | - $i = 0; | |
| 902 | - while($sql->next_record()) { | |
| 903 | - $folderList[$i][0] = $sql->f("id"); | |
| 904 | - $folderList[$i][2] = $sql->f("parent"); | |
| 905 | - $i++; | |
| 899 | + if(check_auth($id, "folder_delete", $userid) == 1) { | |
| 900 | + $sql = new Owl_DB; | |
| 901 | + $sql->query("select id,name,parent from $default->owl_folders_table order by name"); | |
| 902 | + $fCount = ($sql->nf()); | |
| 903 | + $i = 0; | |
| 904 | + while($sql->next_record()) { | |
| 905 | + $folderList[$i][0] = $sql->f("id"); | |
| 906 | + $folderList[$i][2] = $sql->f("parent"); | |
| 907 | + $i++; | |
| 906 | 908 | } |
| 907 | - if ($default->owl_use_fs) { | |
| 909 | + if ($default->owl_use_fs) | |
| 908 | 910 | myDelete($default->owl_FileDir."/".find_path($id)); |
| 909 | - } | |
| 910 | 911 | |
| 911 | 912 | delTree($id); |
| 912 | 913 | sleep(.5); |
| ... | ... | @@ -914,50 +915,50 @@ if($action == "folder_delete") { |
| 914 | 915 | } else { |
| 915 | 916 | include("./lib/header.inc"); |
| 916 | 917 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| 917 | -?> | |
| 918 | + ?> | |
| 918 | 919 | <TR><TD ALIGN=LEFT> |
| 919 | -<?php | |
| 920 | - print("$lang_user: "); | |
| 921 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 922 | - print uid_to_name($userid); | |
| 923 | - print ("</A>"); | |
| 924 | -?> | |
| 925 | - <FONT SIZE=-1> | |
| 926 | - | |
| 927 | -<?php | |
| 928 | - print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 929 | -?> | |
| 930 | - </FONT></TD> | |
| 931 | - <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 932 | - </TD></TR></TABLE><BR><BR><CENTER> | |
| 933 | -<?php | |
| 920 | + <?php print("$lang_user: "); | |
| 921 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand'>"); | |
| 922 | + print uid_to_name($userid); | |
| 923 | + print ("</A>"); | |
| 924 | + ?> | |
| 925 | +<FONT SIZE=-1> | |
| 926 | + | |
| 927 | + <?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 928 | + </FONT></TD> | |
| 929 | + <TD ALIGN=RIGHT><?php print("<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>"); ?> | |
| 930 | + </TD></TR></TABLE><BR><BR><CENTER> | |
| 931 | + <?php | |
| 934 | 932 | exit($lang_nofolderdelete); |
| 935 | 933 | } |
| 936 | 934 | } |
| 937 | 935 | |
| 938 | 936 | if($action == "user") { |
| 939 | - // the following should prevent users from changing others passwords. | |
| 940 | - $sql = new Owl_DB; | |
| 941 | - $sql->query("select * from $default->owl_sessions_table where uid = '$id' and sessid = '$sess'"); | |
| 942 | - if($sql->num_rows() <> 1) { | |
| 943 | - die ("$lang_err_unauthorized"); | |
| 944 | - } | |
| 945 | - | |
| 946 | - if ($newpassword <> '') { | |
| 937 | + // | |
| 938 | + // the following should prevent users from changing others passwords. | |
| 939 | + // | |
| 947 | 940 | $sql = new Owl_DB; |
| 948 | - $sql->query("select * from $default->owl_users_table where id = '$id' and password = '" . md5($oldpassword) ."'"); | |
| 949 | - if($sql->num_rows() == 0) { | |
| 950 | - die("$lang_err_pass_wrong"); | |
| 941 | + $sql->query("select * from $default->owl_sessions_table where uid = '$id' and sessid = '$sess'"); | |
| 942 | + if($sql->num_rows() <> 1) | |
| 943 | + { | |
| 944 | + die ("$lang_err_unauthorized"); | |
| 951 | 945 | } |
| 952 | - if ( $newpassword == $confpassword) { | |
| 953 | - $sql->query("UPDATE $default->owl_users_table SET name='$name',password='" . md5("$newpassword") . "' where id = '$id'"); | |
| 954 | - } else { | |
| 955 | - die ("$lang_err_pass_missmatch"); | |
| 946 | + | |
| 947 | + if ($newpassword <> '') | |
| 948 | + { | |
| 949 | + $sql = new Owl_DB; | |
| 950 | + $sql->query("select * from $default->owl_users_table where id = '$id' and password = '" . md5($oldpassword) ."'"); | |
| 951 | + if($sql->num_rows() == 0) | |
| 952 | + die("$lang_err_pass_wrong"); | |
| 953 | + if ( $newpassword == $confpassword) | |
| 954 | + $sql->query("UPDATE $default->owl_users_table SET name='$name',password='" . md5("$newpassword") . "' where id = '$id'"); | |
| 955 | + else | |
| 956 | + die ("$lang_err_pass_missmatch"); | |
| 956 | 957 | } |
| 957 | - } | |
| 958 | - $sql->query("UPDATE $default->owl_users_table SET name='$name', email='$email', notify='$notify', attachfile='$attachfile', language='$newlanguage' where id = '$id'"); | |
| 958 | + $sql->query("UPDATE $default->owl_users_table SET name='$name', email='$email', notify='$notify', attachfile='$attachfile', language='$newlanguage' where id = '$id'"); | |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | + | |
| 961 | 962 | header("Location: browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname"); |
| 962 | 963 | |
| 963 | 964 | ?> | ... | ... |
download.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/** | |
| 3 | +/* | |
| 4 | 4 | * download.php |
| 5 | 5 | * |
| 6 | - * Allows the user to download the contents of a folder in zip format | |
| 7 | - * | |
| 8 | 6 | * Copyright (c) 1999-2002 The Owl Project Team |
| 9 | 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 10 | 8 | * |
| 11 | 9 | * $Id$ |
| 12 | - * | |
| 13 | - * @todo line 187 spin out into separate function | |
| 14 | - * @todo line 195 spin out into separate function | |
| 15 | - */ | |
| 10 | +*/ | |
| 16 | 11 | |
| 17 | 12 | require("./config/owl.php"); |
| 18 | 13 | require("./lib/owl.lib.php"); |
| 19 | 14 | require("./config/html.php"); |
| 20 | 15 | require("./lib/security.lib.php"); |
| 21 | 16 | |
| 22 | -/** | |
| 23 | -* Finds the path from the root folder to the required folder | |
| 24 | -* | |
| 25 | -* @param $parent required folder | |
| 26 | -* | |
| 27 | -* @returns string containing path from root folder to required folder | |
| 28 | -*/ | |
| 29 | 17 | function find_path($parent) { |
| 30 | 18 | global $parent, $default; |
| 31 | 19 | $path = fid_to_name($parent); |
| ... | ... | @@ -40,13 +28,6 @@ function find_path($parent) { |
| 40 | 28 | return $path; |
| 41 | 29 | } |
| 42 | 30 | |
| 43 | -/** | |
| 44 | -* Get a file name for a file id | |
| 45 | -* | |
| 46 | -* @paramater $id file id | |
| 47 | -* | |
| 48 | -* @return string file name | |
| 49 | -*/ | |
| 50 | 31 | function fid_to_filename($id) { |
| 51 | 32 | global $default; |
| 52 | 33 | $sql = new Owl_DB; |
| ... | ... | @@ -54,22 +35,16 @@ function fid_to_filename($id) { |
| 54 | 35 | while($sql->next_record()) return $sql->f("filename"); |
| 55 | 36 | } |
| 56 | 37 | |
| 57 | -/** | |
| 58 | -* Zips an entire folder, including sub folders and places the resulting | |
| 59 | -* zip file in a temporary directory just off $default->owl_FileDir | |
| 60 | -* | |
| 61 | -* @param $id folder id | |
| 62 | -* @param $userid current user id | |
| 63 | -*/ | |
| 64 | 38 | function zip_folder($id, $userid) { |
| 65 | 39 | |
| 66 | 40 | global $default, $sess; |
| 67 | 41 | |
| 68 | - $tmpdir = $default->owl_FileDir . "/owltmpfld_$sess.$id"; | |
| 42 | + $tmpdir = $default->owl_FileDir . "/owltmpfld_$sess.$id"; | |
| 43 | + //if (file_exists($tmpdir)) system("rm -rf " . escapeshellarg($tmpdir)); | |
| 69 | 44 | if (file_exists($tmpdir)) myDelete($tmpdir); |
| 70 | 45 | |
| 71 | 46 | mkdir("$tmpdir", 0777); |
| 72 | - | |
| 47 | + //system("mkdir " . escapeshellarg($tmpdir)); | |
| 73 | 48 | $sql = new Owl_DB; |
| 74 | 49 | $sql2 = new Owl_DB; |
| 75 | 50 | |
| ... | ... | @@ -79,6 +54,7 @@ function zip_folder($id, $userid) { |
| 79 | 54 | } |
| 80 | 55 | $path = "$tmpdir/$top"; |
| 81 | 56 | mkdir("$path", 0777); |
| 57 | + //system("mkdir " . escapeshellarg($path)); | |
| 82 | 58 | |
| 83 | 59 | folder_loop($sql, $sql2, $id, $path, $userid); |
| 84 | 60 | // get all files in folder |
| ... | ... | @@ -114,19 +90,11 @@ function zip_folder($id, $userid) { |
| 114 | 90 | |
| 115 | 91 | |
| 116 | 92 | |
| 117 | -/** | |
| 118 | -* | |
| 119 | -* @param $sql query selecting the id and name of the folder from the $default->owl_folders_table | |
| 120 | -* @param $sql2 not sure what this param is - its previous value appears to have no bearing on the recursive nature of the function | |
| 121 | -* @param $id folder id | |
| 122 | -* @param $tmpdir temporary director in which zip file will be placed | |
| 123 | -* @param $userid current user id | |
| 124 | -*/ | |
| 93 | +//function folder_loop(&$sql, &$sql2, $id, $tmpdir, $userid) { | |
| 125 | 94 | function folder_loop($sql, $sql2, $id, $tmpdir, $userid) { |
| 126 | 95 | |
| 127 | 96 | global $default; |
| 128 | 97 | |
| 129 | - //if you have rights to the folder | |
| 130 | 98 | if(check_auth($id, "folder_view", $userid) == 1) { |
| 131 | 99 | |
| 132 | 100 | $sql = new Owl_DB; |
| ... | ... | @@ -137,15 +105,10 @@ function folder_loop($sql, $sql2, $id, $tmpdir, $userid) { |
| 137 | 105 | $filename = $tmpdir . "/" . $sql->f("filename"); |
| 138 | 106 | if(check_auth($fid, "file_download", $userid) == 1) { |
| 139 | 107 | |
| 140 | - //if documents are being stored using the file system | |
| 141 | - //simply place a copy of the file in the temporary directory | |
| 142 | 108 | if ($default->owl_use_fs) { |
| 143 | 109 | $source = $default->owl_FileDir . "/" . get_dirpath($id) . "/" . $sql->f("filename"); |
| 144 | 110 | copy($source, $filename); |
| 145 | 111 | } |
| 146 | - //else documents are being stored in the database | |
| 147 | - //and a file must be created in the temporary directory for the document | |
| 148 | - //and filled with the data stored in the database | |
| 149 | 112 | else { |
| 150 | 113 | $sql2->query("select data,compressed from " . $default->owl_files_data_table . " where id='$fid'"); |
| 151 | 114 | while($sql2->next_record()) { |
| ... | ... | @@ -160,9 +123,9 @@ function folder_loop($sql, $sql2, $id, $tmpdir, $userid) { |
| 160 | 123 | $fp=fopen($filename,"w"); |
| 161 | 124 | fwrite($fp, $sql2->f("data")); |
| 162 | 125 | fclose($fp); |
| 163 | - } // end if | |
| 126 | + } // end if | |
| 164 | 127 | |
| 165 | - } // end if | |
| 128 | + } // end if | |
| 166 | 129 | |
| 167 | 130 | } // end while |
| 168 | 131 | ... | ... |
index.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/* | |
| 3 | +/** | |
| 4 | 4 | * index.php -- Main page |
| 5 | + * | |
| 6 | + * This is the main login page | |
| 7 | + * Does some user verification and authentication as well as | |
| 8 | + * Determining the Role of the User logging in (i.e. Admin or user) | |
| 9 | + * | |
| 10 | + * Creates a new session for the user for duration of usage | |
| 5 | 11 | * |
| 6 | - * Copyright (c) 1999-2002 The Owl Project Team | |
| 7 | 12 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | 13 | * |
| 9 | - * $Id$ | |
| 14 | + * @version v 1.1.1.1 2002/12/04 | |
| 15 | + * @Copyright (c) 1999-2002 The Owl Project Team | |
| 16 | + * @author michael | |
| 17 | + * @package test | |
| 18 | + */ | |
| 19 | + | |
| 10 | 20 | */ |
| 11 | 21 | require("./config/owl.php"); |
| 12 | 22 | require("./lib/owl.lib.php"); |
| 13 | 23 | require("./config/html.php"); |
| 14 | 24 | |
| 15 | -if (checkrequirements() == 1) { | |
| 25 | +//check the requirements | |
| 26 | +if (checkrequirements() == 1) | |
| 27 | +{ | |
| 16 | 28 | exit; |
| 17 | 29 | } |
| 18 | -if(!isset($failure)) $failure = 0; | |
| 19 | -if(!$login) $login = 1; | |
| 30 | +/* | |
| 31 | +* $failure is a counter to the number of times the user has tried to | |
| 32 | +* login. | |
| 33 | +*/ | |
| 34 | +if(!isset($failure)) | |
| 35 | +{ | |
| 36 | + $failure = 0; | |
| 37 | +} | |
| 38 | +if(!$login) | |
| 39 | +{ | |
| 40 | + $login = 1; | |
| 41 | +} | |
| 20 | 42 | |
| 21 | -if($loginname && $password) { | |
| 43 | +// if requirements are met | |
| 44 | +if($loginname && $password) | |
| 45 | +{ | |
| 46 | + //Verifies the Login and password of the user | |
| 22 | 47 | $verified["bit"] = 0; |
| 23 | 48 | $verified = verify_login($loginname, $password); |
| 24 | - if ($verified["bit"] == 1) { | |
| 49 | + if ($verified["bit"] == 1) | |
| 50 | + { | |
| 51 | + // if verified open a new session | |
| 25 | 52 | $session = new Owl_Session; |
| 26 | 53 | $uid = $session->Open_Session(0,$verified["uid"]); |
| 27 | 54 | /* |
| ... | ... | @@ -31,41 +58,57 @@ if($loginname && $password) { |
| 31 | 58 | */ |
| 32 | 59 | $id = 1; |
| 33 | 60 | |
| 34 | - | |
| 35 | - | |
| 36 | - | |
| 37 | - /* BEGIN Bozz Change */ | |
| 61 | + /* BEGIN Admin Change */ | |
| 38 | 62 | |
| 39 | 63 | /* If an admin signs on We want to se the admin menu |
| 40 | 64 | Not the File Browser. */ |
| 41 | - if ( $verified["group"] == 0) | |
| 42 | - { | |
| 43 | - if(!isset($fileid)) | |
| 44 | - header("Location: admin/index.php?sess=". $uid->sessdata["sessid"]); | |
| 45 | - else | |
| 46 | - header("Location: browse.php?sess=". $uid->sessdata["sessid"]."&parent=$parent&fileid=$fileid"); | |
| 47 | - } | |
| 48 | - else | |
| 49 | - { | |
| 50 | - if(!isset($fileid)) | |
| 51 | - header("Location: browse.php?sess=". $uid->sessdata["sessid"]); | |
| 52 | - else | |
| 53 | - header("Location: browse.php?sess=". $uid->sessdata["sessid"]."&parent=$parent&fileid=$fileid"); | |
| 54 | - } | |
| 55 | - /* END Bozz Change */ | |
| 65 | + if ( $verified["group"] == 0) | |
| 66 | + { | |
| 67 | + // if admin logs on..goto the admin main page | |
| 68 | + // else goto the normal file browser page | |
| 69 | + if(!isset($fileid)) | |
| 70 | + { | |
| 71 | + header("Location: admin/index.php?sess=". $uid->sessdata["sessid"]); | |
| 72 | + } | |
| 73 | + else | |
| 74 | + { | |
| 75 | + header("Location: browse.php?sess=". $uid->sessdata["sessid"]."&parent=$parent&fileid=$fileid"); | |
| 76 | + } | |
| 77 | + } | |
| 78 | + else | |
| 79 | + { | |
| 80 | + if(!isset($fileid)) | |
| 81 | + { | |
| 82 | + header("Location: browse.php?sess=". $uid->sessdata["sessid"]); | |
| 83 | + } | |
| 84 | + else | |
| 85 | + { | |
| 86 | + header("Location: browse.php?sess=". $uid->sessdata["sessid"]."&parent=$parent&fileid=$fileid"); | |
| 87 | + } | |
| 88 | + } | |
| 89 | + /* END Admin Change */ | |
| 56 | 90 | |
| 57 | - } else { | |
| 58 | - if ($verified["bit"] == 2) | |
| 59 | - header("Location: index.php?login=1&failure=2"); | |
| 60 | - else if ($verified["bit"] == 3 ) | |
| 61 | - header("Location: index.php?login=1&failure=3"); | |
| 62 | - else | |
| 63 | - header("Location: index.php?login=1&failure=1"); | |
| 64 | 91 | } |
| 92 | + else | |
| 93 | + {//normal user..check failures | |
| 94 | + if ($verified["bit"] == 2) | |
| 95 | + { | |
| 96 | + header("Location: index.php?login=1&failure=2"); | |
| 97 | + } | |
| 98 | + else if ($verified["bit"] == 3 ) | |
| 99 | + { | |
| 100 | + header("Location: index.php?login=1&failure=3"); | |
| 101 | + } | |
| 102 | + else | |
| 103 | + { | |
| 104 | + header("Location: index.php?login=1&failure=1"); | |
| 105 | + } | |
| 106 | + } | |
| 65 | 107 | } |
| 66 | 108 | |
| 67 | - | |
| 68 | -if(($login == 1) || ($failure == 1)) { | |
| 109 | +// | |
| 110 | +if(($login == 1) || ($failure == 1)) | |
| 111 | + { | |
| 69 | 112 | include("./lib/header.inc"); |
| 70 | 113 | print("<CENTER>"); |
| 71 | 114 | // BUG Number: 457588 |
| ... | ... | @@ -73,22 +116,35 @@ if(($login == 1) || ($failure == 1)) { |
| 73 | 116 | // BEGIN |
| 74 | 117 | print("<IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/$default->logo'><BR>$lang_engine<BR>$lang_version: $default->version<BR><HR WIDTH=300>"); |
| 75 | 118 | // END |
| 76 | - if($failure == 1) print("<BR>$lang_loginfail<BR>"); | |
| 77 | - if($failure == 2) print("<BR>$lang_logindisabled<BR>"); | |
| 78 | - if($failure == 3) print("<BR>$lang_toomanysessions<BR>"); | |
| 119 | + if($failure == 1) | |
| 120 | + { | |
| 121 | + print("<BR>$lang_loginfail<BR>"); | |
| 122 | + } | |
| 123 | + if($failure == 2) | |
| 124 | + { | |
| 125 | + print("<BR>$lang_logindisabled<BR>"); | |
| 126 | + } | |
| 127 | + if($failure == 3) | |
| 128 | + { | |
| 129 | + print("<BR>$lang_toomanysessions<BR>"); | |
| 130 | + } | |
| 79 | 131 | print "<FORM ACTION=index.php METHOD=POST>"; |
| 80 | - if (isset($fileid)) { | |
| 132 | + | |
| 133 | + if (isset($fileid)) | |
| 134 | + { | |
| 81 | 135 | print "<INPUT TYPE=HIDDEN NAME=parent value=$parent>"; |
| 82 | 136 | print "<INPUT TYPE=HIDDEN NAME=fileid value=$fileid>"; |
| 83 | 137 | } |
| 138 | + | |
| 84 | 139 | print "<TABLE><TR><TD>$lang_username:</TD><TD><INPUT TYPE=TEXT NAME=loginname><BR></TD></TR>"; |
| 85 | 140 | print "<TR><TD>$lang_password:</TD><TD><INPUT TYPE=PASSWORD NAME=password><BR></TD></TR></TABLE>"; |
| 86 | 141 | print "<INPUT TYPE=SUBMIT Value=$lang_login>\n"; |
| 87 | 142 | print "<BR><BR><HR WIDTH=300>"; |
| 88 | 143 | exit; |
| 89 | 144 | } |
| 90 | - | |
| 91 | -if($login == "logout") { | |
| 145 | +// when the user logouts the session is deleted from the session table | |
| 146 | +if($login == "logout") | |
| 147 | +{ | |
| 92 | 148 | include("./lib/header.inc"); |
| 93 | 149 | print("<CENTER>"); |
| 94 | 150 | // BUG Number: 457588 | ... | ... |
lib/owl.lib.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/** | |
| 4 | - * owl.lib.php | |
| 3 | + | |
| 4 | +/* owl.lib.php | |
| 5 | 5 | * |
| 6 | - * Main library routines, language and session handling. | |
| 6 | + * contains the major owl classes and functions | |
| 7 | 7 | * |
| 8 | 8 | * Copyright (c) 1999-2002 The Owl Project Team |
| 9 | 9 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 10 | - * | |
| 11 | - * $Id$ | |
| 12 | - * @todo move classes to their own files (Owl_DB, Owl_Session) | |
| 13 | - * @todo refactor functions by function (authentication, session, language) | |
| 10 | + * @version v 1.1.1.1 2002/12/04 | |
| 11 | + * @author michael | |
| 12 | + * @package Owl | |
| 14 | 13 | */ |
| 15 | - | |
| 14 | + | |
| 16 | 15 | // Support for reg.globals off WES |
| 17 | -if (substr(phpversion(),0,5) >= "4.1.0") { | |
| 18 | - import_request_variables('pgc'); | |
| 19 | -} else { | |
| 20 | - if (!EMPTY($_POST)) { | |
| 21 | - extract($_POST); | |
| 22 | - } else { | |
| 23 | - extract($HTTP_POST_VARS); | |
| 24 | - } | |
| 25 | - if (!EMPTY($_GET)) { | |
| 26 | - extract($_GET); | |
| 27 | - } else { | |
| 28 | - extract($HTTP_GET_VARS); | |
| 29 | - } | |
| 30 | - if (!EMPTY($_FILE)) { | |
| 31 | - extract($_FILE); | |
| 32 | - } else { | |
| 33 | - extract($HTTP_POST_FILES); | |
| 34 | - } | |
| 16 | + | |
| 17 | +// check for phpversion | |
| 18 | +if (substr(phpversion(),0,5) >= "4.1.0") | |
| 19 | + { | |
| 20 | + import_request_variables('pgc'); | |
| 21 | + } | |
| 22 | + else | |
| 23 | + { | |
| 24 | + if (!EMPTY($_POST)) | |
| 25 | + { | |
| 26 | + extract($_POST); | |
| 27 | + } | |
| 28 | + else | |
| 29 | + { | |
| 30 | + extract($HTTP_POST_VARS); | |
| 31 | + } | |
| 32 | + if (!EMPTY($_GET)) | |
| 33 | + { | |
| 34 | + extract($_GET); | |
| 35 | + } | |
| 36 | + else | |
| 37 | + { | |
| 38 | + extract($HTTP_GET_VARS); | |
| 39 | + } | |
| 40 | + | |
| 41 | + if (!EMPTY($_FILE)) | |
| 42 | + { | |
| 43 | + extract($_FILE); | |
| 44 | + } | |
| 45 | + else | |
| 46 | + { | |
| 47 | + extract($HTTP_POST_FILES); | |
| 48 | + } | |
| 35 | 49 | } |
| 36 | 50 | |
| 37 | -if(!isset($sess)) { | |
| 51 | + | |
| 52 | +//set initial session var | |
| 53 | +if(!isset($sess)) | |
| 54 | +{ | |
| 38 | 55 | $sess = 0; |
| 39 | 56 | } |
| 40 | -if(!isset($loginname)) { | |
| 41 | - $loginname = 0; | |
| 57 | + | |
| 58 | +// set initial loginname | |
| 59 | +if(!isset($loginname)) | |
| 60 | +{ | |
| 61 | + $loginname = 0; | |
| 42 | 62 | } |
| 43 | -if(!isset($login)) { | |
| 44 | - $login = 0; | |
| 63 | +//set login var | |
| 64 | +if(!isset($login)) | |
| 65 | +{ | |
| 66 | + $login = 0; | |
| 45 | 67 | } |
| 46 | 68 | |
| 47 | -// load appropriate language | |
| 48 | -if(isset($default->owl_lang)) { | |
| 69 | +// set default language | |
| 70 | +if(isset($default->owl_lang)) | |
| 71 | + { | |
| 49 | 72 | $langdir = "$default->owl_fs_root/locale/$default->owl_lang"; |
| 50 | - if(is_dir("$langdir") != 1) { | |
| 73 | + | |
| 74 | + if(is_dir("$langdir") != 1) | |
| 75 | + { | |
| 51 | 76 | die("$lang_err_lang_1 $langdir $lang_err_lang_2"); |
| 52 | - } else { | |
| 77 | + } | |
| 78 | + else | |
| 79 | + { | |
| 53 | 80 | $sql = new Owl_DB; |
| 54 | - $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'"); | |
| 81 | + $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'"); | |
| 55 | 82 | $sql->next_record(); |
| 56 | - $numrows = $sql->num_rows($sql); | |
| 57 | - $getuid = $sql->f("uid"); | |
| 58 | - if($numrows == 1) { | |
| 59 | - $sql->query("select * from $default->owl_users_table where id = $getuid"); | |
| 83 | + $numrows = $sql->num_rows($sql); | |
| 84 | + $getuid = $sql->f("uid"); | |
| 85 | + if($numrows == 1) | |
| 86 | + { | |
| 87 | + $sql->query("select * from $default->owl_users_table where id = $getuid"); | |
| 60 | 88 | $sql->next_record(); |
| 61 | - $language = $sql->f("language"); | |
| 89 | + $language = $sql->f("language"); | |
| 62 | 90 | // BEGIN wes fix |
| 63 | - if(!$language) { | |
| 64 | - $language = $default->owl_lang; | |
| 91 | + if(!$language) | |
| 92 | + { | |
| 93 | + $language = $default->owl_lang; | |
| 65 | 94 | } |
| 66 | 95 | // END wes fix |
| 67 | 96 | require("$default->owl_fs_root/locale/$language/language.inc"); |
| 68 | 97 | $default->owl_lang = $language; |
| 69 | - } else { | |
| 98 | + } | |
| 99 | + else | |
| 70 | 100 | require("$default->owl_fs_root/locale/$default->owl_lang/language.inc"); |
| 71 | - } | |
| 72 | 101 | } |
| 73 | 102 | } else { |
| 74 | 103 | die("$lang_err_lang_notfound"); |
| 75 | 104 | } |
| 76 | 105 | |
| 77 | - | |
| 78 | 106 | /** |
| 79 | - * Owl specific database class. | |
| 107 | + * class Owl_DB extends DB_Sql | |
| 108 | + * | |
| 109 | + * This class is used for DB connections | |
| 110 | + * | |
| 111 | + * @version v 1.1.1.1 2002/12/04 | |
| 112 | + * @author michael | |
| 113 | + * @package Owl | |
| 80 | 114 | */ |
| 115 | + | |
| 81 | 116 | class Owl_DB extends DB_Sql { |
| 82 | - /** | |
| 83 | - * Identifier for this class | |
| 84 | - */ | |
| 85 | - var $classname = "Owl_DB"; | |
| 86 | - | |
| 87 | - // BEGIN wes changes -- moved these settings to config/owl.php | |
| 88 | - | |
| 89 | - /** | |
| 90 | - * Server where the database resides | |
| 91 | - */ | |
| 92 | - var $Host = ""; | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * Database name | |
| 96 | - */ | |
| 97 | - var $Database = ""; | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * User to access database | |
| 101 | - */ | |
| 102 | - var $User = ""; | |
| 103 | - | |
| 104 | - /** | |
| 105 | - * Password for database | |
| 106 | - */ | |
| 107 | - var $Password = ""; | |
| 108 | - | |
| 109 | - /** | |
| 110 | - * Creates an instance of Owl_DB. | |
| 111 | - * This constructor sets the connection details | |
| 112 | - * from the global defaults defined in config/owl.php | |
| 113 | - */ | |
| 117 | + | |
| 118 | + //declare member variables | |
| 119 | + var $classname = "Owl_DB"; | |
| 120 | + | |
| 121 | + // BEGIN wes changes -- moved these settings to config/owl.php | |
| 122 | + // Server where the database resides | |
| 123 | + var $Host = ""; | |
| 124 | + | |
| 125 | + // Database name | |
| 126 | + var $Database = ""; | |
| 127 | + | |
| 128 | + // User to access database | |
| 129 | + var $User = ""; | |
| 130 | + | |
| 131 | + // Password for database | |
| 132 | + var $Password = ""; | |
| 133 | +//------------------------------------------------------------ | |
| 134 | +/** | |
| 135 | + * Function Owl_DB | |
| 136 | + * | |
| 137 | + * Default Constructor | |
| 138 | + * | |
| 139 | +*/ | |
| 140 | +//------------------------------------------------------------ | |
| 141 | +// Usable | |
| 114 | 142 | function Owl_DB() { |
| 115 | - global $default; | |
| 116 | - $this->Host = $default->owl_db_host; | |
| 117 | - $this->Database = $default->owl_db_name; | |
| 118 | - $this->User = $default->owl_db_user; | |
| 119 | - $this->Password = $default->owl_db_pass; | |
| 143 | + global $default; | |
| 144 | + $this->Host = $default->owl_db_host; | |
| 145 | + $this->Database = $default->owl_db_name; | |
| 146 | + $this->User = $default->owl_db_user; | |
| 147 | + $this->Password = $default->owl_db_pass; | |
| 120 | 148 | } |
| 121 | 149 | // END wes changes |
| 122 | 150 | |
| 123 | - /** | |
| 124 | - * Prints database error message | |
| 125 | - * | |
| 126 | - * @param $msg the error message | |
| 127 | - */ | |
| 128 | - function haltmsg($msg) { | |
| 129 | - printf("</td></table><b>Database error:</b> %s<br>\n", $msg); | |
| 130 | - printf("<b>SQL Error</b>: %s (%s)<br>\n", $this->Errno, $this->Error); | |
| 131 | - } | |
| 151 | +//------------------------------------------------------------ | |
| 152 | +/** | |
| 153 | + * Function haltmsg | |
| 154 | + * | |
| 155 | + * Error Handling | |
| 156 | + * | |
| 157 | +*/ | |
| 158 | +//------------------------------------------------------------ | |
| 159 | +//usable | |
| 160 | + function haltmsg($msg) | |
| 161 | + { | |
| 162 | + printf("</td></table><b>Database error:</b> %s<br>\n", $msg); | |
| 163 | + printf("<b>SQL Error</b>: %s (%s)<br>\n", | |
| 164 | + $this->Errno, $this->Error); | |
| 165 | + } | |
| 132 | 166 | } |
| 133 | 167 | |
| 168 | +/** | |
| 169 | + * class Owl_Session | |
| 170 | + * | |
| 171 | + * This class is used for opening and closing sessions | |
| 172 | + * | |
| 173 | + * @version v 1.1.1.1 2002/12/04 | |
| 174 | + * @author michael | |
| 175 | + * @package Owl | |
| 176 | +*/ | |
| 134 | 177 | class Owl_Session { |
| 135 | 178 | var $sessid; |
| 136 | 179 | var $sessuid; |
| 137 | 180 | var $sessdata; |
| 138 | 181 | |
| 139 | - | |
| 182 | +//------------------------------------------------------------ | |
| 183 | +/** | |
| 184 | + * Function Open_Session($sessid=0, $sessuid=0) | |
| 185 | + * | |
| 186 | + * Opens a session | |
| 187 | + * | |
| 188 | + * @param $sessid | |
| 189 | + * The Session id | |
| 190 | + * @param ssessuid | |
| 191 | + * The user session id | |
| 192 | + * @Return $this | |
| 193 | + * Return the session | |
| 194 | + * | |
| 195 | +*/ | |
| 196 | +//------------------------------------------------------------ | |
| 197 | +// Usable | |
| 140 | 198 | function Open_Session($sessid=0, $sessuid=0) { |
| 141 | 199 | global $default; |
| 142 | 200 | $this->sessid = $sessid; |
| 143 | 201 | $this->sessuid = $sessuid; |
| 144 | 202 | |
| 145 | - if($sessid == "0") { // if there is no user loged in, then create a session for them | |
| 203 | + // if there is no user loged in, then create a session for them | |
| 204 | + if($sessid == "0") | |
| 205 | + { | |
| 146 | 206 | $current = time(); |
| 147 | 207 | $random = $this->sessuid . $current; |
| 148 | 208 | $this->sessid = md5($random); |
| 149 | 209 | $sql = new Owl_DB; |
| 150 | - if(getenv("HTTP_CLIENT_IP")) { | |
| 210 | + | |
| 211 | + if(getenv("HTTP_CLIENT_IP")) | |
| 212 | + { | |
| 151 | 213 | $ip = getenv("HTTP_CLIENT_IP"); |
| 152 | - } elseif(getenv("HTTP_X_FORWARDED_FOR")) { | |
| 214 | + } | |
| 215 | + elseif(getenv("HTTP_X_FORWARDED_FOR")) | |
| 216 | + { | |
| 153 | 217 | $forwardedip = getenv("HTTP_X_FORWARDED_FOR"); |
| 154 | 218 | list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip); |
| 155 | - } else { | |
| 219 | + } | |
| 220 | + else | |
| 221 | + { | |
| 156 | 222 | $ip = getenv("REMOTE_ADDR"); |
| 157 | 223 | } |
| 158 | 224 | //$result = $sql->query("insert into active_sessions values ('$this->sessid', '$this->sessuid', '$current', '$ip')"); |
| 159 | 225 | $result = $sql->query("insert into $default->owl_sessions_table values ('$this->sessid', '$this->sessuid', '$current', '$ip')"); |
| 160 | - if(!'result') die("$lang_err_sess_write"); | |
| 226 | + | |
| 227 | + if(!'result') | |
| 228 | + { | |
| 229 | + die("$lang_err_sess_write"); | |
| 230 | + } | |
| 161 | 231 | } |
| 162 | 232 | |
| 163 | 233 | // else we have a session id, try to validate it... |
| ... | ... | @@ -175,12 +245,37 @@ class Owl_Session { |
| 175 | 245 | return $this; |
| 176 | 246 | } |
| 177 | 247 | } |
| 178 | -function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) { | |
| 248 | + | |
| 249 | + | |
| 250 | +//------------------------------------------------------------ | |
| 251 | +/** | |
| 252 | + * Function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | |
| 253 | + * | |
| 254 | + * Used to notify users | |
| 255 | + * | |
| 256 | + * @param $groupid | |
| 257 | + * The Id of the group | |
| 258 | + * @param $flag | |
| 259 | + * The relvant flag | |
| 260 | + * @param $filename | |
| 261 | + * The relevant filename | |
| 262 | + * @param $title | |
| 263 | + * The relevant title | |
| 264 | + * @param $desc | |
| 265 | + * The description | |
| 266 | + * @param $type | |
| 267 | + * the Relevant type | |
| 268 | + */ | |
| 269 | +//------------------------------------------------------------- | |
| 270 | +// Semi-Usable Some Interface based code | |
| 271 | +function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | |
| 272 | +{ | |
| 179 | 273 | global $default; |
| 180 | 274 | global $lang_notif_subject_new, $lang_notif_subject_upd, $lang_notif_msg; |
| 181 | 275 | global $lang_title, $lang_description; |
| 182 | 276 | $sql = new Owl_DB; |
| 183 | 277 | // BEGIN BUG 548994 |
| 278 | + // get the fileid | |
| 184 | 279 | $path = find_path($parent); |
| 185 | 280 | $sql->query("select id from $default->owl_files_table where filename='$filename' AND parent='$parent'"); |
| 186 | 281 | $sql->next_record(); |
| ... | ... | @@ -188,10 +283,13 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 188 | 283 | // END BUG 548994 More Below |
| 189 | 284 | $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)"); |
| 190 | 285 | |
| 286 | + // loop through records | |
| 191 | 287 | while($sql->next_record()) |
| 192 | 288 | { |
| 193 | 289 | // BEGIN BUG 548994 |
| 194 | - if ( check_auth($fileid, "file_download", $sql->f(id)) == 1 ) { | |
| 290 | + // check authentication rights | |
| 291 | + if ( check_auth($fileid, "file_download", $sql->f(id)) == 1 ) | |
| 292 | + { | |
| 195 | 293 | // END BUG 548994 More Below |
| 196 | 294 | $newpath = ereg_replace(" ","%20",$path); |
| 197 | 295 | $newfilename = ereg_replace(" ","%20",$filename); |
| ... | ... | @@ -200,7 +298,8 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 200 | 298 | |
| 201 | 299 | $r=preg_split("(\;|\,)",$sql->f("email")); |
| 202 | 300 | reset ($r); |
| 203 | - while (list ($occ, $email) = each ($r)) { | |
| 301 | + while (list ($occ, $email) = each ($r)) | |
| 302 | + { | |
| 204 | 303 | $mail = new phpmailer(); |
| 205 | 304 | // Create a temporary session id, the user |
| 206 | 305 | // will need to get to this file before |
| ... | ... | @@ -209,6 +308,7 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 209 | 308 | $uid = $session->Open_Session(0,$sql->f("id")); |
| 210 | 309 | $tempsess = $uid->sessdata["sessid"]; |
| 211 | 310 | |
| 311 | + // if flag set to 0 | |
| 212 | 312 | if ( $flag == 0 ) { |
| 213 | 313 | $mail->IsSMTP(); // set mailer to use SMTP |
| 214 | 314 | $mail->Host = "$default->owl_email_server"; // specify main and backup server |
| ... | ... | @@ -219,18 +319,30 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 219 | 319 | $mail->WordWrap = 50; // set word wrap to 50 characters |
| 220 | 320 | $mail->IsHTML(true); // set email format to HTML |
| 221 | 321 | $mail->Subject = "$lang_notif_subject_new"; |
| 222 | - if ($type != "url") { | |
| 223 | - if ($sql->f("attachfile") == 1) { | |
| 322 | + | |
| 323 | + // as long as its not a url | |
| 324 | + if ($type != "url") | |
| 325 | + { | |
| 326 | + // if attachfile is true | |
| 327 | + if ($sql->f("attachfile") == 1) | |
| 328 | + { | |
| 224 | 329 | $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; |
| 225 | 330 | $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 226 | - if (!$default->owl_use_fs) { | |
| 227 | - if (file_exists("$default->owl_FileDir/$filename")) { | |
| 331 | + | |
| 332 | + // use file system | |
| 333 | + if (!$default->owl_use_fs) | |
| 334 | + { | |
| 335 | + //check if file exits | |
| 336 | + if (file_exists("$default->owl_FileDir/$filename")) | |
| 337 | + { | |
| 228 | 338 | unlink("$default->owl_FileDir/$filename"); |
| 229 | 339 | } |
| 230 | 340 | $file = fopen("$default->owl_FileDir$filename", 'wb'); |
| 231 | 341 | $getfile = new Owl_DB; |
| 232 | 342 | $getfile->query("select data,compressed from $default->owl_files_data_table where id='$fileid'"); |
| 233 | - while ($getfile->next_record()) { | |
| 343 | + while ($getfile->next_record()) | |
| 344 | + { | |
| 345 | + //check if compressed ..and uncompress it | |
| 234 | 346 | if ($getfile->f("compressed")) { |
| 235 | 347 | |
| 236 | 348 | $tmpfile = $default->owl_FileDir . "owltmp.$fileid.gz"; |
| ... | ... | @@ -250,28 +362,36 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 250 | 362 | |
| 251 | 363 | fwrite($file, $filedata); |
| 252 | 364 | unlink($uncomptmpfile); |
| 253 | - } else { | |
| 365 | + } | |
| 366 | + else | |
| 367 | + { // otherwise just write the file | |
| 254 | 368 | fwrite($file, $getfile->f("data")); |
| 255 | 369 | } |
| 256 | 370 | } |
| 257 | 371 | fclose($file); |
| 372 | + // add a mail attachment | |
| 258 | 373 | $mail->AddAttachment("$default->owl_FileDir$newfilename"); |
| 259 | - } else { | |
| 374 | + } else | |
| 375 | + { | |
| 260 | 376 | $mail->AddAttachment("$default->owl_FileDir/$newpath/$newfilename"); |
| 261 | 377 | } |
| 262 | 378 | } |
| 263 | - else { | |
| 379 | + else | |
| 380 | + { // set up mail body | |
| 264 | 381 | $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"; |
| 265 | 382 | $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 266 | 383 | } |
| 267 | 384 | } |
| 268 | - else { | |
| 385 | + else | |
| 386 | + { | |
| 269 | 387 | $mail->Body = "URL: $newfilename <BR><BR>$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; |
| 270 | 388 | $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 271 | 389 | } |
| 272 | 390 | |
| 273 | 391 | } |
| 274 | - else { | |
| 392 | + else | |
| 393 | + // set up mailer | |
| 394 | + { | |
| 275 | 395 | $mail = new phpmailer(); |
| 276 | 396 | $mail->IsSMTP(); // set mailer to use SMTP |
| 277 | 397 | $mail->Host = "$default->owl_email_server"; // specify main and backup server |
| ... | ... | @@ -282,18 +402,31 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 282 | 402 | $mail->WordWrap = 50; // set word wrap to 50 characters |
| 283 | 403 | $mail->IsHTML(true); // set email format to HTML |
| 284 | 404 | $mail->Subject = "$lang_notif_subject_upd"; |
| 285 | - if ($type != "url") { | |
| 286 | - if ($sql->f("attachfile") == 1) { | |
| 405 | + | |
| 406 | + // if type not a url | |
| 407 | + if ($type != "url") | |
| 408 | + { | |
| 409 | + // if attachfile is true..go through process of attaching file..simarly to previous | |
| 410 | + if ($sql->f("attachfile") == 1) | |
| 411 | + { | |
| 287 | 412 | $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; |
| 288 | 413 | $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 289 | - if (!$default->owl_use_fs) { | |
| 290 | - if (file_exists("$default->owl_FileDir/$filename")) { | |
| 414 | + if (!$default->owl_use_fs) | |
| 415 | + { | |
| 416 | + // check existence of file | |
| 417 | + if (file_exists("$default->owl_FileDir/$filename")) | |
| 418 | + { | |
| 291 | 419 | unlink("$default->owl_FileDir/$filename"); |
| 292 | 420 | } |
| 421 | + | |
| 293 | 422 | $file = fopen("$default->owl_FileDir$filename", 'wb'); |
| 294 | 423 | $getfile = new Owl_DB; |
| 295 | 424 | $getfile->query("select data,compressed from $default->owl_files_data_table where id='$fileid'"); |
| 296 | - while ($getfile->next_record()) { | |
| 425 | + | |
| 426 | + // get file check if compressed, if so uncompress | |
| 427 | + // otherwise write away | |
| 428 | + while ($getfile->next_record()) | |
| 429 | + { | |
| 297 | 430 | if ($getfile->f("compressed")) { |
| 298 | 431 | |
| 299 | 432 | $tmpfile = $default->owl_FileDir . "owltmp.$fileid.gz"; |
| ... | ... | @@ -313,29 +446,37 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 313 | 446 | |
| 314 | 447 | fwrite($file, $filedata); |
| 315 | 448 | unlink($uncomptmpfile); |
| 316 | - } else { | |
| 449 | + } | |
| 450 | + else | |
| 451 | + { | |
| 317 | 452 | fwrite($file, $getfile->f("data")); |
| 318 | 453 | } |
| 319 | 454 | } |
| 320 | 455 | fclose($file); |
| 321 | 456 | $mail->AddAttachment("$default->owl_FileDir$newfilename"); |
| 322 | - } else { | |
| 457 | + } | |
| 458 | + else | |
| 459 | + { | |
| 323 | 460 | $mail->AddAttachment("$default->owl_FileDir/$newpath/$newfilename"); |
| 324 | 461 | } |
| 325 | 462 | |
| 326 | 463 | } |
| 327 | - else { | |
| 464 | + else | |
| 465 | + { | |
| 328 | 466 | $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"; |
| 329 | 467 | $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 330 | 468 | } |
| 331 | 469 | } |
| 332 | - else { | |
| 470 | + else | |
| 471 | + { | |
| 333 | 472 | $mail->Body = "URL: $newfilename <BR><BR>$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; |
| 334 | 473 | $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 335 | 474 | } |
| 336 | 475 | } |
| 476 | + // send the email | |
| 337 | 477 | $mail->Send(); |
| 338 | - if (!$default->owl_use_fs && $sql->f("attachfile") == 1) { | |
| 478 | + if (!$default->owl_use_fs && $sql->f("attachfile") == 1) | |
| 479 | + { | |
| 339 | 480 | unlink("$default->owl_FileDir$newfilename"); |
| 340 | 481 | } |
| 341 | 482 | |
| ... | ... | @@ -346,7 +487,21 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 346 | 487 | // END BUG 548994 |
| 347 | 488 | } |
| 348 | 489 | |
| 349 | -function verify_login($username, $password) { | |
| 490 | +//------------------------------------------------------------ | |
| 491 | +/** | |
| 492 | + * Function verify_login($username, $password) | |
| 493 | + * | |
| 494 | + * Used to verify a users login name and password | |
| 495 | + * | |
| 496 | + * @param $username | |
| 497 | + * The username to verfiy | |
| 498 | + * @param $password | |
| 499 | + * The password to verify | |
| 500 | + */ | |
| 501 | +//------------------------------------------------------------- | |
| 502 | +// Usable | |
| 503 | +function verify_login($username, $password) | |
| 504 | +{ | |
| 350 | 505 | global $default; |
| 351 | 506 | $sql = new Owl_DB; |
| 352 | 507 | $query = "select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'"; |
| ... | ... | @@ -355,7 +510,8 @@ function verify_login($username, $password) { |
| 355 | 510 | // Bozz Begin added Password Encryption above, but for now |
| 356 | 511 | // I will allow admin to use non crypted password untile he |
| 357 | 512 | // upgrades all users |
| 358 | - if ($numrows == "1") { | |
| 513 | + if ($numrows == "1") | |
| 514 | + { | |
| 359 | 515 | while($sql->next_record()) { |
| 360 | 516 | if ( $sql->f("disabled") == 1 ) |
| 361 | 517 | $verified["bit"] = 2; |
| ... | ... | @@ -369,11 +525,15 @@ function verify_login($username, $password) { |
| 369 | 525 | } |
| 370 | 526 | // Remove this else in a future version |
| 371 | 527 | else { |
| 372 | - if ($username == "admin") { | |
| 528 | + // username admin check password | |
| 529 | + if ($username == "admin") | |
| 530 | + { | |
| 373 | 531 | $sql->query("select * from $default->owl_users_table where username = '$username' and password = '$password'"); |
| 374 | 532 | $numrows = $sql->num_rows($sql); |
| 375 | - if ($numrows == "1") { | |
| 376 | - while($sql->next_record()) { | |
| 533 | + if ($numrows == "1") | |
| 534 | + { | |
| 535 | + while($sql->next_record()) | |
| 536 | + { | |
| 377 | 537 | $verified["bit"] = 1; |
| 378 | 538 | $verified["user"] = $sql->f("username"); |
| 379 | 539 | $verified["uid"] = $sql->f("id"); |
| ... | ... | @@ -404,34 +564,63 @@ function verify_login($username, $password) { |
| 404 | 564 | return $verified; |
| 405 | 565 | } |
| 406 | 566 | |
| 567 | +//------------------------------------------------------------ | |
| 568 | +/** | |
| 569 | + * Function verify_session($username, $password) | |
| 570 | + * | |
| 571 | + * Used to verify a users session | |
| 572 | + * | |
| 573 | + * @param $username | |
| 574 | + * The username to check | |
| 575 | + * @param $password | |
| 576 | + * The password to check | |
| 577 | + */ | |
| 578 | +//------------------------------------------------------------- | |
| 579 | +// Usable | |
| 580 | + | |
| 407 | 581 | function verify_session($sess) { |
| 408 | 582 | getprefs(); |
| 409 | 583 | global $default, $lang_sesstimeout, $lang_sessinuse, $lang_clicklogin; |
| 410 | 584 | $sess = ltrim($sess); |
| 411 | 585 | $verified["bit"] = 0; |
| 586 | + | |
| 412 | 587 | $sql = new Owl_DB; |
| 413 | 588 | $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'"); |
| 414 | 589 | $numrows = $sql->num_rows($sql); |
| 415 | 590 | $time = time(); |
| 416 | - if ($numrows == "1") { | |
| 417 | - while($sql->next_record()) { | |
| 418 | - if(getenv("HTTP_CLIENT_IP")) { | |
| 591 | + | |
| 592 | + if ($numrows == "1") | |
| 593 | + { | |
| 594 | + while($sql->next_record()) | |
| 595 | + { | |
| 596 | + if(getenv("HTTP_CLIENT_IP")) | |
| 597 | + { | |
| 419 | 598 | $ip = getenv("HTTP_CLIENT_IP"); |
| 420 | - } elseif(getenv("HTTP_X_FORWARDED_FOR")) { | |
| 599 | + } | |
| 600 | + elseif(getenv("HTTP_X_FORWARDED_FOR")) | |
| 601 | + { | |
| 421 | 602 | $forwardedip = getenv("HTTP_X_FORWARDED_FOR"); |
| 422 | 603 | list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip); |
| 423 | - } else { | |
| 604 | + } | |
| 605 | + else | |
| 606 | + { | |
| 424 | 607 | $ip = getenv("REMOTE_ADDR"); |
| 425 | 608 | } |
| 426 | - if ($ip == $sql->f("ip")) { | |
| 427 | - if(($time - $sql->f("lastused")) <= $default->owl_timeout) { | |
| 609 | + if ($ip == $sql->f("ip")) | |
| 610 | + { | |
| 611 | + // if timeout not exceeded | |
| 612 | + if(($time - $sql->f("lastused")) <= $default->owl_timeout) | |
| 613 | + { | |
| 428 | 614 | $verified["bit"] = 1; |
| 429 | 615 | $verified["userid"] = $sql->f("uid"); |
| 430 | 616 | $sql->query("select * from $default->owl_users_table where id = '".$verified["userid"]."'"); |
| 431 | 617 | while($sql->next_record()) $verified["groupid"] = $sql->f("groupid"); |
| 432 | - } else { | |
| 618 | + } | |
| 619 | + else | |
| 620 | + { | |
| 433 | 621 | // Bozz Bug Fix begin |
| 434 | - if (file_exists("./lib/header.inc")) { | |
| 622 | + if (file_exists("./lib/header.inc")) | |
| 623 | + { | |
| 435 | 624 | include("./lib/header.inc"); |
| 436 | 625 | } else { |
| 437 | 626 | include("../lib/header.inc"); |
| ... | ... | @@ -460,80 +649,257 @@ function verify_session($sess) { |
| 460 | 649 | return $verified; |
| 461 | 650 | } |
| 462 | 651 | |
| 463 | -function fid_to_name($parent) { | |
| 652 | +//------------------------------------------------------------ | |
| 653 | +/** | |
| 654 | + * Function fid_to_name($parent) | |
| 655 | + * | |
| 656 | + * used to get the folder name | |
| 657 | + * | |
| 658 | + * @param $parent | |
| 659 | + * The parent id | |
| 660 | + * @Return $sql->f("name"); | |
| 661 | + * Return the name of the folder | |
| 662 | +*/ | |
| 663 | +//------------------------------------------------------------- | |
| 664 | +// Usable | |
| 665 | +function fid_to_name($parent) | |
| 666 | +{ | |
| 464 | 667 | global $default; |
| 465 | 668 | $sql = new Owl_DB; $sql->query("select name from $default->owl_folders_table where id = $parent"); |
| 466 | - while($sql->next_record()) return $sql->f("name"); | |
| 669 | + while($sql->next_record()) | |
| 670 | + { | |
| 671 | + return $sql->f("name"); | |
| 672 | + } | |
| 467 | 673 | } |
| 468 | 674 | |
| 469 | -function flid_to_name($id) { | |
| 675 | +//------------------------------------------------------------ | |
| 676 | +/** | |
| 677 | + * Function flid_to_name($id) | |
| 678 | + * | |
| 679 | + * Gets the filename corresponding to the file id | |
| 680 | + * | |
| 681 | + * @param $id | |
| 682 | + * The file id | |
| 683 | + * @Return $sql->f("name"); | |
| 684 | + * Return the name of the file | |
| 685 | +*/ | |
| 686 | +//------------------------------------------------------------- | |
| 687 | +// Usable | |
| 688 | +function flid_to_name($id) | |
| 689 | +{ | |
| 470 | 690 | global $default; |
| 471 | 691 | $sql = new Owl_DB; $sql->query("select name from $default->owl_files_table where id = $id"); |
| 472 | - while($sql->next_record()) return $sql->f("name"); | |
| 692 | + while($sql->next_record()) | |
| 693 | + { | |
| 694 | + return $sql->f("name"); | |
| 695 | + } | |
| 473 | 696 | } |
| 474 | 697 | |
| 698 | +//------------------------------------------------------------ | |
| 699 | +/** | |
| 700 | + * Function fid_to_filename($id) | |
| 701 | + * | |
| 702 | + * gets filename based on id | |
| 703 | + * | |
| 704 | + * @param $id | |
| 705 | + * file id | |
| 706 | + * @Return $sql->f("name"); | |
| 707 | + * Return the name of the file | |
| 708 | +*/ | |
| 709 | +//------------------------------------------------------------- | |
| 710 | +// Usable | |
| 475 | 711 | function flid_to_filename($id) { |
| 476 | 712 | global $default; |
| 477 | 713 | $sql = new Owl_DB; $sql->query("select filename from $default->owl_files_table where id = $id"); |
| 478 | - while($sql->next_record()) return $sql->f("filename"); | |
| 714 | + while($sql->next_record()) | |
| 715 | + { | |
| 716 | + return $sql->f("filename"); | |
| 717 | + } | |
| 479 | 718 | } |
| 480 | - | |
| 481 | -function owlusergroup($userid) { | |
| 719 | +//------------------------------------------------------------ | |
| 720 | +/** | |
| 721 | + * Function owlusergroup($userid) | |
| 722 | + * | |
| 723 | + * Gets the group id that the user blongs to | |
| 724 | + * | |
| 725 | + * @param $userid | |
| 726 | + * The user id | |
| 727 | + * @Return $groupid | |
| 728 | + * Return the groupId | |
| 729 | +*/ | |
| 730 | +//------------------------------------------------------------- | |
| 731 | +// Usable | |
| 732 | +function owlusergroup($userid) | |
| 733 | +{ | |
| 482 | 734 | global $default; |
| 483 | 735 | $sql = new Owl_DB; $sql->query("select groupid from $default->owl_users_table where id = '$userid'"); |
| 484 | - while($sql->next_record()) $groupid = $sql->f("groupid"); | |
| 485 | - return $groupid; | |
| 736 | + while($sql->next_record()) | |
| 737 | + { | |
| 738 | + $groupid = $sql->f("groupid"); | |
| 739 | + return $groupid; | |
| 740 | + } | |
| 486 | 741 | } |
| 487 | - | |
| 742 | +//------------------------------------------------------------ | |
| 743 | +/** | |
| 744 | + * Function owlfilecreator($fileid) | |
| 745 | + * | |
| 746 | + * used to find the file creator | |
| 747 | + * | |
| 748 | + * @param $fileid | |
| 749 | + * The parent id | |
| 750 | + * @return $filecreator | |
| 751 | + * Return the creatorid of the file | |
| 752 | +*/ | |
| 753 | +//------------------------------------------------------------- | |
| 754 | +// Usable | |
| 488 | 755 | function owlfilecreator($fileid) { |
| 489 | 756 | global $default; |
| 490 | 757 | $sql = new Owl_DB; $sql->query("select creatorid from ".$default->owl_files_table." where id = '$fileid'"); |
| 491 | - while($sql->next_record()) $filecreator = $sql->f("creatorid"); | |
| 492 | - return $filecreator; | |
| 758 | + while($sql->next_record()) | |
| 759 | + { | |
| 760 | + $filecreator = $sql->f("creatorid"); | |
| 761 | + return $filecreator; | |
| 762 | + } | |
| 493 | 763 | } |
| 494 | - | |
| 495 | -function owlfoldercreator($folderid) { | |
| 764 | +//------------------------------------------------------------ | |
| 765 | +/** | |
| 766 | + * Function owlfoldercreator($fileid) { | |
| 767 | + * | |
| 768 | + * Used to get the folder creator | |
| 769 | + * | |
| 770 | + * @param $fileid | |
| 771 | + * The file id | |
| 772 | + * @Return $foldercreator | |
| 773 | + * Return the creatorid of the folder | |
| 774 | +*/ | |
| 775 | +//------------------------------------------------------------- | |
| 776 | +// Usable | |
| 777 | +function owlfoldercreator($folderid) | |
| 778 | +{ | |
| 496 | 779 | global $default; |
| 497 | 780 | $sql = new Owl_DB; $sql->query("select creatorid from ".$default->owl_folders_table." where id = '$folderid'"); |
| 498 | - while($sql->next_record()) $foldercreator = $sql->f("creatorid"); | |
| 499 | - return $foldercreator; | |
| 781 | + while($sql->next_record()) | |
| 782 | + { | |
| 783 | + $foldercreator = $sql->f("creatorid"); | |
| 784 | + return $foldercreator; | |
| 785 | + } | |
| 500 | 786 | } |
| 501 | - | |
| 502 | -function owlfilegroup($fileid) { | |
| 787 | +//------------------------------------------------------------- | |
| 788 | +/** | |
| 789 | + * Function owlfilegroup($fileid) | |
| 790 | + * | |
| 791 | + * Used to get the file group id | |
| 792 | + * | |
| 793 | + * @param $fileid | |
| 794 | + * The file id | |
| 795 | + * @Return $filegroup; | |
| 796 | + * Returns the group id of the file group | |
| 797 | +*/ | |
| 798 | +//------------------------------------------------------------- | |
| 799 | +// Usable | |
| 800 | +function owlfilegroup($fileid) | |
| 801 | + { | |
| 503 | 802 | global $default; |
| 504 | 803 | $sql = new Owl_DB; $sql->query("select groupid from $default->owl_files_table where id = '$fileid'"); |
| 505 | - while($sql->next_record()) $filegroup = $sql->f("groupid"); | |
| 506 | - return $filegroup; | |
| 804 | + while($sql->next_record()) | |
| 805 | + { | |
| 806 | + $filegroup = $sql->f("groupid"); | |
| 807 | + return $filegroup; | |
| 808 | + } | |
| 809 | + | |
| 507 | 810 | } |
| 508 | - | |
| 811 | +//------------------------------------------------------------- | |
| 812 | +/** | |
| 813 | + * Function owlfoldergroup($folderid) | |
| 814 | + * | |
| 815 | + * Used to get the folder group id | |
| 816 | + * | |
| 817 | + * @param $folderid | |
| 818 | + * The folder id | |
| 819 | + * @Return $foldergroup; | |
| 820 | + * Returns the group id of the folder group | |
| 821 | +*/ | |
| 822 | +//------------------------------------------------------------- | |
| 823 | +// Usable | |
| 509 | 824 | function owlfoldergroup($folderid) { |
| 510 | 825 | global $default; |
| 511 | 826 | $sql = new Owl_DB; $sql->query("select groupid from $default->owl_folders_table where id = '$folderid'"); |
| 512 | - while($sql->next_record()) $foldergroup = $sql->f("groupid"); | |
| 513 | - return $foldergroup; | |
| 827 | + while($sql->next_record()) | |
| 828 | + { | |
| 829 | + $foldergroup = $sql->f("groupid"); | |
| 830 | + return $foldergroup; | |
| 831 | + } | |
| 832 | + | |
| 514 | 833 | } |
| 515 | - | |
| 516 | -function owlfolderparent($folderid) { | |
| 834 | +//------------------------------------------------------------- | |
| 835 | +/** | |
| 836 | + * Function owlfolderparent($folderid) | |
| 837 | + * | |
| 838 | + * Used to get the folder parent | |
| 839 | + * | |
| 840 | + * @param $folderid | |
| 841 | + * The folder id | |
| 842 | + * @Return $folderparent | |
| 843 | + * Returns the folderparent of from the folder | |
| 844 | +*/ | |
| 845 | +//------------------------------------------------------------- | |
| 846 | +// Usable | |
| 847 | +function owlfolderparent($folderid) | |
| 848 | + { | |
| 517 | 849 | global $default; |
| 518 | 850 | $sql = new Owl_DB; $sql->query("select parent from $default->owl_folders_table where id = '$folderid'"); |
| 519 | - while($sql->next_record()) $folderparent = $sql->f("parent"); | |
| 520 | - return $folderparent; | |
| 851 | + while($sql->next_record()) | |
| 852 | + { | |
| 853 | + $folderparent = $sql->f("parent"); | |
| 854 | + return $folderparent; | |
| 855 | + } | |
| 856 | + | |
| 521 | 857 | } |
| 522 | - | |
| 523 | -function owlfileparent($fileid) { | |
| 858 | +//------------------------------------------------------------- | |
| 859 | +/** | |
| 860 | + * Function owlfileparent($fileid) | |
| 861 | + * | |
| 862 | + * Used to get the file parent | |
| 863 | + * | |
| 864 | + * @param $fileid | |
| 865 | + * The file id | |
| 866 | + * @Return $fileparent | |
| 867 | + * Returns the file parent of from the files | |
| 868 | +*/ | |
| 869 | +//------------------------------------------------------------- | |
| 870 | +// Usable | |
| 871 | +function owlfileparent($fileid) | |
| 872 | +{ | |
| 524 | 873 | global $default; |
| 525 | 874 | $sql = new Owl_DB; $sql->query("select parent from $default->owl_files_table where id = '$fileid'"); |
| 526 | - while($sql->next_record()) $fileparent = $sql->f("parent"); | |
| 875 | + while($sql->next_record()) | |
| 876 | + { | |
| 877 | + $fileparent = $sql->f("parent"); | |
| 878 | + | |
| 527 | 879 | return $fileparent; |
| 880 | + } | |
| 528 | 881 | } |
| 529 | - | |
| 882 | +//------------------------------------------------------------ | |
| 883 | +/** | |
| 884 | + * Function fid_to_creator($id) | |
| 885 | + * | |
| 886 | + * Used to get the creator of the files | |
| 887 | + * | |
| 888 | + * @param $id | |
| 889 | + * The id | |
| 890 | + * @Return $name; | |
| 891 | + * Return the name of the creator | |
| 892 | +*/ | |
| 893 | +//------------------------------------------------------------- | |
| 894 | +// Usable | |
| 530 | 895 | function fid_to_creator($id) { |
| 531 | 896 | |
| 532 | 897 | global $default; |
| 533 | 898 | $sql = new Owl_DB; |
| 534 | 899 | $sql->query("select creatorid from ".$default->owl_files_table." where id = '$id'"); |
| 535 | 900 | $sql2 = new Owl_DB; |
| 536 | - while($sql->next_record()) { | |
| 901 | + while($sql->next_record()) | |
| 902 | + { | |
| 537 | 903 | $creatorid = $sql->f("creatorid"); |
| 538 | 904 | $sql2->query("select name from $default->owl_users_table where id = '".$creatorid."'"); |
| 539 | 905 | $sql2->next_record(); |
| ... | ... | @@ -541,36 +907,103 @@ function fid_to_creator($id) { |
| 541 | 907 | } |
| 542 | 908 | return $name; |
| 543 | 909 | } |
| 544 | - | |
| 545 | -function group_to_name($id) { | |
| 910 | +//------------------------------------------------------------ | |
| 911 | +/** | |
| 912 | + * Function group_to_name($id) | |
| 913 | + * | |
| 914 | + * select name from the group | |
| 915 | + * | |
| 916 | + * @param $id | |
| 917 | + * The id | |
| 918 | + * @Return $sql->f("name"); | |
| 919 | + * Return the name of the group | |
| 920 | +*/ | |
| 921 | +//------------------------------------------------------------- | |
| 922 | +// Usable | |
| 923 | +function group_to_name($id) | |
| 924 | +{ | |
| 546 | 925 | global $default; |
| 547 | - $sql = new Owl_DB; $sql->query("select name from $default->owl_groups_table where id = '$id'"); | |
| 548 | - while($sql->next_record()) return $sql->f("name"); | |
| 926 | + $sql = new Owl_DB; | |
| 927 | + $sql->query("select name from $default->owl_groups_table where id = '$id'"); | |
| 928 | + while($sql->next_record()) | |
| 929 | + { | |
| 930 | + return $sql->f("name"); | |
| 931 | + } | |
| 549 | 932 | } |
| 550 | - | |
| 551 | -function uid_to_name($id) { | |
| 933 | +//------------------------------------------------------------ | |
| 934 | +/** | |
| 935 | + * Function uid_to_name($id) | |
| 936 | + * | |
| 937 | + * name from the users | |
| 938 | + * | |
| 939 | + * @param $id | |
| 940 | + * The id | |
| 941 | + * @Return $name | |
| 942 | + * Return the name of the user | |
| 943 | +*/ | |
| 944 | +//------------------------------------------------------------- | |
| 945 | +// Usable | |
| 946 | +function uid_to_name($id) | |
| 947 | +{ | |
| 552 | 948 | global $default; |
| 553 | - $sql = new Owl_DB; $sql->query("select name from $default->owl_users_table where id = '$id'"); | |
| 554 | - while($sql->next_record()) $name = $sql->f("name"); | |
| 555 | - if ($name == "") $name = "Owl"; | |
| 556 | - return $name; | |
| 949 | + $sql = new Owl_DB; | |
| 950 | + $sql->query("select name from $default->owl_users_table where id = '$id'"); | |
| 951 | + while($sql->next_record()) | |
| 952 | + { | |
| 953 | + $name = $sql->f("name"); | |
| 954 | + if ($name == "") | |
| 955 | + { | |
| 956 | + $name = "Owl"; | |
| 957 | + } | |
| 958 | + return $name; | |
| 959 | + } | |
| 557 | 960 | } |
| 961 | +//------------------------------------------------------------ | |
| 962 | +/** | |
| 963 | + * Function prefaccess($id) | |
| 964 | + * | |
| 965 | + * get the noprefaccess from the users to compare if access granted | |
| 966 | + * | |
| 967 | + * @param $id | |
| 968 | + * The id | |
| 969 | + * @Return prefaccess; | |
| 970 | + * Return the name of the folder | |
| 971 | +*/ | |
| 972 | +//------------------------------------------------------------- | |
| 973 | +// Usable | |
| 558 | 974 | |
| 559 | 975 | function prefaccess($id) { |
| 560 | 976 | global $default; |
| 561 | 977 | $prefaccess = 1; |
| 562 | 978 | $sql = new Owl_DB; $sql->query("select noprefaccess from $default->owl_users_table where id = '$id'"); |
| 563 | - while($sql->next_record()) $prefaccess = !($sql->f("noprefaccess")); | |
| 564 | - return $prefaccess; | |
| 979 | + while($sql->next_record()) | |
| 980 | + { | |
| 981 | + $prefaccess = !($sql->f("noprefaccess")); | |
| 982 | + return $prefaccess; | |
| 983 | + } | |
| 565 | 984 | } |
| 566 | - | |
| 567 | -function gen_navbar($parent) { | |
| 985 | +//------------------------------------------------------------ | |
| 986 | +/** | |
| 987 | + * Function gen_navbar($parent) | |
| 988 | + * | |
| 989 | + * Used to generate a nav bar | |
| 990 | + * | |
| 991 | + * @param $parent | |
| 992 | + * The parent id | |
| 993 | + * @Return $Navbar | |
| 994 | + * Return the navbar that has been generated | |
| 995 | +*/ | |
| 996 | +//------------------------------------------------------------- | |
| 997 | +// NOT Usable -> Interface based | |
| 998 | +function gen_navbar($parent) | |
| 999 | +{ | |
| 568 | 1000 | global $default; |
| 569 | 1001 | global $sess, $expand, $sort, $sortorder, $order; |
| 570 | 1002 | $name = fid_to_name($parent); |
| 571 | 1003 | $navbar = "<A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sort'>$name</A>"; |
| 572 | 1004 | $new = $parent; |
| 573 | - while ($new != "1") { | |
| 1005 | + while ($new != "1") | |
| 1006 | + { | |
| 574 | 1007 | $sql = new Owl_DB; $sql->query("select parent from $default->owl_folders_table where id = '$new'"); |
| 575 | 1008 | while($sql->next_record()) $newparentid = $sql->f("parent"); |
| 576 | 1009 | $name = fid_to_name($newparentid); |
| ... | ... | @@ -579,7 +1012,19 @@ function gen_navbar($parent) { |
| 579 | 1012 | } |
| 580 | 1013 | return $navbar; |
| 581 | 1014 | } |
| 582 | - | |
| 1015 | +//------------------------------------------------------------ | |
| 1016 | +/** | |
| 1017 | + * Function get_dirpath($parent) | |
| 1018 | + * | |
| 1019 | + * Get the directory path from the db | |
| 1020 | + * | |
| 1021 | + * @param $parent | |
| 1022 | + * The parent id | |
| 1023 | + * @Return $Navbar; | |
| 1024 | + * Return the navbar with directory path | |
| 1025 | +*/ | |
| 1026 | +//------------------------------------------------------------- | |
| 1027 | +// NOT Usable if used in ocnjunction with navbar | |
| 583 | 1028 | //only get dir path from db |
| 584 | 1029 | function get_dirpath($parent) { |
| 585 | 1030 | global $default; |
| ... | ... | @@ -597,22 +1042,57 @@ function get_dirpath($parent) { |
| 597 | 1042 | return $navbar; |
| 598 | 1043 | } |
| 599 | 1044 | |
| 1045 | +//------------------------------------------------------------ | |
| 1046 | +/** | |
| 1047 | + * Function gen_filesze($filesize) | |
| 1048 | + * | |
| 1049 | + * generates the file size | |
| 1050 | + * | |
| 1051 | + * @param $filesize | |
| 1052 | + * The size of the file | |
| 1053 | + * @Return $file_size; | |
| 1054 | + * Return the rounded off file size | |
| 1055 | +*/ | |
| 1056 | +//------------------------------------------------------------- | |
| 1057 | +// Usable | |
| 1058 | +function gen_filesize($file_size) | |
| 1059 | +{ | |
| 1060 | + if(ereg("[^0-9]", $file_size)) | |
| 1061 | + { | |
| 1062 | + return $file_size; | |
| 1063 | + } | |
| 600 | 1064 | |
| 601 | -function gen_filesize($file_size) { | |
| 602 | - if(ereg("[^0-9]", $file_size)) return $file_size; | |
| 603 | - | |
| 604 | - if ($file_size >= 1073741824) { | |
| 1065 | + if ($file_size >= 1073741824) | |
| 1066 | + { | |
| 605 | 1067 | $file_size = round($file_size / 1073741824 * 100) / 100 . "g"; |
| 606 | - } elseif ($file_size >= 1048576) { | |
| 1068 | + } | |
| 1069 | + elseif ($file_size >= 1048576) | |
| 1070 | + { | |
| 607 | 1071 | $file_size = round($file_size / 1048576 * 100) / 100 . "m"; |
| 608 | - } elseif ($file_size >= 1024) { | |
| 1072 | + } | |
| 1073 | + elseif ($file_size >= 1024) | |
| 1074 | + { | |
| 609 | 1075 | $file_size = round($file_size / 1024 * 100) / 100 . "k"; |
| 610 | - } else { | |
| 1076 | + } | |
| 1077 | + else | |
| 1078 | + { | |
| 611 | 1079 | $file_size = $file_size . "b"; |
| 612 | 1080 | } |
| 613 | 1081 | return $file_size; |
| 614 | 1082 | } |
| 615 | - | |
| 1083 | +//------------------------------------------------------------ | |
| 1084 | +/** | |
| 1085 | + * Function unloadCompat($varname) | |
| 1086 | + * | |
| 1087 | + * used to upload | |
| 1088 | + * | |
| 1089 | + * @param $varname | |
| 1090 | + * The parent id | |
| 1091 | + * @Return $sql->f("name"); | |
| 1092 | + * Return the name of the folder | |
| 1093 | +*/ | |
| 1094 | +//------------------------------------------------------------- | |
| 1095 | +// Usable | |
| 616 | 1096 | function uploadCompat($varname) { |
| 617 | 1097 | |
| 618 | 1098 | if ($_FILES[$varname]) return $_FILES[$varname]; |
| ... | ... | @@ -625,8 +1105,9 @@ function uploadCompat($varname) { |
| 625 | 1105 | return $retfile; |
| 626 | 1106 | } |
| 627 | 1107 | |
| 628 | - | |
| 629 | -if ($sess) { | |
| 1108 | +// why is this code here???????????????????????????? is it part of the function?????? | |
| 1109 | +if ($sess) | |
| 1110 | +{ | |
| 630 | 1111 | gethtmlprefs(); |
| 631 | 1112 | $ok = verify_session($sess); |
| 632 | 1113 | $temporary_ok = $ok["bit"]; |
| ... | ... | @@ -652,11 +1133,24 @@ if ($sess) { |
| 652 | 1133 | $sql->query("update $default->owl_sessions_table set lastused = '$lastused' where uid = '$userid'"); |
| 653 | 1134 | } |
| 654 | 1135 | } |
| 1136 | + | |
| 1137 | +//------------------------------------------------------------ | |
| 1138 | +/** | |
| 1139 | + * Function checkrequirements() | |
| 1140 | + * | |
| 1141 | + * Used to check requirments | |
| 1142 | + * | |
| 1143 | + * @Return 1 | |
| 1144 | + * Returns 1 | |
| 1145 | +*/ | |
| 1146 | +//------------------------------------------------------------- | |
| 1147 | +// Usable | |
| 655 | 1148 | function checkrequirements() |
| 656 | 1149 | { |
| 657 | 1150 | global $default, $lang_err_bad_version_1, $lang_err_bad_version_2, $lang_err_bad_version_3; |
| 658 | 1151 | |
| 659 | - if (substr(phpversion(),0,5) < $default->phpversion) { | |
| 1152 | + if (substr(phpversion(),0,5) < $default->phpversion) | |
| 1153 | + { | |
| 660 | 1154 | print("<CENTER><H3>$lang_err_bad_version_1<BR>"); |
| 661 | 1155 | print("$default->phpversion<BR>"); |
| 662 | 1156 | print("$lang_err_bad_version_2<BR>"); |
| ... | ... | @@ -664,41 +1158,92 @@ function checkrequirements() |
| 664 | 1158 | print("<BR>$lang_err_bad_version_3</H3></CENTER>"); |
| 665 | 1159 | return 1; |
| 666 | 1160 | } |
| 667 | - else { | |
| 1161 | + else | |
| 1162 | + { | |
| 668 | 1163 | return 0; |
| 669 | 1164 | } |
| 670 | 1165 | } |
| 671 | - | |
| 672 | -function myExec($_cmd, &$lines, &$errco) { | |
| 1166 | +//------------------------------------------------------------ | |
| 1167 | +/** | |
| 1168 | + * Function myExec($cmd, &$lines, &$errco) | |
| 1169 | + * | |
| 1170 | + * | |
| 1171 | + * | |
| 1172 | + * @param $cmd | |
| 1173 | + * The command | |
| 1174 | + * @param $lines | |
| 1175 | + * | |
| 1176 | + * @param $errco | |
| 1177 | + * The error code | |
| 1178 | + * @Return ""; | |
| 1179 | + * Return empty string | |
| 1180 | + * @Return $lines[count($lines)-1] | |
| 1181 | + * Returns numba of lines | |
| 1182 | +*/ | |
| 1183 | +//------------------------------------------------------------- | |
| 1184 | +// Usable | |
| 1185 | +function myExec($_cmd, &$lines, &$errco) | |
| 1186 | +{ | |
| 673 | 1187 | $cmd = "$_cmd ; echo $?"; |
| 674 | 1188 | exec($cmd, $lines); |
| 675 | 1189 | // Get rid of the last errco line... |
| 676 | 1190 | $errco = (integer) array_pop($lines); |
| 677 | - if (count($lines) == 0) { | |
| 1191 | + if (count($lines) == 0) | |
| 1192 | + { | |
| 678 | 1193 | return ""; |
| 679 | - } else { | |
| 1194 | + } | |
| 1195 | + else | |
| 1196 | + { | |
| 680 | 1197 | return $lines[count($lines) - 1]; |
| 681 | 1198 | } |
| 682 | 1199 | } |
| 683 | - | |
| 1200 | +//------------------------------------------------------------ | |
| 1201 | +/** | |
| 1202 | + * Function my_delete($file) | |
| 1203 | + * | |
| 1204 | + * used to delete a file if it exists | |
| 1205 | + * | |
| 1206 | + * @param $file | |
| 1207 | + * The file to be deleted | |
| 1208 | +*/ | |
| 1209 | +//------------------------------------------------------------- | |
| 1210 | +// Usable | |
| 684 | 1211 | function myDelete($file) { |
| 685 | - if (file_exists($file)) { | |
| 1212 | + if (file_exists($file)) | |
| 1213 | + { | |
| 686 | 1214 | chmod($file,0777); |
| 687 | - if (is_dir($file)) { | |
| 1215 | + if (is_dir($file)) | |
| 1216 | + { | |
| 688 | 1217 | $handle = opendir($file); |
| 689 | - while($filename = readdir($handle)) { | |
| 690 | - if ($filename != "." && $filename != "..") { | |
| 1218 | + while($filename = readdir($handle)) | |
| 1219 | + { | |
| 1220 | + if ($filename != "." && $filename != "..") | |
| 1221 | + { | |
| 691 | 1222 | myDelete($file."/".$filename); |
| 692 | 1223 | } |
| 693 | 1224 | } |
| 694 | 1225 | closedir($handle); |
| 695 | 1226 | rmdir($file); |
| 696 | - } else { | |
| 1227 | + } | |
| 1228 | + else | |
| 1229 | + { | |
| 697 | 1230 | unlink($file); |
| 698 | 1231 | } |
| 699 | 1232 | } |
| 700 | 1233 | } |
| 701 | - | |
| 1234 | +//------------------------------------------------------------ | |
| 1235 | +/** | |
| 1236 | + * Function printError($message, $submessage) | |
| 1237 | + * | |
| 1238 | + * Prints out error messages | |
| 1239 | + * | |
| 1240 | + * @param $message | |
| 1241 | + * The message | |
| 1242 | + * @param $submessage | |
| 1243 | + * The submessage | |
| 1244 | +*/ | |
| 1245 | +//------------------------------------------------------------- | |
| 1246 | +// Not Usable -> INTERFACE Based | |
| 702 | 1247 | function printError($message, $submessage) { |
| 703 | 1248 | global $default; |
| 704 | 1249 | global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid; |
| ... | ... | @@ -730,7 +1275,15 @@ function printError($message, $submessage) { |
| 730 | 1275 | include("./lib/footer.inc"); |
| 731 | 1276 | exit(); |
| 732 | 1277 | } |
| 733 | - | |
| 1278 | +//------------------------------------------------------------ | |
| 1279 | +/** | |
| 1280 | + * Function getprefs() | |
| 1281 | + * | |
| 1282 | + * gets all the preferences | |
| 1283 | + * | |
| 1284 | +*/ | |
| 1285 | +//------------------------------------------------------------- | |
| 1286 | +// Usable | |
| 734 | 1287 | function getprefs ( ) |
| 735 | 1288 | { |
| 736 | 1289 | global $default; |
| ... | ... | @@ -765,6 +1318,15 @@ function getprefs ( ) |
| 765 | 1318 | |
| 766 | 1319 | }; |
| 767 | 1320 | |
| 1321 | +//------------------------------------------------------------ | |
| 1322 | +/** | |
| 1323 | + * Function gethtmlprefs() | |
| 1324 | + * | |
| 1325 | + * get html preferences | |
| 1326 | + * | |
| 1327 | +*/ | |
| 1328 | +//------------------------------------------------------------- | |
| 1329 | +// Usable | |
| 768 | 1330 | |
| 769 | 1331 | function gethtmlprefs ( ) |
| 770 | 1332 | { |
| ... | ... | @@ -787,7 +1349,23 @@ function gethtmlprefs ( ) |
| 787 | 1349 | $default->body_vlink = $sql->f("body_vlink"); |
| 788 | 1350 | |
| 789 | 1351 | }; |
| 790 | - | |
| 1352 | +//------------------------------------------------------------ | |
| 1353 | +/** | |
| 1354 | + * Function printfileperm($currentval, $namevariable, $printmessage, $type) | |
| 1355 | + * | |
| 1356 | + * Print file permissions | |
| 1357 | + * | |
| 1358 | + * @param $currentval | |
| 1359 | + * The current value | |
| 1360 | + * @param $namevariable | |
| 1361 | + * The name of the file | |
| 1362 | + * @param $pringmessage | |
| 1363 | + * The message to be printed | |
| 1364 | + * @param $type | |
| 1365 | + * The type of file | |
| 1366 | +*/ | |
| 1367 | +//------------------------------------------------------------- | |
| 1368 | +// SEMI-Usable Interface based | |
| 791 | 1369 | function printfileperm($currentval, $namevariable, $printmessage, $type) { |
| 792 | 1370 | global $default; |
| 793 | 1371 | global $lang_everyoneread, $lang_everyonewrite, $lang_everyonewrite_nod, $lang_groupread, $lang_groupwrite, $lang_groupwrite_nod, $lang_groupwrite_worldread, $lang_groupwrite_worldread_nod, $lang_onlyyou; |
| ... | ... | @@ -803,7 +1381,10 @@ function printfileperm($currentval, $namevariable, $printmessage, $type) { |
| 803 | 1381 | $file_perm[6][0] = 6; |
| 804 | 1382 | $file_perm[7][0] = 7; |
| 805 | 1383 | $file_perm[8][0] = 8; |
| 806 | - if ($type == "admin") { | |
| 1384 | + | |
| 1385 | + // show admin permissions | |
| 1386 | + if ($type == "admin") | |
| 1387 | + { | |
| 807 | 1388 | $file_perm[0][1] = "$lang_everyoneread_ad"; |
| 808 | 1389 | $file_perm[1][1] = "$lang_everyonewrite_ad"; |
| 809 | 1390 | $file_perm[2][1] = "$lang_groupread_ad"; |
| ... | ... | @@ -814,7 +1395,7 @@ function printfileperm($currentval, $namevariable, $printmessage, $type) { |
| 814 | 1395 | $file_perm[7][1] = "$lang_groupwrite_worldread_ad"; |
| 815 | 1396 | $file_perm[8][1] = "$lang_groupwrite_worldread_ad_nod"; |
| 816 | 1397 | } |
| 817 | - else { | |
| 1398 | + else {// otherwise show other permissions | |
| 818 | 1399 | $file_perm[0][1] = "$lang_everyoneread"; |
| 819 | 1400 | $file_perm[1][1] = "$lang_everyonewrite"; |
| 820 | 1401 | $file_perm[2][1] = "$lang_groupread"; |
| ... | ... | @@ -837,7 +1418,29 @@ function printfileperm($currentval, $namevariable, $printmessage, $type) { |
| 837 | 1418 | |
| 838 | 1419 | |
| 839 | 1420 | }; |
| 840 | - | |
| 1421 | +//------------------------------------------------------------ | |
| 1422 | +/** | |
| 1423 | + * Function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) | |
| 1424 | + * | |
| 1425 | + *prints the file icons | |
| 1426 | + * | |
| 1427 | + * @param $fid | |
| 1428 | + * The folder id | |
| 1429 | + * @param $filename | |
| 1430 | + * The name of the file | |
| 1431 | + * @param $check_out | |
| 1432 | + * checkout status | |
| 1433 | + * @param $url | |
| 1434 | + * The relevant url | |
| 1435 | + * @param $allicons | |
| 1436 | + * | |
| 1437 | + * @param $ext | |
| 1438 | + * The extension of the file | |
| 1439 | + * @Return $sql->f("name"); | |
| 1440 | + * Return the name of the folder | |
| 1441 | +*/ | |
| 1442 | +//------------------------------------------------------------- | |
| 1443 | +// NOT Usable INTERFACE based | |
| 841 | 1444 | function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) |
| 842 | 1445 | { |
| 843 | 1446 | global $default; |
| ... | ... | @@ -941,6 +1544,23 @@ function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) |
| 941 | 1544 | } |
| 942 | 1545 | }; |
| 943 | 1546 | |
| 1547 | +//------------------------------------------------------------ | |
| 1548 | +/** | |
| 1549 | + * Function printgroupperm($currentval, $namevariable, $printmessage, $type) | |
| 1550 | + * | |
| 1551 | + * Prints group permissions | |
| 1552 | + * | |
| 1553 | + * @param $currentval | |
| 1554 | + * The current value | |
| 1555 | + * @param $namevariable | |
| 1556 | + * The name of the group | |
| 1557 | + * @param $printmessage | |
| 1558 | + * The message to be printed | |
| 1559 | + * @param $type | |
| 1560 | + * The type of group | |
| 1561 | +*/ | |
| 1562 | +//------------------------------------------------------------- | |
| 1563 | +// NOT Usable INTERFACE based | |
| 944 | 1564 | function printgroupperm($currentval, $namevariable, $printmessage, $type) { |
| 945 | 1565 | global $default; |
| 946 | 1566 | global $lang_geveryoneread, $lang_geveryonewrite, $lang_geveryonewrite_nod, $lang_ggroupread, $lang_ggroupwrite, $lang_ggroupwrite_nod, $lang_ggroupwrite_worldread, $lang_ggroupwrite_worldread_nod, $lang_gonlyyou; |
| ... | ... | @@ -956,7 +1576,8 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { |
| 956 | 1576 | $group_perm[6][0] = 56; |
| 957 | 1577 | $group_perm[7][0] = 57; |
| 958 | 1578 | $group_perm[8][0] = 58; |
| 959 | - if ($type == "admin") { | |
| 1579 | + if ($type == "admin") | |
| 1580 | + { | |
| 960 | 1581 | $group_perm[0][1] = "$lang_geveryoneread_ad"; |
| 961 | 1582 | $group_perm[1][1] = "$lang_geveryonewrite_ad"; |
| 962 | 1583 | $group_perm[2][1] = "$lang_ggroupread_ad"; |
| ... | ... | @@ -968,7 +1589,8 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { |
| 968 | 1589 | $group_perm[8][1] = "$lang_ggroupwrite_worldread_ad_nod"; |
| 969 | 1590 | |
| 970 | 1591 | } |
| 971 | - else { | |
| 1592 | + else | |
| 1593 | + { | |
| 972 | 1594 | $group_perm[0][1] = "$lang_geveryoneread"; |
| 973 | 1595 | $group_perm[1][1] = "$lang_geveryonewrite"; |
| 974 | 1596 | $group_perm[2][1] = "$lang_ggroupread"; |
| ... | ... | @@ -978,10 +1600,11 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { |
| 978 | 1600 | $group_perm[6][1] = "$lang_geveryonewrite_nod"; |
| 979 | 1601 | $group_perm[7][1] = "$lang_ggroupwrite_worldread"; |
| 980 | 1602 | $group_perm[8][1] = "$lang_ggroupwrite_worldread_nod"; |
| 981 | - } | |
| 1603 | + } | |
| 982 | 1604 | |
| 983 | 1605 | print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$printmessage</TD><TD align=left><SELECT NAME=$namevariable>"); |
| 984 | - foreach($group_perm as $fp) { | |
| 1606 | + foreach($group_perm as $fp) | |
| 1607 | + { | |
| 985 | 1608 | print("<OPTION VALUE=$fp[0] "); |
| 986 | 1609 | if($fp[0] == $currentval) |
| 987 | 1610 | print("SELECTED"); |
| ... | ... | @@ -991,7 +1614,7 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { |
| 991 | 1614 | |
| 992 | 1615 | }; |
| 993 | 1616 | |
| 994 | - | |
| 1617 | +// why is this here????????????????????????????????????????? | |
| 995 | 1618 | if (!$sess && !$loginname && !$login) |
| 996 | 1619 | if(!isset($fileid)) |
| 997 | 1620 | header("Location: " . $default->owl_root_url . "/index.php?login=1"); | ... | ... |
lib/readhd.php
| 1 | 1 | <?php |
| 2 | 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 | + | |
| 3 | 16 | #Ugly code by Anders Axesson. |
| 4 | 17 | # Adapted to OWL global config file by B0zz |
| 5 | 18 | |
| 6 | -function GetFromHD($GetWhat, $ThePath) { | |
| 7 | - if ($Dir = opendir($ThePath)) { | |
| 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 | + { | |
| 8 | 43 | $FileCount = 0; |
| 9 | 44 | $DirCount = 0; |
| 10 | - while($file = readdir($Dir)) { | |
| 45 | + while($file = readdir($Dir)) | |
| 46 | + { | |
| 11 | 47 | $PathFile = $ThePath . "/" . $file; //must test with full path (is_file etc) |
| 12 | 48 | |
| 13 | - if(($file <> ".") and ($file <> "..")) { | |
| 14 | - if (!is_file($PathFile)) { //check if it is a folder (dir) or file (dont check if it is a link) | |
| 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) | |
| 15 | 53 | $DirCount++; |
| 16 | 54 | $Dirs[$DirCount] = $file; |
| 17 | - }else{ | |
| 55 | + } | |
| 56 | + else | |
| 57 | + { | |
| 18 | 58 | $FileCount++; |
| 19 | 59 | $Files[$FileCount] = $file; |
| 20 | 60 | } |
| 21 | 61 | } |
| 22 | 62 | } |
| 23 | - if ($GetWhat == 'file') { | |
| 63 | + // if it is a file add it to an array of files and return it | |
| 64 | + if ($GetWhat == 'file') | |
| 65 | + { | |
| 24 | 66 | $FileCount++; |
| 25 | 67 | $Files[$FileCount] = "[END]"; //stop looping @ this |
| 26 | 68 | return $Files; |
| 27 | 69 | } |
| 28 | - | |
| 29 | - if ($GetWhat == 'folder') { | |
| 70 | + | |
| 71 | + // if it is a folder add it to the array of folders and return it | |
| 72 | + if ($GetWhat == 'folder') | |
| 73 | + { | |
| 30 | 74 | $DirCount++; |
| 31 | 75 | $Dirs[$DirCount] = "[END]"; //stop looping @ this |
| 32 | 76 | return $Dirs; |
| ... | ... | @@ -35,6 +79,20 @@ function GetFromHD($GetWhat, $ThePath) { |
| 35 | 79 | } |
| 36 | 80 | } |
| 37 | 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 | |
| 38 | 96 | function GetFileInfo($PathFile) { |
| 39 | 97 | $TheFileSize = filesize($PathFile); //get filesize |
| 40 | 98 | $TheFileTime = date("Y-m-d H:i:s", filemtime($PathFile)); //get and fix time of last modifikation |
| ... | ... | @@ -48,46 +106,103 @@ function GetFileInfo($PathFile) { |
| 48 | 106 | return $FileInfo; |
| 49 | 107 | } |
| 50 | 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 | + | |
| 51 | 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 | |
| 52 | 135 | $F = GetFromHD($GetWhat, $ThePath); |
| 53 | 136 | |
| 54 | -$RefreshPage = false; //if filez/Folderz are found the page need to be refreshed in order to see them. | |
| 137 | +$RefreshPage = false; //if filez/Folders are found the page need to be refreshed in order to see them. | |
| 55 | 138 | |
| 56 | -if(is_array($F)) { | |
| 139 | +// if array exists | |
| 140 | +if(is_array($F)) | |
| 141 | +{ | |
| 57 | 142 | |
| 58 | - for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++) { | |
| 143 | +// loop through file/folderarray and Dblist array to compare them | |
| 144 | + for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++) | |
| 145 | + { | |
| 59 | 146 | |
| 60 | - for($DBLoopCount = 1; $DBList[$DBLoopCount] !== "[END]";$DBLoopCount++) { | |
| 61 | - if($F[$HDLoopCount] == $DBList[$DBLoopCount]) { | |
| 147 | + for($DBLoopCount = 1; $DBList[$DBLoopCount] !== "[END]";$DBLoopCount++) | |
| 148 | + { | |
| 149 | + if($F[$HDLoopCount] == $DBList[$DBLoopCount]) | |
| 150 | + { | |
| 62 | 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) |
| 63 | 152 | break; |
| 64 | 153 | } |
| 65 | 154 | } |
| 66 | 155 | } |
| 67 | 156 | |
| 68 | - for($HDLoopCount = 1; $F[$HDLoopCount] !== "[END]";$HDLoopCount++) { | |
| 69 | - if(ord($F[$HDLoopCount]) !== 0) { //if not the file/folder name is empty... | |
| 70 | - if($GetWhat == "file") { | |
| 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 | + { | |
| 71 | 164 | $RefreshPage = true; |
| 72 | - InsertHDFilezInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the filez-on-disc-but-not-in-db into the db. | |
| 73 | - }else{ | |
| 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 | + { | |
| 74 | 170 | $RefreshPage = false; |
| 75 | 171 | } |
| 76 | 172 | |
| 77 | - if($GetWhat == "folder") { | |
| 173 | + if($GetWhat == "folder") | |
| 174 | + { | |
| 78 | 175 | $RefreshPage = true; |
| 79 | - InsertHDFolderzInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the folderz-on-disc-but-not-in-db into the db. | |
| 176 | + InsertHDFolderzInDB($F[$HDLoopCount], $parent, $ThePath, $DBTable); //call function that inserts the folders-on-disc-but-not-in-db into the db. | |
| 80 | 177 | } |
| 81 | 178 | } |
| 82 | 179 | } |
| 83 | 180 | |
| 84 | 181 | } |
| 85 | - | |
| 182 | + // return true or false | |
| 86 | 183 | return $RefreshPage; |
| 87 | 184 | |
| 88 | 185 | } |
| 89 | 186 | |
| 90 | -function InsertHDFolderzInDB($TheFolder, $parent, $ThePath, $DBTable) { | |
| 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 | +{ | |
| 91 | 206 | global $default; |
| 92 | 207 | |
| 93 | 208 | $sql = new Owl_DB; //create new db connection |
| ... | ... | @@ -98,6 +213,23 @@ function InsertHDFolderzInDB($TheFolder, $parent, $ThePath, $DBTable) { |
| 98 | 213 | } |
| 99 | 214 | |
| 100 | 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 | |
| 101 | 233 | function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable) { |
| 102 | 234 | |
| 103 | 235 | global $default; |
| ... | ... | @@ -105,6 +237,7 @@ function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable) { |
| 105 | 237 | |
| 106 | 238 | $FileInfo = GetFileInfo($ThePath . "/" . $TheFile); //get file size etc. 2=File size, 2=File time (smodified), 3=File time 2 (modified) |
| 107 | 239 | |
| 240 | + // if there is no file title assign it to default file title | |
| 108 | 241 | if ($default->owl_def_file_title == "") |
| 109 | 242 | { |
| 110 | 243 | $title_name = $TheFile; |
| ... | ... | @@ -114,6 +247,7 @@ function InsertHDFilezInDB($TheFile, $parent, $ThePath, $DBTable) { |
| 114 | 247 | $title_name = $default->owl_def_file_title; |
| 115 | 248 | } |
| 116 | 249 | |
| 250 | +// insert into DB | |
| 117 | 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]')"; |
| 118 | 252 | $sql->query($SQL); |
| 119 | 253 | ... | ... |
log.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/* | |
| 3 | +/** | |
| 4 | 4 | * log.php |
| 5 | 5 | * |
| 6 | + * Used for Revision history and logs when the changes occurred | |
| 7 | + * | |
| 6 | 8 | * Copyright (c) 1999-2002 The Owl Project Team |
| 7 | 9 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | - * | |
| 9 | - * $Id$ | |
| 10 | + * @version v 1.1.1.1 2002/12/04 | |
| 11 | + * @author michael | |
| 12 | + * @package test | |
| 10 | 13 | */ |
| 11 | 14 | |
| 15 | + | |
| 12 | 16 | require("./config/owl.php"); |
| 13 | 17 | require("./lib/owl.lib.php"); |
| 14 | 18 | require("./config/html.php"); |
| ... | ... | @@ -22,6 +26,7 @@ $filesearch = explode('.',$filename); |
| 22 | 26 | // + ADDED &order=$order&$sortorder=$sortname to |
| 23 | 27 | // all browse.php? header and HREF LINES |
| 24 | 28 | |
| 29 | +// responsible for determining the order of information | |
| 25 | 30 | switch ($order) { |
| 26 | 31 | case "name": |
| 27 | 32 | $sortorder = 'sortname'; |
| ... | ... | @@ -53,7 +58,9 @@ print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_b |
| 53 | 58 | ?> |
| 54 | 59 | <TR><TD ALIGN=LEFT> |
| 55 | 60 | <?php print("$lang_user: "); |
| 56 | - if(prefaccess($userid)) { | |
| 61 | + | |
| 62 | + if(prefaccess($userid)) | |
| 63 | + { | |
| 57 | 64 | print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&sortname=$sortname'>"); |
| 58 | 65 | } |
| 59 | 66 | print uid_to_name($userid); |
| ... | ... | @@ -68,13 +75,13 @@ print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_b |
| 68 | 75 | <?php |
| 69 | 76 | |
| 70 | 77 | print("<CENTER>"); |
| 71 | - | |
| 78 | + // generates a navigation bar and provides details for the docs | |
| 72 | 79 | print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border>"); |
| 73 | 80 | print("<TR><TD align=left>$lang_viewlog ".gen_navbar($parent)."/".flid_to_name($id)."</TD></TR>"); |
| 74 | 81 | print("</TABLE><HR WIDTH=$default->table_expand_width><BR>$filename"); |
| 75 | 82 | |
| 76 | 83 | print ("<TABLE width=$default->table_expand_width border=$default->table_border cellpadding=3 cellspacing=0> |
| 77 | - <TR><TD BGCOLOR='$default->table_header_bg' width=5%>$lang_ver</td> | |
| 84 | + <TR><TD BGCOLOR='$default->table_header_bg' width=5%>$lang_ver</td> | |
| 78 | 85 | <TD BGCOLOR='$default->table_header_bg' width=10%>$lang_user</TD> |
| 79 | 86 | <TD BGCOLOR='$default->table_header_bg' width=60%>$lang_log_file</TD> |
| 80 | 87 | <TD BGCOLOR='$default->table_header_bg' width=25%>$lang_modified</TD></TR>"); |
| ... | ... | @@ -116,31 +123,29 @@ if ($default->owl_use_fs) |
| 116 | 123 | else |
| 117 | 124 | { |
| 118 | 125 | // name based query -- assuming that the given name for the file doesn't change... |
| 119 | -// at some point, we should really look into creating a "revision_id" field so that all revisions can be linked. | |
| 120 | -// in the meanwhile, the code for changing the Title of the file has been altered to go back and | |
| 121 | 126 | |
| 122 | 127 | $name = flid_to_name($id); |
| 123 | 128 | $sql->query("select * from $default->owl_files_table where name='$name' AND parent='$parent' order by major_revision desc, minor_revision desc"); |
| 124 | 129 | } |
| 125 | 130 | |
| 126 | 131 | //global $sess; |
| 127 | - | |
| 128 | - | |
| 129 | - while($sql->next_record()) { | |
| 130 | - $choped = split("\.", $sql->f("filename")); | |
| 131 | - $pos = count($choped); | |
| 132 | - $ext = strtolower($choped[$pos-1]); | |
| 133 | - | |
| 134 | -print("<TR><TD valign=top>".$sql->f("major_revision").".".$sql->f("minor_revision")."</TD> | |
| 132 | +// prints out all the relevant information on the specific document | |
| 133 | + while($sql->next_record()) | |
| 134 | + { | |
| 135 | + $choped = split("\.", $sql->f("filename")); | |
| 136 | + $pos = count($choped); | |
| 137 | + $ext = strtolower($choped[$pos-1]); | |
| 138 | + | |
| 139 | + print("<TR><TD valign=top>".$sql->f("major_revision").".".$sql->f("minor_revision")."</TD> | |
| 135 | 140 | <TD valign=top>".uid_to_name($sql->f("creatorid"))."</TD> |
| 136 | 141 | <TD valign=top align=left><font size=2 style='font-weight:bold'>"); |
| 137 | 142 | printFileIcons($sql->f("id"),$sql->f("filename"),$sql->f("checked_out"),$sql->f("url"),$default->owl_version_control,$ext); |
| 138 | 143 | print("  [ ".$sql->f("filename")." ]</font><br> |
| 139 | 144 | <pre>".$sql->f("description")."</></TD> |
| 140 | 145 | <TD valign=top>".$sql->f("modified")."</TD></TR>"); |
| 141 | -} | |
| 146 | + } | |
| 142 | 147 | |
| 143 | -// print("<TR><TD valign=top>".$sql->f("major_revision").".".$sql->f("minor_revision")."</TD> | |
| 148 | + //print("<TR><TD valign=top>".$sql->f("major_revision").".".$sql->f("minor_revision")."</TD> | |
| 144 | 149 | //<TD valign=top>".uid_to_name($sql->f("creatorid"))."</TD> |
| 145 | 150 | //<TD valign=top><font style='font-weight:bold'>[ ".$sql->f("filename")." ]</font><br> |
| 146 | 151 | //<pre>".$sql->f("description")."</></TD> | ... | ... |
modify.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/** | |
| 3 | +/* | |
| 4 | 4 | * modify.php |
| 5 | 5 | * |
| 6 | - * Displays forms for file (upload, update, modify, email) and folder (create, modify) | |
| 7 | - * maintenance and management. | |
| 8 | - * | |
| 9 | 6 | * Copyright (c) 1999-2002 The Owl Project Team |
| 10 | 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 11 | 8 | * |
| 12 | 9 | * $Id$ |
| 13 | - * @todo line 27- refactor | |
| 14 | - * @todo line 55-71- refactor into header.inc and new navigation.inc | |
| 15 | - * @todo quote attribute values in all forms | |
| 16 | - * @todo refactor permission handling | |
| 17 | 10 | */ |
| 18 | 11 | |
| 19 | 12 | //print("<H1>MODIFY Sess: $sess<BR> Loginname: $loginname<BR> Login:$login</H1>"); |
| ... | ... | @@ -22,36 +15,39 @@ require("./config/owl.php"); |
| 22 | 15 | require("./lib/owl.lib.php"); |
| 23 | 16 | require("./config/html.php"); |
| 24 | 17 | require("./lib/security.lib.php"); |
| 25 | -include("./lib/header.inc"); | |
| 26 | 18 | |
| 19 | +include("./lib/header.inc"); | |
| 27 | 20 | // Begin 496814 Column Sorts are not persistant |
| 28 | 21 | // + ADDED &order=$order&$sortorder=$sortname to |
| 29 | 22 | // all browse.php? header and HREF LINES |
| 23 | + | |
| 24 | + | |
| 30 | 25 | switch ($order) { |
| 31 | - case "name": | |
| 32 | - $sortorder = 'sortname'; | |
| 33 | - break; | |
| 34 | - case "major_revision": | |
| 35 | - $sortorder = 'sortver'; | |
| 36 | - break; | |
| 37 | - case "filename" : | |
| 38 | - $sortorder = 'sortfilename'; | |
| 39 | - break; | |
| 40 | - case "size" : | |
| 41 | - $sortorder = 'sortsize'; | |
| 42 | - break; | |
| 43 | - case "creatorid" : | |
| 44 | - $sortorder = 'sortposted'; | |
| 45 | - break; | |
| 46 | - case "smodified" : | |
| 47 | - $sortorder = 'sortmod'; | |
| 48 | - break; | |
| 49 | - case "checked_out": | |
| 50 | - $sortorder = 'sortcheckedout'; | |
| 51 | - break; | |
| 52 | - default: | |
| 53 | - break; | |
| 26 | + case "name": | |
| 27 | + $sortorder = 'sortname'; | |
| 28 | + break; | |
| 29 | + case "major_revision": | |
| 30 | + $sortorder = 'sortver'; | |
| 31 | + break; | |
| 32 | + case "filename" : | |
| 33 | + $sortorder = 'sortfilename'; | |
| 34 | + break; | |
| 35 | + case "size" : | |
| 36 | + $sortorder = 'sortsize'; | |
| 37 | + break; | |
| 38 | + case "creatorid" : | |
| 39 | + $sortorder = 'sortposted'; | |
| 40 | + break; | |
| 41 | + case "smodified" : | |
| 42 | + $sortorder = 'sortmod'; | |
| 43 | + break; | |
| 44 | + case "checked_out": | |
| 45 | + $sortorder = 'sortcheckedout'; | |
| 46 | + break; | |
| 47 | + default: | |
| 48 | + break; | |
| 54 | 49 | } |
| 50 | + | |
| 55 | 51 | // END 496814 Column Sorts are not persistant |
| 56 | 52 | |
| 57 | 53 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| ... | ... | @@ -76,37 +72,36 @@ print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_b |
| 76 | 72 | print("<CENTER>"); |
| 77 | 73 | |
| 78 | 74 | if ($action == "file_update") { |
| 79 | - if(check_auth($id, "file_modify", $userid) == 1) { | |
| 75 | + if(check_auth($id, "file_modify", $userid) == 1) { | |
| 80 | 76 | print("<BR>"); |
| 81 | 77 | $expand = 1; |
| 82 | 78 | print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border>"); |
| 83 | 79 | print("<TR><TD align=left>$lang_updating ".gen_navbar($parent)."/".flid_to_name($id)."</TD></TR>"); |
| 84 | 80 | print("</TABLE><HR WIDTH=$default->table_expand_width><BR>"); |
| 85 | 81 | print("<FORM enctype='multipart/form-data' ACTION='dbmodify.php' METHOD=POST> |
| 86 | - <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 87 | - <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 82 | + <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 83 | + <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 88 | 84 | <INPUT TYPE=HIDDEN NAME=sess VALUE='$sess'> |
| 89 | 85 | <INPUT TYPE=HIDDEN NAME=parent VALUE=$parent> |
| 90 | 86 | <INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE='$default->max_filesize'> |
| 91 | 87 | <INPUT TYPE=HIDDEN NAME=action VALUE=file_update> |
| 92 | 88 | <INPUT TYPE=HIDDEN NAME=id VALUE='$id'>"); |
| 93 | - // BUG FIX: #449395 expanded/collapse view bugs | |
| 94 | - print("<INPUT TYPE=HIDDEN NAME=expand VALUE='$expand'>"); | |
| 95 | - // END BUG FIX: #449395 expanded/collapse view bugs | |
| 96 | - print("<TABLE BORDER=$default->table_border><TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_sendthisfile</TD><TD align=left><input name='userfile' type='file'></TD></TR>"); | |
| 97 | - | |
| 98 | - // begin Daphne change - version control | |
| 99 | - if ($default->owl_version_control == 1) { | |
| 100 | - print("<TR align=left><TD ALIGN=RIGHT bgcolor=$default->table_header_bg valign=top>$lang_vertype</td> | |
| 101 | - <td><SELECT NAME=versionchange> | |
| 102 | - <OPTION VALUE=major_revision>$lang_vermajor | |
| 103 | - <OPTION selected VALUE=minor_revision>$lang_verminor</select></td></tr>"); | |
| 104 | - print("<tr><TD align=right bgcolor=$default->table_header_bg valign=top>$lang_verdescription | |
| 105 | - </td> | |
| 106 | - <td align=left><textarea name=newdesc rows=5 cols=30 wrap=hard></textarea></tr>"); | |
| 107 | - } | |
| 108 | - // End Daphne Change | |
| 109 | - print("</TABLE><INPUT TYPE=SUBMIT VALUE='$lang_sendfile'></FORM>"); | |
| 89 | +// BUG FIX: #449395 expanded/collapse view bugs | |
| 90 | + print("<INPUT TYPE=HIDDEN NAME=expand VALUE='$expand'>"); | |
| 91 | +// END BUG FIX: #449395 expanded/collapse view bugs | |
| 92 | + print("<TABLE BORDER=$default->table_border><TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_sendthisfile</TD><TD align=left><input name='userfile' type='file'></TD></TR>"); | |
| 93 | + // begin Daphne change - version control | |
| 94 | + if ($default->owl_version_control == 1) { | |
| 95 | + print("<TR align=left><TD ALIGN=RIGHT bgcolor=$default->table_header_bg valign=top>$lang_vertype</td> | |
| 96 | + <td><SELECT NAME=versionchange> | |
| 97 | + <OPTION VALUE=major_revision>$lang_vermajor | |
| 98 | + <OPTION selected VALUE=minor_revision>$lang_verminor</select></td></tr>"); | |
| 99 | + print("<tr><TD align=right bgcolor=$default->table_header_bg valign=top>$lang_verdescription | |
| 100 | + </td> | |
| 101 | + <td align=left><textarea name=newdesc rows=5 cols=30 wrap=hard></textarea></tr>"); | |
| 102 | + } | |
| 103 | + // End Daphne Change | |
| 104 | + print("</TABLE><INPUT TYPE=SUBMIT VALUE='$lang_sendfile'></FORM>"); | |
| 110 | 105 | include("./lib/footer.inc"); |
| 111 | 106 | } else { |
| 112 | 107 | print($lang_noupload); |
| ... | ... | @@ -127,60 +122,60 @@ if ($action == "file_upload") { |
| 127 | 122 | $sql->query("select id,name from $default->owl_groups_table"); |
| 128 | 123 | $i=0; |
| 129 | 124 | while($sql->next_record()) { |
| 130 | - $groups[$i][0] = $sql->f("id"); | |
| 131 | - $groups[$i][1] = $sql->f("name"); | |
| 132 | - $i++; | |
| 125 | + $groups[$i][0] = $sql->f("id"); | |
| 126 | + $groups[$i][1] = $sql->f("name"); | |
| 127 | + $i++; | |
| 133 | 128 | } |
| 134 | - } else { | |
| 135 | - $sql = new Owl_DB; | |
| 136 | - $sql->query("select userid,groupid from $default->owl_users_grpmem_table where userid = $userid "); | |
| 137 | - if ($sql->num_rows($sql) == 0) { | |
| 138 | - $sql->query("SELECT u.groupid as groupid, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id"); | |
| 139 | - } | |
| 140 | - $i=0; | |
| 141 | - while($sql->next_record()) { | |
| 142 | - $groups[$i][0] = $sql->f("groupid"); | |
| 143 | - $groups[$i][1] = group_to_name($sql->f("groupid")); | |
| 144 | - $i++; | |
| 145 | - } | |
| 146 | - } | |
| 129 | + } | |
| 130 | + else { | |
| 131 | + $sql = new Owl_DB; | |
| 132 | + $sql->query("select userid,groupid from $default->owl_users_grpmem_table where userid = $userid "); | |
| 133 | + if ($sql->num_rows($sql) == 0) | |
| 134 | + $sql->query("SELECT u.groupid as groupid, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id"); | |
| 135 | + $i=0; | |
| 136 | + while($sql->next_record()) { | |
| 137 | + $groups[$i][0] = $sql->f("groupid"); | |
| 138 | + $groups[$i][1] = group_to_name($sql->f("groupid")); | |
| 139 | + $i++; | |
| 140 | + } | |
| 141 | + } | |
| 147 | 142 | /* END Bozz Change */ |
| 148 | 143 | |
| 149 | 144 | print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border>"); |
| 150 | 145 | print("<TR><TD align=left>$lang_addingfile".gen_navbar($parent)."</TD></TR>"); |
| 151 | 146 | print("</TABLE><HR WIDTH=$default->table_expand_width><BR>"); |
| 152 | 147 | print("<FORM enctype= 'multipart/form-data' ACTION='dbmodify.php' METHOD=POST> |
| 153 | - <INPUT TYPE=HIDDEN NAME=sess VALUE='$sess'><INPUT TYPE=HIDDEN NAME=parent VALUE=$parent> | |
| 154 | - <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 155 | - <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 156 | - <INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE='$default->max_filesize'> | |
| 157 | - <INPUT TYPE=HIDDEN NAME=action VALUE=file_upload> | |
| 158 | - <INPUT TYPE=HIDDEN NAME=expand VALUE=$expand> | |
| 159 | - <INPUT TYPE=HIDDEN NAME=type VALUE=$type> | |
| 160 | - <TABLE BORDER=$default->table_border><TR>"); | |
| 161 | - | |
| 162 | - if ($type == "url") { | |
| 163 | - print("<TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_sendthisurl:</TD><TD align=left><input name='userfile' type='text'size='80'></TD></TR>"); | |
| 164 | - } else { | |
| 148 | + <INPUT TYPE=HIDDEN NAME=sess VALUE='$sess'><INPUT TYPE=HIDDEN NAME=parent VALUE=$parent> | |
| 149 | + <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 150 | + <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 151 | + <INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE='$default->max_filesize'> | |
| 152 | + <INPUT TYPE=HIDDEN NAME=action VALUE=file_upload> | |
| 153 | + <INPUT TYPE=HIDDEN NAME=expand VALUE=$expand> | |
| 154 | + <INPUT TYPE=HIDDEN NAME=type VALUE=$type> | |
| 155 | + <TABLE BORDER=$default->table_border><TR>"); | |
| 156 | + | |
| 157 | + if ($type == "url") | |
| 158 | + print("<TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_sendthisurl:</TD><TD align=left><input name='userfile' type='text'size='80'></TD></TR>"); | |
| 159 | + else | |
| 165 | 160 | print("<TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_sendthisfile:</TD><TD align=left><input name='userfile' type='file'></TD></TR>"); |
| 166 | - } | |
| 167 | 161 | |
| 168 | - print("<TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_title:</TD><TD align=left><INPUT TYPE=TEXT NAME=title></TD></TR> | |
| 169 | - <TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_keywords:</TD><TD align=left><INPUT TYPE=TEXT NAME=metadata></TD></TR>"); | |
| 170 | - | |
| 171 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownergroup:</TD><TD align=left><SELECT NAME=groupid>"); | |
| 172 | - if(isset($groupid)) { | |
| 173 | - print("<OPTION VALUE=".$sql->f("groupid").">".group_to_name($sql->f("groupid"))); | |
| 174 | - } | |
| 175 | - foreach($groups as $g) { | |
| 176 | - print("<OPTION VALUE=$g[0]>$g[1]"); | |
| 177 | - } | |
| 178 | - printfileperm("4", "security", $lang_permissions, "admin"); | |
| 179 | - | |
| 180 | - print("<TR><TD ALIGN=RIGHT VALIGN=TOP bgcolor=$default->table_header_bg>"); | |
| 181 | - // Daphne Change - add wrap=hard to textarea for logs | |
| 182 | - print("$lang_description:</TD><TD align=left><TEXTAREA NAME=description ROWS=10 COLS=50 WRAP=hard></TEXTAREA></TD></TR> | |
| 183 | - </TABLE><INPUT TYPE=SUBMIT VALUE='$lang_sendfile'></FORM>"); | |
| 162 | + print("<TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_title:</TD><TD align=left><INPUT TYPE=TEXT NAME=title></TD></TR> | |
| 163 | + <TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_keywords:</TD><TD align=left><INPUT TYPE=TEXT NAME=metadata></TD></TR>"); | |
| 164 | + | |
| 165 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownergroup:</TD><TD align=left><SELECT NAME=groupid>"); | |
| 166 | + if(isset($groupid)) | |
| 167 | + { | |
| 168 | + print("<OPTION VALUE=".$sql->f("groupid").">".group_to_name($sql->f("groupid"))); | |
| 169 | + } | |
| 170 | + foreach($groups as $g) { | |
| 171 | + print("<OPTION VALUE=$g[0]>$g[1]"); | |
| 172 | + } | |
| 173 | + printfileperm("4", "security", $lang_permissions, "admin"); | |
| 174 | + | |
| 175 | + print("<TR><TD ALIGN=RIGHT VALIGN=TOP bgcolor=$default->table_header_bg>"); | |
| 176 | + // Daphne Change - add wrap=hard to textarea for logs | |
| 177 | + print("$lang_description:</TD><TD align=left><TEXTAREA NAME=description ROWS=10 COLS=50 WRAP=hard></TEXTAREA></TD></TR> | |
| 178 | + </TABLE><INPUT TYPE=SUBMIT VALUE='$lang_sendfile'></FORM>"); | |
| 184 | 179 | include("./lib/footer.inc"); |
| 185 | 180 | } else { |
| 186 | 181 | print($lang_noupload); |
| ... | ... | @@ -194,99 +189,102 @@ if ($action == "file_modify") { |
| 194 | 189 | /* BEGIN Bozz Change |
| 195 | 190 | Retrieve Group information if the user is in the |
| 196 | 191 | Administrator group */ |
| 192 | + | |
| 197 | 193 | if ( owlusergroup($userid) == 0 ) { |
| 198 | - $sql = new Owl_DB; | |
| 199 | - $sql->query("select id,name from $default->owl_groups_table"); | |
| 200 | - $i=0; | |
| 201 | - while($sql->next_record()) { | |
| 202 | - $groups[$i][0] = $sql->f("id"); | |
| 203 | - $groups[$i][1] = $sql->f("name"); | |
| 204 | - $i++; | |
| 205 | - } | |
| 206 | - $sql->query("select id,name from $default->owl_users_table"); | |
| 207 | - $i=0; | |
| 208 | - while($sql->next_record()) { | |
| 209 | - $users[$i][0] = $sql->f("id"); | |
| 210 | - $users[$i][1] = $sql->f("name"); | |
| 211 | - $i++; | |
| 212 | - } | |
| 213 | - } else { | |
| 214 | - if (uid_to_name($userid) == fid_to_creator($id)) { | |
| 215 | - $sql = new Owl_DB; | |
| 216 | - $sql->query("select userid,groupid from $default->owl_users_grpmem_table where userid = $userid "); | |
| 217 | - if ($sql->num_rows($sql) == 0) { | |
| 218 | - $sql->query("SELECT u.groupid as groupid, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id"); | |
| 219 | - } | |
| 220 | - $i=0; | |
| 221 | - while($sql->next_record()) { | |
| 222 | - $groups[$i][0] = $sql->f("groupid"); | |
| 223 | - $groups[$i][1] = group_to_name($sql->f("groupid")); | |
| 224 | - $i++; | |
| 225 | - } | |
| 226 | - $mygroup = owlusergroup($userid); | |
| 227 | - $sql->query("select id,name from $default->owl_users_table where groupid='$mygroup'"); | |
| 228 | - $i=0; | |
| 229 | - while($sql->next_record()) { | |
| 194 | + $sql = new Owl_DB; | |
| 195 | + $sql->query("select id,name from $default->owl_groups_table"); | |
| 196 | + $i=0; | |
| 197 | + while($sql->next_record()) { | |
| 198 | + $groups[$i][0] = $sql->f("id"); | |
| 199 | + $groups[$i][1] = $sql->f("name"); | |
| 200 | + $i++; | |
| 201 | + } | |
| 202 | + $sql->query("select id,name from $default->owl_users_table"); | |
| 203 | + $i=0; | |
| 204 | + while($sql->next_record()) { | |
| 230 | 205 | $users[$i][0] = $sql->f("id"); |
| 231 | 206 | $users[$i][1] = $sql->f("name"); |
| 232 | 207 | $i++; |
| 233 | - } | |
| 234 | - } | |
| 235 | - } | |
| 208 | + } | |
| 209 | + } | |
| 210 | + else { | |
| 211 | + if (uid_to_name($userid) == fid_to_creator($id)) { | |
| 212 | + $sql = new Owl_DB; | |
| 213 | + $sql->query("select userid,groupid from $default->owl_users_grpmem_table where userid = $userid "); | |
| 214 | + if ($sql->num_rows($sql) == 0) | |
| 215 | + $sql->query("SELECT u.groupid as groupid, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id"); | |
| 216 | + $i=0; | |
| 217 | + while($sql->next_record()) { | |
| 218 | + $groups[$i][0] = $sql->f("groupid"); | |
| 219 | + $groups[$i][1] = group_to_name($sql->f("groupid")); | |
| 220 | + $i++; | |
| 221 | + } | |
| 222 | + $mygroup = owlusergroup($userid); | |
| 223 | + $sql->query("select id,name from $default->owl_users_table where groupid='$mygroup'"); | |
| 224 | + $i=0; | |
| 225 | + while($sql->next_record()) { | |
| 226 | + $users[$i][0] = $sql->f("id"); | |
| 227 | + $users[$i][1] = $sql->f("name"); | |
| 228 | + $i++; | |
| 229 | + } | |
| 230 | + } | |
| 231 | + } | |
| 232 | + | |
| 236 | 233 | /* END Bozz Change */ |
| 237 | 234 | |
| 238 | 235 | print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border>"); |
| 239 | 236 | print("<TR><TD align=left>$lang_modifying".gen_navbar($parent)."/".flid_to_name($id)."</TD></TR>"); |
| 240 | 237 | print("</TABLE><HR WIDTH=$default->table_expand_width><BR>"); |
| 241 | - $sql = new Owl_DB; | |
| 242 | - $sql->query("select * from $default->owl_files_table where id = '$id'"); | |
| 243 | - | |
| 238 | + $sql = new Owl_DB; $sql->query("select * from $default->owl_files_table where id = '$id'"); | |
| 244 | 239 | while($sql->next_record()) { |
| 245 | - print("<TABLE WIDTH=66% BORDER=$default->table_border><FORM ACTION='dbmodify.php'><TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg> | |
| 246 | - $lang_title:</TD><TD align=left><INPUT TYPE=TEXT NAME=title VALUE=\"".$sql->f("name")."\"></TD></TR> | |
| 240 | + print("<TABLE WIDTH=66% BORDER=$default->table_border><FORM ACTION='dbmodify.php'><TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg> | |
| 241 | + $lang_title:</TD><TD align=left><INPUT TYPE=TEXT NAME=title VALUE=\"".$sql->f("name")."\"></TD></TR> | |
| 247 | 242 | <TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_file:</TD><TD align=left>".$sql->f("filename")." (".gen_filesize($sql->f("size")).")</TD></TR>"); |
| 248 | - // Bozz Change Begin | |
| 243 | + // Bozz Change Begin | |
| 244 | + | |
| 245 | + | |
| 249 | 246 | |
| 250 | 247 | $security = $sql->f("security"); |
| 251 | - $current_groupid = owlfilegroup($id); | |
| 252 | - $current_owner = owlfilecreator($id); | |
| 253 | - if ( owlusergroup($userid) == 0 || uid_to_name($userid) == fid_to_creator($id)) { | |
| 254 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownership:</TD><TD align=left><SELECT NAME=file_owner>"); | |
| 255 | - foreach($users as $g) { | |
| 256 | - print("<OPTION VALUE=$g[0] "); | |
| 257 | - if($g[0] == owlfilecreator($id)) { | |
| 258 | - print("SELECTED"); | |
| 259 | - } | |
| 260 | - print(">$g[1]"); | |
| 261 | - } | |
| 262 | - print("</SELECT></TD></TR>"); | |
| 263 | - | |
| 264 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownergroup:</TD><TD align=left><SELECT NAME=groupid>"); | |
| 265 | - //print("<OPTION VALUE=$groupid>".group_to_name($sql->f("groupid"))); | |
| 266 | - foreach($groups as $g) { | |
| 267 | - print("<OPTION VALUE=$g[0] "); | |
| 268 | - if($g[0] == $current_groupid) { | |
| 269 | - print("SELECTED"); | |
| 270 | - } | |
| 271 | - print(">$g[1]"); | |
| 272 | - } | |
| 273 | - print("</SELECT></TD></TR>"); | |
| 274 | - printfileperm($security, "security", "$lang_permissions:","admin"); | |
| 275 | - } else { | |
| 276 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownership:</TD><TD align=left>".fid_to_creator($id)." (".group_to_name(owlfilegroup($id)).")</TD></TR>"); | |
| 277 | - print("<INPUT TYPE=HIDDEN NAME=file_owner VALUE='$current_owner'>"); | |
| 278 | - print("<INPUT TYPE=HIDDEN NAME=security VALUE='$security'>"); | |
| 279 | - print("<INPUT TYPE=HIDDEN NAME=groupid VALUE='$current_groupid'>"); | |
| 280 | - } | |
| 281 | - // Bozz change End | |
| 282 | - | |
| 283 | - //print("</SELECT></TD></TR> | |
| 284 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_keywords:</TD><TD align=left><INPUT TYPE=TEXT NAME=metadata VALUE='".$sql->f("metadata")."'></TD></TR> | |
| 248 | + $current_groupid = owlfilegroup($id); | |
| 249 | + $current_owner = owlfilecreator($id); | |
| 250 | + | |
| 251 | + if ( owlusergroup($userid) == 0 || uid_to_name($userid) == fid_to_creator($id)) | |
| 252 | + { | |
| 253 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownership:</TD><TD align=left><SELECT NAME=file_owner>"); | |
| 254 | + foreach($users as $g) { | |
| 255 | + print("<OPTION VALUE=$g[0] "); | |
| 256 | + if($g[0] == owlfilecreator($id)) | |
| 257 | + print("SELECTED"); | |
| 258 | + print(">$g[1]"); | |
| 259 | + } | |
| 260 | + print("</SELECT></TD></TR>"); | |
| 261 | + | |
| 262 | +print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownergroup:</TD><TD align=left><SELECT NAME=groupid>"); | |
| 263 | + //print("<OPTION VALUE=$groupid>".group_to_name($sql->f("groupid"))); | |
| 264 | + foreach($groups as $g) { | |
| 265 | + print("<OPTION VALUE=$g[0] "); | |
| 266 | + if($g[0] == $current_groupid) | |
| 267 | + print("SELECTED"); | |
| 268 | + print(">$g[1]"); | |
| 269 | + } | |
| 270 | + print("</SELECT></TD></TR>"); | |
| 271 | + printfileperm($security, "security", "$lang_permissions:","admin"); | |
| 272 | + } | |
| 273 | + else | |
| 274 | + { | |
| 275 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownership:</TD><TD align=left>".fid_to_creator($id)." (".group_to_name(owlfilegroup($id)).")</TD></TR>"); | |
| 276 | + print("<INPUT TYPE=HIDDEN NAME=file_owner VALUE='$current_owner'>"); | |
| 277 | + print("<INPUT TYPE=HIDDEN NAME=security VALUE='$security'>"); | |
| 278 | + print("<INPUT TYPE=HIDDEN NAME=groupid VALUE='$current_groupid'>"); | |
| 279 | + } | |
| 280 | + // Bozz change End | |
| 281 | + //print("</SELECT></TD></TR> | |
| 282 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_keywords:</TD><TD align=left><INPUT TYPE=TEXT NAME=metadata VALUE='".$sql->f("metadata")."'></TD></TR> | |
| 285 | 283 | <TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg VALIGN=TOP> |
| 286 | 284 | $lang_description:</TD><TD align=left><TEXTAREA NAME=description ROWS=10 COLS=50>".$sql->f("description")."</TEXTAREA> |
| 287 | 285 | <INPUT TYPE=HIDDEN NAME=action VALUE=file_modify> |
| 288 | - <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 289 | - <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 286 | + <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 287 | + <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 290 | 288 | <INPUT TYPE=HIDDEN NAME=id VALUE=$id> |
| 291 | 289 | <INPUT TYPE=HIDDEN NAME=sess VALUE='$sess'> |
| 292 | 290 | <INPUT TYPE=HIDDEN NAME=parent VALUE=$parent></TD></TR></TABLE> |
| ... | ... | @@ -295,7 +293,7 @@ if ($action == "file_modify") { |
| 295 | 293 | include("./lib/footer.inc"); |
| 296 | 294 | } |
| 297 | 295 | } else { |
| 298 | - print("<BR><BR>".$lang_nofilemod); | |
| 296 | + print("<BR><BR>".$lang_nofilemod); | |
| 299 | 297 | } |
| 300 | 298 | } |
| 301 | 299 | |
| ... | ... | @@ -306,21 +304,25 @@ if ($action == "folder_create") { |
| 306 | 304 | /* BEGIN Bozz Change |
| 307 | 305 | Retrieve Group information if the user is in the |
| 308 | 306 | Administrator group */ |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 309 | 310 | $sql = new Owl_DB; |
| 310 | 311 | if ( owlusergroup($userid) == 0 ) { |
| 311 | - $sql->query("SELECT id,name from $default->owl_groups_table"); | |
| 312 | - } else { | |
| 313 | - $sql->query("SELECT * from $default->owl_users_grpmem_table join $default->owl_groups_table where id = groupid and userid = $userid"); | |
| 314 | - if ($sql->num_rows($sql) == 0) { | |
| 315 | - $sql->query("SELECT u.groupid as id, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id"); | |
| 316 | - } | |
| 312 | + $sql->query("SELECT id,name from $default->owl_groups_table"); | |
| 317 | 313 | } |
| 318 | - $i=0; | |
| 319 | - while($sql->next_record()) { | |
| 320 | - $groups[$i][0] = $sql->f("id"); | |
| 321 | - $groups[$i][1] = $sql->f("name"); | |
| 322 | - $i++; | |
| 323 | - } | |
| 314 | + else { | |
| 315 | + $sql->query("SELECT * from $default->owl_users_grpmem_table join $default->owl_groups_table where id = groupid and userid = $userid"); | |
| 316 | + if ($sql->num_rows($sql) == 0) | |
| 317 | + $sql->query("SELECT u.groupid as id, g.name as name from $default->owl_users_table as u join $default->owl_groups_table as g where u.id = $userid and u.groupid = g.id"); | |
| 318 | + } | |
| 319 | + $i=0; | |
| 320 | + while($sql->next_record()) { | |
| 321 | + $groups[$i][0] = $sql->f("id"); | |
| 322 | + $groups[$i][1] = $sql->f("name"); | |
| 323 | + $i++; | |
| 324 | + } | |
| 325 | + | |
| 324 | 326 | /* END Bozz Change */ |
| 325 | 327 | |
| 326 | 328 | print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border><TR><TD align=left>$lang_addingfolder ".gen_navbar($parent)."</TD></TR></TABLE><HR WIDTH=$default->table_expand_width><BR> |
| ... | ... | @@ -328,25 +330,23 @@ if ($action == "folder_create") { |
| 328 | 330 | <INPUT TYPE=HIDDEN NAME=parent VALUE=$parent><INPUT TYPE=HIDDEN NAME=expand VALUE=$expand> |
| 329 | 331 | <INPUT TYPE=HIDDEN NAME=action VALUE=folder_create><INPUT TYPE=TEXT NAME=name></TD></TR> |
| 330 | 332 | <INPUT TYPE=HIDDEN NAME=sess VALUE='$sess'> |
| 331 | - <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 332 | - <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 333 | + <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 334 | + <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 333 | 335 | <INPUT TYPE=HIDDEN NAME=expand VALUE='$expand'>"); |
| 334 | 336 | |
| 335 | - /* BEGIN Bozz Change | |
| 336 | - Display Retrieved Group information if the user is in the | |
| 337 | - Administrator group */ | |
| 338 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownergroup:</TD><TD align=left><SELECT NAME=groupid>"); | |
| 339 | - foreach($groups as $g) { | |
| 340 | - print("<OPTION VALUE=$g[0]>$g[1]"); | |
| 341 | - } | |
| 342 | - if ( owlusergroup($userid) == 0 ) { | |
| 343 | - printgroupperm(54, "policy", $lang_policy, "admin"); | |
| 344 | - } else { | |
| 345 | - printgroupperm(54, "policy", $lang_policy, "user"); | |
| 346 | - } | |
| 347 | - /* END Bozz Change */ | |
| 348 | - | |
| 349 | - print("</TABLE><INPUT TYPE=SUBMIT VALUE=$lang_create></FORM>"); | |
| 337 | + /* BEGIN Bozz Change | |
| 338 | + Display Retrieved Group information if the user is in the | |
| 339 | + Administrator group */ | |
| 340 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownergroup:</TD><TD align=left><SELECT NAME=groupid>"); | |
| 341 | + foreach($groups as $g) { | |
| 342 | + print("<OPTION VALUE=$g[0]>$g[1]"); | |
| 343 | + } | |
| 344 | + if ( owlusergroup($userid) == 0 ) | |
| 345 | + printgroupperm(54, "policy", $lang_policy, "admin"); | |
| 346 | + else | |
| 347 | + printgroupperm(54, "policy", $lang_policy, "user"); | |
| 348 | + /* END Bozz Change */ | |
| 349 | + print("</TABLE><INPUT TYPE=SUBMIT VALUE=$lang_create></FORM>"); | |
| 350 | 350 | include("./lib/footer.inc"); |
| 351 | 351 | } else { |
| 352 | 352 | print($lang_nosubfolder); |
| ... | ... | @@ -357,101 +357,105 @@ if ($action == "folder_modify") { |
| 357 | 357 | if(check_auth($id, "folder_property", $userid) == 1) { |
| 358 | 358 | $expand=1; |
| 359 | 359 | |
| 360 | - /* BEGIN Bozz Change | |
| 361 | - Retrieve Group information if the user is in the | |
| 362 | - Administrator group */ | |
| 363 | - if ( owlusergroup($userid) == 0 ) { | |
| 364 | - $sql = new Owl_DB; | |
| 365 | - $sql->query("select id,name from $default->owl_groups_table"); | |
| 366 | - $i=0; | |
| 367 | - while($sql->next_record()) { | |
| 368 | - $groups[$i][0] = $sql->f("id"); | |
| 369 | - $groups[$i][1] = $sql->f("name"); | |
| 370 | - $i++; | |
| 371 | - } | |
| 372 | - } | |
| 373 | - /* END Bozz Change */ | |
| 360 | + /* BEGIN Bozz Change | |
| 361 | + Retrieve Group information if the user is in the | |
| 362 | + Administrator group */ | |
| 363 | + | |
| 364 | + if ( owlusergroup($userid) == 0 ) { | |
| 365 | + $sql = new Owl_DB; | |
| 366 | + $sql->query("select id,name from $default->owl_groups_table"); | |
| 367 | + $i=0; | |
| 368 | + while($sql->next_record()) { | |
| 369 | + $groups[$i][0] = $sql->f("id"); | |
| 370 | + $groups[$i][1] = $sql->f("name"); | |
| 371 | + $i++; | |
| 372 | + } | |
| 373 | + } | |
| 374 | + /* END Bozz Change */ | |
| 374 | 375 | |
| 375 | 376 | print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border>"); |
| 376 | 377 | print("<TR><TD align=left>$lang_modifying ".gen_navbar($id)."</TD></TR>"); |
| 377 | 378 | print("</TABLE><HR WIDTH=$default->table_expand_width><BR><TABLE WIDTH=50% BORDER=$default->table_border>"); |
| 378 | - $sql = new Owl_DB; | |
| 379 | - $sql->query("select * from $default->owl_folders_table where id = '$id'"); | |
| 380 | - | |
| 381 | - while($sql->next_record()) { | |
| 382 | - $security = $sql->f("security"); | |
| 379 | + $sql = new Owl_DB; $sql->query("select * from $default->owl_folders_table where id = '$id'"); | |
| 380 | + while($sql->next_record()) { | |
| 381 | + $security = $sql->f("security"); | |
| 382 | + | |
| 383 | 383 | print("<FORM ACTION='dbmodify.php'><INPUT TYPE=HIDDEN NAME=action VALUE=folder_modify>"); |
| 384 | 384 | print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_name:</TD><TD align=left><INPUT TYPE=TEXT NAME=name VALUE='".$sql->f("name")."'></TD></TR>"); |
| 385 | - //print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_policy:</TD><TD align=left>$security</TD></TR>"); | |
| 386 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownership:</TD><TD align=left>".uid_to_name(owlfoldercreator($id))." (".group_to_name(owlfoldergroup($id)).")</TD></TR> | |
| 385 | + //print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_policy:</TD><TD align=left>$security</TD></TR>"); | |
| 386 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownership:</TD><TD align=left>".uid_to_name(owlfoldercreator($id))." (".group_to_name(owlfoldergroup($id)).")</TD></TR> | |
| 387 | 387 | <INPUT TYPE=HIDDEN NAME=id VALUE=$id> |
| 388 | - <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 389 | - <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 390 | - <INPUT TYPE=HIDDEN NAME=parent VALUE=$parent> | |
| 391 | - <INPUT TYPE=HIDDEN NAME=expand VALUE=$expand>"); | |
| 392 | - | |
| 393 | - /* BEGIN Bozz Change | |
| 394 | - Display Retrieved Group information if the user is in the | |
| 395 | - Administrator group */ | |
| 396 | - if ( owlusergroup($userid) == 0 ) { | |
| 397 | - print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownergroup:</TD><TD align=left><SELECT NAME=groupid>"); | |
| 398 | - print("<OPTION VALUE=".$sql->f("groupid").">".group_to_name($sql->f("groupid"))); | |
| 399 | - foreach($groups as $g) { | |
| 400 | - print("<OPTION VALUE=$g[0]>$g[1]"); | |
| 401 | - } | |
| 402 | - printgroupperm($security, "policy", $lang_policy, "admin"); | |
| 403 | - } else { | |
| 404 | - printgroupperm($security, "policy", $lang_policy, "user"); | |
| 405 | - } | |
| 406 | - /* END Bozz Change */ | |
| 407 | - | |
| 408 | - print("</TABLE><INPUT TYPE=SUBMIT VALUE=$lang_change><INPUT TYPE=RESET VALUE=$lang_reset> | |
| 388 | + <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 389 | + <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 390 | + <INPUT TYPE=HIDDEN NAME=parent VALUE=$parent> | |
| 391 | + <INPUT TYPE=HIDDEN NAME=expand VALUE=$expand>"); | |
| 392 | + | |
| 393 | + /* BEGIN Bozz Change | |
| 394 | + Display Retrieved Group information if the user is in the | |
| 395 | + Administrator group */ | |
| 396 | + if ( owlusergroup($userid) == 0 ) | |
| 397 | + { | |
| 398 | + print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$lang_ownergroup:</TD><TD align=left><SELECT NAME=groupid>"); | |
| 399 | + print("<OPTION VALUE=".$sql->f("groupid").">".group_to_name($sql->f("groupid"))); | |
| 400 | + foreach($groups as $g) { | |
| 401 | + print("<OPTION VALUE=$g[0]>$g[1]"); | |
| 402 | + } | |
| 403 | + printgroupperm($security, "policy", $lang_policy, "admin"); | |
| 404 | + } | |
| 405 | + else | |
| 406 | + { | |
| 407 | + printgroupperm($security, "policy", $lang_policy, "user"); | |
| 408 | + } | |
| 409 | + /* END Bozz Change */ | |
| 410 | + | |
| 411 | + print("</TABLE><INPUT TYPE=SUBMIT VALUE=$lang_change><INPUT TYPE=RESET VALUE=$lang_reset> | |
| 409 | 412 | <INPUT TYPE=HIDDEN NAME=sess VALUE='$sess'></FORM></TABLE>"); |
| 410 | 413 | include("./lib/footer.inc"); |
| 411 | - } // end while | |
| 412 | - } else { | |
| 413 | - print($lang_nofoldermod); | |
| 414 | - } | |
| 414 | + | |
| 415 | + } | |
| 416 | + } else { | |
| 417 | + print($lang_nofoldermod); | |
| 418 | + } | |
| 415 | 419 | } |
| 416 | 420 | |
| 417 | 421 | if ($action == "file_email") { |
| 418 | - if(check_auth($id, "file_modify", $userid) == 1) { | |
| 419 | - print("<BR>"); | |
| 420 | - $expand = 1; | |
| 422 | + if(check_auth($id, "file_modify", $userid) == 1) { | |
| 423 | + print("<BR>"); | |
| 424 | + $expand = 1; | |
| 421 | 425 | |
| 422 | 426 | $sql = new Owl_DB; |
| 423 | - $sql->query("select * from $default->owl_users_table where id = '$userid'"); | |
| 427 | + $sql->query("select * from $default->owl_users_table where id = '$userid'"); | |
| 424 | 428 | $sql->next_record(); |
| 425 | - $default_reply_to = $sql->f("email"); | |
| 426 | - | |
| 427 | - print("<FORM ACTION='./dbmodify.php' METHOD=POST>"); | |
| 428 | - print("<INPUT TYPE=HIDDEN NAME=id VALUE=".$sql->f("id").">"); | |
| 429 | - | |
| 430 | - print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border>"); | |
| 431 | - print("<TR><TD align=left>$lang_emailing ".gen_navbar($parent)."/".flid_to_name($id)."</TD></TR>"); | |
| 432 | - print("</TABLE><HR WIDTH=$default->table_expand_width><BR>"); | |
| 433 | - print("<FORM enctype='multipart/form-data' ACTION='dbmodify.php' METHOD=POST> | |
| 434 | - <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 435 | - <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 436 | - <INPUT TYPE=HIDDEN NAME=sess VALUE='$sess'> | |
| 437 | - <INPUT TYPE=HIDDEN NAME=parent VALUE=$parent> | |
| 438 | - <INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE='$default->max_filesize'> | |
| 439 | - <INPUT TYPE=HIDDEN NAME=action VALUE=file_email> | |
| 440 | - <INPUT TYPE=HIDDEN NAME=type VALUE='$type'> | |
| 441 | - <INPUT TYPE=HIDDEN NAME=id VALUE='$id'>"); | |
| 442 | - | |
| 443 | - print("<INPUT TYPE=HIDDEN NAME=expand VALUE='$expand'>"); | |
| 444 | - print("<TABLE BORDER=$default->table_border><TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_email_to</TD><TD align=left><INPUT TYPE=TEXT NAME=mailto></TD></TR> | |
| 445 | - <TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_email_cc</TD><TD align=left><INPUT TYPE=TEXT NAME=ccto></TD></TR> | |
| 446 | - <TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_email_reply_to</TD><TD align=left><INPUT TYPE=TEXT NAME=replyto VALUE='$default_reply_to'></TD></TR> | |
| 447 | - <TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_email_subject</TD><TD align=left><INPUT TYPE=TEXT NAME=subject size=80></TD></TR>"); | |
| 448 | - print("<tr><TD align=right bgcolor=$default->table_header_bg valign=top>$lang_email_body</td> | |
| 449 | - <td align=left><textarea name=mailbody rows=20 cols=80 wrap=hard></textarea></tr>"); | |
| 450 | - print("</TABLE><INPUT TYPE=SUBMIT VALUE='$lang_sendfile'></FORM>"); | |
| 451 | - include("./lib/footer.inc"); | |
| 452 | - } else { | |
| 453 | - print($lang_noemail); | |
| 454 | - } | |
| 429 | + $default_reply_to = $sql->f("email"); | |
| 430 | + | |
| 431 | + print("<FORM ACTION='./dbmodify.php' METHOD=POST>"); | |
| 432 | + print("<INPUT TYPE=HIDDEN NAME=id VALUE=".$sql->f("id").">"); | |
| 433 | + | |
| 434 | + print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border>"); | |
| 435 | + print("<TR><TD align=left>$lang_emailing ".gen_navbar($parent)."/".flid_to_name($id)."</TD></TR>"); | |
| 436 | + print("</TABLE><HR WIDTH=$default->table_expand_width><BR>"); | |
| 437 | + print("<FORM enctype='multipart/form-data' ACTION='dbmodify.php' METHOD=POST> | |
| 438 | + <INPUT TYPE=HIDDEN NAME=order VALUE='$order'> | |
| 439 | + <INPUT TYPE=HIDDEN NAME=sortname VALUE='$sortname'> | |
| 440 | + <INPUT TYPE=HIDDEN NAME=sess VALUE='$sess'> | |
| 441 | + <INPUT TYPE=HIDDEN NAME=parent VALUE=$parent> | |
| 442 | + <INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE='$default->max_filesize'> | |
| 443 | + <INPUT TYPE=HIDDEN NAME=action VALUE=file_email> | |
| 444 | + <INPUT TYPE=HIDDEN NAME=type VALUE='$type'> | |
| 445 | + <INPUT TYPE=HIDDEN NAME=id VALUE='$id'>"); | |
| 446 | + | |
| 447 | + print("<INPUT TYPE=HIDDEN NAME=expand VALUE='$expand'>"); | |
| 448 | + print("<TABLE BORDER=$default->table_border><TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_email_to</TD><TD align=left><INPUT TYPE=TEXT NAME=mailto></TD></TR> | |
| 449 | + <TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_email_cc</TD><TD align=left><INPUT TYPE=TEXT NAME=ccto></TD></TR> | |
| 450 | + <TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_email_reply_to</TD><TD align=left><INPUT TYPE=TEXT NAME=replyto VALUE='$default_reply_to'></TD></TR> | |
| 451 | + <TR><TD ALIGN=RIGHT bgcolor=$default->table_header_bg>$lang_email_subject</TD><TD align=left><INPUT TYPE=TEXT NAME=subject size=80></TD></TR>"); | |
| 452 | + print("<tr><TD align=right bgcolor=$default->table_header_bg valign=top>$lang_email_body</td> | |
| 453 | + <td align=left><textarea name=mailbody rows=20 cols=80 wrap=hard></textarea></tr>"); | |
| 454 | + print("</TABLE><INPUT TYPE=SUBMIT VALUE='$lang_sendfile'></FORM>"); | |
| 455 | + include("./lib/footer.inc"); | |
| 456 | + } else { | |
| 457 | + print($lang_noemail); | |
| 458 | + } | |
| 455 | 459 | } |
| 456 | 460 | |
| 457 | 461 | ?> | ... | ... |
move.php
| ... | ... | @@ -3,8 +3,6 @@ |
| 3 | 3 | /* |
| 4 | 4 | * move.php |
| 5 | 5 | * |
| 6 | - * Move a folder or a file to a new destination | |
| 7 | - * | |
| 8 | 6 | * Copyright (c) 1999-2002 The Owl Project Team |
| 9 | 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 10 | 8 | * |
| ... | ... | @@ -48,18 +46,14 @@ switch ($order) { |
| 48 | 46 | |
| 49 | 47 | |
| 50 | 48 | if($action == "file") { |
| 51 | - //if the user does not have permission to modify the file | |
| 52 | 49 | if(check_auth($id, "file_modify", $userid) == 0) { |
| 53 | 50 | include("./lib/header.inc"); |
| 54 | 51 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| 55 | 52 | ?> |
| 56 | 53 | <TR><TD ALIGN=LEFT> |
| 57 | 54 | <?php print("$lang_user: "); |
| 58 | - | |
| 59 | - //if the user has access to his/her preferences | |
| 60 | - //print a link to the user's preferences | |
| 61 | 55 | if(prefaccess($userid)) { |
| 62 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&sortname=$sortname'>"); | |
| 56 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&sortname=$sortname'>"); | |
| 63 | 57 | } |
| 64 | 58 | print uid_to_name($userid); |
| 65 | 59 | print ("</A>"); |
| ... | ... | @@ -75,18 +69,14 @@ if($action == "file") { |
| 75 | 69 | exit($lang_nofilemod); |
| 76 | 70 | } |
| 77 | 71 | } else { |
| 78 | - //if the user does not have permission to modify the folder | |
| 79 | 72 | if(check_auth($id, "folder_modify", $userid) == 0) { |
| 80 | 73 | include("./lib/header.inc"); |
| 81 | 74 | print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); |
| 82 | 75 | ?> |
| 83 | 76 | <TR><TD ALIGN=LEFT> |
| 84 | 77 | <?php print("$lang_user: "); |
| 85 | - | |
| 86 | - //if the user has access to his/her preferences | |
| 87 | - //print a link to the user's preferences | |
| 88 | 78 | if(prefaccess($userid)) { |
| 89 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&sortname=$sortname'>"); | |
| 79 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&sortname=$sortname'>"); | |
| 90 | 80 | } |
| 91 | 81 | print uid_to_name($userid); |
| 92 | 82 | print ("</A>"); |
| ... | ... | @@ -102,17 +92,9 @@ if($action == "file") { |
| 102 | 92 | } |
| 103 | 93 | } |
| 104 | 94 | |
| 105 | - | |
| 106 | -/** | |
| 107 | -* Check for new folders. Sets $newFolder to the new folder id | |
| 108 | -*/ | |
| 109 | 95 | function checkForNewFolder() { |
| 110 | 96 | global $HTTP_POST_VARS, $newFolder; |
| 111 | - if (!is_array($HTTP_POST_VARS)) | |
| 112 | - { | |
| 113 | - return; | |
| 114 | - } | |
| 115 | - | |
| 97 | + if (!is_array($HTTP_POST_VARS)) return; | |
| 116 | 98 | while (list($key, $value) = each ($HTTP_POST_VARS)) { |
| 117 | 99 | if (substr($key,0,2)=="ID") { |
| 118 | 100 | $newFolder = intval(substr($key,2)); |
| ... | ... | @@ -121,58 +103,27 @@ function checkForNewFolder() { |
| 121 | 103 | } |
| 122 | 104 | } |
| 123 | 105 | |
| 124 | -/** | |
| 125 | -* Display all the sub-folders in a folder | |
| 126 | -* | |
| 127 | -* @param $fid folder id | |
| 128 | -* @param $folder folder name | |
| 129 | -* | |
| 130 | -*/ | |
| 131 | 106 | function showFoldersIn($fid, $folder) { |
| 132 | 107 | global $folderList, $fCount, $fDepth, $excludeID, $action, $id, $default, $userid ; |
| 133 | 108 | for ($c=0 ;$c < ($fDepth-1) ; $c++) print "<img src='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/blank.gif' height=16 width=18 align=top>"; |
| 134 | 109 | if ($fDepth) print "<img src='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/link.gif' height=16 width=16 align=top>"; |
| 135 | 110 | |
| 136 | 111 | $gray=0; // Work out when to gray out folders ... |
| 137 | - | |
| 138 | - //current parent for all moves | |
| 139 | - if ($fid==$excludeID) | |
| 140 | - { | |
| 141 | - $gray=1; | |
| 142 | - } | |
| 143 | - //subtree for folder moves | |
| 144 | - //can't move a folder to itself | |
| 145 | - if (($action=="folder") && ($fid==$id)) | |
| 146 | - { | |
| 147 | - $gray=1; | |
| 148 | - } | |
| 149 | - //check for permissions | |
| 150 | - //if you don't have folder modify permissions | |
| 151 | - if (check_auth($fid, "folder_modify", $userid) == 0) | |
| 152 | - { | |
| 153 | - $gray = 1; | |
| 154 | - } | |
| 112 | + if ($fid==$excludeID) $gray=1; // current parent for all moves | |
| 113 | + if (($action=="folder") && ($fid==$id)) $gray=1; // subtree for folder moves | |
| 114 | + if (check_auth($fid, "folder_modify", $userid) == 0) $gray = 1; // check for permissions | |
| 115 | + | |
| 155 | 116 | |
| 156 | - | |
| 157 | 117 | if ($gray) { |
| 158 | 118 | print "<img src='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/folder_gray.gif' height=16 width=16 align=top>"; |
| 159 | 119 | print " <font color=\"silver\">$folder</font><br>\n"; |
| 160 | - } | |
| 161 | - else | |
| 162 | - { | |
| 120 | + } else { | |
| 163 | 121 | print "<input type='image' border=0 src='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/folder_closed.gif' height=16 width=16 align=top name=\"ID"; |
| 164 | 122 | print "$fid\"> $folder<br>\n"; |
| 165 | 123 | } |
| 166 | 124 | |
| 167 | - //Don't show subtree of selected folder as target for folder move | |
| 168 | - if (($action=="folder") && ($fid==$id)) | |
| 169 | - { | |
| 170 | - return; | |
| 171 | - } | |
| 172 | - | |
| 173 | - //recurse through all the folders in the current folder and | |
| 174 | - //display their sub-folders | |
| 175 | - for ($c=0; $c < $fCount; $c++) { | |
| 125 | + if (($action=="folder") && ($fid==$id)) return; // Don't show subtree of selected folder as target for folder move | |
| 126 | + for ($c=0; $c<$fCount; $c++) { | |
| 176 | 127 | if ($folderList[$c][2]==$fid) { |
| 177 | 128 | $fDepth++; |
| 178 | 129 | showFoldersIn( $folderList[$c][0] , $folderList[$c][1] ); |
| ... | ... | @@ -187,14 +138,12 @@ if ($action=="$lang_cancel_button") { |
| 187 | 138 | } |
| 188 | 139 | |
| 189 | 140 | checkForNewFolder(); |
| 190 | -//if there is a new folder | |
| 191 | 141 | if (isset($newFolder)) { |
| 192 | 142 | $sql = new Owl_DB; |
| 193 | 143 | |
| 194 | 144 | $source=""; |
| 195 | 145 | $fID=$parent; |
| 196 | 146 | do { |
| 197 | - //build the directory path from the root folder to the current parent folder | |
| 198 | 147 | $sql->query("select name,parent from $default->owl_folders_table where id='$fID'"); |
| 199 | 148 | while($sql->next_record()) { |
| 200 | 149 | $tName = $sql->f("name"); |
| ... | ... | @@ -206,7 +155,6 @@ if (isset($newFolder)) { |
| 206 | 155 | $dest=""; |
| 207 | 156 | $fID=$newFolder; |
| 208 | 157 | do { |
| 209 | - //build the directory path from the root folder to the new folder | |
| 210 | 158 | $sql->query("select name,parent from $default->owl_folders_table where id='$fID'"); |
| 211 | 159 | while($sql->next_record()) { |
| 212 | 160 | $tName = $sql->f("name"); |
| ... | ... | @@ -232,8 +180,6 @@ if (isset($newFolder)) { |
| 232 | 180 | } |
| 233 | 181 | |
| 234 | 182 | |
| 235 | - //if we're using the file system | |
| 236 | - //then move the file | |
| 237 | 183 | if($default->owl_use_fs) { |
| 238 | 184 | if ($type != "url") { |
| 239 | 185 | if (!file_exists("$default->owl_FileDir/$dest$fname")) { | ... | ... |
prefs.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -/* | |
| 4 | - * prefs.php | |
| 3 | +/** | |
| 4 | + * prefs.php -- Main page | |
| 5 | + * | |
| 6 | + * This is the preferences page | |
| 7 | + * | |
| 8 | + * This page displays the various preference of the specific user | |
| 9 | + * It Allows for ordering of informatio nas well as the changing | |
| 10 | + * Of specific information e.g. passwords etc | |
| 5 | 11 | * |
| 6 | - * Copyright (c) 1999-2002 The Owl Project Team | |
| 7 | 12 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | 13 | * |
| 9 | - * $Id$ | |
| 14 | + * @version v 1.1.1.1 2002/12/04 | |
| 15 | + * @Copyright (c) 1999-2002 The Owl Project Team | |
| 16 | + * @author michael | |
| 17 | + * @package test | |
| 10 | 18 | */ |
| 11 | 19 | |
| 12 | 20 | require("./config/owl.php"); |
| ... | ... | @@ -18,7 +26,10 @@ include("./lib/header.inc"); |
| 18 | 26 | // + ADDED &order=$order&$sortorder=$sortname to |
| 19 | 27 | // all browse.php? header and HREF LINES |
| 20 | 28 | // Begin 496814 Column Sorts are not persistant |
| 21 | -switch ($order) { | |
| 29 | + | |
| 30 | +// This handles the sorting order of information | |
| 31 | +switch ($order) | |
| 32 | +{ | |
| 22 | 33 | case "name": |
| 23 | 34 | $sortorder = 'sortname'; |
| 24 | 35 | break; |
| ... | ... | @@ -52,31 +63,64 @@ print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_b |
| 52 | 63 | ?> |
| 53 | 64 | |
| 54 | 65 | <TR><TD ALIGN=LEFT><?php print "$lang_user: "; print uid_to_name($userid);?> <FONT SIZE=-1> |
| 55 | -<?php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>");?> | |
| 66 | +<? | |
| 67 | + php print("<A HREF='index.php?login=logout&sess=$sess'>$lang_logout</A>"); | |
| 68 | +?> | |
| 56 | 69 | </FONT></TD><TD ALIGN=RIGHT> |
| 57 | -<?php print("<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>");?> | |
| 70 | +<?php | |
| 71 | + print("<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>");?> | |
| 58 | 72 | </A></TD></TR></TABLE> |
| 73 | + | |
| 59 | 74 | <?php print $lang_preference; ?><br><hr width=50%> |
| 60 | - | |
| 61 | 75 | <?php |
| 62 | -if(!$action) $action = "users"; | |
| 63 | 76 | |
| 64 | -function printuser($id) { | |
| 77 | +if(!$action) | |
| 78 | +{ | |
| 79 | + $action = "users"; | |
| 80 | +} | |
| 81 | + | |
| 82 | +//------------------------------------------------------------- | |
| 83 | +/** | |
| 84 | + * Function Printuser($id) | |
| 85 | + * | |
| 86 | + * Displays the user information | |
| 87 | + * | |
| 88 | + * @param $id | |
| 89 | + * The UserId of the user that is currently logged on | |
| 90 | +*/ | |
| 91 | +//------------------------------------------------------------- | |
| 92 | +// Not Usable - Interface has to Change | |
| 93 | +function printuser($id) | |
| 94 | + { | |
| 95 | + // declare some global variables | |
| 65 | 96 | global $order, $sortname, $sort; |
| 66 | 97 | global $sess,$change,$lang_saved,$lang_title,$lang_group,$lang_username,$lang_change,$lang_quota,$lang_groupmember; |
| 67 | 98 | global $lang_deleteuser, $default, $expand, $parent, $lang_oldpassword, $lang_newpassword, $lang_confpassword; |
| 68 | 99 | global $lang_email, $lang_notification, $lang_userlang,$lang_attach_file; |
| 69 | - if(isset($change)) print("$lang_saved<BR>"); | |
| 100 | + | |
| 101 | + if(isset($change)) | |
| 102 | + { | |
| 103 | + print("$lang_saved<BR>"); | |
| 104 | + } | |
| 105 | + | |
| 106 | + // get the id and name from the groups table | |
| 70 | 107 | $sql = new Owl_DB; |
| 71 | 108 | $sql->query("select id,name from $default->owl_groups_table"); |
| 72 | 109 | $i=0; |
| 73 | - while($sql->next_record()) { | |
| 110 | + | |
| 111 | + // store in a double array | |
| 112 | + while($sql->next_record()) | |
| 113 | + { | |
| 74 | 114 | $groups[$i][0] = $sql->f("id"); |
| 75 | 115 | $groups[$i][1] = $sql->f("name"); |
| 76 | 116 | $i++; |
| 77 | 117 | } |
| 118 | + | |
| 119 | + //get all information from the users table based on the group id | |
| 78 | 120 | $sql->query("select * from $default->owl_users_table where id = '$id'"); |
| 79 | - while($sql->next_record()) { | |
| 121 | + // loop through the recordset | |
| 122 | + while($sql->next_record()) | |
| 123 | + { | |
| 80 | 124 | print("<FORM ACTION='./dbmodify.php' METHOD=POST>"); |
| 81 | 125 | print("<INPUT TYPE=HIDDEN NAME=id VALUE=".$sql->f("id").">"); |
| 82 | 126 | print("<INPUT TYPE=HIDDEN NAME=order VALUE='$order'>"); |
| ... | ... | @@ -86,11 +130,14 @@ function printuser($id) { |
| 86 | 130 | print("<INPUT TYPE=HIDDEN name=expand VALUE=$expand>"); |
| 87 | 131 | print("<INPUT TYPE=HIDDEN name=parent VALUE=$parent>"); |
| 88 | 132 | print("<TABLE><TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_title</TD><TD><INPUT TYPE=text NAME=name VALUE='".$sql->f("name")."'></TD></TR>"); |
| 133 | + | |
| 89 | 134 | //******************************* |
| 90 | 135 | // Display the Language dropdown |
| 91 | 136 | //******************************* |
| 137 | + | |
| 92 | 138 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_userlang</TD><TD align=left><SELECT NAME=newlanguage>"); |
| 93 | 139 | print("<OPTION VALUE=".$sql->f("language").">".$sql->f("language")); |
| 140 | + | |
| 94 | 141 | $dir = dir($default->owl_LangDir); |
| 95 | 142 | $dir->rewind(); |
| 96 | 143 | |
| ... | ... | @@ -101,28 +148,48 @@ function printuser($id) { |
| 101 | 148 | print("<OPTION VALUE=$file>$file"); |
| 102 | 149 | } |
| 103 | 150 | } |
| 104 | - $dir->close(); | |
| 151 | + $dir->close(); | |
| 152 | + | |
| 153 | + // get values if password is to be changed | |
| 105 | 154 | print("</SELECT></TD></TR>"); |
| 106 | 155 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_oldpassword</TD><TD><INPUT TYPE=PASSWORD NAME=oldpassword VALUE=></TD></TR>"); |
| 107 | 156 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_newpassword</TD><TD><INPUT TYPE=PASSWORD NAME=newpassword VALUE=></TD></TR>"); |
| 108 | 157 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_confpassword</TD><TD><INPUT TYPE=PASSWORD NAME=confpassword VALUE=></TD></TR>"); |
| 109 | 158 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_email</TD><TD align=left><INPUT TYPE=TEXT NAME=email VALUE='".$sql->f("email")."'></TD></TR>"); |
| 110 | 159 | |
| 160 | + // check if notification has been checked on | |
| 111 | 161 | if ( $sql->f("notify") == 1) |
| 162 | + { | |
| 112 | 163 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_notification</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=notify VALUE=1 checked></TD></TR>"); |
| 164 | + } | |
| 113 | 165 | else |
| 166 | + { | |
| 114 | 167 | print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_notification</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=notify VALUE=1></TD></TR>"); |
| 168 | + } | |
| 169 | + | |
| 170 | + // check if attachfile has been checked | |
| 115 | 171 | if ( $sql->f("attachfile") == 1) |
| 116 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_attach_file</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=attachfile VALUE=1 checked></TD></TR>"); | |
| 172 | + { | |
| 173 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_attach_file</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=attachfile VALUE=1 checked></TD></TR>"); | |
| 174 | + } | |
| 117 | 175 | else |
| 118 | - print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_attach_file</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=attachfile VALUE=1></TD></TR>"); | |
| 176 | + print("<TR><TD BGCOLOR=$default->table_header_bg align=right>$lang_attach_file</TD><TD align=left><INPUT TYPE=CHECKBOX NAME=attachfile VALUE=1></TD></TR>"); | |
| 119 | 177 | print("</TABLE><BR><INPUT TYPE=SUBMIT VALUE=$lang_change>"); |
| 120 | - print("</FORM>"); } | |
| 178 | + print("</FORM>"); | |
| 179 | + } | |
| 121 | 180 | } |
| 122 | 181 | |
| 123 | -if($action) { | |
| 124 | - if(isset($owluser)) printuser($owluser); | |
| 125 | -} else { | |
| 182 | +//------------------------------------------------------------- | |
| 183 | +// if an action has occurred, check if user is set and then print out user preferences | |
| 184 | +if($action) | |
| 185 | +{ | |
| 186 | + if(isset($owluser)) | |
| 187 | + { | |
| 188 | + printuser($owluser); | |
| 189 | + } | |
| 190 | +} | |
| 191 | +else | |
| 192 | +{ | |
| 126 | 193 | exit("$lang_err_general"); |
| 127 | 194 | } |
| 128 | 195 | ... | ... |
search.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -/* | |
| 4 | - * search.php | |
| 2 | +/** | |
| 3 | + * Search.php | |
| 5 | 4 | * |
| 6 | 5 | * Copyright (c) 1999-2002 The Owl Project Team |
| 7 | 6 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 7 | + * This class is just random php used as a example. | |
| 8 | 8 | * |
| 9 | - * $Id$ | |
| 9 | + * @version 1.1.1.1 2002/12/04 | |
| 10 | + * @author Michael | |
| 11 | + * @package Owl | |
| 10 | 12 | */ |
| 11 | 13 | |
| 12 | 14 | require("./config/owl.php"); |
| ... | ... | @@ -14,13 +16,30 @@ require("./lib/owl.lib.php"); |
| 14 | 16 | require("./config/html.php"); |
| 15 | 17 | require("./lib/security.lib.php"); |
| 16 | 18 | |
| 17 | -function find_path($parent) { | |
| 19 | + | |
| 20 | +//------------------------------------------------------------- | |
| 21 | +/** | |
| 22 | + * Function find_path($parent) | |
| 23 | + * | |
| 24 | + * Retrieves the parent folder from the DB | |
| 25 | + * | |
| 26 | + * @param $parent | |
| 27 | + * The parent folder id of the parent folder that needs to be retrieved | |
| 28 | + * @Return $path | |
| 29 | + * Returns the path of the parent folder | |
| 30 | +*/ | |
| 31 | +//------------------------------------------------------------- | |
| 32 | +// Usable | |
| 33 | +function find_path($parent) | |
| 34 | +{ | |
| 18 | 35 | global $default; |
| 19 | 36 | $path = fid_to_name($parent); |
| 20 | 37 | $sql = new Owl_DB; |
| 21 | - while($parent != 1) { | |
| 38 | + while($parent != 1) | |
| 39 | + {// retrieve the parent from the folders table that corresponds to the parent id param | |
| 22 | 40 | $sql->query("select parent from $default->owl_folders_table where id = '$parent'"); |
| 23 | - while($sql->next_record()) { | |
| 41 | + while($sql->next_record()) | |
| 42 | + { | |
| 24 | 43 | $path = fid_to_name($sql->f("parent"))."/".$path; |
| 25 | 44 | $parent = $sql->f("parent"); |
| 26 | 45 | } |
| ... | ... | @@ -28,6 +47,8 @@ function find_path($parent) { |
| 28 | 47 | return $path; |
| 29 | 48 | } |
| 30 | 49 | |
| 50 | +// This Layout section will not be needed as it is going to change | |
| 51 | + | |
| 31 | 52 | // BEGIN patch Scott Tigr |
| 32 | 53 | // patch for layout |
| 33 | 54 | include("./lib/header.inc"); |
| ... | ... | @@ -45,9 +66,12 @@ include("./lib/header.inc"); |
| 45 | 66 | |
| 46 | 67 | print "<center>"; |
| 47 | 68 | print "<br>"; |
| 48 | -if ($expand == 1) { // long view | |
| 69 | +if ($expand == 1) | |
| 70 | +{ // long view | |
| 49 | 71 | print("\t\t<TABLE WIDTH=\"".$default->table_expand_width."\" border=\"0\">\n"); |
| 50 | -} else { | |
| 72 | +} | |
| 73 | +else | |
| 74 | +{ | |
| 51 | 75 | print("\t\t<TABLE WIDTH=$default->table_collapse_width>\n"); |
| 52 | 76 | } |
| 53 | 77 | |
| ... | ... | @@ -67,18 +91,23 @@ $sql->query("SELECT id,creatorid,groupid,security FROM $default->owl_folders_tab |
| 67 | 91 | |
| 68 | 92 | // |
| 69 | 93 | // get all the folders that the user can read |
| 70 | -while($sql->next_record()) { | |
| 94 | +while($sql->next_record()) | |
| 95 | +{ | |
| 71 | 96 | $id = $sql->f("id"); |
| 72 | 97 | if(check_auth($id, "folder_view", $userid) == 1) $folders[$id] = $id; |
| 73 | 98 | } |
| 74 | 99 | |
| 75 | 100 | // |
| 76 | 101 | // get all the files in those folders that the user can read |
| 77 | -foreach($folders as $item) { | |
| 102 | +foreach($folders as $item) | |
| 103 | +{ | |
| 78 | 104 | $sql->query("SELECT * FROM $default->owl_files_table where parent = '$item'"); |
| 79 | - while($sql->next_record()) { | |
| 105 | + while($sql->next_record()) | |
| 106 | + { | |
| 80 | 107 | $id = $sql->f("id"); |
| 81 | - if(check_auth($id, "file_download", $userid) == 1) { | |
| 108 | + | |
| 109 | + if(check_auth($id, "file_download", $userid) == 1) | |
| 110 | + { | |
| 82 | 111 | $files[$id][id] = $id; |
| 83 | 112 | $files[$id][n] = $sql->f("name"); |
| 84 | 113 | $files[$id][m] = explode(" ", $sql->f("metadata")); |
| ... | ... | @@ -109,21 +138,48 @@ $query = explode(" ", $query); |
| 109 | 138 | // |
| 110 | 139 | // the is the meat of the matching |
| 111 | 140 | if(sizeof($files) > 0) { |
| 112 | -foreach($query as $keyword) { | |
| 113 | - foreach(array_keys($files) as $key) { | |
| 141 | +foreach($query as $keyword) | |
| 142 | + { | |
| 143 | + foreach(array_keys($files) as $key) | |
| 144 | + { | |
| 114 | 145 | // BEGIN enhancement Sunil Savkar |
| 115 | 146 | // if the $parent string contains a keyword to be searched, then the score is |
| 116 | 147 | // adjusted. This takes into account the hierarchy. |
| 117 | - if(eregi("$keyword", find_path($files[$key][p]))) $files[$key][score] = $files[$key][score] + 4; | |
| 118 | - if(eregi("$keyword", $files[$key][n])) $files[$key][score] = $files[$key][score] + 4; | |
| 119 | - if(eregi("$keyword", $files[$key][f])) $files[$key][score] = $files[$key][score] + 3; | |
| 120 | - foreach($files[$key][m] as $metaitem) { | |
| 148 | + | |
| 149 | + // if keyword is found in the path | |
| 150 | + if(eregi("$keyword", find_path($files[$key][p]))) | |
| 151 | + { | |
| 152 | + $files[$key][score] = $files[$key][score] + 4; | |
| 153 | + } | |
| 154 | + | |
| 155 | + //if keyword is found in the files array | |
| 156 | + if(eregi("$keyword", $files[$key][n])) | |
| 157 | + { | |
| 158 | + $files[$key][score] = $files[$key][score] + 4; | |
| 159 | + } | |
| 160 | + | |
| 161 | + if(eregi("$keyword", $files[$key][f])) | |
| 162 | + { | |
| 163 | + $files[$key][score] = $files[$key][score] + 3; | |
| 164 | + } | |
| 165 | + // if keyword is found in metadata | |
| 166 | + foreach($files[$key][m] as $metaitem) | |
| 167 | + { | |
| 121 | 168 | // add 2 to the score if we find it in metadata (key search items) |
| 122 | - if(eregi("$keyword", $metaitem)) $files[$key][score] = $files[$key][score] + 2; | |
| 169 | + if(eregi("$keyword", $metaitem)) | |
| 170 | + { | |
| 171 | + $files[$key][score] = $files[$key][score] + 2; | |
| 172 | + } | |
| 123 | 173 | } |
| 124 | - foreach($files[$key][d] as $descitem) { | |
| 174 | + | |
| 175 | + // if keyword is found in description | |
| 176 | + foreach($files[$key][d] as $descitem) | |
| 177 | + { | |
| 125 | 178 | // only add 1 for regular description matches |
| 126 | - if(eregi("$keyword", $descitem)) $files[$key][score] = $files[$key][score] + 1; | |
| 179 | + if(eregi("$keyword", $descitem)) | |
| 180 | + { | |
| 181 | + $files[$key][score] = $files[$key][score] + 1; | |
| 182 | + } | |
| 127 | 183 | } |
| 128 | 184 | } |
| 129 | 185 | } |
| ... | ... | @@ -136,11 +192,16 @@ $hit = 1; |
| 136 | 192 | $CountLines = 0; |
| 137 | 193 | $iconfiles = array("html","htm","gif","jpg","bmp","zip","tar","doc","mdb","xls","ppt","pdf","gz","mp3","tgz"); |
| 138 | 194 | |
| 139 | - | |
| 140 | -if(sizeof($files) > 0) { | |
| 141 | - while($max > 0) { | |
| 142 | - foreach(array_keys($files) as $key) { | |
| 143 | - if($files[$key][score] == $max) { | |
| 195 | +//if array exists print out the results based on their score of relavence | |
| 196 | +// This section will have to change as the interface is changing | |
| 197 | +if(sizeof($files) > 0) | |
| 198 | +{ | |
| 199 | + while($max > 0) | |
| 200 | + { | |
| 201 | + foreach(array_keys($files) as $key) | |
| 202 | + { | |
| 203 | + if($files[$key][score] == $max) | |
| 204 | + { | |
| 144 | 205 | $name = find_path($files[$key][p])."/".$files[$key][n]; |
| 145 | 206 | $filename = $files[$key][f]; |
| 146 | 207 | $choped = split("\.", $filename); |
| ... | ... | @@ -151,22 +212,32 @@ if(sizeof($files) > 0) { |
| 151 | 212 | $CountLines++; |
| 152 | 213 | $PrintLines = $CountLines % 2; |
| 153 | 214 | if ($PrintLines == 0) |
| 215 | + { | |
| 154 | 216 | print("<TR BGCOLOR='$default->table_cell_bg_alt'>"); |
| 217 | + } | |
| 155 | 218 | else |
| 156 | 219 | print("<TR BGCOLOR='$default->table_cell_bg'>"); |
| 157 | 220 | print "<TD ALIGN=CENTER width=5%>"; |
| 158 | 221 | //for ($i=$max; $i>0; $i--) { |
| 159 | 222 | |
| 160 | 223 | //} |
| 224 | + | |
| 225 | + // display results based on relevance (different graphics) and score | |
| 161 | 226 | $t_score = $max; |
| 162 | - for ($c=$max; $c>=1; $c--) { | |
| 163 | - if ( $t_score >= 10) { | |
| 164 | - if ( 0 == ($c % 10)) { | |
| 227 | + for ($c=$max; $c>=1; $c--) | |
| 228 | + { | |
| 229 | + if ( $t_score >= 10) | |
| 230 | + { | |
| 231 | + if ( 0 == ($c % 10)) | |
| 232 | + { | |
| 165 | 233 | print "<IMG SRC='$default->owl_root_url/graphics/star10.gif' BORDER=0>"; |
| 166 | 234 | $t_score = $t_score - 10; |
| 167 | 235 | } |
| 168 | - } else { | |
| 169 | - if ( (0 == ($t_score % 2)) && $t_score > 0 ) { | |
| 236 | + } | |
| 237 | + else | |
| 238 | + { | |
| 239 | + if ( (0 == ($t_score % 2)) && $t_score > 0 ) | |
| 240 | + { | |
| 170 | 241 | print "<IMG SRC='$default->owl_root_url/graphics/star.gif' BORDER=0>"; |
| 171 | 242 | } |
| 172 | 243 | $t_score = $t_score - 1; | ... | ... |
view.php
| ... | ... | @@ -3,8 +3,6 @@ |
| 3 | 3 | /* |
| 4 | 4 | * view.php |
| 5 | 5 | * |
| 6 | - * Displays file details, image previews, zip previews depending on the current action | |
| 7 | - * | |
| 8 | 6 | * Copyright (c) 1999-2002 The Owl Project Team |
| 9 | 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 10 | 8 | * |
| ... | ... | @@ -54,13 +52,7 @@ switch ($order) { |
| 54 | 52 | } |
| 55 | 53 | |
| 56 | 54 | // END 496814 Column Sorts are not persistant |
| 57 | -/** | |
| 58 | -* Finds the path from the root folder to the required folder | |
| 59 | -* | |
| 60 | -* @param $parent required folder | |
| 61 | -* | |
| 62 | -* @returns string containing path from root folder to required folder | |
| 63 | -*/ | |
| 55 | + | |
| 64 | 56 | function find_path($parent) { |
| 65 | 57 | global $default; |
| 66 | 58 | $path = fid_to_name($parent); |
| ... | ... | @@ -75,13 +67,6 @@ function find_path($parent) { |
| 75 | 67 | return $path; |
| 76 | 68 | } |
| 77 | 69 | |
| 78 | -/** | |
| 79 | -* Get a file name for a file id | |
| 80 | -* | |
| 81 | -* @paramater $id file id | |
| 82 | -* | |
| 83 | -* @return string file name | |
| 84 | -*/ | |
| 85 | 70 | function fid_to_filename($id) { |
| 86 | 71 | global $default; |
| 87 | 72 | $sql = new Owl_DB; |
| ... | ... | @@ -90,14 +75,11 @@ function fid_to_filename($id) { |
| 90 | 75 | } |
| 91 | 76 | |
| 92 | 77 | if($action == "image_show") { |
| 93 | - //if the user has permission to download the file | |
| 94 | 78 | if(check_auth($id, "file_download", $userid) == 1) { |
| 95 | - //if the file is stored on the file system | |
| 96 | 79 | if ($default->owl_use_fs) { |
| 97 | 80 | $path = $default->owl_FileDir."/".find_path($parent)."/".fid_to_filename($id); |
| 98 | 81 | readfile("$path"); |
| 99 | 82 | } |
| 100 | - //else the file is stored in the database | |
| 101 | 83 | else { |
| 102 | 84 | $sql = new Owl_DB; |
| 103 | 85 | $filename = fid_to_filename($id); |
| ... | ... | @@ -145,17 +127,12 @@ print("<TABLE WIDTH=$default->table_expand_width BGCOLOR=$default->main_header_b |
| 145 | 127 | <?php print("<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>");?> |
| 146 | 128 | </A></TD></TR></TABLE> |
| 147 | 129 | <?php |
| 148 | - | |
| 149 | -//view the file details (name, creator, security rights etc.) | |
| 150 | 130 | if($action == "file_details") { |
| 151 | - //if the current user has permission to view the folder | |
| 152 | 131 | if(check_auth($parent, "folder_view", $userid) == 1) { |
| 153 | 132 | $expand = 1; |
| 154 | 133 | print("<TABLE WIDTH=$default->table_expand_width BORDER=$default->table_border>"); |
| 155 | 134 | print("<TR><TD align=left>".gen_navbar($parent)."/".flid_to_name($id)."</TD></TR>"); |
| 156 | 135 | print("</TABLE><HR WIDTH=$default->table_expand_width><BR>"); |
| 157 | - | |
| 158 | - //get the file information | |
| 159 | 136 | $sql = new Owl_DB; $sql->query("select * from $default->owl_files_table where id = '$id'"); |
| 160 | 137 | while($sql->next_record()) { |
| 161 | 138 | $security = $sql->f("security"); |
| ... | ... | @@ -183,9 +160,7 @@ if($action == "file_details") { |
| 183 | 160 | } |
| 184 | 161 | } |
| 185 | 162 | |
| 186 | -//preview an image | |
| 187 | 163 | if($action == "image_preview") { |
| 188 | - //if the current user has permission to dowload the file | |
| 189 | 164 | if(check_auth($id, "file_download", $userid) == 1) { |
| 190 | 165 | $path = find_path($parent)."/".fid_to_filename($id); |
| 191 | 166 | print("$lang_viewing". gen_navbar($parent) . "/" . fid_to_filename($id) ."<HR WIDTH=50%><BR><BR>"); |
| ... | ... | @@ -195,18 +170,13 @@ if($action == "image_preview") { |
| 195 | 170 | } |
| 196 | 171 | } |
| 197 | 172 | |
| 198 | -//preview a zip file | |
| 199 | 173 | if($action == "zip_preview") { |
| 200 | - //if the current user has permission to download the file | |
| 201 | 174 | if(check_auth($id, "file_download", $userid) == 1) { |
| 202 | 175 | $name = fid_to_filename($id); |
| 203 | 176 | |
| 204 | - //if the file is stored on the file system | |
| 205 | 177 | if ($default->owl_use_fs) { |
| 206 | 178 | $path = find_path($parent)."/".$name; |
| 207 | - } | |
| 208 | - //else the file is stored in the database | |
| 209 | - else { | |
| 179 | + } else { | |
| 210 | 180 | $path = $name; |
| 211 | 181 | if (file_exists($default->owl_FileDir. "/$path")) unlink($default->owl_FileDir. "/$path"); |
| 212 | 182 | $file = fopen($default->owl_FileDir. "/$path", 'wb'); |
| ... | ... | @@ -254,18 +224,13 @@ if($action == "zip_preview") { |
| 254 | 224 | |
| 255 | 225 | // BEGIN wes change |
| 256 | 226 | if($action == "html_show" || $action == "text_show") { |
| 257 | - //if the current user has permission to download the file | |
| 258 | 227 | if(check_auth($id, "file_download", $userid) == 1) { |
| 259 | - //if the file is stored on the file system | |
| 260 | 228 | if ($default->owl_use_fs) { |
| 261 | 229 | $path = $default->owl_FileDir."/".find_path($parent)."/".fid_to_filename($id); |
| 262 | 230 | print("<BR>$lang_viewing". gen_navbar($parent) . "/" . fid_to_filename($id) ."<HR WIDTH=50%><BR><BR></CENTER>"); |
| 263 | 231 | if ($action == "text_show") print("<xmp>"); |
| 264 | 232 | readfile("$path"); |
| 265 | - } | |
| 266 | - //else the file is stored in the database | |
| 267 | - else | |
| 268 | - { | |
| 233 | + } else { | |
| 269 | 234 | print("$lang_viewing /".find_path($parent)."/".fid_to_filename($id)."<HR WIDTH=50%><BR><BR></CENTER>"); |
| 270 | 235 | if ($action == "text_show") print("<xmp>"); |
| 271 | 236 | ... | ... |