function doLogin($login, $password) {
$auth = $this->authenticate($login, $password);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '<br>'; var_dump($auth); echo '<br />';
}
$sql = "SELECT id FROM tt_users WHERE login = ".$mdb2->quote($login)." AND status = 1";
$res = $mdb2->query($sql);
if (is_a($res, 'PEAR_Error')) {
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG))
+ if (isTrue(AUTH_DEBUG))
echo 'db error!<br />';
return false;
}
$val = $res->fetchRow();
if (!$val['id']) {
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG))
+ if (isTrue(AUTH_DEBUG))
echo 'login "'.$login.'" does not exist in Time Tracker database.<br />';
return false;
}
$this->weekdayNames = $i18n_weekdays;
$this->weekdayShortNames = $i18n_weekdays_short;
-// if (defined('SHOW_HOLIDAYS') && isTrue(SHOW_HOLIDAYS)) {
$this->holidays = $i18n_holidays;
-// }
foreach ($i18n_key_words as $kword=>$value) {
$pos = strpos($kword, ".");
$this->monthNames = $i18n_months;
$this->weekdayNames = $i18n_weekdays;
$this->weekdayShortNames = $i18n_weekdays_short;
-// if (defined('SHOW_HOLIDAYS') && isTrue(SHOW_HOLIDAYS)) {
$this->holidays = $i18n_holidays;
-// }
foreach ($i18n_key_words as $kword=>$value) {
if (!$value) continue;
$pos = strpos($kword, ".");
} else {
// If the OLD_PASSWORDS option is defined - set it.
- if (defined('OLD_PASSWORDS') && isTrue(OLD_PASSWORDS)) {
+ if (isTrue(OLD_PASSWORDS)) {
$sql = "SET SESSION old_passwords = 1";
$res = $mdb2->query($sql);
if (is_a($res, 'PEAR_Error')) {
$lc = ldap_connect($this->params['server']);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '<br />';
echo '$lc='; var_dump($lc); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($lc, LDAP_OPT_REFERRALS, 0);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
ldap_set_option($lc, LDAP_OPT_DEBUG_LEVEL, 7);
}
$login .= '@' . $this->params['default_domain'];
}
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$login='; var_dump($login); echo '<br />';
}
$lb = @ldap_bind($lc, $login, $password);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$lb='; var_dump($lb); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$fields = array('memberof');
$sr = @ldap_search($lc, $this->params['base_dn'], $filter, $fields);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$sr='; var_dump($sr); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$entries = @ldap_get_entries($lc, $sr);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$entries='; var_dump($entries); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$groups[] = substr($grp_fields[0], 3);
}
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$member_of'; var_dump($member_of); echo '<br />';
};
// Assuming OpenLDAP server.
$login_oldap = 'uid='.$login.','.$this->params['base_dn'];
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$login_oldap='; var_dump($login_oldap); echo '<br />';
}
$lb = @ldap_bind($lc, $login_oldap, $password);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$lb='; var_dump($lb); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$fields = array('samaccountname', 'mail', 'memberof', 'department', 'displayname', 'telephonenumber', 'primarygroupid');
$sr = @ldap_search($lc, $this->params['base_dn'], $filter, $fields);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$sr='; var_dump($sr); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$entries = @ldap_get_entries($lc, $sr);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$entries='; var_dump($entries); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$groups[] = substr($grp_fields[0], 3);
}
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$member_of'; var_dump($member_of); echo '<br />';
}
// isTrue is a helper function to return correct false for older config.php values defined as a string 'false'.
function isTrue($val)
{
- return ($val == false || $val === 'false') ? false : true;
+ return ($val === true);
}
// ttValidString is used to check user input to validate a string.
$port = defined('MAIL_SMTP_PORT') ? MAIL_SMTP_PORT : '25';
$username = defined('MAIL_SMTP_USER') ? MAIL_SMTP_USER : null;
$password = defined('MAIL_SMTP_PASSWORD') ? MAIL_SMTP_PASSWORD : null;
- $auth = (defined('MAIL_SMTP_AUTH') && isTrue(MAIL_SMTP_AUTH)) ? true : false;
- $debug = (defined('MAIL_SMTP_DEBUG') && isTrue(MAIL_SMTP_DEBUG)) ? true : false;
+ $auth = isTrue(MAIL_SMTP_AUTH);
+ $debug = isTrue(MAIL_SMTP_DEBUG);
$mail = Mail::factory('smtp', array ('host' => $host,
'port' => $port,
break;
}
- if (defined('MAIL_SMTP_DEBUG') && isTrue(MAIL_SMTP_DEBUG))
+ if (isTrue(MAIL_SMTP_DEBUG))
PEAR::setErrorHandling(PEAR_ERROR_PRINT);
$res = $mail->send($recipients, $headers, $data);
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.25.4482 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.25.4483 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
// Elements of timeRecordForm.
$form = new Form('timeRecordForm');
-if (defined('SUBGROUP_DEBUG') && isTrue(SUBGROUP_DEBUG)) {
+if (isTrue(SUBGROUP_DEBUG)) {
if ($user->can('manage_subgroups')) {
$groups = $user->getGroups();
if (count($groups) > 1) {
print "\t<".$group_by_tag."><![CDATA[".$subtotal['name']."]]></".$group_by_tag.">\n";
if ($bean->getAttribute('chduration')) {
$val = $subtotal['time'];
- if($val && defined('EXPORT_DECIMAL_DURATION') && isTrue(EXPORT_DECIMAL_DURATION))
+ if($val && isTrue(EXPORT_DECIMAL_DURATION))
$val = time_to_decimal($val);
print "\t<duration><![CDATA[".$val."]]></duration>\n";
}
if ($bean->getAttribute('chfinish')) print "\t<finish><![CDATA[".$item['finish']."]]></finish>\n";
if ($bean->getAttribute('chduration')) {
$duration = $item['duration'];
- if($duration && defined('EXPORT_DECIMAL_DURATION') && isTrue(EXPORT_DECIMAL_DURATION))
+ if($duration && isTrue(EXPORT_DECIMAL_DURATION))
$duration = time_to_decimal($duration);
print "\t<duration><![CDATA[".$duration."]]></duration>\n";
}
print '"'.$subtotal['name'].'"';
if ($bean->getAttribute('chduration')) {
$val = $subtotal['time'];
- if($val && defined('EXPORT_DECIMAL_DURATION') && isTrue(EXPORT_DECIMAL_DURATION))
+ if($val && isTrue(EXPORT_DECIMAL_DURATION))
$val = time_to_decimal($val);
print ',"'.$val.'"';
}
if ($bean->getAttribute('chfinish')) print ',"'.$item['finish'].'"';
if ($bean->getAttribute('chduration')) {
$val = $item['duration'];
- if($val && defined('EXPORT_DECIMAL_DURATION') && isTrue(EXPORT_DECIMAL_DURATION))
+ if($val && isTrue(EXPORT_DECIMAL_DURATION))
$val = time_to_decimal($val);
print ',"'.$val.'"';
}