From b027832862272283d9203c994ec8fd39f6196887 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 21 Mar 2016 06:53:16 -0700 Subject: [PATCH] Cleaning up white space --- WEB-INF/templates/footer.tpl | 2 +- time_delete.php | 2 +- tofile.php | 69 ++++++++++++++++++------------------ topdf.php | 16 ++++----- user_add.php | 8 ++--- user_delete.php | 18 +++++----- user_edit.php | 28 +++++++-------- 7 files changed, 72 insertions(+), 71 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index d6a47546..1b8f4dc8 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- '; } $html .= ''; $html .= ''; - + foreach ($items as $item) { // Print a subtotal for a block of grouped values. $cur_date = $item['date']; @@ -234,11 +234,11 @@ if ($totals_only) { } if ($bean->getAttribute('chinvoice')) $html .= ''; $html .= ''; - + $prev_date = $item['date']; if ($print_subtotals) $prev_grouped_by = $item['grouped_by']; } - + // Print a terminating subtotal. if ($print_subtotals) { $html .= ''; @@ -283,7 +283,7 @@ if ($totals_only) { if ($bean->getAttribute('chinvoice')) $html .= ''; $html .= ''; } - + // Print totals. $html .= ''; $html .= ''; @@ -302,7 +302,7 @@ if ($totals_only) { if ($user->canManageTeam() || $user->isClient()) $html .= $totals['cost']; else - $html .= $totals['expenses']; + $html .= $totals['expenses']; $html .= ''; } if ($bean->getAttribute('chinvoice')) $html .= ''; @@ -337,17 +337,17 @@ class ttPDF extends TCPDF { public $image_file = 'images/tt_logo.png'; // Image file for the logo in header. public $page_word = 'Page'; // Localized "Page" word in footer, ex: Page 1/2. - + // SetImageFile - sets image file name. public function SetImageFile($imgFile) { $this->image_file = $imgFile; } - + // SetPageWord - sets page word for footer. public function SetPageWord($pageWord) { $this->page_word = $pageWord; } - + // Page header. public function Header() { // Print logo, which is the only element of our custom header. diff --git a/user_add.php b/user_add.php index 2d0b964e..e6340de9 100644 --- a/user_add.php +++ b/user_add.php @@ -136,11 +136,11 @@ if ($request->getMethod() == 'POST') { if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name')); if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login')); if (!$auth->isPasswordExternal()) { - if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password')); - if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password')); + if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password')); + if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password')); if ($cl_password1 !== $cl_password2) $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password')); - } + } if (!ttValidEmail($cl_email, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email')); if (!ttValidFloat($cl_rate, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.users.default_rate')); @@ -164,7 +164,7 @@ if ($request->getMethod() == 'POST') { } else $errors->add($i18n->getKey('error.user_exists')); } -} // post +} // POST $smarty->assign('auth_external', $auth->isPasswordExternal()); $smarty->assign('forms', array($form->getName()=>$form->toArray())); diff --git a/user_delete.php b/user_delete.php index 6171f7f1..079c1140 100644 --- a/user_delete.php +++ b/user_delete.php @@ -50,19 +50,19 @@ if ($ok_to_go) $ok_to_go = $ok_to_go && ($user->team_id == $user_details['team_i if ($ok_to_go && $user->isCoManager() && (ROLE_COMANAGER == $user_details['role'])) $ok_to_go = ($user->id == $user_details['id']); // Comanager is not allowed to delete other comanagers. if ($ok_to_go && $user->isCoManager() && (ROLE_MANAGER == $user_details['role'])) - $ok_to_go = false; // Comanager is not allowed to delete a manager. + $ok_to_go = false; // Comanager is not allowed to delete a manager. if (!$ok_to_go) die ($i18n->getKey('error.sys')); else - $smarty->assign('user_to_delete', $user_details['name']." (".$user_details['login'].")"); + $smarty->assign('user_to_delete', $user_details['name']." (".$user_details['login'].")"); // Create confirmation form. $form = new Form('userDeleteForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$user_id)); $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete'))); $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->getKey('button.cancel'))); - + if ($request->getMethod() == 'POST') { if ($request->getParameter('btn_delete')) { if (ttUserHelper::markDeleted($user_id)) { @@ -73,14 +73,14 @@ if ($request->getMethod() == 'POST') { } // If we deleted our own account, do housekeeping and logout. if ($user->id == $user_id) { - // Remove tt_login cookie that stores login name. - unset($_COOKIE['tt_login']); - setcookie('tt_login', NULL, -1); - + // Remove tt_login cookie that stores login name. + unset($_COOKIE['tt_login']); + setcookie('tt_login', NULL, -1); + $auth->doLogout(); header('Location: login.php'); } else { - header('Location: users.php'); + header('Location: users.php'); } exit(); } else { @@ -91,7 +91,7 @@ if ($request->getMethod() == 'POST') { header('Location: users.php'); exit(); } -} +} // POST $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('title', $i18n->getKey('title.delete_user')); diff --git a/user_edit.php b/user_edit.php index a5311e0a..e314e53e 100644 --- a/user_edit.php +++ b/user_edit.php @@ -74,7 +74,7 @@ if ($request->getMethod() == 'POST') { $cl_email = trim($request->getParameter('email')); $cl_role = $request->getParameter('role'); $cl_client_id = $request->getParameter('client'); - $cl_status = $request->getParameter('status'); + $cl_status = $request->getParameter('status'); $cl_rate = $request->getParameter('rate'); $cl_projects = $request->getParameter('projects'); if (is_array($cl_projects)) { @@ -167,11 +167,11 @@ if ($request->getMethod() == 'POST') { if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.person_name')); if (!ttValidString($cl_login)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.login')); if (!$auth->isPasswordExternal() && ($cl_password1 || $cl_password2)) { - if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password')); - if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password')); + if (!ttValidString($cl_password1)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.password')); + if (!ttValidString($cl_password2)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password')); if ($cl_password1 !== $cl_password2) $errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password')); - } + } if (!ttValidEmail($cl_email, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.email')); if (!ttValidFloat($cl_rate, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.users.default_rate')); @@ -188,8 +188,8 @@ if ($request->getMethod() == 'POST') { 'rate' => $cl_rate, 'projects' => $assigned_projects); if (right_assign_roles & $user->rights) { - $fields['role'] = $cl_role; - $fields['client_id'] = $cl_client_id; + $fields['role'] = $cl_role; + $fields['client_id'] = $cl_client_id; } if (ttUserHelper::update($user_id, $fields)) { @@ -198,23 +198,23 @@ if ($request->getMethod() == 'POST') { if (($user_id == $user->id) && ($user->login != $cl_login)) { setcookie('tt_login', $cl_login, time() + COOKIE_EXPIRE, '/'); } - + // In case the name of the "on behalf" user has changed - set it in session. if (($user->behalf_id == $user_id) && ($user->behalf_name != $cl_name)) { $_SESSION['behalf_name'] = $cl_name; } - + // If we deactivated our own account, do housekeeping and logout. if ($user->id == $user_id && !is_null($cl_status) && $cl_status == INACTIVE) { - // Remove tt_login cookie that stores login name. - unset($_COOKIE['tt_login']); - setcookie('tt_login', NULL, -1); - + // Remove tt_login cookie that stores login name. + unset($_COOKIE['tt_login']); + setcookie('tt_login', NULL, -1); + $auth->doLogout(); header('Location: login.php'); exit(); } - + header('Location: users.php'); exit(); @@ -223,7 +223,7 @@ if ($request->getMethod() == 'POST') { } else $errors->add($i18n->getKey('error.user_exists')); } -} // post +} // POST $rates = ttProjectHelper::getRates($user_id); $smarty->assign('rates', $rates); -- 2.20.1
 Anuko Time Tracker 1.9.16.3427 | Copyright © Anuko | +  Anuko Time Tracker 1.9.16.3428 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/time_delete.php b/time_delete.php index dd694f7b..e07d1d33 100644 --- a/time_delete.php +++ b/time_delete.php @@ -54,7 +54,7 @@ if ($time_rec['invoice_id']) die($i18n->getKey('error.sys')); $time_rec['comment'] = htmlspecialchars($time_rec['comment']); if ($request->getMethod() == 'POST') { - if ($request->getParameter('delete_button')) { // Delete button pressed. + if ($request->getParameter('delete_button')) { // Delete button pressed. // Determine if it's okay to delete the record. $item_date = new DateAndTime(DB_DATEFORMAT, $time_rec['date']); diff --git a/tofile.php b/tofile.php index a784a1e9..26d1cbae 100644 --- a/tofile.php +++ b/tofile.php @@ -46,9 +46,10 @@ if (in_array('cf', explode(',', $user->plugins))) { // Report settings are stored in session bean before we get here. $bean = new ActionForm('reportBean', new Form('reportForm'), $request); -// At the moment, we distinguish 2 types of export to file: -// 1) export to xml -// 2) export to csv +// This file handles 2 types of export to a file: +// 1) xml +// 2) csv +// Export to pdf is handled separately in topdf.php. $type = $request->getParameter('type'); // Also, there are 2 variations of report: totals only, or normal. Totals only means that the report @@ -67,17 +68,17 @@ header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Cache-Control: private', false); - + // Handle 2 cases of possible exports individually. // 1) entries exported to xml if ('xml' == $type) { header('Content-Type: application/xml'); header('Content-Disposition: attachment; filename="timesheet.xml"'); - + print "\n"; print "\n"; - + $group_by = $bean->getAttribute('group_by'); if ($totals_only) { // Totals only report. Print subtotals. @@ -91,18 +92,18 @@ if ('xml' == $type) { print "\t\n"; } if ($bean->getAttribute('chcost')) { - print "\tcanManageTeam() || $user->isClient()) - print $subtotal['cost']; - else - print $subtotal['expenses']; - print "]]>\n"; + print "\tcanManageTeam() || $user->isClient()) + print $subtotal['cost']; + else + print $subtotal['expenses']; + print "]]>\n"; } print "\n"; } } else { // Normal report. - foreach ($items as $item) { + foreach ($items as $item) { print "\n"; print "\t\n"; @@ -114,34 +115,34 @@ if ('xml' == $type) { if ($bean->getAttribute('chstart')) print "\t\n"; if ($bean->getAttribute('chfinish')) print "\t\n"; if ($bean->getAttribute('chduration')) { - $duration = $item['duration']; + $duration = $item['duration']; if($duration && defined('EXPORT_DECIMAL_DURATION') && isTrue(EXPORT_DECIMAL_DURATION)) $duration = time_to_decimal($duration); print "\t\n"; } if ($bean->getAttribute('chnote')) print "\t\n"; if ($bean->getAttribute('chcost')) { - print "\tcanManageTeam() || $user->isClient()) - print $item['cost']; - else - print $item['expense']; - print "]]>\n"; + print "\tcanManageTeam() || $user->isClient()) + print $item['cost']; + else + print $item['expense']; + print "]]>\n"; } if ($bean->getAttribute('chinvoice')) print "\t\n"; print "\n"; - } + } } - + print ""; -} +} // 2) entries exported to csv if ('csv' == $type) { header('Content-Type: application/csv'); header('Content-Disposition: attachment; filename="timesheet.csv"'); - + // Print UTF8 BOM first to identify encoding. $bom = chr(239).chr(187).chr(191); // 0xEF 0xBB 0xBF in the beginning of the file is UTF8 BOM. print $bom; // Without this Excel does not display UTF8 characters properly. @@ -149,8 +150,8 @@ if ('csv' == $type) { $group_by = $bean->getAttribute('group_by'); if ($totals_only) { // Totals only report. - - // Determine group_by header. + + // Determine group_by header. if ('cf_1' == $group_by) $group_by_header = $custom_fields->fields[0]['label']; else { @@ -163,18 +164,18 @@ if ('csv' == $type) { if ($bean->getAttribute('chduration')) print ',"'.$i18n->getKey('label.duration').'"'; if ($bean->getAttribute('chcost')) print ',"'.$i18n->getKey('label.cost').'"'; print "\n"; - + // Print subtotals. foreach ($subtotals as $subtotal) { print '"'.$subtotal['name'].'"'; if ($bean->getAttribute('chduration')) { $val = $subtotal['time']; - if($val && defined('EXPORT_DECIMAL_DURATION') && isTrue(EXPORT_DECIMAL_DURATION)) + if($val && defined('EXPORT_DECIMAL_DURATION') && isTrue(EXPORT_DECIMAL_DURATION)) $val = time_to_decimal($val); - print ',"'.$val.'"'; + print ',"'.$val.'"'; } if ($bean->getAttribute('chcost')) { - if ($user->canManageTeam() || $user->isClient()) + if ($user->canManageTeam() || $user->isClient()) print ',"'.$subtotal['cost'].'"'; else print ',"'.$subtotal['expenses'].'"'; @@ -215,10 +216,10 @@ if ('csv' == $type) { } if ($bean->getAttribute('chnote')) print ',"'.str_replace('"','""',$item['note']).'"'; if ($bean->getAttribute('chcost')) { - if ($user->canManageTeam() || $user->isClient()) - print ',"'.$item['cost'].'"'; - else - print ',"'.$item['expense'].'"'; + if ($user->canManageTeam() || $user->isClient()) + print ',"'.$item['cost'].'"'; + else + print ',"'.$item['expense'].'"'; } if ($bean->getAttribute('chinvoice')) print ',"'.str_replace('"','""',$item['invoice']).'"'; print "\n"; diff --git a/topdf.php b/topdf.php index 3f0a6dc7..0126bc61 100644 --- a/topdf.php +++ b/topdf.php @@ -159,7 +159,7 @@ if ($totals_only) { if ($bean->getAttribute('chinvoice')) { $colspan++; $html .= ''.$i18n->getKey('label.invoice').'
'.htmlspecialchars($item['invoice']).'