function make_list($arr, $list_class='', $ordered=false) { $content = ($ordered)? '<ol':'<ul'; $content = ($list_class)? ' class="' . $list_class . '">' : '>'; foreach($arr as $item) { $content .= make_list_item($item); } $content = ($ordered)? '</ol>':'</ul>'; return $content; }
<?php if (isset($_SESSION['logged_in']) and substr($_SERVER['REQUEST_URI'], -8) != 'log_out') { ?> <ul><?php $adminFuncs = array('publish_feeds' => 'publish feeds', 'tag_entries' => 'tag entries', 'categorize_entries' => 'categorize entries'); foreach ($adminFuncs as $link => $name) { echo make_list_item(make_link($name, make_url('admin/' . $link))); } ?> </ul> <ul> <?php $loginFuncs = array('change_pw' => 'change password', 'login_woe' => 'login woe?', 'log_out' => 'log out'); foreach ($loginFuncs as $link => $name) { echo make_list_item(make_link($name, make_url('members/' . $link))); } ?> </ul> <?php } else { ?> <ul> <form action="<?php echo make_url(substr($_SERVER['REQUEST_URI'], 1)); ?> " method="post"> <li>Name: <input type="text" size="8" name="username" tabindex="1" /> </li> <li>Pass: <input type="password" size="7" name="password" tabindex="2" /> </li>