public function generate() { $tmpl = new \backbone\Template(); $css = $tmpl->build('footer.css'); $html = $tmpl->build('footer.html'); $js = $tmpl->build('footer.js'); $content = array('html' => $html, 'css' => array('code' => $css, 'link' => 'footer'), 'js' => array('code' => $js, 'link' => 'footer')); return $content; }
public function build($appContent) { $tmpl = new \backbone\Template(); $tmpl->headerContent = $this->header->generate(); $tmpl->appContent = $appContent; $tmpl->footerContent = $this->footer->generate(); $tmpl->title = $this->page_title; $tmpl->id = $this->body_id; $tmpl->root = $this->root; return $tmpl->build('page.html'); }
<?php require_once 'components/system/Preload.php'; $allowed = array(0 => 'Anyone who is logged in'); $page = new \render\Page("Home", 'home', $allowed); $tmpl = new \backbone\Template(); $page->run(); $tmpl->self = $page->self; $tmpl->code = isset($_GET['code']) ? $_GET['code'] : -1; switch ($tmpl->code) { case 0: // user logged in successfully $tmpl->alert['type'] = "okay fadeout"; //style the messagebox AND target it to fade out. $tmpl->alert['message'] = 'Welcome, ' . $tmpl->self->getFname(); break; default: break; } $html = $tmpl->build('home.html'); $css = $tmpl->build('home.css'); $js = $tmpl->build('home.js'); $appContent = array('html' => $html, 'css' => array('code' => $css, 'link' => 'home'), 'js' => array('code' => $js, 'link' => 'home')); echo $page->build($appContent);
public function generate() { $tmpl = new \backbone\Template(); $menuRepo = $this->em->getRepository('model\\entities\\Menu'); // set empty objects $tmpl->data = new \stdClass(); $tmpl->user = new \stdClass(); $dmz_pages = array(); //set DMZ pages foreach ($this->config->dmz as $file) { $dmz_pages[] = $this->root . $file; } //set taglines $taglines = array('It\'s a hard Nox life', 'Nox your clients\' socks off', 'Your new website: Nox\'d off in a second'); $num = mt_rand(0, count($taglines) - 1); $tmpl->data->tagline = $taglines[$num]; $tmpl->user->active = $active = isset($_SESSION['active']); $rp = 1; if ($active) { $tmpl->user->icon = $this->businessUser->getIconUrl($this->self); if (isset($_SESSION['realUserId'])) { $tmpl->user->realIcon = $this->businessUser->getIconUrl($this->realSelf); } $rp = $this->self->getAuthentication()->getResetPassword(); $tmpl->user->fullName = $this->self->getFullName(); } $menus = $menuRepo->findBy(array("location" => "header")); $filteredMenus = array(); foreach ($menus as $m) { if ($this->businessPermission->viewMenu($m, $this->self)) { $filteredMenus[] = $m; } } $tmpl->data->menus = $filteredMenus; /* * force SSL * * if($_SERVER["HTTPS"] != "on") * { * header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); * exit(); * } * * /force SSL */ $uri = $_SERVER['REQUEST_URI']; $script = $_SERVER['SCRIPT_NAME']; if ($rp && $active) { if ($uri != $this->root . 'account.php?a=login&code=5') { header('Location: account.php?a=login&code=5'); } } else { //load DMZ pages if (!in_array($script, $dmz_pages)) { if ($script != $this->root . 'index.php' && !$active) { header('Location: index.php?code=2'); } elseif ($script == $this->root . 'index.php' && $active) { header('Location: home.php'); } elseif ($script == $this->root . 'index.php' && !$active) { //allow to go to login or dmz pages } } } $tmpl->data->root = $this->root; $css = $tmpl->build('header.css'); $html = $tmpl->build('header.html'); $js = $tmpl->build('header.js'); $content = array('html' => $html, 'css' => array('code' => $css, 'link' => 'header'), 'js' => array('code' => $js, 'link' => 'header')); return $content; }
<?php require_once 'components/system/Preload.php'; $tmpl = new \backbone\Template(); $page = new \render\Page("About", 'about'); $page->run(); $html = $tmpl->build('about.html'); $css = $tmpl->build('about.css'); $js = $tmpl->build('about.js'); $appContent = array('html' => $html, 'css' => array('code' => $css, 'link' => 'about'), 'js' => array('code' => $js, 'link' => 'about')); echo $page->build($appContent);
<?php require_once 'components/system/Preload.php'; $tmpl = new \backbone\Template(); $tmpl->code = isset($_GET['code']) ? $_GET['code'] : 200; $page = new \render\Page("HTTP Status " . $tmpl->code . " Page", 'errors'); $page->run(); switch ($tmpl->code) { case 404: // Page or File Not Found $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "It appears that URL is broken.<br />Or the file got moved<br />Or something.<br />It appears the only course of action is to give up completely."; break; case 500: //Server Config or Script Crashed $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "Oh jeez. I'm so sorry. I don't even know what happened.<br />I swear this doesn't usually happen.<br />...<br />Um, the server is broken. Come back later."; break; case 200: default: //Server Config or Script Crashed $tmpl->alert['type'] = "okay"; $tmpl->alert['message'] = "Oh, you think you're SO sneaky. Move along, nothing to see here."; break; } $html = $tmpl->build('error.html'); $css = $tmpl->build('error.css'); $js = $tmpl->build('error.js'); $appContent = array('html' => $html, 'css' => array('code' => $css, 'link' => 'error'), 'js' => array('code' => $js, 'link' => 'error')); echo $page->build($appContent);
<?php require_once 'components/system/Preload.php'; $allowed = array(1 => 'Admin'); $page = new \render\Page("Users", 'users', $allowed); $tmpl = new \backbone\Template(); $doctrineFactory = new \model\Access(); $em = $doctrineFactory->getEntityManager(); $userRepo = $em->getRepository('model\\entities\\User'); $page->run(); $tmpl->self = $page->self; $tmpl->action = isset($_GET['action']) ? $_GET['action'] : null; $tmpl->code = isset($_GET['code']) ? $_GET['code'] : -1; // this page can accept extended error codes. $tmpl->errorcode = isset($_GET['ec']) ? $_GET['ec'] : null; $tmpl->users = $userRepo->findAll(); $tmpl->permit = new \business\Permission($em); switch ($tmpl->code) { case 0: // filler error $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "I'm sorry Dave, I can't let you do that."; break; case 1: // User added successfully $tmpl->alert['type'] = "okay"; $tmpl->alert['message'] = "The new user was added successfully."; break; case 3: // User was deleted successfully $tmpl->alert['type'] = "okay";
<?php require_once 'components/system/Preload.php'; $allowed = array(0 => 'Anyone who is logged in'); $page = new \render\Page('Account Management', 'account', $allowed); $tmpl = new \backbone\Template(); $doctrineFactory = new \model\Access(); $em = $doctrineFactory->getEntityManager(); $userRepo = $em->getRepository('model\\entities\\User'); $roleRepo = $em->getRepository('model\\entities\\Role'); $page->run(); $tmpl->self = $page->self; $tmpl->code = isset($_GET['code']) ? $_GET['code'] : -1; $userid = isset($_GET['uid']) ? $_GET['uid'] : $_SESSION['userid']; $tmpl->action = isset($_GET['a']) ? $_GET['a'] : 'manage'; if ($userid == $_SESSION['userid']) { $user = $userRepo->find($userid); } else { $attempt = $userRepo->find($userid); if ($tmpl->self->getAuthentication()->getRole()->getId() == 1) { $user = $attempt; } else { $user = $tmpl->self; } } //form fields $data['fname'] = isset($_GET['fname']) ? $_GET['fname'] != null ? $_GET['fname'] : ($tmpl->action == 'manage' ? $user->getFname() : null) : ($tmpl->action == 'manage' ? $user->getFname() : null); $data['lname'] = isset($_GET['lname']) ? $_GET['lname'] != null ? $_GET['lname'] : ($tmpl->action == 'manage' ? $user->getLname() : null) : ($tmpl->action == 'manage' ? $user->getLname() : null); $data['gender'] = isset($_GET['gender']) ? $_GET['gender'] != null ? $_GET['gender'] : ($tmpl->action == 'manage' ? $user->getGender() : null) : ($tmpl->action == 'manage' ? $user->getGender() : null); $data['email'] = isset($_GET['email']) ? $_GET['email'] != null ? $_GET['email'] : ($tmpl->action == 'manage' ? $user->getContacts()[0]->getEmail() : ($tmpl->action == 'login' ? $user->getAuthentication()->getIdentity() : null)) : ($tmpl->action == 'manage' ? $user->getContacts()[0]->getEmail() : ($tmpl->action == 'login' ? $user->getAuthentication()->getIdentity() : null)); $data['phone'] = isset($_GET['phone']) ? $_GET['phone'] != null ? $_GET['phone'] : ($tmpl->action == 'manage' ? $user->getContacts()[0]->getFriendlyPhone() : null) : ($tmpl->action == 'manage' ? $user->getContacts()[0]->getFriendlyPhone() : null);
<?php require_once 'components/system/Preload.php'; $allowed = array(1 => 'Admin'); $page = new \render\Page("Menus", 'menus', $allowed); $tmpl = new \backbone\Template(); $doctrineFactory = new \model\Access(); $menuRepo = $doctrineFactory->getEntityManager()->getRepository('model\\entities\\Menu'); $page->run(); $tmpl->user = $tmpl->control = $tmpl->data = new \stdClass(); $tmpl->user->self = $page->self; $tmpl->control->action = isset($_GET['action']) ? $_GET['action'] : null; $tmpl->control->code = isset($_GET['code']) ? $_GET['code'] : -1; $tmpl->data->menus = $menuRepo->findAll(); $tmpl->data->permit = new \business\Permission(); switch ($tmpl->control->code) { case 0: // filler error $tmpl->control->alert['type'] = "error"; $tmpl->control->alert['message'] = "I'm sorry Dave, I can't let you do that."; break; default: break; } $html = $tmpl->build('menus.html'); $css = $tmpl->build('menus.css'); $js = $tmpl->build('menus.js'); $appContent = array('html' => $html, 'css' => array('code' => $css, 'link' => 'menus'), 'js' => array('code' => $js, 'link' => 'menus')); echo $page->build($appContent);
<?php require_once 'components/system/Preload.php'; $page = new \render\Page("Access Portal", 'index'); $tmpl = new \backbone\Template(); $page->run(); $tmpl->self = $page->self; $tmpl->code = isset($_GET['code']) ? $_GET['code'] : -1; $tmpl->email = isset($_GET['email']) ? $_GET['email'] : null; $tmpl->ve = isset($_GET['vemail']) ? $_GET['vemail'] : null; $tmpl->fname = isset($_GET['fname']) ? $_GET['fname'] : null; $tmpl->lname = isset($_GET['lname']) ? $_GET['lname'] : null; $tmpl->a = isset($_GET['a']) ? $_GET['a'] : 'login'; switch ($tmpl->code) { case 0: // user didn't enter one of the two fields $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "You must enter both an email address and a password."; break; case 1: //user didn't authenticate to a valid account $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "The email + password combination you entered didn't match an active account."; break; case 2: //user isn't logged in at all. $tmpl->alert['type'] = "alert"; $tmpl->alert['message'] = "You'll need to log in before you can view that area of the site."; break; case 3: //fringe case: user types in a page they are not authorized to see