Commit fac15f9333ea07a72acab61bec10b1466c66e0d8
1 parent
75911002
converted tabs to spaces
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@72 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
805 additions
and
805 deletions
lib/owl.lib.php
| @@ -23,152 +23,152 @@ | @@ -23,152 +23,152 @@ | ||
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | class Owl_DB extends DB_Sql { | 25 | class Owl_DB extends DB_Sql { |
| 26 | - | ||
| 27 | - /** Class name */ | 26 | + |
| 27 | + /** Class name */ | ||
| 28 | var $classname = "Owl_DB"; | 28 | var $classname = "Owl_DB"; |
| 29 | 29 | ||
| 30 | // BEGIN wes changes -- moved these settings to config/owl.php | 30 | // BEGIN wes changes -- moved these settings to config/owl.php |
| 31 | // Server where the database resides | 31 | // Server where the database resides |
| 32 | - | ||
| 33 | - /** Host name. Retrieved from config/owl.php */ | 32 | + |
| 33 | + /** Host name. Retrieved from config/owl.php */ | ||
| 34 | var $Host = ""; | 34 | var $Host = ""; |
| 35 | /** Database name */ | 35 | /** Database name */ |
| 36 | var $Database = ""; | 36 | var $Database = ""; |
| 37 | /** Database user */ | 37 | /** Database user */ |
| 38 | var $User = ""; | 38 | var $User = ""; |
| 39 | /** Database user password */ | 39 | /** Database user password */ |
| 40 | - var $Password = ""; | ||
| 41 | - /** Query to execute */ | ||
| 42 | - var $sQuery; | ||
| 43 | - /** Name of table last query was executed on*/ | ||
| 44 | - var $sLastTableName; | ||
| 45 | - /** Where clause last used in query execution */ | ||
| 46 | - var $sLastWhereClause; | ||
| 47 | - /** Order by clause last used in query execution */ | ||
| 48 | - var $sLastOrderByClause; | ||
| 49 | - | ||
| 50 | - /** Default Constructor */ | ||
| 51 | - function Owl_DB() { | ||
| 52 | - global $default; | ||
| 53 | - $this->Host = $default->owl_db_host; | ||
| 54 | - $this->Database = $default->owl_db_name; | ||
| 55 | - $this->User = $default->owl_db_user; | ||
| 56 | - $this->Password = $default->owl_db_pass; | ||
| 57 | - } | ||
| 58 | - // END wes changes | ||
| 59 | - | ||
| 60 | - /** | ||
| 61 | - * Create a query from the provided paramaters. The ID column | ||
| 62 | - * is seleted by default | ||
| 63 | - * | ||
| 64 | - * @param $sTableName Table to query | ||
| 65 | - * @param $aColumns Columns in table | ||
| 66 | - * @param $sWhereClause Where clause (optional) | ||
| 67 | - * @param $sOrderByClause Order by clause (optional) | ||
| 68 | - */ | ||
| 69 | - function createSQLQuery($sTableName, $aColumns, $sWhereClause = null, $sOrderByClause = null) { | ||
| 70 | - $this->sLastTableName = $sTableName; | ||
| 71 | - $this->sLastWhereCluase = $sWhereClause; | ||
| 72 | - $this->sLastOrderByClause = $sOrderByClause; | ||
| 73 | - | ||
| 74 | - $this->sQuery = "SELECT ID, "; | ||
| 75 | - | ||
| 76 | - for( $i = 0; $i < count($aColumns) - 1; $i++ ) { | ||
| 77 | - $this->sQuery = $this->sQuery . $aColumns[$i] . ","; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - $this->sQuery .= $aColumns[count($aColumns) - 1] . " "; | ||
| 81 | - $this->sQuery .= "FROM " . $sTableName . " "; | ||
| 82 | - | ||
| 83 | - if (isset($sWhereClause)) { | ||
| 84 | - $this->sQuery .= "WHERE " . $sWhereClause . " "; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - if (isset($sOrderByClause)) { | ||
| 88 | - $this->sQuery .= "ORDER BY " . $sOrderByClause . " "; | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - Create a query from the provided paramaters, specifying a limit and an offset. | ||
| 95 | - The ID column is selected by default | ||
| 96 | - | ||
| 97 | - @param $sTableName Table to query | ||
| 98 | - @param $aColumns Columns in table | ||
| 99 | - @param $iOffset Offset | ||
| 100 | - @param $iLimit Limit | ||
| 101 | - @param $sWhereClause Where clause (optional) | ||
| 102 | - @param $sOrderByClause Order by clause (optional) | ||
| 103 | - */ | ||
| 104 | - | ||
| 105 | - function createSQLQueryWithOffset($sTableName, $aColumns, $iOffset, $iLimit, $sWhereClause = null, $sOrderByClause = null) { | ||
| 106 | - $this->sLastTableName = $sTableName; | ||
| 107 | - $this->sLastWhereCluase = $sWhereClause; | ||
| 108 | - $this->sLastOrderByClause = $sOrderByClause; | ||
| 109 | - | ||
| 110 | - $this->sQuery = "SELECT ID, "; | ||
| 111 | - | ||
| 112 | - for( $i = 0; $i < count($aColumns) - 1; $i++ ) { | ||
| 113 | - $this->sQuery = $this->sQuery . $aColumns[$i] . ","; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - $this->sQuery .= $aColumns[count($aColumns) - 1] . " "; | ||
| 117 | - $this->sQuery .= "FROM " . $sTableName . " "; | ||
| 118 | - | ||
| 119 | - | ||
| 120 | - | ||
| 121 | - if (isset($sWhereClause)) { | ||
| 122 | - $this->sQuery .= "WHERE " . $sWhereClause . " "; | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - if (isset($sOrderByClause)) { | ||
| 126 | - $this->sQuery .= "ORDER BY " . $sOrderByClause . " "; | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | - $this->sQuery .= "LIMIT " . $iOffset . ", " . $iLimit; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - /** | ||
| 133 | - * Get the result count for the previously executed query. Meant | ||
| 134 | - * to be used in conjuction with createSSQLQueryWithOffset so that | ||
| 135 | - * the total number of results can be calculated | ||
| 136 | - * | ||
| 137 | - * @return int row count | ||
| 138 | - */ | ||
| 139 | - function & getLastQueryResultCount() { | ||
| 140 | - if (isset($this->sLastTableName)) { | ||
| 141 | - $sCountResultQuery = "SELECT COUNT(*) AS ResultCount FROM " . $this->sLastTableName; | ||
| 142 | - | ||
| 143 | - if (isset($this->sLastWhereClause)) { | ||
| 144 | - sCountResultQuery . " WHERE " . $this->sLastWhereClause; | ||
| 145 | - } | ||
| 146 | - $this->query($sCountResultQuery); | ||
| 147 | - $this->next_record(); | ||
| 148 | - return $this->f("ResultCount"); | ||
| 149 | - } else { | ||
| 150 | - return 0; | ||
| 151 | - } | ||
| 152 | - } | ||
| 153 | - | ||
| 154 | - /** | ||
| 155 | - * Execute the query and return the results | ||
| 156 | - * | ||
| 157 | - * @returns Results of query | ||
| 158 | - */ | ||
| 159 | - function & getQueryResults() { | ||
| 160 | - $result = null; | ||
| 161 | - if (isset($this->sQuery)) { | ||
| 162 | - $result = $this->query($this->sQuery); | ||
| 163 | - } | ||
| 164 | - return $result; | ||
| 165 | - } | ||
| 166 | - | 40 | + var $Password = ""; |
| 41 | + /** Query to execute */ | ||
| 42 | + var $sQuery; | ||
| 43 | + /** Name of table last query was executed on*/ | ||
| 44 | + var $sLastTableName; | ||
| 45 | + /** Where clause last used in query execution */ | ||
| 46 | + var $sLastWhereClause; | ||
| 47 | + /** Order by clause last used in query execution */ | ||
| 48 | + var $sLastOrderByClause; | ||
| 49 | + | ||
| 50 | + /** Default Constructor */ | ||
| 51 | + function Owl_DB() { | ||
| 52 | + global $default; | ||
| 53 | + $this->Host = $default->owl_db_host; | ||
| 54 | + $this->Database = $default->owl_db_name; | ||
| 55 | + $this->User = $default->owl_db_user; | ||
| 56 | + $this->Password = $default->owl_db_pass; | ||
| 57 | + } | ||
| 58 | + // END wes changes | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * Create a query from the provided paramaters. The ID column | ||
| 62 | + * is seleted by default | ||
| 63 | + * | ||
| 64 | + * @param $sTableName Table to query | ||
| 65 | + * @param $aColumns Columns in table | ||
| 66 | + * @param $sWhereClause Where clause (optional) | ||
| 67 | + * @param $sOrderByClause Order by clause (optional) | ||
| 68 | + */ | ||
| 69 | + function createSQLQuery($sTableName, $aColumns, $sWhereClause = null, $sOrderByClause = null) { | ||
| 70 | + $this->sLastTableName = $sTableName; | ||
| 71 | + $this->sLastWhereCluase = $sWhereClause; | ||
| 72 | + $this->sLastOrderByClause = $sOrderByClause; | ||
| 73 | + | ||
| 74 | + $this->sQuery = "SELECT ID, "; | ||
| 75 | + | ||
| 76 | + for( $i = 0; $i < count($aColumns) - 1; $i++ ) { | ||
| 77 | + $this->sQuery = $this->sQuery . $aColumns[$i] . ","; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + $this->sQuery .= $aColumns[count($aColumns) - 1] . " "; | ||
| 81 | + $this->sQuery .= "FROM " . $sTableName . " "; | ||
| 82 | + | ||
| 83 | + if (isset($sWhereClause)) { | ||
| 84 | + $this->sQuery .= "WHERE " . $sWhereClause . " "; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + if (isset($sOrderByClause)) { | ||
| 88 | + $this->sQuery .= "ORDER BY " . $sOrderByClause . " "; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + Create a query from the provided paramaters, specifying a limit and an offset. | ||
| 95 | + The ID column is selected by default | ||
| 96 | + | ||
| 97 | + @param $sTableName Table to query | ||
| 98 | + @param $aColumns Columns in table | ||
| 99 | + @param $iOffset Offset | ||
| 100 | + @param $iLimit Limit | ||
| 101 | + @param $sWhereClause Where clause (optional) | ||
| 102 | + @param $sOrderByClause Order by clause (optional) | ||
| 103 | + */ | ||
| 104 | + | ||
| 105 | + function createSQLQueryWithOffset($sTableName, $aColumns, $iOffset, $iLimit, $sWhereClause = null, $sOrderByClause = null) { | ||
| 106 | + $this->sLastTableName = $sTableName; | ||
| 107 | + $this->sLastWhereCluase = $sWhereClause; | ||
| 108 | + $this->sLastOrderByClause = $sOrderByClause; | ||
| 109 | + | ||
| 110 | + $this->sQuery = "SELECT ID, "; | ||
| 111 | + | ||
| 112 | + for( $i = 0; $i < count($aColumns) - 1; $i++ ) { | ||
| 113 | + $this->sQuery = $this->sQuery . $aColumns[$i] . ","; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + $this->sQuery .= $aColumns[count($aColumns) - 1] . " "; | ||
| 117 | + $this->sQuery .= "FROM " . $sTableName . " "; | ||
| 118 | + | ||
| 119 | + | ||
| 120 | + | ||
| 121 | + if (isset($sWhereClause)) { | ||
| 122 | + $this->sQuery .= "WHERE " . $sWhereClause . " "; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + if (isset($sOrderByClause)) { | ||
| 126 | + $this->sQuery .= "ORDER BY " . $sOrderByClause . " "; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + $this->sQuery .= "LIMIT " . $iOffset . ", " . $iLimit; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + /** | ||
| 133 | + * Get the result count for the previously executed query. Meant | ||
| 134 | + * to be used in conjuction with createSSQLQueryWithOffset so that | ||
| 135 | + * the total number of results can be calculated | ||
| 136 | + * | ||
| 137 | + * @return int row count | ||
| 138 | + */ | ||
| 139 | + function & getLastQueryResultCount() { | ||
| 140 | + if (isset($this->sLastTableName)) { | ||
| 141 | + $sCountResultQuery = "SELECT COUNT(*) AS ResultCount FROM " . $this->sLastTableName; | ||
| 142 | + | ||
| 143 | + if (isset($this->sLastWhereClause)) { | ||
| 144 | + sCountResultQuery . " WHERE " . $this->sLastWhereClause; | ||
| 145 | + } | ||
| 146 | + $this->query($sCountResultQuery); | ||
| 147 | + $this->next_record(); | ||
| 148 | + return $this->f("ResultCount"); | ||
| 149 | + } else { | ||
| 150 | + return 0; | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + /** | ||
| 155 | + * Execute the query and return the results | ||
| 156 | + * | ||
| 157 | + * @returns Results of query | ||
| 158 | + */ | ||
| 159 | + function & getQueryResults() { | ||
| 160 | + $result = null; | ||
| 161 | + if (isset($this->sQuery)) { | ||
| 162 | + $result = $this->query($this->sQuery); | ||
| 163 | + } | ||
| 164 | + return $result; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | /** | 167 | /** |
| 168 | * Display any database errors encountered | 168 | * Display any database errors encountered |
| 169 | */ | 169 | */ |
| 170 | function haltmsg($msg) { | 170 | function haltmsg($msg) { |
| 171 | - printf("</td></table><b>Database error:</b> %s<br>\n", $msg); | 171 | + printf("</td></table><b>Database error:</b> %s<br>\n", $msg); |
| 172 | printf("<b>SQL Error</b>: %s (%s)<br>\n",$this->Errno, $this->Error); | 172 | printf("<b>SQL Error</b>: %s (%s)<br>\n",$this->Errno, $this->Error); |
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| @@ -183,9 +183,9 @@ class Owl_DB extends DB_Sql { | @@ -183,9 +183,9 @@ class Owl_DB extends DB_Sql { | ||
| 183 | * @package Owl | 183 | * @package Owl |
| 184 | */ | 184 | */ |
| 185 | class Owl_Session { | 185 | class Owl_Session { |
| 186 | - var $sessid; | ||
| 187 | - var $sessuid; | ||
| 188 | - var $sessdata; | 186 | + var $sessid; |
| 187 | + var $sessuid; | ||
| 188 | + var $sessdata; | ||
| 189 | 189 | ||
| 190 | //------------------------------------------------------------ | 190 | //------------------------------------------------------------ |
| 191 | /** | 191 | /** |
| @@ -194,30 +194,30 @@ class Owl_Session { | @@ -194,30 +194,30 @@ class Owl_Session { | ||
| 194 | * Opens a session | 194 | * Opens a session |
| 195 | * | 195 | * |
| 196 | * @param $sessid | 196 | * @param $sessid |
| 197 | - * The Session id | 197 | + * The Session id |
| 198 | * @param ssessuid | 198 | * @param ssessuid |
| 199 | - * The user session id | 199 | + * The user session id |
| 200 | * @Return $this | 200 | * @Return $this |
| 201 | - * Return the session | 201 | + * Return the session |
| 202 | * | 202 | * |
| 203 | */ | 203 | */ |
| 204 | //------------------------------------------------------------ | 204 | //------------------------------------------------------------ |
| 205 | // Usable | 205 | // Usable |
| 206 | - function Open_Session($sessid=0, $sessuid=0) { | 206 | + function Open_Session($sessid=0, $sessuid=0) { |
| 207 | global $default; | 207 | global $default; |
| 208 | - $this->sessid = $sessid; | ||
| 209 | - $this->sessuid = $sessuid; | ||
| 210 | - | ||
| 211 | - // if there is no user loged in, then create a session for them | ||
| 212 | - if($sessid == "0") | ||
| 213 | - { | ||
| 214 | - $current = time(); | ||
| 215 | - $random = $this->sessuid . $current; | ||
| 216 | - $this->sessid = md5($random); | ||
| 217 | - $sql = new Owl_DB; | ||
| 218 | - | ||
| 219 | - if(getenv("HTTP_CLIENT_IP")) | ||
| 220 | - { | 208 | + $this->sessid = $sessid; |
| 209 | + $this->sessuid = $sessuid; | ||
| 210 | + | ||
| 211 | + // if there is no user loged in, then create a session for them | ||
| 212 | + if($sessid == "0") | ||
| 213 | + { | ||
| 214 | + $current = time(); | ||
| 215 | + $random = $this->sessuid . $current; | ||
| 216 | + $this->sessid = md5($random); | ||
| 217 | + $sql = new Owl_DB; | ||
| 218 | + | ||
| 219 | + if(getenv("HTTP_CLIENT_IP")) | ||
| 220 | + { | ||
| 221 | $ip = getenv("HTTP_CLIENT_IP"); | 221 | $ip = getenv("HTTP_CLIENT_IP"); |
| 222 | } | 222 | } |
| 223 | elseif(getenv("HTTP_X_FORWARDED_FOR")) | 223 | elseif(getenv("HTTP_X_FORWARDED_FOR")) |
| @@ -229,29 +229,29 @@ class Owl_Session { | @@ -229,29 +229,29 @@ class Owl_Session { | ||
| 229 | { | 229 | { |
| 230 | $ip = getenv("REMOTE_ADDR"); | 230 | $ip = getenv("REMOTE_ADDR"); |
| 231 | } | 231 | } |
| 232 | - //$result = $sql->query("insert into active_sessions values ('$this->sessid', '$this->sessuid', '$current', '$ip')"); | ||
| 233 | - $result = $sql->query("insert into $default->owl_sessions_table values ('$this->sessid', '$this->sessuid', '$current', '$ip')"); | ||
| 234 | - | ||
| 235 | - if(!'result') | ||
| 236 | - { | ||
| 237 | - die("$lang_err_sess_write"); | ||
| 238 | - } | ||
| 239 | - } | ||
| 240 | - | ||
| 241 | - // else we have a session id, try to validate it... | ||
| 242 | - $sql = new Owl_DB; | ||
| 243 | - $sql->query("select * from $default->owl_sessions_table where sessid = '$this->sessid'"); | ||
| 244 | - | ||
| 245 | - // any matching session ids? | ||
| 246 | - $numrows = $sql->num_rows($sql); | ||
| 247 | - if(!$numrows) die("$lang_err_sess_notvalid"); | ||
| 248 | - | ||
| 249 | - // return if we are a.o.k. | ||
| 250 | - while($sql->next_record()) { | ||
| 251 | - $this->sessdata["sessid"] = $sql->f("sessid"); | ||
| 252 | - } | ||
| 253 | - return $this; | ||
| 254 | - } | 232 | + //$result = $sql->query("insert into active_sessions values ('$this->sessid', '$this->sessuid', '$current', '$ip')"); |
| 233 | + $result = $sql->query("insert into $default->owl_sessions_table values ('$this->sessid', '$this->sessuid', '$current', '$ip')"); | ||
| 234 | + | ||
| 235 | + if(!'result') | ||
| 236 | + { | ||
| 237 | + die("$lang_err_sess_write"); | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + // else we have a session id, try to validate it... | ||
| 242 | + $sql = new Owl_DB; | ||
| 243 | + $sql->query("select * from $default->owl_sessions_table where sessid = '$this->sessid'"); | ||
| 244 | + | ||
| 245 | + // any matching session ids? | ||
| 246 | + $numrows = $sql->num_rows($sql); | ||
| 247 | + if(!$numrows) die("$lang_err_sess_notvalid"); | ||
| 248 | + | ||
| 249 | + // return if we are a.o.k. | ||
| 250 | + while($sql->next_record()) { | ||
| 251 | + $this->sessdata["sessid"] = $sql->f("sessid"); | ||
| 252 | + } | ||
| 253 | + return $this; | ||
| 254 | + } | ||
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | 257 | ||
| @@ -262,19 +262,19 @@ class Owl_Session { | @@ -262,19 +262,19 @@ class Owl_Session { | ||
| 262 | * Used to notify users | 262 | * Used to notify users |
| 263 | * | 263 | * |
| 264 | * @param $groupid | 264 | * @param $groupid |
| 265 | - * The Id of the group | 265 | + * The Id of the group |
| 266 | * @param $flag | 266 | * @param $flag |
| 267 | - * The relvant flag | 267 | + * The relvant flag |
| 268 | * @param $filename | 268 | * @param $filename |
| 269 | - * The relevant filename | 269 | + * The relevant filename |
| 270 | * @param $title | 270 | * @param $title |
| 271 | - * The relevant title | 271 | + * The relevant title |
| 272 | * @param $desc | 272 | * @param $desc |
| 273 | - * The description | 273 | + * The description |
| 274 | * @param $type | 274 | * @param $type |
| 275 | - * the Relevant type | 275 | + * the Relevant type |
| 276 | */ | 276 | */ |
| 277 | -//------------------------------------------------------------- | 277 | +//------------------------------------------------------------- |
| 278 | // Semi-Usable Some Interface based code | 278 | // Semi-Usable Some Interface based code |
| 279 | function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | 279 | function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) |
| 280 | { | 280 | { |
| @@ -285,9 +285,9 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | @@ -285,9 +285,9 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | ||
| 285 | // BEGIN BUG 548994 | 285 | // BEGIN BUG 548994 |
| 286 | // get the fileid | 286 | // get the fileid |
| 287 | $path = find_path($parent); | 287 | $path = find_path($parent); |
| 288 | - $sql->query("select id from $default->owl_files_table where filename='$filename' AND parent='$parent'"); | ||
| 289 | - $sql->next_record(); | ||
| 290 | - $fileid = $sql->f("id"); | 288 | + $sql->query("select id from $default->owl_files_table where filename='$filename' AND parent='$parent'"); |
| 289 | + $sql->next_record(); | ||
| 290 | + $fileid = $sql->f("id"); | ||
| 291 | // END BUG 548994 More Below | 291 | // END BUG 548994 More Below |
| 292 | $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)"); | 292 | $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)"); |
| 293 | 293 | ||
| @@ -295,112 +295,112 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | @@ -295,112 +295,112 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | ||
| 295 | while($sql->next_record()) | 295 | while($sql->next_record()) |
| 296 | { | 296 | { |
| 297 | // BEGIN BUG 548994 | 297 | // BEGIN BUG 548994 |
| 298 | - // check authentication rights | ||
| 299 | - if ( check_auth($fileid, "file_download", $sql->f(id)) == 1 ) | ||
| 300 | - { | 298 | + // check authentication rights |
| 299 | + if ( check_auth($fileid, "file_download", $sql->f(id)) == 1 ) | ||
| 300 | + { | ||
| 301 | // END BUG 548994 More Below | 301 | // END BUG 548994 More Below |
| 302 | - $newpath = ereg_replace(" ","%20",$path); | ||
| 303 | - $newfilename = ereg_replace(" ","%20",$filename); | ||
| 304 | - $DefUserLang = $sql->f("language"); | ||
| 305 | - require("$default->owl_fs_root/locale/$DefUserLang/language.inc"); | ||
| 306 | - | ||
| 307 | - $r=preg_split("(\;|\,)",$sql->f("email")); | ||
| 308 | - reset ($r); | ||
| 309 | - while (list ($occ, $email) = each ($r)) | ||
| 310 | - { | ||
| 311 | - $mail = new phpmailer(); | ||
| 312 | - // Create a temporary session id, the user | ||
| 313 | - // will need to get to this file before | ||
| 314 | - // the default session timeout | ||
| 315 | - $session = new Owl_Session; | ||
| 316 | - $uid = $session->Open_Session(0,$sql->f("id")); | 302 | + $newpath = ereg_replace(" ","%20",$path); |
| 303 | + $newfilename = ereg_replace(" ","%20",$filename); | ||
| 304 | + $DefUserLang = $sql->f("language"); | ||
| 305 | + require("$default->owl_fs_root/locale/$DefUserLang/language.inc"); | ||
| 306 | + | ||
| 307 | + $r=preg_split("(\;|\,)",$sql->f("email")); | ||
| 308 | + reset ($r); | ||
| 309 | + while (list ($occ, $email) = each ($r)) | ||
| 310 | + { | ||
| 311 | + $mail = new phpmailer(); | ||
| 312 | + // Create a temporary session id, the user | ||
| 313 | + // will need to get to this file before | ||
| 314 | + // the default session timeout | ||
| 315 | + $session = new Owl_Session; | ||
| 316 | + $uid = $session->Open_Session(0,$sql->f("id")); | ||
| 317 | $tempsess = $uid->sessdata["sessid"]; | 317 | $tempsess = $uid->sessdata["sessid"]; |
| 318 | - | ||
| 319 | - // if flag set to 0 | ||
| 320 | - if ( $flag == 0 ) { | ||
| 321 | - $mail->IsSMTP(); // set mailer to use SMTP | ||
| 322 | - $mail->Host = "$default->owl_email_server"; // specify main and backup server | ||
| 323 | - $mail->From = "$default->owl_email_from"; | ||
| 324 | - $mail->FromName = "$default->owl_email_fromname"; | ||
| 325 | - $mail->AddAddress($email); | ||
| 326 | - $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet"); | ||
| 327 | - $mail->WordWrap = 50; // set word wrap to 50 characters | ||
| 328 | - $mail->IsHTML(true); // set email format to HTML | ||
| 329 | - $mail->Subject = "$lang_notif_subject_new"; | ||
| 330 | - | ||
| 331 | - // as long as its not a url | ||
| 332 | - if ($type != "url") | ||
| 333 | - { | ||
| 334 | - // if attachfile is true | 318 | + |
| 319 | + // if flag set to 0 | ||
| 320 | + if ( $flag == 0 ) { | ||
| 321 | + $mail->IsSMTP(); // set mailer to use SMTP | ||
| 322 | + $mail->Host = "$default->owl_email_server"; // specify main and backup server | ||
| 323 | + $mail->From = "$default->owl_email_from"; | ||
| 324 | + $mail->FromName = "$default->owl_email_fromname"; | ||
| 325 | + $mail->AddAddress($email); | ||
| 326 | + $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet"); | ||
| 327 | + $mail->WordWrap = 50; // set word wrap to 50 characters | ||
| 328 | + $mail->IsHTML(true); // set email format to HTML | ||
| 329 | + $mail->Subject = "$lang_notif_subject_new"; | ||
| 330 | + | ||
| 331 | + // as long as its not a url | ||
| 332 | + if ($type != "url") | ||
| 333 | + { | ||
| 334 | + // if attachfile is true | ||
| 335 | if ($sql->f("attachfile") == 1) | 335 | if ($sql->f("attachfile") == 1) |
| 336 | { | 336 | { |
| 337 | $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; | 337 | $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; |
| 338 | - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; | ||
| 339 | - | ||
| 340 | - // use file system | ||
| 341 | - if (!$default->owl_use_fs) | ||
| 342 | - { | ||
| 343 | - //check if file exits | ||
| 344 | - if (file_exists("$default->owl_FileDir/$filename")) | ||
| 345 | - { | ||
| 346 | - unlink("$default->owl_FileDir/$filename"); | ||
| 347 | - } | ||
| 348 | - $file = fopen("$default->owl_FileDir$filename", 'wb'); | ||
| 349 | - $getfile = new Owl_DB; | ||
| 350 | - $getfile->query("select data,compressed from $default->owl_files_data_table where id='$fileid'"); | ||
| 351 | - while ($getfile->next_record()) | ||
| 352 | - { | ||
| 353 | - //check if compressed ..and uncompress it | ||
| 354 | - if ($getfile->f("compressed")) { | ||
| 355 | - | ||
| 356 | - $tmpfile = $default->owl_FileDir . "owltmp.$fileid.gz"; | ||
| 357 | - $uncomptmpfile = $default->owl_FileDir . "owltmp.$fileid"; | ||
| 358 | - if (file_exists($tmpfile)) unlink($tmpfile); | ||
| 359 | - | ||
| 360 | - $fp=fopen($tmpfile,"w"); | ||
| 361 | - fwrite($fp, $getfile->f("data")); | ||
| 362 | - fclose($fp); | ||
| 363 | - | ||
| 364 | - system($default->gzip_path . " -df $tmpfile"); | ||
| 365 | - | ||
| 366 | - $fsize = filesize($uncomptmpfile); | ||
| 367 | - $fd = fopen($uncomptmpfile, 'rb'); | ||
| 368 | - $filedata = fread($fd, $fsize); | ||
| 369 | - fclose($fd); | ||
| 370 | - | ||
| 371 | - fwrite($file, $filedata); | ||
| 372 | - unlink($uncomptmpfile); | ||
| 373 | - } | ||
| 374 | - else | ||
| 375 | - { // otherwise just write the file | ||
| 376 | - fwrite($file, $getfile->f("data")); | ||
| 377 | - } | ||
| 378 | - } | ||
| 379 | - fclose($file); | ||
| 380 | - // add a mail attachment | ||
| 381 | - $mail->AddAttachment("$default->owl_FileDir$newfilename"); | ||
| 382 | - } else | ||
| 383 | - { | ||
| 384 | - $mail->AddAttachment("$default->owl_FileDir/$newpath/$newfilename"); | ||
| 385 | - } | 338 | + $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 339 | + | ||
| 340 | + // use file system | ||
| 341 | + if (!$default->owl_use_fs) | ||
| 342 | + { | ||
| 343 | + //check if file exits | ||
| 344 | + if (file_exists("$default->owl_FileDir/$filename")) | ||
| 345 | + { | ||
| 346 | + unlink("$default->owl_FileDir/$filename"); | ||
| 347 | + } | ||
| 348 | + $file = fopen("$default->owl_FileDir$filename", 'wb'); | ||
| 349 | + $getfile = new Owl_DB; | ||
| 350 | + $getfile->query("select data,compressed from $default->owl_files_data_table where id='$fileid'"); | ||
| 351 | + while ($getfile->next_record()) | ||
| 352 | + { | ||
| 353 | + //check if compressed ..and uncompress it | ||
| 354 | + if ($getfile->f("compressed")) { | ||
| 355 | + | ||
| 356 | + $tmpfile = $default->owl_FileDir . "owltmp.$fileid.gz"; | ||
| 357 | + $uncomptmpfile = $default->owl_FileDir . "owltmp.$fileid"; | ||
| 358 | + if (file_exists($tmpfile)) unlink($tmpfile); | ||
| 359 | + | ||
| 360 | + $fp=fopen($tmpfile,"w"); | ||
| 361 | + fwrite($fp, $getfile->f("data")); | ||
| 362 | + fclose($fp); | ||
| 363 | + | ||
| 364 | + system($default->gzip_path . " -df $tmpfile"); | ||
| 365 | + | ||
| 366 | + $fsize = filesize($uncomptmpfile); | ||
| 367 | + $fd = fopen($uncomptmpfile, 'rb'); | ||
| 368 | + $filedata = fread($fd, $fsize); | ||
| 369 | + fclose($fd); | ||
| 370 | + | ||
| 371 | + fwrite($file, $filedata); | ||
| 372 | + unlink($uncomptmpfile); | ||
| 373 | + } | ||
| 374 | + else | ||
| 375 | + { // otherwise just write the file | ||
| 376 | + fwrite($file, $getfile->f("data")); | ||
| 377 | + } | ||
| 378 | + } | ||
| 379 | + fclose($file); | ||
| 380 | + // add a mail attachment | ||
| 381 | + $mail->AddAttachment("$default->owl_FileDir$newfilename"); | ||
| 382 | + } else | ||
| 383 | + { | ||
| 384 | + $mail->AddAttachment("$default->owl_FileDir/$newpath/$newfilename"); | ||
| 385 | + } | ||
| 386 | } | 386 | } |
| 387 | else | 387 | else |
| 388 | - { // set up mail body | 388 | + { // set up mail body |
| 389 | $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"; | 389 | $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"; |
| 390 | - $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; | 390 | + $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 391 | } | 391 | } |
| 392 | - } | ||
| 393 | - else | ||
| 394 | - { | ||
| 395 | - $mail->Body = "URL: $newfilename <BR><BR>$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; | ||
| 396 | - $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; | ||
| 397 | - } | ||
| 398 | - | ||
| 399 | - } | ||
| 400 | - else | ||
| 401 | - // set up mailer | ||
| 402 | - { | ||
| 403 | - $mail = new phpmailer(); | 392 | + } |
| 393 | + else | ||
| 394 | + { | ||
| 395 | + $mail->Body = "URL: $newfilename <BR><BR>$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; | ||
| 396 | + $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + } | ||
| 400 | + else | ||
| 401 | + // set up mailer | ||
| 402 | + { | ||
| 403 | + $mail = new phpmailer(); | ||
| 404 | $mail->IsSMTP(); // set mailer to use SMTP | 404 | $mail->IsSMTP(); // set mailer to use SMTP |
| 405 | $mail->Host = "$default->owl_email_server"; // specify main and backup server | 405 | $mail->Host = "$default->owl_email_server"; // specify main and backup server |
| 406 | $mail->From = "$default->owl_email_from"; | 406 | $mail->From = "$default->owl_email_from"; |
| @@ -409,19 +409,19 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | @@ -409,19 +409,19 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | ||
| 409 | $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet"); | 409 | $mail->AddReplyTo("$default->owl_email_replyto", "OWL Intranet"); |
| 410 | $mail->WordWrap = 50; // set word wrap to 50 characters | 410 | $mail->WordWrap = 50; // set word wrap to 50 characters |
| 411 | $mail->IsHTML(true); // set email format to HTML | 411 | $mail->IsHTML(true); // set email format to HTML |
| 412 | - $mail->Subject = "$lang_notif_subject_upd"; | 412 | + $mail->Subject = "$lang_notif_subject_upd"; |
| 413 | 413 | ||
| 414 | - // if type not a url | 414 | + // if type not a url |
| 415 | if ($type != "url") | 415 | if ($type != "url") |
| 416 | { | 416 | { |
| 417 | - // if attachfile is true..go through process of attaching file..simarly to previous | 417 | + // if attachfile is true..go through process of attaching file..simarly to previous |
| 418 | if ($sql->f("attachfile") == 1) | 418 | if ($sql->f("attachfile") == 1) |
| 419 | { | 419 | { |
| 420 | $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; | 420 | $mail->Body = "$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; |
| 421 | $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; | 421 | $mail->altBody = "$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 422 | - if (!$default->owl_use_fs) | ||
| 423 | - { | ||
| 424 | - // check existence of file | 422 | + if (!$default->owl_use_fs) |
| 423 | + { | ||
| 424 | + // check existence of file | ||
| 425 | if (file_exists("$default->owl_FileDir/$filename")) | 425 | if (file_exists("$default->owl_FileDir/$filename")) |
| 426 | { | 426 | { |
| 427 | unlink("$default->owl_FileDir/$filename"); | 427 | unlink("$default->owl_FileDir/$filename"); |
| @@ -480,18 +480,18 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | @@ -480,18 +480,18 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | ||
| 480 | $mail->Body = "URL: $newfilename <BR><BR>$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; | 480 | $mail->Body = "URL: $newfilename <BR><BR>$lang_notif_msg<BR><BR>" . "$lang_title: $title" . "<BR><BR>$lang_description: $desc"; |
| 481 | $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; | 481 | $mail->altBody = "URL: $newfilename \n\n$lang_notif_msg\n\n" . "$lang_title: $title" . "\n\n $lang_description: $desc"; |
| 482 | } | 482 | } |
| 483 | - } | ||
| 484 | - // send the email | ||
| 485 | - $mail->Send(); | ||
| 486 | - if (!$default->owl_use_fs && $sql->f("attachfile") == 1) | ||
| 487 | - { | ||
| 488 | - unlink("$default->owl_FileDir$newfilename"); | ||
| 489 | - } | ||
| 490 | - | 483 | + } |
| 484 | + // send the email | ||
| 485 | + $mail->Send(); | ||
| 486 | + if (!$default->owl_use_fs && $sql->f("attachfile") == 1) | ||
| 487 | + { | ||
| 488 | + unlink("$default->owl_FileDir$newfilename"); | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | } | 491 | } |
| 492 | } | 492 | } |
| 493 | // BEGIN BUG 548994 | 493 | // BEGIN BUG 548994 |
| 494 | - } | 494 | + } |
| 495 | // END BUG 548994 | 495 | // END BUG 548994 |
| 496 | } | 496 | } |
| 497 | 497 | ||
| @@ -502,29 +502,29 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | @@ -502,29 +502,29 @@ function notify_users($groupid, $flag, $parent, $filename, $title, $desc, $type) | ||
| 502 | * Used to verify a users login name and password | 502 | * Used to verify a users login name and password |
| 503 | * | 503 | * |
| 504 | * @param $username | 504 | * @param $username |
| 505 | - * The username to verfiy | 505 | + * The username to verfiy |
| 506 | * @param $password | 506 | * @param $password |
| 507 | - * The password to verify | 507 | + * The password to verify |
| 508 | */ | 508 | */ |
| 509 | //------------------------------------------------------------- | 509 | //------------------------------------------------------------- |
| 510 | // Usable | 510 | // Usable |
| 511 | function verify_login($username, $password) | 511 | function verify_login($username, $password) |
| 512 | { | 512 | { |
| 513 | - global $default; | ||
| 514 | - $sql = new Owl_DB; | ||
| 515 | - $query = "select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'"; | ||
| 516 | - $sql->query("select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'"); | ||
| 517 | - $numrows = $sql->num_rows($sql); | 513 | + global $default; |
| 514 | + $sql = new Owl_DB; | ||
| 515 | + $query = "select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'"; | ||
| 516 | + $sql->query("select * from $default->owl_users_table where username = '$username' and password = '" . md5($password) . "'"); | ||
| 517 | + $numrows = $sql->num_rows($sql); | ||
| 518 | // Bozz Begin added Password Encryption above, but for now | 518 | // Bozz Begin added Password Encryption above, but for now |
| 519 | // I will allow admin to use non crypted password untile he | 519 | // I will allow admin to use non crypted password untile he |
| 520 | // upgrades all users | 520 | // upgrades all users |
| 521 | - if ($numrows == "1") | ||
| 522 | - { | ||
| 523 | - while($sql->next_record()) { | 521 | + if ($numrows == "1") |
| 522 | + { | ||
| 523 | + while($sql->next_record()) { | ||
| 524 | if ( $sql->f("disabled") == 1 ) | 524 | if ( $sql->f("disabled") == 1 ) |
| 525 | - $verified["bit"] = 2; | 525 | + $verified["bit"] = 2; |
| 526 | else | 526 | else |
| 527 | - $verified["bit"] = 1; | 527 | + $verified["bit"] = 1; |
| 528 | $verified["user"] = $sql->f("username"); | 528 | $verified["user"] = $sql->f("username"); |
| 529 | $verified["uid"] = $sql->f("id"); | 529 | $verified["uid"] = $sql->f("id"); |
| 530 | $verified["group"] = $sql->f("groupid"); | 530 | $verified["group"] = $sql->f("groupid"); |
| @@ -533,10 +533,10 @@ function verify_login($username, $password) | @@ -533,10 +533,10 @@ function verify_login($username, $password) | ||
| 533 | } | 533 | } |
| 534 | // Remove this else in a future version | 534 | // Remove this else in a future version |
| 535 | else { | 535 | else { |
| 536 | - // username admin check password | 536 | + // username admin check password |
| 537 | if ($username == "admin") | 537 | if ($username == "admin") |
| 538 | { | 538 | { |
| 539 | - $sql->query("select * from $default->owl_users_table where username = '$username' and password = '$password'"); | 539 | + $sql->query("select * from $default->owl_users_table where username = '$username' and password = '$password'"); |
| 540 | $numrows = $sql->num_rows($sql); | 540 | $numrows = $sql->num_rows($sql); |
| 541 | if ($numrows == "1") | 541 | if ($numrows == "1") |
| 542 | { | 542 | { |
| @@ -564,13 +564,13 @@ function verify_login($username, $password) | @@ -564,13 +564,13 @@ function verify_login($username, $password) | ||
| 564 | $sql = new Owl_DB; | 564 | $sql = new Owl_DB; |
| 565 | $sql->query("select * from $default->owl_sessions_table where uid = '".$verified["uid"]."'"); | 565 | $sql->query("select * from $default->owl_sessions_table where uid = '".$verified["uid"]."'"); |
| 566 | 566 | ||
| 567 | - if ($sql->num_rows($sql) >= $maxsessions && $verified["bit"] != 0) { | 567 | + if ($sql->num_rows($sql) >= $maxsessions && $verified["bit"] != 0) { |
| 568 | if ( $verified["group"] == 0) | 568 | if ( $verified["group"] == 0) |
| 569 | - $verified["bit"] = 1; | 569 | + $verified["bit"] = 1; |
| 570 | else | 570 | else |
| 571 | - $verified["bit"] = 3; | ||
| 572 | - } | ||
| 573 | - return $verified; | 571 | + $verified["bit"] = 3; |
| 572 | + } | ||
| 573 | + return $verified; | ||
| 574 | } | 574 | } |
| 575 | 575 | ||
| 576 | //------------------------------------------------------------ | 576 | //------------------------------------------------------------ |
| @@ -580,82 +580,82 @@ function verify_login($username, $password) | @@ -580,82 +580,82 @@ function verify_login($username, $password) | ||
| 580 | * Used to verify a users session | 580 | * Used to verify a users session |
| 581 | * | 581 | * |
| 582 | * @param $username | 582 | * @param $username |
| 583 | - * The username to check | 583 | + * The username to check |
| 584 | * @param $password | 584 | * @param $password |
| 585 | - * The password to check | 585 | + * The password to check |
| 586 | */ | 586 | */ |
| 587 | //------------------------------------------------------------- | 587 | //------------------------------------------------------------- |
| 588 | // Usable | 588 | // Usable |
| 589 | 589 | ||
| 590 | function verify_session($sess) { | 590 | function verify_session($sess) { |
| 591 | getprefs(); | 591 | getprefs(); |
| 592 | - global $default, $lang_sesstimeout, $lang_sessinuse, $lang_clicklogin; | 592 | + global $default, $lang_sesstimeout, $lang_sessinuse, $lang_clicklogin; |
| 593 | $sess = ltrim($sess); | 593 | $sess = ltrim($sess); |
| 594 | - $verified["bit"] = 0; | ||
| 595 | - | ||
| 596 | - $sql = new Owl_DB; | 594 | + $verified["bit"] = 0; |
| 595 | + | ||
| 596 | + $sql = new Owl_DB; | ||
| 597 | $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'"); | 597 | $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'"); |
| 598 | - $numrows = $sql->num_rows($sql); | ||
| 599 | - $time = time(); | ||
| 600 | - | ||
| 601 | - if ($numrows == "1") | ||
| 602 | - { | ||
| 603 | - while($sql->next_record()) | ||
| 604 | - { | ||
| 605 | - if(getenv("HTTP_CLIENT_IP")) | ||
| 606 | - { | ||
| 607 | - $ip = getenv("HTTP_CLIENT_IP"); | ||
| 608 | - } | ||
| 609 | - elseif(getenv("HTTP_X_FORWARDED_FOR")) | ||
| 610 | - { | ||
| 611 | - $forwardedip = getenv("HTTP_X_FORWARDED_FOR"); | ||
| 612 | - list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip); | ||
| 613 | - } | ||
| 614 | - else | ||
| 615 | - { | ||
| 616 | - $ip = getenv("REMOTE_ADDR"); | ||
| 617 | - } | ||
| 618 | - if ($ip == $sql->f("ip")) | ||
| 619 | - { | ||
| 620 | - // if timeout not exceeded | ||
| 621 | - if(($time - $sql->f("lastused")) <= $default->owl_timeout) | ||
| 622 | - { | ||
| 623 | - $verified["bit"] = 1; | ||
| 624 | - $verified["userid"] = $sql->f("uid"); | ||
| 625 | - $sql->query("select * from $default->owl_users_table where id = '".$verified["userid"]."'"); | ||
| 626 | - while($sql->next_record()) $verified["groupid"] = $sql->f("groupid"); | ||
| 627 | - } | ||
| 628 | - else | ||
| 629 | - { | 598 | + $numrows = $sql->num_rows($sql); |
| 599 | + $time = time(); | ||
| 600 | + | ||
| 601 | + if ($numrows == "1") | ||
| 602 | + { | ||
| 603 | + while($sql->next_record()) | ||
| 604 | + { | ||
| 605 | + if(getenv("HTTP_CLIENT_IP")) | ||
| 606 | + { | ||
| 607 | + $ip = getenv("HTTP_CLIENT_IP"); | ||
| 608 | + } | ||
| 609 | + elseif(getenv("HTTP_X_FORWARDED_FOR")) | ||
| 610 | + { | ||
| 611 | + $forwardedip = getenv("HTTP_X_FORWARDED_FOR"); | ||
| 612 | + list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip); | ||
| 613 | + } | ||
| 614 | + else | ||
| 615 | + { | ||
| 616 | + $ip = getenv("REMOTE_ADDR"); | ||
| 617 | + } | ||
| 618 | + if ($ip == $sql->f("ip")) | ||
| 619 | + { | ||
| 620 | + // if timeout not exceeded | ||
| 621 | + if(($time - $sql->f("lastused")) <= $default->owl_timeout) | ||
| 622 | + { | ||
| 623 | + $verified["bit"] = 1; | ||
| 624 | + $verified["userid"] = $sql->f("uid"); | ||
| 625 | + $sql->query("select * from $default->owl_users_table where id = '".$verified["userid"]."'"); | ||
| 626 | + while($sql->next_record()) $verified["groupid"] = $sql->f("groupid"); | ||
| 627 | + } | ||
| 628 | + else | ||
| 629 | + { | ||
| 630 | // Bozz Bug Fix begin | 630 | // Bozz Bug Fix begin |
| 631 | if (file_exists("./lib/header.inc")) | 631 | if (file_exists("./lib/header.inc")) |
| 632 | { | 632 | { |
| 633 | - include("./lib/header.inc"); | 633 | + include("./lib/header.inc"); |
| 634 | } else { | 634 | } else { |
| 635 | include("../lib/header.inc"); | 635 | include("../lib/header.inc"); |
| 636 | } | 636 | } |
| 637 | // Bozz Buf Fix End | 637 | // Bozz Buf Fix End |
| 638 | - print("<BR><BR><CENTER>".$lang_sesstimeout); | 638 | + print("<BR><BR><CENTER>".$lang_sesstimeout); |
| 639 | if ($parent == "" || $fileid == "") | 639 | if ($parent == "" || $fileid == "") |
| 640 | - print("<A HREF='$default->owl_root_url/index.php'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>"); | 640 | + print("<A HREF='$default->owl_root_url/index.php'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>"); |
| 641 | else | 641 | else |
| 642 | - print("<A HREF='$default->owl_root_url/index.php?parent=$parent&fileid=$fileid'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>"); | ||
| 643 | - exit(); | ||
| 644 | - } | ||
| 645 | - } else { | 642 | + print("<A HREF='$default->owl_root_url/index.php?parent=$parent&fileid=$fileid'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>"); |
| 643 | + exit(); | ||
| 644 | + } | ||
| 645 | + } else { | ||
| 646 | // Bozz Bug Fix begin | 646 | // Bozz Bug Fix begin |
| 647 | if (file_exists("./lib/header.inc")) { | 647 | if (file_exists("./lib/header.inc")) { |
| 648 | - include("./lib/header.inc"); | 648 | + include("./lib/header.inc"); |
| 649 | } else { | 649 | } else { |
| 650 | include("../lib/header.inc"); | 650 | include("../lib/header.inc"); |
| 651 | } | 651 | } |
| 652 | // Bozz Bug Fix End | 652 | // Bozz Bug Fix End |
| 653 | - print("<BR><BR><CENTER>".$lang_sessinuse); | ||
| 654 | - exit; | ||
| 655 | - } | ||
| 656 | - } | ||
| 657 | - } | ||
| 658 | - return $verified; | 653 | + print("<BR><BR><CENTER>".$lang_sessinuse); |
| 654 | + exit; | ||
| 655 | + } | ||
| 656 | + } | ||
| 657 | + } | ||
| 658 | + return $verified; | ||
| 659 | } | 659 | } |
| 660 | 660 | ||
| 661 | //------------------------------------------------------------ | 661 | //------------------------------------------------------------ |
| @@ -665,21 +665,21 @@ function verify_session($sess) { | @@ -665,21 +665,21 @@ function verify_session($sess) { | ||
| 665 | * used to get the folder name | 665 | * used to get the folder name |
| 666 | * | 666 | * |
| 667 | * @param $parent | 667 | * @param $parent |
| 668 | - * The parent id | 668 | + * The parent id |
| 669 | * @Return $sql->f("name"); | 669 | * @Return $sql->f("name"); |
| 670 | - * Return the name of the folder | 670 | + * Return the name of the folder |
| 671 | */ | 671 | */ |
| 672 | //------------------------------------------------------------- | 672 | //------------------------------------------------------------- |
| 673 | // Usable | 673 | // Usable |
| 674 | function fid_to_name($parent) | 674 | function fid_to_name($parent) |
| 675 | { | 675 | { |
| 676 | - global $default; | ||
| 677 | - $sql = new Owl_DB; | 676 | + global $default; |
| 677 | + $sql = new Owl_DB; | ||
| 678 | $sql->query("select name from $default->owl_folders_table where id = $parent"); | 678 | $sql->query("select name from $default->owl_folders_table where id = $parent"); |
| 679 | - while($sql->next_record()) | ||
| 680 | - { | ||
| 681 | - return $sql->f("name"); | ||
| 682 | - } | 679 | + while($sql->next_record()) |
| 680 | + { | ||
| 681 | + return $sql->f("name"); | ||
| 682 | + } | ||
| 683 | } | 683 | } |
| 684 | 684 | ||
| 685 | //------------------------------------------------------------ | 685 | //------------------------------------------------------------ |
| @@ -689,21 +689,21 @@ function fid_to_name($parent) | @@ -689,21 +689,21 @@ function fid_to_name($parent) | ||
| 689 | * Gets the filename corresponding to the file id | 689 | * Gets the filename corresponding to the file id |
| 690 | * | 690 | * |
| 691 | * @param $id | 691 | * @param $id |
| 692 | - * The file id | 692 | + * The file id |
| 693 | * @Return $sql->f("name"); | 693 | * @Return $sql->f("name"); |
| 694 | - * Return the name of the file | 694 | + * Return the name of the file |
| 695 | */ | 695 | */ |
| 696 | //------------------------------------------------------------- | 696 | //------------------------------------------------------------- |
| 697 | // Usable | 697 | // Usable |
| 698 | function flid_to_name($id) | 698 | function flid_to_name($id) |
| 699 | { | 699 | { |
| 700 | - global $default; | ||
| 701 | - $sql = new Owl_DB; | 700 | + global $default; |
| 701 | + $sql = new Owl_DB; | ||
| 702 | $sql->query("select name from $default->owl_files_table where id = $id"); | 702 | $sql->query("select name from $default->owl_files_table where id = $id"); |
| 703 | - while($sql->next_record()) | ||
| 704 | - { | ||
| 705 | - return $sql->f("name"); | ||
| 706 | - } | 703 | + while($sql->next_record()) |
| 704 | + { | ||
| 705 | + return $sql->f("name"); | ||
| 706 | + } | ||
| 707 | } | 707 | } |
| 708 | 708 | ||
| 709 | //------------------------------------------------------------ | 709 | //------------------------------------------------------------ |
| @@ -713,20 +713,20 @@ function flid_to_name($id) | @@ -713,20 +713,20 @@ function flid_to_name($id) | ||
| 713 | * gets filename based on id | 713 | * gets filename based on id |
| 714 | * | 714 | * |
| 715 | * @param $id | 715 | * @param $id |
| 716 | - * file id | 716 | + * file id |
| 717 | * @Return $sql->f("name"); | 717 | * @Return $sql->f("name"); |
| 718 | - * Return the name of the file | 718 | + * Return the name of the file |
| 719 | */ | 719 | */ |
| 720 | //------------------------------------------------------------- | 720 | //------------------------------------------------------------- |
| 721 | // Usable | 721 | // Usable |
| 722 | function flid_to_filename($id) { | 722 | function flid_to_filename($id) { |
| 723 | - global $default; | ||
| 724 | - $sql = new Owl_DB; | 723 | + global $default; |
| 724 | + $sql = new Owl_DB; | ||
| 725 | $sql->query("select filename from $default->owl_files_table where id = $id"); | 725 | $sql->query("select filename from $default->owl_files_table where id = $id"); |
| 726 | - while($sql->next_record()) | ||
| 727 | - { | ||
| 728 | - return $sql->f("filename"); | ||
| 729 | - } | 726 | + while($sql->next_record()) |
| 727 | + { | ||
| 728 | + return $sql->f("filename"); | ||
| 729 | + } | ||
| 730 | } | 730 | } |
| 731 | //------------------------------------------------------------ | 731 | //------------------------------------------------------------ |
| 732 | /** | 732 | /** |
| @@ -735,22 +735,22 @@ function flid_to_filename($id) { | @@ -735,22 +735,22 @@ function flid_to_filename($id) { | ||
| 735 | * Gets the group id that the user blongs to | 735 | * Gets the group id that the user blongs to |
| 736 | * | 736 | * |
| 737 | * @param $userid | 737 | * @param $userid |
| 738 | - * The user id | 738 | + * The user id |
| 739 | * @Return $groupid | 739 | * @Return $groupid |
| 740 | - * Return the groupId | 740 | + * Return the groupId |
| 741 | */ | 741 | */ |
| 742 | //------------------------------------------------------------- | 742 | //------------------------------------------------------------- |
| 743 | // Usable | 743 | // Usable |
| 744 | function owlusergroup($userid) | 744 | function owlusergroup($userid) |
| 745 | { | 745 | { |
| 746 | - global $default; | ||
| 747 | - $sql = new Owl_DB; | 746 | + global $default; |
| 747 | + $sql = new Owl_DB; | ||
| 748 | $sql->query("select groupid from $default->owl_users_table where id = '$userid'"); | 748 | $sql->query("select groupid from $default->owl_users_table where id = '$userid'"); |
| 749 | - while($sql->next_record()) | ||
| 750 | - { | ||
| 751 | - $groupid = $sql->f("groupid"); | ||
| 752 | - return $groupid; | ||
| 753 | - } | 749 | + while($sql->next_record()) |
| 750 | + { | ||
| 751 | + $groupid = $sql->f("groupid"); | ||
| 752 | + return $groupid; | ||
| 753 | + } | ||
| 754 | } | 754 | } |
| 755 | //------------------------------------------------------------ | 755 | //------------------------------------------------------------ |
| 756 | /** | 756 | /** |
| @@ -759,21 +759,21 @@ function owlusergroup($userid) | @@ -759,21 +759,21 @@ function owlusergroup($userid) | ||
| 759 | * used to find the file creator | 759 | * used to find the file creator |
| 760 | * | 760 | * |
| 761 | * @param $fileid | 761 | * @param $fileid |
| 762 | - * The parent id | 762 | + * The parent id |
| 763 | * @return $filecreator | 763 | * @return $filecreator |
| 764 | - * Return the creatorid of the file | 764 | + * Return the creatorid of the file |
| 765 | */ | 765 | */ |
| 766 | //------------------------------------------------------------- | 766 | //------------------------------------------------------------- |
| 767 | // Usable | 767 | // Usable |
| 768 | function owlfilecreator($fileid) { | 768 | function owlfilecreator($fileid) { |
| 769 | - global $default; | ||
| 770 | - $sql = new Owl_DB; | 769 | + global $default; |
| 770 | + $sql = new Owl_DB; | ||
| 771 | $sql->query("select creatorid from ".$default->owl_files_table." where id = '$fileid'"); | 771 | $sql->query("select creatorid from ".$default->owl_files_table." where id = '$fileid'"); |
| 772 | - while($sql->next_record()) | ||
| 773 | - { | ||
| 774 | - $filecreator = $sql->f("creatorid"); | ||
| 775 | - return $filecreator; | ||
| 776 | - } | 772 | + while($sql->next_record()) |
| 773 | + { | ||
| 774 | + $filecreator = $sql->f("creatorid"); | ||
| 775 | + return $filecreator; | ||
| 776 | + } | ||
| 777 | } | 777 | } |
| 778 | //------------------------------------------------------------ | 778 | //------------------------------------------------------------ |
| 779 | /** | 779 | /** |
| @@ -782,22 +782,22 @@ function owlfilecreator($fileid) { | @@ -782,22 +782,22 @@ function owlfilecreator($fileid) { | ||
| 782 | * Used to get the folder creator | 782 | * Used to get the folder creator |
| 783 | * | 783 | * |
| 784 | * @param $fileid | 784 | * @param $fileid |
| 785 | - * The file id | 785 | + * The file id |
| 786 | * @Return $foldercreator | 786 | * @Return $foldercreator |
| 787 | - * Return the creatorid of the folder | 787 | + * Return the creatorid of the folder |
| 788 | */ | 788 | */ |
| 789 | //------------------------------------------------------------- | 789 | //------------------------------------------------------------- |
| 790 | // Usable | 790 | // Usable |
| 791 | function owlfoldercreator($folderid) | 791 | function owlfoldercreator($folderid) |
| 792 | { | 792 | { |
| 793 | - global $default; | ||
| 794 | - $sql = new Owl_DB; | 793 | + global $default; |
| 794 | + $sql = new Owl_DB; | ||
| 795 | $sql->query("select creatorid from ".$default->owl_folders_table." where id = '$folderid'"); | 795 | $sql->query("select creatorid from ".$default->owl_folders_table." where id = '$folderid'"); |
| 796 | - while($sql->next_record()) | ||
| 797 | - { | ||
| 798 | - $foldercreator = $sql->f("creatorid"); | ||
| 799 | - return $foldercreator; | ||
| 800 | - } | 796 | + while($sql->next_record()) |
| 797 | + { | ||
| 798 | + $foldercreator = $sql->f("creatorid"); | ||
| 799 | + return $foldercreator; | ||
| 800 | + } | ||
| 801 | } | 801 | } |
| 802 | //------------------------------------------------------------- | 802 | //------------------------------------------------------------- |
| 803 | /** | 803 | /** |
| @@ -806,23 +806,23 @@ function owlfoldercreator($folderid) | @@ -806,23 +806,23 @@ function owlfoldercreator($folderid) | ||
| 806 | * Used to get the file group id | 806 | * Used to get the file group id |
| 807 | * | 807 | * |
| 808 | * @param $fileid | 808 | * @param $fileid |
| 809 | - * The file id | 809 | + * The file id |
| 810 | * @Return $filegroup; | 810 | * @Return $filegroup; |
| 811 | - * Returns the group id of the file group | 811 | + * Returns the group id of the file group |
| 812 | */ | 812 | */ |
| 813 | //------------------------------------------------------------- | 813 | //------------------------------------------------------------- |
| 814 | // Usable | 814 | // Usable |
| 815 | function owlfilegroup($fileid) | 815 | function owlfilegroup($fileid) |
| 816 | { | 816 | { |
| 817 | - global $default; | ||
| 818 | - $sql = new Owl_DB; | 817 | + global $default; |
| 818 | + $sql = new Owl_DB; | ||
| 819 | $sql->query("select groupid from $default->owl_files_table where id = '$fileid'"); | 819 | $sql->query("select groupid from $default->owl_files_table where id = '$fileid'"); |
| 820 | - while($sql->next_record()) | ||
| 821 | - { | ||
| 822 | - $filegroup = $sql->f("groupid"); | ||
| 823 | - return $filegroup; | ||
| 824 | - } | ||
| 825 | - | 820 | + while($sql->next_record()) |
| 821 | + { | ||
| 822 | + $filegroup = $sql->f("groupid"); | ||
| 823 | + return $filegroup; | ||
| 824 | + } | ||
| 825 | + | ||
| 826 | } | 826 | } |
| 827 | //------------------------------------------------------------- | 827 | //------------------------------------------------------------- |
| 828 | /** | 828 | /** |
| @@ -831,22 +831,22 @@ function owlfilegroup($fileid) | @@ -831,22 +831,22 @@ function owlfilegroup($fileid) | ||
| 831 | * Used to get the folder group id | 831 | * Used to get the folder group id |
| 832 | * | 832 | * |
| 833 | * @param $folderid | 833 | * @param $folderid |
| 834 | - * The folder id | 834 | + * The folder id |
| 835 | * @Return $foldergroup; | 835 | * @Return $foldergroup; |
| 836 | - * Returns the group id of the folder group | 836 | + * Returns the group id of the folder group |
| 837 | */ | 837 | */ |
| 838 | //------------------------------------------------------------- | 838 | //------------------------------------------------------------- |
| 839 | // Usable | 839 | // Usable |
| 840 | function owlfoldergroup($folderid) { | 840 | function owlfoldergroup($folderid) { |
| 841 | - global $default; | ||
| 842 | - $sql = new Owl_DB; | 841 | + global $default; |
| 842 | + $sql = new Owl_DB; | ||
| 843 | $sql->query("select groupid from $default->owl_folders_table where id = '$folderid'"); | 843 | $sql->query("select groupid from $default->owl_folders_table where id = '$folderid'"); |
| 844 | - while($sql->next_record()) | ||
| 845 | - { | ||
| 846 | - $foldergroup = $sql->f("groupid"); | ||
| 847 | - return $foldergroup; | ||
| 848 | - } | ||
| 849 | - | 844 | + while($sql->next_record()) |
| 845 | + { | ||
| 846 | + $foldergroup = $sql->f("groupid"); | ||
| 847 | + return $foldergroup; | ||
| 848 | + } | ||
| 849 | + | ||
| 850 | } | 850 | } |
| 851 | //------------------------------------------------------------- | 851 | //------------------------------------------------------------- |
| 852 | /** | 852 | /** |
| @@ -855,23 +855,23 @@ function owlfoldergroup($folderid) { | @@ -855,23 +855,23 @@ function owlfoldergroup($folderid) { | ||
| 855 | * Used to get the folder parent | 855 | * Used to get the folder parent |
| 856 | * | 856 | * |
| 857 | * @param $folderid | 857 | * @param $folderid |
| 858 | - * The folder id | 858 | + * The folder id |
| 859 | * @Return $folderparent | 859 | * @Return $folderparent |
| 860 | - * Returns the folderparent of from the folder | 860 | + * Returns the folderparent of from the folder |
| 861 | */ | 861 | */ |
| 862 | //------------------------------------------------------------- | 862 | //------------------------------------------------------------- |
| 863 | // Usable | 863 | // Usable |
| 864 | function owlfolderparent($folderid) | 864 | function owlfolderparent($folderid) |
| 865 | { | 865 | { |
| 866 | - global $default; | ||
| 867 | - $sql = new Owl_DB; | 866 | + global $default; |
| 867 | + $sql = new Owl_DB; | ||
| 868 | $sql->query("select parent from $default->owl_folders_table where id = '$folderid'"); | 868 | $sql->query("select parent from $default->owl_folders_table where id = '$folderid'"); |
| 869 | - while($sql->next_record()) | ||
| 870 | - { | ||
| 871 | - $folderparent = $sql->f("parent"); | ||
| 872 | - return $folderparent; | ||
| 873 | - } | ||
| 874 | - | 869 | + while($sql->next_record()) |
| 870 | + { | ||
| 871 | + $folderparent = $sql->f("parent"); | ||
| 872 | + return $folderparent; | ||
| 873 | + } | ||
| 874 | + | ||
| 875 | } | 875 | } |
| 876 | //------------------------------------------------------------- | 876 | //------------------------------------------------------------- |
| 877 | /** | 877 | /** |
| @@ -880,22 +880,22 @@ function owlfolderparent($folderid) | @@ -880,22 +880,22 @@ function owlfolderparent($folderid) | ||
| 880 | * Used to get the file parent | 880 | * Used to get the file parent |
| 881 | * | 881 | * |
| 882 | * @param $fileid | 882 | * @param $fileid |
| 883 | - * The file id | 883 | + * The file id |
| 884 | * @Return $fileparent | 884 | * @Return $fileparent |
| 885 | - * Returns the file parent of from the files | 885 | + * Returns the file parent of from the files |
| 886 | */ | 886 | */ |
| 887 | //------------------------------------------------------------- | 887 | //------------------------------------------------------------- |
| 888 | // Usable | 888 | // Usable |
| 889 | function owlfileparent($fileid) | 889 | function owlfileparent($fileid) |
| 890 | { | 890 | { |
| 891 | - global $default; | ||
| 892 | - $sql = new Owl_DB; $sql->query("select parent from $default->owl_files_table where id = '$fileid'"); | ||
| 893 | - while($sql->next_record()) | ||
| 894 | - { | ||
| 895 | - $fileparent = $sql->f("parent"); | ||
| 896 | - | ||
| 897 | - return $fileparent; | ||
| 898 | - } | 891 | + global $default; |
| 892 | + $sql = new Owl_DB; $sql->query("select parent from $default->owl_files_table where id = '$fileid'"); | ||
| 893 | + while($sql->next_record()) | ||
| 894 | + { | ||
| 895 | + $fileparent = $sql->f("parent"); | ||
| 896 | + | ||
| 897 | + return $fileparent; | ||
| 898 | + } | ||
| 899 | } | 899 | } |
| 900 | //------------------------------------------------------------ | 900 | //------------------------------------------------------------ |
| 901 | /** | 901 | /** |
| @@ -904,26 +904,26 @@ function owlfileparent($fileid) | @@ -904,26 +904,26 @@ function owlfileparent($fileid) | ||
| 904 | * Used to get the creator of the files | 904 | * Used to get the creator of the files |
| 905 | * | 905 | * |
| 906 | * @param $id | 906 | * @param $id |
| 907 | - * The id | 907 | + * The id |
| 908 | * @Return $name; | 908 | * @Return $name; |
| 909 | - * Return the name of the creator | 909 | + * Return the name of the creator |
| 910 | */ | 910 | */ |
| 911 | //------------------------------------------------------------- | 911 | //------------------------------------------------------------- |
| 912 | // Usable | 912 | // Usable |
| 913 | function fid_to_creator($id) { | 913 | function fid_to_creator($id) { |
| 914 | 914 | ||
| 915 | - global $default; | ||
| 916 | - $sql = new Owl_DB; | ||
| 917 | - $sql->query("select creatorid from ".$default->owl_files_table." where id = '$id'"); | ||
| 918 | - $sql2 = new Owl_DB; | ||
| 919 | - while($sql->next_record()) | ||
| 920 | - { | ||
| 921 | - $creatorid = $sql->f("creatorid"); | ||
| 922 | - $sql2->query("select name from $default->owl_users_table where id = '".$creatorid."'"); | ||
| 923 | - $sql2->next_record(); | ||
| 924 | - $name = $sql2->f("name"); | ||
| 925 | - } | ||
| 926 | - return $name; | 915 | + global $default; |
| 916 | + $sql = new Owl_DB; | ||
| 917 | + $sql->query("select creatorid from ".$default->owl_files_table." where id = '$id'"); | ||
| 918 | + $sql2 = new Owl_DB; | ||
| 919 | + while($sql->next_record()) | ||
| 920 | + { | ||
| 921 | + $creatorid = $sql->f("creatorid"); | ||
| 922 | + $sql2->query("select name from $default->owl_users_table where id = '".$creatorid."'"); | ||
| 923 | + $sql2->next_record(); | ||
| 924 | + $name = $sql2->f("name"); | ||
| 925 | + } | ||
| 926 | + return $name; | ||
| 927 | } | 927 | } |
| 928 | //------------------------------------------------------------ | 928 | //------------------------------------------------------------ |
| 929 | /** | 929 | /** |
| @@ -932,21 +932,21 @@ function fid_to_creator($id) { | @@ -932,21 +932,21 @@ function fid_to_creator($id) { | ||
| 932 | * select name from the group | 932 | * select name from the group |
| 933 | * | 933 | * |
| 934 | * @param $id | 934 | * @param $id |
| 935 | - * The id | 935 | + * The id |
| 936 | * @Return $sql->f("name"); | 936 | * @Return $sql->f("name"); |
| 937 | - * Return the name of the group | 937 | + * Return the name of the group |
| 938 | */ | 938 | */ |
| 939 | //------------------------------------------------------------- | 939 | //------------------------------------------------------------- |
| 940 | // Usable | 940 | // Usable |
| 941 | function group_to_name($id) | 941 | function group_to_name($id) |
| 942 | { | 942 | { |
| 943 | - global $default; | ||
| 944 | - $sql = new Owl_DB; | ||
| 945 | - $sql->query("select name from $default->owl_groups_table where id = '$id'"); | ||
| 946 | - while($sql->next_record()) | ||
| 947 | - { | ||
| 948 | - return $sql->f("name"); | ||
| 949 | - } | 943 | + global $default; |
| 944 | + $sql = new Owl_DB; | ||
| 945 | + $sql->query("select name from $default->owl_groups_table where id = '$id'"); | ||
| 946 | + while($sql->next_record()) | ||
| 947 | + { | ||
| 948 | + return $sql->f("name"); | ||
| 949 | + } | ||
| 950 | } | 950 | } |
| 951 | //------------------------------------------------------------ | 951 | //------------------------------------------------------------ |
| 952 | /** | 952 | /** |
| @@ -955,26 +955,26 @@ function group_to_name($id) | @@ -955,26 +955,26 @@ function group_to_name($id) | ||
| 955 | * name from the users | 955 | * name from the users |
| 956 | * | 956 | * |
| 957 | * @param $id | 957 | * @param $id |
| 958 | - * The id | 958 | + * The id |
| 959 | * @Return $name | 959 | * @Return $name |
| 960 | - * Return the name of the user | 960 | + * Return the name of the user |
| 961 | */ | 961 | */ |
| 962 | //------------------------------------------------------------- | 962 | //------------------------------------------------------------- |
| 963 | // Usable | 963 | // Usable |
| 964 | function uid_to_name($id) | 964 | function uid_to_name($id) |
| 965 | { | 965 | { |
| 966 | - global $default; | ||
| 967 | - $sql = new Owl_DB; | ||
| 968 | - $sql->query("select name from $default->owl_users_table where id = '$id'"); | ||
| 969 | - while($sql->next_record()) | ||
| 970 | - { | ||
| 971 | - $name = $sql->f("name"); | ||
| 972 | - if ($name == "") | ||
| 973 | - { | ||
| 974 | - $name = "Owl"; | ||
| 975 | - } | ||
| 976 | - return $name; | ||
| 977 | - } | 966 | + global $default; |
| 967 | + $sql = new Owl_DB; | ||
| 968 | + $sql->query("select name from $default->owl_users_table where id = '$id'"); | ||
| 969 | + while($sql->next_record()) | ||
| 970 | + { | ||
| 971 | + $name = $sql->f("name"); | ||
| 972 | + if ($name == "") | ||
| 973 | + { | ||
| 974 | + $name = "Owl"; | ||
| 975 | + } | ||
| 976 | + return $name; | ||
| 977 | + } | ||
| 978 | } | 978 | } |
| 979 | //------------------------------------------------------------ | 979 | //------------------------------------------------------------ |
| 980 | /** | 980 | /** |
| @@ -983,22 +983,22 @@ function uid_to_name($id) | @@ -983,22 +983,22 @@ function uid_to_name($id) | ||
| 983 | * get the noprefaccess from the users to compare if access granted | 983 | * get the noprefaccess from the users to compare if access granted |
| 984 | * | 984 | * |
| 985 | * @param $id | 985 | * @param $id |
| 986 | - * The id | 986 | + * The id |
| 987 | * @Return prefaccess; | 987 | * @Return prefaccess; |
| 988 | - * Return the name of the folder | 988 | + * Return the name of the folder |
| 989 | */ | 989 | */ |
| 990 | //------------------------------------------------------------- | 990 | //------------------------------------------------------------- |
| 991 | // Usable | 991 | // Usable |
| 992 | 992 | ||
| 993 | function prefaccess($id) { | 993 | function prefaccess($id) { |
| 994 | - global $default; | ||
| 995 | - $prefaccess = 1; | ||
| 996 | - $sql = new Owl_DB; $sql->query("select noprefaccess from $default->owl_users_table where id = '$id'"); | ||
| 997 | - while($sql->next_record()) | ||
| 998 | - { | ||
| 999 | - $prefaccess = !($sql->f("noprefaccess")); | ||
| 1000 | - return $prefaccess; | ||
| 1001 | - } | 994 | + global $default; |
| 995 | + $prefaccess = 1; | ||
| 996 | + $sql = new Owl_DB; $sql->query("select noprefaccess from $default->owl_users_table where id = '$id'"); | ||
| 997 | + while($sql->next_record()) | ||
| 998 | + { | ||
| 999 | + $prefaccess = !($sql->f("noprefaccess")); | ||
| 1000 | + return $prefaccess; | ||
| 1001 | + } | ||
| 1002 | } | 1002 | } |
| 1003 | //------------------------------------------------------------ | 1003 | //------------------------------------------------------------ |
| 1004 | /** | 1004 | /** |
| @@ -1007,28 +1007,28 @@ function prefaccess($id) { | @@ -1007,28 +1007,28 @@ function prefaccess($id) { | ||
| 1007 | * Used to generate a nav bar | 1007 | * Used to generate a nav bar |
| 1008 | * | 1008 | * |
| 1009 | * @param $parent | 1009 | * @param $parent |
| 1010 | - * The parent id | 1010 | + * The parent id |
| 1011 | * @Return $Navbar | 1011 | * @Return $Navbar |
| 1012 | - * Return the navbar that has been generated | 1012 | + * Return the navbar that has been generated |
| 1013 | */ | 1013 | */ |
| 1014 | //------------------------------------------------------------- | 1014 | //------------------------------------------------------------- |
| 1015 | // NOT Usable -> Interface based | 1015 | // NOT Usable -> Interface based |
| 1016 | function gen_navbar($parent) | 1016 | function gen_navbar($parent) |
| 1017 | { | 1017 | { |
| 1018 | - global $default; | ||
| 1019 | - global $sess, $expand, $sort, $sortorder, $order; | ||
| 1020 | - $name = fid_to_name($parent); | ||
| 1021 | - $navbar = "<A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sort'>$name</A>"; | ||
| 1022 | - $new = $parent; | ||
| 1023 | - while ($new != "1") | ||
| 1024 | - { | ||
| 1025 | - $sql = new Owl_DB; $sql->query("select parent from $default->owl_folders_table where id = '$new'"); | ||
| 1026 | - while($sql->next_record()) $newparentid = $sql->f("parent"); | ||
| 1027 | - $name = fid_to_name($newparentid); | ||
| 1028 | - $navbar = "<A HREF='browse.php?sess=$sess&parent=$newparentid&expand=$expand&order=$order&$sortorder=$sort'>$name</A>/" . $navbar; | ||
| 1029 | - $new = $newparentid; | ||
| 1030 | - } | ||
| 1031 | - return $navbar; | 1018 | + global $default; |
| 1019 | + global $sess, $expand, $sort, $sortorder, $order; | ||
| 1020 | + $name = fid_to_name($parent); | ||
| 1021 | + $navbar = "<A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sort'>$name</A>"; | ||
| 1022 | + $new = $parent; | ||
| 1023 | + while ($new != "1") | ||
| 1024 | + { | ||
| 1025 | + $sql = new Owl_DB; $sql->query("select parent from $default->owl_folders_table where id = '$new'"); | ||
| 1026 | + while($sql->next_record()) $newparentid = $sql->f("parent"); | ||
| 1027 | + $name = fid_to_name($newparentid); | ||
| 1028 | + $navbar = "<A HREF='browse.php?sess=$sess&parent=$newparentid&expand=$expand&order=$order&$sortorder=$sort'>$name</A>/" . $navbar; | ||
| 1029 | + $new = $newparentid; | ||
| 1030 | + } | ||
| 1031 | + return $navbar; | ||
| 1032 | } | 1032 | } |
| 1033 | //------------------------------------------------------------ | 1033 | //------------------------------------------------------------ |
| 1034 | /** | 1034 | /** |
| @@ -1037,9 +1037,9 @@ function gen_navbar($parent) | @@ -1037,9 +1037,9 @@ function gen_navbar($parent) | ||
| 1037 | * Get the directory path from the db | 1037 | * Get the directory path from the db |
| 1038 | * | 1038 | * |
| 1039 | * @param $parent | 1039 | * @param $parent |
| 1040 | - * The parent id | 1040 | + * The parent id |
| 1041 | * @Return $Navbar; | 1041 | * @Return $Navbar; |
| 1042 | - * Return the navbar with directory path | 1042 | + * Return the navbar with directory path |
| 1043 | */ | 1043 | */ |
| 1044 | //------------------------------------------------------------- | 1044 | //------------------------------------------------------------- |
| 1045 | // NOT Usable if used in ocnjunction with navbar | 1045 | // NOT Usable if used in ocnjunction with navbar |
| @@ -1067,22 +1067,22 @@ function get_dirpath($parent) { | @@ -1067,22 +1067,22 @@ function get_dirpath($parent) { | ||
| 1067 | * generates the file size | 1067 | * generates the file size |
| 1068 | * | 1068 | * |
| 1069 | * @param $filesize | 1069 | * @param $filesize |
| 1070 | - * The size of the file | 1070 | + * The size of the file |
| 1071 | * @Return $file_size; | 1071 | * @Return $file_size; |
| 1072 | - * Return the rounded off file size | 1072 | + * Return the rounded off file size |
| 1073 | */ | 1073 | */ |
| 1074 | //------------------------------------------------------------- | 1074 | //------------------------------------------------------------- |
| 1075 | // Usable | 1075 | // Usable |
| 1076 | function gen_filesize($file_size) | 1076 | function gen_filesize($file_size) |
| 1077 | { | 1077 | { |
| 1078 | - if(ereg("[^0-9]", $file_size)) | ||
| 1079 | - { | ||
| 1080 | - return $file_size; | ||
| 1081 | - } | ||
| 1082 | - | ||
| 1083 | - if ($file_size >= 1073741824) | ||
| 1084 | - { | ||
| 1085 | - $file_size = round($file_size / 1073741824 * 100) / 100 . "g"; | 1078 | + if(ereg("[^0-9]", $file_size)) |
| 1079 | + { | ||
| 1080 | + return $file_size; | ||
| 1081 | + } | ||
| 1082 | + | ||
| 1083 | + if ($file_size >= 1073741824) | ||
| 1084 | + { | ||
| 1085 | + $file_size = round($file_size / 1073741824 * 100) / 100 . "g"; | ||
| 1086 | } | 1086 | } |
| 1087 | elseif ($file_size >= 1048576) | 1087 | elseif ($file_size >= 1048576) |
| 1088 | { | 1088 | { |
| @@ -1096,7 +1096,7 @@ function gen_filesize($file_size) | @@ -1096,7 +1096,7 @@ function gen_filesize($file_size) | ||
| 1096 | { | 1096 | { |
| 1097 | $file_size = $file_size . "b"; | 1097 | $file_size = $file_size . "b"; |
| 1098 | } | 1098 | } |
| 1099 | - return $file_size; | 1099 | + return $file_size; |
| 1100 | } | 1100 | } |
| 1101 | //------------------------------------------------------------ | 1101 | //------------------------------------------------------------ |
| 1102 | /** | 1102 | /** |
| @@ -1105,9 +1105,9 @@ function gen_filesize($file_size) | @@ -1105,9 +1105,9 @@ function gen_filesize($file_size) | ||
| 1105 | * used to upload | 1105 | * used to upload |
| 1106 | * | 1106 | * |
| 1107 | * @param $varname | 1107 | * @param $varname |
| 1108 | - * The parent id | 1108 | + * The parent id |
| 1109 | * @Return $sql->f("name"); | 1109 | * @Return $sql->f("name"); |
| 1110 | - * Return the name of the folder | 1110 | + * Return the name of the folder |
| 1111 | */ | 1111 | */ |
| 1112 | //------------------------------------------------------------- | 1112 | //------------------------------------------------------------- |
| 1113 | // Usable | 1113 | // Usable |
| @@ -1130,7 +1130,7 @@ function uploadCompat($varname) { | @@ -1130,7 +1130,7 @@ function uploadCompat($varname) { | ||
| 1130 | * Used to check requirments | 1130 | * Used to check requirments |
| 1131 | * | 1131 | * |
| 1132 | * @Return 1 | 1132 | * @Return 1 |
| 1133 | - * Returns 1 | 1133 | + * Returns 1 |
| 1134 | */ | 1134 | */ |
| 1135 | //------------------------------------------------------------- | 1135 | //------------------------------------------------------------- |
| 1136 | // Usable | 1136 | // Usable |
| @@ -1159,32 +1159,32 @@ function checkrequirements() | @@ -1159,32 +1159,32 @@ function checkrequirements() | ||
| 1159 | * | 1159 | * |
| 1160 | * | 1160 | * |
| 1161 | * @param $cmd | 1161 | * @param $cmd |
| 1162 | - * The command | 1162 | + * The command |
| 1163 | * @param $lines | 1163 | * @param $lines |
| 1164 | * | 1164 | * |
| 1165 | * @param $errco | 1165 | * @param $errco |
| 1166 | - * The error code | 1166 | + * The error code |
| 1167 | * @Return ""; | 1167 | * @Return ""; |
| 1168 | - * Return empty string | 1168 | + * Return empty string |
| 1169 | * @Return $lines[count($lines)-1] | 1169 | * @Return $lines[count($lines)-1] |
| 1170 | - * Returns numba of lines | 1170 | + * Returns numba of lines |
| 1171 | */ | 1171 | */ |
| 1172 | //------------------------------------------------------------- | 1172 | //------------------------------------------------------------- |
| 1173 | // Usable | 1173 | // Usable |
| 1174 | function myExec($_cmd, &$lines, &$errco) | 1174 | function myExec($_cmd, &$lines, &$errco) |
| 1175 | { | 1175 | { |
| 1176 | - $cmd = "$_cmd ; echo $?"; | ||
| 1177 | - exec($cmd, $lines); | ||
| 1178 | - // Get rid of the last errco line... | ||
| 1179 | - $errco = (integer) array_pop($lines); | ||
| 1180 | - if (count($lines) == 0) | ||
| 1181 | - { | ||
| 1182 | - return ""; | ||
| 1183 | - } | ||
| 1184 | - else | ||
| 1185 | - { | ||
| 1186 | - return $lines[count($lines) - 1]; | ||
| 1187 | - } | 1176 | + $cmd = "$_cmd ; echo $?"; |
| 1177 | + exec($cmd, $lines); | ||
| 1178 | + // Get rid of the last errco line... | ||
| 1179 | + $errco = (integer) array_pop($lines); | ||
| 1180 | + if (count($lines) == 0) | ||
| 1181 | + { | ||
| 1182 | + return ""; | ||
| 1183 | + } | ||
| 1184 | + else | ||
| 1185 | + { | ||
| 1186 | + return $lines[count($lines) - 1]; | ||
| 1187 | + } | ||
| 1188 | } | 1188 | } |
| 1189 | //------------------------------------------------------------ | 1189 | //------------------------------------------------------------ |
| 1190 | /** | 1190 | /** |
| @@ -1193,32 +1193,32 @@ function myExec($_cmd, &$lines, &$errco) | @@ -1193,32 +1193,32 @@ function myExec($_cmd, &$lines, &$errco) | ||
| 1193 | * used to delete a file if it exists | 1193 | * used to delete a file if it exists |
| 1194 | * | 1194 | * |
| 1195 | * @param $file | 1195 | * @param $file |
| 1196 | - * The file to be deleted | 1196 | + * The file to be deleted |
| 1197 | */ | 1197 | */ |
| 1198 | //------------------------------------------------------------- | 1198 | //------------------------------------------------------------- |
| 1199 | // Usable | 1199 | // Usable |
| 1200 | function myDelete($file) { | 1200 | function myDelete($file) { |
| 1201 | - if (file_exists($file)) | ||
| 1202 | - { | ||
| 1203 | - chmod($file,0777); | ||
| 1204 | - if (is_dir($file)) | ||
| 1205 | - { | ||
| 1206 | - $handle = opendir($file); | ||
| 1207 | - while($filename = readdir($handle)) | ||
| 1208 | - { | ||
| 1209 | - if ($filename != "." && $filename != "..") | ||
| 1210 | - { | ||
| 1211 | - myDelete($file."/".$filename); | ||
| 1212 | - } | ||
| 1213 | - } | ||
| 1214 | - closedir($handle); | ||
| 1215 | - rmdir($file); | ||
| 1216 | - } | ||
| 1217 | - else | ||
| 1218 | - { | ||
| 1219 | - unlink($file); | ||
| 1220 | - } | ||
| 1221 | - } | 1201 | + if (file_exists($file)) |
| 1202 | + { | ||
| 1203 | + chmod($file,0777); | ||
| 1204 | + if (is_dir($file)) | ||
| 1205 | + { | ||
| 1206 | + $handle = opendir($file); | ||
| 1207 | + while($filename = readdir($handle)) | ||
| 1208 | + { | ||
| 1209 | + if ($filename != "." && $filename != "..") | ||
| 1210 | + { | ||
| 1211 | + myDelete($file."/".$filename); | ||
| 1212 | + } | ||
| 1213 | + } | ||
| 1214 | + closedir($handle); | ||
| 1215 | + rmdir($file); | ||
| 1216 | + } | ||
| 1217 | + else | ||
| 1218 | + { | ||
| 1219 | + unlink($file); | ||
| 1220 | + } | ||
| 1221 | + } | ||
| 1222 | } | 1222 | } |
| 1223 | //------------------------------------------------------------ | 1223 | //------------------------------------------------------------ |
| 1224 | /** | 1224 | /** |
| @@ -1227,41 +1227,41 @@ function myDelete($file) { | @@ -1227,41 +1227,41 @@ function myDelete($file) { | ||
| 1227 | * Prints out error messages | 1227 | * Prints out error messages |
| 1228 | * | 1228 | * |
| 1229 | * @param $message | 1229 | * @param $message |
| 1230 | - * The message | 1230 | + * The message |
| 1231 | * @param $submessage | 1231 | * @param $submessage |
| 1232 | - * The submessage | 1232 | + * The submessage |
| 1233 | */ | 1233 | */ |
| 1234 | //------------------------------------------------------------- | 1234 | //------------------------------------------------------------- |
| 1235 | // Not Usable -> INTERFACE Based | 1235 | // Not Usable -> INTERFACE Based |
| 1236 | function printError($message, $submessage) { | 1236 | function printError($message, $submessage) { |
| 1237 | - global $default; | 1237 | + global $default; |
| 1238 | global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid; | 1238 | global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid; |
| 1239 | global $language; | 1239 | global $language; |
| 1240 | 1240 | ||
| 1241 | - require("$default->owl_fs_root/locale/$default->owl_lang/language.inc"); | ||
| 1242 | - include("./lib/header.inc"); | 1241 | + require("$default->owl_fs_root/locale/$default->owl_lang/language.inc"); |
| 1242 | + include("./lib/header.inc"); | ||
| 1243 | 1243 | ||
| 1244 | - if(check_auth($parent, "folder_view", $userid) != "1") { | ||
| 1245 | - $sql = new Owl_DB; | 1244 | + if(check_auth($parent, "folder_view", $userid) != "1") { |
| 1245 | + $sql = new Owl_DB; | ||
| 1246 | $sql->query("select * from $default->owl_folders_table where id = '$parent'"); | 1246 | $sql->query("select * from $default->owl_folders_table where id = '$parent'"); |
| 1247 | $sql->next_record(); | 1247 | $sql->next_record(); |
| 1248 | $parent = $sql->f("parent"); | 1248 | $parent = $sql->f("parent"); |
| 1249 | - } | ||
| 1250 | - | ||
| 1251 | - echo("<TABLE WIDTH=$default->table_expand_width BGCOLOR=\"#d0d0d0\" CELLSPACING=0 CELLPADDING=0 BORDER=0 HEIGHT=30>"); | ||
| 1252 | - echo("<TR><TD ALIGN=LEFT>"); | ||
| 1253 | - print("$lang_user: "); | ||
| 1254 | - print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&sortname=$sortname'>"); | ||
| 1255 | - print uid_to_name($userid); | ||
| 1256 | - print ("</A><FONT SIZE=-1>"); | ||
| 1257 | - print("<A HREF='index.php?login=logout&sess=$sess'> $lang_logout</A>"); | ||
| 1258 | - print("</FONT></TD>"); | ||
| 1259 | - print("<TD ALIGN=RIGHT><A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname'><IMG SRC='$default->owl_root_url/locale/$language/graphics/btn_browse.gif' BORDER=0></A>"); | ||
| 1260 | - print("</TD></TR></TABLE><BR><BR><CENTER>"); | ||
| 1261 | - print $message; | 1249 | + } |
| 1250 | + | ||
| 1251 | + echo("<TABLE WIDTH=$default->table_expand_width BGCOLOR=\"#d0d0d0\" CELLSPACING=0 CELLPADDING=0 BORDER=0 HEIGHT=30>"); | ||
| 1252 | + echo("<TR><TD ALIGN=LEFT>"); | ||
| 1253 | + print("$lang_user: "); | ||
| 1254 | + print("<A HREF='prefs.php?owluser=$userid&sess=$sess&expand=$expand&order=$order&sortname=$sortname'>"); | ||
| 1255 | + print uid_to_name($userid); | ||
| 1256 | + print ("</A><FONT SIZE=-1>"); | ||
| 1257 | + print("<A HREF='index.php?login=logout&sess=$sess'> $lang_logout</A>"); | ||
| 1258 | + print("</FONT></TD>"); | ||
| 1259 | + print("<TD ALIGN=RIGHT><A HREF='browse.php?sess=$sess&parent=$parent&expand=$expand&order=$order&$sortorder=$sortname'><IMG SRC='$default->owl_root_url/locale/$language/graphics/btn_browse.gif' BORDER=0></A>"); | ||
| 1260 | + print("</TD></TR></TABLE><BR><BR><CENTER>"); | ||
| 1261 | + print $message; | ||
| 1262 | print("<BR>"); | 1262 | print("<BR>"); |
| 1263 | - print $submessage; | ||
| 1264 | - include("./lib/footer.inc"); | 1263 | + print $submessage; |
| 1264 | + include("./lib/footer.inc"); | ||
| 1265 | exit(); | 1265 | exit(); |
| 1266 | } | 1266 | } |
| 1267 | //------------------------------------------------------------ | 1267 | //------------------------------------------------------------ |
| @@ -1275,34 +1275,34 @@ function printError($message, $submessage) { | @@ -1275,34 +1275,34 @@ function printError($message, $submessage) { | ||
| 1275 | // Usable | 1275 | // Usable |
| 1276 | function getprefs ( ) | 1276 | function getprefs ( ) |
| 1277 | { | 1277 | { |
| 1278 | - global $default; | ||
| 1279 | - | ||
| 1280 | - $sql = new Owl_DB; | ||
| 1281 | - //$sql->query("select * from $default->owl_prefs_table"); | ||
| 1282 | - $sql->query("select * from prefs"); | ||
| 1283 | - $sql->next_record(); | ||
| 1284 | - | ||
| 1285 | - $default->owl_email_from = $sql->f("email_from"); | ||
| 1286 | - $default->owl_email_fromname = $sql->f("email_fromname"); | ||
| 1287 | - $default->owl_email_replyto = $sql->f("email_replyto"); | ||
| 1288 | - $default->owl_email_server = $sql->f("email_server"); | ||
| 1289 | - $default->owl_LookAtHD = $sql->f("lookathd"); | ||
| 1290 | - $default->owl_def_file_security = $sql->f("def_file_security"); | ||
| 1291 | - $default->owl_def_file_group_owner= $sql->f("def_file_group_owner"); | ||
| 1292 | - $default->owl_def_file_owner = $sql->f("def_file_owner"); | ||
| 1293 | - $default->owl_def_file_title = $sql->f("def_file_title"); | ||
| 1294 | - $default->owl_def_file_meta = $sql->f("def_file_meta"); | ||
| 1295 | - $default->owl_def_fold_security = $sql->f("def_fold_security"); | ||
| 1296 | - $default->owl_def_fold_group_owner= $sql->f("def_fold_group_owner"); | ||
| 1297 | - $default->owl_def_fold_owner = $sql->f("def_fold_owner"); | ||
| 1298 | - $default->max_filesize = $sql->f("max_filesize"); | ||
| 1299 | - $default->owl_timeout = $sql->f("timeout"); | ||
| 1300 | - $default->expand = $sql->f("expand"); | ||
| 1301 | - $default->owl_version_control = $sql->f("version_control"); | ||
| 1302 | - $default->restrict_view = $sql->f("restrict_view"); | ||
| 1303 | - $default->dbdump_path = $sql->f("dbdump_path"); | ||
| 1304 | - $default->gzip_path = $sql->f("gzip_path"); | ||
| 1305 | - $default->tar_path = $sql->f("tar_path"); | 1278 | + global $default; |
| 1279 | + | ||
| 1280 | + $sql = new Owl_DB; | ||
| 1281 | + //$sql->query("select * from $default->owl_prefs_table"); | ||
| 1282 | + $sql->query("select * from prefs"); | ||
| 1283 | + $sql->next_record(); | ||
| 1284 | + | ||
| 1285 | + $default->owl_email_from = $sql->f("email_from"); | ||
| 1286 | + $default->owl_email_fromname = $sql->f("email_fromname"); | ||
| 1287 | + $default->owl_email_replyto = $sql->f("email_replyto"); | ||
| 1288 | + $default->owl_email_server = $sql->f("email_server"); | ||
| 1289 | + $default->owl_LookAtHD = $sql->f("lookathd"); | ||
| 1290 | + $default->owl_def_file_security = $sql->f("def_file_security"); | ||
| 1291 | + $default->owl_def_file_group_owner= $sql->f("def_file_group_owner"); | ||
| 1292 | + $default->owl_def_file_owner = $sql->f("def_file_owner"); | ||
| 1293 | + $default->owl_def_file_title = $sql->f("def_file_title"); | ||
| 1294 | + $default->owl_def_file_meta = $sql->f("def_file_meta"); | ||
| 1295 | + $default->owl_def_fold_security = $sql->f("def_fold_security"); | ||
| 1296 | + $default->owl_def_fold_group_owner= $sql->f("def_fold_group_owner"); | ||
| 1297 | + $default->owl_def_fold_owner = $sql->f("def_fold_owner"); | ||
| 1298 | + $default->max_filesize = $sql->f("max_filesize"); | ||
| 1299 | + $default->owl_timeout = $sql->f("timeout"); | ||
| 1300 | + $default->expand = $sql->f("expand"); | ||
| 1301 | + $default->owl_version_control = $sql->f("version_control"); | ||
| 1302 | + $default->restrict_view = $sql->f("restrict_view"); | ||
| 1303 | + $default->dbdump_path = $sql->f("dbdump_path"); | ||
| 1304 | + $default->gzip_path = $sql->f("gzip_path"); | ||
| 1305 | + $default->tar_path = $sql->f("tar_path"); | ||
| 1306 | 1306 | ||
| 1307 | 1307 | ||
| 1308 | }; | 1308 | }; |
| @@ -1319,23 +1319,23 @@ function getprefs ( ) | @@ -1319,23 +1319,23 @@ function getprefs ( ) | ||
| 1319 | 1319 | ||
| 1320 | function gethtmlprefs ( ) | 1320 | function gethtmlprefs ( ) |
| 1321 | { | 1321 | { |
| 1322 | - global $default; | ||
| 1323 | - | ||
| 1324 | - $sql = new Owl_DB; | ||
| 1325 | - $sql->query("select * from $default->owl_html_table"); | ||
| 1326 | - $sql->next_record(); | ||
| 1327 | - | ||
| 1328 | - $default->table_border = $sql->f("table_border"); | ||
| 1329 | - $default->table_header_bg = $sql->f("table_header_bg"); | ||
| 1330 | - $default->table_cell_bg = $sql->f("table_cell_bg"); | ||
| 1331 | - $default->table_cell_bg_alt = $sql->f("table_cell_bg_alt"); | ||
| 1332 | - $default->table_expand_width = $sql->f("table_expand_width"); | ||
| 1333 | - $default->table_collapse_width = $sql->f("table_collapse_width"); | ||
| 1334 | - $default->main_header_bgcolor = $sql->f("main_header_bgcolor"); | ||
| 1335 | - $default->body_bgcolor = $sql->f("body_bgcolor"); | ||
| 1336 | - $default->body_textcolor = $sql->f("body_textcolor"); | ||
| 1337 | - $default->body_link = $sql->f("body_link"); | ||
| 1338 | - $default->body_vlink = $sql->f("body_vlink"); | 1322 | + global $default; |
| 1323 | + | ||
| 1324 | + $sql = new Owl_DB; | ||
| 1325 | + $sql->query("select * from $default->owl_html_table"); | ||
| 1326 | + $sql->next_record(); | ||
| 1327 | + | ||
| 1328 | + $default->table_border = $sql->f("table_border"); | ||
| 1329 | + $default->table_header_bg = $sql->f("table_header_bg"); | ||
| 1330 | + $default->table_cell_bg = $sql->f("table_cell_bg"); | ||
| 1331 | + $default->table_cell_bg_alt = $sql->f("table_cell_bg_alt"); | ||
| 1332 | + $default->table_expand_width = $sql->f("table_expand_width"); | ||
| 1333 | + $default->table_collapse_width = $sql->f("table_collapse_width"); | ||
| 1334 | + $default->main_header_bgcolor = $sql->f("main_header_bgcolor"); | ||
| 1335 | + $default->body_bgcolor = $sql->f("body_bgcolor"); | ||
| 1336 | + $default->body_textcolor = $sql->f("body_textcolor"); | ||
| 1337 | + $default->body_link = $sql->f("body_link"); | ||
| 1338 | + $default->body_vlink = $sql->f("body_vlink"); | ||
| 1339 | 1339 | ||
| 1340 | }; | 1340 | }; |
| 1341 | //------------------------------------------------------------ | 1341 | //------------------------------------------------------------ |
| @@ -1345,20 +1345,20 @@ function gethtmlprefs ( ) | @@ -1345,20 +1345,20 @@ function gethtmlprefs ( ) | ||
| 1345 | * Print file permissions | 1345 | * Print file permissions |
| 1346 | * | 1346 | * |
| 1347 | * @param $currentval | 1347 | * @param $currentval |
| 1348 | - * The current value | 1348 | + * The current value |
| 1349 | * @param $namevariable | 1349 | * @param $namevariable |
| 1350 | - * The name of the file | 1350 | + * The name of the file |
| 1351 | * @param $pringmessage | 1351 | * @param $pringmessage |
| 1352 | - * The message to be printed | 1352 | + * The message to be printed |
| 1353 | * @param $type | 1353 | * @param $type |
| 1354 | - * The type of file | 1354 | + * The type of file |
| 1355 | */ | 1355 | */ |
| 1356 | //------------------------------------------------------------- | 1356 | //------------------------------------------------------------- |
| 1357 | // SEMI-Usable Interface based | 1357 | // SEMI-Usable Interface based |
| 1358 | function printfileperm($currentval, $namevariable, $printmessage, $type) { | 1358 | function printfileperm($currentval, $namevariable, $printmessage, $type) { |
| 1359 | - global $default; | ||
| 1360 | - global $lang_everyoneread, $lang_everyonewrite, $lang_everyonewrite_nod, $lang_groupread, $lang_groupwrite, $lang_groupwrite_nod, $lang_groupwrite_worldread, $lang_groupwrite_worldread_nod, $lang_onlyyou; | ||
| 1361 | - global $lang_everyoneread_ad, $lang_everyonewrite_ad, $lang_everyonewrite_ad_nod, $lang_groupread_ad, $lang_groupwrite_ad, $lang_groupwrite_ad_nod, $lang_groupwrite_worldread_ad, $lang_groupwrite_worldread_ad_nod, $lang_onlyyou_ad; | 1359 | + global $default; |
| 1360 | + global $lang_everyoneread, $lang_everyonewrite, $lang_everyonewrite_nod, $lang_groupread, $lang_groupwrite, $lang_groupwrite_nod, $lang_groupwrite_worldread, $lang_groupwrite_worldread_nod, $lang_onlyyou; | ||
| 1361 | + global $lang_everyoneread_ad, $lang_everyonewrite_ad, $lang_everyonewrite_ad_nod, $lang_groupread_ad, $lang_groupwrite_ad, $lang_groupwrite_ad_nod, $lang_groupwrite_worldread_ad, $lang_groupwrite_worldread_ad_nod, $lang_onlyyou_ad; | ||
| 1362 | 1362 | ||
| 1363 | 1363 | ||
| 1364 | $file_perm[0][0] = 0; | 1364 | $file_perm[0][0] = 0; |
| @@ -1370,31 +1370,31 @@ function printfileperm($currentval, $namevariable, $printmessage, $type) { | @@ -1370,31 +1370,31 @@ function printfileperm($currentval, $namevariable, $printmessage, $type) { | ||
| 1370 | $file_perm[6][0] = 6; | 1370 | $file_perm[6][0] = 6; |
| 1371 | $file_perm[7][0] = 7; | 1371 | $file_perm[7][0] = 7; |
| 1372 | $file_perm[8][0] = 8; | 1372 | $file_perm[8][0] = 8; |
| 1373 | - | ||
| 1374 | - // show admin permissions | ||
| 1375 | - if ($type == "admin") | ||
| 1376 | - { | ||
| 1377 | - $file_perm[0][1] = "$lang_everyoneread_ad"; | ||
| 1378 | - $file_perm[1][1] = "$lang_everyonewrite_ad"; | ||
| 1379 | - $file_perm[2][1] = "$lang_groupread_ad"; | ||
| 1380 | - $file_perm[3][1] = "$lang_groupwrite_ad"; | ||
| 1381 | - $file_perm[4][1] = "$lang_onlyyou_ad"; | ||
| 1382 | - $file_perm[5][1] = "$lang_groupwrite_ad_nod"; | ||
| 1383 | - $file_perm[6][1] = "$lang_everyonewrite_ad_nod"; | ||
| 1384 | - $file_perm[7][1] = "$lang_groupwrite_worldread_ad"; | ||
| 1385 | - $file_perm[8][1] = "$lang_groupwrite_worldread_ad_nod"; | ||
| 1386 | - } | ||
| 1387 | - else {// otherwise show other permissions | ||
| 1388 | - $file_perm[0][1] = "$lang_everyoneread"; | ||
| 1389 | - $file_perm[1][1] = "$lang_everyonewrite"; | ||
| 1390 | - $file_perm[2][1] = "$lang_groupread"; | ||
| 1391 | - $file_perm[3][1] = "$lang_groupwrite"; | ||
| 1392 | - $file_perm[4][1] = "$lang_onlyyou"; | ||
| 1393 | - $file_perm[5][1] = "$lang_groupwrite_nod"; | ||
| 1394 | - $file_perm[6][1] = "$lang_everyonewrite_nod"; | ||
| 1395 | - $file_perm[7][1] = "$lang_groupwrite_worldread"; | ||
| 1396 | - $file_perm[8][1] = "$lang_groupwrite_worldread_nod"; | ||
| 1397 | - } | 1373 | + |
| 1374 | + // show admin permissions | ||
| 1375 | + if ($type == "admin") | ||
| 1376 | + { | ||
| 1377 | + $file_perm[0][1] = "$lang_everyoneread_ad"; | ||
| 1378 | + $file_perm[1][1] = "$lang_everyonewrite_ad"; | ||
| 1379 | + $file_perm[2][1] = "$lang_groupread_ad"; | ||
| 1380 | + $file_perm[3][1] = "$lang_groupwrite_ad"; | ||
| 1381 | + $file_perm[4][1] = "$lang_onlyyou_ad"; | ||
| 1382 | + $file_perm[5][1] = "$lang_groupwrite_ad_nod"; | ||
| 1383 | + $file_perm[6][1] = "$lang_everyonewrite_ad_nod"; | ||
| 1384 | + $file_perm[7][1] = "$lang_groupwrite_worldread_ad"; | ||
| 1385 | + $file_perm[8][1] = "$lang_groupwrite_worldread_ad_nod"; | ||
| 1386 | + } | ||
| 1387 | + else {// otherwise show other permissions | ||
| 1388 | + $file_perm[0][1] = "$lang_everyoneread"; | ||
| 1389 | + $file_perm[1][1] = "$lang_everyonewrite"; | ||
| 1390 | + $file_perm[2][1] = "$lang_groupread"; | ||
| 1391 | + $file_perm[3][1] = "$lang_groupwrite"; | ||
| 1392 | + $file_perm[4][1] = "$lang_onlyyou"; | ||
| 1393 | + $file_perm[5][1] = "$lang_groupwrite_nod"; | ||
| 1394 | + $file_perm[6][1] = "$lang_everyonewrite_nod"; | ||
| 1395 | + $file_perm[7][1] = "$lang_groupwrite_worldread"; | ||
| 1396 | + $file_perm[8][1] = "$lang_groupwrite_worldread_nod"; | ||
| 1397 | + } | ||
| 1398 | 1398 | ||
| 1399 | print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$printmessage</TD><TD align=left><SELECT NAME=$namevariable>"); | 1399 | print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$printmessage</TD><TD align=left><SELECT NAME=$namevariable>"); |
| 1400 | foreach($file_perm as $fp) { | 1400 | foreach($file_perm as $fp) { |
| @@ -1414,123 +1414,123 @@ function printfileperm($currentval, $namevariable, $printmessage, $type) { | @@ -1414,123 +1414,123 @@ function printfileperm($currentval, $namevariable, $printmessage, $type) { | ||
| 1414 | *prints the file icons | 1414 | *prints the file icons |
| 1415 | * | 1415 | * |
| 1416 | * @param $fid | 1416 | * @param $fid |
| 1417 | - * The folder id | 1417 | + * The folder id |
| 1418 | * @param $filename | 1418 | * @param $filename |
| 1419 | - * The name of the file | 1419 | + * The name of the file |
| 1420 | * @param $check_out | 1420 | * @param $check_out |
| 1421 | - * checkout status | 1421 | + * checkout status |
| 1422 | * @param $url | 1422 | * @param $url |
| 1423 | - * The relevant url | 1423 | + * The relevant url |
| 1424 | * @param $allicons | 1424 | * @param $allicons |
| 1425 | - * | 1425 | + * |
| 1426 | * @param $ext | 1426 | * @param $ext |
| 1427 | - * The extension of the file | 1427 | + * The extension of the file |
| 1428 | * @Return $sql->f("name"); | 1428 | * @Return $sql->f("name"); |
| 1429 | - * Return the name of the folder | 1429 | + * Return the name of the folder |
| 1430 | */ | 1430 | */ |
| 1431 | //------------------------------------------------------------- | 1431 | //------------------------------------------------------------- |
| 1432 | // NOT Usable INTERFACE based | 1432 | // NOT Usable INTERFACE based |
| 1433 | function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) | 1433 | function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) |
| 1434 | { | 1434 | { |
| 1435 | - global $default; | ||
| 1436 | - global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid; | ||
| 1437 | - global $lang_log_file, $lang_reallydelete, $lang_del_file_alt, $lang_mod_file_alt; | ||
| 1438 | - global $lang_move_file_alt,$lang_upd_file_alt,$lang_get_file_alt,$lang_lock_file,$lang_email_alt,$lang_view_file_alt; | ||
| 1439 | - | ||
| 1440 | - if ($allicons == 1) | ||
| 1441 | - { | ||
| 1442 | - if ($url != "1") | ||
| 1443 | - print("<a href='log.php?sess=$sess&id=".$fid."&filename=".$filename."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/log.gif' BORDER=0 ALT='$lang_log_file' TITLE='$lang_log_file'></a>"); | ||
| 1444 | - } | ||
| 1445 | - | ||
| 1446 | - if (($checked_out == 0) || ($checked_out == $userid)) { | ||
| 1447 | - // ***************************************************************************** | ||
| 1448 | - // Don't Show the delete icon if the user doesn't have delete access to the file | ||
| 1449 | - // ***************************************************************************** | ||
| 1450 | - | ||
| 1451 | - if (check_auth($fid, "file_delete", $userid) == 1) | ||
| 1452 | - if ($url == "1") | ||
| 1453 | - print("\t<A HREF='dbmodify.php?sess=$sess&action=file_delete&type=url&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'\tonClick='return confirm(\"$lang_reallydelete ".$filename."?\");'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/trash.gif' ALT='$lang_del_file_alt' TITLE='$lang_del_file_alt'\tBORDER=0></A>"); | ||
| 1454 | - else | ||
| 1455 | - print("\t<A HREF='dbmodify.php?sess=$sess&action=file_delete&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'\tonClick='return confirm(\"$lang_reallydelete ".$filename."?\");'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/trash.gif' ALT='$lang_del_file_alt' TITLE='$lang_del_file_alt'\tBORDER=0></A>"); | ||
| 1456 | - | ||
| 1457 | - // ***************************************************************************** | ||
| 1458 | - // Don't Show the modify icon if the user doesn't have modify access to the file | ||
| 1459 | - // ***************************************************************************** | ||
| 1460 | - | ||
| 1461 | - if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1462 | - print("<A HREF='modify.php?sess=$sess&action=file_modify&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/edit.gif' BORDER=0 ALT='$lang_mod_file_alt' TITLE='$lang_mod_file_alt'></A>"); | ||
| 1463 | - | ||
| 1464 | - // ***************************************************************************** | ||
| 1465 | - // Don't Show the move modify icon if the user doesn't have move access to the file | ||
| 1466 | - // ***************************************************************************** | ||
| 1467 | - | ||
| 1468 | - if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1469 | - if ($url == "1") | ||
| 1470 | - print("<A HREF='move.php?sess=$sess&id=".$fid."&parent=$parent&expand=$expand&action=file&type=url&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/move.gif' BORDER=0 ALT='$lang_move_file_alt' TITLE='$lang_move_file_alt'></A>"); | ||
| 1471 | - else | ||
| 1472 | - print("<A HREF='move.php?sess=$sess&id=".$fid."&parent=$parent&expand=$expand&action=file&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/move.gif' BORDER=0 ALT='$lang_move_file_alt' TITLE='$lang_move_file_alt'></A>"); | ||
| 1473 | - // ***************************************************************************** | ||
| 1474 | - // Don't Show the file update icon if the user doesn't have update access to the file | ||
| 1475 | - // ***************************************************************************** | ||
| 1476 | - | ||
| 1477 | - if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1478 | - if ($url != "1") | ||
| 1479 | - print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_update&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/update.gif' BORDER=0 ALT='$lang_upd_file_alt' TITLE='$lang_upd_file_alt'></A>"); | ||
| 1480 | - | ||
| 1481 | - // ***************************************************************************** | ||
| 1482 | - // Don't Show the file dowload icon if the user doesn't have download access to the file | ||
| 1483 | - // ***************************************************************************** | ||
| 1484 | - | ||
| 1485 | - if(check_auth($fid, "file_download", $userid) == 1) | ||
| 1486 | - if ($url != "1") | ||
| 1487 | - print("<A HREF='$default->owl_root_url/download.php?sess=$sess&id=".$fid."&parent=".$parent."&binary=1'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/bin.gif' BORDER=0 ALT='$lang_get_file_alt' TITLE='$lang_get_file_alt'></A>"); | ||
| 1488 | - | ||
| 1489 | - if ($allicons == 1) | ||
| 1490 | - { | ||
| 1491 | - // ***************************************************************************** | ||
| 1492 | - // Don't Show the lock icon if the user doesn't have access to the file | ||
| 1493 | - // ***************************************************************************** | ||
| 1494 | - if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1495 | - if ($url != "1") | ||
| 1496 | - print("<A HREF='dbmodify.php?sess=$sess&action=file_lock&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/lock.gif' BORDER=0 ALT='$lang_lock_file' TITLE='$lang_lock_file'></a>"); | ||
| 1497 | - } | ||
| 1498 | - | ||
| 1499 | - // ***************************************************************************** | ||
| 1500 | - // Don't Show the email icon if the user doesn't have access to email the file | ||
| 1501 | - // ***************************************************************************** | ||
| 1502 | - | ||
| 1503 | - if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1504 | - if ($url == "1") | ||
| 1505 | - print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_email&type=url&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/email.gif' BORDER=0 ALT='$lang_email_alt' TITLE='$lang_email_alt'></A>"); | ||
| 1506 | - else | ||
| 1507 | - print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_email&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/email.gif' BORDER=0 ALT='$lang_email_alt' TITLE='$lang_email_alt'></A>"); | ||
| 1508 | - | ||
| 1509 | - // ***************************************************************************** | ||
| 1510 | - // Don't Show the view icon if the user doesn't have download access to the file | ||
| 1511 | - // ***************************************************************************** | ||
| 1512 | - | ||
| 1513 | - if(check_auth($fid, "file_download", $userid) == 1) | ||
| 1514 | - if ($url != "1") { | ||
| 1515 | - $imgfiles = array("jpg","gif"); | ||
| 1516 | - if ($ext != "" && preg_grep("/$ext/", $imgfiles)) { | ||
| 1517 | - print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=image_preview&expand=$expand&order=$order&sortname=$sortname'> <IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>"); | ||
| 1518 | - } | ||
| 1519 | - $htmlfiles = array("html","htm",xml); | ||
| 1520 | - if ($ext != "" && preg_grep("/$ext/", $htmlfiles)) { | ||
| 1521 | - print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=html_show&expand=$expand&order=$order&sortname=$sortname'> <IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>"); | ||
| 1522 | - } | ||
| 1523 | - $txtfiles = array("txt","text","README", "readme", "sh", "c", "cpp", "php", "php3", "pl", "perl", "sql", "py"); | ||
| 1524 | - if ($ext != "" && preg_grep("/$ext/", $txtfiles)) { | ||
| 1525 | - print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=text_show&expand=$expand&order=$order&sortname=$sortname'> <IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>"); | ||
| 1526 | - } | ||
| 1527 | - if (substr(php_uname(), 0, 7) != "Windows") { | ||
| 1528 | - $zipfiles = array("tar.gz", "tgz", "tar", "gz"); | ||
| 1529 | - if ($ext != "" && preg_grep("/$ext/", $zipfiles)) | ||
| 1530 | - print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=zip_preview&expand=$expand&order=$order&sortname=$sortname'> <IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>"); | ||
| 1531 | - } | ||
| 1532 | - } | ||
| 1533 | - } | 1435 | + global $default; |
| 1436 | + global $sess, $parent, $expand, $order, $sortorder ,$sortname, $userid; | ||
| 1437 | + global $lang_log_file, $lang_reallydelete, $lang_del_file_alt, $lang_mod_file_alt; | ||
| 1438 | + global $lang_move_file_alt,$lang_upd_file_alt,$lang_get_file_alt,$lang_lock_file,$lang_email_alt,$lang_view_file_alt; | ||
| 1439 | + | ||
| 1440 | + if ($allicons == 1) | ||
| 1441 | + { | ||
| 1442 | + if ($url != "1") | ||
| 1443 | + print("<a href='log.php?sess=$sess&id=".$fid."&filename=".$filename."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/log.gif' BORDER=0 ALT='$lang_log_file' TITLE='$lang_log_file'></a>"); | ||
| 1444 | + } | ||
| 1445 | + | ||
| 1446 | + if (($checked_out == 0) || ($checked_out == $userid)) { | ||
| 1447 | + // ***************************************************************************** | ||
| 1448 | + // Don't Show the delete icon if the user doesn't have delete access to the file | ||
| 1449 | + // ***************************************************************************** | ||
| 1450 | + | ||
| 1451 | + if (check_auth($fid, "file_delete", $userid) == 1) | ||
| 1452 | + if ($url == "1") | ||
| 1453 | + print("\t<A HREF='dbmodify.php?sess=$sess&action=file_delete&type=url&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'\tonClick='return confirm(\"$lang_reallydelete ".$filename."?\");'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/trash.gif' ALT='$lang_del_file_alt' TITLE='$lang_del_file_alt'\tBORDER=0></A>"); | ||
| 1454 | + else | ||
| 1455 | + print("\t<A HREF='dbmodify.php?sess=$sess&action=file_delete&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'\tonClick='return confirm(\"$lang_reallydelete ".$filename."?\");'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/trash.gif' ALT='$lang_del_file_alt' TITLE='$lang_del_file_alt'\tBORDER=0></A>"); | ||
| 1456 | + | ||
| 1457 | + // ***************************************************************************** | ||
| 1458 | + // Don't Show the modify icon if the user doesn't have modify access to the file | ||
| 1459 | + // ***************************************************************************** | ||
| 1460 | + | ||
| 1461 | + if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1462 | + print("<A HREF='modify.php?sess=$sess&action=file_modify&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/edit.gif' BORDER=0 ALT='$lang_mod_file_alt' TITLE='$lang_mod_file_alt'></A>"); | ||
| 1463 | + | ||
| 1464 | + // ***************************************************************************** | ||
| 1465 | + // Don't Show the move modify icon if the user doesn't have move access to the file | ||
| 1466 | + // ***************************************************************************** | ||
| 1467 | + | ||
| 1468 | + if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1469 | + if ($url == "1") | ||
| 1470 | + print("<A HREF='move.php?sess=$sess&id=".$fid."&parent=$parent&expand=$expand&action=file&type=url&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/move.gif' BORDER=0 ALT='$lang_move_file_alt' TITLE='$lang_move_file_alt'></A>"); | ||
| 1471 | + else | ||
| 1472 | + print("<A HREF='move.php?sess=$sess&id=".$fid."&parent=$parent&expand=$expand&action=file&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/move.gif' BORDER=0 ALT='$lang_move_file_alt' TITLE='$lang_move_file_alt'></A>"); | ||
| 1473 | + // ***************************************************************************** | ||
| 1474 | + // Don't Show the file update icon if the user doesn't have update access to the file | ||
| 1475 | + // ***************************************************************************** | ||
| 1476 | + | ||
| 1477 | + if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1478 | + if ($url != "1") | ||
| 1479 | + print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_update&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/update.gif' BORDER=0 ALT='$lang_upd_file_alt' TITLE='$lang_upd_file_alt'></A>"); | ||
| 1480 | + | ||
| 1481 | + // ***************************************************************************** | ||
| 1482 | + // Don't Show the file dowload icon if the user doesn't have download access to the file | ||
| 1483 | + // ***************************************************************************** | ||
| 1484 | + | ||
| 1485 | + if(check_auth($fid, "file_download", $userid) == 1) | ||
| 1486 | + if ($url != "1") | ||
| 1487 | + print("<A HREF='$default->owl_root_url/download.php?sess=$sess&id=".$fid."&parent=".$parent."&binary=1'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/icons/bin.gif' BORDER=0 ALT='$lang_get_file_alt' TITLE='$lang_get_file_alt'></A>"); | ||
| 1488 | + | ||
| 1489 | + if ($allicons == 1) | ||
| 1490 | + { | ||
| 1491 | + // ***************************************************************************** | ||
| 1492 | + // Don't Show the lock icon if the user doesn't have access to the file | ||
| 1493 | + // ***************************************************************************** | ||
| 1494 | + if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1495 | + if ($url != "1") | ||
| 1496 | + print("<A HREF='dbmodify.php?sess=$sess&action=file_lock&id=".$fid."&parent=$parent&expand=$expand&order=$order&sortname=$sortname'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/lock.gif' BORDER=0 ALT='$lang_lock_file' TITLE='$lang_lock_file'></a>"); | ||
| 1497 | + } | ||
| 1498 | + | ||
| 1499 | + // ***************************************************************************** | ||
| 1500 | + // Don't Show the email icon if the user doesn't have access to email the file | ||
| 1501 | + // ***************************************************************************** | ||
| 1502 | + | ||
| 1503 | + if(check_auth($fid, "file_modify", $userid) == 1) | ||
| 1504 | + if ($url == "1") | ||
| 1505 | + print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_email&type=url&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/email.gif' BORDER=0 ALT='$lang_email_alt' TITLE='$lang_email_alt'></A>"); | ||
| 1506 | + else | ||
| 1507 | + print("<A HREF='$default->owl_root_url/modify.php?sess=$sess&expand=$expand&action=file_email&order=$order&sortname=$sortname&id=".$fid."&parent=".$parent."'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/email.gif' BORDER=0 ALT='$lang_email_alt' TITLE='$lang_email_alt'></A>"); | ||
| 1508 | + | ||
| 1509 | + // ***************************************************************************** | ||
| 1510 | + // Don't Show the view icon if the user doesn't have download access to the file | ||
| 1511 | + // ***************************************************************************** | ||
| 1512 | + | ||
| 1513 | + if(check_auth($fid, "file_download", $userid) == 1) | ||
| 1514 | + if ($url != "1") { | ||
| 1515 | + $imgfiles = array("jpg","gif"); | ||
| 1516 | + if ($ext != "" && preg_grep("/$ext/", $imgfiles)) { | ||
| 1517 | + print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=image_preview&expand=$expand&order=$order&sortname=$sortname'> <IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>"); | ||
| 1518 | + } | ||
| 1519 | + $htmlfiles = array("html","htm",xml); | ||
| 1520 | + if ($ext != "" && preg_grep("/$ext/", $htmlfiles)) { | ||
| 1521 | + print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=html_show&expand=$expand&order=$order&sortname=$sortname'> <IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>"); | ||
| 1522 | + } | ||
| 1523 | + $txtfiles = array("txt","text","README", "readme", "sh", "c", "cpp", "php", "php3", "pl", "perl", "sql", "py"); | ||
| 1524 | + if ($ext != "" && preg_grep("/$ext/", $txtfiles)) { | ||
| 1525 | + print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=text_show&expand=$expand&order=$order&sortname=$sortname'> <IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>"); | ||
| 1526 | + } | ||
| 1527 | + if (substr(php_uname(), 0, 7) != "Windows") { | ||
| 1528 | + $zipfiles = array("tar.gz", "tgz", "tar", "gz"); | ||
| 1529 | + if ($ext != "" && preg_grep("/$ext/", $zipfiles)) | ||
| 1530 | + print("<A HREF='view.php?sess=$sess&id=".$fid."&parent=$parent&action=zip_preview&expand=$expand&order=$order&sortname=$sortname'> <IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/mag.jpg' BORDER=0 ALT='$lang_view_file_alt' TITLE='$lang_view_file_alt'></A>"); | ||
| 1531 | + } | ||
| 1532 | + } | ||
| 1533 | + } | ||
| 1534 | }; | 1534 | }; |
| 1535 | 1535 | ||
| 1536 | //------------------------------------------------------------ | 1536 | //------------------------------------------------------------ |
| @@ -1540,19 +1540,19 @@ function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) | @@ -1540,19 +1540,19 @@ function printFileIcons ($fid, $filename, $checked_out, $url, $allicons, $ext) | ||
| 1540 | * Prints group permissions | 1540 | * Prints group permissions |
| 1541 | * | 1541 | * |
| 1542 | * @param $currentval | 1542 | * @param $currentval |
| 1543 | - * The current value | 1543 | + * The current value |
| 1544 | * @param $namevariable | 1544 | * @param $namevariable |
| 1545 | - * The name of the group | 1545 | + * The name of the group |
| 1546 | * @param $printmessage | 1546 | * @param $printmessage |
| 1547 | - * The message to be printed | 1547 | + * The message to be printed |
| 1548 | * @param $type | 1548 | * @param $type |
| 1549 | - * The type of group | 1549 | + * The type of group |
| 1550 | */ | 1550 | */ |
| 1551 | //------------------------------------------------------------- | 1551 | //------------------------------------------------------------- |
| 1552 | // NOT Usable INTERFACE based | 1552 | // NOT Usable INTERFACE based |
| 1553 | function printgroupperm($currentval, $namevariable, $printmessage, $type) { | 1553 | function printgroupperm($currentval, $namevariable, $printmessage, $type) { |
| 1554 | - global $default; | ||
| 1555 | - global $lang_geveryoneread, $lang_geveryonewrite, $lang_geveryonewrite_nod, $lang_ggroupread, $lang_ggroupwrite, $lang_ggroupwrite_nod, $lang_ggroupwrite_worldread, $lang_ggroupwrite_worldread_nod, $lang_gonlyyou; | 1554 | + global $default; |
| 1555 | + global $lang_geveryoneread, $lang_geveryonewrite, $lang_geveryonewrite_nod, $lang_ggroupread, $lang_ggroupwrite, $lang_ggroupwrite_nod, $lang_ggroupwrite_worldread, $lang_ggroupwrite_worldread_nod, $lang_gonlyyou; | ||
| 1556 | global $lang_geveryoneread_ad, $lang_geveryonewrite_ad, $lang_geveryonewrite_ad_nod, $lang_ggroupread_ad, $lang_ggroupwrite_ad, $lang_ggroupwrite_ad_nod, $lang_ggroupwrite_worldread_ad, $lang_ggroupwrite_worldread_ad_nod, $lang_gonlyyou_ad; | 1556 | global $lang_geveryoneread_ad, $lang_geveryonewrite_ad, $lang_geveryonewrite_ad_nod, $lang_ggroupread_ad, $lang_ggroupwrite_ad, $lang_ggroupwrite_ad_nod, $lang_ggroupwrite_worldread_ad, $lang_ggroupwrite_worldread_ad_nod, $lang_gonlyyou_ad; |
| 1557 | 1557 | ||
| 1558 | 1558 | ||
| @@ -1565,8 +1565,8 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { | @@ -1565,8 +1565,8 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { | ||
| 1565 | $group_perm[6][0] = 56; | 1565 | $group_perm[6][0] = 56; |
| 1566 | $group_perm[7][0] = 57; | 1566 | $group_perm[7][0] = 57; |
| 1567 | $group_perm[8][0] = 58; | 1567 | $group_perm[8][0] = 58; |
| 1568 | - if ($type == "admin") | ||
| 1569 | - { | 1568 | + if ($type == "admin") |
| 1569 | + { | ||
| 1570 | $group_perm[0][1] = "$lang_geveryoneread_ad"; | 1570 | $group_perm[0][1] = "$lang_geveryoneread_ad"; |
| 1571 | $group_perm[1][1] = "$lang_geveryonewrite_ad"; | 1571 | $group_perm[1][1] = "$lang_geveryonewrite_ad"; |
| 1572 | $group_perm[2][1] = "$lang_ggroupread_ad"; | 1572 | $group_perm[2][1] = "$lang_ggroupread_ad"; |
| @@ -1577,9 +1577,9 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { | @@ -1577,9 +1577,9 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { | ||
| 1577 | $group_perm[7][1] = "$lang_ggroupwrite_worldread_ad"; | 1577 | $group_perm[7][1] = "$lang_ggroupwrite_worldread_ad"; |
| 1578 | $group_perm[8][1] = "$lang_ggroupwrite_worldread_ad_nod"; | 1578 | $group_perm[8][1] = "$lang_ggroupwrite_worldread_ad_nod"; |
| 1579 | 1579 | ||
| 1580 | - } | ||
| 1581 | - else | ||
| 1582 | - { | 1580 | + } |
| 1581 | + else | ||
| 1582 | + { | ||
| 1583 | $group_perm[0][1] = "$lang_geveryoneread"; | 1583 | $group_perm[0][1] = "$lang_geveryoneread"; |
| 1584 | $group_perm[1][1] = "$lang_geveryonewrite"; | 1584 | $group_perm[1][1] = "$lang_geveryonewrite"; |
| 1585 | $group_perm[2][1] = "$lang_ggroupread"; | 1585 | $group_perm[2][1] = "$lang_ggroupread"; |
| @@ -1589,7 +1589,7 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { | @@ -1589,7 +1589,7 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { | ||
| 1589 | $group_perm[6][1] = "$lang_geveryonewrite_nod"; | 1589 | $group_perm[6][1] = "$lang_geveryonewrite_nod"; |
| 1590 | $group_perm[7][1] = "$lang_ggroupwrite_worldread"; | 1590 | $group_perm[7][1] = "$lang_ggroupwrite_worldread"; |
| 1591 | $group_perm[8][1] = "$lang_ggroupwrite_worldread_nod"; | 1591 | $group_perm[8][1] = "$lang_ggroupwrite_worldread_nod"; |
| 1592 | - } | 1592 | + } |
| 1593 | 1593 | ||
| 1594 | print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$printmessage</TD><TD align=left><SELECT NAME=$namevariable>"); | 1594 | print("<TR><TD ALIGN=RIGHT BGCOLOR=$default->table_header_bg>$printmessage</TD><TD align=left><SELECT NAME=$namevariable>"); |
| 1595 | foreach($group_perm as $fp) | 1595 | foreach($group_perm as $fp) |
| @@ -1655,7 +1655,7 @@ if(isset($default->owl_lang)) { | @@ -1655,7 +1655,7 @@ if(isset($default->owl_lang)) { | ||
| 1655 | 1655 | ||
| 1656 | $langdir = "$default->owl_fs_root/locale/$default->owl_lang"; | 1656 | $langdir = "$default->owl_fs_root/locale/$default->owl_lang"; |
| 1657 | 1657 | ||
| 1658 | - if(is_dir("$langdir") != 1) { | 1658 | + if(is_dir("$langdir") != 1) { |
| 1659 | die("$lang_err_lang_1 $langdir $lang_err_lang_2"); | 1659 | die("$lang_err_lang_1 $langdir $lang_err_lang_2"); |
| 1660 | } else { | 1660 | } else { |
| 1661 | 1661 | ||
| @@ -1687,8 +1687,8 @@ if ($sess) { | @@ -1687,8 +1687,8 @@ if ($sess) { | ||
| 1687 | gethtmlprefs(); | 1687 | gethtmlprefs(); |
| 1688 | $ok = verify_session($sess); | 1688 | $ok = verify_session($sess); |
| 1689 | $temporary_ok = $ok["bit"]; | 1689 | $temporary_ok = $ok["bit"]; |
| 1690 | - $userid = $ok["userid"]; | ||
| 1691 | - $usergroupid = $ok["groupid"]; | 1690 | + $userid = $ok["userid"]; |
| 1691 | + $usergroupid = $ok["groupid"]; | ||
| 1692 | 1692 | ||
| 1693 | if ($ok["bit"] != "1") { | 1693 | if ($ok["bit"] != "1") { |
| 1694 | // Bozz Bug Fix begin | 1694 | // Bozz Bug Fix begin |
| @@ -1702,21 +1702,21 @@ if ($sess) { | @@ -1702,21 +1702,21 @@ if ($sess) { | ||
| 1702 | if ($parent == "" || $fileid == "") { | 1702 | if ($parent == "" || $fileid == "") { |
| 1703 | print("<A HREF='$default->owl_root_url/index.php'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>"); | 1703 | print("<A HREF='$default->owl_root_url/index.php'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>"); |
| 1704 | } else { | 1704 | } else { |
| 1705 | - print("<A HREF='$default->owl_root_url/index.php?parent=$parent&fileid=$fileid'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>"); | 1705 | + print("<A HREF='$default->owl_root_url/index.php?parent=$parent&fileid=$fileid'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>"); |
| 1706 | } | 1706 | } |
| 1707 | - exit; | 1707 | + exit; |
| 1708 | } else { | 1708 | } else { |
| 1709 | - $lastused = time(); | ||
| 1710 | - $sql = new Owl_DB; | ||
| 1711 | - $sql->query("update $default->owl_sessions_table set lastused = '$lastused' where uid = '$userid'"); | ||
| 1712 | - } | 1709 | + $lastused = time(); |
| 1710 | + $sql = new Owl_DB; | ||
| 1711 | + $sql->query("update $default->owl_sessions_table set lastused = '$lastused' where uid = '$userid'"); | ||
| 1712 | + } | ||
| 1713 | } | 1713 | } |
| 1714 | 1714 | ||
| 1715 | if (!$sess && !$loginname && !$login) { | 1715 | if (!$sess && !$loginname && !$login) { |
| 1716 | - if(!isset($fileid)) { | ||
| 1717 | - header("Location: " . $default->owl_root_url . "/index.php?login=1"); | 1716 | + if(!isset($fileid)) { |
| 1717 | + header("Location: " . $default->owl_root_url . "/index.php?login=1"); | ||
| 1718 | } else { | 1718 | } else { |
| 1719 | - header("Location: " . $default->owl_root_url . "/index.php?login=1&fileid=$fileid&parent=$parent"); | 1719 | + header("Location: " . $default->owl_root_url . "/index.php?login=1&fileid=$fileid&parent=$parent"); |
| 1720 | } | 1720 | } |
| 1721 | } | 1721 | } |
| 1722 | */ | 1722 | */ |