2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 08/27/2004 *
4 * =================== Last change: 08/27/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-config_mods.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Module configuration *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Modul-Konfiguration *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 if (isFormSent('edit')) {
47 // Check if at least one module is selected
48 if (ifPostContainsSelections()) {
52 // Edit selected modules
53 foreach (postRequestParameter('sel') as $id => $sel) {
55 // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function
56 $result = SQL_QUERY_ESC("SELECT `id`, `module`, `title`, `locked`, `hidden`, `admin_only`, `mem_only` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `id`=%s LIMIT 1",
57 array(bigintval($id)), __FILE__, __LINE__);
60 $content = SQL_FETCHARRAY($result);
63 SQL_FREERESULT($result);
65 // Prepare array for the template
66 $content['locked'] = addSelectionBox('yn', $content['locked'] , 'locked', $id);
67 $content['hidden'] = addSelectionBox('yn', $content['hidden'] , 'hidden', $id);
68 $content['admin_only'] = addSelectionBox('yn', $content['admin_only'], 'admin' , $id);
69 $content['mem_only'] = addSelectionBox('yn', $content['mem_only'] , 'member', $id);
72 $OUT .= loadTemplate('admin_edit_mods_row', true, $content);
76 loadTemplate('admin_edit_mods', false, $OUT);
79 displayMessage('{--ADMIN_MODS_NOTHING_SELECTED--}');
81 // Remove maybe confusing data
82 unsetPostRequestParameter('edit');
83 unsetPostRequestParameter('change');
85 } elseif (isFormSent('change')) {
90 foreach (postRequestParameter('sel') as $id => $sel) {
95 addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `title`='%s', `locked`='%s', `hidden`='%s', `admin_only`='%s', `mem_only`='%s' WHERE `id`=%s LIMIT 1",
97 postRequestParameter('title', $id),
98 postRequestParameter('locked', $id),
99 postRequestParameter('hidden', $id),
100 postRequestParameter('admin', $id),
101 postRequestParameter('member', $id),
103 ), __FILE__, __LINE__, false));
107 runFilterChain('run_sqls');
109 // Remove cache file if version matches
110 if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
111 if ($GLOBALS['cache_instance']->loadCacheFile('modules')) $GLOBALS['cache_instance']->removeCacheFile();
115 displayMessage('{--ADMIN_MODS_CHANGED--}');
118 if (!ifPostContainsSelections()) {
119 // Load module data (We do not need to check if there's at least one...)
120 $result = SQL_QUERY('SELECT
121 `id`, `module`, `locked`, `hidden`, `admin_only`, `title`, `mem_only`
123 `{?_MYSQL_PREFIX?}_mod_reg`
125 `module` ASC', __FILE__, __LINE__);
128 while ($content = SQL_FETCHARRAY($result)) {
129 // Reset title to --- if it is NULL
130 if (($content['module'] == 'index') || ($content['module'] == 'login')) {
131 // Add link to detail statistics
132 $content['module'] = '<strong><a href="{%url=modules.php?module=admin&what=stats_mods&mod=' . $content['module'] . '%}">' . $content['module'] . '</a></strong>';
136 $OUT .= loadTemplate('admin_list_mods_row', true, $content);
140 SQL_FREERESULT($result);
142 // Load main template
143 loadTemplate('admin_list_mods', false, $OUT);