// // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // You may not change or alter any portion of this comment or credits // // of supporting developers from this source code or any supporting // // source code which is considered copyrighted (c) material of the // // original comment or credit authors. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // define('XOOPS_CPFUNC_LOADED', 1); function xoops_cp_header() { global $xoopsConfig, $xoopsUser; if ($xoopsConfig['gzip_compression'] == 1) { ob_start("ob_gzhandler"); } else { ob_start(); } if (!headers_sent()) { header ('Content-Type:text/html; charset='._CHARSET); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header('Cache-Control: no-store, no-cache, must-revalidate'); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } echo ""; echo ' '.htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES).' Administration '; echo ''; echo ''; include_once XOOPS_CACHE_PATH.'/adminmenu.php'; $moduleperm_handler =& xoops_gethandler('groupperm'); $admin_mids = $moduleperm_handler->getItemIds('module_admin', $xoopsUser->getGroups()); $module_handler =& xoops_gethandler('module'); $modules =& $module_handler->getObjects(new Criteria('mid', "(".implode(',', $admin_mids).")", 'IN'), true); $admin_mids = array_keys($modules); ?>
".htmlspecialchars($xoopsConfig[
 "._CPHOME." "._LOGOUT." | "._YOURHOME."  

"; foreach ( $admin_mids as $adm ) { if ( !empty($xoops_admin_menu_ft[$adm]) ) { echo ""; } } echo "
".$xoops_admin_menu_ft[$adm]."


\n"; } function xoops_cp_footer() { global $xoopsConfig, $xoopsLogger; echo"

Powered by ".XOOPS_VERSION." © 2001-2005 The XOOPS Cube Project
"; include XOOPS_CACHE_PATH.'/adminmenu.php'; echo $xoops_admin_menu_dv; echo " "; if ($xoopsConfig['debug_mode'] == 2) { echo ''; } ob_end_flush(); } // We need these because theme files will not be included function OpenTable() { echo "
\n"; } function CloseTable() { echo '
'; } function themecenterposts($title, $content) { echo '
'.$title.'

