var $holidays;
var $keys = array(); // These are our localized strings.
- // The getKey obtains localized keyword value.
- function getKey($kword) {
+ // get - obtains a localized value from $keys array.
+ function get($key) {
$value = '';
- $pos = strpos($kword, '.'); // Keywords can have separating dots such as in form.login.about.
+ $pos = strpos($key, '.'); // Keywords can have separating dots such as in form.login.about.
if (!($pos === false)) {
- $words = explode('.', $kword);
+ $words = explode('.', $key);
$str = '';
foreach ($words as $word) {
$str .= "['".$word."']";
}
eval("\$value = \$this->keys".$str.";");
} else {
- $value = $this->keys[$kword];
+ $value = $this->keys[$key];
}
return $value;
}
+ // getKey is a legacy function that we are replacing with get.
+ function getKey($kword) {
+ return $this->get($kword);
+ }
+
// TODO: refactoring ongoing down from here...
function getWeekDayName($id) {
$id = (int) $id;
$str .= "</TR>\n";
}
- $str .= "<tr><td colspan=\"7\" align=\"center\"><a id=\"today_link\" href=\"?".$this->controlName."=".strftime(DB_DATEFORMAT)."\" tabindex=\"-1\">".$i18n->getKey('label.today')."</a></td></tr>\n";
+ $str .= "<tr><td colspan=\"7\" align=\"center\"><a id=\"today_link\" href=\"?".$this->controlName."=".strftime(DB_DATEFORMAT)."\" tabindex=\"-1\">".$i18n->get('label.today')."</a></td></tr>\n";
$str .= "</table>\n";
$str .= "<input type=\"hidden\" name=\"$this->controlName\" value=\"$indate\">\n";
function localize() {
global $i18n;
- $this->lSelAll = $i18n->getKey('label.select_all');
- $this->lSelNone = $i18n->getKey('label.select_none');
+ $this->lSelAll = $i18n->get('label.select_all');
+ $this->lSelNone = $i18n->get('label.select_none');
}
function getHtml() {
$this->mMonthNames = $i18n->monthNames;
$this->mWeekDayShortNames = $i18n->weekdayShortNames;
- $this->lToday = $i18n->getKey('label.today');
- $this->lCalendarButtons['today'] = $i18n->getKey('label.today');
- $this->lCalendarButtons['close'] = $i18n->getKey('button.close');
+ $this->lToday = $i18n->get('label.today');
+ $this->lCalendarButtons['today'] = $i18n->get('label.today');
+ $this->lCalendarButtons['close'] = $i18n->get('button.close');
$this->mDateFormat = $user->date_format;
$this->mWeekStartDay = $user->week_start;
$result = true;
if (!ttValidString($fields['group_name'], true)) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.team_name'));
$result = false;
}
if (!ttValidString($fields['user_name'])) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.manager_name'));
$result = false;
}
if (!ttValidString($fields['new_login'])) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.manager_login'));
$result = false;
}
// If we change login, it must be unique.
if ($fields['new_login'] != $fields['old_login']) {
if (ttUserHelper::getUserByLogin($fields['new_login'])) {
- $this->err->add($i18n->getKey('error.user_exists'));
+ $this->err->add($i18n->get('error.user_exists'));
$result = false;
}
}
if (!$auth->isPasswordExternal() && ($fields['password1'] || $fields['password2'])) {
if (!ttValidString($fields['password1'])) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.password'));
$result = false;
}
if (!ttValidString($fields['password2'])) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.confirm_password'));
$result = false;
}
if ($fields['password1'] !== $fields['password2']) {
- $this->err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $this->err->add($i18n->get('error.not_equal'), $i18n->get('label.password'), $i18n->get('label.confirm_password'));
$result = false;
}
}
if (!ttValidEmail($fields['email'], true)) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.email'));
$result = false;
}
$result = true;
if (!ttValidString($fields['name'])) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.person_name'));
$result = false;
}
if (!ttValidString($fields['login'])) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.login'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.login'));
$result = false;
}
// If we change login, it must be unique.
if ($fields['login'] != $user->login) {
if (ttUserHelper::getUserByLogin($fields['login'])) {
- $this->err->add($i18n->getKey('error.user_exists'));
+ $this->err->add($i18n->get('error.user_exists'));
$result = false;
}
}
if (!$auth->isPasswordExternal() && ($fields['password1'] || $fields['password2'])) {
if (!ttValidString($fields['password1'])) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.password'));
$result = false;
}
if (!ttValidString($fields['password2'])) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.confirm_password'));
$result = false;
}
if ($fields['password1'] !== $fields['password2']) {
- $this->err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $this->err->add($i18n->get('error.not_equal'), $i18n->get('label.password'), $i18n->get('label.confirm_password'));
$result = false;
}
}
if (!ttValidEmail($fields['email'], true)) {
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.email'));
$result = false;
}
$sql = 'update tt_users set '.$login_part.$password_part.$name_part.$email_part.$modified_part.'where id = '.$user_id;
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) {
- $this->err->add($i18n->getKey('error.db'));
+ $this->err->add($i18n->get('error.db'));
return false;
}
// If the file is compressed - uncompress it.
if ($compressed) {
if (!$this->uncompress($_FILES['xmlfile']['tmp_name'], $filename)) {
- $this->errors->add($i18n->getKey('error.sys'));
+ $this->errors->add($i18n->get('error.sys'));
return;
}
unlink($_FILES['xmlfile']['tmp_name']);
} else {
if (!move_uploaded_file($_FILES['xmlfile']['tmp_name'], $filename)) {
- $this->errors->add($i18n->getKey('error.upload'));
+ $this->errors->add($i18n->get('error.upload'));
return;
}
}
xml_get_current_line_number($parser)));
}
if (!$this->canImport) {
- $this->errors->add($i18n->getKey('error.user_exists'));
+ $this->errors->add($i18n->get('error.user_exists'));
break;
}
}
$body .= '<body>';
// Output title.
- $body .= '<p style="'.$style_title.'">'.$i18n->getKey('title.invoice').' '.htmlspecialchars($invoice['name']).'</p>';
+ $body .= '<p style="'.$style_title.'">'.$i18n->get('title.invoice').' '.htmlspecialchars($invoice['name']).'</p>';
// Output comment.
if($comment) $body .= '<p>'.htmlspecialchars($comment).'</p>';
// Output invoice info.
$body .= '<table>';
- $body .= '<tr><td><b>'.$i18n->getKey('label.date').':</b> '.$invoice['date'].'</td></tr>';
- $body .= '<tr><td><b>'.$i18n->getKey('label.client').':</b> '.htmlspecialchars($client['name']).'</td></tr>';
- $body .= '<tr><td><b>'.$i18n->getKey('label.client_address').':</b> '.htmlspecialchars($client['address']).'</td></tr>';
+ $body .= '<tr><td><b>'.$i18n->get('label.date').':</b> '.$invoice['date'].'</td></tr>';
+ $body .= '<tr><td><b>'.$i18n->get('label.client').':</b> '.htmlspecialchars($client['name']).'</td></tr>';
+ $body .= '<tr><td><b>'.$i18n->get('label.client_address').':</b> '.htmlspecialchars($client['address']).'</td></tr>';
$body .= '</table>';
$body .= '<p></p>';
// Output invoice items.
$body .= '<table border="0" cellpadding="4" cellspacing="0" width="100%">';
$body .= '<tr>';
- $body .= '<td style="'.$style_tableHeader.'">'.$i18n->getKey('label.date').'</td>';
- $body .= '<td style="'.$style_tableHeader.'">'.$i18n->getKey('form.invoice.person').'</td>';
+ $body .= '<td style="'.$style_tableHeader.'">'.$i18n->get('label.date').'</td>';
+ $body .= '<td style="'.$style_tableHeader.'">'.$i18n->get('form.invoice.person').'</td>';
if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
- $body .= '<td style="'.$style_tableHeader.'">'.$i18n->getKey('label.project').'</td>';
+ $body .= '<td style="'.$style_tableHeader.'">'.$i18n->get('label.project').'</td>';
if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
- $body .= '<td style="'.$style_tableHeader.'">'.$i18n->getKey('label.task').'</td>';
- $body .= '<td style="'.$style_tableHeader.'">'.$i18n->getKey('label.note').'</td>';
- $body .= '<td style="'.$style_tableHeaderCentered.'" width="5%">'.$i18n->getKey('label.duration').'</td>';
- $body .= '<td style="'.$style_tableHeaderCentered.'" width="5%">'.$i18n->getKey('label.cost').'</td>';
+ $body .= '<td style="'.$style_tableHeader.'">'.$i18n->get('label.task').'</td>';
+ $body .= '<td style="'.$style_tableHeader.'">'.$i18n->get('label.note').'</td>';
+ $body .= '<td style="'.$style_tableHeaderCentered.'" width="5%">'.$i18n->get('label.duration').'</td>';
+ $body .= '<td style="'.$style_tableHeaderCentered.'" width="5%">'.$i18n->get('label.cost').'</td>';
$body .= '</tr>';
foreach ($invoice_items as $item) {
$body .= '<tr>';
$colspan += 2;
$body .= '<tr><td> </td></tr>';
if ($tax) {
- $body .= '<tr><td colspan="'.$colspan.'" align="right"><b>'.$i18n->getKey('label.subtotal').':</b></td><td nowrap align="right">'.$subtotal.'</td></tr>';
- $body .= '<tr><td colspan="'.$colspan.'" align="right"><b>'.$i18n->getKey('label.tax').':</b></td><td nowrap align="right">'.$tax.'</td></tr>';
+ $body .= '<tr><td colspan="'.$colspan.'" align="right"><b>'.$i18n->get('label.subtotal').':</b></td><td nowrap align="right">'.$subtotal.'</td></tr>';
+ $body .= '<tr><td colspan="'.$colspan.'" align="right"><b>'.$i18n->get('label.tax').':</b></td><td nowrap align="right">'.$tax.'</td></tr>';
}
- $body .= '<tr><td colspan="'.$colspan.'" align="right"><b>'.$i18n->getKey('label.total').':</b></td><td nowrap align="right">'.$total.'</td></tr>';
+ $body .= '<tr><td colspan="'.$colspan.'" align="right"><b>'.$i18n->get('label.total').':</b></td><td nowrap align="right">'.$total.'</td></tr>';
$body .= '</table>';
// Output footer.
if (!defined('REPORT_FOOTER') || !(REPORT_FOOTER == false))
- $body .= '<p style="text-align: center;">'.$i18n->getKey('form.mail.footer').'</p>';
+ $body .= '<p style="text-align: center;">'.$i18n->get('form.mail.footer').'</p>';
// Finish creating email body.
$body .= '</body></html>';
global $i18n;
if (!ttValidString($this->group_name, true))
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.team_name'));
if (!ttValidString($this->currency, true))
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.currency'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.currency'));
if (!ttValidString($this->user_name))
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.manager_name'));
if (!ttValidString($this->login))
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.manager_login'));
if (!ttValidString($this->password1))
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.password'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.password'));
if (!ttValidString($this->password2))
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.confirm_password'));
if ($this->password1 !== $this->password2)
- $this->err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
+ $this->err->add($i18n->get('error.not_equal'), $i18n->get('label.password'), $i18n->get('label.confirm_password'));
if (!ttValidEmail($this->email, true))
- $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.email'));
+ $this->err->add($i18n->get('error.field'), $i18n->get('label.email'));
}
// The register function registers a user in Time Tracker.
import('ttUserHelper');
if (ttUserHelper::getUserByLogin($this->login)) {
// User login already exists.
- $this->err->add($i18n->getKey('error.user_exists'));
+ $this->err->add($i18n->get('error.user_exists'));
return false;
}
// Create a new group.
$this->group_id = $this->createGroup();
if (!$this->group_id) {
- $this->err->add($i18n->getKey('error.db'));
+ $this->err->add($i18n->get('error.db'));
return false;
}
import('ttRoleHelper');
if (!ttRoleHelper::createPredefinedRoles($this->group_id, $this->lang)) {
- $err->add($i18n->getKey('error.db'));
+ $err->add($i18n->get('error.db'));
return false;
}
$this->role_id = ttRoleHelper::getTopManagerRoleID();
$this->user_id = $this->createUser();
if (!$this->user_id) {
- $err->add($i18n->getKey('error.db'));
+ $err->add($i18n->get('error.db'));
return false;
}
$sql = "update tt_teams set created_by = $user_id where id = $this->group_id";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) {
- $this->err->add($i18n->getKey('error.db'));
+ $this->err->add($i18n->get('error.db'));
return false;
}
$sql = "update tt_users set created_by = $user_id where id = $user_id and team_id = $this->group_id";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) {
- $this->err->add($i18n->getKey('error.db'));
+ $this->err->add($i18n->get('error.db'));
return false;
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.17.67.4141 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.17.67.4142 | 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>