source: temp/test-xoops.ec-cube.net/html/include/cp_header.php @ 405

Revision 405, 1.5 KB checked in by root, 20 years ago (diff)
Line 
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 
8include_once '../../../mainfile.php';
9include_once XOOPS_ROOT_PATH . "/include/cp_functions.php";
10$moduleperm_handler = & xoops_gethandler( 'groupperm' );
11if ( $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
26if ( $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
32if ( file_exists( "../language/" . $xoopsConfig['language'] . "/admin.php" ) ) {
33    include "../language/" . $xoopsConfig['language'] . "/admin.php";
34}
35elseif ( file_exists( "../language/english/admin.php" ) ) {
36    include "../language/english/admin.php";
37}
38?>
Note: See TracBrowser for help on using the repository browser.