Commit f3ad5f25e1a2da42318afc7bcd77f29cc60c0bc2

Authored by michael
1 parent 26bd3e29

updated phpdocs

- @author
- @package
- @params
- GPL


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@365 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/Log.inc
1 1 <?php
  2 +
  3 +define("DEBUG", 0);
  4 +define("INFO", 1);
  5 +define("ERROR", 2);
  6 +
2 7 /**
3 8 * $Id$
4 9 *
... ... @@ -7,13 +12,9 @@
7 12 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 13 *
9 14 * @version $Revision$
10   - * @author <a href="mailto:michael@jamwarehouse.com">Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
11   - * @package dmslib
  15 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  16 + * @package lib
12 17 */
13   -define("DEBUG", 0);
14   -define("INFO", 1);
15   -define("ERROR", 2);
16   -
17 18 class Log {
18 19 /**
19 20 * The minimum logging level- log everything with
... ... @@ -33,7 +34,8 @@ class Log {
33 34 /**
34 35 * Default constructor
35 36 *
36   - * @param $logLevel the desired level to log at
  37 + * @param string the path to the logfile to write to
  38 + * @param int the desired level to log at
37 39 */
38 40 function Log($logFile, $logLevel = INFO) {
39 41 $this->logFile = $logFile;
... ... @@ -45,7 +47,7 @@ class Log {
45 47 /**
46 48 * Log a debug entry
47 49 *
48   - * @param $logEntry the message to write to the log file
  50 + * @param string the message to write to the log file
49 51 */
50 52 function debug($logEntry) {
51 53 $this->writeLog($this->prefixEntry($logEntry, "DEBUG"), DEBUG);
... ... @@ -54,7 +56,7 @@ class Log {
54 56 /**
55 57 * Log an info entry
56 58 *
57   - * @param $logEntry the message to write to the log file
  59 + * @param string the message to write to the log file
58 60 */
59 61 function info($logEntry) {
60 62 $this->writeLog($this->prefixEntry($logEntry, " INFO"), INFO);
... ... @@ -63,7 +65,7 @@ class Log {
63 65 /**
64 66 * Log an error entry
65 67 *
66   - * @param $logEntry the message to write to the log file
  68 + * @param string the message to write to the log file
67 69 */
68 70 function error($logEntry) {
69 71 $this->writeLog($this->prefixEntry($logEntry, "ERROR"), ERROR);
... ... @@ -73,8 +75,8 @@ class Log {
73 75 * Writes to the log file, checking that the log level is within
74 76 * the minimum logging level
75 77 *
76   - * @param $logEntry the message to write to the log file
77   - * @param $logLevel the error level to log at
  78 + * @param string the message to write to the log file
  79 + * @param int the error level to log at
78 80 */
79 81 function writeLog($logEntry, $logLevel) {
80 82 if ($logLevel >= $this->minimumLoggingLevel) {
... ... @@ -88,6 +90,9 @@ class Log {
88 90 /**
89 91 * Prefixes the log entry with the current date time, the logging level
90 92 * and the page that called it
  93 + *
  94 + * @param string the message to write to the log file
  95 + * @param int the error level to log at
91 96 */
92 97 function prefixEntry($logEntry, $logLevel) {
93 98 return getCurrentDateTime() . ":$logLevel: $logEntry\n";
... ...
lib/Session.inc
... ... @@ -4,16 +4,18 @@
4 4 *
5 5 * This class is used for session management.
6 6 *
7   - * @author <a href="mailto:michael@jamwarehouse.com">Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
  7 + * Licensed under the GNU GPL. For full terms see the file COPYING.
  8 + *
  9 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
8 10 * @version $Revision$
9   - * @package dmslib
  11 + * @package lib.session
10 12 */
11 13 class Session {
12 14  
13 15 /**
14 16 * Creates a session.
15 17 *
16   - * @param $userID the id of the user to create a session for
  18 + * @param int the id of the user to create a session for
17 19 * @return string the generated sessionID
18 20 */
19 21 function create($userID) {
... ... @@ -64,8 +66,7 @@ class Session {
64 66 /**
65 67 * Removes any stale sessions for the specified userID
66 68 *
67   - * @param userID
68   - * the userID to remove stale sessions for
  69 + * @param int the userID to remove stale sessions for
69 70 */
70 71 function removeStaleSessions($userID) {
71 72 global $default;
... ... @@ -78,8 +79,7 @@ class Session {
78 79 /**
79 80 * Used to verify the current user's session.
80 81 *
81   - * @return
82   - * array containing the userID, groupID and session verification status
  82 + * @return int session verification status
83 83 */
84 84 function verify() {
85 85 global $default, $lang_sesstimeout, $lang_sessinuse, $lang_err_sess_notvalid;
... ...
lib/authentication/LDAPAuthenticator.inc
... ... @@ -8,9 +8,11 @@ require_once(&quot;$default-&gt;owl_fs_root/lib/authentication/Authenticator.inc&quot;);
8 8 *
9 9 * Perform authentication tasks against LDAP compliant directory server.
10 10 *
  11 + * Licensed under the GNU GPL. For full terms see the file COPYING.
  12 + *
11 13 * @version $Revision$
12   - * @author <a href="mailto:michael@jamwarehouse.com">Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
13   - * @package dmslib
  14 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  15 + * @package lib.authentication
14 16 */
15 17 class LDAPAuthenticator extends Authenticator {
16 18  
... ... @@ -26,10 +28,8 @@ class LDAPAuthenticator extends Authenticator {
26 28 /**
27 29 * Creates a new instance of the LDAPAuthenticator
28 30 *
29   - * @param $ldapServer
30   - * the LDAP server to connect to for validation
31   - * @param $ldapDN
32   - * the dn branch to perform the authentication against
  31 + * @param string the LDAP server to connect to for validation
  32 + * @param string the dn branch to perform the authentication against
33 33 */
34 34 function LDAPAuthentication($ldapServer, $ldapDN) {
35 35 $this->ldapServer = $ldapServer;
... ... @@ -39,10 +39,8 @@ class LDAPAuthenticator extends Authenticator {
39 39 /**
40 40 * Checks the user's password against the LDAP directory
41 41 *
42   - * @param $userName
43   - * the name of the user to check
44   - * @param $password
45   - * the password to check
  42 + * @param string the name of the user to check
  43 + * @param string the password to check
46 44 * @return boolean true if the password is correct, else false
47 45 */
48 46 function checkPassword($userName, $password) {
... ...
lib/database/lookup.inc
... ... @@ -6,18 +6,19 @@
6 6 * Contains database helper functions
7 7 *
8 8 * Licensed under the GNU GPL. For full terms see the file COPYING.
  9 + *
9 10 * @version $Revision$
10   - * @author <a href="mailto:michael@jamwarehouse.com">Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
11   - * @package dmslib
  11 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  12 + * @package lib.database
12 13 */
13 14  
14 15 /**
15 16 * Performs an id field lookup on the specified table.
16 17 *
17   - * @param $tableName the name of table to perform the id lookup.
18   - * @param $fieldName the db field to return.
19   - * @param $fieldValue the value to perform the lookup for
20   - * @return the id of the row in the db with $fieldName=$fieldValue
  18 + * @param string the name of table to perform the id lookup.
  19 + * @param string the db field to return.
  20 + * @param mixed the value to perform the lookup for
  21 + * @return int the id of the row in the db with $fieldName=$fieldValue
21 22 */
22 23 function lookupID($tableName, $fieldName, $fieldValue){
23 24 return lookupField($tableName, "id", $fieldName, $fieldValue);
... ... @@ -26,8 +27,8 @@ function lookupID($tableName, $fieldName, $fieldValue){
26 27 /**
27 28 * Retrieves the groups that the user is a member of
28 29 *
29   - * @param $userID the user to lookup groups for
30   - * @return an array containing the groupsIDs the user is a member of
  30 + * @param int the user to lookup groups for
  31 + * @return array the groupsIDs the user is a member of
31 32 */
32 33 function lookupGroupIDs($userID) {
33 34 global $default;
... ... @@ -44,11 +45,10 @@ function lookupGroupIDs($userID) {
44 45 /**
45 46 * Performs a generic one field lookup on a table
46 47 *
47   - * @param $tableName the name of the table to perform the lookup on
48   - * @param $selectFieldName the field to return
49   - * @param $whereFieldName the field to discriminate against(?!)
50   - * @param $whereFieldValue the field value to return rows for
51   - * (NOTE: the caller is responsible for quoting this value)
  48 + * @param string the name of the table to perform the lookup on
  49 + * @param string the field to return
  50 + * @param string the field to discriminate against(?!)
  51 + * @param string the field value to return rows for
52 52 */
53 53 function lookupField($tableName, $selectFieldName, $whereFieldName, $whereFieldValue) {
54 54 global $default;
... ... @@ -71,6 +71,9 @@ function lookupField($tableName, $selectFieldName, $whereFieldName, $whereFieldV
71 71  
72 72 /**
73 73 * Converts an array to a string
  74 + *
  75 + * @param array the array to convert
  76 + * @return string stringified array
74 77 */
75 78 function arrayToString($array) {
76 79 ob_start();
... ... @@ -83,8 +86,8 @@ function arrayToString($array) {
83 86 /**
84 87 * Converts an array to a comma separated string
85 88 *
86   - * @param $array the array to convert
87   - * @return a comma separated string of the array values
  89 + * @param array the array to convert
  90 + * @return string a comma separated string of the array values
88 91 */
89 92 function arrayToCss($array) {
90 93 $css = "";
... ... @@ -108,7 +111,7 @@ function getCurrentDateTime() {
108 111 /**
109 112 * Returns the specified date time, formatted as Y-m-d H:i:s
110 113 *
111   - * @param $dateTime the date time to format
  114 + * @param int the date time to format
112 115 * @return string the formatted date time
113 116 */
114 117 function formatDateTime($dateTime) {
... ...
lib/documentmanagement/DocumentBrowser.inc
... ... @@ -7,17 +7,19 @@ require_once(&quot;$default-&gt;owl_fs_root/lib/security/permission.inc&quot;);
7 7 *
8 8 * Contains document browsing business logic.
9 9 *
  10 + * Licensed under the GNU GPL. For full terms see the file COPYING.
  11 + *
10 12 * @version $Revision$
11   - * @author <a href="mailto:michael@jamwarehouse.com">Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
12   - * @package dmslib
  13 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  14 + * @package lib.documentmanagement
13 15 */
14 16 class DocumentBrowser {
15 17  
16 18 /**
17 19 * Browse the documents by folder
18 20 *
19   - * @param $folderID the folder to browse from
20   - * @return an multidimensional array of folders and documents
  21 + * @param int the folder to browse from
  22 + * @return array folders and documents
21 23 */
22 24 function browseByFolder($folderID = -1) {
23 25 global $default;
... ... @@ -137,7 +139,7 @@ class DocumentBrowser {
137 139 /**
138 140 * Browse the documents by category
139 141 *
140   - * @param $category the category to browse
  142 + * @param string the category to browse
141 143 */
142 144 function browseByCategory($category = "") {
143 145 global $default;
... ... @@ -196,7 +198,7 @@ class DocumentBrowser {
196 198 /**
197 199 * Browse the documents by document type
198 200 *
199   - * @param $documentTypeID the document type ID to browse
  201 + * @param int the document type ID to browse
200 202 */
201 203 function browseByDocumentType($documentTypeID = -1) {
202 204 global $default;
... ... @@ -241,8 +243,8 @@ class DocumentBrowser {
241 243 * Checks whether the required group is one of the
242 244 * groups in the $groupIDs array
243 245 *
244   - * @param $requiredGroupName the group name to check for
245   - * @param $groupIDS an array of groupIDs to check
  246 + * @param string the group name to check for
  247 + * @param array an array of groupIDs to check
246 248 * @return boolean true if $requiredGroupName is in the $groupIDs array, else false
247 249 */
248 250 function checkGroup($requiredGroupName, $groupIDs) {
... ... @@ -270,8 +272,8 @@ class DocumentBrowser {
270 272 /**
271 273 * Returns an array of folder details for the specified folder
272 274 *
273   - * @param $folderQuery the sql query to retrieve the correct folder
274   - * @return an array containing the folder details
  275 + * @param string the sql query to retrieve the correct folder
  276 + * @return array the folder details
275 277 */
276 278 function retrieveFolderDetails($folderQuery) {
277 279 global $default;
... ... @@ -308,8 +310,8 @@ class DocumentBrowser {
308 310 /**
309 311 * Lookup document details for all the document_ids in the input array
310 312 *
311   - * @param $documentIDs an array containing the documentIDs to retrieve details for
312   - * @return an array containing the details of all the documents
  313 + * @param array the documentIDs to retrieve details for
  314 + * @return array the details of all the documents
313 315 */
314 316 function lookupDocumentDetails($documentIDs) {
315 317 global $default;
... ...
login.php
1 1 <?php
2 2  
  3 +// main library routines and defaults
  4 +require_once("./config/dmsDefaults.php");
  5 +
3 6 /**
4 7 * $Id$
5 8 *
... ... @@ -9,12 +12,9 @@
9 12 * Licensed under the GNU GPL. For full terms see the file COPYING.
10 13 *
11 14 * @version $Revision$
12   - * @author <a href="mailto:michael@jamwarehouse.com">Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
13   - * @package dms
  15 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  16 + * @package presentation
14 17 */
15   -
16   -// main library routines and defaults
17   -require_once("./config/dmsDefaults.php");
18 18  
19 19 // -------------------------------
20 20 // page start
... ...
logout.php
1 1 <?php
2 2  
  3 +// main library routines and defaults
  4 +require_once("./config/dmsDefaults.php");
  5 +
3 6 /**
4 7 * $Id$
5 8 *
... ... @@ -11,12 +14,9 @@
11 14 * Licensed under the GNU GPL. For full terms see the file COPYING.
12 15 *
13 16 * @version $Revision$
14   - * @author <a href="mailto:michael@jamwarehouse.com">Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
15   - * @package dms
  17 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  18 + * @package presentation
16 19 */
17   -
18   -// main library routines and defaults
19   -require_once("./config/dmsDefaults.php");
20 20  
21 21 // destroy the session
22 22 Session::destroy();
... ...
tests/administration/UnitManager.php
... ... @@ -5,17 +5,30 @@ require_once(&quot;../../config/dmsDefaults.php&quot;);
5 5 require_once("$default->owl_fs_root/lib/owl.lib.php");
6 6 require_once("$default->owl_fs_root/lib/administration/UnitManager.inc");
7 7  
  8 +/**
  9 + * $Id$
  10 + *
  11 + * Unit Tests for lib/administration/UnitManager.inc
  12 + *
  13 + * Licensed under the GNU GPL. For full terms see the file COPYING.
  14 + *
  15 + * @version $Revision$
  16 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  17 + * @package tests.administration
  18 + */
  19 +
8 20 echo "<pre>";
9 21 // unit tests for UnitManager methods
10 22  
11 23 $um = new UnitManager();
  24 +/*
12 25 $userArray = $um->listLdapUsers($userNameSearch);
13   -if (!'userArray') {
  26 +if (!userArray) {
14 27 echo "ldap user lookup failed!<br>";
15 28 } else {
16 29 print_r($userArray);
17 30 }
18   -/*
  31 +*/
19 32 // do some transformation of the first entry in the array?
20 33 // think maybe just set username = uid
21 34  
... ... @@ -34,10 +47,10 @@ global $default;
34 47 $result = $um->addUser($unitID, $userDetails);
35 48 if (!$result) {
36 49 echo "add user failed!<br>";
37   - echo "error message=$default->errorMessage";
  50 + echo "error message=" . $_SESSION["errorMessage"];
38 51 } else {
39 52 echo "added user successfully<br>";
40 53 }
41   -*/
  54 +
42 55 echo "</pre>";
43 56 ?>
... ...