'.$content.'
'; } function myTextForm($url , $value) { return '
'; } function xoopsfwrite() { if ($_SERVER['REQUEST_METHOD'] != 'POST') { return false; } else { } if (!xoops_refcheck()) { return false; } else { } return true; } function xoops_module_get_admin_menu() { /************************************************************ * Based on: * - PHP Layers Menu 1.0.7(c)2001,2002 Marco Pratesi * - TreeMenu 1.1 - Bjorge Dijkstra ************************************************************/ $abscissa_step = 90; // step for the left boundaries of layers $abscissa_offset = 15; // to choose the horizontal coordinate start offset for the layers $rightarrow = ""; // the following is to support browsers not detecting the mouse position $ordinata_step = 15; // estimated value of the number of pixels between links on a layer $ordinata[1] = 150-$ordinata_step;// to choose the vertical coordinate start offset for the layers $moveLayers = array(); $shutdown = array(); $firstleveltable = array(); /*********************************************/ /* read file to $tree array */ /* tree[x][0] -> tree level */ /* tree[x][1] -> item text */ /* tree[x][2] -> item link */ /* tree[x][3] -> link target */ /* tree[x][4] -> module id */ /*********************************************/ $js = ""; $maxlevel = 0; $cnt = 1; $module_handler =& xoops_gethandler('module'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('hasadmin', 1)); $criteria->add(new Criteria('isactive', 1)); $criteria->setSort('mid'); $mods =& $module_handler->getObjects($criteria); foreach ($mods as $mod) { // RMV-NOTIFY: // Why need 'adminindex' defined?? Should just be for ALL modules // because sometimes comments, notification gives options but // module may have no other admin functions... /*if ($mod->getInfo('adminindex') && trim($mod->getInfo('adminindex')) != '') {*/ $tree[$cnt][0] = 1; $tree[$cnt][5] = "getInfo('image')."' alt='' />"; $tree[$cnt][1] = $mod->getVar('name'); $tree[$cnt][2] = "\".XOOPS_URL.\"/modules/".$mod->getVar('dirname')."/".trim($mod->getInfo('adminindex')); $tree[$cnt][3] = ""; $tree[$cnt][4] = $mod->getVar('mid'); $tree[$cnt][6] = "\"._VERSION.\": ".round($mod->getVar('version')/100 , 2)."
\"._DESCRIPTION.\": ".$mod->getInfo('description'); $layer_label[$cnt] = "L" . $cnt; if ( $tree[$cnt][0] > $maxlevel ) { $maxlevel = $tree[$cnt][0]; } $cnt++; $adminmenu = $mod->getAdminMenu(); if ($mod->getVar('hasnotification') || ($mod->getInfo('config') && is_array($mod->getInfo('config'))) || ($mod->getInfo('comments') && is_array($mod->getInfo('comments')))) { $adminmenu[] = array('link' => '".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mod->getVar('mid'), 'title' => _PREFERENCES, 'absolute' => true); } if (!empty($adminmenu)) { foreach ( $adminmenu as $menuitem ) { $menuitem['link'] = trim($menuitem['link']); $menuitem['target'] = isset($menuitem['target']) ? trim($menuitem['target']) : ''; $tree[$cnt][0] = 2; $tree[$cnt][1] = trim($menuitem['title']); if (isset($menuitem['absolute']) && $menuitem['absolute']) { $tree[$cnt][2] = (empty($menuitem['link'])) ? "#" : $menuitem['link']; } else { $tree[$cnt][2] = (empty($menuitem['link'])) ? "#" : "\".XOOPS_URL.\"/modules/".$mod->getVar('dirname')."/".$menuitem['link']; } $tree[$cnt][3] = (empty($menuitem['target'])) ? "" : $menuitem['target']; $tree[$cnt][4] = $mod->getVar('mid'); $layer_label[$cnt] = "L" . $cnt; if ($tree[$cnt][0] > $maxlevel) { $maxlevel = $tree[$cnt][0]; } $cnt++; } } /* }*/ } $tmpcount = count($tree); $tree[$tmpcount+1][0] = 0; for ( $i = 0; $i < $maxlevel; $i++) { $abscissa[$i] = $i * $abscissa_step + $abscissa_offset; } for ( $cnt = 1; $cnt <= $tmpcount; $cnt++) { // this counter scans all nodes // assign the layers name to the current hierarchical level, // to keep trace of the route leading to the current node on the tree $layername[$tree[$cnt][0]] = $layer_label[$cnt]; // assign the starting vertical coordinates for all sublevels for ( $i = $tree[$cnt][0] + 1; $i < $maxlevel; $i++) { $ordinata[$i] = $ordinata[$i-1] + 1.5*$ordinata_step; } // increment the starting vertical coordinate for the current sublevel if ($tree[$cnt][0] < $maxlevel) { $ordinata[$tree[$cnt][0]] += $ordinata_step; } if ($tree[$cnt+1][0]>$tree[$cnt][0] && $cnt<$tmpcount) { // the node is not a leaf, hence it has at least a child // initialize the corresponding layer content trought a void string $layer[$layer_label[$cnt]] = ""; // prepare the popUp function related to the children $js .= "function popUp" . $layer_label[$cnt] . "() {\n" . "shutdown();\n"; for ($i=1; $i<=$tree[$cnt][0]; $i++) { $js .= "popUp(\\\"" . $layername[$i] . "\\\",true);\n"; } $js .= "}\n"; // geometrical parameters are assigned to the new layer, related to the above mentioned children if (!isset($moveLayers[$tree[$cnt][4]])) { $moveLayers[$tree[$cnt][4]] = "setleft('" . $layer_label[$cnt] . "'," . $abscissa[$tree[$cnt][0]] . ");\n"; } else { $moveLayers[$tree[$cnt][4]] .= "setleft('" . $layer_label[$cnt] . "'," . $abscissa[$tree[$cnt][0]] . ");\n"; } if (!isset($moveLayers[$tree[$cnt][4]])) { $moveLayers[$tree[$cnt][4]] = "settop('" . $layer_label[$cnt] . "'," . $ordinata[$tree[$cnt][0]] . ");\n"; } else { $moveLayers[$tree[$cnt][4]] .= "settop('" . $layer_label[$cnt] . "'," . $ordinata[$tree[$cnt][0]] . ");\n"; } //$moveLayers[$tree[$cnt][4]] .= "setwidth('" . $layer_label[$cnt] . "'," . $abscissa_step . ");\n"; // the new layer is accounted for in the shutdown() function if (!isset($shutdown[$tree[$cnt][4]])) { $shutdown[$tree[$cnt][4]] = "popUp('" . $layer_label[$cnt] . "',false);\n"; } else { $shutdown[$tree[$cnt][4]] .= "popUp('" . $layer_label[$cnt] . "',false);\n"; } } if ($tree[$cnt+1][0]>$tree[$cnt][0] && $cnt<$tmpcount) { // not a leaf $currentarrow = $rightarrow; } else { // a leaf $currentarrow = ""; } /* */ $currentlink = $tree[$cnt][2]; /* */ /* if ( $tree[$cnt+1][0] > $tree[$cnt][0] && $cnt < $tmpcount) { // not a leaf $currentlink = "#"; } else { // a leaf $currentlink = $tree[$cnt][2]; } */ if ($tree[$cnt][3] != "") { $currenttarget = " target='" . $tree[$cnt][3] . "'"; } else { $currenttarget = ""; } if ($tree[$cnt][0] > 1) { // the hierarchical level is > 1, hence the current node is not a child of the root node // handle accordingly the corresponding link, distinguishing if the current node is a leaf or not if ( $tree[$cnt+1][0] > $tree[$cnt][0] && $cnt < $tmpcount ) { // not a leaf $onmouseover = " onmouseover='moveLayerY(\\\"" . $layer_label[$cnt] . "\\\", currentY) ; popUp" . $layer_label[$cnt] . "();"; $onmouseover = " onmouseover='moveLayerY(\\\"" . $layer_label[$cnt] . "\\\", currentY, event) ; popUp" . $layer_label[$cnt] . "();"; } else { // a leaf $onmouseover = " onmouseover='popUp" . $layername[$tree[$cnt][0]-1] . "();"; } $layer[$layername[$tree[$cnt][0]-1]] .= " " .$tree[$cnt][1]. "" . $currentarrow . "
\n"; } elseif ($tree[$cnt][0] == 1) { // the hierarchical level is = 1, hence the current node is a child of the root node // handle accordingly the corresponding link, distinguishing if the current node is a leaf or not if ($tree[$cnt+1][0]>$tree[$cnt][0] && $cnt<$tmpcount) { // not a leaf $onmouseover = " onmouseover='moveLayerY(\\\"" . $layer_label[$cnt] . "\\\", currentY) ; popUp" . $layer_label[$cnt] . "();"; $onmouseover = " onmouseover='moveLayerY(\\\"" . $layer_label[$cnt] . "\\\", currentY,event) ; popUp" . $layer_label[$cnt] . "();"; } else { // a leaf $onmouseover = " onmouseover='shutdown();"; } if (!isset($firstleveltable[$tree[$cnt][4]])) { $firstleveltable[$tree[$cnt][4]] = "" . $tree[$cnt][5] . "" . $currentarrow . "
\n"; } else { $firstleveltable[$tree[$cnt][4]] .= "" . $tree[$cnt][5] . "" . $currentarrow . "
\n"; } } } // end of the "for" cycle scanning all nodes $cellpadding = 10; $width = $abscissa_step - $cellpadding; $menu_layers = ""; for ( $cnt = 1; $cnt <= $tmpcount; $cnt++ ) { if (!($tree[$cnt+1][0]<=$tree[$cnt][0])) { $menu_layers .= "\n"; } } $menu_layers .= "\n"; $content = "<"."?php\n"; $content .= "\$xoops_admin_menu_js = \"".$js."\";\n"; foreach ( $moveLayers as $k => $v ){ $content .= "\$xoops_admin_menu_ml[$k] = \"".$v."\";\n"; } foreach ( $shutdown as $k => $v ){ $content .= "\$xoops_admin_menu_sd[$k] = \"".$v."\";\n"; } foreach ( $firstleveltable as $k => $v ){ $content .= "\$xoops_admin_menu_ft[$k] = \"".$v."\";\n"; } $content .= "\$xoops_admin_menu_dv = \"".$menu_layers."\";\n"; $content .= "\n?".">"; return $content; } function xoops_module_write_admin_menu($content) { if (!xoopsfwrite()) { return false; } $filename = XOOPS_CACHE_PATH.'/adminmenu.php'; if ( !$file = fopen($filename, "w") ) { echo 'failed open file'; return false; } if ( fwrite($file, $content) == -1 ) { echo 'failed write file'; return false; } fclose($file); return true; } ?>