1
+ <?php
2
+ // $Id: admin.php,v 1.3 2005/08/16 15:39:45 fx2024 Exp $
3
+ // ------------------------------------------------------------------------ //
4
+ // XOOPS - PHP Content Management System //
5
+ // Copyright (c) 2000 XOOPS.org //
6
+ // <http://www.xoops.org/> //
7
+ // ------------------------------------------------------------------------ //
8
+ // This program is free software; you can redistribute it and/or modify //
9
+ // it under the terms of the GNU General Public License as published by //
10
+ // the Free Software Foundation; either version 2 of the License, or //
11
+ // (at your option) any later version. //
12
+ // //
13
+ // You may not change or alter any portion of this comment or credits //
14
+ // of supporting developers from this source code or any supporting //
15
+ // source code which is considered copyrighted (c) material of the //
16
+ // original comment or credit authors. //
17
+ // //
18
+ // This program is distributed in the hope that it will be useful, //
19
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of //
20
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21
+ // GNU General Public License for more details. //
22
+ // //
23
+ // You should have received a copy of the GNU General Public License //
24
+ // along with this program; if not, write to the Free Software //
25
+ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
26
+ // ------------------------------------------------------------------------ //
27
+ // Author: Kazumi Ono (AKA onokazu) //
28
+ // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
29
+ // Project: The XOOPS Project //
30
+ // ------------------------------------------------------------------------- //
31
+ if (!defined ("XOOPS_ROOT_PATH " )) {
32
+ die ("XOOPS root path not defined " );
33
+ }
34
+
35
+ if (isset ($ HTTP_POST_VARS ['fct ' ])) {
36
+ $ fct = trim ($ HTTP_POST_VARS ['fct ' ]);
37
+ }
38
+ if (isset ($ HTTP_GET_VARS ['fct ' ])) {
39
+ $ fct = trim ($ HTTP_GET_VARS ['fct ' ]);
40
+ }
41
+ if (empty ($ fct )) $ fct = 'preferences ' ;
42
+ include "../../../mainfile.php " ;
43
+ include XOOPS_ROOT_PATH ."/include/cp_functions.php " ;
44
+
45
+ include_once XOOPS_ROOT_PATH ."/kernel/module.php " ;
46
+
47
+ $ admintest = 0 ;
48
+
49
+ if (is_object ($ xoopsUser )) {
50
+ $ xoopsModule =& XoopsModule::getByDirname ("system " );
51
+ if ( !$ xoopsUser ->isAdmin ($ xoopsModule ->mid ()) ) {
52
+ redirect_header (XOOPS_URL .'/user.php ' ,3 ,_NOPERM );
53
+ exit ();
54
+ }
55
+ $ admintest =1 ;
56
+ } else {
57
+ redirect_header (XOOPS_URL .'/user.php ' ,3 ,_NOPERM );
58
+ exit ();
59
+ }
60
+
61
+ // include system category definitions
62
+ include_once XOOPS_ROOT_PATH ."/modules/system/constants.php " ;
63
+ $ error = false ;
64
+ if ($ admintest != 0 ) {
65
+ if (isset ($ fct ) && $ fct != '' ) {
66
+ if (file_exists (XOOPS_ROOT_PATH ."/modules/system/admin/ " .$ fct ."/xoops_version.php " )) {
67
+
68
+ include_once ( XOOPS_ROOT_PATH ."/modules/system/language/ " . $ xoopsConfig ['language ' ] . "/admin.php " ) ;
69
+
70
+ if (file_exists (XOOPS_ROOT_PATH ."/modules/system/language/ " .$ xoopsConfig ['language ' ]."/admin/ " .$ fct .".php " )) {
71
+ include XOOPS_ROOT_PATH ."/modules/system/language/ " .$ xoopsConfig ['language ' ]."/admin/ " .$ fct .".php " ;
72
+ } elseif (file_exists (XOOPS_ROOT_PATH ."/modules/system/language/english/admin/ " .$ fct .".php " )) {
73
+ include XOOPS_ROOT_PATH ."/modules/system/language/english/admin/ " .$ fct .".php " ;
74
+ }
75
+ include XOOPS_ROOT_PATH ."/modules/system/admin/ " .$ fct ."/xoops_version.php " ;
76
+ $ sysperm_handler =& xoops_gethandler ('groupperm ' );
77
+ $ category = !empty ($ modversion ['category ' ])? intval ($ modversion ['category ' ]) : 0 ;
78
+ unset($ modversion );
79
+ if ($ category > 0 ) {
80
+ $ groups =& $ xoopsUser ->getGroups ();
81
+ if (in_array (XOOPS_GROUP_ADMIN , $ groups ) || false != $ sysperm_handler ->checkRight ('system_admin ' , $ category , $ groups , $ xoopsModule ->getVar ('mid ' ))){
82
+ if (file_exists ("../include/ {$ fct }.inc.php " )) {
83
+ include_once "../include/ {$ fct }.inc.php " ;
84
+ } else {
85
+ $ error = true ;
86
+ }
87
+ } else {
88
+ $ error = true ;
89
+ }
90
+ } elseif ($ fct == 'version ' ) {
91
+ if (file_exists (XOOPS_ROOT_PATH ."/modules/system/admin/version/main.php " )) {
92
+ include_once XOOPS_ROOT_PATH ."/modules/system/admin/version/main.php " ;
93
+ } else {
94
+ $ error = true ;
95
+ }
96
+ } else {
97
+ $ error = true ;
98
+ }
99
+ } else {
100
+ $ error = true ;
101
+ }
102
+ } else {
103
+ $ error = true ;
104
+ }
105
+ }
106
+
107
+ if (false != $ error ) {
108
+ xoops_cp_header ();
109
+ echo "<h4>System Configuration</h4> " ;
110
+ echo '<table class="outer" cellpadding="4" cellspacing="1"> ' ;
111
+ echo '<tr> ' ;
112
+ $ groups = $ xoopsUser ->getGroups ();
113
+ $ all_ok = false ;
114
+ if (!in_array (XOOPS_GROUP_ADMIN , $ groups )) {
115
+ $ sysperm_handler =& xoops_gethandler ('groupperm ' );
116
+ $ ok_syscats =& $ sysperm_handler ->getItemIds ('system_admin ' , $ groups );
117
+ } else {
118
+ $ all_ok = true ;
119
+ }
120
+ $ admin_dir = XOOPS_ROOT_PATH ."/modules/system/admin " ;
121
+ $ handle = opendir ($ admin_dir );
122
+ $ counter = 0 ;
123
+ $ class = 'even ' ;
124
+ while ($ file = readdir ($ handle )) {
125
+ if (strtolower ($ file ) != 'cvs ' && !preg_match ("/[.]/ " , $ file ) && is_dir ($ admin_dir .'/ ' .$ file )) {
126
+ include $ admin_dir .'/ ' .$ file .'/xoops_version.php ' ;
127
+ if ($ modversion ['hasAdmin ' ]) {
128
+ $ category = isset ($ modversion ['category ' ])? intval ($ modversion ['category ' ]) : 0 ;
129
+ if (false != $ all_ok || in_array ($ modversion ['category ' ], $ ok_syscats )) {
130
+ echo "<td class=' $ class' align='center' valign='bottom' width='19%'> " ;
131
+ echo "<a href=' " .XOOPS_URL ."/modules/system/admin.php?fct= " .$ file ."'><b> " .trim ($ modversion ['name ' ])."</b></a> \n" ;
132
+ echo "</td> " ;
133
+ $ counter ++;
134
+ $ class = ($ class == 'even ' )? 'odd ' : 'even ' ;
135
+ }
136
+ if ( $ counter > 4 ) {
137
+ $ counter = 0 ;
138
+ echo "</tr> " ;
139
+ echo "<tr> " ;
140
+ }
141
+ }
142
+ unset($ modversion );
143
+ }
144
+ }
145
+ while ($ counter < 5 ) {
146
+ echo '<td class=" ' .$ class .'"> </td> ' ;
147
+ $ class = ($ class == 'even ' )? 'odd ' : 'even ' ;
148
+ $ counter ++;
149
+ }
150
+ echo '</tr></table> ' ;
151
+ xoops_cp_footer ();
152
+ }
153
+
154
+ ?>
0 commit comments