// array('Ldap Testers') means that the user must be a member Ldap Testers group.
// array('Ldap Testers', 'Ldap Users') means the user must be a member of both Ldap Testers and Ldap Users groups.
-// define('AUTH_DEBUG', false); // Note: enabling AUTH_DEBUG breaks redirects as debug output is printed before setting redirect header. Do not enable on production systems.
+// define('DEBUG', false); // Note: enabling DEBUG breaks redirects as debug output is printed before setting redirect header. Do not enable on production systems.
// Team managers can set monthly work hour quota for years between the following values.
function doLogin($login, $password) {
$auth = $this->authenticate($login, $password);
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('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 (isTrue('AUTH_DEBUG'))
+ if (isTrue('DEBUG'))
echo 'db error!<br />';
return false;
}
$val = $res->fetchRow();
if (!$val['id']) {
- if (isTrue('AUTH_DEBUG'))
+ if (isTrue('DEBUG'))
echo 'login "'.$login.'" does not exist in Time Tracker database.<br />';
return false;
}
$lc = ldap_connect($this->params['server']);
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('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 (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
ldap_set_option($lc, LDAP_OPT_DEBUG_LEVEL, 7);
}
$login .= '@' . $this->params['default_domain'];
}
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
echo '$login='; var_dump($login); echo '<br />';
}
$lb = @ldap_bind($lc, $login, $password);
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('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 (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
echo '$sr='; var_dump($sr); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$entries = @ldap_get_entries($lc, $sr);
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
echo '$entries='; var_dump($entries); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$groups[] = substr($grp_fields[0], 3);
}
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
echo '$member_of'; var_dump($member_of); echo '<br />';
};
// Assuming OpenLDAP server.
$login_oldap = 'uid='.$login.','.$this->params['base_dn'];
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
echo '$login_oldap='; var_dump($login_oldap); echo '<br />';
}
$lb = @ldap_bind($lc, $login_oldap, $password);
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('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 (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
echo '$sr='; var_dump($sr); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$entries = @ldap_get_entries($lc, $sr);
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
echo '$entries='; var_dump($entries); echo '<br />';
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
}
$groups[] = substr($grp_fields[0], 3);
}
- if (isTrue('AUTH_DEBUG')) {
+ if (isTrue('DEBUG')) {
echo '$member_of'; var_dump($member_of); echo '<br />';
}
--- /dev/null
+<?php
+// +----------------------------------------------------------------------+
+// | Anuko Time Tracker
+// +----------------------------------------------------------------------+
+// | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
+// +----------------------------------------------------------------------+
+// | LIBERAL FREEWARE LICENSE: This source code document may be used
+// | by anyone for any purpose, and freely redistributed alone or in
+// | combination with other software, provided that the license is obeyed.
+// |
+// | There are only two ways to violate the license:
+// |
+// | 1. To redistribute this code in source form, with the copyright
+// | notice or license removed or altered. (Distributing in compiled
+// | forms without embedded copyright notices is permitted).
+// |
+// | 2. To redistribute modified versions of this code in *any* form
+// | that bears insufficient indications that the modifications are
+// | not the work of the original author(s).
+// |
+// | This license applies to this document only, not any other software
+// | that it may be combined with.
+// |
+// +----------------------------------------------------------------------+
+// | Contributors:
+// | https://www.anuko.com/time_tracker/credits.htm
+// +----------------------------------------------------------------------+
+
+import('ttConfigHelper');
+import('ttGroupHelper');
+
+// ttDebugTracer class is used to print debug messages when DEBUG constant is true.
+// It does nothing otherwise.
+class ttDebugTracer {
+ var $debug = false; // Do work only if true.
+ var $file_name = null; // Source file name to print.
+
+ // Constructor.
+ function __construct($file_name = null) {
+ if (isTrue('DEBUG')) $this->debug = true;
+ $this->file_name = $file_name;
+ }
+
+ // prinln - prints a line.
+ public function println($msg) {
+ if ($this->debug) {
+ echo "$this->file_name: $msg<br />";
+ }
+ }
+}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.65.4941 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.65.4942 | 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>
// +----------------------------------------------------------------------+
require_once('initialize.php');
+import('ttDebugTracer');
import('form.Form');
import('ttConfigHelper');
import('ttUserHelper');
import('ttTimeHelper');
import('DateAndTime');
+// Initialize ttDebugTracer to print diagnostic messages.
+$debug = new ttDebugTracer(__FILE__);
+$debug->println('page entry after imports');
+
// Access checks.
if (!(ttAccessAllowed('track_own_time') || ttAccessAllowed('track_time'))) {
header('Location: access_denied.php');
exit();
}
}
+$debug->println('after all access checks');
// End of access checks.
// Determine user for whom we display this page.
}
$group_id = $user->getGroup();
+$debug->println("user_id: $user_id group_id: $group_id");
$showClient = $user->isPluginEnabled('cl');
$trackingMode = $user->getTrackingMode();
$week_total = ttTimeHelper::getTimeForWeek($selected_date);
$timeRecords = $showFiles? ttTimeHelper::getRecordsWithFiles($user_id, $cl_date) : ttTimeHelper::getRecords($user_id, $cl_date);
+$debug->println('smarty assignments');
+
$smarty->assign('selected_date', $selected_date);
$smarty->assign('week_total', $week_total);
$smarty->assign('day_total', ttTimeHelper::getTimeForDay($cl_date));
$smarty->assign('show_start', $showStart);
$smarty->assign('show_finish', $showFinish);
$smarty->assign('show_duration', $showDuration);
-
-
$smarty->assign('show_note_column', $showNoteColumn);
$smarty->assign('show_note_row', $showNoteRow);
$smarty->assign('show_files', $showFiles);