function getAccesses() { global $toC_Json, $osC_Language; $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access'); $osC_DirectoryListing->setIncludeDirectories(false); $access_modules_array = array(); foreach ($osC_DirectoryListing->getFiles() as $file) { $module = substr($file['name'], 0, strrpos($file['name'], '.')); if (!class_exists('osC_Access_' . ucfirst($module))) { $osC_Language->loadIniFile('modules/access/' . $file['name']); include $osC_DirectoryListing->getDirectory() . '/' . $file['name']; } $module = 'osC_Access_' . ucfirst($module); $module = new $module(); $title = osC_Access::getGroupTitle($module->getGroup()); $access_modules_array[$title][] = array('id' => $module->getModule(), 'text' => $module->getTitle(), 'leaf' => true); } ksort($access_modules_array); $access_options = array(); $count = 1; foreach ($access_modules_array as $group => $modules) { $access_option['id'] = $count; $access_option['text'] = $group; $mod_arrs = array(); foreach ($modules as $module) { $mod_arrs[] = $module; } $access_option['children'] = $mod_arrs; $access_options[] = $access_option; $count++; } echo $toC_Json->encode($access_options); }
</script> </head> <body> <?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>'; }
public static function getAccessModules() { global $osC_Language; $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access'); $osC_DirectoryListing->setIncludeDirectories(false); $modules = array(); foreach ($osC_DirectoryListing->getFiles() as $file) { $module = substr($file['name'], 0, strrpos($file['name'], '.')); if (!class_exists('osC_Access_' . ucfirst($module))) { $osC_Language->loadIniFile('modules/access/' . $file['name']); include $osC_DirectoryListing->getDirectory() . '/' . $file['name']; } $module = 'osC_Access_' . ucfirst($module); $module = new $module(); $modules[osC_Access::getGroupTitle($module->getGroup())][] = array('id' => $module->getModule(), 'text' => $module->getTitle()); } ksort($modules); return $modules; }
</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>'; } echo ' </ul>' . ' </li>' . ' <li></li>'; } echo ' <li><span></span><span>' . $osC_Language->get('header_title_help') . '</span>' . ' <ul>' . ' <li><span>' . osc_icon('oscommerce.png') . '</span><span>' . $osC_Language->get('header_title_oscommerce_support_site') . '</span>' . ' <ul>' . ' <li><span>' . osc_icon('oscommerce.png') . '</span><a href="http://www.oscommerce.com" target="_blank">Support Site</a></li>' . ' <li><span>' . osc_icon('log.png') . '</span><a href="http://www.oscommerce.info" target="_blank">Knowledge Base</a></li>' . ' <li><span>' . osc_icon('people.png') . '</span><a href="http://forums.oscommerce.com" target="_blank">Community Forums</a></li>' . ' <li><span>' . osc_icon('run.png') . '</span><a href="http://www.oscommerce.com/community/contributions" target="_blank">Contributions</a></li>' . ' <li><span>' . osc_icon('configure.png') . '</span><a href="http://svn.oscommerce.com/jira" target="_blank">Bug Reporter</a></li>' . ' </ul>' . ' </li>' . ' <li><span>' . osc_icon('locale.png') . '</span><span>' . $osC_Language->get('header_title_languages') . '</span>' . ' <ul>';
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; }
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> <script type="text/javascript">