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