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 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
40 // Add description as navigation point
41 ADD_DESCR("admin", __FILE__);
44 if (REQUEST_ISSET_POST(('edit'))) {
45 // Check if at least one module is selected
46 $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
51 // Edit selected modules
52 foreach (REQUEST_POST('sel') as $id => $sel) {
54 $result = SQL_QUERY_ESC("SELECT module, title, locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE id=%s LIMIT 1",
55 array(bigintval($id)), __FILE__, __LINE__);
56 list($mod, $title, $locked, $hidden, $admin, $mem) = SQL_FETCHROW($result);
57 SQL_FREERESULT($result);
59 // Prepare array for the template
65 'locked' => ADD_SELECTION("yn", $locked, "locked", $id),
66 'hidden' => ADD_SELECTION("yn", $hidden, "hidden", $id),
67 'admin' => ADD_SELECTION("yn", $admin , "admin" , $id),
68 'mem' => ADD_SELECTION("yn", $mem , "member", $id),
72 $OUT .= LOAD_TEMPLATE("admin_mods_edit_row", true, $content);
74 define('__MODS_ROWS', $OUT);
77 LOAD_TEMPLATE("admin_mods_edit");
80 LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MODS_NOTHING_SELECTED'));
82 // Remove maybe confusing data
83 REQUEST_UNSET_POST(('edit'));
84 REQUEST_UNSET_POST(('change'));
86 } elseif (REQUEST_ISSET_POST(('change'))) {
88 foreach (REQUEST_POST('sel') as $id => $sel) {
93 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",
95 REQUEST_POST('title', $id),
96 REQUEST_POST('locked', $id),
97 REQUEST_POST('hidden', $id),
98 REQUEST_POST('admin', $id),
99 REQUEST_POST('member', $id),
101 ), __FILE__, __LINE__);
104 // Remove cache file if version matches
105 if (GET_EXT_VERSION("cache") >= "0.1.2") {
106 if ($GLOBALS['cache_instance']->loadCacheFile("mod_reg")) $GLOBALS['cache_instance']->destroyCacheFile();
110 LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MODS_CHANGED'));
114 // Load module data (We do not need to check if there's at least one...)
115 $result = SQL_QUERY("SELECT id, module, locked, hidden, admin_only, title, mem_only, clicks
116 FROM `{!_MYSQL_PREFIX!}_mod_reg`
117 ORDER BY module", __FILE__, __LINE__);
119 while (list($id, $mod, $locked, $hidden, $admin, $title, $mem) = SQL_FETCHROW($result)) {
120 // Reset title to --- if it is NULL
121 if (empty($title)) $title = "---";
122 if (($mod == "index") || ($mod == "login")) {
123 // Add link to detail statistics
124 $mod = "<strong><a href=\"{!URL!}/modules.php?module=admin&what=stats_mods&mod=".$mod."\">".$mod."</a></strong>";
127 // Prepare array for the template
133 'locked' => TRANSLATE_YESNO($locked),
134 'hidden' => TRANSLATE_YESNO($hidden),
135 'admin' => TRANSLATE_YESNO($admin),
136 'mem' => TRANSLATE_YESNO($mem),
140 $OUT .= LOAD_TEMPLATE("admin_mods_list_row", true, $content);
147 SQL_FREERESULT($result);
148 define('__MODS_ROWS', $OUT);
150 // Load main template
151 LOAD_TEMPLATE("admin_mods_list");