Commit db070caf79acaa198c72f03d348e6dc38732a9d6

Authored by Michael Joseph
1 parent e9c5af1f

added copyright and gpl notice


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2555 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/authentication/Authenticator.inc
1 1 <?php
2   -
3 2 require_once("$default->fileSystemRoot/lib/users/User.inc");
4   -
5 3 /**
6 4 * $Id$
7   - *
  5 + *
8 6 * Interface class that performs all authentication functions.
  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.
  14 + *
  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.
9 19 *
10   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  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
... ... @@ -28,7 +40,7 @@ class Authenticator {
28 40 $aUserDetails = array();
29 41  
30 42 // retrieve the userID
31   - $iUserID = lookupID($default->owl_users_table, "BINARY username", "$sUserName");
  43 + $iUserID = lookupID($default->users_table, "BINARY username", "$sUserName");
32 44 if ($iUserID) {
33 45 $oUser = & User::get($iUserID);
34 46  
... ... @@ -47,10 +59,10 @@ class Authenticator {
47 59 Session::removeStaleSessions($aUserDetails["userID"]);
48 60  
49 61 // Check if Maxsessions has been reached
50   - $iMaxSessions = lookupField($default->owl_users_table, "max_sessions", "id", $iUserID);
  62 + $iMaxSessions = lookupField($default->users_table, "max_sessions", "id", $iUserID);
51 63 $default->log->debug("maxsessions=$iMaxSessions for userID=$iUserID");
52 64 $sql = $default->db;
53   - if ($sql->query("SELECT count(*) as count FROM $default->owl_sessions_table WHERE user_id = $iUserID")) {
  65 + if ($sql->query("SELECT count(*) as count FROM $default->sessions_table WHERE user_id = $iUserID")) {
54 66 $sql->next_record();
55 67 $default->log->debug("sess count=" . $sql->f("count"));
56 68 if ($sql->f("count") >= $iMaxSessions) {
... ...
lib/authentication/DBAuthenticator.inc
1 1 <?php
2   -
3 2 require_once("$default->fileSystemRoot/lib/authentication/Authenticator.inc");
4   -
5 3 /**
6 4 * $Id$
7   - *
  5 + *
8 6 * Perform authentication tasks against the database.
9 7 *
10   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  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.
  14 + *
  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.
11 19 *
12   - * @version $Revision$
  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
  23 + *
  24 + * @version $Revision$
13 25 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
14   - * @package lib.authentication
  26 + * @package lib.authentication
15 27 */
16   -
17 28 class DBAuthenticator extends Authenticator {
18 29  
19 30 /**
... ... @@ -27,7 +38,7 @@ class DBAuthenticator extends Authenticator {
27 38 global $default;
28 39  
29 40 $sql = $default->db;
30   - if ($sql->query("SELECT * FROM $default->owl_users_table WHERE username = '$userName' AND password = '" . md5($password) . "'")) {
  41 + if ($sql->query("SELECT * FROM $default->users_table WHERE username = '$userName' AND password = '" . md5($password) . "'")) {
31 42 if ($sql->num_rows($sql) == "1") {
32 43 return true;
33 44 } else {
... ... @@ -55,7 +66,7 @@ class DBAuthenticator extends Authenticator {
55 66 for ($i=0; $i<count($aAttributes); $i++) {
56 67 $sQuery .= $aAttributes[$i] . (( ($i+1) == count($aAttributes) ) ? "" : ", ");
57 68 }
58   - $sQuery .= " FROM $default->owl_users_table WHERE username = '$sUserName'";
  69 + $sQuery .= " FROM $default->users_table WHERE username = '$sUserName'";
59 70  
60 71 if ($sql->query($sQuery)) {
61 72 $aUserResults = array();
... ... @@ -87,7 +98,7 @@ class DBAuthenticator extends Authenticator {
87 98 for ($i=0; $i<count($aAttributes); $i++) {
88 99 $sQuery .= $aAttributes[$i] . (( ($i+1) == count($aAttributes) ) ? "" : ", ");
89 100 }
90   - $sQuery .= " FROM $default->owl_users_table where username like '%$sUserNameSearch%'";
  101 + $sQuery .= " FROM $default->users_table where username like '%$sUserNameSearch%'";
91 102  
92 103 if ($sql->query($sQuery)) {
93 104 $aUserResults = array();
... ...
lib/authentication/LDAPAuthenticator.inc
1 1 <?php
2   -
3 2 require_once("$default->fileSystemRoot/lib/authentication/class.AuthLdap.php");
4 3 require_once("$default->fileSystemRoot/lib/authentication/Authenticator.inc");
5   -
6 4 /**
7 5 * $Id$
8   - *
  6 + *
9 7 * Perform authentication tasks against LDAP compliant directory server.
  8 + *
  9 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify
  12 + * it under the terms of the GNU General Public License as published by
  13 + * the Free Software Foundation; either version 2 of the License, or
  14 + * (at your option) any later version.
  15 + *
  16 + * This program is distributed in the hope that it will be useful,
  17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19 + * GNU General Public License for more details.
10 20 *
11   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  21 + * You should have received a copy of the GNU General Public License
  22 + * along with this program; if not, write to the Free Software
  23 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12 24 *
13   - * @version $Revision$
  25 + * @version $Revision$
14 26 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
15   - * @package lib.authentication
  27 + * @package lib.authentication
16 28 */
17 29 class LDAPAuthenticator extends Authenticator {
18 30  
... ... @@ -59,7 +71,7 @@ class LDAPAuthenticator extends Authenticator {
59 71 global $default;
60 72 if ($this->oLdap->connect()) {
61 73 // lookup dn from username - must exist in db
62   - $sBindDn = lookupField($default->owl_users_table, "ldap_dn", "username", $sUserName);
  74 + $sBindDn = lookupField($default->users_table, "ldap_dn", "username", $sUserName);
63 75 if ($sBindDn && $sPassword) {
64 76 if ( $this->oLdap->authBind($sBindDn, $sPassword) ) {
65 77 return true;
... ...