示例#1
0
function admin_menu($help_file = '')
{
    $pntable = pnDBGetTables();
    list($newsubs) = db_select_one_row("SELECT count(*) FROM {$pntable['queue']}");
    if (!pnSecAuthAction(0, "::", '::', ACCESS_EDIT)) {
        // suppress admin display - return to index.
        pnRedirect('index.php');
    } else {
        menu_title('admin.php', _ADMINMENU);
        menu_graphic(pnConfigGetVar('admingraphic'));
        if ($help_file != '') {
            menu_help($help_file, _ONLINEMANUAL);
        }
        $mods = pnModGetAdminMods();
        if ($mods == false) {
            // there aren't admin modules
            return;
        }
        foreach ($mods as $mod) {
            // Hack until the new news module comes into being
            // TODO - remove this at appropriate time
            if ($mod['name'] == 'AddStory') {
                $mod['name'] = 'Stories';
            }
            if (pnSecAuthAction(0, "{$mod['name']}::", '::', ACCESS_EDIT)) {
                if (file_exists("modules/" . pnVarPrepForOS($mod['directory']) . "/pnadmin.php")) {
                    $file = "modules/" . pnVarPrepForOS($mod['directory']) . "/pnimages/admin.";
                    if (file_exists($file . 'gif')) {
                        $imgfile = $file . 'gif';
                    } elseif (file_exists($file . 'jpg')) {
                        $imgfile = $file . 'jpg';
                    } elseif (file_exists($file . 'png')) {
                        $imgfile = $file . 'png';
                    } else {
                        $imgfile = 'modules/NS-Admin/images/default.gif';
                    }
                    menu_add_option(pnVarPrepForDisplay(pnModURL($mod['name'], 'admin')), $mod['displayname'], $imgfile);
                } else {
                    $file = "modules/" . pnVarPrepForOS($mod['directory']) . "/images/admin.";
                    if (file_exists($file . 'gif')) {
                        $imgfile = $file . 'gif';
                    } elseif (file_exists($file . 'jpg')) {
                        $imgfile = $file . 'jpg';
                    } elseif (file_exists($file . 'png')) {
                        $imgfile = $file . 'png';
                    } else {
                        $imgfile = 'modules/NS-Admin/images/default.gif';
                    }
                    menu_add_option("admin.php?module={$mod['directory']}&op=main", $mod['displayname'], $imgfile);
                }
            }
        }
    }
}
示例#2
0
if (has_menu_items()) {
    ?>
				<nav id="main" role="navigation">
					<ul>
						<?php 
    while (menu_items()) {
        ?>
						<li <?php 
        echo menu_active() ? 'class="active"' : '';
        ?>
>
							<a href="<?php 
        echo menu_url();
        ?>
" title="<?php 
        echo menu_title();
        ?>
">
								<?php 
        echo menu_name();
        ?>
							</a>
						</li>
						<?php 
    }
    ?>
					</ul>
				</nav>
				<?php 
}
?>