]> git.mxchange.org Git - mailer.git/blob - inc/modules/admin/what-config_mods.php
Introduced template call-back function 'doTemplateAdminListUserTitle':
[mailer.git] / inc / modules / admin / what-config_mods.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 08/27/2004 *
4  * ===================                          Last change: 08/27/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_mods.php                             *
8  * -------------------------------------------------------------------- *
9  * Short description : Module configuration                             *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Modul-Konfiguration                              *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
40         die();
41 } // END - if
42
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
45
46 if (isFormSent('edit')) {
47         // Check if at least one module is selected
48         if (ifPostContainsSelections()) {
49                 // Output header
50                 $OUT = '';
51
52                 // Edit selected modules
53                 foreach (postRequestParameter('sel') as $id => $sel) {
54                         // Load module data
55                         // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function
56                         $result = SQL_QUERY_ESC("SELECT `id`, `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
59                         // Load data
60                         $content = SQL_FETCHARRAY($result);
61
62                         // Free result
63                         SQL_FREERESULT($result);
64
65                         // Prepare array for the template
66                         $content['locked']     = addSelectionBox('yn', $content['locked']    , 'locked', $id);
67                         $content['hidden']     = addSelectionBox('yn', $content['hidden']    , 'hidden', $id);
68                         $content['admin_only'] = addSelectionBox('yn', $content['admin_only'], 'admin' , $id);
69                         $content['mem_only']   = addSelectionBox('yn', $content['mem_only']  , 'member', $id);
70
71                         // Load row template
72                         $OUT .= loadTemplate('admin_edit_mods_row', true, $content);
73                 } // END - foreach
74
75                 // Load main template
76                 loadTemplate('admin_edit_mods', false, $OUT);
77         } else {
78                 // Nothing selected
79                 displayMessage('{--ADMIN_MODS_NOTHING_SELECTED--}');
80
81                 // Remove maybe confusing data
82                 unsetPostRequestParameter('edit');
83                 unsetPostRequestParameter('change');
84         }
85 } elseif (isFormSent('change')) {
86         // Init SQLs
87         initSqls();
88
89         // Change modules
90         foreach (postRequestParameter('sel') as $id => $sel) {
91                 // Secure id number
92                 $id = bigintval($id);
93
94                 // Update module
95                 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",
96                         array(
97                                 postRequestParameter('title', $id),
98                                 postRequestParameter('locked', $id),
99                                 postRequestParameter('hidden', $id),
100                                 postRequestParameter('admin', $id),
101                                 postRequestParameter('member', $id),
102                                 $id
103                         ),  __FILE__, __LINE__, false));
104         }
105
106         // Run all sqls
107         runFilterChain('run_sqls');
108
109         // Remove cache file if version matches
110         if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
111                 if ($GLOBALS['cache_instance']->loadCacheFile('modules')) $GLOBALS['cache_instance']->removeCacheFile();
112         } // END - if
113
114         // Entries updated
115         displayMessage('{--ADMIN_MODS_CHANGED--}');
116 }
117
118 if (!ifPostContainsSelections()) {
119         // Load module data (We do not need to check if there's at least one...)
120         $result = SQL_QUERY('SELECT
121         `id`, `module`, `locked`, `hidden`, `admin_only`, `title`, `mem_only`
122 FROM
123         `{?_MYSQL_PREFIX?}_mod_reg`
124 ORDER BY
125         `module` ASC', __FILE__, __LINE__);
126
127         $OUT = '';
128         while ($content = SQL_FETCHARRAY($result)) {
129                 // Reset title to --- if it is NULL
130                 if (($content['module'] == 'index') || ($content['module'] == 'login')) {
131                         // Add link to detail statistics
132                         $content['module'] = '<strong><a href="{%url=modules.php?module=admin&amp;what=stats_mods&amp;mod=' . $content['module'] . '%}">' . $content['module'] . '</a></strong>';
133                 } // END - if
134
135                 // Load row template
136                 $OUT .= loadTemplate('admin_list_mods_row', true, $content);
137         } // END - while
138
139         // Free memory
140         SQL_FREERESULT($result);
141
142         // Load main template
143         loadTemplate('admin_list_mods', false, $OUT);
144 } // END - if
145
146 // [EOF]
147 ?>