function getAdminCollapseMenu($txt, $arr = array()) { $rnd = rand(); $active = false; foreach ($arr as $k => $v) { $active = PAGE == $v[0] ? true : $active; } $in = $active ? "in" : ""; $collapsed = $active ? "" : "collapsed"; echo "<a href='#m{$rnd}' data-toggle='collapse' class='list-group-item {$collapsed}'>{$txt}</a>"; echo "<div id='m{$rnd}' class='list-group collapse {$in}'>"; foreach ($arr as $k => $v) { getAdminMenu($v[0], $v[1]); } echo "</div>"; }
</div> </div> </div> <div class="row"> <div class="col-md-3"> <div class="list-group"> <?php echo getAdminMenu("setting/profile", '<i class="fa fa-user" aria-hidden="true"></i> ข้อมูลส่วนตัว', "setting"); ?> <?php echo getAdminMenu("setting/social", '<i class="fa fa-facebook" aria-hidden="true"></i> Social Connect'); ?> <?php echo getAdminMenu("setting/security", '<i class="fa fa-key" aria-hidden="true"></i> รหัสผ่าน'); ?> <?php getAdminCollapseMenu('<i class="fa fa-cog" aria-hidden="true"></i> ข้อมูลบัญชี', array(array("setting/bank", '<i class="fa fa-university" aria-hidden="true"></i> บัญชีธนาคาร'), array("setting/deposit", '<i class="fa fa-credit-card" aria-hidden="true"></i> ฝาก'), array("setting/withdraw", '<i class="fa fa-money" aria-hidden="true"></i> ถอน'))); ?> <?php if (S("user")['rank'] > 1) { getAdminCollapseMenu("Administrator", array(array("setting/role", "User Role"), array("setting/bank-manager", "Bank Manager"), array("setting/deposit-manager", "Deposit Manager"), array("setting/withdraw-manager", "Withdraw Manager"))); } ?> </div>
function _parseElement() { global $_SP_CONF, $_USER, $_TABLES, $LANG01, $_CONF, $_GROUPS; $returnArray = array(); $childArray = array(); $item_array = array(); if ($this->active != 1 && $this->id != 0) { return NULL; } if ($this->group_id == 998 && !COM_isAnonUser()) { return NULL; } if (isset($_REQUEST['topic'])) { $topic = COM_applyFilter($_REQUEST['topic']); } else { $topic = ''; } if (COM_isAnonUser()) { $anon = 1; } else { $anon = 0; } $allowed = true; if ($this->group_id != 998 && $this->id != 0 && !SEC_inGroup($this->group_id)) { return NULL; } if ($this->group_id == 1 && !isset($_GROUPS['Root'])) { return NULL; } switch ($this->type) { case ET_SUB_MENU: $this->replace_macros(); break; case ET_FUSION_ACTION: switch ($this->subtype) { case 0: // home $this->url = $_CONF['site_url'] . '/'; break; case 1: // contribute if ($anon && ($_CONF['loginrequired'] || $_CONF['submitloginrequired'])) { return NULL; } if (empty($topic)) { $this->url = $_CONF['site_url'] . '/submit.php?type=story'; } else { $this->url = $_CONF['site_url'] . '/submit.php?type=story&topic=' . $topic; } $label = $LANG01[71]; break; case 2: // directory if ($anon && ($_CONF['loginrequired'] || $_CONF['directoryloginrequired'])) { return NULL; } $this->url = $_CONF['site_url'] . '/directory.php'; if (!empty($topic)) { $this->url = COM_buildUrl($this->url . '?topic=' . urlencode($topic)); } break; case 3: // prefs if ($anon && ($_CONF['loginrequired'] || $_CONF['profileloginrequired'])) { return NULL; } $this->url = $_CONF['site_url'] . '/usersettings.php?mode=edit'; break; case 4: // search if ($anon && ($_CONF['loginrequired'] || $_CONF['searchloginrequired'])) { return NULL; } $this->url = $_CONF['site_url'] . '/search.php'; break; case 5: // stats if (!SEC_hasRights('stats.view')) { return NULL; } $this->url = $_CONF['site_url'] . '/stats.php'; break; default: // unknown? $this->url = $_CONF['site_url'] . '/'; break; } break; case ET_FUSION_MENU: $this->url = ''; switch ($this->subtype) { case USER_MENU: // if anonymous user - show login entry if (COM_isAnonUser()) { $this->label = $LANG01[58]; $this->url = $_CONF['site_url'] . '/users.php'; $this->target = ''; break; } // logged-in user see My Account entry $item_array = getUserMenu(); $this->label = $LANG01[47]; break; case ADMIN_MENU: $this->url = $_CONF['site_admin_url']; $item_array = getAdminMenu(); break; case TOPIC_MENU: $item_array = getTopicMenu(); break; case STATICPAGE_MENU: $item_array = array(); $order = ''; if (!empty($_SP_CONF['sort_menu_by'])) { $order = ' ORDER BY '; if ($_SP_CONF['sort_menu_by'] == 'date') { $order .= 'sp_date DESC'; } else { if ($_SP_CONF['sort_menu_by'] == 'label') { $order .= 'sp_label'; } else { if ($_SP_CONF['sort_menu_by'] == 'title') { $order .= 'sp_title'; } else { // default to "sort by id" $order .= 'sp_id'; } } } } $result = DB_query('SELECT sp_id, sp_label FROM ' . $_TABLES['staticpage'] . ' WHERE sp_onmenu = 1 AND sp_status = 1' . COM_getPermSql('AND') . $order); $nrows = DB_numRows($result); $menuitems = array(); for ($i = 0; $i < $nrows; $i++) { $A = DB_fetchArray($result); $url = COM_buildURL($_CONF['site_url'] . '/page.php?page=' . $A['sp_id']); $label = $A['sp_label']; $item_array[] = array('label' => $label, 'url' => $url); } break; case PLUGIN_MENU: $item_array = array(); $plugin_menu = PLG_getMenuItems(); if (count($plugin_menu) == 0) { $this->access = 0; } else { for ($i = 1; $i <= count($plugin_menu); $i++) { $url = current($plugin_menu); $label = key($plugin_menu); $item_array[] = array('label' => $label, 'url' => $url); next($plugin_menu); } } break; case HEADER_MENU: default: } break; case ET_PLUGIN: $plugin_menus = _mbPLG_getMenuItems(); if (isset($plugin_menus[$this->subtype])) { $this->url = $plugin_menus[$this->subtype]; } else { $this->access = 0; $allowed = 0; } break; case ET_STATICPAGE: $this->url = COM_buildURL($_CONF['site_url'] . '/page.php?page=' . $this->subtype); break; case ET_URL: $this->replace_macros(); break; case ET_PHP: $functionName = $this->subtype; if (function_exists($functionName)) { $item_array = $functionName(); } break; case ET_TOPIC: $this->url = $_CONF['site_url'] . '/index.php?topic=' . $this->subtype; break; default: break; } if ($this->id != 0 && $this->group_id == 998 && SEC_inGroup('Root')) { return NULL; } if ($allowed == 0 || $this->access == 0) { return NULL; } if ($this->type == ET_FUSION_MENU || $this->type == ET_PHP) { $childArray = $item_array; } else { if (!empty($this->children)) { $howmany = $this->getChildcount(); if ($howmany > 0) { $children = $this->getChildren(); foreach ($children as $child) { $elementArray = $child->_parseElement(); if ($elementArray != NULL) { $childArray[] = $elementArray; } } } } else { $childArray = NULL; } } $returnArray = array('label' => $this->label, 'url' => $this->url, 'target' => $this->target, 'children' => is_array($childArray) ? $childArray : NULL); return $returnArray; }
function TopCodeAdmin($extraCodeInBody = '') { global $dir; global $site; global $_page; global $en_sdating; global $logged; global $dir_dir; global $sdating_dir; global $sRayHomeDir; if ($logged['admin']) { $logo_alt = 'Admin'; $user = '******'; } elseif ($logged['aff']) { $logo_alt = 'Affiliate'; $user = '******'; } elseif ($logged['moderator']) { $logo_alt = 'Moderator'; $user = '******'; } $selfCateg = 0; $selfCategIcon = ''; $self = basename($_SERVER['PHP_SELF']); if ($self != 'index.php') { $aSelfCateg = db_assoc_arr("\r\n\t\t\tSELECT\r\n\t\t\t\t`Categ`,\r\n\t\t\t\t`AdminMenuCateg`.`Icon`\r\n\t\t\tFROM `AdminMenu`\r\n\t\t\tLEFT JOIN `AdminMenuCateg` ON\r\n\t\t\t\t`AdminMenuCateg`.`ID` = `AdminMenu`.`Categ`\r\n\t\t\tWHERE\r\n\t\t\t\tRIGHT(`Url`, " . strlen($self) . ")='{$self}' AND\r\n\t\t\t\t`User`='{$user}'\r\n\t\t\t"); $selfCateg = (int) $aSelfCateg['Categ']; $selfCategIcon = $aSelfCateg['Icon']; } else { $admin_categ = (int) $_GET['admin_categ']; if ($admin_categ) { $aSelfCateg = db_assoc_arr("\r\n\t\t\t\tSELECT\r\n\t\t\t\t\t`ID`,\r\n\t\t\t\t\t`Title`,\r\n\t\t\t\t\t`Icon`\r\n\t\t\t\tFROM `AdminMenuCateg`\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t`ID`={$admin_categ} AND\r\n\t\t\t\t\t`User`='{$user}'\r\n\t\t\t\t"); if ($aSelfCateg) { $selfCateg = (int) $aSelfCateg['ID']; $selfCategIcon = $aSelfCateg['Icon']; $_page['header'] = $aSelfCateg['Title']; } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title>Admin panel: <?php echo $_page['header']; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="<?php echo $site['plugins']; ?> calendar/calendar_themes/aqua.css" type="text/css" /> <link href="<?php echo $site['url_admin']; ?> styles/general.css" rel="stylesheet" type="text/css" /> <?php if (strlen($_page['css_name']) and file_exists("{$dir['root']}admin/styles/{$_page['css_name']}")) { ?> <link href="styles/<?php echo $_page['css_name']; ?> " rel="stylesheet" type="text/css" /> <link href="styles/<?php echo $_page['css_name2']; ?> " rel="stylesheet" type="text/css" /> <?php } ?> <script type="text/javascript" language="javascript">var sRayUrl = '<?php echo $site['url'] . $sRayHomeDir; ?> ';</script> <script src="../ray/modules/global/js/integration.js" type="text/javascript" language="javascript"></script> <script src="../inc/js/functions.js" type="text/javascript" language="javascript"></script> <!--[if lt IE 7.]> <script defer type="text/javascript"> var site_url = '<?php echo $site['url']; ?> '; </script> <script defer type="text/javascript" src="../inc/js/pngfix.js"></script> <![endif]--> <?php if (strlen($_page['js_name'])) { echo <<<EOJ <script type="text/javascript"> <!-- \tvar site_url = '{$site['url']}'; \tvar lang_delete = 'delete'; \tvar lang_loading = 'loading ...'; \tvar lang_delete_message = 'Poll successfully deleted'; \tvar lang_make_it = 'make it'; --> </script> <script src="{$site['url']}inc/js/{$_page['js_name']}" type="text/javascript" language="javascript"></script> EOJ; } ?> <?php echo $_page['extraCodeInHead']; ?> </head> <body id="admin_cont"> <div id="FloatDesc"></div> <?php echo $_page['extraCodeInBody']; ?> <?php echo $extraCodeInBody; ?> <?php if ($logged['admin'] || $logged['aff'] || $logged['moderator']) { ?> <div class="top_header"> <img src="<?php echo $site['url_admin']; ?> images/top_dol_logo.png" class="top_logo" /> <div class="top_head_title"> <span class="head_blue"> <span class="title_bold">Dolphin</span> <?php echo $logo_alt; ?> - </span> <?php echo $site['title']; ?> </div> <div class="boonex_link"> <a href="http://www.boonex.com/" title="BoonEx - Community Software Experts"> <img src="<?php echo $site['url_admin']; ?> images/boonex.png" alt="BoonEx - Community Software Experts" /> </a> </div> </div> <div class="middle_wrapper"> <div class="clear_both"></div> <div class="right_menu_wrapper"> <div class="clear_both"></div> <?php echo getAdminMenu(); ?> <div class="clear_both"></div> <div style="text-align:center; margin:20px;"> <a href="http://www.expertzzz.com/" title="Experzzz - Community Software Support"> <img src="<?php echo $site['url_admin']; ?> images/expertzzz.gif" alt="Expertzzz - Community Software Support" /> </a> </div> </div> <div class="main_cont" id="main_cont" <?php echo $selfCategIcon ? "style=\"background-image:url({$site['url_admin']}images/icons/{$selfCategIcon});\"" : ''; ?> > <div class="page_header"><?php echo $_page['header']; ?> </div> <div class="page_cont"> <?php } }
/** * Prints administration menu * * This will return the administration menu items that the user has * sufficient rights to -- Admin Block on right side. * * @param string $help Help file to show * @param string $title Menu Title * @param string $position Side being shown on 'left', 'right' or blank. * @see function COM_userMenu * */ function COM_adminMenu($help = '', $title = '', $position = '') { global $_TABLES, $_USER, $_CONF; $retval = ''; $link_array = array(); if (COM_isAnonUser()) { return $retval; } $thisUrl = COM_getCurrentURL(); if ($_CONF['hide_adminmenu'] && @strpos($thisUrl, $_CONF['site_admin_url']) === false) { return ''; } if (empty($title)) { $title = DB_getItem($_TABLES['blocks'], 'title', "name = 'admin_block'"); } $retval .= COM_startBlock($title, $help, COM_getBlockTemplate('admin_block', 'header', $position), 'admin_block'); $menuData = getAdminMenu(); $retval .= '<div id="adminmenu"><ul>'; foreach ($menuData as $item) { $retval .= '<li><a href="' . $item['url'] . '">' . $item['label'] . '</a></li>'; } $retval .= '</ul></div>'; $retval .= COM_endBlock(COM_getBlockTemplate('admin_block', 'footer', $position)); return $retval; }