$start = retrieve(POST, 'start', '', TSTRING_UNCHANGE); $end = retrieve(POST, 'end', '', TSTRING_UNCHANGE); $hour = retrieve(POST, 'hour', '', TSTRING_UNCHANGE); $min = retrieve(POST, 'min', '', TSTRING_UNCHANGE); $get_visible = retrieve(POST, 'visible', 0); if (!empty($icon_path)) { $icon = $icon_path; } if (!empty($img)) { $img = '<img src="' . stripslashes($img) . '" alt="' . stripslashes($alt) . '" title="' . stripslashes($alt) . '" class="img_right" style="margin: 6px; border: 1px solid #000000;" />'; } else { $img = ''; } $start_timestamp = strtotimestamp($start, $LANG['date_format_short']); $end_timestamp = strtotimestamp($end, $LANG['date_format_short']); $current_date_timestamp = strtotimestamp($current_date, $LANG['date_format_short']); $visible = 1; if ($get_visible == 2) { if ($start_timestamp > time()) { $visible = 2; } else { $start = ''; } if ($end_timestamp > time() && $end_timestamp > $start_timestamp) { $visible = 2; } else { $end = ''; } } elseif ($get_visible == 1) { $start = ''; $end = '';
$Template->pparse('calendar'); } } else { redirect(HOST . SCRIPT . SID2); } } elseif ($add) { if (!$User->check_level($CONFIG_CALENDAR['calendar_auth'])) { $Errorh->handler('e_auth', E_USER_REDIRECT); } if (!empty($_POST['valid'])) { $contents = retrieve(POST, 'contents', '', TSTRING_PARSE); $title = retrieve(POST, 'title', ''); $date = retrieve(POST, 'date', '', TSTRING_UNCHANGE); $hour = retrieve(POST, 'hour', 0); $min = retrieve(POST, 'min', 0); $timestamp = strtotimestamp($date, $LANG['date_format_short']); if ($timestamp > 0) { $timestamp += $hour * 3600 + $min * 60; } else { $timestamp = 0; } if ($timestamp > 0 && ($hour >= 0 && $hour <= 23) && ($min >= 0 && $min <= 59)) { if (!empty($title) && !empty($contents)) { $Sql->query_inject("INSERT INTO " . PREFIX . "calendar (timestamp,title,contents,user_id,nbr_com) VALUES ('" . $timestamp . "', '" . $title . "', '" . $contents . "', '" . $User->get_attribute('user_id') . "', 0)", __LINE__, __FILE__); $day = gmdate_format('d', $timestamp); $month = gmdate_format('m', $timestamp); $year = gmdate_format('Y', $timestamp); redirect(HOST . DIR . '/calendar/calendar' . url('.php?d=' . $day . '&m=' . $month . '&y=' . $year, '-' . $day . '-' . $month . '-' . $year . '.php', '&') . '#act'); } else { redirect(HOST . SCRIPT . url('?add=1&error=incomplete', '', '&') . '#errorh'); }
require_once '../admin/admin_begin.php'; define('TITLE', $LANG['administration']); require_once '../admin/admin_header.php'; if (!empty($_POST['valid'])) { $maintain_check = retrieve(POST, 'maintain_check', 0); switch ($maintain_check) { case 1: $maintain = retrieve(POST, 'maintain', 0); if ($maintain != -1) { $maintain = !empty($maintain) ? time() + $maintain + 5 : '0'; } break; case 2: $maintain = retrieve(POST, 'end', '', TSTRING_UNCHANGE); $maintain = strtotimestamp($maintain, $LANG['date_format_short']); break; default: $maintain = '0'; } $CONFIG['maintain_text'] = stripslashes(retrieve(POST, 'contents', '', TSTRING_PARSE)); $CONFIG['maintain_delay'] = retrieve(POST, 'display_delay', 0); $CONFIG['maintain_display_admin'] = retrieve(POST, 'maintain_display_admin', 0); $CONFIG['maintain'] = $maintain; $Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($CONFIG)) . "' WHERE name = 'config'", __LINE__, __FILE__); ###### Régénération du cache $CONFIG ####### $Cache->Generate_file('config'); redirect(HOST . SCRIPT); } else { $Template->set_filenames(array('admin_maintain' => 'admin/admin_maintain.tpl')); $array_time = array(-1, 60, 300, 600, 900, 1800, 3600, 7200, 10800, 14400, 18000, 21600, 25200, 28800, 57600);