home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / include / cp_header.php < prev    next >
Encoding:
PHP Script  |  2006-05-27  |  1.6 KB  |  39 lines

  1. <?php 
  2. // $Id: cp_header.php 506 2006-05-26 23:10:37Z skalpa $
  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. //error_reporting(0);
  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.  
  26. // set config values for this module
  27. if ( $xoopsModule->getVar( 'hasconfig' ) == 1 || $xoopsModule->getVar( 'hascomments' ) == 1 ) {
  28.     $config_handler = & xoops_gethandler( 'config' );
  29.     $xoopsModuleConfig = & $config_handler->getConfigsByCat( 0, $xoopsModule->getVar( 'mid' ) );
  30. }
  31.  
  32. // include the default language file for the admin interface
  33. if ( file_exists( "../language/" . $xoopsConfig['language'] . "/admin.php" ) ) {
  34.     include "../language/" . $xoopsConfig['language'] . "/admin.php";
  35. }
  36. elseif ( file_exists( "../language/english/admin.php" ) ) {
  37.     include "../language/english/admin.php";
  38. }
  39. ?>