XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
admin.php
Go to the documentation of this file.
1 <?php
2 // start hack by Trabis
3 if (!class_exists('ProtectorRegistry')) exit('Registry not found');
4 
6 $mydirname = $registry->getEntry('mydirname');
7 $mydirpath = $registry->getEntry('mydirpath');
8 $language = $registry->getEntry('language');
9 // end hack by Trabis
10 
11 $mytrustdirname = basename( dirname( __FILE__ ) ) ;
12 $mytrustdirpath = dirname( __FILE__ ) ;
13 
14 // environment
15 require_once XOOPS_ROOT_PATH.'/class/template.php' ;
19 $xoopsModuleConfig =& $config_handler->getConfigsByCat( 0 , $xoopsModule->getVar( 'mid' ) ) ;
20 
21 // check permission of 'module_admin' of this module
23 if( ! is_object( @$xoopsUser ) || ! $moduleperm_handler->checkRight( 'module_admin' , $xoopsModule->getVar( 'mid' ) , $xoopsUser->getGroups() ) ) die( 'only admin can access this area' ) ;
24 
25 $xoopsOption['pagetype'] = 'admin' ;
26 require XOOPS_ROOT_PATH.'/include/cp_functions.php' ;
27 
28 // language files (admin.php)
29 //$language = empty( $xoopsConfig['language'] ) ? 'english' : $xoopsConfig['language'] ; //hack by Trabis
30 if( file_exists( "$mydirpath/language/$language/admin.php" ) ) {
31  // user customized language file
32  include_once "$mydirpath/language/$language/admin.php" ;
33 } else if( file_exists( "$mytrustdirpath/language/$language/admin.php" ) ) {
34  // default language file
35  include_once "$mytrustdirpath/language/$language/admin.php" ;
36 } else {
37  // fallback english
38  include_once "$mytrustdirpath/language/english/admin.php" ;
39 }
40 
41 // language files (main.php)
42 //$language = empty( $xoopsConfig['language'] ) ? 'english' : $xoopsConfig['language'] ; //hack by Trabis
43 if( file_exists( "$mydirpath/language/$language/main.php" ) ) {
44  // user customized language file
45  include_once "$mydirpath/language/$language/main.php" ;
46 } else if( file_exists( "$mytrustdirpath/language/$language/main.php" ) ) {
47  // default language file
48  include_once "$mytrustdirpath/language/$language/main.php" ;
49 } else {
50  // fallback english
51  include_once "$mytrustdirpath/language/english/main.php" ;
52 }
53 
54 
55 
56 if( ! empty( $_GET['lib'] ) ) {
57  // common libs (eg. altsys)
58  $lib = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , $_GET['lib'] ) ;
59  $page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ;
60 
61  if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ) ) {
62  include XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ;
63  } else if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ) ) {
64  include XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ;
65  } else {
66  die( 'wrong request' ) ;
67  }
68 } else {
69  // fork each pages of this module
70  $page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ;
71 
72  if( file_exists( "$mytrustdirpath/admin/$page.php" ) ) {
73  include "$mytrustdirpath/admin/$page.php" ;
74  } else if( file_exists( "$mytrustdirpath/admin/index.php" ) ) {
75  include "$mytrustdirpath/admin/index.php" ;
76  } else {
77  die( 'wrong request' ) ;
78  }
79 }
80 
81 ?>