Commit a30dcf95da168ef88682767cba038542b31e2e29

Authored by michael
1 parent df57d3ec

added copyright and gpl notice

removed owl prefix from table aliases


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2566 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/roles/Role.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class Role
5   -* Represents a role as per the roles database table
6   -*
7   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
8   -* @date 20 January 2003
9   -* package lib.roles
10   -*/
11   -
  3 + * $Id$
  4 + *
  5 + * Represents a role as per the roles database table.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22 + *
  23 + * @version $Revision$
  24 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.roles
  26 + */
12 27 class Role {
13 28  
14 29 /** role object primary key */
... ... @@ -87,7 +102,7 @@ class Role {
87 102 if ($this->iId < 0) {
88 103 //check to see if name exsits
89 104 $sql = $default->db;
90   - $query = "SELECT name FROM ". $default->owl_roles_table ." WHERE name = '" . $this->sName . "'";
  105 + $query = "SELECT name FROM ". $default->roles_table ." WHERE name = '" . $this->sName . "'";
91 106 $sql->query($query);
92 107 $rows = $sql->num_rows($sql);
93 108  
... ... @@ -98,7 +113,7 @@ class Role {
98 113 }else
99 114 {
100 115 $sql = $default->db;
101   - $result = $sql->query("INSERT INTO " . $default->owl_roles_table . " (name, active, can_read, can_write) VALUES ('" . addslashes($this->sName) . "', " . ($this->bActive ? 1 : 0) . ", " . ($this->bCanRead ? 1 : 0) . ", " . ($this->bCanWrite ? 1 : 0) . ")");
  116 + $result = $sql->query("INSERT INTO " . $default->roles_table . " (name, active, can_read, can_write) VALUES ('" . addslashes($this->sName) . "', " . ($this->bActive ? 1 : 0) . ", " . ($this->bCanRead ? 1 : 0) . ", " . ($this->bCanWrite ? 1 : 0) . ")");
102 117 if ($result) {
103 118 $this->iId = $sql->insert_id();
104 119 return true;
... ... @@ -122,7 +137,7 @@ class Role {
122 137 //only update if the object has been stored
123 138 if ($this->iId > 0) {
124 139 $sql = $default->db;
125   - $result = $sql->query("UPDATE " . $default->owl_roles_table . " SET name = '" . addslashes($this->sName) . "', active = " . ($this->bActive ? 1 : 0) . ", can_read = " . ($this->bCanRead ? 1 : 0) . ", can_write = " . ($this->bCanWrite ? 1 : 0) . " WHERE id = $this->iId");
  140 + $result = $sql->query("UPDATE " . $default->roles_table . " SET name = '" . addslashes($this->sName) . "', active = " . ($this->bActive ? 1 : 0) . ", can_read = " . ($this->bCanRead ? 1 : 0) . ", can_write = " . ($this->bCanWrite ? 1 : 0) . " WHERE id = $this->iId");
126 141 if ($result) {
127 142 return true;
128 143 }
... ... @@ -145,7 +160,7 @@ class Role {
145 160 if ($this->iId >= 0) {
146 161 //check to see if role is linked to a folder
147 162 $sql = $default->db;
148   - $query = "SELECT role_id FROM ". $default->owl_groups_folders_approval_table ." WHERE role_id = '" . $this->iId . "'";
  163 + $query = "SELECT role_id FROM ". $default->groups_folders_approval_table ." WHERE role_id = '" . $this->iId . "'";
149 164 $sql->query($query);
150 165 $rows = $sql->num_rows($sql);
151 166  
... ... @@ -156,7 +171,7 @@ class Role {
156 171  
157 172 }else{
158 173 $sql = $default->db;
159   - $result = $sql->query("DELETE FROM $default->owl_roles_table WHERE id = $this->iId");
  174 + $result = $sql->query("DELETE FROM $default->roles_table WHERE id = $this->iId");
160 175 if ($result) {
161 176 return true;
162 177 }
... ... @@ -179,7 +194,7 @@ class Role {
179 194 function & get($iRoleID) {
180 195 global $default;
181 196 $sql = $default->db;
182   - $result = $sql->query("SELECT * FROM $default->owl_roles_table WHERE id = $iRoleID");
  197 + $result = $sql->query("SELECT * FROM $default->roles_table WHERE id = $iRoleID");
183 198 if ($result) {
184 199 if ($sql->next_record()) {
185 200 $oRole = & new Role(stripslashes($sql->f("name")), $sql->f("can_read"), $sql->f("can_write"));
... ... @@ -187,7 +202,7 @@ class Role {
187 202 $oRole->bActive = $sql->f("active");
188 203 return $oRole;
189 204 }
190   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRoleID . " table = $default->owl_roles_table";
  205 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRoleID . " table = $default->roles_table";
191 206 return false;
192 207 }
193 208 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -207,7 +222,7 @@ class Role {
207 222 $aRoleArray;
208 223 settype($aRoleArray, "array");
209 224 $sql = $default->db;
210   - $result = $sql->query("SELECT * FROM " . $default->owl_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  225 + $result = $sql->query("SELECT * FROM " . $default->roles_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
211 226 if ($result) {
212 227 $iCount = 0;
213 228 while ($sql->next_record()) {
... ...
lib/roles/RoleFolderLink.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class RoleFolderLink
5   -* Represents a role, folder links as per the folders_users_role_link table
6   -*
7   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
8   -* @date 20 January 2003
9   -* @package lib.roles
10   -*/
11   -
  3 + * $Id$
  4 + *
  5 + * Represents a role, folder links as per the folders_users_role_link table.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22 + *
  23 + * @version $Revision$
  24 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.roles
  26 + */
12 27 class RoleFolderLink {
13 28  
14 29 var $iId;
... ... @@ -162,7 +177,7 @@ class RoleFolderLink {
162 177 //if the object hasn't been created
163 178 if ($this->iId < 0) {
164 179 $sql = $default->db;
165   - $result = $sql->query("INSERT INTO " . $default->owl_folders_user_roles_table . " (user_id, folder_id, role_type_id, datetime, done, active) VALUES ($this->iUserID, $this->iFolderID, $this->iRoleTypeID, '$this->dDateTime', " . ($this->bDone ? 1 : 0) . "), " . ($this->bActive ? 1 : 0) . ")");
  180 + $result = $sql->query("INSERT INTO " . $default->folders_user_roles_table . " (user_id, folder_id, role_type_id, datetime, done, active) VALUES ($this->iUserID, $this->iFolderID, $this->iRoleTypeID, '$this->dDateTime', " . ($this->bDone ? 1 : 0) . "), " . ($this->bActive ? 1 : 0) . ")");
166 181 if ($result) {
167 182 $this->iId = $sql->insert_id();
168 183 return true;
... ... @@ -170,7 +185,6 @@ class RoleFolderLink {
170 185 $_SESSION["errorMessage"] = $lang_err_database;
171 186 return false;
172 187 }
173   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_folder_user_roles_table";
174 188 return false;
175 189 }
176 190  
... ... @@ -185,7 +199,7 @@ class RoleFolderLink {
185 199 //only update if the object has been stored
186 200 if ($this->iId > 0) {
187 201 $sql = $default->db;
188   - $result = $sql->query("UPDATE " . $default->owl_folders_user_roles_table . " SET user_id = $this->iUserID, folder_id = $this->iFolderID, role_type_id = $this->iRoleTypeID, datetime = '$this->dDateTime', done = " . ($this->bDone ? 1 : 0) . ", active = " . ($this->bActive ? 1 : 0) . " WHERE id = $this->iId");
  202 + $result = $sql->query("UPDATE " . $default->folders_user_roles_table . " SET user_id = $this->iUserID, folder_id = $this->iFolderID, role_type_id = $this->iRoleTypeID, datetime = '$this->dDateTime', done = " . ($this->bDone ? 1 : 0) . ", active = " . ($this->bActive ? 1 : 0) . " WHERE id = $this->iId");
189 203 if ($result) {
190 204 return true;
191 205 }
... ... @@ -207,7 +221,7 @@ class RoleFolderLink {
207 221 //only delete the object if it exists in the database
208 222 if ($this->iId >= 0) {
209 223 $sql = $default->db;
210   - $result = $sql->query("DELETE FROM $default->owl_folders_user_roles_table WHERE id = $this->iId");
  224 + $result = $sql->query("DELETE FROM $default->folders_user_roles_table WHERE id = $this->iId");
211 225 if ($result) {
212 226 return true;
213 227 }
... ... @@ -229,7 +243,7 @@ class RoleFolderLink {
229 243 function & get($iRolesFoldersID) {
230 244 global $default;
231 245 $sql = $default->db;
232   - $result = $sql->query("SELECT * FROM $default->owl_folders_user_roles_table WHERE id = $iRolesFoldersID");
  246 + $result = $sql->query("SELECT * FROM $default->folders_user_roles_table WHERE id = $iRolesFoldersID");
233 247 if ($result) {
234 248 if ($sql->next_record()) {
235 249 $oRolesFoldersLink = & new RoleFolderLink($sql->f("user_id"), $sql->f("folder_id"), $sql->f("role_type_id"), $sql->f("datetime"));
... ... @@ -238,7 +252,7 @@ class RoleFolderLink {
238 252 $oRolesFoldersLink->iId = $iRolesFoldersID;
239 253 return $oRolesFoldersLink;
240 254 }
241   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRolesFoldersID . " table = $default->owl_folders_user_roles_table";
  255 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRolesFoldersID . " table = $default->folders_user_roles_table";
242 256 return false;
243 257 }
244 258 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -258,7 +272,7 @@ class RoleFolderLink {
258 272 $aRolesFoldersLinkArray;
259 273 settype($aRolesFoldersLinkArray, "array");
260 274 $sql = $default->db;
261   - $result = $sql->query("SELECT * FROM " . $default->owl_folders_user_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  275 + $result = $sql->query("SELECT * FROM " . $default->folders_user_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
262 276 if ($result) {
263 277 $iCount = 0;
264 278 while ($sql->next_record()) {
... ...
lib/session/Session.inc
... ... @@ -2,14 +2,28 @@
2 2 /**
3 3 * $Id$
4 4 *
5   - * This class is used for session management.
  5 + * Session management class.
6 6 *
7   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8 22 *
9   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
10 23 * @version $Revision$
  24 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
11 25 * @package lib.session
12   - */
  26 + */
13 27 class Session {
14 28  
15 29 /**
... ... @@ -36,7 +50,7 @@ class Session {
36 50  
37 51 // insert session information into db
38 52 $sql = $default->db;
39   - $query = "INSERT INTO $default->owl_sessions_table (session_id, user_id, lastused, ip) VALUES ('$sessionID', $iUserID, '" . date("Y-m-d H:i:s", time()) . "', '$ip')";
  53 + $query = "INSERT INTO $default->sessions_table (session_id, user_id, lastused, ip) VALUES ('$sessionID', $iUserID, '" . date("Y-m-d H:i:s", time()) . "', '$ip')";
40 54  
41 55 $result = $sql->query($query);
42 56 if(!$result) {
... ... @@ -58,7 +72,7 @@ class Session {
58 72  
59 73 // remove the session information from the database
60 74 $sql = $default->db;
61   - $query = "DELETE FROM $default->owl_sessions_table WHERE session_id = '$sSessionID' AND user_id=$iUserID";
  75 + $query = "DELETE FROM $default->sessions_table WHERE session_id = '$sSessionID' AND user_id=$iUserID";
62 76 $default->log->info("Session::destroy $query");
63 77 $sql->query($query);
64 78  
... ... @@ -77,7 +91,7 @@ class Session {
77 91 // deletes any sessions for this userID where the default timeout has elapsed.
78 92 $time = time() - $default->sessionTimeout;
79 93 $sql = $default->db;
80   - $sQuery = "DELETE FROM $default->owl_sessions_table WHERE " . (($userID != -1) ? "user_id=$userID AND " : "") . "lastused <= '" . formatDateTime($time) . "'";
  94 + $sQuery = "DELETE FROM $default->sessions_table WHERE " . (($userID != -1) ? "user_id=$userID AND " : "") . "lastused <= '" . formatDateTime($time) . "'";
81 95 $sql->query($sQuery);
82 96 }
83 97  
... ... @@ -97,7 +111,7 @@ class Session {
97 111  
98 112 // this should be an existing session, so check the db
99 113 $sql = $default->db;
100   - $sql->query("SELECT * FROM $default->owl_sessions_table WHERE session_id = '$sessionID'");
  114 + $sql->query("SELECT * FROM $default->sessions_table WHERE session_id = '$sessionID'");
101 115 $numrows = $sql->num_rows($sql);
102 116  
103 117 // FIXME: if there aren't more rows that the max sessions for this user
... ... @@ -123,7 +137,7 @@ class Session {
123 137 }
124 138  
125 139 // update last used timestamp
126   - $sql->query("UPDATE $default->owl_sessions_table SET lastused = '" . getCurrentDateTime() ."' " .
  140 + $sql->query("UPDATE $default->sessions_table SET lastused = '" . getCurrentDateTime() ."' " .
127 141 "WHERE user_id = $iUserID AND session_id = '$sessionID'");
128 142 // add the array to the session
129 143 $_SESSION["sessionStatus"] = $sessionStatus;
... ...
lib/session/SiteMap.inc
1 1 <?php
2   -
3   -require_once("$default->fileSystemRoot/lib/security/permission.inc");
4   -
  2 +require_once("$default->fileSystemRoot/lib/security/Permission.inc");
5 3 // define access constants
6 4 define("None", 1);
7 5 define("Guest", 2);
8 6 define("User", 3);
9 7 define("UnitAdmin", 4);
10 8 define("SysAdmin", 5);
11   -
12 9 /**
13 10 * $Id$
14   - *
  11 + *
15 12 * Maintains (page, access) access map, as well as (section, page) map.
16   - *
17   - * @version $Revision$
  13 + *
  14 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  15 + *
  16 + * This program is free software; you can redistribute it and/or modify
  17 + * it under the terms of the GNU General Public License as published by
  18 + * the Free Software Foundation; either version 2 of the License, or
  19 + * (at your option) any later version.
  20 + *
  21 + * This program is distributed in the hope that it will be useful,
  22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24 + * GNU General Public License for more details.
  25 + *
  26 + * You should have received a copy of the GNU General Public License
  27 + * along with this program; if not, write to the Free Software
  28 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29 + *
  30 + * @version $Revision$
18 31 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
19 32 * @package lib.session
20 33 */
... ... @@ -169,12 +182,12 @@ class SiteMap {
169 182 global $default, $lang_err_database, $fFolderID;
170 183 $sql = $default->db;
171 184 // lookup sectionID
172   - $sectionID = lookupID($default->owl_site_sections_table, "name", $sSectionName);
  185 + $sectionID = lookupID($default->site_sections_table, "name", $sSectionName);
173 186 if ($sectionID) {
174 187 // initialise result array
175 188 $results = array("descriptions" => array(), "links" => array());
176 189  
177   - if ($sql->query("SELECT link_text, action, access_id FROM $default->owl_sitemap_table WHERE section_id=$sectionID " .
  190 + if ($sql->query("SELECT link_text, action, access_id FROM $default->sitemap_table WHERE section_id=$sectionID " .
178 191 "AND is_enabled=1 AND is_default=0" . ( $bSortLinks ? " ORDER BY link_text ASC" : "" ) ) ) {
179 192 while ($sql->next_record()) {
180 193 // check permissions
... ... @@ -310,7 +323,7 @@ class SiteMap {
310 323 global $default, $lang_err_database;
311 324 $sql = $default->db;
312 325 // lookup the page and access_id from the sitemap
313   - if ($sql->query("SELECT page, access_id FROM $default->owl_sitemap_table WHERE action='$action'")) {
  326 + if ($sql->query("SELECT page, access_id FROM $default->sitemap_table WHERE action='$action'")) {
314 327 if ($sql->next_record()) {
315 328 // check permissions
316 329 if ($this->hasPermission($sql->f("access_id"))) {
... ... @@ -384,8 +397,8 @@ class SiteMap {
384 397 global $default, $lang_err_database;
385 398 $sql = $default->db;
386 399 // lookup the page and access_id from the sitemap
387   - if ($sql->query("SELECT SSL.name FROM $default->owl_sitemap_table AS S
388   - INNER JOIN $default->owl_site_sections_table AS SSL ON S.section_id=SSL.id
  400 + if ($sql->query("SELECT SSL.name FROM $default->sitemap_table AS S
  401 + INNER JOIN $default->site_sections_table AS SSL ON S.section_id=SSL.id
389 402 WHERE S.page='$sRequiredPage'")) {
390 403 if ($sql->next_record()) {
391 404 // return the section name
... ... @@ -446,10 +459,10 @@ class SiteMap {
446 459 global $default, $lang_err_database;
447 460 $sql = $default->db;
448 461 // lookup sectionID
449   - $sectionID = lookupID($default->owl_site_sections_table, "name", $sSectionName);
  462 + $sectionID = lookupID($default->site_sections_table, "name", $sSectionName);
450 463 if ($sectionID) {
451 464 // lookup the default action for the specified section
452   - if ($sql->query("SELECT action FROM $default->owl_sitemap_table
  465 + if ($sql->query("SELECT action FROM $default->sitemap_table
453 466 WHERE section_id=$sectionID
454 467 AND is_default=1 AND is_enabled=1")) {
455 468 if ($sql->next_record()) {
... ... @@ -527,7 +540,7 @@ class SiteMap {
527 540 $sql = $default->db;
528 541  
529 542 // lookup the action for the specified page
530   - if ($sql->query("SELECT action FROM $default->owl_sitemap_table WHERE page='$sPage'")) {
  543 + if ($sql->query("SELECT action FROM $default->sitemap_table WHERE page='$sPage'")) {
531 544 if ($sql->next_record()) {
532 545 // return the section name
533 546 return $sql->f("action");
... ... @@ -588,13 +601,13 @@ class SiteMap {
588 601 // only if we're using the array
589 602 if (!$this->bUseDB) {
590 603 // clear section table
591   - if ($sql->query("DELETE from $default->owl_site_sections_table")) {
  604 + if ($sql->query("DELETE from $default->site_sections_table")) {
592 605 $default->log->debug("Sitemap::syncWithDB removed sections");
593 606 } else {
594 607 $default->log->error("Sitemap::syncWithDB remove sections failed");
595 608 }
596 609 // clear sitemap table
597   - if ($sql->query("DELETE from $default->owl_sitemap_table")) {
  610 + if ($sql->query("DELETE from $default->sitemap_table")) {
598 611 $default->log->debug("Sitemap::syncWithDB removed sitemap");
599 612 } else {
600 613 $default->log->error("Sitemap::syncWithDB remove sitemap failed");
... ... @@ -602,7 +615,7 @@ class SiteMap {
602 615 // for each section
603 616 foreach ($this->aSiteMap as $section => $valArr) {
604 617 // insert into the section
605   - $sSectionSql = "INSERT INTO $default->owl_site_sections_table (name) VALUES ('$section')";
  618 + $sSectionSql = "INSERT INTO $default->site_sections_table (name) VALUES ('$section')";
606 619 $default->log->debug("Sitemap::syncWithDB insert=$sSectionSql");
607 620  
608 621 if ($sql->query($sSectionSql)) {
... ... @@ -616,7 +629,7 @@ class SiteMap {
616 629 foreach ($valArr as $requiredAccess => $pageArr) {
617 630 // now loop through all the pages
618 631 foreach ($pageArr as $action => $page) {
619   - $sSiteMapSql = "INSERT INTO $default->owl_sitemap_table (action, page, section_id, access_id, link_text, is_default, is_enabled) " .
  632 + $sSiteMapSql = "INSERT INTO $default->sitemap_table (action, page, section_id, access_id, link_text, is_default, is_enabled) " .
620 633 "VALUES ('$action', '" . $page["page"] . "', $sectionID, $requiredAccess, '" . $page["description"] . "', " . $page["default"] . ", " . $page["enabled"] . ")";
621 634 if ($sql->query($sSiteMapSql)) {
622 635 $default->log->debug("Sitemap::syncWithDb sitemap insert worked for ($action, " . $page["page"] . ")");
... ...
lib/session/control.inc
1 1 <?php
2   -
3 2 /**
4 3 * $Id$
5 4 *
6   - * Contains the controller helper functions
  5 + * Contains the controller helper functions.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
7 18 *
8   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9 22 *
10 23 * @version $Revision$
11 24 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
... ...
lib/subscriptions/Subscription.inc
... ... @@ -2,20 +2,31 @@
2 2 require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionConstants.inc");
3 3 require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
4 4 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
5   -
6 5 /**
7   - *
8 6 * $Id$
9   - *
  7 + *
10 8 * Represents a subscription.
11 9 *
12   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  10 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
13 11 *
14   - * @version $Revision$
15   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  12 + * This program is free software; you can redistribute it and/or modify
  13 + * it under the terms of the GNU General Public License as published by
  14 + * the Free Software Foundation; either version 2 of the License, or
  15 + * (at your option) any later version.
16 16 *
  17 + * This program is distributed in the hope that it will be useful,
  18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20 + * GNU General Public License for more details.
  21 + *
  22 + * You should have received a copy of the GNU General Public License
  23 + * along with this program; if not, write to the Free Software
  24 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25 + *
  26 + * @version $Revision$
  27 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
17 28 * @package lib.subscriptions
18   - */
  29 + */
19 30 class Subscription {
20 31  
21 32 /**
... ... @@ -354,9 +365,9 @@ class Subscription {
354 365 global $default;
355 366  
356 367 if ($iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) {
357   - return $default->owl_document_subscriptions_table;
  368 + return $default->document_subscriptions_table;
358 369 } else if($iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) {
359   - return $default->owl_folder_subscriptions_table;
  370 + return $default->folder_subscriptions_table;
360 371 }
361 372  
362 373 }
... ...
lib/subscriptions/SubscriptionConstants.inc
1 1 <?php
2 2 /**
3   - *
4 3 * $Id$
5   - *
  4 + *
6 5 * Holds all the subscription constants.
7 6 *
8   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9 8 *
10   - * @version $Revision$
11   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
12 18 *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22 + *
  23 + * @version $Revision$
  24 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
13 25 * @package lib.subscriptions
14   - */
  26 + */
15 27 class SubscriptionConstants {
16 28 /**
17 29 * Statically returns subscription types
... ...
lib/subscriptions/SubscriptionEngine.inc
... ... @@ -6,20 +6,31 @@ require_once(&quot;$default-&gt;fileSystemRoot/lib/subscriptions/Subscription.inc&quot;);
6 6 require_once("$default->fileSystemRoot/lib/alert/AlertContent.inc");
7 7 require_once("$default->fileSystemRoot/lib/alert/delivery/EmailAlert.inc");
8 8 require_once("$default->fileSystemRoot/lib/alert/delivery/SMSAlert.inc");
9   -
10 9 /**
11   - *
12 10 * $Id$
13   - *
  11 + *
14 12 * Facilitates firing subscription alerts.
15 13 *
16   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  14 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
17 15 *
18   - * @version $Revision$
19   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  16 + * This program is free software; you can redistribute it and/or modify
  17 + * it under the terms of the GNU General Public License as published by
  18 + * the Free Software Foundation; either version 2 of the License, or
  19 + * (at your option) any later version.
20 20 *
  21 + * This program is distributed in the hope that it will be useful,
  22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24 + * GNU General Public License for more details.
  25 + *
  26 + * You should have received a copy of the GNU General Public License
  27 + * along with this program; if not, write to the Free Software
  28 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29 + *
  30 + * @version $Revision$
  31 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
21 32 * @package lib.subscriptions
22   - */
  33 + */
23 34 class SubscriptionEngine {
24 35  
25 36 /**
... ...
lib/subscriptions/SubscriptionManager.inc
1 1 <?php
2 2 require_once("$default->fileSystemRoot/lib/subscriptions/Subscription.inc");
3   -
4 3 /**
5   - *
6 4 * $Id$
7   - *
  5 + *
8 6 * Facilitates adding and removing file and folder subscriptions.
9 7 *
10   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  8 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
11 9 *
12   - * @version $Revision$
13   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  10 + * This program is free software; you can redistribute it and/or modify
  11 + * it under the terms of the GNU General Public License as published by
  12 + * the Free Software Foundation; either version 2 of the License, or
  13 + * (at your option) any later version.
14 14 *
  15 + * This program is distributed in the hope that it will be useful,
  16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18 + * GNU General Public License for more details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program; if not, write to the Free Software
  22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23 + *
  24 + * @version $Revision$
  25 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
15 26 * @package lib.subscriptions
16   - */
  27 + */
17 28 class SubscriptionManager {
18 29  
19 30 /**
... ...
lib/unitmanagement/Unit.inc
1 1 <?php
2 2 /**
3   -* Class Unit
4   -* Represents a unit as per the database table units
5   -*
6   -* @author Mukhtar Dharsey
7   -* @date 28 January 2003
8   -* @package lib.unitmanagement
9   -*/
10   -
  3 + * $Id$
  4 + *
  5 + * Represents a unit as per the database table units.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22 + *
  23 + * @version $Revision$
  24 + * @author Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.unitmanagement
  26 + */
11 27 class Unit {
12 28  
13 29 /** object's primary key */
... ... @@ -64,7 +80,7 @@ class Unit {
64 80 //if the object hasn't been created
65 81 if ($this->iId < 0) { //check to see if name exsits
66 82 $sql = $default->db;
67   - $query = "SELECT name FROM ". $default->owl_units_table ." WHERE name = '" . $this->sName . "'";
  83 + $query = "SELECT name FROM ". $default->units_table ." WHERE name = '" . $this->sName . "'";
68 84 $sql->query($query);
69 85 $rows = $sql->num_rows($sql);
70 86  
... ... @@ -73,7 +89,7 @@ class Unit {
73 89 $_SESSION["errorMessage"] = "Unit::The name " . $this->sName . " is already in use!";
74 90 return false;
75 91 } else {
76   - $result = $sql->query("INSERT INTO " . $default->owl_units_table . " (name) VALUES ('" . addslashes($this->sName) . "')");
  92 + $result = $sql->query("INSERT INTO " . $default->units_table . " (name) VALUES ('" . addslashes($this->sName) . "')");
77 93 if ($result) {
78 94 $this->iId = $sql->insert_id();
79 95 // create a new unit root folder
... ... @@ -98,7 +114,7 @@ class Unit {
98 114 return false;
99 115 }
100 116 }
101   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_units_table";
  117 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->units_table";
102 118 return false;
103 119 }
104 120  
... ... @@ -114,8 +130,8 @@ class Unit {
114 130 if ($this->iId > 0) {
115 131 $sql = $default->db;
116 132 // lookup current name before updating
117   - $sOldName = lookupField($default->owl_units_table, "name", "id", $this->iId);
118   - $result = $sql->query("UPDATE " . $default->owl_units_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
  133 + $sOldName = lookupField($default->units_table, "name", "id", $this->iId);
  134 + $result = $sql->query("UPDATE " . $default->units_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
119 135 if ($result) {
120 136 // need to update the units root folder also
121 137 $iFolderID = Folder::getFolderID($sOldName);
... ... @@ -162,7 +178,7 @@ class Unit {
162 178 //only delete the object if it exists in the database
163 179 if ($this->iId >= 0) {
164 180 $sql = $default->db;
165   - if ($sql->query("DELETE FROM $default->owl_units_table WHERE id = $this->iId")) {
  181 + if ($sql->query("DELETE FROM $default->units_table WHERE id = $this->iId")) {
166 182 return true;
167 183 }
168 184 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -183,14 +199,14 @@ class Unit {
183 199 function & get($iUnitID) {
184 200 global $default;
185 201 $sql = $default->db;
186   - $result = $sql->query("SELECT * FROM $default->owl_units_table WHERE id = $iUnitID");
  202 + $result = $sql->query("SELECT * FROM $default->units_table WHERE id = $iUnitID");
187 203 if ($result) {
188 204 if ($sql->next_record()) {
189 205 $oUnit = & new Unit(stripslashes($sql->f("name")));
190 206 $oUnit->iId = $iUnitID;
191 207 return $oUnit;
192 208 }
193   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUnitID . " table = $default->owl_units_table";
  209 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUnitID . " table = $default->units_table";
194 210 return false;
195 211 }
196 212 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -204,7 +220,7 @@ class Unit {
204 220 global $default;
205 221 // check to see if group is linked to a unit
206 222 $sql = $default->db;
207   - $query = "SELECT unit_id FROM ". $default->owl_groups_units_table ." WHERE unit_id = " . $this->iId;
  223 + $query = "SELECT unit_id FROM ". $default->groups_units_table ." WHERE unit_id = " . $this->iId;
208 224 $sql->query($query);
209 225 if ($sql->num_rows($sql) > 0) {
210 226 return true;
... ... @@ -222,7 +238,7 @@ class Unit {
222 238 */
223 239 function getUnitID($name) {
224 240 global $default;
225   - $id = lookupID($default->owl_units_table, "name", $name);
  241 + $id = lookupID($default->units_table, "name", $name);
226 242 $this->iId= $id;
227 243 }
228 244  
... ... @@ -236,7 +252,7 @@ class Unit {
236 252 */
237 253 function getUnitName($id) {
238 254 global $default;
239   - $name = lookupField("$default->owl_units_table", "name", "id", $id );
  255 + $name = lookupField("$default->units_table", "name", "id", $id );
240 256 $this->sName= $name;
241 257 }
242 258  
... ... @@ -253,7 +269,7 @@ class Unit {
253 269 $aUnitArray;
254 270 settype($aUnitArray, "array");
255 271 $sql = $default->db;
256   - $result = $sql->query("SELECT * FROM " . $default->owl_units_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  272 + $result = $sql->query("SELECT * FROM " . $default->units_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
257 273 if ($result) {
258 274 $iCount = 0;
259 275 while ($sql->next_record()) {
... ...
lib/unitmanagement/UnitOrganisationLink.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class UnitOrganisationLink
5   -* Represents a unit, organisation link as per the database table units_organisations_link
6   -*
7   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
8   -* @date 20 January 2003
9   -* @package lib.groups
10   -*/
11   -
12   -
  3 + * $Id$
  4 + *
  5 + * Represents a unit, organisation link as per the database table units_organisations_link.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22 + *
  23 + * @version $Revision$
  24 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.unitmanagement
  26 + */
13 27 class UnitOrganisationLink {
14 28  
15 29 /** primary key of object */
... ... @@ -91,7 +105,7 @@ class UnitOrganisationLink {
91 105 if ($this->iId < 0) {
92 106  
93 107 $sql = $default->db;
94   - $query = "SELECT unit_id FROM $default->owl_units_organisations_table WHERE unit_id = $this->iUnitID AND organisation_id = $this->iOrgID";
  108 + $query = "SELECT unit_id FROM $default->units_organisations_table WHERE unit_id = $this->iUnitID AND organisation_id = $this->iOrgID";
95 109 $sql->query($query);
96 110 $rows = $sql->num_rows($sql);
97 111  
... ... @@ -100,7 +114,7 @@ class UnitOrganisationLink {
100 114 $_SESSION["errorMessage"] = "UnitOrganisationlink::The id " . $this->iUnitID . " is already exist!";
101 115 return false;
102 116 } else{
103   - $result = $sql->query("INSERT INTO " . $default->owl_units_organisations_table . " (unit_id,organisation_id) VALUES ($this->iUnitID,$this->iOrgID)");
  117 + $result = $sql->query("INSERT INTO " . $default->units_organisations_table . " (unit_id,organisation_id) VALUES ($this->iUnitID,$this->iOrgID)");
104 118 if ($result) {
105 119 $this->iId = $sql->insert_id();
106 120 return true;
... ... @@ -109,7 +123,6 @@ class UnitOrganisationLink {
109 123 return false;
110 124 }
111 125 }
112   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_units_organisations_link_table";
113 126 return false;
114 127 }
115 128  
... ... @@ -124,7 +137,7 @@ class UnitOrganisationLink {
124 137 //only update if the object has been stored
125 138 if ($this->iId > 0) {
126 139 $sql = $default->db;
127   - $result = $sql->query("UPDATE " . $default->owl_units_organisations_table . " SET organisation_id = $this->iOrgID, unit_id = $this->iUnitID WHERE id = $this->iId");
  140 + $result = $sql->query("UPDATE " . $default->units_organisations_table . " SET organisation_id = $this->iOrgID, unit_id = $this->iUnitID WHERE id = $this->iId");
128 141 if ($result) {
129 142 return true;
130 143 }
... ... @@ -146,7 +159,7 @@ class UnitOrganisationLink {
146 159 //only delete the object if it exists in the database
147 160 if ($this->iId >= 0) {
148 161 $sql = $default->db;
149   - $result = $sql->query("DELETE FROM $default->owl_units_organisations_table WHERE id = $this->iId");
  162 + $result = $sql->query("DELETE FROM $default->units_organisations_table WHERE id = $this->iId");
150 163 if ($result) {
151 164 return true;
152 165 }
... ... @@ -168,14 +181,13 @@ class UnitOrganisationLink {
168 181 function & get($iUnitOrganisationLinkID) {
169 182 global $default;
170 183 $sql = $default->db;
171   - $result = $sql->query("SELECT * FROM $default->owl_units_organisations_table WHERE id = $iUnitOrganisationLinkID");
  184 + $result = $sql->query("SELECT * FROM $default->units_organisations_table WHERE id = $iUnitOrganisationLinkID");
172 185 if ($result) {
173 186 if ($sql->next_record()) {
174 187 $oUnitOrganisationLink = & new UnitOrganisationLink($sql->f("unit_id"),$sql->f("organisation_id") );
175 188 $oUnitOrganisationLink->iId = $iUnitOrganisationLinkID;
176 189 return $oUnitOrganisationLink;
177 190 }
178   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUnitOrganisationLinkID . " table = $default->owl_units_organisations_link_table";
179 191 return false;
180 192 }
181 193 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -195,7 +207,7 @@ class UnitOrganisationLink {
195 207 $aUnitOrganisationLink;
196 208 settype($aUnitOrganisationLink, "array");
197 209 $sql = $default->db;
198   - $result = $sql->query("SELECT * FROM " . $default->owl_units_organisations_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  210 + $result = $sql->query("SELECT * FROM " . $default->units_organisations_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
199 211 if ($result) {
200 212 $iCount = 0;
201 213 while ($sql->next_record()) {
... ... @@ -218,7 +230,7 @@ class UnitOrganisationLink {
218 230 */
219 231 function unitBelongsToOrg($unitId) {
220 232 global $default;
221   - return lookupField("$default->owl_units_organisations_table", "organisation_id", "unit_id", $unitId );
  233 + return lookupField("$default->units_organisations_table", "organisation_id", "unit_id", $unitId );
222 234 }
223 235  
224 236 /*
... ... @@ -232,14 +244,14 @@ class UnitOrganisationLink {
232 244 */
233 245 function setUnitOrgID($unitId) {
234 246 global $default;
235   - $id = lookupID($default->owl_units_organisations_table, "unit_id", $unitId);
  247 + $id = lookupID($default->units_organisations_table, "unit_id", $unitId);
236 248 $this->iId= $id;
237 249 }
238 250  
239 251 function getByUnitID($unitId) {
240 252 global $default;
241 253 $sql = $default->db;
242   - $result = $sql->query("SELECT * FROM $default->owl_units_organisations_table WHERE unit_id = $unitId");
  254 + $result = $sql->query("SELECT * FROM $default->units_organisations_table WHERE unit_id = $unitId");
243 255 if ($result) {
244 256 if ($sql->next_record()) {
245 257 $oUnitOrganisationLink = & UnitOrganisationLink::get($sql->f("id"));
... ...
lib/users/User.inc
1 1 <?php
2 2 /**
3   -* Class User
4   -* Represents a user as per the users table in the database
5   -*
6   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
7   -* @date 20 January 2003
8   -* @package lib.user
9   -*/
10   -
  3 + * $Id$
  4 + *
  5 + * Represents a user as per the users table in the database.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22 + *
  23 + * @version $Revision$
  24 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.unitmanagement
  26 + */
11 27 class User {
12 28  
13 29 /** object primary key */
... ... @@ -297,7 +313,7 @@ class User {
297 313 if ($this->iId < 0) {
298 314 //check to see if name exsits
299 315 $sql = $default->db;
300   - $query = "SELECT username FROM ". $default->owl_users_table ." WHERE username = '" . $this->sUserName . "'";
  316 + $query = "SELECT username FROM ". $default->users_table ." WHERE username = '" . $this->sUserName . "'";
301 317 $sql->query($query);
302 318 $rows = $sql->num_rows($sql);
303 319  
... ... @@ -307,7 +323,7 @@ class User {
307 323 return false;
308 324 }
309 325 else {
310   - $result = $sql->query("INSERT INTO " . $default->owl_users_table . " (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id) " .
  326 + $result = $sql->query("INSERT INTO " . $default->users_table . " (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id) " .
311 327 "VALUES ('" . addslashes($this->sUserName) . "', '" . addslashes($this->sName) . "', '" . addslashes(md5($this->sPassword)) . "', $this->iQuotaMax, 0, '" . addslashes($this->sEmail) . "', '" . addslashes($this->sMobile) . "', " . ($this->bEmailNotification ? 1 : 0) . ", " . ($this->bSmsNotification ? 1 : 0) . ", '" . addslashes($this->sLdapDn) . "', $this->iMaxSessions, $this->iLanguageID)");
312 328 if ($result) {
313 329 $this->iId = $sql->insert_id();
... ... @@ -317,7 +333,7 @@ class User {
317 333 return false;
318 334 }
319 335 }
320   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_users_table";
  336 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->users_table";
321 337 return false;
322 338 }
323 339  
... ... @@ -333,7 +349,7 @@ class User {
333 349 if ($this->iId < 0) {
334 350 //check to see if name exsits
335 351 $sql = $default->db;
336   - $query = "SELECT username FROM ". $default->owl_users_table ." WHERE username = '" . $this->sUserName . "'";
  352 + $query = "SELECT username FROM ". $default->users_table ." WHERE username = '" . $this->sUserName . "'";
337 353 $sql->query($query);
338 354 $rows = $sql->num_rows($sql);
339 355  
... ... @@ -344,7 +360,7 @@ class User {
344 360 }
345 361 else {
346 362 $sql = $default->db;
347   - $result = $sql->query("UPDATE " . $default->owl_users_table . " SET username = '" . addslashes($this->sUserName) . "', name = '" . addslashes($this->sName) . "', " . ($this->bPasswordChanged ? "password = '" . addslashes(md5($this->sPassword)) . "', " : " ") . " quota_max = $this->iQuotaMax, email = '" . addslashes($this->sEmail) . "', mobile = '" . addslashes($this->sMobile) . "', email_notification = " . ($this->bEmailNotification ? 1 : 0) . ", sms_notification = " . ($this->bSmsNotification ? 1 : 0) . ", ldap_dn = '" . addslashes($this->sLdapDn) . "', max_sessions = $this->iMaxSessions, language_id = $this->iLanguageID WHERE id = $this->iId");
  363 + $result = $sql->query("UPDATE " . $default->users_table . " SET username = '" . addslashes($this->sUserName) . "', name = '" . addslashes($this->sName) . "', " . ($this->bPasswordChanged ? "password = '" . addslashes(md5($this->sPassword)) . "', " : " ") . " quota_max = $this->iQuotaMax, email = '" . addslashes($this->sEmail) . "', mobile = '" . addslashes($this->sMobile) . "', email_notification = " . ($this->bEmailNotification ? 1 : 0) . ", sms_notification = " . ($this->bSmsNotification ? 1 : 0) . ", ldap_dn = '" . addslashes($this->sLdapDn) . "', max_sessions = $this->iMaxSessions, language_id = $this->iLanguageID WHERE id = $this->iId");
348 364 if ($result) {
349 365 return true;
350 366 }
... ... @@ -367,7 +383,7 @@ class User {
367 383 //only delete the object if it exists in the database
368 384 if ($this->iId >= 0) {
369 385 $sql = $default->db;
370   - $result = $sql->query("DELETE FROM $default->owl_users_table WHERE id = $this->iId");
  386 + $result = $sql->query("DELETE FROM $default->users_table WHERE id = $this->iId");
371 387 if ($result) {
372 388 return true;
373 389 }
... ... @@ -390,7 +406,7 @@ class User {
390 406 //only delete the object if it exists in the database
391 407 if ($this->iId >= 0) {
392 408 $sql = $default->db;
393   - $result = $sql->query("DELETE FROM $default->owl_users_groups_table WHERE user_id = $this->iId");
  409 + $result = $sql->query("DELETE FROM $default->users_groups_table WHERE user_id = $this->iId");
394 410 if ($result) {
395 411 return true;
396 412 }
... ... @@ -411,14 +427,14 @@ class User {
411 427 function & get($iUserID) {
412 428 global $default;
413 429 $sql = $default->db;
414   - $result = $sql->query("SELECT * FROM $default->owl_users_table WHERE id = $iUserID");
  430 + $result = $sql->query("SELECT * FROM $default->users_table WHERE id = $iUserID");
415 431 if ($result) {
416 432 if ($sql->next_record()) {
417 433 $oUser = & new User(stripslashes($sql->f("username")), stripslashes($sql->f("name")), stripslashes($sql->f("password")), $sql->f("quota_max"), stripslashes($sql->f("email")), stripslashes($sql->f("mobile")), $sql->f("email_notification"), $sql->f("sms_notification"), $sql->f("ldap_dn"), $sql->f("max_sessions"), $sql->f("language_id"));
418 434 $oUser->iId = $iUserID;
419 435 return $oUser;
420 436 }
421   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUserID . " table = $default->owl_users_table";
  437 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUserID . " table = $default->users_table";
422 438 return false;
423 439 }
424 440 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -438,7 +454,7 @@ class User {
438 454 $aUserArray;
439 455 settype($aUserArray, "array");
440 456 $sql = $default->db;
441   - $result = $sql->query("SELECT * FROM " . $default->owl_users_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  457 + $result = $sql->query("SELECT * FROM " . $default->users_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
442 458 if ($result) {
443 459 $iCount = 0;
444 460 while ($sql->next_record()) {
... ... @@ -465,8 +481,8 @@ class User {
465 481 global $default, $lang_err_database;
466 482  
467 483 $sql = $default->db;
468   - $result = $sql->query("SELECT DISTINCT gul.unit_id FROM $default->owl_users_groups_table ugl " .
469   - "INNER JOIN $default->owl_groups_units_table gul ON ugl.group_id = gul.group_id ".
  484 + $result = $sql->query("SELECT DISTINCT gul.unit_id FROM $default->users_groups_table ugl " .
  485 + "INNER JOIN $default->groups_units_table gul ON ugl.group_id = gul.group_id ".
470 486 "WHERE ugl.user_id=$userID");
471 487 if ($result) {
472 488 if ($sql->next_record()) {
... ... @@ -487,7 +503,7 @@ class User {
487 503 function getUserID($sUsername) {
488 504 global $default;
489 505  
490   - $id = lookupID($default->owl_users_table, "username", $sUsername);
  506 + $id = lookupID($default->users_table, "username", $sUsername);
491 507  
492 508 $this->iId = $id;
493 509 }
... ... @@ -505,7 +521,7 @@ class User {
505 521 // if the user is in a unit, start at the unit's root folder
506 522  
507 523 // lookup the unit name
508   - $unitName = lookupField($default->owl_units_table, "name", "id", $unitID);
  524 + $unitName = lookupField($default->units_table, "name", "id", $unitID);
509 525  
510 526 // the unit root folder has the same name as the unit
511 527 // FIXME: dodgy i know, but its easy
... ... @@ -516,12 +532,12 @@ class User {
516 532  
517 533 if (!$aFolders) {
518 534 // no folder exists with this name, so start at the root
519   - $iFolderID = lookupID($default->owl_folders_table, "parent_id", 0);
  535 + $iFolderID = lookupID($default->folders_table, "parent_id", 0);
520 536 } else {
521 537 $iFolderID = $aFolders[0]->getID();
522 538 }
523 539 } else {
524   - $iFolderID = lookupID($default->owl_folders_table, "parent_id", 0);
  540 + $iFolderID = lookupID($default->folders_table, "parent_id", 0);
525 541 }
526 542 return $iFolderID;
527 543 }
... ... @@ -538,16 +554,16 @@ class User {
538 554 // then find the group that is unit_admin
539 555 $sql = $default->db;
540 556 $sEmail = "";
541   - if ($sql->query("SELECT group_id FROM $default->owl_groups_units_table GUL " .
542   - "INNER JOIN $default->owl_groups_table GL on GUL.group_id=GL.id " .
  557 + if ($sql->query("SELECT group_id FROM $default->groups_units_table GUL " .
  558 + "INNER JOIN $default->groups_table GL on GUL.group_id=GL.id " .
543 559 "WHERE GL.is_unit_admin=1 " .
544 560 "AND unit_id=$iUnitID")) {
545 561 // get the first record
546 562 if ($sql->next_record()) {
547 563 $iGroupID = $sql->f("group_id");
548 564 // then find the first user in this group that has an email address
549   - if ($sql->query("SELECT U.id, U.email FROM $default->owl_users_table U " .
550   - "INNER JOIN $default->owl_users_groups_table UGL on UGL.user_id=U.id " .
  565 + if ($sql->query("SELECT U.id, U.email FROM $default->users_table U " .
  566 + "INNER JOIN $default->users_groups_table UGL on UGL.user_id=U.id " .
551 567 "WHERE group_id=$iGroupID")) {
552 568 while ($sql->next_record()) {
553 569 if (strlen($sql->f("email")) > 0) {
... ...