This shows you the differences between two versions of the page.
| 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, | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -51,6 +51,7 @@ | ||
| + | | ||
| + | | ||
| + | |||
| + | +session_name(' | ||
| + | | ||
| + | |||
| + | /* Try to prevent caching. */ | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -109,6 +109,7 @@ | ||
| + | |||
| + | | ||
| + | { | ||
| + | + session_name(' | ||
| + | | ||
| + | |||
| + | /* Validate the session. */ | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== 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. | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -61,20 +61,6 @@ | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | - <!-- old client id selection code follows | ||
| + | - <td class=" | ||
| + | - <select id=" | ||
| + | - <option value=""> | ||
| + | - | ||
| + | - <?php foreach ($this-> | ||
| + | - <?php if ($this-> | ||
| + | - <option selected value="<? | ||
| + | - <?php else: ?> | ||
| + | - <option value="<? | ||
| + | - <?php endif; ?> | ||
| + | - <?php endforeach; ?> | ||
| + | - </ | ||
| + | - </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | |||
| + | </ | ||
| + | ==== Fix TPL Errors ==== | ||
| + | This patch fixes incorrect javascript file references in various templates. | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -1,5 +1,5 @@ | ||
| + | <? | ||
| + | -<?php TemplateUtility:: | ||
| + | +<?php TemplateUtility:: | ||
| + | |||
| + | <? | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -1,5 +1,5 @@ | ||
| + | <? | ||
| + | -<?php TemplateUtility:: | ||
| + | +<?php TemplateUtility:: | ||
| + | <? | ||
| + | < | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -1,5 +1,5 @@ | ||
| + | <? | ||
| + | -<?php TemplateUtility:: | ||
| + | +<?php TemplateUtility:: | ||
| + | <? | ||
| + | < | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -1,5 +1,5 @@ | ||
| + | <? | ||
| + | -<?php TemplateUtility:: | ||
| + | +<?php TemplateUtility:: | ||
| + | <? | ||
| + | < | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -1,5 +1,5 @@ | ||
| + | <? | ||
| + | -<?php TemplateUtility:: | ||
| + | +<?php TemplateUtility:: | ||
| + | |||
| + | <? | ||
| + | < | ||
| + | |||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -1,5 +1,5 @@ | ||
| + | <? | ||
| + | -<?php TemplateUtility:: | ||
| + | +<?php TemplateUtility:: | ||
| + | <? | ||
| + | < | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -1,5 +1,5 @@ | ||
| + | <? | ||
| + | -<?php TemplateUtility:: | ||
| + | +<?php TemplateUtility:: | ||
| + | <? | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | ==== Change Order Types ==== | ||
| + | This patch alters the order types to the author' | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -821,16 +821,16 @@ | ||
| + | { | ||
| + | | ||
| + | { | ||
| + | - case ' | ||
| + | - return ' | ||
| + | + case ' | ||
| + | + return ' | ||
| + | | ||
| + | |||
| + | case ' | ||
| + | | ||
| + | | ||
| + | |||
| + | - case ' | ||
| + | - return ' | ||
| + | + case ' | ||
| + | + return 'Temp to Hire'; | ||
| + | | ||
| + | |||
| + | | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -127,16 +127,16 @@ | ||
| + | < | ||
| + | <? | ||
| + | < | ||
| + | - <option value=" | ||
| + | - <option value=" | ||
| + | - <?php elseif ($this-> | ||
| + | + <option value=" | ||
| + | + <option value=" | ||
| + | + <?php elseif ($this-> | ||
| + | < | ||
| + | - <option selected value=" | ||
| + | - <option value=" | ||
| + | + <option selected value=" | ||
| + | + <option value=" | ||
| + | <? | ||
| + | < | ||
| + | - <option value=" | ||
| + | - <option selected value=" | ||
| + | + <option value=" | ||
| + | + <option selected value=" | ||
| + | <? | ||
| + | </ | ||
| + | </ | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -173,8 +173,8 @@ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | - <option value=" | ||
| + | - <option value=" | ||
| + | + <option value=" | ||
| + | + <option value=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -184,8 +184,8 @@ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | - <option value=" | ||
| + | - <option value=" | ||
| + | + <option value=" | ||
| + | + <option value=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Fix Activity Graph Display ==== | ||
| + | This patch fixes a logic bug encountered only on weekends for the activity graph. Additionally, | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -70,6 +70,7 @@ | ||
| + | | ||
| + | | ||
| + | | ||
| + | + $string = str_replace(' | ||
| + | | ||
| + | |||
| + | | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -148,7 +148,7 @@ | ||
| + | $RS = $statistics-> | ||
| + | |||
| + | // FIXME: Factor out these calculations? | ||
| + | - $firstDay = mktime(0, 0, 0, date(' | ||
| + | + $firstDay = strtotime(" | ||
| + | |||
| + | /* Get Labels. */ | ||
| + | $y = array(); | ||
| + | @@ -165,15 +165,8 @@ | ||
| + | | ||
| + | { | ||
| + | | ||
| + | - $dayOfWeek = (int) date(' | ||
| + | - if ((int) date(' | ||
| + | - { | ||
| + | - $x[$dayOfWeek]++; | ||
| + | - } | ||
| + | - else | ||
| + | - { | ||
| + | - $x[$dayOfWeek + 7]++; | ||
| + | - } | ||
| + | + $days = (int) ((strtotime(date(' | ||
| + | + $x[$days]++; | ||
| + | } | ||
| + | |||
| + | | ||
| + | @@ -188,7 +181,7 @@ | ||
| + | | ||
| + | $RS = $statistics-> | ||
| + | |||
| + | - $firstDay = mktime(0, 0, 0, date(' | ||
| + | + $firstDay = strtotime(" | ||
| + | |||
| + | /* Get labels. */ | ||
| + | $y = array(); | ||
| + | @@ -203,15 +196,8 @@ | ||
| + | | ||
| + | { | ||
| + | | ||
| + | - $dayOfWeek = (int) date(' | ||
| + | - if ((int) date(' | ||
| + | - { | ||
| + | - $x[$dayOfWeek]++; | ||
| + | - } | ||
| + | - else | ||
| + | - { | ||
| + | - $x[$dayOfWeek + 7]++; | ||
| + | - } | ||
| + | + $days = (int) ((strtotime(date(' | ||
| + | + $x[$days]++; | ||
| + | } | ||
| + | |||
| + | | ||
| + | @@ -227,7 +213,7 @@ | ||
| + | $RS = $statistics-> | ||
| + | |||
| + | /* Get labels. */ | ||
| + | - $firstDay = mktime(0, 0, 0, date(' | ||
| + | + $firstDay = strtotime(" | ||
| + | |||
| + | $y = array(); | ||
| + | for ($i = 0; $i < 14; $i++) | ||
| + | @@ -241,15 +227,8 @@ | ||
| + | | ||
| + | { | ||
| + | | ||
| + | - $dayOfWeek = (int) date(' | ||
| + | - if ((int) date(' | ||
| + | - { | ||
| + | - $x[$dayOfWeek]++; | ||
| + | - } | ||
| + | - else | ||
| + | - { | ||
| + | - $x[$dayOfWeek + 7]++; | ||
| + | - } | ||
| + | + $days = (int) ((strtotime(date(' | ||
| + | + $x[$days]++; | ||
| + | } | ||
| + | |||
| + | | ||
| + | @@ -348,7 +327,7 @@ | ||
| + | $RS = $statistics-> | ||
| + | |||
| + | /* Get labels. */ | ||
| + | - $firstDay = mktime(0, 0, 0, date(' | ||
| + | + $firstDay = strtotime(" | ||
| + | |||
| + | $y = array(); | ||
| + | for ($i = 0; $i < 14; $i++) | ||
| + | @@ -362,15 +341,8 @@ | ||
| + | | ||
| + | { | ||
| + | | ||
| + | - $dayOfWeek = (int) date(' | ||
| + | - if ((int) date(' | ||
| + | - { | ||
| + | - $x[$dayOfWeek]++; | ||
| + | - } | ||
| + | - else | ||
| + | - { | ||
| + | - $x[$dayOfWeek + 7]++; | ||
| + | - } | ||
| + | + $days = (int) ((strtotime(date(' | ||
| + | + $x[$days]++; | ||
| + | } | ||
| + | |||
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Include Key Skills in Candidate Quick Search ==== | ||
| + | This patch causes the candidate' | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -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 | ||
| + | | ||
| + | @@ -518,6 +519,7 @@ | ||
| + | | ||
| + | | ||
| + | | ||
| + | + $wildCardString, | ||
| + | | ||
| + | ); | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ==== 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:// | ||
| + | |||
| + | I had to make minor changes to Daniel' | ||
| + | < | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -96,7 +96,7 @@ | ||
| + | %s, | ||
| + | %s, | ||
| + | %s, | ||
| + | - %s | ||
| + | + 1 | ||
| + | | ||
| + | | ||
| + | /* $this-> | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -29,6 +29,7 @@ | ||
| + | |||
| + | | ||
| + | | ||
| + | +include_once(' | ||
| + | |||
| + | class CATSSession | ||
| + | { | ||
| + | @@ -309,6 +310,190 @@ | ||
| + | } | ||
| + | } | ||
| + | |||
| + | + public function processLDAPLogin($username, | ||
| + | + { | ||
| + | + $db = DatabaseConnection:: | ||
| + | + | ||
| + | + /* Is the login information supplied correct? Get the status flag. */ | ||
| + | + $users = new Users(-1); | ||
| + | + $adldap = new adLDAP(); | ||
| + | + | ||
| + | + if ((empty($username)) || (empty($password))) { | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + | ||
| + | + return; | ||
| + | + | ||
| + | + } | ||
| + | + | ||
| + | + if ($adldap-> | ||
| + | + { | ||
| + | + // Check Group Affiliation | ||
| + | + $group=$adldap-> | ||
| + | + if (array_search(" | ||
| + | + { | ||
| + | + $access_level = 400; | ||
| + | + } | ||
| + | + elseif (array_search(" | ||
| + | + { | ||
| + | + $access_level = 300; | ||
| + | + } | ||
| + | + elseif (1 == 1) | ||
| + | + { | ||
| + | + $access_level = 200; | ||
| + | + } | ||
| + | + else | ||
| + | + { | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + | ||
| + | + return; | ||
| + | + } | ||
| + | + | ||
| + | + // Grab LDAP User Information | ||
| + | + $fields = array(" | ||
| + | + $info=$adldap-> | ||
| + | + | ||
| + | + // Find out if user is already in CATS database. | ||
| + | + $db = DatabaseConnection:: | ||
| + | + | ||
| + | + $sql = sprintf( | ||
| + | + " | ||
| + | + 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-> | ||
| + | + ); | ||
| + | + $rs = $db-> | ||
| + | + | ||
| + | + /* Is this the first time the user has logged in */ | ||
| + | + if (!$rs || $db-> | ||
| + | + { | ||
| + | + // Insert User | ||
| + | + $new_user = $users-> | ||
| + | + // Get New details | ||
| + | + $rs = $db-> | ||
| + | + } | ||
| + | + | ||
| + | + $loginStatus = LOGIN_SUCCESS; | ||
| + | + } | ||
| + | + else | ||
| + | + { | ||
| + | + $loginStatus = LOGIN_INVALID_USER; | ||
| + | + } | ||
| + | + | ||
| + | + if (array_key_exists(' | ||
| + | + { | ||
| + | + $ip = $_SERVER[' | ||
| + | + } | ||
| + | + else | ||
| + | + { | ||
| + | + $ip = ''; | ||
| + | + } | ||
| + | + | ||
| + | + if (array_key_exists(' | ||
| + | + { | ||
| + | + $userAgent = $_SERVER[' | ||
| + | + } | ||
| + | + else | ||
| + | + { | ||
| + | + $userAgent = ''; | ||
| + | + } | ||
| + | + | ||
| + | + switch ($loginStatus) | ||
| + | + { | ||
| + | + case LOGIN_INVALID_PASSWORD: | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + | ||
| + | + /* Log the login as unsuccessful. */ | ||
| + | + $users-> | ||
| + | + $rs[' | ||
| + | + $rs[' | ||
| + | + $ip, | ||
| + | + $userAgent, | ||
| + | + false | ||
| + | + ); | ||
| + | + | ||
| + | + break; | ||
| + | + | ||
| + | + case LOGIN_DISABLED: | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + | ||
| + | + /* Log the login as unsuccessful. */ | ||
| + | + $users-> | ||
| + | + $rs[' | ||
| + | + $rs[' | ||
| + | + $ip, | ||
| + | + $userAgent, | ||
| + | + false | ||
| + | + ); | ||
| + | + | ||
| + | + break; | ||
| + | + | ||
| + | + case LOGIN_SUCCESS: | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + | ||
| + | + if ($rs[' | ||
| + | + { | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + } | ||
| + | + else | ||
| + | + { | ||
| + | + $this-> | ||
| + | + } | ||
| + | + | ||
| + | + if ($rs[' | ||
| + | + { | ||
| + | + $this-> | ||
| + | + } | ||
| + | + else | ||
| + | + { | ||
| + | + $this-> | ||
| + | + } | ||
| + | + | ||
| + | + /* Log the login as successful. */ | ||
| + | + $users-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + $this-> | ||
| + | + true | ||
| + | + ); | ||
| + | + | ||
| + | + /* Upon successful login, try to upgrade plaintext passwords. */ | ||
| + | + /* $users-> | ||
| + | + | ||
| + | + $this-> | ||
| + | + | ||
| + | + break; | ||
| + | + } | ||
| + | + } | ||
| + | + | ||
| + | /** | ||
| + | * Returns the error message for which the current login attempt failed. | ||
| + | * | ||
| + | Index: trunk/ | ||
| + | =================================================================== | ||
| + | --- trunk/ | ||
| + | +++ trunk/ | ||
| + | @@ -139,7 +139,7 @@ | ||
| + | | ||
| + | |||
| + | /* Make a blind attempt at logging the user in. */ | ||
| + | - $_SESSION[' | ||
| + | + $_SESSION[' | ||
| + | |||
| + | /* If unsuccessful, | ||
| + | if (!$_SESSION[' | ||
| + | </ | ||