2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 11/24/2012 *
4 * =================== Last change: 11/24/2012 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_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 - 2015 by Mailer Developer Team *
20 * For more information visit: http://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 (postRequestElement('sel') as $id => $sel) {
55 // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function
56 $result = sqlQueryEscaped('SELECT
64 `{?_MYSQL_PREFIX?}_mod_reg`
68 array(bigintval($id)), __FILE__, __LINE__);
71 $content = sqlFetchArray($result);
74 sqlFreeResult($result);
76 // Prepare array for the template
77 $content['locked'] = addSelectionBox('yn', $content['locked'] , 'locked', $id);
78 $content['admin_only'] = addSelectionBox('yn', $content['admin_only'], 'admin' , $id);
79 $content['mem_only'] = addSelectionBox('yn', $content['mem_only'] , 'member', $id);
82 $OUT .= loadTemplate('admin_edit_mods_row', TRUE, $content);
86 loadTemplate('admin_edit_mods', FALSE, $OUT);
89 displayMessage('{--ADMIN_MODS_NOTHING_SELECTED--}');
91 // Remove maybe confusing data
92 unsetPostRequestElement('edit');
93 unsetPostRequestElement('do_edit');
95 } elseif (isFormSent('do_edit')) {
100 foreach (postRequestElement('sel') as $id => $sel) {
102 $id = bigintval($id);
105 addSql(sqlQueryEscaped("UPDATE
106 `{?_MYSQL_PREFIX?}_mod_reg`
116 postRequestElement('title', $id),
117 postRequestElement('locked', $id),
118 postRequestElement('admin', $id),
119 postRequestElement('member', $id),
121 ), __FILE__, __LINE__, FALSE));
125 runFilterChain('run_sqls');
127 // Remove cache file if version matches
128 rebuildCache('modules', 'modules');
131 displayMessage('{--ADMIN_MODS_CHANGED--}');
134 if (!ifPostContainsSelections()) {
135 // Load module data (We do not need to check if there's at least one...)
136 $result = sqlQuery('SELECT
144 `{?_MYSQL_PREFIX?}_mod_reg`
146 `module` ASC', __FILE__, __LINE__);
149 while ($content = sqlFetchArray($result)) {
150 // Reset title to --- if it is NULL
151 if (($content['module'] == 'index') || ($content['module'] == 'login')) {
152 // Add link to detail statistics
153 $content['module'] = '<strong><a href="{%url=modules.php?module=admin&what=stats_mods&mod=' . $content['module'] . '%}">' . $content['module'] . '</a></strong>';
157 $OUT .= loadTemplate('admin_list_mods_row', TRUE, $content);
161 sqlFreeResult($result);
163 // Load main template
164 loadTemplate('admin_list_mods', FALSE, $OUT);