<?php # ================================================================== # DO NOT ALLOW DIRECT ACCESS # ================================================================== defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); # ================================================================== # AREA 1: Render the menu. Note we directly output it # ================================================================== $menus = SessionGET("AGMENU"); $ulpads = html('ul'); $ulpads->hp['class'] = 'nav'; $first = 0; $menuLvl = 0; foreach ($menus as $menuid => $menuinfo) { $pad = $ulpads->h('li'); $pad->hp['class'] = 'dropdown'; $a = $pad->h('a', $menuinfo['description']); $a->hp['class'] = 'dropdown-toggle'; $a->hp['data-toggle'] = 'dropdown'; $a->hp['href'] = '#'; $ul = $pad->h('ul'); $ul->hp['class'] = 'dropdown-menu'; if (!empty($menuinfo['items'])) { $c = $a->h('b'); $c->hp['class'] = 'caret'; } foreach ($menuinfo['items'] as $page => $pageinfo) { $pd = $pageinfo['description']; $li = $ul->h('li'); $a2 = html('a', $li, $pd);
<?php # ================================================================== # DUPLICATE CODE ALERT # # THE BASIC LINK GENERATION CODE IN HERE IS ALSO IN X6MENU.PHP # ================================================================== # ================================================================== # DO NOT ALLOW DIRECT ACCESS # ================================================================== defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); # ================================================================== # AREA 1: Render the menx6. Note we directly output it # ================================================================== $menus = SessionGET("AGMENU", array()); #if(count($menus)==0) return; $ulpads = html('ul'); $first = 0; foreach ($menus as $menuid => $menuinfo) { if (count($menuinfo['items']) == 0) { continue; } $pad = $ulpads->h('li'); $pad->hp['id'] = 'x6menupad_' . $menuid; #$pad->addClass('x6menupad'); # IE 6 $a = $pad->h('a', $menuinfo['description']); $a->hp['href'] = "javascript:x6menuclick('{$menuid}')"; #$span= $pad->h('span',$menuinfo['description']); #$span->hp['onmouseover'] = "x6menumouseover('$menuid')"; #$span->hp['onclick'] = "x6menuclick('$menuid')";
function scDBConn_Push($role = '', $db = '') { $dbc = isset($GLOBALS['dbconn']) ? $GLOBALS['dbconn'] : null; scStackPush('dbconns', $dbc); // UID is either admin or logged in user if ($role == $GLOBALS['AG']['application']) { //echo "Going for role!"; $uid = $role; $pwd = $role; } elseif ($role != '' && $role != $GLOBALS['AG']['application']) { $uid = $GLOBALS['AG']['application'] . "_" . $role; $pwd = $GLOBALS['AG']['application'] . "_" . $role; } else { $uid = SessionGet('UID'); $pwd = SessionGet('PWD'); } //$db = $db=='' ? $GLOBALS['AG']['application'] : $db; $db = $GLOBALS['AG']['application']; // Now make a connection $GLOBALS['dbconn'] = SQL_Conn($uid, $pwd, $db); // If the "impersonate" function is there, go with it if (SessionGET("UID_IMPERSONATE") != '') { SQL("SET SESSION AUTHORIZATION " . SessionGet("UID_IMPERSONATE")); } }
function mosShowListMenu($menutype) { // ------------------------------------------------------- // Andromeda Code: If we are in an Andromeda situation // then everything is vastly simplified, we already have // the menu and we don't do much conversion // ------------------------------------------------------- if (defined('_ANDROMEDA_JOOMLA')) { if (!LoggedIn()) { return; } // KFD 7/6/07, cache the menu so we don't have to do // this on every call. // Cachegrind cost to build menu : 259 / 199 // Cachegrind cost logging in : 140 // Cachegrind cost login, cache to session: 2!!!! // Cachegrind cost to cache to disk : 400! # KFD 4/17/08, rebuild menu if they switched modes # KFD 6/21/08, simplify this by just looking at x4Welcome #$menu_mode = gpExists('x4Page') # ? (vgfGet('x4menu',false)==true ? 'x4' : 'classic') # : 'classic'; $menu_mode = configGet('x4welcome', 'N') == 'Y' ? 'x4' : 'classic'; vgfSet('menu_mode', $menu_mode); # KFD 6/21/08 (END) if ($menu_mode != SessionGet('menu_mode')) { sessionSet('menu', ''); sessionSet('menu_mode', $menu_mode); } $menu = SessionGet('menu', ''); if ($menu != '') { echo $menu; return; } ob_start(); $children = array(); $open = array(); $indents = array(array("<ul>", "<li>", "</li>", "</ul>")); $class_sfx = null; $hilightid = SessionGET('AGMENU_MODULE'); $hilightid = ''; $menus = SessionGET("AGMENU"); foreach ($menus as $menuid => $menuinfo) { //if($menuid=='datadict') continue; //if($menuid=='sysref') continue; $x = new joomla_fake(); $x->type = 'url'; $x->id = $menuid; if (sessionGet('menu_mode') == 'x4') { $x->link = 'javascript:void(0);'; } else { $x->link = "?x_module=" . urlencode($menuid); } $x->browserNav = ''; $x->name = $menuinfo['description']; $children[0][] = $x; foreach ($menuinfo['items'] as $page => $pageinfo) { $x = new joomla_fake(); $x->type = 'url'; $x->id = $page; # KFD 6/26/08, the vgfX(x4) was experimental, get rid of it #if(vgfGet('x4')===true) { # $pd = $pageinfo['description']; # $x->link="javascript:x4Page('$page','$pd')"; #} #else { # KFD 6/26/08, work out the menu mode first $xmode = 'x2'; if (sessionGet('menu_mode') == 'x4') { $xmode = a($pageinfo, 'uix2', 'N') == 'Y' ? 'x2' : 'x4'; } if ($xmode == 'x4') { $x->link = '?x4Page=' . urlencode($page); $x->link .= '&x4Return=' . vgaGet('nopage', 'menu'); } else { $x->link = "?x_module={$menuid}&x2=1&gp_page=" . urlencode($page); } if (ArraySafe($pageinfo, 'menu_parms') != '') { $x->link .= '&' . urlencode($pageinfo['menu_parms']); } #} $x->browserNav = ''; $x->name = $pageinfo['description']; $children[$menuid][] = $x; } } mosRecurseListMenu(0, 0, $children, $open, $indents, $class_sfx, $hilightid); $menu = ob_get_clean(); echo $menu; SessionSet('menu', $menu); //$fsMenuFileHTML=ob_get_clean(); //file_put_contents($fsMenuFile,$fsMenuFileHTML); //echo $fsMenuFileHTML; return; } // ------------------------------------------------------- // Andromeda Code: END // ------------------------------------------------------- global $database, $my, $cur_template, $Itemid; global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_shownoauth; $class_sfx = null; $hilightid = null; /* If a user has signed in, get their user type */ $intUserType = 0; if ($my->gid) { switch ($my->usertype) { case 'Super Administrator': $intUserType = 0; break; case 'Administrator': $intUserType = 1; break; case 'Editor': $intUserType = 2; break; case 'Registered': $intUserType = 3; break; case 'Author': $intUserType = 4; break; case 'Publisher': $intUserType = 5; break; case 'Manager': $intUserType = 6; break; } } else { /* user isn't logged in so make their usertype 0 */ $intUserType = 0; } if ($mosConfig_shownoauth) { $database->setQuery("SELECT m.*, count(p.parent) as cnt" . "\nFROM #__menu AS m" . "\nLEFT JOIN #__menu AS p ON p.parent = m.id" . "\nWHERE m.menutype='{$menutype}' AND m.published='1'" . "\nGROUP BY m.id ORDER BY m.parent, m.ordering "); } else { $database->setQuery("SELECT m.*, sum(case when p.published=1 then 1 else 0 end) as cnt" . "\nFROM #__menu AS m" . "\nLEFT JOIN #__menu AS p ON p.parent = m.id" . "\nWHERE m.menutype='{$menutype}' AND m.published='1' AND m.access <= '{$my->gid}'" . "\nGROUP BY m.id ORDER BY m.parent, m.ordering "); } $rows = $database->loadObjectList('id'); echo $database->getErrorMsg(); //work out if this should be highlighted $sql = "SELECT m.* FROM #__menu AS m" . "\nWHERE menutype='" . $menutype . "' AND m.published='1'"; $database->setQuery($sql); $subrows = $database->loadObjectList('id'); $maxrecurse = 5; $parentid = $Itemid; //this makes sure toplevel stays hilighted when submenu active while ($maxrecurse-- > 0) { $parentid = getParentRow($subrows, $parentid); if (isset($parentid) && $parentid >= 0 && $subrows[$parentid]) { if (vgfGet('menu_mode') != 'x4') { $hilightid = $parentid; } } else { break; } } if (vgfGet('menu_mode') == 'x4') { $hilightid = ''; } //echo "<!--[if lte IE 7]>\n"; include_once "{$mosConfig_absolute_path}/templates/" . $cur_template . "/js/ie.js"; //echo "<![endif]-->\n"; $indents = array(array("<ul>", "<li>", "</li>", "</ul>")); // establish the hierarchy of the menu $children = array(); // first pass - collect children foreach ($rows as $v) { $pt = $v->parent; $list = @$children[$pt] ? $children[$pt] : array(); array_push($list, $v); $children[$pt] = $list; } // second pass - collect 'open' menus $open = array($Itemid); $count = 20; // maximum levels - to prevent runaway loop $id = $Itemid; while (--$count) { if (isset($rows[$id]) && $rows[$id]->parent > 0) { $id = $rows[$id]->parent; $open[] = $id; } else { break; } } $class_sfx = null; mosRecurseListMenu(0, 0, $children, $open, $indents, $class_sfx, $hilightid); }