Commit 6b8975276ff61066d80d6537d4d8c8d05466072e

Authored by Michael Joseph
1 parent db070caf

added copyright and gpl notice

removed owl prefix from table aliases


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2556 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/browse/Browser.inc
1 1 <?php
2   -
3 2 require_once("$default->fileSystemRoot/lib/security/permission.inc");
4 3 require_once("$default->fileSystemRoot/lib/users/User.inc");
5 4 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
6 5 require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
7   -
8 6 /**
9   - *
10 7 * $Id$
11   - *
  8 + *
12 9 * Contains document browsing business logic.
13 10 *
14   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  11 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  12 + *
  13 + * This program is free software; you can redistribute it and/or modify
  14 + * it under the terms of the GNU General Public License as published by
  15 + * the Free Software Foundation; either version 2 of the License, or
  16 + * (at your option) any later version.
  17 + *
  18 + * This program is distributed in the hope that it will be useful,
  19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21 + * GNU General Public License for more details.
  22 + *
  23 + * You should have received a copy of the GNU General Public License
  24 + * along with this program; if not, write to the Free Software
  25 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 26 *
16 27 * @version $Revision$
17 28 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
18   - *
19 29 * @package lib.browse
20 30 */
21 31 class Browser {
... ...
lib/browse/BrowserFactory.inc
... ... @@ -4,18 +4,29 @@ require_once(&quot;$default-&gt;fileSystemRoot/lib/browse/Browser.inc&quot;);
4 4 require_once("$default->fileSystemRoot/lib/browse/FolderBrowser.inc");
5 5 require_once("$default->fileSystemRoot/lib/browse/CategoryBrowser.inc");
6 6 require_once("$default->fileSystemRoot/lib/browse/DocumentTypeBrowser.inc");
7   -
8 7 /**
9   - *
10 8 * $Id$
11   - *
  9 + *
12 10 * Responsible for generating the appropriate browser class instance.
13 11 *
14   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  12 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  13 + *
  14 + * This program is free software; you can redistribute it and/or modify
  15 + * it under the terms of the GNU General Public License as published by
  16 + * the Free Software Foundation; either version 2 of the License, or
  17 + * (at your option) any later version.
  18 + *
  19 + * This program is distributed in the hope that it will be useful,
  20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22 + * GNU General Public License for more details.
  23 + *
  24 + * You should have received a copy of the GNU General Public License
  25 + * along with this program; if not, write to the Free Software
  26 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 27 *
16 28 * @version $Revision$
17 29 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
18   - *
19 30 * @package lib.browse
20 31 */
21 32 class BrowserFactory {
... ...
lib/browse/CategoryBrowser.inc
... ... @@ -4,19 +4,30 @@ require_once(&quot;$default-&gt;fileSystemRoot/lib/security/permission.inc&quot;);
4 4 require_once("$default->fileSystemRoot/lib/users/User.inc");
5 5 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
6 6 require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
7   -
8 7 /**
9   - *
10 8 * $Id$
11   - *
12   - * Contains document browsing business logic.
13 9 *
14   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  10 + * Contains category view document browsing business logic.
  11 + *
  12 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  13 + *
  14 + * This program is free software; you can redistribute it and/or modify
  15 + * it under the terms of the GNU General Public License as published by
  16 + * the Free Software Foundation; either version 2 of the License, or
  17 + * (at your option) any later version.
  18 + *
  19 + * This program is distributed in the hope that it will be useful,
  20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22 + * GNU General Public License for more details.
  23 + *
  24 + * You should have received a copy of the GNU General Public License
  25 + * along with this program; if not, write to the Free Software
  26 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 27 *
16 28 * @version $Revision$
17 29 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
18   - *
19   - * @package lib.documentmanagement
  30 + * @package lib.browse
20 31 */
21 32 class CategoryBrowser extends Browser {
22 33  
... ... @@ -48,7 +59,7 @@ class CategoryBrowser extends Browser {
48 59 $sql = $default->db;
49 60  
50 61 // lookup document_fields id for category
51   - $categoryFieldID = lookupID($default->owl_fields_table, "name", "$categoryField");
  62 + $categoryFieldID = lookupID($default->document_fields_table, "name", "$categoryField");
52 63 $default->log->debug("CategoryBrowser::browse() categoryFieldID=$categoryFieldID");
53 64  
54 65 if ($sCategoryName == "") {
... ... @@ -57,7 +68,7 @@ class CategoryBrowser extends Browser {
57 68 // set the first value to "categories"
58 69 $results["categories"][] = "Categories";
59 70 // get a list of category values
60   - $query = "SELECT DISTINCT value FROM $default->owl_document_fields_table WHERE document_field_id=$categoryFieldID ORDER BY value " . ($this->sSortField == "name" ? $this->sSortDirection : "ASC");
  71 + $query = "SELECT DISTINCT value FROM $default->document_fields_link_table WHERE document_field_id=$categoryFieldID ORDER BY value " . ($this->sSortField == "name" ? $this->sSortDirection : "ASC");
61 72 $default->log->info("CategoryBrowser::browse() category listing query=$query; $this->sSortField");
62 73 $sql->query($query);
63 74 // loop through resultset, build array and return
... ... @@ -74,8 +85,8 @@ class CategoryBrowser extends Browser {
74 85  
75 86 // we have a category to use, so find all the documents
76 87 // with this category value
77   - $categoryQuery = "SELECT df.document_id FROM $default->owl_document_fields_table df " .
78   - "INNER JOIN $default->owl_documents_table d ON df.document_id = d.id ";
  88 + $categoryQuery = "SELECT df.document_id FROM $default->document_fields_link_table df " .
  89 + "INNER JOIN $default->documents_table d ON df.document_id = d.id ";
79 90 if ( isset($aLookupCriteria) ) {
80 91 $categoryQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON ";
81 92 $categoryQuery .= "d.$this->sSortField" . "=lt." . (isset($aLookupCriteria["joinColumn"]) ? $aLookupCriteria["joinColumn"] : "id");
... ...
lib/browse/DocumentTypeBrowser.inc
1 1 <?php
2   -
3 2 require_once("$default->fileSystemRoot/lib/security/permission.inc");
4 3 require_once("$default->fileSystemRoot/lib/users/User.inc");
5 4 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
6 5 require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
7   -
8 6 /**
9   - *
10 7 * $Id$
11   - *
12   - * Contains document browsing business logic.
13 8 *
14   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  9 + * Contains document type view document browsing business logic.
  10 + *
  11 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  12 + *
  13 + * This program is free software; you can redistribute it and/or modify
  14 + * it under the terms of the GNU General Public License as published by
  15 + * the Free Software Foundation; either version 2 of the License, or
  16 + * (at your option) any later version.
  17 + *
  18 + * This program is distributed in the hope that it will be useful,
  19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21 + * GNU General Public License for more details.
  22 + *
  23 + * You should have received a copy of the GNU General Public License
  24 + * along with this program; if not, write to the Free Software
  25 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 26 *
16 27 * @version $Revision$
17 28 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
18   - *
19   - * @package lib.documentmanagement
  29 + * @package lib.browse
20 30 */
21 31 class DocumentTypeBrowser extends Browser {
22 32  
... ... @@ -51,7 +61,7 @@ class DocumentTypeBrowser extends Browser {
51 61 $results["documentTypes"][] = array("name" => "Document Types");
52 62  
53 63 // return a list of document types
54   - $query = "SELECT * FROM $default->owl_document_types_table ORDER BY name " . ($this->sSortField == "name" ? $this->sSortDirection : "ASC");
  64 + $query = "SELECT * FROM $default->document_types_table ORDER BY name " . ($this->sSortField == "name" ? $this->sSortDirection : "ASC");
55 65  
56 66 $sql->query($query);
57 67 while ($sql->next_record()) {
... ... @@ -62,11 +72,11 @@ class DocumentTypeBrowser extends Browser {
62 72 $aLookupCriteria = $this->aSortCriteria[$this->sSortField]["lookup"];
63 73  
64 74 // lookup document type name from the passed in id
65   - $documentTypeName = lookupField($default->owl_document_types_table, "name", "id", $iDocumentTypeID);
  75 + $documentTypeName = lookupField($default->document_types_table, "name", "id", $iDocumentTypeID);
66 76 $results["documentTypes"][] = array("id" => $iDocumentTypeID, "name" => $documentTypeName);
67 77  
68 78 // create query to retrieve documents with this document type
69   - $documentQuery = "SELECT d.id as id FROM $default->owl_documents_table d ";
  79 + $documentQuery = "SELECT d.id as id FROM $default->documents_table d ";
70 80 if ( isset($aLookupCriteria) ) {
71 81 //$documentQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON d.$this->sSortField=lt.id ";
72 82 $documentQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON ";
... ...
lib/browse/FolderBrowser.inc
1 1 <?php
2   -
3 2 require_once("$default->fileSystemRoot/lib/browse/Browser.inc");
4 3 require_once("$default->fileSystemRoot/lib/security/permission.inc");
5 4 require_once("$default->fileSystemRoot/lib/users/User.inc");
6 5 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
7 6 require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
8   -
9 7 /**
10   - *
11 8 * $Id$
12   - *
13   - * Contains document browsing business logic.
14 9 *
15   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  10 + * Contains folder view document browsing business logic.
  11 + *
  12 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  13 + *
  14 + * This program is free software; you can redistribute it and/or modify
  15 + * it under the terms of the GNU General Public License as published by
  16 + * the Free Software Foundation; either version 2 of the License, or
  17 + * (at your option) any later version.
  18 + *
  19 + * This program is distributed in the hope that it will be useful,
  20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22 + * GNU General Public License for more details.
  23 + *
  24 + * You should have received a copy of the GNU General Public License
  25 + * along with this program; if not, write to the Free Software
  26 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 27 *
17 28 * @version $Revision$
18 29 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
19   - *
20   - * @package lib.documentmanagement
  30 + * @package lib.browse
21 31 */
22 32 class FolderBrowser extends Browser {
23 33  
... ... @@ -58,7 +68,7 @@ class FolderBrowser extends Browser {
58 68 // if the user is in a unit, start at the unit's root folder
59 69  
60 70 // lookup the unit name
61   - $unitName = lookupField($default->owl_units_table, "name", "id", $unitID);
  71 + $unitName = lookupField($default->units_table, "name", "id", $unitID);
62 72  
63 73 // the unit root folder has the same name as the unit
64 74 // FIXME: dodgy i know, but its easy
... ... @@ -69,7 +79,7 @@ class FolderBrowser extends Browser {
69 79  
70 80 if (!$aFolders) {
71 81 // no folder exists with this name, so start at the root
72   - $iFolderID = lookupID($default->owl_folders_table, "parent_id", 0);
  82 + $iFolderID = lookupID($default->folders_table, "parent_id", 0);
73 83 } else {
74 84 $iFolderID = $aFolders[0]->getID();
75 85 }
... ... @@ -77,7 +87,7 @@ class FolderBrowser extends Browser {
77 87 } else {
78 88 // else just start at the root
79 89 // FIXME: start at the root folder for the default organisation
80   - $iFolderID = lookupID($default->owl_folders_table, "parent_id", 0);
  90 + $iFolderID = lookupID($default->folders_table, "parent_id", 0);
81 91 }
82 92 }
83 93  
... ... @@ -93,7 +103,7 @@ class FolderBrowser extends Browser {
93 103 $aLookupCriteria = $this->aSortCriteria[$this->sSortField]["lookup"];
94 104  
95 105 // if we're sorting by name or creator_id then sort folders in the appropriate direction
96   - $sFolderQuery = "SELECT f.id FROM $default->owl_folders_table AS f ";
  106 + $sFolderQuery = "SELECT f.id FROM $default->folders_table AS f ";
97 107 if (in_array($this->sSortField, array("name", "creator_id"))) {
98 108 if (isset($aLookupCriteria)) {
99 109 $sFolderQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON f.$this->sSortField=lt.id WHERE parent_id=" . $iFolderID;
... ... @@ -113,7 +123,7 @@ class FolderBrowser extends Browser {
113 123 }
114 124  
115 125 // create query to retrieve documents in this folder
116   - $documentQuery = "SELECT d.id as id FROM $default->owl_documents_table AS d ";
  126 + $documentQuery = "SELECT d.id as id FROM $default->documents_table AS d ";
117 127 if ( isset($aLookupCriteria) ) {
118 128 $documentQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON ";
119 129 $documentQuery .= "d.$this->sSortField" . "=lt." . (isset($aLookupCriteria["joinColumn"]) ? $aLookupCriteria["joinColumn"] : "id");
... ...
lib/dashboard/Dashboard.inc
1 1 <?php
2   -
3 2 require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc");
4 3 require_once("$default->fileSystemRoot/lib/web/WebDocument.inc");
5 4 require_once("$default->fileSystemRoot/lib/links/link.inc");
6 5 require_once("$default->fileSystemRoot/lib/documentmanagement/DependantDocumentInstance.inc");
7 6 require_once("$default->fileSystemRoot/lib/archiving/ArchiveRestorationRequest.inc");
8   -
9 7 /**
10 8 * $Id$
  9 + *
  10 + * Contains dashboard helper functions.
  11 + *
  12 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  13 + *
  14 + * This program is free software; you can redistribute it and/or modify
  15 + * it under the terms of the GNU General Public License as published by
  16 + * the Free Software Foundation; either version 2 of the License, or
  17 + * (at your option) any later version.
11 18 *
12   - * Contains dashboard helper functions
  19 + * This program is distributed in the hope that it will be useful,
  20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22 + * GNU General Public License for more details.
13 23 *
14   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  24 + * You should have received a copy of the GNU General Public License
  25 + * along with this program; if not, write to the Free Software
  26 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 27 *
16 28 * @version $Revision$
17 29 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
18 30 * @package lib.dashboard
19 31 */
20   -
21 32 class Dashboard {
22 33  
23 34 /**
... ... @@ -66,7 +77,7 @@ class Dashboard {
66 77 function getPendingCollaborationDocuments(){
67 78 global $default;
68 79  
69   - $sQuery = "SELECT document_id FROM $default->owl_folders_user_roles_table WHERE active=1 AND user_id=" . $this->iUserID;
  80 + $sQuery = "SELECT document_id FROM $default->folders_user_roles_table WHERE active=1 AND user_id=" . $this->iUserID;
70 81 $aDocumentList = array();
71 82 $sql = $default->db;
72 83 if ($sql->query($sQuery)) {
... ... @@ -109,7 +120,7 @@ class Dashboard {
109 120 */
110 121 function getDependantDocuments() {
111 122 global $default;
112   - $sQuery = "SELECT id FROM $default->owl_dependant_document_instance_table WHERE user_id = " . $this->iUserID;
  123 + $sQuery = "SELECT id FROM $default->dependant_document_instance_table WHERE user_id = " . $this->iUserID;
113 124 $aDocumentList = array();
114 125 $sql = $default->db;
115 126 $sql->query($sQuery);
... ...
lib/dashboard/DashboardNews.inc
1 1 <?php
2   -
3 2 require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc");
4   -
5 3 /**
6 4 * $Id$
7   - *
  5 + *
8 6 * Represents a dashboard news item.
  7 + *
  8 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify
  11 + * it under the terms of the GNU General Public License as published by
  12 + * the Free Software Foundation; either version 2 of the License, or
  13 + * (at your option) any later version.
9 14 *
10   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  15 + * This program is distributed in the hope that it will be useful,
  16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18 + * GNU General Public License for more details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program; if not, write to the Free Software
  22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
11 23 *
12 24 * @version $Revision$
13 25 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
14 26 * @package lib.dashboard
15 27 */
16   -
17 28 class DashboardNews {
18 29  
19 30 /**
... ... @@ -294,7 +305,7 @@ class DashboardNews {
294 305 //if the id >= 0, then the object has already been created
295 306 if ($this->iId < 0) {
296 307 $sql = $default->db;
297   - $result = $sql->query("INSERT INTO $default->owl_news_table (synopsis, body, rank, image, image_size, image_mime_type_id, active) " .
  308 + $result = $sql->query("INSERT INTO $default->news_table (synopsis, body, rank, image, image_size, image_mime_type_id, active) " .
298 309 "VALUES ('" . addslashes($this->sSynopsis) . "', '" . addslashes($this->sBody) . "', $this->iRank, " .
299 310 "'" . addslashes($this->sImage) . "', $this->iImageSize, $this->iImageMimeTypeID, " . ($this->bActive ? "1" : "0") . ")");
300 311 if ($result) {
... ... @@ -303,7 +314,7 @@ class DashboardNews {
303 314  
304 315 if ($this->bActive) {
305 316 // we're setting this entry to active, so set all the others to inactive
306   - $sql->query("UPDATE $default->owl_news_table SET active=0 WHERE id <> $this->iId");
  317 + $sql->query("UPDATE $default->news_table SET active=0 WHERE id <> $this->iId");
307 318 }
308 319  
309 320 return true;
... ... @@ -322,7 +333,7 @@ class DashboardNews {
322 333 global $default;
323 334 if ($this->iId >= 0) {
324 335 $sql = $default->db;
325   - $sQuery = "UPDATE " . $default->owl_news_table . " SET " .
  336 + $sQuery = "UPDATE " . $default->news_table . " SET " .
326 337 "synopsis = '" . addslashes($this->sSynopsis) . "', " .
327 338 "body = '" . addslashes($this->sBody) . "', " .
328 339 "rank = $this->iRank, " .
... ... @@ -335,12 +346,12 @@ class DashboardNews {
335 346 if ($result) {
336 347 if ($this->bActive) {
337 348 // we're setting this entry to active, so set all the others to inactive
338   - $sql->query("UPDATE $default->owl_news_table SET active=0");
  349 + $sql->query("UPDATE $default->news_table SET active=0");
339 350 // now set our entry to active
340   - $sql->query("UPDATE $default->owl_news_table SET active=1 where id=$this->iId");
  351 + $sql->query("UPDATE $default->news_table SET active=1 where id=$this->iId");
341 352 } else {
342 353 // set this to inactive
343   - $sql->query("UPDATE $default->owl_news_table SET active=0 where id=$this->iId");
  354 + $sql->query("UPDATE $default->news_table SET active=0 where id=$this->iId");
344 355 }
345 356 return true;
346 357 }
... ... @@ -359,7 +370,7 @@ class DashboardNews {
359 370 global $default;
360 371 if ($this->iId >= 0) {
361 372 $sql = $default->db;
362   - $result = $sql->query("DELETE FROM " . $default->owl_news_table . " WHERE id = $this->iId");
  373 + $result = $sql->query("DELETE FROM " . $default->news_table . " WHERE id = $this->iId");
363 374 if ($result) {
364 375 $this->iId = -1;
365 376 return true;
... ... @@ -379,7 +390,7 @@ class DashboardNews {
379 390 function & get($iNewsID) {
380 391 global $default;
381 392 $sql = $default->db;
382   - $sql->query("SELECT * FROM $default->owl_news_table WHERE id = $iNewsID");
  393 + $sql->query("SELECT * FROM $default->news_table WHERE id = $iNewsID");
383 394 if ($sql->next_record()) {
384 395 $aImage = array( "image" => $sql->f("image"),
385 396 "filesize" => $sql->f("image_size"),
... ... @@ -403,7 +414,7 @@ class DashboardNews {
403 414 global $default;
404 415 $aDashboardNewsArray = array();
405 416 $sql = $default->db;
406   - $result = $sql->query("SELECT * FROM " . $default->owl_news_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "") . " ORDER BY rank ASC");
  417 + $result = $sql->query("SELECT * FROM " . $default->news_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "") . " ORDER BY rank ASC");
407 418 if ($result) {
408 419 $iCount = 0;
409 420 while ($sql->next_record()) {
... ...
lib/database/datetime.inc
1 1 <?php
2   -
3 2 /**
4 3 * $Id$
5 4 *
6   - * Contains datetime functions
  5 + * Contains datetime functions.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
7 8 *
8   - * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9 22 *
10 23 * @version $Revision$
11 24 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
12   - * @package lib.database
  25 + * @package lib.database
13 26 */
14 27  
15 28 /**
... ...
lib/database/db.inc
... ... @@ -4,11 +4,25 @@
4 4 *
5 5 * The default database wrapper class.
6 6 *
7   - * Licensed under the GNU GPL. For full terms see the file COPYING.
8   - *
9   - * @version $Revision$
10   - * @author Mukhtar Dharsey
11   - * @package lib.database
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22 + *
  23 + * @version $Revision$
  24 + * @author Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.database
12 26 */
13 27 class Database extends DB_Sql {
14 28  
... ...
lib/database/lookup.inc
1 1 <?php
2   -
3 2 /**
4 3 * $Id$
5 4 *
6   - * Contains database helper functions
  5 + * Contains database helper functions.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
7 8 *
8   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9 22 *
10 23 * @version $Revision$
11   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
12   - * @package lib.database
  24 +* @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.database
13 26 */
14 27  
15 28 /**
... ... @@ -37,7 +50,7 @@ function lookupName($tableName, $idFieldValue){
37 50  
38 51 function lookupStatusID($statusName) {
39 52 global $default;
40   - return lookupID($default->owl_status_table, "name", $statusName);
  53 + return lookupID($default->status_table, "name", $statusName);
41 54 }
42 55  
43 56 /**
... ... @@ -51,7 +64,7 @@ function lookupGroupIDs($userID) {
51 64 $groupIDs = array();
52 65  
53 66 $sql = $default->db;
54   - $sql->query("select group_id from $default->owl_users_groups_table where user_id = '$userID'");
  67 + $sql->query("select group_id from $default->users_groups_table where user_id = '$userID'");
55 68 while($sql->next_record()) {
56 69 $groupIDs[] = $sql->f("group_id");
57 70 }
... ...
lib/discussions/DiscussionComment.inc
... ... @@ -2,11 +2,27 @@
2 2 /**
3 3 * $Id$
4 4 *
5   - * Contains static functions concerned with sending emails
  5 + * Represents a document discussion comment.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6 22 *
7   - * @author Omar Rahbeeni, CS Holdings, South Africa
8 23 * @version $Revision$
9   - * @package lib.discussions
  24 + * @author Omar Rahbeeni, CS Holdings, South Africa
  25 + * @package lib.discussions
10 26 */
11 27 class DiscussionComment {
12 28  
... ... @@ -123,7 +139,7 @@ class DiscussionComment {
123 139 function & get($iNewCommentID) {
124 140 global $default;
125 141 $sql = $default->db;
126   - $result = $sql->query("SELECT * FROM $default->owl_discussion_comments_table WHERE id = $iNewCommentID");
  142 + $result = $sql->query("SELECT * FROM $default->discussion_comments_table WHERE id = $iNewCommentID");
127 143 if ($result) {
128 144 if ($sql->next_record()) {
129 145 $oDiscussionComment = & new DiscussionComment($sql->f("body"),$sql->f("subject"),$sql->f("user_id"),$sql->f("thread_id"));
... ... @@ -131,7 +147,7 @@ class DiscussionComment {
131 147 $oDiscussionComment->dDate = $sql->f("date");
132 148 return $oDiscussionComment;
133 149 }
134   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iNewCommentID . " table = $default->owl_discussion_comments_table";
  150 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iNewCommentID . " table = $default->discussion_comments_table";
135 151 return false;
136 152 }
137 153 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -144,7 +160,7 @@ class DiscussionComment {
144 160 if ($this->iId < 0) { //check to see if comment exists
145 161 $sql = $default->db;
146 162  
147   - $result = $sql->query("INSERT INTO " . $default->owl_discussion_comments_table . " (thread_id,user_id,subject, body, date)" .
  163 + $result = $sql->query("INSERT INTO " . $default->discussion_comments_table . " (thread_id,user_id,subject, body, date)" .
148 164 "VALUES (" . $this->iThreadID . "," . $this->iUserID . ",\"" . $this->sSubject . "\",\"" . $this->sBody . "\",Now())");
149 165 if ($result) {
150 166 $this->iId = $sql->insert_id();
... ... @@ -154,7 +170,7 @@ class DiscussionComment {
154 170 return false;
155 171  
156 172 }
157   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_units_table";
  173 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->units_table";
158 174 return false;
159 175 }
160 176  
... ... @@ -165,7 +181,7 @@ class DiscussionComment {
165 181 $sql = $default->db;
166 182 // Do update query
167 183  
168   - $result = $sql->query( "UPDATE " . $default->owl_discussion_comments_table .
  184 + $result = $sql->query( "UPDATE " . $default->discussion_comments_table .
169 185 " SET thread_id = " . $this->iThreadID .
170 186 " AND user_id = " . $this->iUserID .
171 187 " AND subject = " . $this->sSubject .
... ... @@ -189,7 +205,7 @@ class DiscussionComment {
189 205 if ($this->iId > 0) {
190 206 //check to see if group is linked to a unit
191 207 $sql = $default->db;
192   - $query = "SELECT * FROM ". $default->owl_discussion_comments_table . " WHERE id = " . $this->iId ;
  208 + $query = "SELECT * FROM ". $default->discussion_comments_table . " WHERE id = " . $this->iId ;
193 209 $sql->query($query);
194 210 $rows = $sql->num_rows($sql);
195 211  
... ... @@ -200,7 +216,7 @@ class DiscussionComment {
200 216  
201 217 } else {
202 218 $sql = $default->db;
203   - $result = $sql->query("DELETE FROM $default->owl_discussion_comments_table WHERE id = $this->iId");
  219 + $result = $sql->query("DELETE FROM $default->discussion_comments_table WHERE id = $this->iId");
204 220 if ($result) {
205 221 return true;
206 222 }
... ...
lib/discussions/DiscussionThread.inc
... ... @@ -2,11 +2,27 @@
2 2 /**
3 3 * $Id$
4 4 *
5   - * Contains static functions concerned with Discusion threads
  5 + * Represents a document discussion thread.
  6 + *
  7 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; either version 2 of the License, or
  12 + * (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6 22 *
7   - * @author Omar Rahbeeni, CS Holdings, South Africa
8 23 * @version $Revision$
9   - * @package lib.discussions
  24 + * @author Omar Rahbeeni, CS Holdings, South Africa
  25 + * @package lib.discussions
10 26 */
11 27 class DiscussionThread {
12 28  
... ... @@ -114,12 +130,12 @@ class DiscussionThread {
114 130 global $default;
115 131  
116 132 $sql = $default->db;
117   - $result = $sql->query("SELECT id FROM $default->owl_discussion_threads_table WHERE document_id = $this->iDocumentID ORDER BY id");
  133 + $result = $sql->query("SELECT id FROM $default->discussion_threads_table WHERE document_id = $this->iDocumentID ORDER BY id");
118 134 if ($result) {
119 135 $sql->next_record();
120 136 $iThreadID = $sql->f("id");
121 137  
122   - $result = $sql->query("SELECT id FROM $default->owl_discussion_comments_table WHERE thread_id = $iThreadID ORDER BY date Desc");
  138 + $result = $sql->query("SELECT id FROM $default->discussion_comments_table WHERE thread_id = $iThreadID ORDER BY date Desc");
123 139  
124 140 if ($result) {
125 141 while ($sql->next_record()) {
... ... @@ -142,7 +158,7 @@ class DiscussionThread {
142 158 function getThreadIDforDoc($iDocumentID){
143 159 global $default;
144 160 $sql = $default->db;
145   - $result = $sql->query("SELECT id FROM $default->owl_discussion_threads_table WHERE document_id = $iDocumentID");
  161 + $result = $sql->query("SELECT id FROM $default->discussion_threads_table WHERE document_id = $iDocumentID");
146 162 if ($result) {
147 163 if ($sql->next_record()) {
148 164 if ($sql->f("id") > 0) {
... ... @@ -151,7 +167,7 @@ class DiscussionThread {
151 167 return "false";
152 168 }
153 169 }
154   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "Document_id = " . $iDocumentID . " table = $default->owl_discussion_threads_table";
  170 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "Document_id = " . $iDocumentID . " table = $default->discussion_threads_table";
155 171 return false;
156 172 }
157 173 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -170,7 +186,7 @@ class DiscussionThread {
170 186 function & get($iNewThreadID) {
171 187 global $default;
172 188 $sql = $default->db;
173   - $result = $sql->query("SELECT * FROM $default->owl_discussion_threads_table WHERE id = $iNewThreadID");
  189 + $result = $sql->query("SELECT * FROM $default->discussion_threads_table WHERE id = $iNewThreadID");
174 190 if ($result) {
175 191 if ($sql->next_record()) {
176 192  
... ... @@ -184,7 +200,7 @@ class DiscussionThread {
184 200 $oDiscussionThread->iNumberOfReplies = $sql->f("replies");
185 201 return $oDiscussionThread;
186 202 }
187   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iNewThreadID . " table = $default->owl_discussion_threads_table";
  203 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iNewThreadID . " table = $default->discussion_threads_table";
188 204 return false;
189 205 }
190 206 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -200,7 +216,7 @@ class DiscussionThread {
200 216 $sQuery = "what the hell";
201 217 if ($this->iId < 0) { //check to see if entry exists
202 218 $sql = $default->db;
203   - $sQuery = "INSERT INTO " . $default->owl_discussion_threads_table .
  219 + $sQuery = "INSERT INTO " . $default->discussion_threads_table .
204 220 " (document_id, first_comment_id, last_comment_id, views, replies, creator_id) " .
205 221 "VALUES (" . $this->iDocumentID . "," . $this->iFirstCommentID . "," . $this->iLastCommentID . "," . $this->iNumberOfViews . "," . $this->iNumberOfReplies ."," . $this->iCreatorID . ")";
206 222 $result = $sql->query($sQuery);
... ... @@ -212,7 +228,7 @@ class DiscussionThread {
212 228 $_SESSION["errorMessage"] = $lang_err_database;
213 229 return false;
214 230 }
215   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_discussion_threads_table";
  231 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->discussion_threads_table";
216 232 return false;
217 233 }
218 234  
... ... @@ -224,7 +240,7 @@ class DiscussionThread {
224 240 //only update if the object has been stored
225 241 if ($this->iId > 0) {
226 242 $sql = $default->db;
227   - $sQuery = "UPDATE " . $default->owl_discussion_threads_table .
  243 + $sQuery = "UPDATE " . $default->discussion_threads_table .
228 244 " SET document_id = " . $this->iDocumentID .
229 245 ", first_comment_id = " . $this->iFirstCommentID .
230 246 ", last_comment_id = " . $this->iLastCommentID .
... ... @@ -256,7 +272,7 @@ class DiscussionThread {
256 272 if ($this->iId > 0) {
257 273 //check to see if group is linked to a unit
258 274 $sql = $default->db;
259   - $query = "SELECT * FROM ". $default->owl_discussion_threads_table ." WHERE id = " . $this->iId ;
  275 + $query = "SELECT * FROM ". $default->discussion_threads_table ." WHERE id = " . $this->iId ;
260 276 $sql->query($query);
261 277 $rows = $sql->num_rows($sql);
262 278  
... ... @@ -267,7 +283,7 @@ class DiscussionThread {
267 283  
268 284 } else {
269 285 $sql = $default->db;
270   - $result = $sql->query("DELETE FROM $default->owl_discussion_threads_table WHERE id = $this->iId");
  286 + $result = $sql->query("DELETE FROM $default->discussion_threads_table WHERE id = $this->iId");
271 287 if ($result) {
272 288 return true;
273 289 }
... ...