| 1 | <?php |
|---|
| 2 | // $Id: admin.php,v 1.7 2003/04/11 13:00:53 okazu 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 | |
|---|
| 32 | $admin_mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; |
|---|
| 33 | |
|---|
| 34 | $fct = empty( $_POST['fct'] ) ? '' : trim( $_POST['fct'] ) ; |
|---|
| 35 | $fct = empty( $_GET['fct'] ) ? $fct : trim( $_GET['fct'] ) ; |
|---|
| 36 | if( empty( $fct ) ) $fct = 'preferences' ; |
|---|
| 37 | //if (isset($fct) && $fct == "users") { |
|---|
| 38 | // $xoopsOption['pagetype'] = "user"; |
|---|
| 39 | //} |
|---|
| 40 | include "../../../mainfile.php"; |
|---|
| 41 | // include "../../mainfile.php"; GIJ |
|---|
| 42 | include XOOPS_ROOT_PATH."/include/cp_functions.php"; |
|---|
| 43 | |
|---|
| 44 | include_once XOOPS_ROOT_PATH."/class/xoopsmodule.php"; |
|---|
| 45 | include_once "../include/gtickets.php" ;// GIJ |
|---|
| 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 | if ( file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php") ) { |
|---|
| 69 | include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php"; |
|---|
| 70 | } else { |
|---|
| 71 | include XOOPS_ROOT_PATH."/modules/system/language/english/admin.php"; |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | if (file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php")) { |
|---|
| 75 | include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php"; |
|---|
| 76 | } elseif (file_exists(XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php")) { |
|---|
| 77 | include XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php"; |
|---|
| 78 | } |
|---|
| 79 | include XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php"; |
|---|
| 80 | $sysperm_handler =& xoops_gethandler('groupperm'); |
|---|
| 81 | $category = !empty($modversion['category']) ? intval($modversion['category']) : 0; |
|---|
| 82 | unset($modversion); |
|---|
| 83 | if ($category > 0) { |
|---|
| 84 | $groups = $xoopsUser->getGroups(); |
|---|
| 85 | if (in_array(XOOPS_GROUP_ADMIN, $groups) || false != $sysperm_handler->checkRight('system_admin', $category, $groups, $xoopsModule->getVar('mid'))){ |
|---|
| 86 | // if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php")) { |
|---|
| 87 | // include_once XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php"; GIJ |
|---|
| 88 | if (file_exists("../include/{$fct}.inc.php")) { |
|---|
| 89 | include_once "../include/{$fct}.inc.php" ; |
|---|
| 90 | } else { |
|---|
| 91 | $error = true; |
|---|
| 92 | } |
|---|
| 93 | } else { |
|---|
| 94 | $error = true; |
|---|
| 95 | } |
|---|
| 96 | } elseif ($fct == 'version') { |
|---|
| 97 | if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/version/main.php")) { |
|---|
| 98 | include_once XOOPS_ROOT_PATH."/modules/system/admin/version/main.php"; |
|---|
| 99 | } else { |
|---|
| 100 | $error = true; |
|---|
| 101 | } |
|---|
| 102 | } else { |
|---|
| 103 | $error = true; |
|---|
| 104 | } |
|---|
| 105 | } else { |
|---|
| 106 | $error = true; |
|---|
| 107 | } |
|---|
| 108 | } else { |
|---|
| 109 | $error = true; |
|---|
| 110 | } |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | if (false != $error) { |
|---|
| 114 | xoops_cp_header(); |
|---|
| 115 | echo "<h4>System Configuration</h4>"; |
|---|
| 116 | echo '<table class="outer" cellpadding="4" cellspacing="1">'; |
|---|
| 117 | echo '<tr>'; |
|---|
| 118 | $groups = $xoopsUser->getGroups(); |
|---|
| 119 | $all_ok = false; |
|---|
| 120 | if (!in_array(XOOPS_GROUP_ADMIN, $groups)) { |
|---|
| 121 | $sysperm_handler =& xoops_gethandler('groupperm'); |
|---|
| 122 | $ok_syscats = $sysperm_handler->getItemIds('system_admin', $groups); |
|---|
| 123 | } else { |
|---|
| 124 | $all_ok = true; |
|---|
| 125 | } |
|---|
| 126 | $admin_dir = XOOPS_ROOT_PATH."/modules/system/admin"; |
|---|
| 127 | $handle = opendir($admin_dir); |
|---|
| 128 | $counter = 0; |
|---|
| 129 | $class = 'even'; |
|---|
| 130 | while ($file = readdir($handle)) { |
|---|
| 131 | if (strtolower($file) != 'cvs' && !preg_match("/[.]/", $file) && is_dir($admin_dir.'/'.$file)) { |
|---|
| 132 | include $admin_dir.'/'.$file.'/xoops_version.php'; |
|---|
| 133 | if ($modversion['hasAdmin']) { |
|---|
| 134 | $category = isset($modversion['category']) ? intval($modversion['category']) : 0; |
|---|
| 135 | if (false != $all_ok || in_array($modversion['category'], $ok_syscats)) { |
|---|
| 136 | echo "<td class='$class' align='center' valign='bottom' width='19%'>"; |
|---|
| 137 | echo "<a href='".XOOPS_URL."/modules/system/admin.php?fct=".$file."'><b>" .trim($modversion['name'])."</b></a>\n"; |
|---|
| 138 | echo "</td>"; |
|---|
| 139 | $counter++; |
|---|
| 140 | $class = ($class == 'even') ? 'odd' : 'even'; |
|---|
| 141 | } |
|---|
| 142 | if ( $counter > 4 ) { |
|---|
| 143 | $counter = 0; |
|---|
| 144 | echo "</tr>"; |
|---|
| 145 | echo "<tr>"; |
|---|
| 146 | } |
|---|
| 147 | } |
|---|
| 148 | unset($modversion); |
|---|
| 149 | } |
|---|
| 150 | } |
|---|
| 151 | while ($counter < 5) { |
|---|
| 152 | echo '<td class="'.$class.'"> </td>'; |
|---|
| 153 | $class = ($class == 'even') ? 'odd' : 'even'; |
|---|
| 154 | $counter++; |
|---|
| 155 | } |
|---|
| 156 | echo '</tr></table>'; |
|---|
| 157 | xoops_cp_footer(); |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | ?> |
|---|