if ($file_size > 1) { $size_tpl = $file_size . ' ' . $LANG['unit_megabytes']; } elseif ($file_size > 0) { $size_tpl = $file_size * 1024 . ' ' . $LANG['unit_kilobytes']; } else { $size_tpl = $DOWNLOAD_LANG['unknown_size']; } $creation_calendar = new MiniCalendar('creation'); $creation_calendar->set_date($file_creation_date); $release_calendar = new MiniCalendar('release_date'); $release_calendar->set_date($file_release_date); if ($file_visibility < 0 || $file_visibility > 2) { $file_visibility = 0; } $Template->assign_vars(array('C_DISPLAY_DOWNLOAD' => true, 'C_IMG' => !empty($file_image), 'C_EDIT_AUTH' => false, 'MODULE_DATA_PATH' => $Template->get_module_data_path('download'), 'NAME' => stripslashes($file_title), 'CONTENTS' => second_parse(stripslashes(strparse($file_contents))), 'CREATION_DATE' => $file_creation_date->format(DATE_FORMAT_SHORT), 'RELEASE_DATE' => $file_release_date->get_timestamp() > 0 ? $file_release_date->format(DATE_FORMAT_SHORT) : $DOWNLOAD_LANG['unknown_date'], 'SIZE' => $size_tpl, 'COUNT' => $file_hits, 'THEME' => get_utheme(), 'HITS' => sprintf($DOWNLOAD_LANG['n_times'], (int) $file_hits), 'NUM_NOTES' => sprintf($DOWNLOAD_LANG['num_notes'], 0), 'U_IMG' => $file_image, 'IMAGE_ALT' => str_replace('"', '\\"', $file_title), 'LANG' => get_ulang(), 'FORCE_DOWNLOAD_SELECTED' => $file_download_method == 'force_download' ? ' selected="selected"' : '', 'REDIRECTION_SELECTED' => $file_download_method != 'force_download' ? ' selected="selected"' : '', 'L_DATE' => $LANG['date'], 'L_SIZE' => $LANG['size'], 'L_DOWNLOAD' => $DOWNLOAD_LANG['download'], 'L_DOWNLOAD_FILE' => $DOWNLOAD_LANG['download_file'], 'L_FILE_INFOS' => $DOWNLOAD_LANG['file_infos'], 'L_INSERTION_DATE' => $DOWNLOAD_LANG['insertion_date'], 'L_RELEASE_DATE' => $DOWNLOAD_LANG['release_date'], 'L_DOWNLOADED' => $DOWNLOAD_LANG['downloaded'], 'L_NOTE' => $LANG['note'], 'U_DOWNLOAD_FILE' => url('count.php?id=' . $edit_file_id, 'file-' . $edit_file_id . '+' . url_encode_rewrite($file_title) . '.php'))); $Template->assign_vars(array('C_CONTRIBUTION' => false, 'TITLE' => stripslashes($file_title), 'COUNT' => $file_hits, 'DESCRIPTION' => htmlspecialchars(stripslashes($file_contents), ENT_COMPAT, 'ISO-8859-1'), 'SHORT_DESCRIPTION' => htmlspecialchars(stripslashes($file_short_contents), ENT_COMPAT, 'ISO-8859-1'), 'FILE_IMAGE' => $file_image, 'URL' => $file_url, 'SIZE_FORM' => $file_size, 'DATE' => $file_creation_date->format(DATE_FORMAT_SHORT, TIMEZONE_AUTO), 'CATEGORIES_TREE' => $download_categories->build_select_form($file_cat_id, 'idcat', 'idcat', 0, DOWNLOAD_WRITE_CAT_AUTH_BIT, $CONFIG_DOWNLOAD['global_auth'], IGNORE_AND_CONTINUE_BROWSING_IF_A_CATEGORY_DOES_NOT_MATCH), 'SHORT_DESCRIPTION_PREVIEW' => second_parse(stripslashes(strparse($file_short_contents))), 'VISIBLE_WAITING' => $file_visibility == 2 ? ' checked="checked"' : '', 'VISIBLE_ENABLED' => $file_visibility == 1 ? ' checked="checked"' : '', 'VISIBLE_HIDDEN' => $file_visibility == 0 ? ' checked="checked"' : '', 'APPROVED' => $file_approved ? ' checked="checked"' : '', 'DATE_CALENDAR_CREATION' => $creation_calendar->display(), 'DATE_CALENDAR_RELEASE' => $release_calendar->display(), 'BOOL_IGNORE_RELEASE_DATE' => $ignore_release_date ? 'true' : 'false', 'STYLE_FIELD_RELEASE_DATE' => $ignore_release_date ? 'none' : 'block', 'IGNORE_RELEASE_DATE_CHECKED' => $ignore_release_date ? ' checked="checked"' : '', 'BEGINING_CALENDAR' => $begining_calendar->display(), 'END_CALENDAR' => $end_calendar->display())); } else { $file_creation_date = new Date(DATE_TIMESTAMP, TIMEZONE_AUTO, $file_infos['timestamp']); $file_release_date = new Date(DATE_TIMESTAMP, TIMEZONE_AUTO, $file_infos['release_timestamp']); $creation_calendar = new MiniCalendar('creation'); $creation_calendar->set_date($file_creation_date); $release_calendar = new MiniCalendar('release_date'); $ignore_release_date = $file_release_date->get_timestamp() == 0; if (!$ignore_release_date) { $release_calendar->set_date($file_release_date); } $begining_calendar = new MiniCalendar('begining_date'); $end_calendar = new MiniCalendar('end_date'); $end_calendar->set_style('margin-left:150px;'); if (!empty($file_infos['start']) && !empty($file_infos['end'])) { $file_visibility = 2;
$id_edit = retrieve(GET, 'edit', 0); $new_cat = !empty($_GET['new']) ? true : false; $error = retrieve(GET, 'error', ''); if ($id_up > 0) { $download_categories->move($id_up, MOVE_CATEGORY_UP); import('content/syndication/feed'); Feed::clear_cache('download'); redirect(url('admin_download_cat.php')); } elseif ($id_down > 0) { $download_categories->move($id_down, MOVE_CATEGORY_DOWN); import('content/syndication/feed'); Feed::clear_cache('download'); redirect(url('admin_download_cat.php')); } elseif ($cat_to_del > 0) { $Template->set_filenames(array('admin_download_cat_remove' => 'download/admin_download_cat_remove.tpl')); $Template->assign_vars(array('CATEGORY_TREE' => $download_categories->build_select_form(0, 'id_parent', 'id_parent', $cat_to_del), 'IDCAT' => $cat_to_del, 'L_REMOVING_CATEGORY' => $DOWNLOAD_LANG['removing_category'], 'L_EXPLAIN_REMOVING' => $DOWNLOAD_LANG['explain_removing_category'], 'L_DELETE_CATEGORY_AND_CONTENT' => $DOWNLOAD_LANG['delete_category_and_its_content'], 'L_MOVE_CONTENT' => $DOWNLOAD_LANG['move_category_content'], 'L_SUBMIT' => $LANG['delete'], 'U_FORM_TARGET' => HOST . DIR . url('/download/admin_download_cat.php?token=' . $Session->get_token()))); include_once 'admin_download_menu.php'; $Template->pparse('admin_download_cat_remove'); } elseif (retrieve(POST, 'submit', false)) { $error_string = 'e_success'; if ($cat_to_del_post > 0) { $action = retrieve(POST, 'action', ''); $delete_content = $action != 'move'; $id_parent = retrieve(POST, 'id_parent', 0); if ($delete_content) { $download_categories->Delete_category_recursively($cat_to_del_post); } else { $download_categories->Delete_category_and_move_content($cat_to_del_post, $id_parent); } import('content/syndication/feed'); Feed::clear_cache('download');