/** * @route * /member/signout */ public function signout() { @session_start(); unset($_SESSION['member']); header('Location: ' . FW::baseUrl() . '/index.php/member'); return false; }
/** * @route * /static/([a-z0-9_-]+) */ public function staticPage($matches, $callback) { $page = FW::getIndex($matches, 1); $path = BASE_PATH . '/views/static/' . $page . '.php'; if (empty($page) || !file_exists($path)) { FW::callHttpStatus(404); return false; } echo FW::render('layouts/public', 'static/' . $page); }
<?php FW::set('title', 'Contact - '); ?> <h1>FW Sample App - Contact</h1> <form method="post"> <label for="name">Name</label><br/> <input type="text" name="name" id="name" /><br/> <br/> <label for="message">Message</label><br/> <textarea name="message" id="message"></textarea> <br/> <input type="submit" /> </form>
<?php FW::set('title', 'Not Found - '); ?> <h1>Not Found</h1>
<ul> <li><a href="<?php echo FW::baseUrl(); ?> /">Home</a></li> <li><a href="<?php echo FW::baseUrl(); ?> /index.php/contact">Contact</a></li> <li><a href="<?php echo FW::baseUrl(); ?> /index.php/static/about">About</a></li> <?php if (FW::get('auth')) { ?> <li><a href="<?php echo FW::baseUrl(); ?> /index.php/member/signout">Sign out</a></li> <?php } else { ?> <li><a href="<?php echo FW::baseUrl(); ?> /index.php/member">Member Area</a></li> <?php } ?> </ul>
<?php FW::set('title', 'Home - '); ?> <h1>FW Sample App</h1> <p><strong>About</strong></p>
<!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"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title><?php echo FW::get('title'); ?> Member Area - Sample App</title> </head> <body> <?php echo FW::render(null, 'common/menu'); ?> <?php echo $content; ?> </body> </html>
<?php FW::set('title', 'Login - '); ?> <h1>FW Sample App - Member Area</h1> <form method="post"> <?php if ($error) { ?> <div class="error">Login error.</div> <?php } ?> <label for="name">Login</label><br/> <input type="text" name="login" id="login" /><small> (Login: sample)</small><br/> <br/> <label for="message">Password</label><br/> <input type="password" name="password" id="password" /><small> (Password: sample)</small><br/> <br/> <input type="submit" /> </form>
public static function refresh($anchor = '', $statusCode = 302) { return FW::redirect(self::getRequestUri() . $anchor, $statusCode); }
<?php define('BASE_PATH', dirname(__FILE__)); define('LIB_PATH', BASE_PATH . '/lib'); require_once BASE_PATH . '/../fw.php'; require_once LIB_PATH . '/PublicArea.php'; require_once LIB_PATH . '/MemberArea.php'; FW::add('PublicArea'); FW::add('MemberArea'); FW::run();