/** * @method check_auth * @abstract Filter method that checks authorization before accessing actions. */ function check_auth() { if (!Login::is_logged_in()) { $_SESSION['redirect_to'] = array('controller' => $this->name, 'action' => $this->action); $this->flash('Login is required to access the page you requested!', 'warning'); $this->redirect_to(sprintf('http://%s/common/login.php?gate=%s', $_SERVER['HTTP_HOST'], urlencode(trim(APPLICATION_ROOT, '/')))); } }
?> <?php // $tags = $this->article->tags; // for ($i = 0; $i < count($tags); $i++) // { // print $this->link_to(ucwords($tags[$i]->tag), array('class' => 'token', 'action' => 'tag', 'id' => $tags[$i]->id)); // if ($i < count($tags) - 1) // print ", "; // } ?> </div--> <div class="diario-controls lighter"> <ul class="plain"> <?php if (Login::is_logged_in()) { ?> <li class="plain"> <?php echo $this->link_to(l('Edit'), array('controller' => 'backend', 'action' => 'diario_post_edit', 'id' => $this->article->id)); ?> </li> <?php } ?> <!-- <li class="plain"> <?php echo $this->link_to_remote(l('Update'), array('action' => 'comments', 'id' => $this->article->id, 'target' => 'comments')); ?> </li>
?> <div class="error"><?php echo $this->error_message; ?> </div> <?php } else { if ($this->success_message !== null) { ?> <div class="success"><?php echo $this->success_message; ?> </div> <?php } else { if (!empty($_GET['reason']) && Login::is_logged_in()) { ?> <div class="success"> <?php switch ($_GET['reason']) { case 'updated': echo 'Invoice updated'; break; case 'created': echo 'Invoice created'; break; } ?> </div> <?php }
/** * A user has permissions if their ID matches $user_id or there is a matching key in $_GET. * * @param int $user_id * @param string $key * @return bool */ private function has_permissions($user_id, $key) { if (Login::is_logged_in() && intval($user_id) === $this->current_user[InvoicerDB::USER_ID]) { return true; } if (isset($_GET['key']) && $_GET['key'] === $key) { return true; } return false; }
/** * @fn check_auth * @short Filter method that checks authorization before accessing actions. */ protected function check_auth() { if (!Login::is_logged_in()) { $_SESSION['redirect_to'] = array('controller' => $this->name, 'action' => $this->action); $this->flash('Login is required to access the page you requested!', 'warning'); $this->redirect_to(array('controller' => 'login')); } }
<?php session_start(); define('ROOT', __DIR__); require ROOT . '/config.php'; require ROOT . '/includes/database.php'; require ROOT . '/includes/login.php'; require ROOT . '/includes/invoice.php'; require ROOT . '/includes/upload.php'; require ROOT . '/includes/page.php'; $current_user = Login::is_logged_in() ? $database->get_user(Login::get_current_user_id()) : null; $page = new Page($current_user, $base_url, $sub_folder); ?> <!DOCTYPE html> <html> <?php $page->load_head(); ?> <body> <?php $page->load_header(); ?> <!--[if lt IE 7]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <div id="container" class="wrapper"> <?php $page->load_template(); ?>
?> " title="Español"><img src="/assets/images/es_flag.gif" alt="Spanish flag" /></a></li></ul> </div> <ul class="toplinks"> <li> <?php echo $this->link_to(l('Contact'), array('controller' => 'contact')); ?> </li> <?php if ($this->name != 'login') { ?> <li> <?php echo Login::is_logged_in() ? $this->link_to(l('Logout'), array('controller' => 'login', 'action' => 'logout')) : $this->link_to(l('Login'), array('controller' => 'login')); ?> </li> <?php } ?> </ul> <?php if (date("Y-m-d") == "2008-05-23") { ?> <div style="position:absolute;right:90px;z-index:2000"> <a href="http://en.wikipedia.org/wiki/Giovanni_Falcone"><img src="/assets/images/a/falcone_1992_2008.png" alt="Giovanni Falcone — 1992-2008" /></a> </div> <?php }