| 1 | <?php |
|---|
| 2 | // $Id: cp_header.php,v 1.2 2005/03/18 12:51:55 onokazu Exp $ |
|---|
| 3 | /** |
|---|
| 4 | * module files can include this file for admin authorization |
|---|
| 5 | * the file that will include this file must be located under xoops_url/modules/module_directory_name/admin_directory_name/ |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | include_once '../../../mainfile.php'; |
|---|
| 9 | include_once XOOPS_ROOT_PATH . "/include/cp_functions.php"; |
|---|
| 10 | $moduleperm_handler = & xoops_gethandler( 'groupperm' ); |
|---|
| 11 | if ( $xoopsUser ) { |
|---|
| 12 | $url_arr = explode('/',strstr($xoopsRequestUri,'/modules/')); |
|---|
| 13 | $module_handler =& xoops_gethandler('module'); |
|---|
| 14 | $xoopsModule =& $module_handler->getByDirname($url_arr[2]); |
|---|
| 15 | unset($url_arr); |
|---|
| 16 | |
|---|
| 17 | if ( !$moduleperm_handler->checkRight( 'module_admin', $xoopsModule->getVar( 'mid' ), $xoopsUser->getGroups() ) ) { |
|---|
| 18 | redirect_header( XOOPS_URL . "/user.php", 1, _NOPERM ); |
|---|
| 19 | exit(); |
|---|
| 20 | } |
|---|
| 21 | } else { |
|---|
| 22 | redirect_header( XOOPS_URL . "/user.php", 1, _NOPERM ); |
|---|
| 23 | exit(); |
|---|
| 24 | } |
|---|
| 25 | // set config values for this module |
|---|
| 26 | if ( $xoopsModule->getVar( 'hasconfig' ) == 1 || $xoopsModule->getVar( 'hascomments' ) == 1 ) { |
|---|
| 27 | $config_handler = & xoops_gethandler( 'config' ); |
|---|
| 28 | $xoopsModuleConfig = & $config_handler->getConfigsByCat( 0, $xoopsModule->getVar( 'mid' ) ); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | // include the default language file for the admin interface |
|---|
| 32 | if ( file_exists( "../language/" . $xoopsConfig['language'] . "/admin.php" ) ) { |
|---|
| 33 | include "../language/" . $xoopsConfig['language'] . "/admin.php"; |
|---|
| 34 | } |
|---|
| 35 | elseif ( file_exists( "../language/english/admin.php" ) ) { |
|---|
| 36 | include "../language/english/admin.php"; |
|---|
| 37 | } |
|---|
| 38 | ?> |
|---|