source: temp/test-xoops.ec-cube.net/html/modules/system/admin.php @ 405

Revision 405, 7.0 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: admin.php,v 1.3 2006/05/01 02:37:29 onokazu 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
32if (isset($_POST['fct'])) {
33    $fct = trim($_POST['fct']);
34}
35if (isset($_GET['fct'])) {
36    $fct = trim($_GET['fct']);
37}
38if (isset($fct) && $fct == "users") {
39    $xoopsOption['pagetype'] = "user";
40}
41include "../../mainfile.php";
42include XOOPS_ROOT_PATH."/include/cp_functions.php";
43if ( file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php") ) {
44    include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php";
45} else {
46    include XOOPS_ROOT_PATH."/modules/system/language/english/admin.php";
47}
48include_once XOOPS_ROOT_PATH."/class/xoopsmodule.php";
49
50$admintest = 0;
51
52if (is_object($xoopsUser)) {
53    $xoopsModule =& XoopsModule::getByDirname("system");
54    if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
55        redirect_header(XOOPS_URL."/",3,_NOPERM);
56        exit();
57    }
58    $admintest=1;
59} else {
60    redirect_header(XOOPS_URL."/",3,_NOPERM);
61    exit();
62}
63
64// include system category definitions
65include_once XOOPS_ROOT_PATH."/modules/system/constants.php";
66$error = false;
67if ($admintest != 0) {
68    if (isset($fct) && $fct != '') {
69        if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php")) {
70       
71            if (file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php")) {
72                include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php";
73            } elseif (file_exists(XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php")) {
74                include XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php";
75            }
76            include XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php";
77            $sysperm_handler =& xoops_gethandler('groupperm');
78            $category = !empty($modversion['category']) ? intval($modversion['category']) : 0;
79            unset($modversion);
80            if ($category > 0) {
81                $groups = $xoopsUser->getGroups();
82                if (in_array(XOOPS_GROUP_ADMIN, $groups) || false != $sysperm_handler->checkRight('system_admin', $category, $groups, $xoopsModule->getVar('mid'))){
83                    if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php")) {
84                        include_once XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php";
85                    } else {
86                        $error = true;
87                    }
88                } else {
89                    $error = true;
90                }
91            } elseif ($fct == 'version') {
92                if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/version/main.php")) {
93                    include_once XOOPS_ROOT_PATH."/modules/system/admin/version/main.php";
94                } else {
95                    $error = true;
96                }
97            } else {
98                $error = true;
99            }
100        } else {
101            $error = true;
102        }
103    } else {
104        $error = true;
105    }
106}
107
108if (false != $error) {
109    xoops_cp_header();
110    echo "<h4>System Configuration</h4>";
111    echo '<table class="outer" cellpadding="4" cellspacing="1">';
112    echo '<tr>';
113    $groups = $xoopsUser->getGroups();
114    $all_ok = false;
115    if (!in_array(XOOPS_GROUP_ADMIN, $groups)) {
116        $sysperm_handler =& xoops_gethandler('groupperm');
117        $ok_syscats = $sysperm_handler->getItemIds('system_admin', $groups);
118    } else {
119        $all_ok = true;
120    }
121    $admin_dir = XOOPS_ROOT_PATH."/modules/system/admin";
122    $handle = opendir($admin_dir);
123    $counter = 0;
124    $class = 'even';
125    while ($file = readdir($handle)) {
126        if (strtolower($file) != 'cvs' && !preg_match("/[.]/", $file) && is_dir($admin_dir.'/'.$file)) {
127            include $admin_dir.'/'.$file.'/xoops_version.php';
128            if ($modversion['hasAdmin']) {
129                $category = isset($modversion['category']) ? intval($modversion['category']) : 0;
130                if (false != $all_ok || in_array($modversion['category'], $ok_syscats)) {
131                    echo "<td class='$class' align='center' valign='bottom' width='19%'>";
132                    echo "<a href='".XOOPS_URL."/modules/system/admin.php?fct=".$file."'><b>" .trim($modversion['name'])."</b></a>\n";
133                    echo "</td>";
134                    $counter++;
135                    $class = ($class == 'even') ? 'odd' : 'even';
136                }
137                if ( $counter > 4 ) {
138                    $counter = 0;
139                    echo "</tr>";
140                    echo "<tr>";
141                }
142            }
143            unset($modversion);
144        }
145    }
146    while ($counter < 5) {
147        echo '<td class="'.$class.'">&nbsp;</td>';
148        $class = ($class == 'even') ? 'odd' : 'even';
149        $counter++;
150    }
151    echo '</tr></table>';
152    xoops_cp_footer();
153}
154
155?>
Note: See TracBrowser for help on using the repository browser.