From a30dcf95da168ef88682767cba038542b31e2e29 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 7 Aug 2003 15:37:39 +0000 Subject: [PATCH] added copyright and gpl notice removed owl prefix from table aliases --- lib/roles/Role.inc | 49 ++++++++++++++++++++++++++++++++----------------- lib/roles/RoleFolderLink.inc | 46 ++++++++++++++++++++++++++++++---------------- lib/session/Session.inc | 32 +++++++++++++++++++++++--------- lib/session/SiteMap.inc | 51 ++++++++++++++++++++++++++++++++------------------- lib/session/control.inc | 19 ++++++++++++++++--- lib/subscriptions/Subscription.inc | 29 ++++++++++++++++++++--------- lib/subscriptions/SubscriptionConstants.inc | 24 ++++++++++++++++++------ lib/subscriptions/SubscriptionEngine.inc | 25 ++++++++++++++++++------- lib/subscriptions/SubscriptionManager.inc | 25 ++++++++++++++++++------- lib/unitmanagement/Unit.inc | 56 ++++++++++++++++++++++++++++++++++++-------------------- lib/unitmanagement/UnitOrganisationLink.inc | 54 +++++++++++++++++++++++++++++++++--------------------- lib/users/User.inc | 72 ++++++++++++++++++++++++++++++++++++++++++++---------------------------- 12 files changed, 320 insertions(+), 162 deletions(-) diff --git a/lib/roles/Role.inc b/lib/roles/Role.inc index a1fac3a..60cb02a 100644 --- a/lib/roles/Role.inc +++ b/lib/roles/Role.inc @@ -1,14 +1,29 @@ iId < 0) { //check to see if name exsits $sql = $default->db; - $query = "SELECT name FROM ". $default->owl_roles_table ." WHERE name = '" . $this->sName . "'"; + $query = "SELECT name FROM ". $default->roles_table ." WHERE name = '" . $this->sName . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -98,7 +113,7 @@ class Role { }else { $sql = $default->db; - $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) . ")"); + $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) . ")"); if ($result) { $this->iId = $sql->insert_id(); return true; @@ -122,7 +137,7 @@ class Role { //only update if the object has been stored if ($this->iId > 0) { $sql = $default->db; - $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"); + $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"); if ($result) { return true; } @@ -145,7 +160,7 @@ class Role { if ($this->iId >= 0) { //check to see if role is linked to a folder $sql = $default->db; - $query = "SELECT role_id FROM ". $default->owl_groups_folders_approval_table ." WHERE role_id = '" . $this->iId . "'"; + $query = "SELECT role_id FROM ". $default->groups_folders_approval_table ." WHERE role_id = '" . $this->iId . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -156,7 +171,7 @@ class Role { }else{ $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_roles_table WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM $default->roles_table WHERE id = $this->iId"); if ($result) { return true; } @@ -179,7 +194,7 @@ class Role { function & get($iRoleID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_roles_table WHERE id = $iRoleID"); + $result = $sql->query("SELECT * FROM $default->roles_table WHERE id = $iRoleID"); if ($result) { if ($sql->next_record()) { $oRole = & new Role(stripslashes($sql->f("name")), $sql->f("can_read"), $sql->f("can_write")); @@ -187,7 +202,7 @@ class Role { $oRole->bActive = $sql->f("active"); return $oRole; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRoleID . " table = $default->owl_roles_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRoleID . " table = $default->roles_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -207,7 +222,7 @@ class Role { $aRoleArray; settype($aRoleArray, "array"); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); + $result = $sql->query("SELECT * FROM " . $default->roles_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); if ($result) { $iCount = 0; while ($sql->next_record()) { diff --git a/lib/roles/RoleFolderLink.inc b/lib/roles/RoleFolderLink.inc index ac2c72f..9331627 100644 --- a/lib/roles/RoleFolderLink.inc +++ b/lib/roles/RoleFolderLink.inc @@ -1,14 +1,29 @@ iId < 0) { $sql = $default->db; - $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) . ")"); + $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) . ")"); if ($result) { $this->iId = $sql->insert_id(); return true; @@ -170,7 +185,6 @@ class RoleFolderLink { $_SESSION["errorMessage"] = $lang_err_database; return false; } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_folder_user_roles_table"; return false; } @@ -185,7 +199,7 @@ class RoleFolderLink { //only update if the object has been stored if ($this->iId > 0) { $sql = $default->db; - $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"); + $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"); if ($result) { return true; } @@ -207,7 +221,7 @@ class RoleFolderLink { //only delete the object if it exists in the database if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_folders_user_roles_table WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM $default->folders_user_roles_table WHERE id = $this->iId"); if ($result) { return true; } @@ -229,7 +243,7 @@ class RoleFolderLink { function & get($iRolesFoldersID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_folders_user_roles_table WHERE id = $iRolesFoldersID"); + $result = $sql->query("SELECT * FROM $default->folders_user_roles_table WHERE id = $iRolesFoldersID"); if ($result) { if ($sql->next_record()) { $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 { $oRolesFoldersLink->iId = $iRolesFoldersID; return $oRolesFoldersLink; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRolesFoldersID . " table = $default->owl_folders_user_roles_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRolesFoldersID . " table = $default->folders_user_roles_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -258,7 +272,7 @@ class RoleFolderLink { $aRolesFoldersLinkArray; settype($aRolesFoldersLinkArray, "array"); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_folders_user_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); + $result = $sql->query("SELECT * FROM " . $default->folders_user_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); if ($result) { $iCount = 0; while ($sql->next_record()) { diff --git a/lib/session/Session.inc b/lib/session/Session.inc index 688cb93..5565540 100644 --- a/lib/session/Session.inc +++ b/lib/session/Session.inc @@ -2,14 +2,28 @@ /** * $Id$ * - * This class is used for session management. + * Session management class. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @version $Revision$ + * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package lib.session - */ + */ class Session { /** @@ -36,7 +50,7 @@ class Session { // insert session information into db $sql = $default->db; - $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')"; + $query = "INSERT INTO $default->sessions_table (session_id, user_id, lastused, ip) VALUES ('$sessionID', $iUserID, '" . date("Y-m-d H:i:s", time()) . "', '$ip')"; $result = $sql->query($query); if(!$result) { @@ -58,7 +72,7 @@ class Session { // remove the session information from the database $sql = $default->db; - $query = "DELETE FROM $default->owl_sessions_table WHERE session_id = '$sSessionID' AND user_id=$iUserID"; + $query = "DELETE FROM $default->sessions_table WHERE session_id = '$sSessionID' AND user_id=$iUserID"; $default->log->info("Session::destroy $query"); $sql->query($query); @@ -77,7 +91,7 @@ class Session { // deletes any sessions for this userID where the default timeout has elapsed. $time = time() - $default->sessionTimeout; $sql = $default->db; - $sQuery = "DELETE FROM $default->owl_sessions_table WHERE " . (($userID != -1) ? "user_id=$userID AND " : "") . "lastused <= '" . formatDateTime($time) . "'"; + $sQuery = "DELETE FROM $default->sessions_table WHERE " . (($userID != -1) ? "user_id=$userID AND " : "") . "lastused <= '" . formatDateTime($time) . "'"; $sql->query($sQuery); } @@ -97,7 +111,7 @@ class Session { // this should be an existing session, so check the db $sql = $default->db; - $sql->query("SELECT * FROM $default->owl_sessions_table WHERE session_id = '$sessionID'"); + $sql->query("SELECT * FROM $default->sessions_table WHERE session_id = '$sessionID'"); $numrows = $sql->num_rows($sql); // FIXME: if there aren't more rows that the max sessions for this user @@ -123,7 +137,7 @@ class Session { } // update last used timestamp - $sql->query("UPDATE $default->owl_sessions_table SET lastused = '" . getCurrentDateTime() ."' " . + $sql->query("UPDATE $default->sessions_table SET lastused = '" . getCurrentDateTime() ."' " . "WHERE user_id = $iUserID AND session_id = '$sessionID'"); // add the array to the session $_SESSION["sessionStatus"] = $sessionStatus; diff --git a/lib/session/SiteMap.inc b/lib/session/SiteMap.inc index 25be9ca..af1f4d7 100644 --- a/lib/session/SiteMap.inc +++ b/lib/session/SiteMap.inc @@ -1,20 +1,33 @@ fileSystemRoot/lib/security/permission.inc"); - +require_once("$default->fileSystemRoot/lib/security/Permission.inc"); // define access constants define("None", 1); define("Guest", 2); define("User", 3); define("UnitAdmin", 4); define("SysAdmin", 5); - /** * $Id$ - * + * * Maintains (page, access) access map, as well as (section, page) map. - * - * @version $Revision$ + * + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Revision$ * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package lib.session */ @@ -169,12 +182,12 @@ class SiteMap { global $default, $lang_err_database, $fFolderID; $sql = $default->db; // lookup sectionID - $sectionID = lookupID($default->owl_site_sections_table, "name", $sSectionName); + $sectionID = lookupID($default->site_sections_table, "name", $sSectionName); if ($sectionID) { // initialise result array $results = array("descriptions" => array(), "links" => array()); - if ($sql->query("SELECT link_text, action, access_id FROM $default->owl_sitemap_table WHERE section_id=$sectionID " . + if ($sql->query("SELECT link_text, action, access_id FROM $default->sitemap_table WHERE section_id=$sectionID " . "AND is_enabled=1 AND is_default=0" . ( $bSortLinks ? " ORDER BY link_text ASC" : "" ) ) ) { while ($sql->next_record()) { // check permissions @@ -310,7 +323,7 @@ class SiteMap { global $default, $lang_err_database; $sql = $default->db; // lookup the page and access_id from the sitemap - if ($sql->query("SELECT page, access_id FROM $default->owl_sitemap_table WHERE action='$action'")) { + if ($sql->query("SELECT page, access_id FROM $default->sitemap_table WHERE action='$action'")) { if ($sql->next_record()) { // check permissions if ($this->hasPermission($sql->f("access_id"))) { @@ -384,8 +397,8 @@ class SiteMap { global $default, $lang_err_database; $sql = $default->db; // lookup the page and access_id from the sitemap - if ($sql->query("SELECT SSL.name FROM $default->owl_sitemap_table AS S - INNER JOIN $default->owl_site_sections_table AS SSL ON S.section_id=SSL.id + if ($sql->query("SELECT SSL.name FROM $default->sitemap_table AS S + INNER JOIN $default->site_sections_table AS SSL ON S.section_id=SSL.id WHERE S.page='$sRequiredPage'")) { if ($sql->next_record()) { // return the section name @@ -446,10 +459,10 @@ class SiteMap { global $default, $lang_err_database; $sql = $default->db; // lookup sectionID - $sectionID = lookupID($default->owl_site_sections_table, "name", $sSectionName); + $sectionID = lookupID($default->site_sections_table, "name", $sSectionName); if ($sectionID) { // lookup the default action for the specified section - if ($sql->query("SELECT action FROM $default->owl_sitemap_table + if ($sql->query("SELECT action FROM $default->sitemap_table WHERE section_id=$sectionID AND is_default=1 AND is_enabled=1")) { if ($sql->next_record()) { @@ -527,7 +540,7 @@ class SiteMap { $sql = $default->db; // lookup the action for the specified page - if ($sql->query("SELECT action FROM $default->owl_sitemap_table WHERE page='$sPage'")) { + if ($sql->query("SELECT action FROM $default->sitemap_table WHERE page='$sPage'")) { if ($sql->next_record()) { // return the section name return $sql->f("action"); @@ -588,13 +601,13 @@ class SiteMap { // only if we're using the array if (!$this->bUseDB) { // clear section table - if ($sql->query("DELETE from $default->owl_site_sections_table")) { + if ($sql->query("DELETE from $default->site_sections_table")) { $default->log->debug("Sitemap::syncWithDB removed sections"); } else { $default->log->error("Sitemap::syncWithDB remove sections failed"); } // clear sitemap table - if ($sql->query("DELETE from $default->owl_sitemap_table")) { + if ($sql->query("DELETE from $default->sitemap_table")) { $default->log->debug("Sitemap::syncWithDB removed sitemap"); } else { $default->log->error("Sitemap::syncWithDB remove sitemap failed"); @@ -602,7 +615,7 @@ class SiteMap { // for each section foreach ($this->aSiteMap as $section => $valArr) { // insert into the section - $sSectionSql = "INSERT INTO $default->owl_site_sections_table (name) VALUES ('$section')"; + $sSectionSql = "INSERT INTO $default->site_sections_table (name) VALUES ('$section')"; $default->log->debug("Sitemap::syncWithDB insert=$sSectionSql"); if ($sql->query($sSectionSql)) { @@ -616,7 +629,7 @@ class SiteMap { foreach ($valArr as $requiredAccess => $pageArr) { // now loop through all the pages foreach ($pageArr as $action => $page) { - $sSiteMapSql = "INSERT INTO $default->owl_sitemap_table (action, page, section_id, access_id, link_text, is_default, is_enabled) " . + $sSiteMapSql = "INSERT INTO $default->sitemap_table (action, page, section_id, access_id, link_text, is_default, is_enabled) " . "VALUES ('$action', '" . $page["page"] . "', $sectionID, $requiredAccess, '" . $page["description"] . "', " . $page["default"] . ", " . $page["enabled"] . ")"; if ($sql->query($sSiteMapSql)) { $default->log->debug("Sitemap::syncWithDb sitemap insert worked for ($action, " . $page["page"] . ")"); diff --git a/lib/session/control.inc b/lib/session/control.inc index 9d5eae4..62349ff 100644 --- a/lib/session/control.inc +++ b/lib/session/control.inc @@ -1,11 +1,24 @@ , Jam Warehouse (Pty) Ltd, South Africa diff --git a/lib/subscriptions/Subscription.inc b/lib/subscriptions/Subscription.inc index d74dc07..331aee4 100644 --- a/lib/subscriptions/Subscription.inc +++ b/lib/subscriptions/Subscription.inc @@ -2,20 +2,31 @@ require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionConstants.inc"); require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); - /** - * * $Id$ - * + * * Represents a subscription. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com * - * @version $Revision$ - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Revision$ + * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package lib.subscriptions - */ + */ class Subscription { /** @@ -354,9 +365,9 @@ class Subscription { global $default; if ($iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { - return $default->owl_document_subscriptions_table; + return $default->document_subscriptions_table; } else if($iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) { - return $default->owl_folder_subscriptions_table; + return $default->folder_subscriptions_table; } } diff --git a/lib/subscriptions/SubscriptionConstants.inc b/lib/subscriptions/SubscriptionConstants.inc index 27e7b7f..7d33609 100644 --- a/lib/subscriptions/SubscriptionConstants.inc +++ b/lib/subscriptions/SubscriptionConstants.inc @@ -1,17 +1,29 @@ , Jam Warehouse (Pty) Ltd, South Africa + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Revision$ + * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package lib.subscriptions - */ + */ class SubscriptionConstants { /** * Statically returns subscription types diff --git a/lib/subscriptions/SubscriptionEngine.inc b/lib/subscriptions/SubscriptionEngine.inc index 046625c..164382d 100644 --- a/lib/subscriptions/SubscriptionEngine.inc +++ b/lib/subscriptions/SubscriptionEngine.inc @@ -6,20 +6,31 @@ require_once("$default->fileSystemRoot/lib/subscriptions/Subscription.inc"); require_once("$default->fileSystemRoot/lib/alert/AlertContent.inc"); require_once("$default->fileSystemRoot/lib/alert/delivery/EmailAlert.inc"); require_once("$default->fileSystemRoot/lib/alert/delivery/SMSAlert.inc"); - /** - * * $Id$ - * + * * Facilitates firing subscription alerts. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com * - * @version $Revision$ - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Revision$ + * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package lib.subscriptions - */ + */ class SubscriptionEngine { /** diff --git a/lib/subscriptions/SubscriptionManager.inc b/lib/subscriptions/SubscriptionManager.inc index 0927a92..67d1ee5 100644 --- a/lib/subscriptions/SubscriptionManager.inc +++ b/lib/subscriptions/SubscriptionManager.inc @@ -1,19 +1,30 @@ fileSystemRoot/lib/subscriptions/Subscription.inc"); - /** - * * $Id$ - * + * * Facilitates adding and removing file and folder subscriptions. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com * - * @version $Revision$ - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Revision$ + * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package lib.subscriptions - */ + */ class SubscriptionManager { /** diff --git a/lib/unitmanagement/Unit.inc b/lib/unitmanagement/Unit.inc index 5dac7fd..f8bd629 100644 --- a/lib/unitmanagement/Unit.inc +++ b/lib/unitmanagement/Unit.inc @@ -1,13 +1,29 @@ iId < 0) { //check to see if name exsits $sql = $default->db; - $query = "SELECT name FROM ". $default->owl_units_table ." WHERE name = '" . $this->sName . "'"; + $query = "SELECT name FROM ". $default->units_table ." WHERE name = '" . $this->sName . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -73,7 +89,7 @@ class Unit { $_SESSION["errorMessage"] = "Unit::The name " . $this->sName . " is already in use!"; return false; } else { - $result = $sql->query("INSERT INTO " . $default->owl_units_table . " (name) VALUES ('" . addslashes($this->sName) . "')"); + $result = $sql->query("INSERT INTO " . $default->units_table . " (name) VALUES ('" . addslashes($this->sName) . "')"); if ($result) { $this->iId = $sql->insert_id(); // create a new unit root folder @@ -98,7 +114,7 @@ class Unit { return false; } } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_units_table"; + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->units_table"; return false; } @@ -114,8 +130,8 @@ class Unit { if ($this->iId > 0) { $sql = $default->db; // lookup current name before updating - $sOldName = lookupField($default->owl_units_table, "name", "id", $this->iId); - $result = $sql->query("UPDATE " . $default->owl_units_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); + $sOldName = lookupField($default->units_table, "name", "id", $this->iId); + $result = $sql->query("UPDATE " . $default->units_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); if ($result) { // need to update the units root folder also $iFolderID = Folder::getFolderID($sOldName); @@ -162,7 +178,7 @@ class Unit { //only delete the object if it exists in the database if ($this->iId >= 0) { $sql = $default->db; - if ($sql->query("DELETE FROM $default->owl_units_table WHERE id = $this->iId")) { + if ($sql->query("DELETE FROM $default->units_table WHERE id = $this->iId")) { return true; } $_SESSION["errorMessage"] = $lang_err_database; @@ -183,14 +199,14 @@ class Unit { function & get($iUnitID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_units_table WHERE id = $iUnitID"); + $result = $sql->query("SELECT * FROM $default->units_table WHERE id = $iUnitID"); if ($result) { if ($sql->next_record()) { $oUnit = & new Unit(stripslashes($sql->f("name"))); $oUnit->iId = $iUnitID; return $oUnit; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUnitID . " table = $default->owl_units_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUnitID . " table = $default->units_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -204,7 +220,7 @@ class Unit { global $default; // check to see if group is linked to a unit $sql = $default->db; - $query = "SELECT unit_id FROM ". $default->owl_groups_units_table ." WHERE unit_id = " . $this->iId; + $query = "SELECT unit_id FROM ". $default->groups_units_table ." WHERE unit_id = " . $this->iId; $sql->query($query); if ($sql->num_rows($sql) > 0) { return true; @@ -222,7 +238,7 @@ class Unit { */ function getUnitID($name) { global $default; - $id = lookupID($default->owl_units_table, "name", $name); + $id = lookupID($default->units_table, "name", $name); $this->iId= $id; } @@ -236,7 +252,7 @@ class Unit { */ function getUnitName($id) { global $default; - $name = lookupField("$default->owl_units_table", "name", "id", $id ); + $name = lookupField("$default->units_table", "name", "id", $id ); $this->sName= $name; } @@ -253,7 +269,7 @@ class Unit { $aUnitArray; settype($aUnitArray, "array"); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_units_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); + $result = $sql->query("SELECT * FROM " . $default->units_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); if ($result) { $iCount = 0; while ($sql->next_record()) { diff --git a/lib/unitmanagement/UnitOrganisationLink.inc b/lib/unitmanagement/UnitOrganisationLink.inc index 5a0e736..18aa6e8 100644 --- a/lib/unitmanagement/UnitOrganisationLink.inc +++ b/lib/unitmanagement/UnitOrganisationLink.inc @@ -1,15 +1,29 @@ iId < 0) { $sql = $default->db; - $query = "SELECT unit_id FROM $default->owl_units_organisations_table WHERE unit_id = $this->iUnitID AND organisation_id = $this->iOrgID"; + $query = "SELECT unit_id FROM $default->units_organisations_table WHERE unit_id = $this->iUnitID AND organisation_id = $this->iOrgID"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -100,7 +114,7 @@ class UnitOrganisationLink { $_SESSION["errorMessage"] = "UnitOrganisationlink::The id " . $this->iUnitID . " is already exist!"; return false; } else{ - $result = $sql->query("INSERT INTO " . $default->owl_units_organisations_table . " (unit_id,organisation_id) VALUES ($this->iUnitID,$this->iOrgID)"); + $result = $sql->query("INSERT INTO " . $default->units_organisations_table . " (unit_id,organisation_id) VALUES ($this->iUnitID,$this->iOrgID)"); if ($result) { $this->iId = $sql->insert_id(); return true; @@ -109,7 +123,6 @@ class UnitOrganisationLink { return false; } } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_units_organisations_link_table"; return false; } @@ -124,7 +137,7 @@ class UnitOrganisationLink { //only update if the object has been stored if ($this->iId > 0) { $sql = $default->db; - $result = $sql->query("UPDATE " . $default->owl_units_organisations_table . " SET organisation_id = $this->iOrgID, unit_id = $this->iUnitID WHERE id = $this->iId"); + $result = $sql->query("UPDATE " . $default->units_organisations_table . " SET organisation_id = $this->iOrgID, unit_id = $this->iUnitID WHERE id = $this->iId"); if ($result) { return true; } @@ -146,7 +159,7 @@ class UnitOrganisationLink { //only delete the object if it exists in the database if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_units_organisations_table WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM $default->units_organisations_table WHERE id = $this->iId"); if ($result) { return true; } @@ -168,14 +181,13 @@ class UnitOrganisationLink { function & get($iUnitOrganisationLinkID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_units_organisations_table WHERE id = $iUnitOrganisationLinkID"); + $result = $sql->query("SELECT * FROM $default->units_organisations_table WHERE id = $iUnitOrganisationLinkID"); if ($result) { if ($sql->next_record()) { $oUnitOrganisationLink = & new UnitOrganisationLink($sql->f("unit_id"),$sql->f("organisation_id") ); $oUnitOrganisationLink->iId = $iUnitOrganisationLinkID; return $oUnitOrganisationLink; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUnitOrganisationLinkID . " table = $default->owl_units_organisations_link_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -195,7 +207,7 @@ class UnitOrganisationLink { $aUnitOrganisationLink; settype($aUnitOrganisationLink, "array"); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_units_organisations_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); + $result = $sql->query("SELECT * FROM " . $default->units_organisations_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); if ($result) { $iCount = 0; while ($sql->next_record()) { @@ -218,7 +230,7 @@ class UnitOrganisationLink { */ function unitBelongsToOrg($unitId) { global $default; - return lookupField("$default->owl_units_organisations_table", "organisation_id", "unit_id", $unitId ); + return lookupField("$default->units_organisations_table", "organisation_id", "unit_id", $unitId ); } /* @@ -232,14 +244,14 @@ class UnitOrganisationLink { */ function setUnitOrgID($unitId) { global $default; - $id = lookupID($default->owl_units_organisations_table, "unit_id", $unitId); + $id = lookupID($default->units_organisations_table, "unit_id", $unitId); $this->iId= $id; } function getByUnitID($unitId) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_units_organisations_table WHERE unit_id = $unitId"); + $result = $sql->query("SELECT * FROM $default->units_organisations_table WHERE unit_id = $unitId"); if ($result) { if ($sql->next_record()) { $oUnitOrganisationLink = & UnitOrganisationLink::get($sql->f("id")); diff --git a/lib/users/User.inc b/lib/users/User.inc index 30fe0ce..621a100 100644 --- a/lib/users/User.inc +++ b/lib/users/User.inc @@ -1,13 +1,29 @@ iId < 0) { //check to see if name exsits $sql = $default->db; - $query = "SELECT username FROM ". $default->owl_users_table ." WHERE username = '" . $this->sUserName . "'"; + $query = "SELECT username FROM ". $default->users_table ." WHERE username = '" . $this->sUserName . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -307,7 +323,7 @@ class User { return false; } else { - $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) " . + $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) " . "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)"); if ($result) { $this->iId = $sql->insert_id(); @@ -317,7 +333,7 @@ class User { return false; } } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_users_table"; + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->users_table"; return false; } @@ -333,7 +349,7 @@ class User { if ($this->iId < 0) { //check to see if name exsits $sql = $default->db; - $query = "SELECT username FROM ". $default->owl_users_table ." WHERE username = '" . $this->sUserName . "'"; + $query = "SELECT username FROM ". $default->users_table ." WHERE username = '" . $this->sUserName . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -344,7 +360,7 @@ class User { } else { $sql = $default->db; - $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"); + $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"); if ($result) { return true; } @@ -367,7 +383,7 @@ class User { //only delete the object if it exists in the database if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_users_table WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM $default->users_table WHERE id = $this->iId"); if ($result) { return true; } @@ -390,7 +406,7 @@ class User { //only delete the object if it exists in the database if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_users_groups_table WHERE user_id = $this->iId"); + $result = $sql->query("DELETE FROM $default->users_groups_table WHERE user_id = $this->iId"); if ($result) { return true; } @@ -411,14 +427,14 @@ class User { function & get($iUserID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_users_table WHERE id = $iUserID"); + $result = $sql->query("SELECT * FROM $default->users_table WHERE id = $iUserID"); if ($result) { if ($sql->next_record()) { $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")); $oUser->iId = $iUserID; return $oUser; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUserID . " table = $default->owl_users_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iUserID . " table = $default->users_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -438,7 +454,7 @@ class User { $aUserArray; settype($aUserArray, "array"); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_users_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); + $result = $sql->query("SELECT * FROM " . $default->users_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); if ($result) { $iCount = 0; while ($sql->next_record()) { @@ -465,8 +481,8 @@ class User { global $default, $lang_err_database; $sql = $default->db; - $result = $sql->query("SELECT DISTINCT gul.unit_id FROM $default->owl_users_groups_table ugl " . - "INNER JOIN $default->owl_groups_units_table gul ON ugl.group_id = gul.group_id ". + $result = $sql->query("SELECT DISTINCT gul.unit_id FROM $default->users_groups_table ugl " . + "INNER JOIN $default->groups_units_table gul ON ugl.group_id = gul.group_id ". "WHERE ugl.user_id=$userID"); if ($result) { if ($sql->next_record()) { @@ -487,7 +503,7 @@ class User { function getUserID($sUsername) { global $default; - $id = lookupID($default->owl_users_table, "username", $sUsername); + $id = lookupID($default->users_table, "username", $sUsername); $this->iId = $id; } @@ -505,7 +521,7 @@ class User { // if the user is in a unit, start at the unit's root folder // lookup the unit name - $unitName = lookupField($default->owl_units_table, "name", "id", $unitID); + $unitName = lookupField($default->units_table, "name", "id", $unitID); // the unit root folder has the same name as the unit // FIXME: dodgy i know, but its easy @@ -516,12 +532,12 @@ class User { if (!$aFolders) { // no folder exists with this name, so start at the root - $iFolderID = lookupID($default->owl_folders_table, "parent_id", 0); + $iFolderID = lookupID($default->folders_table, "parent_id", 0); } else { $iFolderID = $aFolders[0]->getID(); } } else { - $iFolderID = lookupID($default->owl_folders_table, "parent_id", 0); + $iFolderID = lookupID($default->folders_table, "parent_id", 0); } return $iFolderID; } @@ -538,16 +554,16 @@ class User { // then find the group that is unit_admin $sql = $default->db; $sEmail = ""; - if ($sql->query("SELECT group_id FROM $default->owl_groups_units_table GUL " . - "INNER JOIN $default->owl_groups_table GL on GUL.group_id=GL.id " . + if ($sql->query("SELECT group_id FROM $default->groups_units_table GUL " . + "INNER JOIN $default->groups_table GL on GUL.group_id=GL.id " . "WHERE GL.is_unit_admin=1 " . "AND unit_id=$iUnitID")) { // get the first record if ($sql->next_record()) { $iGroupID = $sql->f("group_id"); // then find the first user in this group that has an email address - if ($sql->query("SELECT U.id, U.email FROM $default->owl_users_table U " . - "INNER JOIN $default->owl_users_groups_table UGL on UGL.user_id=U.id " . + if ($sql->query("SELECT U.id, U.email FROM $default->users_table U " . + "INNER JOIN $default->users_groups_table UGL on UGL.user_id=U.id " . "WHERE group_id=$iGroupID")) { while ($sql->next_record()) { if (strlen($sql->f("email")) > 0) { -- libgit2 0.21.4