$sql = "update tt_users set accessed = now(), accessed_ip = $accessed_ip where id = $user->id";
$mdb2->exec($sql);
}
+
+ // canAdd determines if we can add a user in case there is a limit.
+ static function canAdd() {
+ $mdb2 = getConnection();
+ $sql = "select param_value from tt_site_config where param_name = 'max_users'";
+ $res = $mdb2->query($sql);
+ $val = $res->fetchRow();
+ if (!$val) return true; // No limit.
+
+ $max_count = $val['param_value'];
+ $sql = "select count(*) as user_count from tt_users where status is not null";
+ $res = $mdb2->query($sql);
+ $val = $res->fetchRow();
+ if ($val['user_count'] < $max_count)
+ return true; // Limit not reached.
+
+ return false;
+ }
}
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
'error.xml' => 'Error in XML file at line %d: %s.',
'error.cannot_import' => 'Cannot import: %s.',
'error.format' => 'Invalid file format.',
+'error.user_count' => 'Limit on user count.',
// Warning messages.
'warn.sure' => 'Are you sure?',
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
'error.xml' => 'Fout in XML bestand in regel line %d: %s.',
'error.cannot_import' => 'Kan het volgende niet importeren: %s.',
'error.format' => 'Bestandsformaat niet valide.',
+// TODO: translate the following.
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
'error.xml' => 'Ошибка в файле XML на строке %d: %s.',
'error.cannot_import' => 'Невозможно импортировать: %s.',
'error.format' => 'Неверный формат файла.',
+'error.user_count' => 'Ограничение на количество пользователей.',
// Warning messages.
'warn.sure' => 'Вы уверены?',
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
// 'error.xml' => 'Error in XML file at line %d: %s.',
// 'error.cannot_import' => 'Cannot import: %s.',
// 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
// Warning messages.
// TODO: translate the following.
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.36.4686 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.36.4687 | 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>
if (!ttValidEmail($cl_email, true)) $err->add($i18n->get('error.field'), $i18n->get('label.email'));
if (!ttValidFloat($cl_rate, true)) $err->add($i18n->get('error.field'), $i18n->get('form.users.default_rate'));
if (!ttValidFloat($cl_quota_percent, true)) $err->add($i18n->get('error.field'), $i18n->get('label.quota'));
+ if (!ttUserHelper::canAdd()) $err->add($i18n->get('error.user_count'));
if ($err->no()) {
if (!ttUserHelper::getUserByLogin($cl_login)) {
if ($user->isPluginEnabled('cl') && ttRoleHelper::isClientRole($cl_role_id) && !$cl_client_id) $err->add($i18n->get('error.client'));
if (!ttValidFloat($cl_rate, true)) $err->add($i18n->get('error.field'), $i18n->get('form.users.default_rate'));
if (!ttValidFloat($cl_quota_percent, true)) $err->add($i18n->get('error.field'), $i18n->get('label.quota'));
+ if (!ttUserHelper::canAdd()) $err->add($i18n->get('error.user_count'));
if ($err->no()) {
if (!ttUserHelper::getUserByLogin($cl_login)) {