$GLOBALS['Response']->addFeedback('error', $Language->getText('account_change_timezone', 'choose_tz')); } else { // if we got this far, it must be good db_query("UPDATE user SET timezone='" . db_es($request->get('timezone')) . "' WHERE user_id=" . user_getid()); session_redirect("/account/"); } } } $HTML->header(array('title' => $Language->getText('account_change_timezone', 'title'))); ?> <H3><?php echo $Language->getText('account_change_timezone', 'title2'); ?> </h3> <P> <?php echo $Language->getText('account_change_timezone', 'message', array($GLOBALS['sys_name'])); ?> <P> <form action="change_timezone.php" method="post"> <?php echo html_get_timezone_popup('timezone', user_get_timezone()); ?> <input type="submit" name="submit" value="<?php echo $Language->getText('global', 'btn_update'); ?> "> </form> <?php $HTML->footer(array());
/** * Format the changes * * @param changes: array of changes * @param $field_perm an array with the permission associated to each field. false to no check perms * @param $visible_change only needed when using permissions. Returns true if there is any change * that the user has permission to see * * @return string */ function formatChanges($changes, $field_perm, &$visible_change) { global $art_field_fact, $Language; $visible_change = false; $out_hdr = ''; $out = ''; $out_com = ''; $out_att = ''; reset($changes); $fmt = "%20s | %-25s | %s" . $GLOBALS['sys_lf']; if ($this->hasFieldPermission($field_perm, 'assigned_to') || $this->hasFieldPermission($field_perm, 'multi_assigned_to') || !isset($field_perm['assigned_to']) && !isset($field_perm['multi_assigned_to'])) { if (user_isloggedin()) { $user_id = user_getid(); $out_hdr = $Language->getText('tracker_include_artifact', 'changes_by') . ' ' . user_getrealname($user_id) . ' <' . user_getemail($user_id) . ">" . $GLOBALS['sys_lf'] . ""; $out_hdr .= $Language->getText('tracker_import_utils', 'date') . ': ' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), time()) . ' (' . user_get_timezone() . ')'; } else { $out_hdr = $Language->getText('tracker_include_artifact', 'changes_by') . ' ' . $Language->getText('tracker_include_artifact', 'anon_user') . ' ' . $Language->getText('tracker_import_utils', 'date') . ': ' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), time()); } } //Process special cases first: follow-up comment if (array_key_exists('comment', $changes) && $changes['comment']) { $visible_change = true; $out_com = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "--------------- " . $Language->getText('tracker_include_artifact', 'add_flup_comment') . " ----------------" . $GLOBALS['sys_lf'] . ""; if (isset($changes['comment']['type']) && $changes['comment']['type'] != $Language->getText('global', 'none') && $changes['comment']['type'] != '') { $out_com .= "[" . $changes['comment']['type'] . "]" . $GLOBALS['sys_lf']; } $out_com .= $this->formatFollowUp(null, $changes['comment']['format'], $changes['comment']['add'], self::OUTPUT_MAIL_TEXT); unset($changes['comment']); } //Process special cases first: file attachment if (array_key_exists('attach', $changes) && $changes['attach']) { $visible_change = true; $out_att = "" . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "--------------- " . $Language->getText('tracker_include_artifact', 'add_attachment') . " -----------------" . $GLOBALS['sys_lf'] . ""; $out_att .= sprintf($Language->getText('tracker_include_artifact', 'file_name') . " %-30s " . $Language->getText('tracker_include_artifact', 'size') . ":%d KB" . $GLOBALS['sys_lf'] . "", $changes['attach']['name'], intval($changes['attach']['size'] / 1024)); $out_att .= $changes['attach']['description'] . $GLOBALS['sys_lf'] . $changes['attach']['href']; unset($changes['attach']); } // All the rest of the fields now reset($changes); while (list($field_name, $h) = each($changes)) { // If both removed and added items are empty skip - Sanity check if ((isset($h['del']) && $h['del'] || isset($h['add']) && $h['add']) && $this->hasFieldPermission($field_perm, $field_name)) { $visible_change = true; $label = $field_name; $field = $art_field_fact->getFieldFromName($field_name); if ($field) { $label = $field->getLabel(); if (isset($h['del'])) { $h['del'] = SimpleSanitizer::unsanitize(util_unconvert_htmlspecialchars($h['del'])); } if (isset($h['add'])) { $h['add'] = SimpleSanitizer::unsanitize(util_unconvert_htmlspecialchars($h['add'])); } } $out .= sprintf($fmt, SimpleSanitizer::unsanitize($label), isset($h['del']) ? $h['del'] : "", isset($h['add']) ? $h['add'] : ""); } } // while if ($out) { $out = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . sprintf($fmt, $Language->getText('tracker_include_artifact', 'what') . ' ', $Language->getText('tracker_include_artifact', 'removed'), $Language->getText('tracker_include_artifact', 'added')) . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $out; } return $out_hdr . $out . $out_com . $out_att; }
// if we got this far, it must be good db_query("UPDATE user SET timezone='" . db_es($request->get('timezone')) . "' WHERE user_id=" . user_getid()); session_redirect("/account/"); } } } $HTML->header(array('title' => $Language->getText('account_change_timezone', 'title'))); ?> <h2><?php echo $Language->getText('account_change_timezone', 'title2'); ?> </h2> <P> <?php echo $Language->getText('account_change_timezone', 'message', array($GLOBALS['sys_name'])); ?> <P> <form action="change_timezone.php" method="post"> <?php echo $csrf->fetchHTMLInput(); echo html_get_timezone_popup(user_get_timezone()); ?> <br> <input type="submit" class="btn btn-primary" name="submit" value="<?php echo $Language->getText('global', 'btn_update'); ?> "> </form> <?php $HTML->footer(array());