| // | Mod description : | // | Ce module est base sur le module existant pour le telechargement, | // | cette version permet le telechargement sur plusieurs pages. | // +-----------------------------------------------------------------------+ // | This program is free software; you can redistribute it and/or modify | // | it under the terms of the GNU General Public License as published by | // | the Free Software Foundation | // | | // | This program is distributed in the hope that it will be useful, but | // | WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | // | General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | // | USA. | // +-----------------------------------------------------------------------+ if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); check_status(ACCESS_ADMINISTRATOR); $DownloadMulti = get_plugin_data($plugin_id); global $template, $lang, $page; // Si le formulaire est posté // alors on écrit la configuration if (isset($_POST['downloadmulti_post_form']) == 1) { if (empty($_POST['downloadmulti_group'])) { array_push($page['errors'], $lang['dl_error_group_id']); } if (empty($_POST['downloadmulti_archive_size'])) { array_push($page['errors'], $lang['dl_error_file_size']); } if(preg_match('/[^0-9]/', $_POST['downloadmulti_archive_size'])) { array_push($page['errors'], $lang['dl_error_file_size_car']); } if(preg_match('/[^a-z0-9\-_]/', $_POST['downloadmulti_prefix'])) { array_push($page['errors'], $lang['dl_zip_prefix_car']); } if(preg_match('/[^a-z0-9\-_\[\]]/', $_POST['downloadmulti_pattern_name'])) { array_push($page['errors'], $lang['dl_zip_pattern_name_car']); } if (empty($_POST['downloadmulti_pattern_name'])) { array_push($page['errors'], $lang['dl_error_pattern_name']); } if(preg_match('/[^a-z0-9\-_]/', $_POST['downloadmulti_prefix_dir'])) { array_push($page['errors'], $lang['dl_zip_dir_prefix_car']); } // Si il n'y a pas d'erreurs if (count($page['errors']) == 0) { if(isset($_POST['downloadmulti_active_comment'])) { $downloadmulti_active_comment = 'on'; } else { $downloadmulti_active_comment = ''; } if(isset($_POST['downloadmulti_create_category'])) { $downloadmulti_create_category = 'on'; } else { $downloadmulti_create_category = ''; } $DownloadMulti->my_config['active_comment'] = $downloadmulti_active_comment; $DownloadMulti->my_config['comment'] = $_POST['downloadmulti_comment']; $DownloadMulti->my_config['group_id'] = $_POST['downloadmulti_group']; $DownloadMulti->my_config['archive_size'] = $_POST['downloadmulti_archive_size']; $DownloadMulti->my_config['prefix'] = $_POST['downloadmulti_prefix']; $DownloadMulti->my_config['prefix_dir'] = $_POST['downloadmulti_prefix_dir']; $DownloadMulti->my_config['pattern_name'] = $_POST['downloadmulti_pattern_name']; $DownloadMulti->my_config['select_dl'] = $_POST['downloadmulti_select_dl']; $DownloadMulti->my_config['create_category'] = $downloadmulti_create_category; $DownloadMulti->save_config(); array_push($page['infos'], $lang['dl_backup_config']); } } if(isset($DownloadMulti->my_config['active_comment'])) { $active_comment = $DownloadMulti->my_config['active_comment']; } if(isset($DownloadMulti->my_config['comment'])) { $comment = $DownloadMulti->my_config['comment']; } if(isset($DownloadMulti->my_config['archive_size'])) { $archive_size = $DownloadMulti->my_config['archive_size']; } if(isset($DownloadMulti->my_config['prefix'])) { $prefix = $DownloadMulti->my_config['prefix']; } if(isset($DownloadMulti->my_config['prefix_dir'])) { $prefix_dir = $DownloadMulti->my_config['prefix_dir']; } if(isset($DownloadMulti->my_config['pattern_name'])) { $pattern_name = $DownloadMulti->my_config['pattern_name']; } if(isset($DownloadMulti->my_config['select_dl'])) { $select_dl = $DownloadMulti->my_config['select_dl']; } if(isset($DownloadMulti->my_config['group_id'])) { $group_id = $DownloadMulti->my_config['group_id']; } if(isset($DownloadMulti->my_config['create_category'])) { $create_category = $DownloadMulti->my_config['create_category']; } if(!isset($active_comment)) { $active_comment = ''; } if(!isset($comment)) { $comment = ''; } if(!isset($archive_size)) { $archive_size = ''; } if(!isset($prefix)) { $prefix = ''; } if(!isset($prefix_dir)) { $prefix_dir = ''; } if(!isset($pattern_name)) { $pattern_name = ''; } if(!isset($select_dl)) { $select_dl = ''; } if(!isset($group_id)) { $group_id = ''; } if(!isset($create_category)) { $create_category = ''; } // +-----------------------------------------------------------------------+ // | template initialization // +-----------------------------------------------------------------------+ $template->set_filenames(array('plugin_admin_content' => $DownloadMulti->plugin_path.'template/admin.tpl')); if(!class_exists('zipArchive')) { array_push($page['errors'], $lang['dl_class_exist']); } $template->assign(array( 'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=plugin&section=download_multi%2Fadmin%2Fadmin.php', 'DOWNLOADMULTI_ACTIVECOMMENT' => $active_comment ? 'checked="checked"' : '', 'DOWNLOADMULTI_COMMENT' => $comment, 'DOWNLOADMULTI_ARCHIVE_SIZE' => $archive_size, 'DOWNLOADMULTI_PREFIX' => $prefix, 'DOWNLOADMULTI_PREFIX_DIR' => $prefix_dir, 'DOWNLOADMULTI_PATTERN_NAME' => $pattern_name, 'DOWNLOADMULTI_CREATECATEGORY' => $create_category ? 'checked="checked"' : '', )); // Gestion des groupes $query = ' SELECT id, name FROM '.$prefixeTable.'groups ORDER BY name ASC ;'; $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { $groupe_id[] = $row['id']; $groupe_name[] = $row['name']; } $template->assign('downloadmulti_group_id', $groupe_id); $template->assign('downloadmulti_group_name', $groupe_name); $template->assign('downloadmulti_group_select', $group_id); // Gestion des formats de téléchargement par défaut $template->assign('downloadmulti_select_dl', array( 'thumbnail' => $lang['dl_thumbnail'], 'normal' => $lang['dl_normal'], 'high' => $lang['dl_high'] ) ); $template->assign('select_dl', $select_dl); // Chargement de la configuration du serveur $DownloadMulti->DmServeurConfiguration(); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); ?>