function draw_page($page, $label, $h, $w) { $dat .= '<html><head><title>' . TITLE . '</title><link rel="stylesheet" type="text/css" href="admin.css" ></head><body>'; $dat .= '<table height="100%" width="100%"><tr><td align="center">'; if (isset($_SESSION['eror'])) { $dat .= '<div class="error">' . $_SESSION['eror'] . '</div>'; unset($_SESSION['eror']); } $dat .= '<table class="tab" cellspacing="0"><tr><td class="label">' . $label . '</td><td width="1px" class="buttons">'; if ($_SESSION['user'] == md5(USER_NAME) and $_SESSION['pass'] == md5(PASSWORD)) { $dat .= '<a class="logout" href="admin.php?do=logout"><img src="logout.jpg" border="0" alt=""></a>'; } $dat .= '</td></tr><tr><td colspan="2" height="' . $h . '" width="' . $w . '" style="overflow: auto;">'; $dat .= '<table border="0" height="100%" width="100%" class="cont"><tr>'; if ($_SESSION['user'] == md5(USER_NAME) and $_SESSION['pass'] == md5(PASSWORD)) { $dat .= '<td class="menu" valign="top" width="1">'; $dat .= make_menu(); $dat .= '</td>'; } $dat .= '<td align="center">'; $dat .= $_SESSION['path']; //$dat.= '<div style="height:490px;overflow:auto;" align="center">'; $dat .= $page; //$dat.= '</div>'; $dat .= '</td></tr></table>'; $dat .= '</td></tr></table>'; $dat .= '</td></tr></table>'; $dat .= '</body></html>'; echo $dat; }
function make_menu($prefix, $current_path, $level) { $full_path = $prefix . "/" . $current_path; $files = scandir($full_path); $reverse_list = array_reverse($files); // access files most recent at top foreach ($reverse_list as $key => $filename) { // skip '.' and '..' directories in a reverse-sorted list if ($key > count($reverse_list) - 3) { continue; } if (is_dir($full_path . $filename)) { $date = strtotime($current_path . $filename); $name = $filename; if ($level == "month") { $name = date('F', $date); } elseif ($level == "day") { $name = date('l, d', $date); } printf("<div class=%s id=%s>%s", $level, $current_path . $filename, $name); $next_level = ""; if ($level == "year") { $next_level = "month"; } elseif ($level == "month") { $next_level = "day"; } else { $next_level = "POST"; } make_menu($prefix, $current_path . $filename . "/", $next_level); printf("</div>"); } else { $file_contents = file_get_contents($full_path . $filename); $firstline = str_replace("#", "", current(explode("\n", $file_contents))); printf("<div class='post' id='%s'>%s</div>", $full_path . $filename, $firstline); } } }
<?php $menu = array('index.php' => '| Home ', 'products.php' => '| Products |', 'client.php' => ' Client Area |'); echo '<div style="padding-left:0;">'; $unord_links = make_menu($menu); echo $unord_links; echo '</div>';
} elseif ($p == "admin_export_users") { require_once realpath(__DIR__ . '/../includes/controller/export_users_controller.php'); if (isset($_REQUEST['type'])) { $type = $_REQUEST['type']; } else { $ype = 'csv'; } users_export_controller($type); } elseif ($p == "admin_log") { $title = admin_log_title(); $content = admin_log(); } elseif ($p == "credits") { require_once realpath(__DIR__ . '/../includes/pages/guest_credits.php'); $title = credits_title(); $content = guest_credits(); } else { require_once realpath(__DIR__ . '/../includes/pages/guest_start.php'); $content = guest_start(); } } else { // Wenn schon eingeloggt, keine-Berechtigung-Seite anzeigen if (isset($user)) { $title = _("No Access"); $content = _("You don't have permission to view this page. You probably have to sign in or register in order to gain access!"); } else { // Sonst zur Loginseite leiten redirect(page_link_to("login")); } } echo template_render('../templates/layout.html', array('theme' => isset($user) ? $user['color'] : $default_theme, 'title' => $title, 'atom_link' => $p == 'news' || $p == 'user_meetings' ? '<link href="' . page_link_to('atom') . ($p == 'user_meetings' ? '&meetings=1' : '') . '&key=' . $user['api_key'] . '" type="application/atom+xml" rel="alternate" title="Atom Feed">' : '', 'menu' => make_menu(), 'content' => msg() . $content, 'header_toolbar' => header_toolbar(), 'faq_url' => $faq_url, 'contact_email' => $contact_email, 'locale' => locale()));
document.getElementById('eq_abbrev').value = document.getElementById('crew_'+crew_id+'_abbrev').value; } </script> <style> a:hover {text-decoration:none;} </style> </head> <body> <div id="banner_left"><a href="index.php"><img src="images/raprec_banner_left.jpg" style="border:none" alt="RapRec Central Logo" /></a></div> <div id="banner_right"><a href="index.php"><img src="images/raprec_banner_right.jpg" style="border:none" alt="RapRec Central" /></a></div> <div id="left_sidebar"> <?php make_menu(); ?> </div> <div id="location_bar"><?php echo $_SESSION['location_bar']; ?> </div> <div id="content" style="text-align:center"> <?php /* ------------------------------------------------<< BEGIN CONTENT >>-------------------------------------------------------------*/ if (isset($_GET['eq_type']) && in_array($_GET['eq_type'], array('rope', 'genie', 'letdown_line'))) { if (isset($_POST['eq_num1'])) { try {
} elseif ($p == "imprint") { require_once realpath(__DIR__ . '/../includes/pages/guest_imprint.php'); $title = credits_title(); $content = guest_credits(); } elseif ($p == "privacy") { require_once realpath(__DIR__ . '/../includes/pages/guest_privacy.php'); $title = credits_title(); $content = guest_credits(); } elseif ($p === "dashboard") { require_once realpath(__DIR__ . '/../includes/pages/dashboard.php'); $title = getDashboardTitle(); $content = get_dashboard(); } elseif ($p == "api_key") { require_once realpath(__DIR__ . '/../includes/controller/api_key.php'); $content = getAPIKey(); } else { require_once realpath(__DIR__ . '/../includes/pages/guest_start.php'); $content = guest_start(); } } else { // Wenn schon eingeloggt, keine-Berechtigung-Seite anzeigen if (isset($user)) { $title = _("No Access"); $content = _("You don't have permission to view this page. You probably have to sign in or register in order to gain access!"); } else { // Sonst zur Loginseite leiten redirect(page_link_to("login")); } } echo template_render('../templates/layout.html', array('theme' => isset($user) ? $user['color'] : $default_theme, 'title' => $title, 'atom_link' => $p == 'news' || $p == 'user_meetings' ? '<link href="' . page_link_to('atom') . ($p == 'user_meetings' ? '&meetings=1' : '') . '&key=' . $user['api_key'] . '" type="application/atom+xml" rel="alternate" title="Atom Feed">' : '', 'menu' => make_menu(), 'content' => msg() . $content, 'privacy_note' => PN_ShowNotice(), 'header_toolbar' => header_toolbar(), 'faq_url' => $faq_url, 'locale' => locale(), 'selectAllText' => _('Select all'), 'filterPlaceholder' => _("Search"), 'allSelectedText' => _("All selected"), 'nSelectedText' => _("selected"), 'nonSelectedText' => _("None selected")));
<html> <head> <title>Hi, My Site</title> <link rel="stylesheet" href="mywebsite.css"> <script src="js/jquery-2.1.4.js"></script> <body> <div id="page"> <div id="blog_menu"> <?php include_once "php/blog_menu.php"; make_menu("blog", "", "year"); //phpinfo(); ?> </div> <div id="blog_view"> </div> </div> <script> $(document).ready(function() { $(".post").each(function(){ $(this).click(function() { $.ajax("php/blog_view.php?entry=" + this.id) .success(function(msg){ $("#blog_view").html(msg); }) .fail(function() { $("#blog_view").html("AJAX failure loading post: " + this.id); }); }) .mouseover(function(){
function draw_navigation() { global $auth_user; // SELF doesn't cut it here, using REQUEST URI instead $self = strip_tags(htmlspecialchars(@$_SERVER['REQUEST_URI'], ENT_QUOTES, 'iso-8859-1')); if ($self === '/') { $self = '/index.php'; } include_once 'pear-auth.php'; init_auth_user(); $main_order = $main = $data = $sub = $rel = array(); $main_order[1] = '/index.php'; $main['/index.php'] = 'Main'; $sub['/index.php'] = array(); $sub['/index.php']['/index.php'] = 'Home'; $sub['/index.php']['/news/'] = 'News'; $sub['/index.php']['/qa/'] = 'Quality Assurance'; $sub['/index.php']['/group/'] = 'The PEAR Group'; $sub['/index.php']['/mirrors.php'] = 'Mirrors'; $main_order[2] = '/support/'; $main['/support/'] = 'Support'; $sub['/support/'] = array(); $sub['/support/']['/support/'] = 'Overview'; $sub['/support/']['/support/lists.php'] = 'Mailing Lists'; $sub['/support/']['/support/books.php'] = 'Books'; $sub['/support/']['/support/tutorials.php'] = 'Tutorials'; $sub['/support/']['/support/slides.php'] = 'Presentation Slides'; $sub['/support/']['/support/icons.php'] = 'Icons'; $sub['/support/']['/support/forums.php'] = 'Forums'; $main_order[3] = '/manual/'; $main['/manual/'] = 'Documentation'; $sub['/manual/'] = array(); $sub['/manual/']['/manual/en/about-pear.php'] = 'About PEAR'; $sub['/manual/']['/manual/'] = 'Manual'; $sub['/manual/']['/manual/en/faq.php'] = 'FAQ'; $main_order[4] = '/packages.php'; $main['/packages.php'] = 'Packages'; $sub['/packages.php'] = array(); if (!empty($auth_user) && !empty($auth_user->registered) && auth_check('pear.dev')) { $sub['/packages.php']['/package-new.php'] = 'New Package'; $sub['/packages.php']['/release-upload.php'] = 'Upload Release'; } $sub['/packages.php']['/packages.php'] = 'List Packages'; $sub['/packages.php']['/search.php'] = 'Search Packages'; $sub['/packages.php']['/package-stats.php'] = 'Statistics'; $sub['/packages.php']['/channels/'] = 'Channels'; $main_order[6] = '/accounts.php'; $main['/accounts.php'] = 'Developers'; $sub['/accounts.php'] = array(); $sub['/accounts.php']['/map/'] = 'Find a Developer'; $sub['/accounts.php']['/accounts.php'] = 'List Accounts'; $sub['/accounts.php']['/bugs/stats_dev.php'] = 'Developers Bug Statistics'; if (!empty($auth_user) && !empty($auth_user->registered) && auth_check('pear.dev')) { $sub['/accounts.php']['/release-upload.php'] = 'Upload Release'; $sub['/accounts.php']['/package-new.php'] = 'New Package'; $sub['/accounts.php']['/notes/admin/'] = 'Manage User Notes'; $sub['/accounts.php']['/election/'] = 'View Elections'; } $main_order[5] = '/pepr/'; $main['/pepr/'] = 'Package Proposals'; $sub['/pepr/'] = array(); $sub['/pepr/']['/pepr/'] = 'Browse Proposals'; $sub['/pepr/']['/pepr/pepr-proposal-edit.php'] = 'New Proposal'; $main_order[7] = '/bugs/'; $main['/bugs/'] = 'Bugs'; $sub['/bugs/'] = array(); $sub['/bugs/']['/bugs/search.php'] = 'Search for bugs'; $sub['/bugs/']['/bugs/stats.php'] = 'Package Bug Statistics'; if (!empty($auth_user) && $auth_user->isAdmin()) { $main_order[8] = '/admin/'; $main['/admin/'] = 'Administrators'; $sub['/admin/'] = array(); $sub['/admin/']['/admin/'] = 'Overview'; $sub['/admin/']['/admin/package-approval.php'] = 'Package approvals'; $sub['/admin/']['/admin/category-manager.php'] = 'Manage categories'; $sub['/admin/']['/tags/admin.php'] = 'Manage tags'; $sub['/admin/']['/admin/karma.php'] = 'Karma'; $sub['/admin/']['/admin/apidoc-log.php'] = 'APIdoc log'; } // Orders the main items in the proper order according to $main_order ksort($main_order); foreach ($main_order as $mo) { if (isset($main[$mo])) { $data[$mo] = $main[$mo]; } } // Relationship linker foreach (array_keys($sub) as $path) { $keys = array_keys($sub[$path]); $temp = array_fill_keys($keys, $path); $rel += $temp; } // Can't find a match, lets cut pieces of the url // lets first try sub dir + a php file if (!isset($rel[$self]) || $rel[$self] === null) { $pos = strpos($self, '.php'); $self = $pos !== false ? substr($self, 0, $pos + 4) : $self; } // Can't find a match, lets cut pieces of the url if ((!isset($rel[$self]) || $rel[$self] === null) && strlen($self) > 0) { $pos = strpos($self, '/', 1); $self = $pos !== false ? substr($self, 0, $pos + 1) : $self; } /* Check if it's a top level item. * There are cases were we don't want to put fake second level * menu item, like Bugs -> Index, the top level link serves as Index */ if (isset($data[$self])) { $rel += array($self => $self); } // avoid a notice if the array key isn't set if (!array_key_exists($self, $rel)) { $rel[$self] = null; } // Not really menu items but required so the correct // sub menu item gets selected $fake = array('/developers/' => '/accounts.php', '/user/' => '/accounts.php', '/package/' => '/packages.php', '/package-edit.php' => '/packages.php', '/package-delete.php' => '/packages.php'); if (isset($fake[$self])) { $self = $fake[$self]; } // Still no luck, lets fallback on index.php if ($rel[$self] === null) { $self = '/index.php'; } $menu = array(); $menu['main'] = make_menu($data, 'menu', $rel[$self]); $menu['sub'] = make_menu($sub[$rel[$self]], 'submenu', $self); return $menu; }
/** * Creating menu list of navbar * * @param array $links menu link list * @param string $name menu name * @param string $class menu class * * @return string */ function make_menu($menu_array, $responsivable = FALSE) { $output = ''; foreach ($menu_array as $list_id => $list_item) { $class = isset($list_item['class']) ? $list_item['class'] : ''; $output .= '<ul id="' . $list_id . '" role="menu" class="' . $class . '">'; foreach ($list_item['items'] as $menu_id => $menu_item) { $list_attr = array('role' => 'presentation', 'id' => str_replace('_', '-', $menu_id), 'class' => ''); switch ($menu_item['type']) { case 'header': $list_attr['class'] .= 'dropdown-header'; $output .= '<li ' . parse_attrs($list_attr) . '>' . $menu_item['label']; break; case 'devider': $list_attr['class'] .= 'nav-divider'; $output .= '<li ' . parse_attrs($list_attr) . '>'; break; case 'link': $list_attr['class'] .= 'nav-link'; if (strpos(current_url(), site_url($menu_item['url'])) !== FALSE) { $list_attr['class'] .= ' active'; } if ($has_child = array_key_exists('child', $menu_item)) { $list_attr['class'] .= ' dropdown'; } $output .= '<li ' . parse_attrs($list_attr) . '>'; $menu_item['attr'] = array_merge($menu_item['attr'], array('role' => 'menuitem', 'tabindex' => '-1')); if ($has_child === TRUE) { $menu_item['label'] .= ' <b class="caret"></b>'; $menu_item['attr'] = array_merge($menu_item['attr'], array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown')); } $anchor_pre = '<span class="menu-text">'; $output .= anchor($menu_item['url'], $anchor_pre . $menu_item['label'] . '</span>', $menu_item['attr']); if ($has_child === TRUE) { $output .= make_menu($menu_item['child'], 'dropdown-menu'); } break; } $output .= '</li>'; } $output .= '</ul>'; } return $output; }