<tr><td> </td><td><?php if (isset($_POST['rel_startid']) && isset($_POST['action']) && $_POST['action'] == L_CALENDAR_RELATIVE_CHECK) { echo calc_start_id($_POST['rel_startid']); } ?> </td></tr> <tr><td><?php echo L_NAME; ?> **</td><td><input type="text" id="rel_name" name="rel_name" value="<?php echo isset($_POST['rel_name']) ? $_POST['rel_name'] : (isset($_SESSION['set_' . $module . '_time_rel_name']) ? $_SESSION['set_' . $module . '_time_rel_name'] : '%Y/%m'); ?> " onchange="is_custom()" /></td></tr> <tr><td> </td><td><?php if (isset($_POST['rel_name']) && isset($_POST['action']) && $_POST['action'] == L_CALENDAR_RELATIVE_CHECK) { echo time_replace_chars($_POST['rel_name']); } ?> </td></tr> <tr><td colspan="2"> <a href="../doc/relative_time-spans.html" target="_blank"><?php echo L_CALENDAR_RELATIVE_HELP; ?> </a> <input type="hidden" name="rel" value="1" /> </td></tr> <?php } ?> <tr><td colspan="2" style="text-align:center"><?php
foreach ($list_modules as $modul) { if (isset($_SESSION['set_' . $modul . '_time_rel']) && $_SESSION['set_' . $modul . '_time_rel']) { if (!$_SESSION['set_' . $modul . '_time_span']) { $changed[$modul] = true; } else { if (isset($_SESSION['set_' . $modul . '_time_start'])) { $old_start = $_SESSION['set_' . $modul . '_time_start']; } if (isset($_SESSION['set_' . $modul . '_time_end'])) { $old_end = $_SESSION['set_' . $modul . '_time_end']; } } $_SESSION['set_' . $modul . '_time_span'] = true; $_SESSION['set_' . $modul . '_time_start'] = parse_str_to_time($_SESSION['set_' . $modul . '_time_rel_start']); $_SESSION['set_' . $modul . '_time_end'] = parse_str_to_time($_SESSION['set_' . $modul . '_time_rel_end']); $_SESSION['set_' . $modul . '_time_name'] = time_replace_chars($_SESSION['set_' . $modul . '_time_rel_name']); if (isset($old_start) && isset($old_end) && ($old_start != $_SESSION['set_' . $modul . '_time_start'] || $old_end != $_SESSION['set_' . $modul . '_time_end'])) { $changed[$modul] = true; } unset($old_start); unset($old_end); } } if (empty($message_fatal)) { // read cache $all_cached = true; foreach ($list_modules as $modul) { if ($config_stat_cache && isset($_SESSION['module_' . $modul . '_data']) && (!isset($changed[$modul]) || !$changed[$modul]) && (!isset($_GET['reload']) || $_GET['reload'] != 'true')) { $cached[$modul] = true; } else { if (!isset($_GET['goon'])) {
function calc_start_id($str) { if (strpos($str, '-') !== false) { $op = '-'; } elseif (strpos($str, '+') !== false) { $op = '+'; } else { return time_replace_chars($str); } $parts = explode($op, $str); $result = 0; $opuse = false; foreach ($parts as $id => $part) { $part = time_replace_chars($part); $result += ($op == '-' && $opuse ? -1 : 1) * $part; $opuse = true; } return $result; }