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 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
47 if (isPostRequestElementSet('edit')) {
48 // Check if at least one module is selected
49 if (countPostSelection() > 0) {
53 // Edit selected modules
54 foreach (postRequestElement('sel') as $id => $sel) {
56 $result = SQL_QUERY_ESC("SELECT module, title, locked, hidden, admin_only, mem_only FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `id`=%s LIMIT 1",
57 array(bigintval($id)), __FILE__, __LINE__);
58 list($mod, $title, $locked, $hidden, $admin, $mem) = SQL_FETCHROW($result);
59 SQL_FREERESULT($result);
61 // Prepare array for the template
67 'locked' => addSelectionBox('yn', $locked, 'locked', $id),
68 'hidden' => addSelectionBox('yn', $hidden, 'hidden', $id),
69 'admin' => addSelectionBox('yn', $admin , 'admin' , $id),
70 'mem' => addSelectionBox('yn', $mem , 'member', $id),
74 $OUT .= loadTemplate('admin_mods_edit_row', true, $content);
78 loadTemplate('admin_mods_edit', false, $OUT);
81 loadTemplate('admin_settings_saved', false, getMessage('MODS_NOTHING_SELECTED'));
83 // Remove maybe confusing data
84 unsetPostRequestElement('edit');
85 unsetPostRequestElement('change');
87 } elseif (isPostRequestElementSet('change')) {
92 foreach (postRequestElement('sel') as $id => $sel) {
97 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",
99 postRequestElement('title', $id),
100 postRequestElement('locked', $id),
101 postRequestElement('hidden', $id),
102 postRequestElement('admin', $id),
103 postRequestElement('member', $id),
105 ), __FILE__, __LINE__, false));
109 runFilterChain('run_sqls');
111 // Remove cache file if version matches
112 if (getExtensionVersion('cache') >= '0.1.2') {
113 if ($GLOBALS['cache_instance']->loadCacheFile('modules')) $GLOBALS['cache_instance']->removeCacheFile();
117 loadTemplate('admin_settings_saved', false, getMessage('MODS_CHANGED'));
120 if (countPostSelection() == '0') {
121 // Load module data (We do not need to check if there's at least one...)
122 $result = SQL_QUERY('SELECT id, module, locked, hidden, admin_only, title, mem_only
123 FROM `{?_MYSQL_PREFIX?}_mod_reg`
124 ORDER BY module', __FILE__, __LINE__);
126 while ($content = SQL_FETCHARRAY($result)) {
127 // Reset title to --- if it is NULL
128 if (empty($content['title'])) $content['title'] = '---';
129 if (($content['module'] == 'index') || ($content['module'] == 'login')) {
130 // Add link to detail statistics
131 $content['module'] = "<strong><a href=\"{?URL?}/modules.php?module=admin&what=stats_mods&mod=".$content['module']."\">".$content['module']."</a></strong>";
134 // Prepare array for the template
135 // @TODO Rewritings: mod->module in template
138 'id' => $content['id'],
139 'mod' => $content['module'],
140 'title' => $content['title'],
141 'locked' => translateYesNo($content['locked']),
142 'hidden' => translateYesNo($content['hidden']),
143 'admin' => translateYesNo($content['admin_only']),
144 'mem' => translateYesNo($content['mem_only']),
148 $OUT .= loadTemplate('admin_list_mods_row', true, $content);
155 SQL_FREERESULT($result);
157 // Load main template
158 loadTemplate('admin_list_mods', false, $OUT);