[170] | 1 | <?php |
---|
| 2 | if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ; |
---|
| 3 | |
---|
| 4 | if( empty( $mydirname ) ) $mydirname = basename(dirname(dirname(__FILE__))) ; |
---|
| 5 | |
---|
[737] | 6 | // Detect Altsys |
---|
| 7 | // Not Active ALTSYS => $active_altsys = false; |
---|
| 8 | // Active ALTSYS => $active_altsys = true; |
---|
| 9 | $module_handler =& xoops_gethandler('module'); |
---|
| 10 | $criteria = new CriteriaCompo(); |
---|
| 11 | $criteria->add(new Criteria('dirname','altsys')); |
---|
| 12 | $criteria->add(new Criteria('isactive', 1)); |
---|
| 13 | $altsys_mod = $module_handler->getObjects($criteria); |
---|
| 14 | if(empty($altsys_mod)) $active_altsys = false; else $active_altsys = true; |
---|
| 15 | |
---|
| 16 | |
---|
[170] | 17 | if( ! defined( 'XOOPS_ORETEKI' ) ) { |
---|
| 18 | // Skip for ORETEKI XOOPS |
---|
| 19 | |
---|
| 20 | if( ! isset( $module ) || ! is_object( $module ) ) $module = $xoopsModule ; |
---|
| 21 | else if( ! is_object( $xoopsModule ) ) die( '$xoopsModule is not set' ) ; |
---|
| 22 | |
---|
| 23 | // load modinfo.php if necessary (judged by a specific constant is defined) |
---|
| 24 | if( ! defined( '_MYMENU_CONSTANT_IN_MODINFO' ) || ! defined( _MYMENU_CONSTANT_IN_MODINFO ) ) { |
---|
| 25 | if( file_exists("../language/".$xoopsConfig['language']."/modinfo.php") ) { |
---|
| 26 | include_once("../language/".$xoopsConfig['language']."/modinfo.php"); |
---|
| 27 | } else { |
---|
| 28 | include_once("../language/english/modinfo.php"); |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | include( './menu.php' ) ; |
---|
| 33 | |
---|
| 34 | $menuitem_dirname = $module->getvar('dirname') ; |
---|
| 35 | |
---|
[737] | 36 | // mytplsadmin (TODO check if this module has tplfile) |
---|
| 37 | if( $active_altsys ) { |
---|
| 38 | $title = defined( '_MD_A_MYMENU_MYTPLSADMIN' ) ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin' ; |
---|
| 39 | array_push( $adminmenu , array( 'title' => $title , 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin' ) ) ; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | // myblocksadmin |
---|
| 43 | $title = defined( '_MD_A_MYMENU_MYBLOCKSADMIN' ) ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin' ; |
---|
| 44 | if( $active_altsys ){ |
---|
| 45 | // mypreferences |
---|
| 46 | array_push( $adminmenu , array( 'title' => $title , 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin' ) ) ; |
---|
[170] | 47 | } else if( defined( 'XOOPS_CUBE_LEGACY' ) ) { |
---|
| 48 | // Cube Legacy without altsys |
---|
[737] | 49 | array_push( $adminmenu , array( 'title' => $title , 'link' => XOOPS_URL.'/modules/legacy/admin/index.php?action=BlockList') ) ; |
---|
| 50 | } else if ( preg_match ( "/^ImpressCMS/" , XOOPS_VERSION ) ){ |
---|
| 51 | // ImpressCMS |
---|
| 52 | array_push( $adminmenu , array( 'title' => $title , 'link' => XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&filtersel=mid&filtersel2='.$module->getvar('mid') ) ) ; |
---|
[170] | 53 | } else { |
---|
[737] | 54 | array_push( $adminmenu , array( 'title' => $title , 'link' => XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&op=list&filter=1&selgen='.$module->getvar('mid').'&selmod=-2&selgrp=-1&selvis=-1' ) ) ; |
---|
[170] | 55 | } |
---|
[737] | 56 | |
---|
| 57 | // mylangadmin |
---|
| 58 | if( $active_altsys ){ |
---|
| 59 | $title = defined( '_MD_A_MYMENU_MYLANGADMIN' ) ? _MD_A_MYMENU_MYLANGADMIN : 'langadmin' ; |
---|
| 60 | array_push( $adminmenu , array( 'title' => $title , 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mylangadmin' ) ) ; |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | // preferences |
---|
| 64 | if( $module->getvar('hasconfig') ){ |
---|
| 65 | if( $active_altsys ){ |
---|
| 66 | // mypreferences |
---|
| 67 | $title = defined( '_MD_A_MYMENU_MYPREFERENCES' ) ? _MD_A_MYMENU_MYPREFERENCES : _PREFERENCES ; |
---|
| 68 | array_push( $adminmenu , array( 'title' => _PREFERENCES , 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences' ) ) ; |
---|
| 69 | } else if( defined( 'XOOPS_CUBE_LEGACY' ) ) { |
---|
| 70 | // Cube Legacy without altsys |
---|
| 71 | array_push( $adminmenu , array( 'title' => _PREFERENCES , 'link' => XOOPS_URL.'/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id=' . $module->getvar('mid') ) ) ; |
---|
| 72 | } else { |
---|
| 73 | // system->preferences |
---|
| 74 | array_push( $adminmenu , array( 'title' => _PREFERENCES , 'link' => XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$module->mid() ) ) ; |
---|
| 75 | } |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | // hilight |
---|
[170] | 79 | $mymenu_uri = empty( $mymenu_fake_uri ) ? $_SERVER['REQUEST_URI'] : $mymenu_fake_uri ; |
---|
| 80 | $mymenu_link = substr( strstr( $mymenu_uri , '/admin/' ) , 1 ) ; |
---|
| 81 | |
---|
| 82 | foreach( array_keys( $adminmenu ) as $i ) { |
---|
| 83 | if( $mymenu_link == $adminmenu[$i]['link'] ) { |
---|
| 84 | $adminmenu[$i]['color'] = '#FFCCCC' ; |
---|
| 85 | $adminmenu_hilighted = true ; |
---|
| 86 | $GLOBALS['altsysAdminPageTitle'] = $adminmenu[$i]['title'] ; |
---|
| 87 | } else { |
---|
| 88 | $adminmenu[$i]['color'] = '#DDDDDD' ; |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | if( empty( $adminmenu_hilighted ) ) { |
---|
| 92 | foreach( array_keys( $adminmenu ) as $i ) { |
---|
| 93 | if( stristr( $mymenu_uri , $adminmenu[$i]['link'] ) ) { |
---|
| 94 | $adminmenu[$i]['color'] = '#FFCCCC' ; |
---|
| 95 | $GLOBALS['altsysAdminPageTitle'] = $adminmenu[$i]['title'] ; |
---|
| 96 | break ; |
---|
| 97 | } |
---|
| 98 | } |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | // link conversion from relative to absolute |
---|
| 102 | foreach( array_keys( $adminmenu ) as $i ) { |
---|
| 103 | if( stristr( $adminmenu[$i]['link'] , XOOPS_URL ) === false ) { |
---|
| 104 | $adminmenu[$i]['link'] = XOOPS_URL."/modules/$mydirname/" . $adminmenu[$i]['link'] ; |
---|
| 105 | } |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | // display |
---|
| 109 | echo "<div style='text-align:left;width:98%;'>" ; |
---|
| 110 | foreach( $adminmenu as $menuitem ) { |
---|
| 111 | echo "<div style='float:left;height:1.5em;'><nobr><a href='".htmlspecialchars($menuitem['link'],ENT_QUOTES)."' style='background-color:{$menuitem['color']};font:normal normal bold 9pt/12pt;'>".htmlspecialchars($menuitem['title'],ENT_QUOTES)."</a> | </nobr></div>\n" ; |
---|
| 112 | } |
---|
| 113 | echo "</div>\n<hr style='clear:left;display:block;' />\n" ; |
---|
| 114 | |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | ?> |
---|