User Tools

Site Tools


cats:bugfixes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
cats:bugfixes [2007/02/07 21:03]
helphand
cats:bugfixes [2007/02/07 22:10] (current)
helphand
Line 1: Line 1:
 +^  :!: This Documentation Applies to CATS Version 0.6.1 :!:  ^
 +|  The CATS Team has since released new versions, the material documented here likely will not work on the new versions without modification.  |
 +
 +===== Bug Fixes/Mods to 0.6.1 =====
 +==== Add session name ====
 +This patch adds the session_name to the session cookies so CATS does not interfere with other PHP applications running on the same server. Without the session_name, those other applications can step on CATS saved session information, and vice versa.
 +<code>
 +Index: trunk/index.php
 +===================================================================
 +--- trunk/index.php (revision 1)
 ++++ trunk/index.php (working copy)
 +@@ -51,6 +51,7 @@
 + include_once('./lib/Session.php'); /* Depends on ArrayUtility, Users, and DatabaseConnection. */
 + include_once('./lib/UserInterface.php'); /* Depends on Template. */
 + 
 ++session_name('CATS');
 + session_start();
 + 
 + /* Try to prevent caching. */
 +Index: trunk/lib/AJAXInterface.php
 +===================================================================
 +--- trunk/lib/AJAXInterface.php (revision 1)
 ++++ trunk/lib/AJAXInterface.php (working copy)
 +@@ -109,6 +109,7 @@
 + 
 +     public function __construct()
 +     {
 ++        session_name('CATS');
 +         session_start();
 + 
 +         /* Validate the session. */
 +
 +</code>
 +
 +==== Remove Old Contact Code ====
 +This patch removes old client selection code from the contacts page. This code would substantially slow down the contact display on systems with large numbers of clients.
 +<code>
 +Index: trunk/modules/contacts/Edit.tpl
 +===================================================================
 +--- trunk/modules/contacts/Edit.tpl (revision 1)
 ++++ trunk/modules/contacts/Edit.tpl (working copy)
 +@@ -61,20 +61,6 @@
 +                             <div id="ClientResults" class="ajaxSearchResults"></div>
 +                         </td>
 + 
 +-                        <!-- old client id selection code follows
 +-                        <td class="tdData">
 +-                            <select id="clientID" name="clientID" class="inputbox" style="width: 150px;">
 +-                                <option value="">(Select a Client)</option>
 +-
 +-                                <?php foreach ($this->clientsRS as $rowNumber => $clientsData): ?>
 +-                                    <?php if ($this->data['clientID'] == $clientsData['clientID']): ?>
 +-                                        <option selected value="<?php $this->_($clientsData['clientID']) ?>"><?php $this->_($clientsData['name']) ?></option>
 +-                                    <?php else: ?>
 +-                                        <option value="<?php $this->_($clientsData['clientID']) ?>"><?php $this->_($clientsData['name']) ?></option>
 +-                                    <?php endif; ?>
 +-                                <?php endforeach; ?>
 +-                            </select>&nbsp;*
 +-                        </td>-->
 +                     </tr>
 + 
 +                     <tr>
 +
 +</code>
 +==== Fix TPL Errors ====
 +This patch fixes incorrect javascript file references in various templates.
 +<code>
 +Index: trunk/modules/activity/Search.tpl
 +===================================================================
 +--- trunk/modules/activity/Search.tpl (revision 1)
 ++++ trunk/modules/activity/Search.tpl (working copy)
 +@@ -1,5 +1,5 @@
 + <?php /* $Id: Search.tpl 789 2006-09-08 07:41:24Z will $ */ ?>
 +-<?php TemplateUtility::printHeader('Activities', array('js/highlightrows.js', 'modules/activity/validator.js', 'js/addEvent.js', 'js/sweetTitles.js')); ?>
 ++<?php TemplateUtility::printHeader('Activities', array('js/highlightrows.js', 'modules/activity/validator.js', 'js/sweetTitles.js')); ?>
 + 
 + <?php TemplateUtility::printHeaderBlock(); ?>
 +     <div id="header">
 +Index: trunk/modules/activity/Activity.tpl
 +===================================================================
 +--- trunk/modules/activity/Activity.tpl (revision 1)
 ++++ trunk/modules/activity/Activity.tpl (working copy)
 +@@ -1,5 +1,5 @@
 + <?php /* $Id: Activity.tpl 928 2006-09-19 12:43:00Z will $ */ ?>
 +-<?php TemplateUtility::printHeader('Activities', array('js/highlightrows.js', 'js/addEvent.js', 'js/sweetTitles.js')); ?>
 ++<?php TemplateUtility::printHeader('Activities', array('js/highlightrows.js', 'js/sweetTitles.js')); ?>
 + <?php TemplateUtility::printHeaderBlock(); ?>
 +     <div id="header">
 +         <ul id="primary">
 +Index: trunk/modules/candidates/HotList.tpl
 +===================================================================
 +--- trunk/modules/candidates/HotList.tpl (revision 1)
 ++++ trunk/modules/candidates/HotList.tpl (working copy)
 +@@ -1,5 +1,5 @@
 + <?php /* $Id: HotList.tpl 789 2006-09-08 07:41:24Z will $ */ ?>
 +-<?php TemplateUtility::printHeader('Candidates', array('js/submodal/subModal.js', 'js/highlightrows.js', 'js/addEvent.js', 'js/export.js', 'js/listEditor.js')); ?>
 ++<?php TemplateUtility::printHeader('Candidates', array('js/submodal/subModal.js', 'js/highlightrows.js', 'js/sweetTitles.js', 'js/export.js', 'js/listEditor.js')); ?>
 + <?php TemplateUtility::printHeaderBlock(); ?>
 +     <div id="header">
 +         <ul id="primary">
 +Index: trunk/modules/candidates/Candidates.tpl
 +===================================================================
 +--- trunk/modules/candidates/Candidates.tpl (revision 1)
 ++++ trunk/modules/candidates/Candidates.tpl (working copy)
 +@@ -1,5 +1,5 @@
 + <?php /* $Id: Candidates.tpl 925 2006-09-18 21:15:07Z brian $ */ ?>
 +-<?php TemplateUtility::printHeader('Candidates', array('js/submodal/subModal.js', 'js/highlightrows.js', 'js/addEvent.js', 'js/export.js', 'js/checkBox.js')); ?>
 ++<?php TemplateUtility::printHeader('Candidates', array('js/submodal/subModal.js', 'js/highlightrows.js', 'js/sweetTitles.js', 'js/export.js')); ?>
 + <?php TemplateUtility::printHeaderBlock(); ?>
 +     <div id="header">
 +         <ul id="primary">
 +Index: trunk/modules/clients/Clients.tpl
 +===================================================================
 +--- trunk/modules/clients/Clients.tpl (revision 1)
 ++++ trunk/modules/clients/Clients.tpl (working copy)
 +@@ -1,5 +1,5 @@
 + <?php /* $Id: Clients.tpl 789 2006-09-08 07:41:24Z will $ */ ?>
 +-<?php TemplateUtility::printHeader('Clients', array('js/highlightrows.js', 'js/addEvent.js', 'js/export.js')); ?>
 ++<?php TemplateUtility::printHeader('Clients', array('js/highlightrows.js', 'js/sweetTitles.js', 'js/export.js')); ?>
 + 
 + <?php TemplateUtility::printHeaderBlock(); ?>
 +     <div id="header">
 +
 +Index: trunk/modules/calendar/Calendar.tpl
 +===================================================================
 +--- trunk/modules/calendar/Calendar.tpl (revision 1)
 ++++ trunk/modules/calendar/Calendar.tpl (working copy)
 +@@ -1,5 +1,5 @@
 + <?php /* $Id: Calendar.tpl 789 2006-09-08 07:41:24Z will $ */ ?>
 +-<?php TemplateUtility::printHeader('Calendar', array('modules/calendar/Calendar.css', 'js/highlightrows.js', 'modules/calendar/Calendar.js', 'modules/calendar/CalendarUI.js', 'js/calendarDateInput.js', 'modules/calendar/validator.js')); ?>
 ++<?php TemplateUtility::printHeader('Calendar', array('Calendar.css', 'js/highlightrows.js', 'modules/calendar/Calendar.js', 'modules/calendar/CalendarUI.js', 'js/calendarDateInput.js', 'modules/calendar/validator.js')); ?>
 + <?php TemplateUtility::printHeaderBlock(); ?>
 +     <div id="header">
 +         <ul id="primary">
 +Index: trunk/modules/contacts/Contacts.tpl
 +===================================================================
 +--- trunk/modules/contacts/Contacts.tpl (revision 1)
 ++++ trunk/modules/contacts/Contacts.tpl (working copy)
 +@@ -1,5 +1,5 @@
 + <?php /* $Id: Contacts.tpl 789 2006-09-08 07:41:24Z will $ */ ?>
 +-<?php TemplateUtility::printHeader('Contacts', array('js/highlightrows.js', 'js/addEvent.js', 'js/export.js')); ?>
 ++<?php TemplateUtility::printHeader('Contacts', array('js/highlightrows.js', 'js/sweetTitles.js', 'js/export.js')); ?>
 + <?php TemplateUtility::printHeaderBlock(); ?>
 +     <div id="header">
 +         <ul id="primary">
 +</code>
 +==== Change Order Types ====
 +This patch alters the order types to the author's tastes.
 +<code>
 +Index: trunk/lib/JobOrders.php
 +===================================================================
 +--- trunk/lib/JobOrders.php (revision 1)
 ++++ trunk/lib/JobOrders.php (working copy)
 +@@ -821,16 +821,16 @@
 +     {
 +         switch ($typeCode)
 +         {
 +-            case 'C':
 +-                return 'Contract';
 ++            case 'T':
 ++                return 'Temp';
 +                 break;
 + 
 +             case 'H';
 +                 return 'Hire';
 +                 break;
 + 
 +-            case 'C2H';
 +-                return 'Contract to Hire';
 ++            case 'T2H';
 ++                return 'Temp to Hire';
 +                 break;
 + 
 +             default:
 +Index: trunk/modules/joborders/Edit.tpl
 +===================================================================
 +--- trunk/modules/joborders/Edit.tpl (revision 1)
 ++++ trunk/modules/joborders/Edit.tpl (working copy)
 +@@ -127,16 +127,16 @@
 +                             <select tabindex="12" id="type" name="type" class="inputbox" style="width: 150px;">
 +                                 <?php if ($this->data['type'] == 'H'): ?>
 +                                     <option selected value="H">H (Hire)</option>
 +-                                    <option value="C2H">C2H (Contract to Hire)</option>
 +-                                    <option value="C">C (Contract)</option>
 +-                                <?php elseif ($this->data['type'] == 'C2H'): ?>
 ++                                    <option value="T2H">T2H (Temp to Hire)</option>
 ++                                    <option value="T">T (Temp)</option>
 ++                                <?php elseif ($this->data['type'] == 'T2H'): ?>
 +                                     <option value="H">H (Hire)</option>
 +-                                    <option selected value="C2H">C2H (Contract to Hire)</option>
 +-                                    <option value="C">C (Contract)</option>
 ++                                    <option selected value="T2H">T2H (Temp to Hire)</option>
 ++                                    <option value="T">T (Temp)</option>
 +                                 <?php else: ?>
 +                                     <option value="H">H (Hire)</option>
 +-                                    <option value="C2H">C2H (Contract to Hire)</option>
 +-                                    <option selected value="C">C (Contract)</option>
 ++                                    <option value="T2H">T2H (Temp to Hire)</option>
 ++                                    <option selected value="T">T (Temp)</option>
 +                                 <?php endif; ?>
 +                             </select>&nbsp;*
 +                         </td>
 +Index: trunk/modules/joborders/Add.tpl
 +===================================================================
 +--- trunk/modules/joborders/Add.tpl (revision 1)
 ++++ trunk/modules/joborders/Add.tpl (working copy)
 +@@ -173,8 +173,8 @@
 +                             <td class="tdData">
 +                                 <select tabindex="7" id="type" name="type" class="inputbox" style="width: 150px;">
 +                                     <option value="H">H (Hire)</option>
 +-                                    <option value="C2H">C2H (Contract to Hire)</option>
 +-                                    <option value="C">C (Contract)</option>
 ++                                    <option value="T2H">T2H (Temp to Hire)</option>
 ++                                    <option value="T">T (Temp)</option>
 +                                 </select>&nbsp;*
 +                             </td>
 + 
 +Index: trunk/modules/reports/JobOrderReport.tpl
 +===================================================================
 +--- trunk/modules/reports/JobOrderReport.tpl (revision 1)
 ++++ trunk/modules/reports/JobOrderReport.tpl (working copy)
 +@@ -184,8 +184,8 @@
 +                             <td class="tdData">
 +                                 <select tabindex="7" id="type" name="type" class="inputbox" style="width: 150px;">
 +                                     <option value="H">H (Hire)</option>
 +-                                    <option value="C2H">C2H (Contract to Hire)</option>
 +-                                    <option value="C">C (Contract)</option>
 ++                                    <option value="T2H">T2H (Temp to Hire)</option>
 ++                                    <option value="T">T (Temp)</option>
 +                                 </select>&nbsp;*
 +                             </td>
 + 
 +
 +</code>
 +
 +==== Fix Activity Graph Display ====
 +This patch fixes a logic bug encountered only on weekends for the activity graph. Additionally, it changes the graph to the past 14 days rather than the base system's display of this week and next week.
 +<code>
 +Index: trunk/lib/Dashboard.php
 +===================================================================
 +--- trunk/lib/Dashboard.php (revision 1)
 ++++ trunk/lib/Dashboard.php (working copy)
 +@@ -70,6 +70,7 @@
 +         $string = str_replace('((DATE))', date('m-d-y'), $string);
 +         $string = str_replace('((TIME))', date('g:i A'), $string);
 +         $string = str_replace('((LASTWEEKTHROUGHTHISWEEK))', date('m-d-y', $dateLastSun) . ' through ' . date('m-d-y', $dateThisSat), $string);
 ++        $string = str_replace('((LAST14DAYS))', date('m-d-y', strtotime("-13 days")) . ' through ' . date('m-d-y'), $string);
 +         $string = str_replace('((SITENAME))', $_SESSION['catsSession']->getSiteName(), $string);
 + 
 +         return $string;
 +Index: trunk/modules/graphs/GraphsUI.php
 +===================================================================
 +--- trunk/modules/graphs/GraphsUI.php (revision 1)
 ++++ trunk/modules/graphs/GraphsUI.php (working copy)
 +@@ -148,7 +148,7 @@
 +         $RS = $statistics->getActivitiesByPeriod(STATISTICS_PERIOD_LASTTWOWEEKS);
 + 
 +         // FIXME: Factor out these calculations? Common to most of these graphs.
 +-        $firstDay = mktime(0, 0, 0, date('m'), date('d') - ((int) date('w')) - 7,  date('Y'));
 ++        $firstDay = strtotime("-13 days");
 + 
 +         /* Get Labels. */
 +         $y = array();
 +@@ -165,15 +165,8 @@
 +         foreach ($RS as $lineRS)
 +         {
 +             $thisDay = mktime(0, 0, 0, $lineRS['month'], $lineRS['day'], $lineRS['year']);
 +-            $dayOfWeek = (int) date('w', $thisDay);
 +-            if ((int) date('W', $thisDay) != (int) date('W'))
 +-            {
 +-                $x[$dayOfWeek]++;
 +-            }
 +-            else
 +-            {
 +-                $x[$dayOfWeek + 7]++;
 +-            }
 ++            $days = (int) ((strtotime(date('Y-m-d',$thisDay))) - strtotime(date('Y-m-d',$firstDay))) / (60 * 60 * 24);
 ++            $x[$days]++;
 +         }
 + 
 +         $graph = new GraphSimple($y, $x, 'DarkGreen', 'Weekly Activity', $this->width, $this->height);
 +@@ -188,7 +181,7 @@
 +         $statistics = new Statistics($this->_siteID);
 +         $RS = $statistics->getCandidatesByPeriod(STATISTICS_PERIOD_LASTTWOWEEKS);
 + 
 +-        $firstDay = mktime(0, 0, 0, date('m'), date('d') - ((int) date('w')) - 7,  date('Y'));
 ++        $firstDay = strtotime("-13 days");
 + 
 +         /* Get labels. */
 +         $y = array();
 +@@ -203,15 +196,8 @@
 +         foreach ($RS as $lineRS)
 +         {
 +             $thisDay = mktime(0, 0, 0, $lineRS['month'], $lineRS['day'], $lineRS['year']);
 +-            $dayOfWeek = (int) date('w', $thisDay);
 +-            if ((int) date('W', $thisDay) != (int) date('W'))
 +-            {
 +-                $x[$dayOfWeek]++;
 +-            }
 +-            else
 +-            {
 +-                $x[$dayOfWeek + 7]++;
 +-            }
 ++            $days = (int) ((strtotime(date('Y-m-d',$thisDay))) - strtotime(date('Y-m-d',$firstDay))) / (60 * 60 * 24);
 ++            $x[$days]++;
 +         }
 + 
 +         $graph = new GraphSimple($y, $x, 'Blue', 'New Candidates', $this->width, $this->height);
 +@@ -227,7 +213,7 @@
 +         $RS = $statistics->getJobOrdersByPeriod(STATISTICS_PERIOD_LASTTWOWEEKS);
 + 
 +         /* Get labels. */
 +-        $firstDay = mktime(0, 0, 0, date('m'), date('d') - ((int) date('w')) - 7,  date('Y'));
 ++        $firstDay = strtotime("-13 days");
 + 
 +         $y = array();
 +         for ($i = 0; $i < 14; $i++)
 +@@ -241,15 +227,8 @@
 +         foreach ($RS as $lineRS)
 +         {
 +             $thisDay = mktime(0, 0, 0, $lineRS['month'], $lineRS['day'], $lineRS['year']);
 +-            $dayOfWeek = (int) date('w', $thisDay);
 +-            if ((int) date('W', $thisDay) != (int) date('W'))
 +-            {
 +-                $x[$dayOfWeek]++;
 +-            }
 +-            else
 +-            {
 +-                $x[$dayOfWeek + 7]++;
 +-            }
 ++            $days = (int) ((strtotime(date('Y-m-d',$thisDay))) - strtotime(date('Y-m-d',$firstDay))) / (60 * 60 * 24);
 ++            $x[$days]++;
 +         }
 + 
 +         $graph = new GraphSimple($y, $x, 'Red', 'New Job Orders', $this->width, $this->height);
 +@@ -348,7 +327,7 @@
 +         $RS = $statistics->getSubmissionsByPeriod(STATISTICS_PERIOD_LASTTWOWEEKS);
 + 
 +         /* Get labels. */
 +-        $firstDay = mktime(0, 0, 0, date('m'), date('d') - ((int) date('w')) - 7,  date('Y'));
 ++        $firstDay = strtotime("-13 days");
 + 
 +         $y = array();
 +         for ($i = 0; $i < 14; $i++)
 +@@ -362,15 +341,8 @@
 +         foreach ($RS as $lineRS)
 +         {
 +             $thisDay = mktime(0, 0, 0, $lineRS['month'], $lineRS['day'], $lineRS['year']);
 +-            $dayOfWeek = (int) date('w', $thisDay);
 +-            if ((int) date('W', $thisDay) != (int) date('W'))
 +-            {
 +-                $x[$dayOfWeek]++;
 +-            }
 +-            else
 +-            {
 +-                $x[$dayOfWeek + 7]++;
 +-            }
 ++            $days = (int) ((strtotime(date('Y-m-d',$thisDay))) - strtotime(date('Y-m-d',$firstDay))) / (60 * 60 * 24);
 ++            $x[$days]++;
 +         }
 + 
 +         $graph = new GraphSimple($y, $x, 'Orange', 'New Submissions', $this->width, $this->height);
 +
 +</code>
 +
 +==== Include Key Skills in Candidate Quick Search ====
 +This patch causes the candidate's key skills field to be included in the candidate quick search.<code>
 +Index: trunk/lib/Search.php
 +===================================================================
 +--- trunk/lib/Search.php (revision 1)
 ++++ trunk/lib/Search.php (working copy)
 +@@ -505,6 +505,7 @@
 +                 OR candidate.email1 LIKE %s
 +                 OR candidate.phone_home LIKE %s
 +                 OR candidate.phone_cell LIKE %s
 ++ OR candidate.key_skills LIKE %s
 +             )
 +             AND
 +                 candidate.site_id = %s
 +@@ -518,6 +519,7 @@
 +             $wildCardString,
 +             $wildCardString,
 +             $wildCardString,
 ++     $wildCardString,
 +             $this->_siteID
 +         );
 + 
 +</code>
 +
 +
 +==== Authenticate Via ActiveDirectory ====
 +Thanks to CATS user Daniel Felzke CATS can be modified to authenticate via LDAP with ActiveDirectory. Daniel explains the steps needed in the thread here [[http://www.catsone.com/forum/viewtopic.php?id=187]]. Note that adLDAP Version 1.5 is the version included in Daniel's package, I'm not sure if the more recent Version 2.0 will work without mods though since I haven't tried it.
 +
 +I had to make minor changes to Daniel's stuff to get it to work with my Windows 2003 ActiveDirectory server, but unfortunately, I did not keep track of my changes versus Daniel's so the patch documented here is really only for my own documentation purposes. Those who want to implement this authentication should follow Daniel's instructions at the link above, you shouldn't have any problem getting it to work.
 +<code>
 +Index: trunk/lib/Users.php
 +===================================================================
 +--- trunk/lib/Users.php (revision 1)
 ++++ trunk/lib/Users.php (working copy)
 +@@ -96,7 +96,7 @@
 +                 %s,
 +                 %s,
 +                 %s,
 +-                %s
 ++                1
 +             )",
 +             $this->_db->makeQueryString($username),
 +             /* $this->_db->makeQueryString(self::hashPassword($password)), TODO 0.7 */
 +Index: trunk/lib/Session.php
 +===================================================================
 +--- trunk/lib/Session.php (revision 1)
 ++++ trunk/lib/Session.php (working copy)
 +@@ -29,6 +29,7 @@
 + 
 + include_once('./lib/Mailer.php');
 + include_once('./lib/MRU.php');
 ++include_once('./lib/adLDAP.php');
 + 
 + class CATSSession
 + {
 +@@ -309,6 +310,190 @@
 +         }
 +     }
 + 
 ++    public function processLDAPLogin($username, $password)
 ++    {
 ++        $db = DatabaseConnection::getInstance();
 ++
 ++        /* Is the login information supplied correct? Get the status flag. */
 ++        $users = new Users(-1);
 ++        $adldap = new adLDAP();
 ++        
 ++        if ((empty($username)) || (empty($password))) {
 ++            $this->_isLoggedIn = false;
 ++            $this->_loginError = 'You can not have an empty username or password.';
 ++
 ++            return;
 ++            
 ++        }
 ++
 ++        if ($adldap->authenticate($username,$password))
 ++        {               
 ++            // Check Group Affiliation
 ++            $group=$adldap->user_groups($username);
 ++            if (array_search("Corporate", $group))
 ++            {
 ++                $access_level = 400;
 ++            }
 ++            elseif (array_search("Branch Users", $group))
 ++            {
 ++                $access_level = 300;
 ++            }
 ++            elseif (1 == 1) 
 ++            {
 ++                $access_level = 200;
 ++            }
 ++            else
 ++            {
 ++                $this->_isLoggedIn = false;
 ++                $this->_loginError = 'You do not have access to this program.';
 ++
 ++                return;
 ++            }
 ++            
 ++            // Grab LDAP User Information
 ++            $fields = array("givenname", "sn", "samaccountname","mail","memberof","department","displayname","telephonenumber","primarygroupid","title");
 ++            $info=$adldap->user_info($username, $fields);
 ++
 ++            // Find out if user is already in CATS database.
 ++            $db = DatabaseConnection::getInstance();
 ++            
 ++            $sql = sprintf(
 ++                "SELECT
 ++                    user.user_id AS userID,
 ++                    user.user_name AS username,
 ++                    user.first_name AS firstName,
 ++                    user.last_name AS lastName,
 ++                    user.access_level AS accessLevel,
 ++                    user.site_id AS userSiteID,
 ++                    user.is_beta_tester AS isBetaTester,
 ++     user.*,
 ++                    site.name AS siteName,
 ++                    site.is_demo AS isDemo
 ++                FROM
 ++                    user
 ++                LEFT JOIN site
 ++                    ON site.site_id = user.site_id
 ++                WHERE
 ++                    user.user_name = %s",
 ++                $db->makeQueryString($username)
 ++            );
 ++            $rs = $db->getAssoc($sql);
 ++                
 ++            /* Is this the first time the user has logged in */
 ++            if (!$rs || $db->isEOF())
 ++            {
 ++                // Insert User
 ++                $new_user = $users->add($info[0]['sn'][0], $info[0]['givenname'][0], $info[0]['mail'][0], $info[0]['samaccountname'][0], NULL, $access_level);
 ++                // Get New details
 ++                $rs = $db->getAssoc($sql);
 ++            }
 ++            
 ++            $loginStatus = LOGIN_SUCCESS;
 ++        }
 ++        else
 ++        {
 ++            $loginStatus = LOGIN_INVALID_USER;
 ++        }
 ++
 ++        if (array_key_exists('REMOTE_ADDR', $_SERVER))
 ++        {
 ++            $ip = $_SERVER['REMOTE_ADDR'];
 ++        }
 ++        else
 ++        {
 ++            $ip = '';
 ++        }
 ++
 ++        if (array_key_exists('HTTP_USER_AGENT', $_SERVER))
 ++        {
 ++            $userAgent = $_SERVER['HTTP_USER_AGENT'];
 ++        }
 ++        else
 ++        {
 ++            $userAgent = '';
 ++        }
 ++
 ++        switch ($loginStatus)
 ++        {
 ++            case LOGIN_INVALID_PASSWORD:
 ++                $this->_isLoggedIn = false;
 ++                $this->_loginError = 'Invalid username or password.';
 ++
 ++                /* Log the login as unsuccessful. */
 ++                $users->addLoginHistory(
 ++                    $rs['userID'],
 ++                    $rs['userSiteID'],
 ++                    $ip,
 ++                    $userAgent,
 ++                    false
 ++                );
 ++
 ++                break;
 ++
 ++            case LOGIN_DISABLED:
 ++                $this->_isLoggedIn = false;
 ++                $this->_loginError = 'Your account is disabled.';
 ++
 ++                /* Log the login as unsuccessful. */
 ++                $users->addLoginHistory(
 ++                    $rs['userID'],
 ++                    $rs['userSiteID'],
 ++                    $ip,
 ++                    $userAgent,
 ++                    false
 ++                );
 ++
 ++                break;
 ++
 ++            case LOGIN_SUCCESS:
 ++                $this->_username    = $rs['username'];
 ++                $this->_userID      = $rs['userID'];
 ++                $this->_siteID      = $rs['userSiteID'];
 ++                $this->_firstName   = $rs['firstName'];
 ++                $this->_lastName    = $rs['lastName'];
 ++                $this->_siteName    = $rs['siteName'];
 ++                $this->_accessLevel = $rs['accessLevel'];
 ++                $this->_email       = $rs['email'];
 ++                $this->_ip          = $ip;
 ++                $this->_userAgent   = $userAgent;
 ++
 ++                if ($rs['isDemo'] == '1' && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' && ENABLE_DEMO_MODE && $rs['isDemoUser'] == 1)
 ++                {
 ++                    $this->_isDemo = true;
 ++                    $this->_accessLevel = ACCESS_LEVEL_DEMO;
 ++                }
 ++                else
 ++                {
 ++                    $this->_isDemo = false;
 ++                }
 ++
 ++                if ($rs['isBetaTester'] == '1')
 ++                {
 ++                    $this->_isBetaTester = true;
 ++                }
 ++                else
 ++                {
 ++                    $this->_isBetaTester = false;
 ++                }
 ++
 ++                /* Log the login as successful. */
 ++                $users->addLoginHistory(
 ++                    $this->_userID,
 ++                    $this->_siteID,
 ++                    $this->_ip,
 ++                    $this->_userAgent,
 ++                    true
 ++                );
 ++
 ++                /* Upon successful login, try to upgrade plaintext passwords. */
 ++                /* $users->tryUpgradePassword($username, $password); TODO 0.6 */
 ++
 ++                $this->_isLoggedIn = true;
 ++
 ++                break;
 ++        }
 ++    }
 ++    
 +     /**
 +      * Returns the error message for which the current login attempt failed.
 +      *
 +Index: trunk/modules/login/LoginUI.php
 +===================================================================
 +--- trunk/modules/login/LoginUI.php (revision 1)
 ++++ trunk/modules/login/LoginUI.php (working copy)
 +@@ -139,7 +139,7 @@
 +         $password = $this->getTrimmedInput('password', $_POST);
 + 
 +         /* Make a blind attempt at logging the user in. */
 +-        $_SESSION['catsSession']->processLogin($username, $password);
 ++        $_SESSION['catsSession']->processLDAPLogin($username, $password);
 + 
 +         /* If unsuccessful, take the user back to the login page. */
 +         if (!$_SESSION['catsSession']->isLoggedIn())
 +</code>
  
cats/bugfixes.txt ยท Last modified: 2007/02/07 22:10 by helphand