Commit 46e717e3157c44d8c8dde789b8bdf6d9dc2bb797

Authored by Michael Joseph
1 parent e0bddae7

changed all references to Owl_DB to $default->db

renamed Owl_DB to Database


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@683 c91229c3-7414-0410-bfa2-8a42b809f60b
config/dmsDefaults.php
@@ -187,13 +187,19 @@ $default->siteMap->addPage("scratchPad", "/tests/scratchPad.php", "Tests", Guest @@ -187,13 +187,19 @@ $default->siteMap->addPage("scratchPad", "/tests/scratchPad.php", "Tests", Guest
187 $default->siteMap->addPage("sitemap", "/tests/session/SiteMap.php", "Tests", Guest, "sitemap", false); 187 $default->siteMap->addPage("sitemap", "/tests/session/SiteMap.php", "Tests", Guest, "sitemap", false);
188 $default->siteMap->addPage("documentBrowserTest", "/tests/documentmanagement/DocumentBrowser.php", "Tests", Guest, "test the document browser", false); 188 $default->siteMap->addPage("documentBrowserTest", "/tests/documentmanagement/DocumentBrowser.php", "Tests", Guest, "test the document browser", false);
189 189
  190 +
  191 +
190 // default requires 192 // default requires
191 require_once("$default->owl_fs_root/phpmailer/class.phpmailer.php"); 193 require_once("$default->owl_fs_root/phpmailer/class.phpmailer.php");
192 require_once("$default->owl_fs_root/lib/session/Session.inc"); 194 require_once("$default->owl_fs_root/lib/session/Session.inc");
193 require_once("$default->owl_fs_root/lib/session/control.inc"); 195 require_once("$default->owl_fs_root/lib/session/control.inc");
194 require_once("$default->owl_fs_root/lib/database/db.inc"); 196 require_once("$default->owl_fs_root/lib/database/db.inc");
195 require_once("$default->owl_fs_root/lib/database/lookup.inc"); 197 require_once("$default->owl_fs_root/lib/database/lookup.inc");
196 -require_once("$default->owl_fs_root/lib/dms.inc");  
197 198
198 // single db instantiation 199 // single db instantiation
  200 +$default->db = new Database();
  201 +
  202 +// import request variables and setup language
  203 +require_once("$default->owl_fs_root/lib/dms.inc");
  204 +
199 ?> 205 ?>
lib/DefaultLookup.inc
@@ -68,7 +68,7 @@ class DefaultLookup { @@ -68,7 +68,7 @@ class DefaultLookup {
68 global $lang_err_database, $lang_err_object_exists; 68 global $lang_err_database, $lang_err_object_exists;
69 //don't create the object if it's aready been created 69 //don't create the object if it's aready been created
70 if ($this->iId < 0) { 70 if ($this->iId < 0) {
71 - $sql = new Owl_DB(); 71 + $sql = $default->db;
72 $result = $sql->query("INSERT INTO $this->sTableName (name) VALUES ( '". addslashes($this->sName) . "')"); 72 $result = $sql->query("INSERT INTO $this->sTableName (name) VALUES ( '". addslashes($this->sName) . "')");
73 if ($result) { 73 if ($result) {
74 //set the primary key; 74 //set the primary key;
@@ -92,7 +92,7 @@ class DefaultLookup { @@ -92,7 +92,7 @@ class DefaultLookup {
92 global $lang_err_database, $lang_err_object_key; 92 global $lang_err_database, $lang_err_object_key;
93 //can only update if the object has been stored 93 //can only update if the object has been stored
94 if ($this->iId >= 0) { 94 if ($this->iId >= 0) {
95 - $sql = new Owl_DB(); 95 + $sql = $default->db;
96 $result = $sql->query("UPDATE $this->sTableName SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); 96 $result = $sql->query("UPDATE $this->sTableName SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
97 if ($result) { 97 if ($result) {
98 return true; 98 return true;
@@ -114,7 +114,7 @@ class DefaultLookup { @@ -114,7 +114,7 @@ class DefaultLookup {
114 global $lang_err_database, $lang_err_object_not_exist; 114 global $lang_err_database, $lang_err_object_not_exist;
115 //can only delete and object if it has been stored already 115 //can only delete and object if it has been stored already
116 if ($this->iId >= 0) { 116 if ($this->iId >= 0) {
117 - $sql = new Owl_DB(); 117 + $sql = $default->db;
118 $result = $sql->query("DELETE FROM $this->sTableName WHERE id = $this->iId"); 118 $result = $sql->query("DELETE FROM $this->sTableName WHERE id = $this->iId");
119 if ($result) { 119 if ($result) {
120 //reset the primary key 120 //reset the primary key
@@ -139,7 +139,7 @@ class DefaultLookup { @@ -139,7 +139,7 @@ class DefaultLookup {
139 * @return Lookup lookup object populated with relevant values 139 * @return Lookup lookup object populated with relevant values
140 */ 140 */
141 function & get($sTableName, $iId) { 141 function & get($sTableName, $iId) {
142 - $sql = new Owl_DB(); 142 + $sql = $default->db;
143 $result = $sql->query("SELECT * FROM $sTableName WHERE id = $iId"); 143 $result = $sql->query("SELECT * FROM $sTableName WHERE id = $iId");
144 if ($result) { 144 if ($result) {
145 if ($sql->next_record()) { 145 if ($sql->next_record()) {
lib/authentication/Authenticator.inc
@@ -39,7 +39,7 @@ class Authenticator { @@ -39,7 +39,7 @@ class Authenticator {
39 // Check if Maxsessions has been reached 39 // Check if Maxsessions has been reached
40 // lookup maxsessions 40 // lookup maxsessions
41 $maxSessions = lookupField($default->owl_users_table, "max_sessions", "id", $userID); 41 $maxSessions = lookupField($default->owl_users_table, "max_sessions", "id", $userID);
42 - $sql = new Owl_DB; 42 + $sql = $default->db;
43 if ($sql->query("SELECT * FROM $default->owl_sessions_table WHERE user_id = '".$userDetails["user_id"]."'")) { 43 if ($sql->query("SELECT * FROM $default->owl_sessions_table WHERE user_id = '".$userDetails["user_id"]."'")) {
44 if ($sql->num_rows($sql) >= $maxSessions) { 44 if ($sql->num_rows($sql) >= $maxSessions) {
45 // return too many sessions status code 45 // return too many sessions status code
lib/authentication/DBAuthenticator.inc
@@ -26,7 +26,7 @@ class DBAuthenticator extends Authenticator { @@ -26,7 +26,7 @@ class DBAuthenticator extends Authenticator {
26 function checkPassword($userName, $password) { 26 function checkPassword($userName, $password) {
27 global $default; 27 global $default;
28 28
29 - $sql = new Owl_DB; 29 + $sql = $default->db;
30 $query = "select * from $default->owl_users_table where username = '$userName' and password = '" . md5($password) . "'"; 30 $query = "select * from $default->owl_users_table where username = '$userName' and password = '" . md5($password) . "'";
31 $sql->query($query); 31 $sql->query($query);
32 $numrows = $sql->num_rows($sql); 32 $numrows = $sql->num_rows($sql);
lib/database/db.inc
@@ -20,10 +20,10 @@ @@ -20,10 +20,10 @@
20 * @version v 1.1.1.1 2002/12/04 20 * @version v 1.1.1.1 2002/12/04
21 * @author michael 21 * @author michael
22 */ 22 */
23 -class Owl_DB extends DB_Sql { 23 +class Database extends DB_Sql {
24 24
25 /** Class name */ 25 /** Class name */
26 - var $classname = "Owl_DB"; 26 + var $classname = "Database";
27 27
28 // BEGIN wes changes -- moved these settings to config/owl.php 28 // BEGIN wes changes -- moved these settings to config/owl.php
29 // Server where the database resides 29 // Server where the database resides
@@ -46,7 +46,7 @@ class Owl_DB extends DB_Sql { @@ -46,7 +46,7 @@ class Owl_DB extends DB_Sql {
46 var $sLastOrderByClause; 46 var $sLastOrderByClause;
47 47
48 /** Default Constructor */ 48 /** Default Constructor */
49 - function Owl_DB() { 49 + function Database() {
50 global $default; 50 global $default;
51 $this->Host = $default->owl_db_host; 51 $this->Host = $default->owl_db_host;
52 $this->Database = $default->owl_db_name; 52 $this->Database = $default->owl_db_name;
lib/database/lookup.inc
@@ -34,7 +34,7 @@ function lookupGroupIDs($userID) { @@ -34,7 +34,7 @@ function lookupGroupIDs($userID) {
34 global $default; 34 global $default;
35 $groupIDs = array(); 35 $groupIDs = array();
36 36
37 - $sql = new Owl_DB; 37 + $sql = $default->db;
38 $sql->query("select group_id from $default->owl_users_groups_table where user_id = '$userID'"); 38 $sql->query("select group_id from $default->owl_users_groups_table where user_id = '$userID'");
39 while($sql->next_record()) { 39 while($sql->next_record()) {
40 $groupIDs[] = $sql->f("group_id"); 40 $groupIDs[] = $sql->f("group_id");
@@ -52,7 +52,7 @@ function lookupGroupIDs($userID) { @@ -52,7 +52,7 @@ function lookupGroupIDs($userID) {
52 */ 52 */
53 function lookupField($tableName, $selectFieldName, $whereFieldName, $whereFieldValue) { 53 function lookupField($tableName, $selectFieldName, $whereFieldName, $whereFieldValue) {
54 global $default; 54 global $default;
55 - $sql = new Owl_DB(); 55 + $sql = $default->db;
56 $query = "select $selectFieldName from $tableName where $whereFieldName = '". $whereFieldValue . "'" ; 56 $query = "select $selectFieldName from $tableName where $whereFieldName = '". $whereFieldValue . "'" ;
57 57
58 if ($sql->query($query)) { 58 if ($sql->query($query)) {
lib/dms.inc
@@ -52,7 +52,7 @@ if(isset($default-&gt;owl_lang)) { @@ -52,7 +52,7 @@ if(isset($default-&gt;owl_lang)) {
52 die("$lang_err_lang_1 $langdir $lang_err_lang_2"); 52 die("$lang_err_lang_1 $langdir $lang_err_lang_2");
53 } else { 53 } else {
54 54
55 - $sql = new Owl_DB; 55 + $sql = $default->db;
56 $sql->query("select * from $default->owl_sessions_table where id = '" . session_id() . "'"); 56 $sql->query("select * from $default->owl_sessions_table where id = '" . session_id() . "'");
57 $sql->next_record(); 57 $sql->next_record();
58 $numrows = $sql->num_rows($sql); 58 $numrows = $sql->num_rows($sql);
lib/documentmanagement/Document.inc
@@ -201,7 +201,7 @@ class Document { @@ -201,7 +201,7 @@ class Document {
201 global $default, $lang_err_doc_exist, $lang_err_database; 201 global $default, $lang_err_doc_exist, $lang_err_database;
202 //if the id >= 0, then the object has already been created 202 //if the id >= 0, then the object has already been created
203 if ($this->iId < 0) { 203 if ($this->iId < 0) {
204 - $sql = new Owl_DB(); 204 + $sql = $default->db;
205 $result = $sql->query("INSERT INTO " . $default->owl_documents_table . " (document_type_id, name, filename, size, creator_id, modified, description, mime_id, folder_id, major_version, minor_version, is_checked_out) " . 205 $result = $sql->query("INSERT INTO " . $default->owl_documents_table . " (document_type_id, name, filename, size, creator_id, modified, description, mime_id, folder_id, major_version, minor_version, is_checked_out) " .
206 "VALUES (" . $this->iDocumentTypeID . ", '" . addslashes($this->sName) . "', '" . addslashes($this->sFileName) . "', $this->iSize, $this->iCreatorID, '" . getCurrentDateTime() . "', '" . addslashes($this->sDescription) . "', $this->iMimeTypeID, $this->iFolderID, $this->iMajorVersion, $this->iMinorVersion, " . ($this->bIsCheckedOut ? 1 : 0) . ")"); 206 "VALUES (" . $this->iDocumentTypeID . ", '" . addslashes($this->sName) . "', '" . addslashes($this->sFileName) . "', $this->iSize, $this->iCreatorID, '" . getCurrentDateTime() . "', '" . addslashes($this->sDescription) . "', $this->iMimeTypeID, $this->iFolderID, $this->iMajorVersion, $this->iMinorVersion, " . ($this->bIsCheckedOut ? 1 : 0) . ")");
207 if ($result) { 207 if ($result) {
@@ -225,7 +225,7 @@ class Document { @@ -225,7 +225,7 @@ class Document {
225 function update() { 225 function update() {
226 global $default, $lang_err_database, $lang_err_object_key; 226 global $default, $lang_err_database, $lang_err_object_key;
227 if ($this->iId >= 0) { 227 if ($this->iId >= 0) {
228 - $sql = new Owl_DB(); 228 + $sql = $default->db;
229 $result = $sql->query("UPDATE " . $default->owl_documents_table . " SET " . 229 $result = $sql->query("UPDATE " . $default->owl_documents_table . " SET " .
230 "document_typeid = $this->iDocumentTypeID, " . 230 "document_typeid = $this->iDocumentTypeID, " .
231 "file_name = '" . addslashes($this->file_name) . "', " . 231 "file_name = '" . addslashes($this->file_name) . "', " .
@@ -259,7 +259,7 @@ class Document { @@ -259,7 +259,7 @@ class Document {
259 function delete() { 259 function delete() {
260 global $default, $lang_err_database, $lang_err_object_key; 260 global $default, $lang_err_database, $lang_err_object_key;
261 if ($this->iId >= 0) { 261 if ($this->iId >= 0) {
262 - $sql = new Owl_DB(); 262 + $sql = $default->db;
263 $result = $sql->query("DELETE FROM " . $default->owl_documents_table . " WHERE id = $this->iId"); 263 $result = $sql->query("DELETE FROM " . $default->owl_documents_table . " WHERE id = $this->iId");
264 if ($result) { 264 if ($result) {
265 $this->iId = -1; 265 $this->iId = -1;
@@ -283,7 +283,7 @@ class Document { @@ -283,7 +283,7 @@ class Document {
283 */ 283 */
284 function & get($iDocumentID) { 284 function & get($iDocumentID) {
285 global $default, $lang_err_doc_not_exist; 285 global $default, $lang_err_doc_not_exist;
286 - $sql = new Owl_DB(); 286 + $sql = $default->db;
287 $sql->query("SELECT * FROM $default->owl_documents_table WHERE id = $iDocumentID"); 287 $sql->query("SELECT * FROM $default->owl_documents_table WHERE id = $iDocumentID");
288 if ($sql->next_record()) { 288 if ($sql->next_record()) {
289 $oDocument = & new Document(stripslashes($sql->f("name")), $sql->f("filename"), $sql->f("size"), stripslashes($sql->f("creator_id")), $sql->f("mime_id"), $sql->f("folder_id"), $sql->f("description")); 289 $oDocument = & new Document(stripslashes($sql->f("name")), $sql->f("filename"), $sql->f("size"), stripslashes($sql->f("creator_id")), $sql->f("mime_id"), $sql->f("folder_id"), $sql->f("description"));
@@ -310,7 +310,7 @@ class Document { @@ -310,7 +310,7 @@ class Document {
310 function getDocumentFieldsForDocumentType($iDocumentTypeID, $bMandatoryOnly = false) { 310 function getDocumentFieldsForDocumentType($iDocumentTypeID, $bMandatoryOnly = false) {
311 $aDocumentFieldArray; 311 $aDocumentFieldArray;
312 settype($aDocumentFieldArray,"array"); 312 settype($aDocumentFieldArray,"array");
313 - $sql = new Owl_DB(); 313 + $sql = $default->db;
314 $result = $sql->query("SELECT DF.id AS id, DF.name AS name, DF.data_type AS data_type FROM document_fields AS DF INNER JOIN document_type_fields_link AS DTFL ON DF.id = DTFL.field_id WHERE DTFL.document_type_id = $iDocumentTypeID " . ($bMandatoryOnly ? "AND DFTL.is_mandatory = 1 " : " ") . "ORDER BY DF.name ASC"); 314 $result = $sql->query("SELECT DF.id AS id, DF.name AS name, DF.data_type AS data_type FROM document_fields AS DF INNER JOIN document_type_fields_link AS DTFL ON DF.id = DTFL.field_id WHERE DTFL.document_type_id = $iDocumentTypeID " . ($bMandatoryOnly ? "AND DFTL.is_mandatory = 1 " : " ") . "ORDER BY DF.name ASC");
315 if ($result) { 315 if ($result) {
316 $iCount = 0; 316 $iCount = 0;
@@ -338,7 +338,7 @@ class Document { @@ -338,7 +338,7 @@ class Document {
338 global $default, $lang_err_database; 338 global $default, $lang_err_database;
339 $aDocumentHistory; 339 $aDocumentHistory;
340 settype($aDocumentHistory, "array"); 340 settype($aDocumentHistory, "array");
341 - $sql = new Owl_DB(); 341 + $sql = $default->db;
342 $result = $sql->query("SELECT * FROM " . $default->owl_document_transactions_table . " WHERE document_id = $this->iId ORDER BY datetime ASC"); 342 $result = $sql->query("SELECT * FROM " . $default->owl_document_transactions_table . " WHERE document_id = $this->iId ORDER BY datetime ASC");
343 if ($result) { 343 if ($result) {
344 $iCount = 0; 344 $iCount = 0;
@@ -365,7 +365,7 @@ class Document { @@ -365,7 +365,7 @@ class Document {
365 */ 365 */
366 function documentExists($sFileName, $iFolderID) { 366 function documentExists($sFileName, $iFolderID) {
367 global $default, $lang_err_doc_not_exist; 367 global $default, $lang_err_doc_not_exist;
368 - $sql = new Owl_DB(); 368 + $sql = $default->db;
369 $sql->query("SELECT * FROM $default->owl_documents_table WHERE name = '" . addslashes($sFileName) . "' AND folder_id = $iFolderID"); 369 $sql->query("SELECT * FROM $default->owl_documents_table WHERE name = '" . addslashes($sFileName) . "' AND folder_id = $iFolderID");
370 if ($sql->next_record()) { 370 if ($sql->next_record()) {
371 return true; 371 return true;
lib/documentmanagement/DocumentBrowser.inc
@@ -31,7 +31,7 @@ class DocumentBrowser { @@ -31,7 +31,7 @@ class DocumentBrowser {
31 31
32 // instantiate and initialise 32 // instantiate and initialise
33 $results = array(); 33 $results = array();
34 - $sql = new Owl_DB(); 34 + $sql = $default->db;
35 35
36 // no folder specified, so depending on the users groups, resolve to the right folderID 36 // no folder specified, so depending on the users groups, resolve to the right folderID
37 if ($folderID == -1) { 37 if ($folderID == -1) {
@@ -117,7 +117,7 @@ class DocumentBrowser { @@ -117,7 +117,7 @@ class DocumentBrowser {
117 // TODO: add this to default inserts 117 // TODO: add this to default inserts
118 $categoryField = "Category"; 118 $categoryField = "Category";
119 $results = array(); 119 $results = array();
120 - $sql = new Owl_DB(); 120 + $sql = $default->db;
121 121
122 // lookup document_fields id for category 122 // lookup document_fields id for category
123 $categoryFieldID = lookupID($default->owl_fields_table, "name", "$categoryField"); 123 $categoryFieldID = lookupID($default->owl_fields_table, "name", "$categoryField");
@@ -174,7 +174,7 @@ class DocumentBrowser { @@ -174,7 +174,7 @@ class DocumentBrowser {
174 global $default; 174 global $default;
175 175
176 $results = array(); 176 $results = array();
177 - $sql = new Owl_DB(); 177 + $sql = $default->db;
178 178
179 if ($documentTypeID == -1) { 179 if ($documentTypeID == -1) {
180 // no category value supplied, so return a list of categories 180 // no category value supplied, so return a list of categories
@@ -222,7 +222,7 @@ class DocumentBrowser { @@ -222,7 +222,7 @@ class DocumentBrowser {
222 */ 222 */
223 function checkGroup($requiredGroupName, $groupIDs) { 223 function checkGroup($requiredGroupName, $groupIDs) {
224 global $default; 224 global $default;
225 - $sql = new Owl_DB(); 225 + $sql = $default->db;
226 // lookup the id of $requiredGroupName 226 // lookup the id of $requiredGroupName
227 $requiredGroupID = lookupID($default->owl_groups_table, "name", "$requiredGroupName"); 227 $requiredGroupID = lookupID($default->owl_groups_table, "name", "$requiredGroupName");
228 $default->log->debug("DocumentBrowser::checkGroup reqGrpID=$requiredGroupID"); 228 $default->log->debug("DocumentBrowser::checkGroup reqGrpID=$requiredGroupID");
@@ -252,7 +252,7 @@ class DocumentBrowser { @@ -252,7 +252,7 @@ class DocumentBrowser {
252 global $default; 252 global $default;
253 253
254 $folders = array(); 254 $folders = array();
255 - $folderSql = new Owl_DB(); 255 + $folderSql = $default->db;
256 // perform folder details query and loop through results 256 // perform folder details query and loop through results
257 if ($folderSql->query($folderQuery)) { 257 if ($folderSql->query($folderQuery)) {
258 // should only be one result 258 // should only be one result
@@ -294,7 +294,7 @@ class DocumentBrowser { @@ -294,7 +294,7 @@ class DocumentBrowser {
294 global $default; 294 global $default;
295 295
296 $documents = array(); 296 $documents = array();
297 - $sql = new Owl_DB(); 297 + $sql = $default->db;
298 298
299 // convert array to a comma separated string 299 // convert array to a comma separated string
300 $documentIDStr = arrayToCSS($documentIDs); 300 $documentIDStr = arrayToCSS($documentIDs);
lib/documentmanagement/DocumentField.inc
@@ -93,7 +93,7 @@ class DocumentField { @@ -93,7 +93,7 @@ class DocumentField {
93 global $default, $lang_err_database, $lang_err_object_exists; 93 global $default, $lang_err_database, $lang_err_object_exists;
94 //if the object hasn't been created 94 //if the object hasn't been created
95 if ($this->iId < 0) { 95 if ($this->iId < 0) {
96 - $sql = new Owl_DB(); 96 + $sql = $default->db;
97 $result = $sql->query("INSERT INTO " . $default->owl_fields_table . " (name, data_type) VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDataType) . "')"); 97 $result = $sql->query("INSERT INTO " . $default->owl_fields_table . " (name, data_type) VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDataType) . "')");
98 if ($result) { 98 if ($result) {
99 $this->iId = $sql->insert_id(); 99 $this->iId = $sql->insert_id();
@@ -116,7 +116,7 @@ class DocumentField { @@ -116,7 +116,7 @@ class DocumentField {
116 global $default, $lang_err_database, $lang_err_object_key; 116 global $default, $lang_err_database, $lang_err_object_key;
117 //only update if the object has been stored 117 //only update if the object has been stored
118 if ($this->iId > 0) { 118 if ($this->iId > 0) {
119 - $sql = new Owl_DB(); 119 + $sql = $default->db;
120 $result = $sql->query("UPDATE " . $default->owl_fields_table . " SET name = '" . addslashes($this->sName) . "', data_type = '" . addslashes($this->sDataType) . "' WHERE id = $this->iId"); 120 $result = $sql->query("UPDATE " . $default->owl_fields_table . " SET name = '" . addslashes($this->sName) . "', data_type = '" . addslashes($this->sDataType) . "' WHERE id = $this->iId");
121 if ($result) { 121 if ($result) {
122 return true; 122 return true;
@@ -138,7 +138,7 @@ class DocumentField { @@ -138,7 +138,7 @@ class DocumentField {
138 global $default, $lang_err_database, $lang_err_object_key; 138 global $default, $lang_err_database, $lang_err_object_key;
139 //only delete the object if it exists in the database 139 //only delete the object if it exists in the database
140 if ($this->iId >= 0) { 140 if ($this->iId >= 0) {
141 - $sql = new Owl_DB(); 141 + $sql = $default->db;
142 $result = $sql->query("DELETE FROM $default->owl_fields_table WHERE id = $this->iId"); 142 $result = $sql->query("DELETE FROM $default->owl_fields_table WHERE id = $this->iId");
143 if ($result) { 143 if ($result) {
144 return true; 144 return true;
@@ -160,7 +160,7 @@ class DocumentField { @@ -160,7 +160,7 @@ class DocumentField {
160 */ 160 */
161 function & get($iDocumentFieldsID) { 161 function & get($iDocumentFieldsID) {
162 global $default; 162 global $default;
163 - $sql = new Owl_DB(); 163 + $sql = $default->db;
164 $result = $sql->query("SELECT * FROM $default->owl_fields_table WHERE id = $iDocumentFieldsID"); 164 $result = $sql->query("SELECT * FROM $default->owl_fields_table WHERE id = $iDocumentFieldsID");
165 if ($result) { 165 if ($result) {
166 if ($sql->next_record()) { 166 if ($sql->next_record()) {
lib/documentmanagement/DocumentFieldLink.inc
@@ -118,7 +118,7 @@ class DocumentFieldLink { @@ -118,7 +118,7 @@ class DocumentFieldLink {
118 global $default, $lang_err_doc_exist, $lang_err_database; 118 global $default, $lang_err_doc_exist, $lang_err_database;
119 //if the id >= 0, then the object has already been created 119 //if the id >= 0, then the object has already been created
120 if ($this->iId < 0) { 120 if ($this->iId < 0) {
121 - $sql = new Owl_DB(); 121 + $sql = $default->db;
122 $result = $sql->query("INSERT INTO " . $default->owl_document_fields_table . " (document_id, document_field_id, value) " . 122 $result = $sql->query("INSERT INTO " . $default->owl_document_fields_table . " (document_id, document_field_id, value) " .
123 "VALUES ($this->iDocumentID, $this->iDocumentFieldID, '" . addslashes($this->sValue) . "')"); 123 "VALUES ($this->iDocumentID, $this->iDocumentFieldID, '" . addslashes($this->sValue) . "')");
124 if ($result) { 124 if ($result) {
@@ -142,7 +142,7 @@ class DocumentFieldLink { @@ -142,7 +142,7 @@ class DocumentFieldLink {
142 function update() { 142 function update() {
143 global $default, $lang_err_database, $lang_err_object_key; 143 global $default, $lang_err_database, $lang_err_object_key;
144 if ($this->iId >= 0) { 144 if ($this->iId >= 0) {
145 - $sql = new Owl_DB(); 145 + $sql = $default->db;
146 $result = $sql->query("UPDATE " . $default->owl_document_fields_table . " SET " . 146 $result = $sql->query("UPDATE " . $default->owl_document_fields_table . " SET " .
147 "document_id = $this->iDocumentID, document_field_id = $this->iDocumentFieldID, value = '" . addslashes($this->sValue) . "'" . 147 "document_id = $this->iDocumentID, document_field_id = $this->iDocumentFieldID, value = '" . addslashes($this->sValue) . "'" .
148 "WHERE id = $this->iId"); 148 "WHERE id = $this->iId");
@@ -166,7 +166,7 @@ class DocumentFieldLink { @@ -166,7 +166,7 @@ class DocumentFieldLink {
166 function delete() { 166 function delete() {
167 global $default, $lang_err_database, $lang_err_object_key; 167 global $default, $lang_err_database, $lang_err_object_key;
168 if ($this->iId >= 0) { 168 if ($this->iId >= 0) {
169 - $sql = new Owl_DB(); 169 + $sql = $default->db;
170 $result = $sql->query("DELETE FROM " . $default->owl_document_fields_table . " WHERE id = $this->iId"); 170 $result = $sql->query("DELETE FROM " . $default->owl_document_fields_table . " WHERE id = $this->iId");
171 if ($result) { 171 if ($result) {
172 $this->iId = -1; 172 $this->iId = -1;
@@ -190,7 +190,7 @@ class DocumentFieldLink { @@ -190,7 +190,7 @@ class DocumentFieldLink {
190 */ 190 */
191 function & get($iDocumentFieldLinkID) { 191 function & get($iDocumentFieldLinkID) {
192 global $default, $lang_err_doc_not_exist; 192 global $default, $lang_err_doc_not_exist;
193 - $sql = new Owl_DB(); 193 + $sql = $default->db;
194 $sql->query("SELECT * FROM " . $default->owl_document_fields_table . " WHERE id = " . $iDocumentFieldLinkID); 194 $sql->query("SELECT * FROM " . $default->owl_document_fields_table . " WHERE id = " . $iDocumentFieldLinkID);
195 if ($sql->next_record()) { 195 if ($sql->next_record()) {
196 $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value")); 196 $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value"));
lib/documentmanagement/DocumentTransaction.inc
@@ -81,7 +81,7 @@ class DocumentTransaction { @@ -81,7 +81,7 @@ class DocumentTransaction {
81 global $default, $lang_err_object_exists; 81 global $default, $lang_err_object_exists;
82 //if the object hasn't been stored yet 82 //if the object hasn't been stored yet
83 if ($this->iId < 0) { 83 if ($this->iId < 0) {
84 - $sql = new Owl_DB(); 84 + $sql = $default->db;
85 $result = $sql->query("INSERT INTO " . $default->owl_document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " . 85 $result = $sql->query("INSERT INTO " . $default->owl_document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " .
86 "VALUES ($this->iDocumentID, '" . addslashes($this->sVersion) . "', $this->iUserID, '" . addslashes($this->dDateTime) . "', '" . addslashes($this->sIP) . "', '" . addslashes($this->sFileName) . "', '" . addslashes($this->sComment) . "', $this->iTransactionID)"); 86 "VALUES ($this->iDocumentID, '" . addslashes($this->sVersion) . "', $this->iUserID, '" . addslashes($this->dDateTime) . "', '" . addslashes($this->sIP) . "', '" . addslashes($this->sFileName) . "', '" . addslashes($this->sComment) . "', $this->iTransactionID)");
87 if ($result) { 87 if ($result) {
lib/documentmanagement/PhysicalDocumentManager.inc
@@ -158,7 +158,7 @@ class PhysicalDocumentManager { @@ -158,7 +158,7 @@ class PhysicalDocumentManager {
158 */ 158 */
159 function getMimeTypeID($sName) { 159 function getMimeTypeID($sName) {
160 global $default; 160 global $default;
161 - $sql = new Owl_DB(); 161 + $sql = $default->db;
162 //get the mime type 162 //get the mime type
163 if (isset($sName)) { 163 if (isset($sName)) {
164 $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = '$sName'"); 164 $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = '$sName'");
@@ -179,7 +179,7 @@ class PhysicalDocumentManager { @@ -179,7 +179,7 @@ class PhysicalDocumentManager {
179 */ 179 */
180 function getDefaultMimeTypeID() { 180 function getDefaultMimeTypeID() {
181 global $default; 181 global $default;
182 - $sql = new Owl_DB(); 182 + $sql = $default->db;
183 $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = 'text/plain'"); 183 $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = 'text/plain'");
184 $sql->next_record(); 184 $sql->next_record();
185 //get the mime type id 185 //get the mime type id
@@ -188,7 +188,7 @@ class PhysicalDocumentManager { @@ -188,7 +188,7 @@ class PhysicalDocumentManager {
188 188
189 function getMimeTypeName($iMimeTypeID) { 189 function getMimeTypeName($iMimeTypeID) {
190 global $default; 190 global $default;
191 - $sql = new Owl_DB(); 191 + $sql = $default->db;
192 $sql->query("SELECT mimetypes FROM " . $default->owl_mime_table . " WHERE id = " . $iMimeTypeID); 192 $sql->query("SELECT mimetypes FROM " . $default->owl_mime_table . " WHERE id = " . $iMimeTypeID);
193 if ($sql->next_record()) { 193 if ($sql->next_record()) {
194 return $sql->f("mimetypes"); 194 return $sql->f("mimetypes");
lib/foldermanagement/Folder.inc
@@ -190,7 +190,7 @@ class Folder { @@ -190,7 +190,7 @@ class Folder {
190 global $default, $lang_err_database; $lang_err_object_exists; 190 global $default, $lang_err_database; $lang_err_object_exists;
191 //if the object has not already been stored 191 //if the object has not already been stored
192 if ($this->iId < 0) { 192 if ($this->iId < 0) {
193 - $sql = new Owl_DB(); 193 + $sql = $default->db;
194 $result = $sql->query("INSERT INTO " . $default->owl_folders_table . " (name, description, parent_id, creator_id, document_type_id, unit_id, is_public) " . 194 $result = $sql->query("INSERT INTO " . $default->owl_folders_table . " (name, description, parent_id, creator_id, document_type_id, unit_id, is_public) " .
195 "VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDescription) . "', $this->iParentID, $this->iCreatorID, $this->iDocumentTypeID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ")"); 195 "VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDescription) . "', $this->iParentID, $this->iCreatorID, $this->iDocumentTypeID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ")");
196 if ($result) { 196 if ($result) {
@@ -213,7 +213,7 @@ class Folder { @@ -213,7 +213,7 @@ class Folder {
213 global $default, $lang_err_database, $lang_err_object_key; 213 global $default, $lang_err_database, $lang_err_object_key;
214 //can only update the object if it has already been stored 214 //can only update the object if it has already been stored
215 if ($this->iId >= 0) { 215 if ($this->iId >= 0) {
216 - $sql = new Owl_DB(); 216 + $sql = $default->db;
217 $result = $sql->query("UPDATE " . $default->owl_folders_table . " SET " . 217 $result = $sql->query("UPDATE " . $default->owl_folders_table . " SET " .
218 "name = '" . addslashes($this->sName) . "', " . 218 "name = '" . addslashes($this->sName) . "', " .
219 "description = '" . addslashes($this->sDescription) . "', " . 219 "description = '" . addslashes($this->sDescription) . "', " .
@@ -241,7 +241,7 @@ class Folder { @@ -241,7 +241,7 @@ class Folder {
241 function delete() { 241 function delete() {
242 global $default, $lang_err_database, $lang_err_object_key; 242 global $default, $lang_err_database, $lang_err_object_key;
243 if ($this->iId >= 0) { 243 if ($this->iId >= 0) {
244 - $sql = new Owl_DB(); 244 + $sql = $default->db;
245 $result = $sql->query("DELETE FROM " . $default->owl_folders_table . " WHERE id = " . $this->iId); 245 $result = $sql->query("DELETE FROM " . $default->owl_folders_table . " WHERE id = " . $this->iId);
246 if ($result) { 246 if ($result) {
247 $this->iId = -1; 247 $this->iId = -1;
@@ -267,7 +267,7 @@ class Folder { @@ -267,7 +267,7 @@ class Folder {
267 */ 267 */
268 function get($iFolderID) { 268 function get($iFolderID) {
269 global $default, $lang_err_object_not_exist; 269 global $default, $lang_err_object_not_exist;
270 - $sql = new Owl_DB(); 270 + $sql = $default->db;
271 $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); 271 $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
272 if ($sql->next_record()) { 272 if ($sql->next_record()) {
273 $oFolder = & new Folder(stripslashes($sql->f("name")), stripslashes($sql->f("description")), $sql->f("parent_id"), $sql->f("creator_id"), $sql->f("document_type_id"), $sql->f("unit_id"), $sql->f("is_public")); 273 $oFolder = & new Folder(stripslashes($sql->f("name")), stripslashes($sql->f("description")), $sql->f("parent_id"), $sql->f("creator_id"), $sql->f("document_type_id"), $sql->f("unit_id"), $sql->f("is_public"));
@@ -346,7 +346,7 @@ class Folder { @@ -346,7 +346,7 @@ class Folder {
346 function getParentFolderID($iFolderID) { 346 function getParentFolderID($iFolderID) {
347 if ($iFolderID != 0) { 347 if ($iFolderID != 0) {
348 global $default; 348 global $default;
349 - $sql = new Owl_DB(); 349 + $sql = $default->db;
350 $sql->query("SELECT parent_id FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); 350 $sql->query("SELECT parent_id FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
351 $sql->next_record(); 351 $sql->next_record();
352 return $sql->f("parent_id"); 352 return $sql->f("parent_id");
@@ -365,7 +365,7 @@ class Folder { @@ -365,7 +365,7 @@ class Folder {
365 function getFolderDocumentType($iFolderID) { 365 function getFolderDocumentType($iFolderID) {
366 global $default, $lang_err_database; 366 global $default, $lang_err_database;
367 if (Folder::folderExistsID($iFolderID)) { 367 if (Folder::folderExistsID($iFolderID)) {
368 - $sql = new Owl_DB(); 368 + $sql = $default->db;
369 $sql->query("SELECT document_type_id FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); 369 $sql->query("SELECT document_type_id FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
370 if ($sql->next_record()) { 370 if ($sql->next_record()) {
371 return $sql->f("document_type_id"); 371 return $sql->f("document_type_id");
@@ -389,7 +389,7 @@ class Folder { @@ -389,7 +389,7 @@ class Folder {
389 function folderExistsName($sName, $iParentID) { 389 function folderExistsName($sName, $iParentID) {
390 $sName = addslashes($sName); 390 $sName = addslashes($sName);
391 global $default, $lang_err_folder_exist; 391 global $default, $lang_err_folder_exist;
392 - $sql = new Owl_DB(); 392 + $sql = $default->db;
393 $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE name = '" . $sName . "' AND parent_id = " . $iParentID); 393 $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE name = '" . $sName . "' AND parent_id = " . $iParentID);
394 if ($sql->next_record()) { 394 if ($sql->next_record()) {
395 return true; 395 return true;
@@ -407,7 +407,7 @@ class Folder { @@ -407,7 +407,7 @@ class Folder {
407 */ 407 */
408 function folderExistsID($iFolderID) { 408 function folderExistsID($iFolderID) {
409 global $default, $lang_err_folder_exist; 409 global $default, $lang_err_folder_exist;
410 - $sql = new Owl_DB(); 410 + $sql = $default->db;
411 $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); 411 $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
412 if ($sql->next_record()) { 412 if ($sql->next_record()) {
413 return true; 413 return true;
@@ -425,7 +425,7 @@ class Folder { @@ -425,7 +425,7 @@ class Folder {
425 */ 425 */
426 function getFolderName($iFolderID) { 426 function getFolderName($iFolderID) {
427 global $default, $lang_err_database; 427 global $default, $lang_err_database;
428 - $sql = new Owl_DB(); 428 + $sql = $default->db;
429 $sql->query("SELECT name FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); 429 $sql->query("SELECT name FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
430 if ($sql->next_record()) { 430 if ($sql->next_record()) {
431 return stripslashes($sql->f("name")); 431 return stripslashes($sql->f("name"));
@@ -443,7 +443,7 @@ class Folder { @@ -443,7 +443,7 @@ class Folder {
443 */ 443 */
444 function getFolderID($sFolderName) { 444 function getFolderID($sFolderName) {
445 global $default, $lang_err_database; 445 global $default, $lang_err_database;
446 - $sql = new Owl_DB(); 446 + $sql = $default->db;
447 $sql->query("SELECT id FROM " . $default->owl_folders_table . " WHERE name = '" . addslashes($sFolderName) . "'"); 447 $sql->query("SELECT id FROM " . $default->owl_folders_table . " WHERE name = '" . addslashes($sFolderName) . "'");
448 if ($sql->next_record()) { 448 if ($sql->next_record()) {
449 return $sql->f("id"); 449 return $sql->f("id");
lib/groups/Group.inc
@@ -36,7 +36,7 @@ class Group { @@ -36,7 +36,7 @@ class Group {
36 global $default, $lang_err_database, $lang_err_object_exists; 36 global $default, $lang_err_database, $lang_err_object_exists;
37 //if the object hasn't been created 37 //if the object hasn't been created
38 if ($this->iId < 0) { 38 if ($this->iId < 0) {
39 - $sql = new Owl_DB(); 39 + $sql = $default->db;
40 $result = $sql->query("INSERT INTO " . $default->owl_groups_table . " (name, is_sys_admin, is_unit_admin) VALUES ('" . addslashes($this->sName) . "', " . ($this->bIsSysAdmin ? 1 : 0) . ", " . ($this->bIsUnitAdmin ? 1 : 0) . ")"); 40 $result = $sql->query("INSERT INTO " . $default->owl_groups_table . " (name, is_sys_admin, is_unit_admin) VALUES ('" . addslashes($this->sName) . "', " . ($this->bIsSysAdmin ? 1 : 0) . ", " . ($this->bIsUnitAdmin ? 1 : 0) . ")");
41 if ($result) { 41 if ($result) {
42 $this->iId = $sql->insert_id(); 42 $this->iId = $sql->insert_id();
@@ -59,7 +59,7 @@ class Group { @@ -59,7 +59,7 @@ class Group {
59 global $default, $lang_err_database, $lang_err_object_key; 59 global $default, $lang_err_database, $lang_err_object_key;
60 //only update if the object has been stored 60 //only update if the object has been stored
61 if ($this->iId > 0) { 61 if ($this->iId > 0) {
62 - $sql = new Owl_DB(); 62 + $sql = $default->db;
63 $result = $sql->query("UPDATE " . $default->owl_groups_table . " SET name = '" . addslashes($this->sName) . "', is_sys_admin = " . ($this->bIsSysAdmin ? 1 : 0) . ", is_unit_admin = " . ($this->bIsUnitAdmin ? 1 : 0) . " WHERE id = $this->iId"); 63 $result = $sql->query("UPDATE " . $default->owl_groups_table . " SET name = '" . addslashes($this->sName) . "', is_sys_admin = " . ($this->bIsSysAdmin ? 1 : 0) . ", is_unit_admin = " . ($this->bIsUnitAdmin ? 1 : 0) . " WHERE id = $this->iId");
64 if ($result) { 64 if ($result) {
65 return true; 65 return true;
@@ -81,7 +81,7 @@ class Group { @@ -81,7 +81,7 @@ class Group {
81 global $default, $lang_err_database, $lang_err_object_key; 81 global $default, $lang_err_database, $lang_err_object_key;
82 //only delete the object if it exists in the database 82 //only delete the object if it exists in the database
83 if ($this->iId >= 0) { 83 if ($this->iId >= 0) {
84 - $sql = new Owl_DB(); 84 + $sql = $default->db;
85 $result = $sql->query("DELETE FROM $default->owl_groups_table WHERE id = $this->iId"); 85 $result = $sql->query("DELETE FROM $default->owl_groups_table WHERE id = $this->iId");
86 if ($result) { 86 if ($result) {
87 return true; 87 return true;
@@ -103,7 +103,7 @@ class Group { @@ -103,7 +103,7 @@ class Group {
103 */ 103 */
104 function & get($iGroupID) { 104 function & get($iGroupID) {
105 global $default; 105 global $default;
106 - $sql = new Owl_DB(); 106 + $sql = $default->db;
107 $result = $sql->query("SELECT * FROM $default->owl_groups_table WHERE id = $iGroupID"); 107 $result = $sql->query("SELECT * FROM $default->owl_groups_table WHERE id = $iGroupID");
108 if ($result) { 108 if ($result) {
109 if ($sql->next_record()) { 109 if ($sql->next_record()) {
@@ -130,7 +130,7 @@ class Group { @@ -130,7 +130,7 @@ class Group {
130 global $default, $lang_err_database; 130 global $default, $lang_err_database;
131 $aGroupArray; 131 $aGroupArray;
132 settype($aGroupArray, "array"); 132 settype($aGroupArray, "array");
133 - $sql = new Owl_DB(); 133 + $sql = $default->db;
134 $result = $sql->query("SELECT * FROM " . $default->owl_groups_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 134 $result = $sql->query("SELECT * FROM " . $default->owl_groups_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
135 if ($result) { 135 if ($result) {
136 $iCount = 0; 136 $iCount = 0;
lib/groups/GroupFolderApprovalLink.inc
@@ -133,7 +133,7 @@ class GroupFolderApprovalLink { @@ -133,7 +133,7 @@ class GroupFolderApprovalLink {
133 global $default, $lang_err_database, $lang_err_object_exists; 133 global $default, $lang_err_database, $lang_err_object_exists;
134 //if the object hasn't been created 134 //if the object hasn't been created
135 if ($this->iId < 0) { 135 if ($this->iId < 0) {
136 - $sql = new Owl_DB(); 136 + $sql = $default->db;
137 $result = $sql->query("INSERT INTO " . $default->owl_groups_folders_approval_table . " (folder_id, group_id, precedence, role_id) VALUES ($this->iFolderID, $this->iGroupID, $this->iPrecedence, $this->iRoleID)"); 137 $result = $sql->query("INSERT INTO " . $default->owl_groups_folders_approval_table . " (folder_id, group_id, precedence, role_id) VALUES ($this->iFolderID, $this->iGroupID, $this->iPrecedence, $this->iRoleID)");
138 if ($result) { 138 if ($result) {
139 $this->iId = $sql->insert_id(); 139 $this->iId = $sql->insert_id();
@@ -156,7 +156,7 @@ class GroupFolderApprovalLink { @@ -156,7 +156,7 @@ class GroupFolderApprovalLink {
156 global $default, $lang_err_database, $lang_err_object_key; 156 global $default, $lang_err_database, $lang_err_object_key;
157 //only update if the object has been stored 157 //only update if the object has been stored
158 if ($this->iId > 0) { 158 if ($this->iId > 0) {
159 - $sql = new Owl_DB(); 159 + $sql = $default->db;
160 $result = $sql->query("UPDATE " . $default->owl_groups_folders_approval_table . " SET folder_id = $this->iFolderID, group_id = $this->iGroupID, precedence = $this->iPrecedence, role_id = $this->iRoleID WHERE id = $this->iId"); 160 $result = $sql->query("UPDATE " . $default->owl_groups_folders_approval_table . " SET folder_id = $this->iFolderID, group_id = $this->iGroupID, precedence = $this->iPrecedence, role_id = $this->iRoleID WHERE id = $this->iId");
161 if ($result) { 161 if ($result) {
162 return true; 162 return true;
@@ -178,7 +178,7 @@ class GroupFolderApprovalLink { @@ -178,7 +178,7 @@ class GroupFolderApprovalLink {
178 global $default, $lang_err_database, $lang_err_object_key; 178 global $default, $lang_err_database, $lang_err_object_key;
179 //only delete the object if it exists in the database 179 //only delete the object if it exists in the database
180 if ($this->iId >= 0) { 180 if ($this->iId >= 0) {
181 - $sql = new Owl_DB(); 181 + $sql = $default->db;
182 $result = $sql->query("DELETE FROM $default->owl_groups_folders_approval_table WHERE id = $this->iId"); 182 $result = $sql->query("DELETE FROM $default->owl_groups_folders_approval_table WHERE id = $this->iId");
183 if ($result) { 183 if ($result) {
184 return true; 184 return true;
@@ -200,7 +200,7 @@ class GroupFolderApprovalLink { @@ -200,7 +200,7 @@ class GroupFolderApprovalLink {
200 */ 200 */
201 function & get($iGroupFolderLinkID) { 201 function & get($iGroupFolderLinkID) {
202 global $default; 202 global $default;
203 - $sql = new Owl_DB(); 203 + $sql = $default->db;
204 $result = $sql->query("SELECT * FROM $default->owl_groups_folders_approval_table WHERE id = $iGroupFolderLinkID"); 204 $result = $sql->query("SELECT * FROM $default->owl_groups_folders_approval_table WHERE id = $iGroupFolderLinkID");
205 if ($result) { 205 if ($result) {
206 if ($sql->next_record()) { 206 if ($sql->next_record()) {
@@ -227,7 +227,7 @@ class GroupFolderApprovalLink { @@ -227,7 +227,7 @@ class GroupFolderApprovalLink {
227 global $default, $lang_err_database; 227 global $default, $lang_err_database;
228 $aGroupFolderApprovalLinkArray; 228 $aGroupFolderApprovalLinkArray;
229 settype($aGroupFolderApprovalLinkArray, "array"); 229 settype($aGroupFolderApprovalLinkArray, "array");
230 - $sql = new Owl_DB(); 230 + $sql = $default->db;
231 $result = $sql->query("SELECT * FROM " . $default->owl_groups_folders_approval_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 231 $result = $sql->query("SELECT * FROM " . $default->owl_groups_folders_approval_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
232 if ($result) { 232 if ($result) {
233 $iCount = 0; 233 $iCount = 0;
lib/groups/GroupUnitLink.inc
@@ -85,7 +85,7 @@ class GroupUnitLink { @@ -85,7 +85,7 @@ class GroupUnitLink {
85 global $default, $lang_err_database, $lang_err_object_exists; 85 global $default, $lang_err_database, $lang_err_object_exists;
86 //if the object hasn't been created 86 //if the object hasn't been created
87 if ($this->iId < 0) { 87 if ($this->iId < 0) {
88 - $sql = new Owl_DB(); 88 + $sql = $default->db;
89 $result = $sql->query("INSERT INTO " . $default->owl_groups_units_table . " (group_id, unit_id) VALUES ($this->iGroupID, $this->iUnitID)"); 89 $result = $sql->query("INSERT INTO " . $default->owl_groups_units_table . " (group_id, unit_id) VALUES ($this->iGroupID, $this->iUnitID)");
90 if ($result) { 90 if ($result) {
91 $this->iId = $sql->insert_id(); 91 $this->iId = $sql->insert_id();
@@ -108,7 +108,7 @@ class GroupUnitLink { @@ -108,7 +108,7 @@ class GroupUnitLink {
108 global $default, $lang_err_database, $lang_err_object_key; 108 global $default, $lang_err_database, $lang_err_object_key;
109 //only update if the object has been stored 109 //only update if the object has been stored
110 if ($this->iId > 0) { 110 if ($this->iId > 0) {
111 - $sql = new Owl_DB(); 111 + $sql = $default->db;
112 $result = $sql->query("UPDATE " . $default->owl_groups_units_table . " SET group_id = $this->iGroupID, unit_id = $this->iUnitID WHERE id = $this->iId"); 112 $result = $sql->query("UPDATE " . $default->owl_groups_units_table . " SET group_id = $this->iGroupID, unit_id = $this->iUnitID WHERE id = $this->iId");
113 if ($result) { 113 if ($result) {
114 return true; 114 return true;
@@ -130,7 +130,7 @@ class GroupUnitLink { @@ -130,7 +130,7 @@ class GroupUnitLink {
130 global $default, $lang_err_database, $lang_err_object_key; 130 global $default, $lang_err_database, $lang_err_object_key;
131 //only delete the object if it exists in the database 131 //only delete the object if it exists in the database
132 if ($this->iId >= 0) { 132 if ($this->iId >= 0) {
133 - $sql = new Owl_DB(); 133 + $sql = $default->db;
134 $result = $sql->query("DELETE FROM $default->owl_groups_units_table WHERE id = $this->iId"); 134 $result = $sql->query("DELETE FROM $default->owl_groups_units_table WHERE id = $this->iId");
135 if ($result) { 135 if ($result) {
136 return true; 136 return true;
@@ -152,7 +152,7 @@ class GroupUnitLink { @@ -152,7 +152,7 @@ class GroupUnitLink {
152 */ 152 */
153 function & get($iGroupUnitLinkID) { 153 function & get($iGroupUnitLinkID) {
154 global $default; 154 global $default;
155 - $sql = new Owl_DB(); 155 + $sql = $default->db;
156 $result = $sql->query("SELECT * FROM $default->owl_groups_units_table WHERE id = $iGroupUnitLinkID"); 156 $result = $sql->query("SELECT * FROM $default->owl_groups_units_table WHERE id = $iGroupUnitLinkID");
157 if ($result) { 157 if ($result) {
158 if ($sql->next_record()) { 158 if ($sql->next_record()) {
@@ -179,7 +179,7 @@ class GroupUnitLink { @@ -179,7 +179,7 @@ class GroupUnitLink {
179 global $default, $lang_err_database; 179 global $default, $lang_err_database;
180 $aGroupUnitLink; 180 $aGroupUnitLink;
181 settype($aGroupUnitLink, "array"); 181 settype($aGroupUnitLink, "array");
182 - $sql = new Owl_DB(); 182 + $sql = $default->db;
183 $result = $sql->query("SELECT * FROM " . $default->owl_groups_units_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 183 $result = $sql->query("SELECT * FROM " . $default->owl_groups_units_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
184 if ($result) { 184 if ($result) {
185 $iCount = 0; 185 $iCount = 0;
lib/groups/GroupUserLink.inc
@@ -85,7 +85,7 @@ class GroupUserLink { @@ -85,7 +85,7 @@ class GroupUserLink {
85 global $default, $lang_err_database, $lang_err_object_exists; 85 global $default, $lang_err_database, $lang_err_object_exists;
86 //if the object hasn't been created 86 //if the object hasn't been created
87 if ($this->iId < 0) { 87 if ($this->iId < 0) {
88 - $sql = new Owl_DB(); 88 + $sql = $default->db;
89 $result = $sql->query("INSERT INTO " . $default->owl_users_groups_table . " (group_id, user_id) VALUES ($this->iGroupID, $this->iUserID)"); 89 $result = $sql->query("INSERT INTO " . $default->owl_users_groups_table . " (group_id, user_id) VALUES ($this->iGroupID, $this->iUserID)");
90 if ($result) { 90 if ($result) {
91 $this->iId = $sql->insert_id(); 91 $this->iId = $sql->insert_id();
@@ -108,7 +108,7 @@ class GroupUserLink { @@ -108,7 +108,7 @@ class GroupUserLink {
108 global $default, $lang_err_database, $lang_err_object_key; 108 global $default, $lang_err_database, $lang_err_object_key;
109 //only update if the object has been stored 109 //only update if the object has been stored
110 if ($this->iId > 0) { 110 if ($this->iId > 0) {
111 - $sql = new Owl_DB(); 111 + $sql = $default->db;
112 $result = $sql->query("UPDATE " . $default->owl_users_groups_table . " SET group_id = $this->iGroupID, user_id = $this->iUserID WHERE id = $this->iId"); 112 $result = $sql->query("UPDATE " . $default->owl_users_groups_table . " SET group_id = $this->iGroupID, user_id = $this->iUserID WHERE id = $this->iId");
113 if ($result) { 113 if ($result) {
114 return true; 114 return true;
@@ -130,7 +130,7 @@ class GroupUserLink { @@ -130,7 +130,7 @@ class GroupUserLink {
130 global $default, $lang_err_database, $lang_err_object_key; 130 global $default, $lang_err_database, $lang_err_object_key;
131 //only delete the object if it exists in the database 131 //only delete the object if it exists in the database
132 if ($this->iId >= 0) { 132 if ($this->iId >= 0) {
133 - $sql = new Owl_DB(); 133 + $sql = $default->db;
134 $result = $sql->query("DELETE FROM $default->owl_users_groups_table WHERE id = $this->iId"); 134 $result = $sql->query("DELETE FROM $default->owl_users_groups_table WHERE id = $this->iId");
135 if ($result) { 135 if ($result) {
136 return true; 136 return true;
@@ -152,7 +152,7 @@ class GroupUserLink { @@ -152,7 +152,7 @@ class GroupUserLink {
152 */ 152 */
153 function & get($iGroupUserLinkID) { 153 function & get($iGroupUserLinkID) {
154 global $default; 154 global $default;
155 - $sql = new Owl_DB(); 155 + $sql = $default->db;
156 $result = $sql->query("SELECT * FROM $default->owl_users_groups_table WHERE id = $iGroupUserLinkID"); 156 $result = $sql->query("SELECT * FROM $default->owl_users_groups_table WHERE id = $iGroupUserLinkID");
157 if ($result) { 157 if ($result) {
158 if ($sql->next_record()) { 158 if ($sql->next_record()) {
@@ -179,7 +179,7 @@ class GroupUserLink { @@ -179,7 +179,7 @@ class GroupUserLink {
179 global $default, $lang_err_database; 179 global $default, $lang_err_database;
180 $aGroupUserLink; 180 $aGroupUserLink;
181 settype($aGroupUserLink, "array"); 181 settype($aGroupUserLink, "array");
182 - $sql = new Owl_DB(); 182 + $sql = $default->db;
183 $result = $sql->query("SELECT * FROM " . $default->owl_users_groups_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 183 $result = $sql->query("SELECT * FROM " . $default->owl_users_groups_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
184 if ($result) { 184 if ($result) {
185 $iCount = 0; 185 $iCount = 0;
lib/roles/Role.inc
@@ -46,7 +46,7 @@ class Role { @@ -46,7 +46,7 @@ class Role {
46 global $default, $lang_err_database, $lang_err_object_exists; 46 global $default, $lang_err_database, $lang_err_object_exists;
47 //if the object hasn't been created 47 //if the object hasn't been created
48 if ($this->iId < 0) { 48 if ($this->iId < 0) {
49 - $sql = new Owl_DB(); 49 + $sql = $default->db;
50 $result = $sql->query("INSERT INTO " . $default->owl_roles_table . " (name, can_read, can_write) VALUES ('" . addslashes($this->sName) . "', " . ($this->bCanRead ? 1 : 0) . ", " . ($this->bCanWrite ? 1 : 0) . ")"); 50 $result = $sql->query("INSERT INTO " . $default->owl_roles_table . " (name, can_read, can_write) VALUES ('" . addslashes($this->sName) . "', " . ($this->bCanRead ? 1 : 0) . ", " . ($this->bCanWrite ? 1 : 0) . ")");
51 if ($result) { 51 if ($result) {
52 $this->iId = $sql->insert_id(); 52 $this->iId = $sql->insert_id();
@@ -69,7 +69,7 @@ class Role { @@ -69,7 +69,7 @@ class Role {
69 global $default, $lang_err_database, $lang_err_object_key; 69 global $default, $lang_err_database, $lang_err_object_key;
70 //only update if the object has been stored 70 //only update if the object has been stored
71 if ($this->iId > 0) { 71 if ($this->iId > 0) {
72 - $sql = new Owl_DB(); 72 + $sql = $default->db;
73 $result = $sql->query("UPDATE " . $default->owl_roles_table . " SET name = '" . addslashes($this->sName) . "', can_read = " . ($this->bCanRead ? 1 : 0) . ", can_write = " . ($this->bCanWrite ? 1 : 0) . " WHERE id = $this->iId"); 73 $result = $sql->query("UPDATE " . $default->owl_roles_table . " SET name = '" . addslashes($this->sName) . "', can_read = " . ($this->bCanRead ? 1 : 0) . ", can_write = " . ($this->bCanWrite ? 1 : 0) . " WHERE id = $this->iId");
74 if ($result) { 74 if ($result) {
75 return true; 75 return true;
@@ -91,7 +91,7 @@ class Role { @@ -91,7 +91,7 @@ class Role {
91 global $default, $lang_err_database, $lang_err_object_key; 91 global $default, $lang_err_database, $lang_err_object_key;
92 //only delete the object if it exists in the database 92 //only delete the object if it exists in the database
93 if ($this->iId >= 0) { 93 if ($this->iId >= 0) {
94 - $sql = new Owl_DB(); 94 + $sql = $default->db;
95 $result = $sql->query("DELETE FROM $default->owl_roles_table WHERE id = $this->iId"); 95 $result = $sql->query("DELETE FROM $default->owl_roles_table WHERE id = $this->iId");
96 if ($result) { 96 if ($result) {
97 return true; 97 return true;
@@ -113,7 +113,7 @@ class Role { @@ -113,7 +113,7 @@ class Role {
113 */ 113 */
114 function & get($iRoleID) { 114 function & get($iRoleID) {
115 global $default; 115 global $default;
116 - $sql = new Owl_DB(); 116 + $sql = $default->db;
117 $result = $sql->query("SELECT * FROM $default->owl_roles_table WHERE id = $iRoleID"); 117 $result = $sql->query("SELECT * FROM $default->owl_roles_table WHERE id = $iRoleID");
118 if ($result) { 118 if ($result) {
119 if ($sql->next_record()) { 119 if ($sql->next_record()) {
@@ -140,7 +140,7 @@ class Role { @@ -140,7 +140,7 @@ class Role {
140 global $default, $lang_err_database; 140 global $default, $lang_err_database;
141 $aRoleArray; 141 $aRoleArray;
142 settype($aRoleArray, "array"); 142 settype($aRoleArray, "array");
143 - $sql = new Owl_DB(); 143 + $sql = $default->db;
144 $result = $sql->query("SELECT * FROM " . $default->owl_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 144 $result = $sql->query("SELECT * FROM " . $default->owl_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
145 if ($result) { 145 if ($result) {
146 $iCount = 0; 146 $iCount = 0;
lib/roles/RoleFolderLink.inc
@@ -159,7 +159,7 @@ class RoleFolderLink { @@ -159,7 +159,7 @@ class RoleFolderLink {
159 global $default, $lang_err_database, $lang_err_object_exists; 159 global $default, $lang_err_database, $lang_err_object_exists;
160 //if the object hasn't been created 160 //if the object hasn't been created
161 if ($this->iId < 0) { 161 if ($this->iId < 0) {
162 - $sql = new Owl_DB(); 162 + $sql = $default->db;
163 $result = $sql->query("INSERT INTO " . $default->owl_folders_user_roles_table . " (user_id, folder_id, role_type_id, datetime, done) VALUES ($this->iUserID, $this->iFolderID, $this->iRoleTypeID, '$this->dDateTime', " . ($this->bDone ? 1 : 0) . ")"); 163 $result = $sql->query("INSERT INTO " . $default->owl_folders_user_roles_table . " (user_id, folder_id, role_type_id, datetime, done) VALUES ($this->iUserID, $this->iFolderID, $this->iRoleTypeID, '$this->dDateTime', " . ($this->bDone ? 1 : 0) . ")");
164 if ($result) { 164 if ($result) {
165 $this->iId = $sql->insert_id(); 165 $this->iId = $sql->insert_id();
@@ -182,7 +182,7 @@ class RoleFolderLink { @@ -182,7 +182,7 @@ class RoleFolderLink {
182 global $default, $lang_err_database, $lang_err_object_key; 182 global $default, $lang_err_database, $lang_err_object_key;
183 //only update if the object has been stored 183 //only update if the object has been stored
184 if ($this->iId > 0) { 184 if ($this->iId > 0) {
185 - $sql = new Owl_DB(); 185 + $sql = $default->db;
186 $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) . " WHERE id = $this->iId"); 186 $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) . " WHERE id = $this->iId");
187 if ($result) { 187 if ($result) {
188 return true; 188 return true;
@@ -204,7 +204,7 @@ class RoleFolderLink { @@ -204,7 +204,7 @@ class RoleFolderLink {
204 global $default, $lang_err_database, $lang_err_object_key; 204 global $default, $lang_err_database, $lang_err_object_key;
205 //only delete the object if it exists in the database 205 //only delete the object if it exists in the database
206 if ($this->iId >= 0) { 206 if ($this->iId >= 0) {
207 - $sql = new Owl_DB(); 207 + $sql = $default->db;
208 $result = $sql->query("DELETE FROM $default->owl_folders_user_roles_table WHERE id = $this->iId"); 208 $result = $sql->query("DELETE FROM $default->owl_folders_user_roles_table WHERE id = $this->iId");
209 if ($result) { 209 if ($result) {
210 return true; 210 return true;
@@ -226,7 +226,7 @@ class RoleFolderLink { @@ -226,7 +226,7 @@ class RoleFolderLink {
226 */ 226 */
227 function & get($iRolesFoldersID) { 227 function & get($iRolesFoldersID) {
228 global $default; 228 global $default;
229 - $sql = new Owl_DB(); 229 + $sql = $default->db;
230 $result = $sql->query("SELECT * FROM $default->owl_folders_user_roles_table WHERE id = $iRolesFoldersID"); 230 $result = $sql->query("SELECT * FROM $default->owl_folders_user_roles_table WHERE id = $iRolesFoldersID");
231 if ($result) { 231 if ($result) {
232 if ($sql->next_record()) { 232 if ($sql->next_record()) {
@@ -253,7 +253,7 @@ class RoleFolderLink { @@ -253,7 +253,7 @@ class RoleFolderLink {
253 global $default, $lang_err_database; 253 global $default, $lang_err_database;
254 $aRolesFoldersLinkArray; 254 $aRolesFoldersLinkArray;
255 settype($aRolesFoldersLinkArray, "array"); 255 settype($aRolesFoldersLinkArray, "array");
256 - $sql = new Owl_DB(); 256 + $sql = $default->db;
257 $result = $sql->query("SELECT * FROM " . $default->owl_folders_user_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 257 $result = $sql->query("SELECT * FROM " . $default->owl_folders_user_roles_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
258 if ($result) { 258 if ($result) {
259 $iCount = 0; 259 $iCount = 0;
lib/security/permission.inc
@@ -113,7 +113,7 @@ class Permission { @@ -113,7 +113,7 @@ class Permission {
113 */ 113 */
114 function folderIsPublic($iFolderID) { 114 function folderIsPublic($iFolderID) {
115 global $default, $lang_err_folder_not_public; 115 global $default, $lang_err_folder_not_public;
116 - $sql = new Owl_DB(); 116 + $sql = $default->db;
117 $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID . " AND is_public = 1"); 117 $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID . " AND is_public = 1");
118 if ($sql->next_record()) { 118 if ($sql->next_record()) {
119 return true; 119 return true;
@@ -131,7 +131,7 @@ class Permission { @@ -131,7 +131,7 @@ class Permission {
131 */ 131 */
132 function userHasGroupWritePermissionForFolder($iFolderID) { 132 function userHasGroupWritePermissionForFolder($iFolderID) {
133 global $default, $lang_err_user_folder_write; 133 global $default, $lang_err_user_folder_write;
134 - $sql = new Owl_DB(); 134 + $sql = $default->db;
135 $sql->query("SELECT GFL.folder_id " . 135 $sql->query("SELECT GFL.folder_id " .
136 "FROM groups_folders_link AS GFL INNER JOIN users_groups_link AS UGL ON GFL.group_id = UGL.group_id " . 136 "FROM groups_folders_link AS GFL INNER JOIN users_groups_link AS UGL ON GFL.group_id = UGL.group_id " .
137 "WHERE UGL.user_id = " . $_SESSION["userID"] . " " . 137 "WHERE UGL.user_id = " . $_SESSION["userID"] . " " .
@@ -176,7 +176,7 @@ class Permission { @@ -176,7 +176,7 @@ class Permission {
176 */ 176 */
177 function userHasGroupReadPermissionForFolder($iFolderID) { 177 function userHasGroupReadPermissionForFolder($iFolderID) {
178 global $default, $lang_err_user_folder_read; 178 global $default, $lang_err_user_folder_read;
179 - $sql = new Owl_DB(); 179 + $sql = $default->db;
180 //$sql->query("SELECT * FROM " . $default->owl_groups_folders_table = "groups_folders_link" . " WHERE folder_id = " . $iFolderID . " AND user_id = " . $_SESSION["userID"] . " AND can_read = 1"); 180 //$sql->query("SELECT * FROM " . $default->owl_groups_folders_table = "groups_folders_link" . " WHERE folder_id = " . $iFolderID . " AND user_id = " . $_SESSION["userID"] . " AND can_read = 1");
181 $sql->query("SELECT GFL.folder_id " . 181 $sql->query("SELECT GFL.folder_id " .
182 "FROM groups_folders_link AS GFL INNER JOIN users_groups_link AS UGL ON GFL.group_id = UGL.group_id " . 182 "FROM groups_folders_link AS GFL INNER JOIN users_groups_link AS UGL ON GFL.group_id = UGL.group_id " .
@@ -199,7 +199,7 @@ class Permission { @@ -199,7 +199,7 @@ class Permission {
199 */ 199 */
200 function userIsInGroupID($iGroupID) { 200 function userIsInGroupID($iGroupID) {
201 global $default, $lang_err_user_group; 201 global $default, $lang_err_user_group;
202 - $sql = new Owl_DB(); 202 + $sql = $default->db;
203 $sql->query("SELECT id FROM " . $default->owl_groups_users_table . " WHERE id = " . $iGroupID . " AND user_id = " . $_SESSION["userID"]); 203 $sql->query("SELECT id FROM " . $default->owl_groups_users_table . " WHERE id = " . $iGroupID . " AND user_id = " . $_SESSION["userID"]);
204 if ($sql->next_record()) { 204 if ($sql->next_record()) {
205 return true; 205 return true;
@@ -217,7 +217,7 @@ class Permission { @@ -217,7 +217,7 @@ class Permission {
217 */ 217 */
218 function userIsInGroupName($sGroupName) { 218 function userIsInGroupName($sGroupName) {
219 global $default, $lang_err_user_group; 219 global $default, $lang_err_user_group;
220 - $sql = new Owl_DB(); 220 + $sql = $default->db;
221 $sql->query("SELECT GULT.id FROM " . $default->owl_users_groups_table . " AS GULT INNER JOIN " . $default->owl_groups_table . " AS G ON GULT.group_id = G.ID WHERE G.name = '" . $sGroupName . "' AND user_id = " . $_SESSION["userID"]); 221 $sql->query("SELECT GULT.id FROM " . $default->owl_users_groups_table . " AS GULT INNER JOIN " . $default->owl_groups_table . " AS G ON GULT.group_id = G.ID WHERE G.name = '" . $sGroupName . "' AND user_id = " . $_SESSION["userID"]);
222 if ($sql->next_record()) { 222 if ($sql->next_record()) {
223 return true; 223 return true;
@@ -236,7 +236,7 @@ class Permission { @@ -236,7 +236,7 @@ class Permission {
236 */ 236 */
237 function userHasWriteRoleForFolder($iFolderID) { 237 function userHasWriteRoleForFolder($iFolderID) {
238 global $default, $lang_err_user_role; 238 global $default, $lang_err_user_role;
239 - $sql = new Owl_DB(); 239 + $sql = $default->db;
240 $sql->query("SELECT * FROM " . $default->owl_folders_user_roles_table . " AS FURL INNER JOIN " . $default->owl_roles_table . " AS R ON FURL.role_type_id = R.id " . 240 $sql->query("SELECT * FROM " . $default->owl_folders_user_roles_table . " AS FURL INNER JOIN " . $default->owl_roles_table . " AS R ON FURL.role_type_id = R.id " .
241 "WHERE folder_id = " . $iFolderID . " " . 241 "WHERE folder_id = " . $iFolderID . " " .
242 "AND user_id = " . $_SESSION["userID"] . " " . 242 "AND user_id = " . $_SESSION["userID"] . " " .
@@ -257,7 +257,7 @@ class Permission { @@ -257,7 +257,7 @@ class Permission {
257 */ 257 */
258 function userHasReadRoleForFolder($iFolderID) { 258 function userHasReadRoleForFolder($iFolderID) {
259 global $default, $lang_err_user_role; 259 global $default, $lang_err_user_role;
260 - $sql = new Owl_DB(); 260 + $sql = $default->db;
261 $sql->query("SELECT * " . 261 $sql->query("SELECT * " .
262 "FROM " . $default->owl_folders_user_roles_table . " AS FURL INNER JOIN " . $default->owl_roles_table . " AS R ON FURL.role_type_id = R.id " . 262 "FROM " . $default->owl_folders_user_roles_table . " AS FURL INNER JOIN " . $default->owl_roles_table . " AS R ON FURL.role_type_id = R.id " .
263 "WHERE folder_id = " . $iFolderID . " " . 263 "WHERE folder_id = " . $iFolderID . " " .
@@ -279,7 +279,7 @@ class Permission { @@ -279,7 +279,7 @@ class Permission {
279 */ 279 */
280 function roleIDExists($iRoleID) { 280 function roleIDExists($iRoleID) {
281 global $default, $lang_err_role_not_exist; 281 global $default, $lang_err_role_not_exist;
282 - $sql = new Owl_DB(); 282 + $sql = $default->db;
283 $sql->query("SELECT id FROM " . $default->owl_roles_table . " WHERE id = " . $iRoleID); 283 $sql->query("SELECT id FROM " . $default->owl_roles_table . " WHERE id = " . $iRoleID);
284 if ($sql->next_record()) { 284 if ($sql->next_record()) {
285 return true; 285 return true;
@@ -297,7 +297,7 @@ class Permission { @@ -297,7 +297,7 @@ class Permission {
297 */ 297 */
298 function roleNameExists($sRoleName) { 298 function roleNameExists($sRoleName) {
299 global $default, $lang_err_role_not_exist; 299 global $default, $lang_err_role_not_exist;
300 - $sql = new Owl_DB(); 300 + $sql = $default->db;
301 $sql->query("SELECT id FROM " . $default->owl_roles_table . " WHERE name = '" . $sRoleName . "'"); 301 $sql->query("SELECT id FROM " . $default->owl_roles_table . " WHERE name = '" . $sRoleName . "'");
302 if ($sql->next_record()) { 302 if ($sql->next_record()) {
303 return true; 303 return true;
@@ -316,7 +316,7 @@ class Permission { @@ -316,7 +316,7 @@ class Permission {
316 function getRoleID($sRoleName) { 316 function getRoleID($sRoleName) {
317 global $default, $lang_err_database; 317 global $default, $lang_err_database;
318 if (roleExists($sRoleName)) { 318 if (roleExists($sRoleName)) {
319 - $sql = new Owl_DB(); 319 + $sql = $default->db;
320 $sql->query("SELECT id FROM " . $default->owl_roles_table . " WHERE name = '" . $sRoleName . "'"); 320 $sql->query("SELECT id FROM " . $default->owl_roles_table . " WHERE name = '" . $sRoleName . "'");
321 $sql->next_record(); 321 $sql->next_record();
322 return $sql->f("id"); 322 return $sql->f("id");
@@ -333,7 +333,7 @@ class Permission { @@ -333,7 +333,7 @@ class Permission {
333 */ 333 */
334 function userIsSystemAdministrator() { 334 function userIsSystemAdministrator() {
335 global $default, $lang_err_database; 335 global $default, $lang_err_database;
336 - $sql = new Owl_DB(); 336 + $sql = $default->db;
337 $sql->query("SELECT UGL.group_id " . 337 $sql->query("SELECT UGL.group_id " .
338 "FROM $default->owl_users_groups_table AS UGL INNER JOIN $default->owl_groups_table AS GL ON UGL.group_id = GL.id " . 338 "FROM $default->owl_users_groups_table AS UGL INNER JOIN $default->owl_groups_table AS GL ON UGL.group_id = GL.id " .
339 "WHERE UGL.user_id = " . $_SESSION["userID"] . " " . 339 "WHERE UGL.user_id = " . $_SESSION["userID"] . " " .
@@ -348,7 +348,7 @@ class Permission { @@ -348,7 +348,7 @@ class Permission {
348 */ 348 */
349 function userIsUnitAdministrator() { 349 function userIsUnitAdministrator() {
350 global $default; 350 global $default;
351 - $sql = new Owl_DB(); 351 + $sql = $default->db;
352 $sql->query("SELECT UGL.group_id " . 352 $sql->query("SELECT UGL.group_id " .
353 "FROM $default->owl_users_groups_table AS UGL INNER JOIN $default->owl_groups_units_table AS GUL ON GUL.group_id = UGL.group_id " . 353 "FROM $default->owl_users_groups_table AS UGL INNER JOIN $default->owl_groups_units_table AS GUL ON GUL.group_id = UGL.group_id " .
354 "INNER JOIN $default->owl_groups_table AS GL ON GL.id = UGL.group_id " . 354 "INNER JOIN $default->owl_groups_table AS GL ON GL.id = UGL.group_id " .
@@ -364,7 +364,7 @@ class Permission { @@ -364,7 +364,7 @@ class Permission {
364 */ 364 */
365 function userIsUnitAdministratorForFolder($iFolderID) { 365 function userIsUnitAdministratorForFolder($iFolderID) {
366 global $default; 366 global $default;
367 - $sql = new Owl_DB(); 367 + $sql = $default->db;
368 $sql->query("SELECT UGL.group_id " . 368 $sql->query("SELECT UGL.group_id " .
369 "FROM $default->owl_users_groups_table AS UGL INNER JOIN $default->owl_groups_units_table AS GUL ON GUL.group_id = UGL.group_id " . 369 "FROM $default->owl_users_groups_table AS UGL INNER JOIN $default->owl_groups_units_table AS GUL ON GUL.group_id = UGL.group_id " .
370 "INNER JOIN $default->owl_groups_table AS GL ON GL.id = UGL.group_id " . 370 "INNER JOIN $default->owl_groups_table AS GL ON GL.id = UGL.group_id " .
@@ -382,7 +382,7 @@ class Permission { @@ -382,7 +382,7 @@ class Permission {
382 */ 382 */
383 function userIsGuest() { 383 function userIsGuest() {
384 global $default; 384 global $default;
385 - $sql = new Owl_DB(); 385 + $sql = $default->db;
386 // you're a guest user if you're in the Anonymous group 386 // you're a guest user if you're in the Anonymous group
387 $sql->query("SELECT UGL.group_id 387 $sql->query("SELECT UGL.group_id
388 FROM $default->owl_users_groups_table AS UGL INNER JOIN $default->owl_groups_table AS GL ON GL.id = UGL.group_id 388 FROM $default->owl_users_groups_table AS UGL INNER JOIN $default->owl_groups_table AS GL ON GL.id = UGL.group_id
lib/session/Session.inc
@@ -35,7 +35,7 @@ class Session { @@ -35,7 +35,7 @@ class Session {
35 $default->log->debug("Session::create() new session for $userID, from $ip, sessionID=$sessionID"); 35 $default->log->debug("Session::create() new session for $userID, from $ip, sessionID=$sessionID");
36 36
37 // insert session information into db 37 // insert session information into db
38 - $sql = new Owl_DB; 38 + $sql = $default->db;
39 $query = "INSERT INTO $default->owl_sessions_table (session_id, user_id, lastused, ip) VALUES ('$sessionID', '$userID', '" . date("Y-m-d H:i:s", time()) . "', '$ip')"; 39 $query = "INSERT INTO $default->owl_sessions_table (session_id, user_id, lastused, ip) VALUES ('$sessionID', '$userID', '" . date("Y-m-d H:i:s", time()) . "', '$ip')";
40 40
41 $result = $sql->query($query); 41 $result = $sql->query($query);
@@ -54,7 +54,7 @@ class Session { @@ -54,7 +54,7 @@ class Session {
54 54
55 session_start(); 55 session_start();
56 // remove the session information from the database 56 // remove the session information from the database
57 - $sql = new Owl_DB; 57 + $sql = $default->db;
58 $query = "DELETE FROM $default->owl_sessions_table WHERE session_id = '" . session_id() . "'"; 58 $query = "DELETE FROM $default->owl_sessions_table WHERE session_id = '" . session_id() . "'";
59 $sql->query($query); 59 $sql->query($query);
60 60
@@ -72,7 +72,7 @@ class Session { @@ -72,7 +72,7 @@ class Session {
72 global $default; 72 global $default;
73 // deletes any sessions for this userID where the default timeout has elapsed. 73 // deletes any sessions for this userID where the default timeout has elapsed.
74 $time = time() - $default->owl_timeout; 74 $time = time() - $default->owl_timeout;
75 - $sql = new Owl_DB; 75 + $sql = $default->db;
76 $sql->query("DELETE FROM $default->owl_sessions_table WHERE user_id = '" . $userID . "' AND lastused <= '" . formatDateTime($time) . "'"); 76 $sql->query("DELETE FROM $default->owl_sessions_table WHERE user_id = '" . $userID . "' AND lastused <= '" . formatDateTime($time) . "'");
77 } 77 }
78 78
@@ -92,7 +92,7 @@ class Session { @@ -92,7 +92,7 @@ class Session {
92 $sessionStatus = 0; 92 $sessionStatus = 0;
93 93
94 // this should be an existing session, so check the db 94 // this should be an existing session, so check the db
95 - $sql = new Owl_DB; 95 + $sql = $default->db;
96 $sql->query("SELECT * FROM $default->owl_sessions_table WHERE session_id = '$sessionID'"); 96 $sql->query("SELECT * FROM $default->owl_sessions_table WHERE session_id = '$sessionID'");
97 $numrows = $sql->num_rows($sql); 97 $numrows = $sql->num_rows($sql);
98 98
lib/session/SiteMap.inc
@@ -155,7 +155,7 @@ class SiteMap { @@ -155,7 +155,7 @@ class SiteMap {
155 */ 155 */
156 function getSectionLinksUsingDB($sSectionName) { 156 function getSectionLinksUsingDB($sSectionName) {
157 global $default, $lang_err_database, $fFolderID; 157 global $default, $lang_err_database, $fFolderID;
158 - $sql = new Owl_DB(); 158 + $sql = $default->db;
159 // lookup sectionID 159 // lookup sectionID
160 $sectionID = lookupID($default->owl_site_sections_table, "name", $sSectionName); 160 $sectionID = lookupID($default->owl_site_sections_table, "name", $sSectionName);
161 if ($sectionID) { 161 if ($sectionID) {
@@ -258,7 +258,7 @@ class SiteMap { @@ -258,7 +258,7 @@ class SiteMap {
258 */ 258 */
259 function getPageUsingDB($action) { 259 function getPageUsingDB($action) {
260 global $default, $lang_err_database; 260 global $default, $lang_err_database;
261 - $sql = new Owl_DB(); 261 + $sql = $default->db;
262 // lookup the page and access_id from the sitemap 262 // lookup the page and access_id from the sitemap
263 if ($sql->query("SELECT page, access_id FROM $default->owl_sitemap_table WHERE action='$action'")) { 263 if ($sql->query("SELECT page, access_id FROM $default->owl_sitemap_table WHERE action='$action'")) {
264 if ($sql->next_record()) { 264 if ($sql->next_record()) {
@@ -332,7 +332,7 @@ class SiteMap { @@ -332,7 +332,7 @@ class SiteMap {
332 */ 332 */
333 function getSectionNameUsingDB($sRequiredPage) { 333 function getSectionNameUsingDB($sRequiredPage) {
334 global $default, $lang_err_database; 334 global $default, $lang_err_database;
335 - $sql = new Owl_DB(); 335 + $sql = $default->db;
336 // lookup the page and access_id from the sitemap 336 // lookup the page and access_id from the sitemap
337 if ($sql->query("SELECT SSL.name FROM $default->owl_sitemap_table AS S 337 if ($sql->query("SELECT SSL.name FROM $default->owl_sitemap_table AS S
338 INNER JOIN $default->owl_site_sections_table AS SSL ON S.section_id=SSL.id 338 INNER JOIN $default->owl_site_sections_table AS SSL ON S.section_id=SSL.id
@@ -394,7 +394,7 @@ class SiteMap { @@ -394,7 +394,7 @@ class SiteMap {
394 */ 394 */
395 function getDefaultActionUsingDB($sSectionName) { 395 function getDefaultActionUsingDB($sSectionName) {
396 global $default, $lang_err_database; 396 global $default, $lang_err_database;
397 - $sql = new Owl_DB(); 397 + $sql = $default->db;
398 // lookup sectionID 398 // lookup sectionID
399 $sectionID = lookupID($default->owl_site_sections_table, "name", $sSectionName); 399 $sectionID = lookupID($default->owl_site_sections_table, "name", $sSectionName);
400 if ($sectionID) { 400 if ($sectionID) {
@@ -474,7 +474,7 @@ class SiteMap { @@ -474,7 +474,7 @@ class SiteMap {
474 */ 474 */
475 function getActionFromPageUsingDB($sPage) { 475 function getActionFromPageUsingDB($sPage) {
476 global $default, $lang_err_database; 476 global $default, $lang_err_database;
477 - $sql = new Owl_DB(); 477 + $sql = $default->db;
478 478
479 // lookup the action for the specified page 479 // lookup the action for the specified page
480 if ($sql->query("SELECT action FROM $default->owl_sitemap_table WHERE page='$sPage'")) { 480 if ($sql->query("SELECT action FROM $default->owl_sitemap_table WHERE page='$sPage'")) {
@@ -532,7 +532,7 @@ class SiteMap { @@ -532,7 +532,7 @@ class SiteMap {
532 */ 532 */
533 function syncWithDB() { 533 function syncWithDB() {
534 global $default; 534 global $default;
535 - $sql = new Owl_DB(); 535 + $sql = $default->db;
536 536
537 // only if we're using the array 537 // only if we're using the array
538 if (!$this->bUseDB) { 538 if (!$this->bUseDB) {
lib/unitmanagement/Unit.inc
@@ -70,7 +70,7 @@ class Unit { @@ -70,7 +70,7 @@ class Unit {
70 //if the object hasn't been created 70 //if the object hasn't been created
71 if ($this->iId < 0) 71 if ($this->iId < 0)
72 { //check to see if name exsits 72 { //check to see if name exsits
73 - $sql = new Owl_DB(); 73 + $sql = $default->db;
74 $query = "SELECT name FROM ". $default->owl_units_table ." WHERE name = '" . $this->sName . "'"; 74 $query = "SELECT name FROM ". $default->owl_units_table ." WHERE name = '" . $this->sName . "'";
75 $sql->query($query); 75 $sql->query($query);
76 $rows = $sql->num_rows($sql); 76 $rows = $sql->num_rows($sql);
@@ -109,7 +109,7 @@ class Unit { @@ -109,7 +109,7 @@ class Unit {
109 //only update if the object has been stored 109 //only update if the object has been stored
110 if ($this->iId > 0) 110 if ($this->iId > 0)
111 { 111 {
112 - $sql = new Owl_DB(); 112 + $sql = $default->db;
113 $result = $sql->query("UPDATE " . $default->owl_units_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); 113 $result = $sql->query("UPDATE " . $default->owl_units_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
114 if ($result) 114 if ($result)
115 { 115 {
@@ -134,7 +134,7 @@ class Unit { @@ -134,7 +134,7 @@ class Unit {
134 //only delete the object if it exists in the database 134 //only delete the object if it exists in the database
135 if ($this->iId >= 0) 135 if ($this->iId >= 0)
136 { 136 {
137 - $sql = new Owl_DB(); 137 + $sql = $default->db;
138 $result = $sql->query("DELETE FROM $default->owl_units_table WHERE id = $this->iId"); 138 $result = $sql->query("DELETE FROM $default->owl_units_table WHERE id = $this->iId");
139 if ($result) 139 if ($result)
140 { 140 {
@@ -158,7 +158,7 @@ class Unit { @@ -158,7 +158,7 @@ class Unit {
158 function & get($iUnitID) 158 function & get($iUnitID)
159 { 159 {
160 global $default; 160 global $default;
161 - $sql = new Owl_DB(); 161 + $sql = $default->db;
162 $result = $sql->query("SELECT * FROM $default->owl_units_table WHERE id = $iUnitID"); 162 $result = $sql->query("SELECT * FROM $default->owl_units_table WHERE id = $iUnitID");
163 if ($result) 163 if ($result)
164 { 164 {
@@ -207,7 +207,7 @@ class Unit { @@ -207,7 +207,7 @@ class Unit {
207 global $default, $lang_err_database; 207 global $default, $lang_err_database;
208 $aUnitArray; 208 $aUnitArray;
209 settype($aUnitArray, "array"); 209 settype($aUnitArray, "array");
210 - $sql = new Owl_DB(); 210 + $sql = $default->db;
211 $result = $sql->query("SELECT * FROM " . $default->owl_units_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 211 $result = $sql->query("SELECT * FROM " . $default->owl_units_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
212 if ($result) 212 if ($result)
213 { 213 {
lib/users/User.inc
@@ -279,7 +279,7 @@ class User { @@ -279,7 +279,7 @@ class User {
279 if ($this->iId < 0) 279 if ($this->iId < 0)
280 { 280 {
281 //check to see if name exsits 281 //check to see if name exsits
282 - $sql = new Owl_DB(); 282 + $sql = $default->db;
283 $query = "SELECT username FROM ". $default->owl_users_table ." WHERE username = '" . $this->sUserName . "'"; 283 $query = "SELECT username FROM ". $default->owl_users_table ." WHERE username = '" . $this->sUserName . "'";
284 $sql->query($query); 284 $sql->query($query);
285 $rows = $sql->num_rows($sql); 285 $rows = $sql->num_rows($sql);
@@ -318,7 +318,7 @@ class User { @@ -318,7 +318,7 @@ class User {
318 global $default, $lang_err_database, $lang_err_object_key; 318 global $default, $lang_err_database, $lang_err_object_key;
319 //only update if the object has been stored 319 //only update if the object has been stored
320 if ($this->iId > 0) { 320 if ($this->iId > 0) {
321 - $sql = new Owl_DB(); 321 + $sql = $default->db;
322 $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"); 322 $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");
323 if ($result) { 323 if ($result) {
324 return true; 324 return true;
@@ -340,7 +340,7 @@ class User { @@ -340,7 +340,7 @@ class User {
340 global $default, $lang_err_database, $lang_err_object_key; 340 global $default, $lang_err_database, $lang_err_object_key;
341 //only delete the object if it exists in the database 341 //only delete the object if it exists in the database
342 if ($this->iId >= 0) { 342 if ($this->iId >= 0) {
343 - $sql = new Owl_DB(); 343 + $sql = $default->db;
344 $result = $sql->query("DELETE FROM $default->owl_users_table WHERE id = $this->iId"); 344 $result = $sql->query("DELETE FROM $default->owl_users_table WHERE id = $this->iId");
345 if ($result) { 345 if ($result) {
346 return true; 346 return true;
@@ -362,7 +362,7 @@ class User { @@ -362,7 +362,7 @@ class User {
362 */ 362 */
363 function & get($iUserID) { 363 function & get($iUserID) {
364 global $default; 364 global $default;
365 - $sql = new Owl_DB(); 365 + $sql = $default->db;
366 $result = $sql->query("SELECT * FROM $default->owl_users_table WHERE id = $iUserID"); 366 $result = $sql->query("SELECT * FROM $default->owl_users_table WHERE id = $iUserID");
367 if ($result) { 367 if ($result) {
368 if ($sql->next_record()) { 368 if ($sql->next_record()) {
@@ -389,7 +389,7 @@ class User { @@ -389,7 +389,7 @@ class User {
389 global $default, $lang_err_database; 389 global $default, $lang_err_database;
390 $aUserArray; 390 $aUserArray;
391 settype($aUserArray, "array"); 391 settype($aUserArray, "array");
392 - $sql = new Owl_DB(); 392 + $sql = $default->db;
393 $result = $sql->query("SELECT * FROM " . $default->owl_users_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 393 $result = $sql->query("SELECT * FROM " . $default->owl_users_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
394 if ($result) { 394 if ($result) {
395 $iCount = 0; 395 $iCount = 0;
@@ -415,7 +415,7 @@ class User { @@ -415,7 +415,7 @@ class User {
415 function getUnitID($userID) { 415 function getUnitID($userID) {
416 global $default, $lang_err_database; 416 global $default, $lang_err_database;
417 417
418 - $sql = new Owl_DB(); 418 + $sql = $default->db;
419 $result = $sql->query("SELECT DISTINCT gul.unit_id FROM $default->owl_users_groups_table ugl " . 419 $result = $sql->query("SELECT DISTINCT gul.unit_id FROM $default->owl_users_groups_table ugl " .
420 "INNER JOIN $default->owl_groups_units_table gul ON ugl.group_id = gul.group_id ". 420 "INNER JOIN $default->owl_groups_units_table gul ON ugl.group_id = gul.group_id ".
421 "WHERE ugl.user_id=$userID"); 421 "WHERE ugl.user_id=$userID");
lib/visualpatterns/PatternDatabaseTable.inc
@@ -103,7 +103,9 @@ class PatternDatabaseTable { @@ -103,7 +103,9 @@ class PatternDatabaseTable {
103 * 103 *
104 * @todo possibly add in image size restraints for link types 2 and 3 104 * @todo possibly add in image size restraints for link types 2 and 3
105 */ 105 */
106 - function & render() { 106 + function & render() {
  107 + global $default;
  108 +
107 $sToRender = "<table width=\"100%\" height=\"100%\">\n"; 109 $sToRender = "<table width=\"100%\" height=\"100%\">\n";
108 $sToRender .= "<tr>\n"; 110 $sToRender .= "<tr>\n";
109 //$i starts at 1 because the $aColumns[0] is the ID column, which 111 //$i starts at 1 because the $aColumns[0] is the ID column, which
@@ -113,7 +115,7 @@ class PatternDatabaseTable { @@ -113,7 +115,7 @@ class PatternDatabaseTable {
113 } 115 }
114 $sToRender .= "</tr>\n"; 116 $sToRender .= "</tr>\n";
115 117
116 - $sql = & new Owl_DB(); 118 + $sql = & $default->db;
117 $sql->createSQLQueryWithOffset($this->sTableName, $this->aColumns, $this->iStartIndex, $this->iResultsToDisplay); 119 $sql->createSQLQueryWithOffset($this->sTableName, $this->aColumns, $this->iStartIndex, $this->iResultsToDisplay);
118 120
119 121
lib/visualpatterns/PatternEditableListFromQuery.inc
@@ -79,7 +79,9 @@ class PatternEditableListFromQuery { @@ -79,7 +79,9 @@ class PatternEditableListFromQuery {
79 } 79 }
80 80
81 function & render() { 81 function & render() {
82 - $sql = new Owl_DB(); 82 + global $default;
  83 +
  84 + $sql = $default->db;
83 $sql->query($this->sQuery); 85 $sql->query($this->sQuery);
84 if ($sql->next_record()) {; 86 if ($sql->next_record()) {;
85 $sToRender = ""; 87 $sToRender = "";
lib/visualpatterns/PatternEditableTableSqlQuery.inc
@@ -80,6 +80,8 @@ class PatternEditableTableSqlQuery { @@ -80,6 +80,8 @@ class PatternEditableTableSqlQuery {
80 } 80 }
81 81
82 function & render() { 82 function & render() {
  83 + global $default;
  84 +
83 //$sToRender = "<table border = 0, width=$this->sWidth>\n"; 85 //$sToRender = "<table border = 0, width=$this->sWidth>\n";
84 $sToRender = "<table cellpadding = 5, border = 0>\n"; 86 $sToRender = "<table cellpadding = 5, border = 0>\n";
85 if (isset($this->sTableCaption)) { 87 if (isset($this->sTableCaption)) {
@@ -90,7 +92,7 @@ class PatternEditableTableSqlQuery { @@ -90,7 +92,7 @@ class PatternEditableTableSqlQuery {
90 $sToRender .= "<th align=left>" . $this->aColumnHeaderNames[$i] . "</th>\n"; 92 $sToRender .= "<th align=left>" . $this->aColumnHeaderNames[$i] . "</th>\n";
91 } 93 }
92 } 94 }
93 - $sql = new Owl_DB(); 95 + $sql = $default->db;
94 $sql->query($this->sQuery); 96 $sql->query($this->sQuery);
95 if ($sql->num_rows() == 0) { 97 if ($sql->num_rows() == 0) {
96 $sToRender .= "<tr>\n"; 98 $sToRender .= "<tr>\n";
lib/visualpatterns/PatternListBox.inc
@@ -54,7 +54,9 @@ class PatternListBox { @@ -54,7 +54,9 @@ class PatternListBox {
54 * 54 *
55 */ 55 */
56 function & render() { 56 function & render() {
57 - $sql = new Owl_DB(); 57 + global $default;
  58 +
  59 + $sql = $default->db;
58 $sQuery = "SELECT DISTINCT $this->sDisplayColumn AS display, $this->sValueColumn AS value FROM $this->sTableName "; 60 $sQuery = "SELECT DISTINCT $this->sDisplayColumn AS display, $this->sValueColumn AS value FROM $this->sTableName ";
59 if (isset($this->sWhereClause)) { 61 if (isset($this->sWhereClause)) {
60 $sQuery .= "WHERE " . $this->sWhereClause . " "; 62 $sQuery .= "WHERE " . $this->sWhereClause . " ";
lib/visualpatterns/PatternListFromQuery.inc
@@ -70,7 +70,9 @@ class PatternListFromQuery { @@ -70,7 +70,9 @@ class PatternListFromQuery {
70 } 70 }
71 71
72 function & render() { 72 function & render() {
73 - $sql = new Owl_DB(); 73 + global $default;
  74 +
  75 + $sql = $default->db;
74 $sql->query($this->sQuery); 76 $sql->query($this->sQuery);
75 $sToRender = ""; 77 $sToRender = "";
76 $sToRender .= "<table border = 0, cellpadding = 5 " . (isset($this->iTableWidth) ? ", width = $this->iTableWidth" : "") . " >\n"; 78 $sToRender .= "<table border = 0, cellpadding = 5 " . (isset($this->iTableWidth) ? ", width = $this->iTableWidth" : "") . " >\n";
lib/visualpatterns/PatternMainPage.inc
@@ -17,6 +17,8 @@ @@ -17,6 +17,8 @@
17 class PatternMainPage { 17 class PatternMainPage {
18 18
19 function PatternMainPage() { 19 function PatternMainPage() {
  20 + global $default;
  21 +
20 $this->sFormAction = "$default->owl_root_url/control.php"; 22 $this->sFormAction = "$default->owl_root_url/control.php";
21 } 23 }
22 24
lib/visualpatterns/PatternTableSqlQuery.inc
@@ -84,7 +84,9 @@ class PatternTableSqlQuery { @@ -84,7 +84,9 @@ class PatternTableSqlQuery {
84 * 84 *
85 * @todo possibly add in image size restraints for link types 2 and 3 85 * @todo possibly add in image size restraints for link types 2 and 3
86 */ 86 */
87 - function & render() { 87 + function & render() {
  88 + global $default;
  89 +
88 $sToRender = "<table cellpadding = 5, border = 0>\n"; 90 $sToRender = "<table cellpadding = 5, border = 0>\n";
89 if (isset($this->sTableHeading)) { 91 if (isset($this->sTableHeading)) {
90 $sToRender .= "<caption align=\"top\" colspan = " . count($this->aColumns) . ", align=left><b>$this->sTableHeading</b></caption>\n"; 92 $sToRender .= "<caption align=\"top\" colspan = " . count($this->aColumns) . ", align=left><b>$this->sTableHeading</b></caption>\n";
@@ -94,7 +96,7 @@ class PatternTableSqlQuery { @@ -94,7 +96,7 @@ class PatternTableSqlQuery {
94 $sToRender .= "<th align=left>" . $this->aColumnHeaderNames[$i] . "</th>\n"; 96 $sToRender .= "<th align=left>" . $this->aColumnHeaderNames[$i] . "</th>\n";
95 } 97 }
96 } 98 }
97 - $sql = new Owl_DB(); 99 + $sql = $default->db;
98 $sql->query($this->sQuery); 100 $sql->query($this->sQuery);
99 if ($sql->num_rows() == 0) { 101 if ($sql->num_rows() == 0) {
100 $sToRender .= "<tr>\n"; 102 $sToRender .= "<tr>\n";
lib/web/Subscription.inc
@@ -51,7 +51,7 @@ class Subscription { @@ -51,7 +51,7 @@ class Subscription {
51 global $default, $lang_err_database, $lang_err_object_exists; 51 global $default, $lang_err_database, $lang_err_object_exists;
52 //if the object hasn't been created 52 //if the object hasn't been created
53 if ($this->iId < 0) { 53 if ($this->iId < 0) {
54 - $sql = new Owl_DB(); 54 + $sql = $default->db;
55 $result = $sql->query("INSERT INTO " . $default->owl_subscriptions_table . " (user_id, document_id) VALUES ($this->iUserID, $this->iDocumentID)"); 55 $result = $sql->query("INSERT INTO " . $default->owl_subscriptions_table . " (user_id, document_id) VALUES ($this->iUserID, $this->iDocumentID)");
56 if ($result) { 56 if ($result) {
57 $this->iId = $sql->insert_id(); 57 $this->iId = $sql->insert_id();
@@ -74,7 +74,7 @@ class Subscription { @@ -74,7 +74,7 @@ class Subscription {
74 global $default, $lang_err_database, $lang_err_object_key; 74 global $default, $lang_err_database, $lang_err_object_key;
75 //only update if the object has been stored 75 //only update if the object has been stored
76 if ($this->iId > 0) { 76 if ($this->iId > 0) {
77 - $sql = new Owl_DB(); 77 + $sql = $default->db;
78 $result = $sql->query("UPDATE " . $default->owl_subscriptions_table . " SET user_id = $this->iUserID, document_id = $this->iDocumentID WHERE id = $this->iId"); 78 $result = $sql->query("UPDATE " . $default->owl_subscriptions_table . " SET user_id = $this->iUserID, document_id = $this->iDocumentID WHERE id = $this->iId");
79 if ($result) { 79 if ($result) {
80 return true; 80 return true;
@@ -96,7 +96,7 @@ class Subscription { @@ -96,7 +96,7 @@ class Subscription {
96 global $default, $lang_err_database, $lang_err_object_key; 96 global $default, $lang_err_database, $lang_err_object_key;
97 //only delete the object if it exists in the database 97 //only delete the object if it exists in the database
98 if ($this->iId >= 0) { 98 if ($this->iId >= 0) {
99 - $sql = new Owl_DB(); 99 + $sql = $default->db;
100 $result = $sql->query("DELETE FROM $default->owl_subscriptions_table WHERE id = $this->iId"); 100 $result = $sql->query("DELETE FROM $default->owl_subscriptions_table WHERE id = $this->iId");
101 if ($result) { 101 if ($result) {
102 return true; 102 return true;
@@ -118,7 +118,7 @@ class Subscription { @@ -118,7 +118,7 @@ class Subscription {
118 */ 118 */
119 function & get($iSubscriptionID) { 119 function & get($iSubscriptionID) {
120 global $default; 120 global $default;
121 - $sql = new Owl_DB(); 121 + $sql = $default->db;
122 $result = $sql->query("SELECT * FROM $default->owl_subscriptions_table WHERE id = $iSubscriptionID"); 122 $result = $sql->query("SELECT * FROM $default->owl_subscriptions_table WHERE id = $iSubscriptionID");
123 if ($result) { 123 if ($result) {
124 if ($sql->next_record()) { 124 if ($sql->next_record()) {
@@ -145,7 +145,7 @@ class Subscription { @@ -145,7 +145,7 @@ class Subscription {
145 global $default, $lang_err_database; 145 global $default, $lang_err_database;
146 $aSubscriptionArray; 146 $aSubscriptionArray;
147 settype($aSubscriptionArray, "array"); 147 settype($aSubscriptionArray, "array");
148 - $sql = new Owl_DB(); 148 + $sql = $default->db;
149 $result = $sql->query("SELECT * FROM " . $default->owl_subscriptions_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 149 $result = $sql->query("SELECT * FROM " . $default->owl_subscriptions_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
150 if ($result) { 150 if ($result) {
151 $iCount = 0; 151 $iCount = 0;
lib/web/WebDocument.inc
@@ -50,7 +50,7 @@ class WebDocument { @@ -50,7 +50,7 @@ class WebDocument {
50 global $default, $lang_err_database, $lang_err_object_exists; 50 global $default, $lang_err_database, $lang_err_object_exists;
51 //if the object hasn't been created 51 //if the object hasn't been created
52 if ($this->iId < 0) { 52 if ($this->iId < 0) {
53 - $sql = new Owl_DB(); 53 + $sql = $default->db;
54 $result = $sql->query("INSERT INTO " . $default->owl_web_documents_table . " (document_id, web_site_id, unit_id, status_id, datetime) VALUES ($this->iDocumentID, $this->iWebSiteID, $this->iUnitID, $this->iStatusID, '$this->dDateTime')"); 54 $result = $sql->query("INSERT INTO " . $default->owl_web_documents_table . " (document_id, web_site_id, unit_id, status_id, datetime) VALUES ($this->iDocumentID, $this->iWebSiteID, $this->iUnitID, $this->iStatusID, '$this->dDateTime')");
55 if ($result) { 55 if ($result) {
56 $this->iId = $sql->insert_id(); 56 $this->iId = $sql->insert_id();
@@ -73,7 +73,7 @@ class WebDocument { @@ -73,7 +73,7 @@ class WebDocument {
73 global $default, $lang_err_database, $lang_err_object_key; 73 global $default, $lang_err_database, $lang_err_object_key;
74 //only update if the object has been stored 74 //only update if the object has been stored
75 if ($this->iId > 0) { 75 if ($this->iId > 0) {
76 - $sql = new Owl_DB(); 76 + $sql = $default->db;
77 $result = $sql->query("UPDATE " . $default->owl_web_documents_table . " SET document_id = $this->iDocumentID, web_site_id = $this->iWebSiteID, unit_id = $this->iUnitID, status_id = $this->iStatusID, datetime = '$this->dDateTime' WHERE id = $this->iId"); 77 $result = $sql->query("UPDATE " . $default->owl_web_documents_table . " SET document_id = $this->iDocumentID, web_site_id = $this->iWebSiteID, unit_id = $this->iUnitID, status_id = $this->iStatusID, datetime = '$this->dDateTime' WHERE id = $this->iId");
78 if ($result) { 78 if ($result) {
79 return true; 79 return true;
@@ -95,7 +95,7 @@ class WebDocument { @@ -95,7 +95,7 @@ class WebDocument {
95 global $default, $lang_err_database, $lang_err_object_key; 95 global $default, $lang_err_database, $lang_err_object_key;
96 //only delete the object if it exists in the database 96 //only delete the object if it exists in the database
97 if ($this->iId >= 0) { 97 if ($this->iId >= 0) {
98 - $sql = new Owl_DB(); 98 + $sql = $default->db;
99 $result = $sql->query("DELETE FROM $default->owl_web_documents_table WHERE id = $this->iId"); 99 $result = $sql->query("DELETE FROM $default->owl_web_documents_table WHERE id = $this->iId");
100 if ($result) { 100 if ($result) {
101 return true; 101 return true;
@@ -117,7 +117,7 @@ class WebDocument { @@ -117,7 +117,7 @@ class WebDocument {
117 */ 117 */
118 function & get($iWebDocumentsID) { 118 function & get($iWebDocumentsID) {
119 global $default; 119 global $default;
120 - $sql = new Owl_DB(); 120 + $sql = $default->db;
121 $result = $sql->query("SELECT * FROM $default->owl_web_documents_table WHERE id = $iWebDocumentsID"); 121 $result = $sql->query("SELECT * FROM $default->owl_web_documents_table WHERE id = $iWebDocumentsID");
122 if ($result) { 122 if ($result) {
123 if ($sql->next_record()) { 123 if ($sql->next_record()) {
@@ -144,7 +144,7 @@ class WebDocument { @@ -144,7 +144,7 @@ class WebDocument {
144 global $default, $lang_err_database; 144 global $default, $lang_err_database;
145 $aWebDocumentArray; 145 $aWebDocumentArray;
146 settype($aWebDocumentArray, "array"); 146 settype($aWebDocumentArray, "array");
147 - $sql = new Owl_DB(); 147 + $sql = $default->db;
148 $result = $sql->query("SELECT * FROM " . $default->owl_web_documents_table . (isset($sWhereClause) ? " " . $sWhereClause : "")); 148 $result = $sql->query("SELECT * FROM " . $default->owl_web_documents_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
149 if ($result) { 149 if ($result) {
150 $iCount = 0; 150 $iCount = 0;
lib/web/WebSite.inc
@@ -120,7 +120,7 @@ class WebSite { @@ -120,7 +120,7 @@ class WebSite {
120 global $default, $lang_err_database, $lang_err_object_exists; 120 global $default, $lang_err_database, $lang_err_object_exists;
121 //if the object hasn't been created 121 //if the object hasn't been created
122 if ($this->iId < 0) { 122 if ($this->iId < 0) {
123 - $sql = new Owl_DB(); 123 + $sql = $default->db;
124 $result = $sql->query("INSERT INTO " . $default->owl_web_sites_table . " (web_site_name, web_site_url, web_master_id) VALUES ('" . addslashes($this->sWebSiteName) . "', '" . addslashes($this->sWebSiteURL) . "', $this->iWebMasterID)"); 124 $result = $sql->query("INSERT INTO " . $default->owl_web_sites_table . " (web_site_name, web_site_url, web_master_id) VALUES ('" . addslashes($this->sWebSiteName) . "', '" . addslashes($this->sWebSiteURL) . "', $this->iWebMasterID)");
125 if ($result) { 125 if ($result) {
126 $this->iId = $sql->insert_id(); 126 $this->iId = $sql->insert_id();
@@ -143,7 +143,7 @@ class WebSite { @@ -143,7 +143,7 @@ class WebSite {
143 global $default, $lang_err_database, $lang_err_object_key; 143 global $default, $lang_err_database, $lang_err_object_key;
144 //only update if the object has been stored 144 //only update if the object has been stored
145 if ($this->iId > 0) { 145 if ($this->iId > 0) {
146 - $sql = new Owl_DB(); 146 + $sql = $default->db;
147 $result = $sql->query("UPDATE " . $default->owl_web_sites_table . " SET web_site_name = '" . addslashes($this->sWebSiteName) . "', web_site_url = '" . addslashes($this->sWebSiteURL) . "', web_master_id = $this->iWebMasterID WHERE id = $this->iId"); 147 $result = $sql->query("UPDATE " . $default->owl_web_sites_table . " SET web_site_name = '" . addslashes($this->sWebSiteName) . "', web_site_url = '" . addslashes($this->sWebSiteURL) . "', web_master_id = $this->iWebMasterID WHERE id = $this->iId");
148 if ($result) { 148 if ($result) {
149 return true; 149 return true;
@@ -165,7 +165,7 @@ class WebSite { @@ -165,7 +165,7 @@ class WebSite {
165 global $default, $lang_err_database, $lang_err_object_key; 165 global $default, $lang_err_database, $lang_err_object_key;
166 //only delete the object if it exists in the database 166 //only delete the object if it exists in the database
167 if ($this->iId >= 0) { 167 if ($this->iId >= 0) {
168 - $sql = new Owl_DB(); 168 + $sql = $default->db;
169 $result = $sql->query("DELETE FROM $default->owl_web_sites_table WHERE id = $this->iId"); 169 $result = $sql->query("DELETE FROM $default->owl_web_sites_table WHERE id = $this->iId");
170 if ($result) { 170 if ($result) {
171 return true; 171 return true;
@@ -187,7 +187,7 @@ class WebSite { @@ -187,7 +187,7 @@ class WebSite {
187 */ 187 */
188 function & get($iWebSiteID) { 188 function & get($iWebSiteID) {
189 global $default; 189 global $default;
190 - $sql = new Owl_DB(); 190 + $sql = $default->db;
191 $result = $sql->query("SELECT * FROM $default->owl_web_sites_table WHERE id = $iWebSiteID"); 191 $result = $sql->query("SELECT * FROM $default->owl_web_sites_table WHERE id = $iWebSiteID");
192 if ($result) { 192 if ($result) {
193 if ($sql->next_record()) { 193 if ($sql->next_record()) {
@@ -212,7 +212,7 @@ class WebSite { @@ -212,7 +212,7 @@ class WebSite {
212 global $default, $lang_err_database; 212 global $default, $lang_err_database;
213 $aWebSiteArray; 213 $aWebSiteArray;
214 settype($aWebSiteArray, "array"); 214 settype($aWebSiteArray, "array");
215 - $sql = new Owl_DB(); 215 + $sql = $default->db;
216 $result = $sql->query("SELECT * FROM " . $default->owl_web_sites_table); 216 $result = $sql->query("SELECT * FROM " . $default->owl_web_sites_table);
217 if ($result) { 217 if ($result) {
218 $iCount = 0; 218 $iCount = 0;
presentation/lookAndFeel/knowledgeTree/store.php
@@ -116,7 +116,7 @@ for ($i = 0; $i &lt; count($aKeys); $i++) { @@ -116,7 +116,7 @@ for ($i = 0; $i &lt; count($aKeys); $i++) {
116 break; 116 break;
117 } 117 }
118 //execute the query 118 //execute the query
119 - $sql = new Owl_DB(); 119 + $sql = $default->db;
120 $sql->query($sQuery); 120 $sql->query($sQuery);
121 } else { 121 } else {
122 //perform an update 122 //perform an update
@@ -149,7 +149,7 @@ for ($i = 0; $i &lt; count($aKeys); $i++) { @@ -149,7 +149,7 @@ for ($i = 0; $i &lt; count($aKeys); $i++) {
149 } 149 }
150 $sQuery .= "WHERE id = $iPrimaryKey"; 150 $sQuery .= "WHERE id = $iPrimaryKey";
151 //execute the query 151 //execute the query
152 - $sql = new Owl_DB(); 152 + $sql = $default->db;
153 $sql->query($sQuery); 153 $sql->query($sQuery);
154 } 154 }
155 155