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);
case 18: // reducing the user's role failed because the person trying to do it isn't allowed to $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "It's not possible to reduce the user's role at this time."; break; case 19: // resending verification email succeeded. $tmpl->alert['type'] = "okay"; $tmpl->alert['message'] = "Verification email resent."; break; case 20: // resending email verification failed $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "Verification email could not be sent."; break; case 21: // either you're not allowed to resend the verification, or that user doesn't exist $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "You can't send an email to that user at this time."; break; default: break; } if ($tmpl->action == 'become' && (!$_SESSION['active'] || $_SESSION['roleid'] != 1)) { unset($tmpl->action); } $html = $tmpl->build('users.html'); $css = $tmpl->build('users.css'); $js = $tmpl->build('users.js'); $appContent = array('html' => $html, 'css' => array('code' => $css, 'link' => 'users'), 'js' => array('code' => $js, 'link' => 'users')); echo $page->build($appContent);
$tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "The \"New Password\" and \"Verify New Password\" fields must match."; break; case 5: // User is required to change their password $tmpl->alert['type'] = "alert"; $tmpl->alert['message'] = "You must change your password before continuing."; break; case -1: default: break; } switch (strtolower($user->getGender())) { case 'm': $tmpl->icon = 'user'; break; case 'f': $tmpl->icon = 'user-female'; break; default: $tmpl->icon = 'user-silhouette'; break; } $tmpl->user = $user; $tmpl->data = $data; $tmpl->roles = $roleRepo->findAll(); $html = $tmpl->build('account.html'); $css = $tmpl->build('account.css'); $js = $tmpl->build('account.js'); $appContent = array('html' => $html, 'css' => array('code' => $css, 'link' => 'account'), 'js' => array('code' => $js, 'link' => 'account')); echo $page->build($appContent);
<?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);
$tmpl->alert['message'] = "You must complete all of the fields."; break; case 6: //account was created, email sent $tmpl->alert['type'] = "alert"; $tmpl->alert['message'] = "An email was sent to your address.<br />Please complete your request by clicking the link provided in the email."; break; case 7: //identity unavailable $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = 'That email address is unavailable for use. If this is your email address, <a href="components/authentication/recover.php?email=' . $tmpl->email . '">click here to send a recovery email</a>.'; break; case 8: //failed to create user $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = "An error was encountered while attempting to create the new user. Please try again."; break; case 9: //invalid quick_login code $tmpl->alert['type'] = "error"; $tmpl->alert['message'] = 'That verification code was invalid. Please try again, or <a href="index.php?a=request">click here to create a new account</a>.'; break; case -1: default: break; } $html = $tmpl->build('index.html'); $css = $tmpl->build('index.css'); $js = $tmpl->build('index.js'); $appContent = array('html' => $html, 'css' => array('code' => $css, 'link' => 'index'), 'js' => array('code' => $js, 'link' => 'index')); echo $page->build($appContent);