function parse() { global $osC_Language; if (isset($_SESSION['admin'])) { $access = osC_Access::getLevels(); ksort($access); $found = false; $module = null; foreach ($access as $group => $links) { foreach ($links as $link) { if (is_array($link['subgroups']) && !empty($link['subgroups'])) { foreach ($link['subgroups'] as $subgroup) { if ($_REQUEST['module'] == $subgroup['identifier']) { $found = true; $module = $link['module']; break; } } } else { if ($_REQUEST['module'] == $link['module'] . '-win') { $found = true; $module = $link['module']; break; } } } } if ($found === true) { $osC_Language->loadIniFile($module . '.php'); if (file_exists('includes/extmodules/' . $module . '/main.php')) { include 'includes/extmodules/' . $module . '/main.php'; exit; } else { echo "{'success': false}"; } } } else { echo "{'success': false, 'error': 'session_timeout'}"; } }
function getGroup($module = null) { if (empty($module)) { return $this->_group; } foreach (osC_Access::getLevels() as $group => $links) { foreach ($links as $link) { if ($link['module'] == $module) { return $group; } } } return false; }
<?php if ($osC_Template->hasPageHeader()) { include 'templates/default/header.php'; } if (isset($_SESSION['admin']) && !in_array($osC_Template->getModule(), array('index', 'login'))) { ?> <div id="appsPane"> <h4><?php echo osC_Access::getGroupTitle(osC_Access::getGroup($osC_Template->getModule())); ?> </h4> <?php foreach (osC_Access::getLevels(osC_Access::getGroup($osC_Template->getModule())) as $group => $links) { echo '<ul>'; foreach ($links as $link) { echo '<li' . ($link['module'] == $osC_Template->getModule() ? ' class="selected"' : '') . '><span>' . osc_icon($link['icon'], $link['title']) . '</span> <a href="' . osc_href_link_admin(FILENAME_DEFAULT, $link['module']) . '">' . $link['title'] . '</a>'; if (is_array($link['subgroups']) && !empty($link['subgroups'])) { echo '<ul' . ($link['module'] == $osC_Template->getModule() ? ' style="display: block;"' : '') . '>'; foreach ($link['subgroups'] as $subgroup) { echo '<li><a href="' . osc_href_link_admin(FILENAME_DEFAULT, $link['module'] . '&' . $subgroup['identifier']) . '">' . $subgroup['title'] . '</a></li>'; } echo '</ul>'; } echo '</li>'; } echo '</ul>'; } ?>
} else { echo $osC_Language->get('ssl_unprotected') . ' ' . osc_icon('unlocked.png'); } ?> </td> </tr> </table> <div id="administrationMenu" class="ThemeOfficeMainItem"> <ul style="visibility: hidden"> <?php $access = array(); if (isset($_SESSION['admin'])) { $access = osC_Access::getLevels(); } ksort($access); foreach ($access as $group => $links) { echo ' <li><span></span><span>' . osC_Access::getGroupTitle($group) . '</span>' . ' <ul>'; ksort($links); foreach ($links as $link) { echo ' <li><span>' . osc_icon($link['icon'], $link['title']) . '</span><a href="' . osc_href_link_admin(FILENAME_DEFAULT, $link['module']) . '">' . $link['title'] . '</a>'; if (is_array($link['subgroups']) && !empty($link['subgroups'])) { echo ' <ul>'; foreach ($link['subgroups'] as $subgroup) { echo ' <li><span>' . osc_icon($subgroup['icon']) . '</span><a href="' . osc_href_link_admin(FILENAME_DEFAULT, $link['module'] . '&' . $subgroup['identifier']) . '">' . $subgroup['title'] . '</a></li>'; } echo ' </ul>'; } echo ' </li>';
function outputModules() { $output = ''; if (isset($_SESSION['admin'])) { $access = osC_Access::getLevels(); ksort($access); } foreach ($access as $group => $links) { $group_class = ''; $modules = array(); foreach ($links as $link) { if (is_array($link['subgroups']) && !empty($link['subgroups'])) { $modules[] = '\'' . $link['module'] . '-subgroup' . '\''; } else { $modules[] = '\'' . $link['module'] . '-win' . '\''; } } $group_class = 'TocDesktop.' . ucfirst($group) . 'GroupWindow = Ext.extend(Ext.app.Module, {' . "\n"; $group_class .= 'appType : \'group\',' . "\n"; $group_class .= 'id : \'' . $group . '-grp\',' . "\n"; $group_class .= 'title : \'' . htmlentities(osC_Access::getGroupTitle($group), ENT_QUOTES, 'UTF-8') . '\',' . "\n"; $group_class .= 'menu : new Ext.menu.Menu(),' . "\n"; $group_class .= 'items : [' . implode(',', $modules) . '],' . "\n"; $group_class .= 'init : function(){' . "\n"; $group_class .= 'this.launcher = {' . "\n"; $group_class .= 'text: this.title,' . "\n"; $group_class .= 'iconCls: \'icon-' . $group . '-grp\',' . "\n"; $group_class .= 'menu: this.menu' . "\n"; $group_class .= '}}});' . "\n" . "\n"; $output .= $group_class; foreach ($links as $link) { if (is_array($link['subgroups']) && !empty($link['subgroups'])) { $modules = array(); foreach ($link['subgroups'] as $subgroup) { $modules[] = '\'' . $subgroup['identifier'] . '\''; } $group_class = ''; $module = str_replace(' ', '', ucwords(str_replace('_', ' ', $link['module']))); $group_class = 'TocDesktop.' . $module . 'SubGroupWindow = Ext.extend(Ext.app.Module, {' . "\n"; $group_class .= 'appType : \'subgroup\',' . "\n"; $group_class .= 'id : \'' . $link['module'] . '-subgroup\',' . "\n"; $group_class .= 'title : \'' . htmlentities($link['title'], ENT_QUOTES, 'UTF-8') . '\',' . "\n"; $group_class .= 'menu : new Ext.menu.Menu(),' . "\n"; $group_class .= 'items : [' . implode(',', $modules) . '],' . "\n"; $group_class .= 'init : function(){' . "\n"; $group_class .= 'this.launcher = {' . "\n"; $group_class .= 'text: this.title,' . "\n"; $group_class .= 'iconCls: \'icon-' . $link['module'] . '-subgroup\',' . "\n"; $group_class .= 'menu: this.menu' . "\n"; $group_class .= '}}});' . "\n" . "\n"; $output .= $group_class; $group_class = ''; $module = str_replace(' ', '', ucwords(str_replace('_', ' ', $link['module']))); $group_class = 'TocDesktop.' . $module . 'Window = Ext.extend(Ext.app.Module, {' . "\n"; $group_class .= 'appType : \'win\',' . "\n"; $group_class .= 'id : \'' . $link['module'] . '-win\',' . "\n"; $group_class .= 'title: \'' . htmlentities($link['title'], ENT_QUOTES, 'UTF-8') . '\',' . "\n"; $group_class .= 'init : function(){' . "\n"; $group_class .= 'this.launcher = {' . "\n"; $group_class .= 'text: this.title,' . "\n"; $group_class .= 'iconCls: this.iconCls,' . "\n"; $group_class .= 'shortcutIconCls: this.shortcutIconCls,' . "\n"; $group_class .= 'scope: this' . "\n"; $group_class .= '}}});' . "\n" . "\n"; $output .= $group_class; } else { $group_class = ''; $module = str_replace(' ', '', ucwords(str_replace('_', ' ', $link['module']))); $group_class = 'TocDesktop.' . $module . 'Window = Ext.extend(Ext.app.Module, {' . "\n"; $group_class .= 'appType : \'win\',' . "\n"; $group_class .= 'id : \'' . $link['module'] . '-win\',' . "\n"; $group_class .= 'title: \'' . htmlentities($link['title'], ENT_QUOTES, 'UTF-8') . '\',' . "\n"; $group_class .= 'init : function(){' . "\n"; $group_class .= 'this.launcher = {' . "\n"; $group_class .= 'text: this.title,' . "\n"; $group_class .= 'iconCls: \'icon-' . $link['module'] . '-win\',' . "\n"; $group_class .= 'shortcutIconCls: \'icon-' . $link['module'] . '-shortcut\',' . "\n"; $group_class .= 'scope: this' . "\n"; $group_class .= '}}});' . "\n" . "\n"; $output .= $group_class; } } } $output .= $this->getLangModules(); return $output; }
<?php if ($request_type == 'SSL') { echo '<div class="reqSSL">' . __('ssl_protection') . '</div>'; } else { echo '<div class="reqNONSSL">' . __('ssl_unprotected') . '</div>'; } ?> </div> </div> <div id="adminMenu"> <ul class="levelTop"> <?php foreach (osC_Access::getLevels() as $group => $links) { echo '<li' . ($group == osC_Access::getGroup($osC_Template->getModule()) ? ' class="activeGreen"' : ' class="hoverGreen"') . '><span><a href="' . osc_href_link_admin(FILENAME_DEFAULT, $links[array_shift(array_keys($links))]['module']) . '">' . osC_Access::getGroupTitle($group) . '</a></span><ul class="levelSub">'; foreach ($links as $link) { echo '<li><a href="' . osc_href_link_admin(FILENAME_DEFAULT, $link['module']) . '">' . $link['title'] . '</a></li>'; } echo '</ul></li>'; } echo '<li class="hoverGreen"><span><a href="http://www.oscommerce.com" target="_blank">' . __('header_title_help') . '</a></span><ul class="levelSub">' . '<li><a href="http://www.oscommerce.com" target="_blank">osCommerce Support Site</a></li>' . '<li><a href="http://www.oscommerce.info" target="_blank">Online Documentation</a></li>' . '<li><a href="http://forums.oscommerce.com" target="_blank">Community Support Forums</a></li>' . '<li><a href="http://addons.oscommerce.com" target="_blank">Add-Ons Site</a></li>' . '<li><a href="http://svn.oscommerce.com/jira" target="_blank">Bug Reporter</a></li></ul></li>' . '<li class="hoverGreen"><a href="' . osc_href_link('', null, 'NONSSL', false, false, true) . '" target="_blank">' . __('header_title_online_catalog') . '</a></li>'; if (isset($_SESSION['admin'])) { echo '<li class="hoverRed"><a href="' . osc_href_link_admin(FILENAME_DEFAULT, 'login&action=logoff') . '">' . __('header_title_logoff') . '</a></li>'; } ?> </ul> </div>