<?php if (http_is_post()) { if ($_POST['form_action'] == 'newuser') { if ($user = $g->add_user($_POST)) { Fu_Feedback::set_flash('user added'); http_redirect(http_request_uri()); } } } $users = $g->get_users(); include 'giiki/theme/_header.php'; ?> <div id="wrapper" class="wat-cf"> <div id="main"> <div class="block" id=""> <div class="content"> <h2 class="title">Manage Users</h2> <div class="inner"> <!-- messages //--> <?php app_show_feedback(); ?> <table class="table"> <tr> <th class="first">Name</th> <th>Email</th> <th>Admin?</th> <th class="last"></th>
include 'giiki/theme/_header.php'; ?> <div id="wrapper" class="wat-cf"> <div id="main"> <!-- messages //--> <?php app_show_feedback(); ?> <div class="block" id="main-content"> <div class="secondary-navigation"> <ul class="wat-cf"> <li class="first active"><a href="<?php h(http_request_uri()); ?> "><?php h($g->get_page_name(true)); ?> </a></li> <?php if (defined('COMMIT')) { ?> <li><a href="?view">show current</a></li> <?php } else { ?> <li><a href="?edit">edit</a></li> <?php }
$file = ROOT . '/giiki/theme/' . $page_name; if (file_exists($file)) { include $file; } else { die('No such page'); } break; case isset($_REQUEST['edit']): include 'giiki/theme/edit.php'; break; case isset($_REQUEST['view']): default: if (http_is_post()) { if ($_POST['form_action'] == 'newpage') { $page_name = preg_replace('/[^a-z\\s0-9\\/_\\-\\.]/i', '', $_POST['pagename']); if (!$page_name) { http_redirect(http_request_uri()); } http_redirect('/' . $page_name . '.html?edit'); } } if (!$g->page_exists()) { http_redirect('/' . $g->get_page() . '?edit'); } $qs = str_replace(http_path() . '?', '', http_request_uri()); if (strlen($qs) == 40 && preg_match('/^[a-z0-9]+$/i', $qs)) { define('COMMIT', $qs); } include 'giiki/theme/view.php'; break; }
<?php $crumbs = $g->get_breadcrumbs(); $children = $g->get_child_pages(); $db_page = $g->get_db_page(); ?> <div class="block"> <h3>Breadcrumbs</h3> <ul class="navigation"> <?php foreach ($crumbs as $k => $v) { printf('<li><a href="%s">%s</a></li>', $k, $v); } printf('<li><a href="%s"><b>%s</b></a></li>', http_request_uri(), $g->get_page_name()); foreach ($children as $k => $v) { $indent = (int) substr_count(str_replace('/' . $g->get_page_name(), '', $k), '/'); printf('<li><a href="%s" class="indent-%s">%s</a></li>', $k, $indent, $v); } ?> </ul> </div> <div class="block"> <h3>Sidebar</h3> <ul class="navigation"> <li><a href="?edit" title="Edit <?php h($g->get_page()); ?> ">Edit Page</a></li> <li><a href="#history" id="history-btn">History / Commits</a></li> </ul> </div>
/** * Check if user logged in. * * If not, redirect. */ function authenticate() { if (http_path() == '/login.php') { return; } do { if ($_COOKIE['cs']) { // user id and token present, check $cookie_store = json_decode($_COOKIE['cs']); if (!$cookie_store->email) { break; } try { $dbo = new DB_User(); $user = $dbo->find_by('email', $cookie_store->email); if ($cookie_store->key != md5($cookie_store->email . $cookie_store->ts . $user->token)) { break; } $this->user = $user; $this->git->set_author($this->user); return true; } catch (Exception $e) { break; } } else { break; // no chance of being logged in } } while (0); http_redirect('/login.php?fwd=' . rawurlencode(http_request_uri())); }