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 (isset($_POST['edit']))
46 // Check if at least one module is selected
47 $SEL = SELECTION_COUNT($_POST['sel']);
53 // Edit selected modules
54 foreach ($_POST['sel'] as $id => $sel)
57 $result = SQL_QUERY_ESC("SELECT module, title, locked, hidden, admin_only, mem_only FROM "._MYSQL_PREFIX."_mod_reg WHERE id=%s LIMIT 1",
58 array(bigintval($id)), __FILE__, __LINE__);
59 list($mod, $title, $locked, $hidden, $admin, $mem) = SQL_FETCHROW($result);
60 SQL_FREERESULT($result);
62 // Prepare array for the template
68 'locked' => ADD_SELECTION("yn", $locked, "locked", $id),
69 'hidden' => ADD_SELECTION("yn", $hidden, "hidden", $id),
70 'admin' => ADD_SELECTION("yn", $admin , "admin" , $id),
71 'mem' => ADD_SELECTION("yn", $mem , "member", $id),
75 $OUT .= LOAD_TEMPLATE("admin_mods_edit_row", true, $content);
77 define('__MODS_ROWS', $OUT);
80 LOAD_TEMPLATE("admin_mods_edit");
85 LOAD_TEMPLATE("admin_settings_saved", false, MODS_NOTHING_SELECTED);
86 OUTPUT_HTML("<br />");
88 // Remove maybe confusing data
89 unset($_POST['edit']);
90 unset($_POST['change']);
93 elseif (isset($_POST['change']))
96 foreach ($_POST['sel'] as $id => $sel)
102 $result = 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 array($_POST['title'][$id], $_POST['locked'][$id], $_POST['hidden'][$id], $_POST['admin'][$id], $_POST['member'][$id], $id), __FILE__, __LINE__);
106 // Remove cache file if version matches
107 if (GET_EXT_VERSION("cache") >= "0.1.2")
109 if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
113 LOAD_TEMPLATE("admin_settings_saved", false, MODS_CHANGED);
114 OUTPUT_HTML("<br />");
119 // Load module data (We do not need to check if there's at least one...)
120 $result = SQL_QUERY("SELECT id, module, locked, hidden, admin_only, title, mem_only, clicks
121 FROM "._MYSQL_PREFIX."_mod_reg
122 ORDER BY module", __FILE__, __LINE__);
124 while (list($id, $mod, $locked, $hidden, $admin, $title, $mem) = SQL_FETCHROW($result))
126 // Reset title to --- if it is NULL
127 if (empty($title)) $title = "---";
128 if (($mod == "index") || ($mod == "login"))
130 // Add link to detail statistics
131 $mod = "<STRONG><A href=\"".URL."/modules.php?module=admin&what=stats_mods&mod=".$mod."\">".$mod."</A></STRONG>";
134 // Prepare array for the template
140 'locked' => TRANSLATE_YESNO($locked),
141 'hidden' => TRANSLATE_YESNO($hidden),
142 'admin' => TRANSLATE_YESNO($admin),
143 'mem' => TRANSLATE_YESNO($mem),
147 $OUT .= LOAD_TEMPLATE("admin_mods_list_row", true, $content);
154 SQL_FREERESULT($result);
155 define('__MODS_ROWS', $OUT);
157 // Load main template
158 LOAD_TEMPLATE("admin_mods_list");