2 /************************************************************************
3 * MXChange v0.2.1 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 - 2008 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')) || (!IS_ADMIN())) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
45 // Add description as navigation point
46 ADD_DESCR('admin', __FILE__);
49 if (REQUEST_ISSET_POST('edit')) {
50 // Check if at least one module is selected
51 $SEL = countPostSelection();
56 // Edit selected modules
57 foreach (REQUEST_POST('sel') as $id => $sel) {
59 $result = SQL_QUERY_ESC("SELECT module, title, locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `id`=%s LIMIT 1",
60 array(bigintval($id)), __FILE__, __LINE__);
61 list($mod, $title, $locked, $hidden, $admin, $mem) = SQL_FETCHROW($result);
62 SQL_FREERESULT($result);
64 // Prepare array for the template
70 'locked' => ADD_SELECTION('yn', $locked, 'locked', $id),
71 'hidden' => ADD_SELECTION('yn', $hidden, 'hidden', $id),
72 'admin' => ADD_SELECTION('yn', $admin , 'admin' , $id),
73 'mem' => ADD_SELECTION('yn', $mem , 'member', $id),
77 $OUT .= LOAD_TEMPLATE('admin_mods_edit_row', true, $content);
79 define('__MODS_ROWS', $OUT);
82 LOAD_TEMPLATE('admin_mods_edit');
85 LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MODS_NOTHING_SELECTED'));
87 // Remove maybe confusing data
88 REQUEST_UNSET_POST('edit');
89 REQUEST_UNSET_POST('change');
91 } elseif (REQUEST_ISSET_POST('change')) {
96 foreach (REQUEST_POST('sel') as $id => $sel) {
101 ADD_SQL(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",
103 REQUEST_POST('title', $id),
104 REQUEST_POST('locked', $id),
105 REQUEST_POST('hidden', $id),
106 REQUEST_POST('admin', $id),
107 REQUEST_POST('member', $id),
109 ), __FILE__, __LINE__, false));
113 runFilterChain('run_sqls');
115 // Remove cache file if version matches
116 if (GET_EXT_VERSION('cache') >= '0.1.2') {
117 if ($GLOBALS['cache_instance']->loadCacheFile('modreg')) $GLOBALS['cache_instance']->destroyCacheFile();
121 LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MODS_CHANGED'));
125 // Load module data (We do not need to check if there's at least one...)
126 $result = SQL_QUERY('SELECT id, module, locked, hidden, admin_only, title, mem_only
127 FROM `{!_MYSQL_PREFIX!}_mod_reg`
128 ORDER BY module', __FILE__, __LINE__);
130 while ($content = SQL_FETCHARRAY($result)) {
131 // Reset title to --- if it is NULL
132 if (empty($content['title'])) $content['title'] = '---';
133 if (($content['module'] == 'index') || ($content['module'] == 'login')) {
134 // Add link to detail statistics
135 $content['module'] = "<strong><a href=\"{!URL!}/modules.php?module=admin&what=stats_mods&mod=".$content['module']."\">".$content['module']."</a></strong>";
138 // Prepare array for the template
139 // @TODO Rewritings: mod->module in template
142 'id' => $content['id'],
143 'mod' => $content['module'],
144 'title' => $content['title'],
145 'locked' => translateYesNo($content['locked']),
146 'hidden' => translateYesNo($content['hidden']),
147 'admin' => translateYesNo($content['admin_only']),
148 'mem' => translateYesNo($content['mem_only']),
152 $OUT .= LOAD_TEMPLATE('admin_mods_list_row', true, $content);
159 SQL_FREERESULT($result);
161 // @TODO Rewrite this constant
162 define('__MODS_ROWS', $OUT);
164 // Load main template
165 LOAD_TEMPLATE('admin_mods_list');