本文整理汇总了PHP中SpoonHTTP::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP SpoonHTTP::redirect方法的具体用法?PHP SpoonHTTP::redirect怎么用?PHP SpoonHTTP::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpoonHTTP
的用法示例。
在下文中一共展示了SpoonHTTP::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateForm
/**
* Validate the form
*/
protected function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
$fields = $this->frm->getFields();
$fields['email']->isFilled(BL::err('FieldIsRequired'));
if ($this->frm->isCorrect()) {
//--Get the mail
$mailing = BackendMailengineModel::get($this->id);
//--Get the template
$template = BackendMailengineModel::getTemplate($mailing['template_id']);
//--Create basic mail
$text = BackendMailengineModel::createMail($mailing, $template);
$mailing['from_email'] = $template['from_email'];
$mailing['from_name'] = html_entity_decode($template['from_name']);
$mailing['reply_email'] = $template['reply_email'];
$mailing['reply_name'] = html_entity_decode($template['reply_name']);
$emails = explode(',', $fields['email']->getValue());
if (!empty($emails)) {
foreach ($emails as $email) {
$email = trim($email);
if (\SpoonFilter::isEmail($email)) {
//--Send test mailing
BackendMailengineModel::sendMail(html_entity_decode($mailing['subject']), $text, $email, 'Test Recepient', $mailing);
}
}
}
//--Redirect
\SpoonHTTP::redirect(BackendModel::createURLForAction('index', $this->module) . "&id=" . $this->id . "&report=TestEmailSend");
}
}
$this->frm->parse($this->tpl);
}
示例2: __construct
/**
* Check if all required settings have been set
*
* @param string $module The module.
*/
public function __construct($module)
{
parent::__construct($module);
$error = false;
$action = Spoon::exists('url') ? Spoon::get('url')->getAction() : null;
// analytics session token
if (BackendModel::getModuleSetting('analytics', 'session_token') === null) {
$error = true;
}
// analytics table id
if (BackendModel::getModuleSetting('analytics', 'table_id') === null) {
$error = true;
}
// missing settings, so redirect to the index-page to show a message (except on the index- and settings-page)
if ($error && $action != 'settings' && $action != 'index') {
SpoonHTTP::redirect(BackendModel::createURLForAction('index'));
}
}
示例3: validateForm
/**
* Validate the form based on the variables in $_POST
*
* @return void
*/
private function validateForm()
{
// form submitted
if ($this->frm->isSubmitted()) {
// required fields
$this->frm->getField('email')->isEmail('Please provide a valid e-mailaddress.');
$this->frm->getField('password')->isFilled('This field is required.');
$this->frm->getField('confirm')->isFilled('This field is required.');
if ($this->frm->getField('password')->getValue() != $this->frm->getField('confirm')->getValue()) {
$this->frm->getField('confirm')->addError('The passwords do not match.');
}
// all valid
if ($this->frm->isCorrect()) {
// update session
SpoonSession::set('email', $this->frm->getField('email')->getValue());
SpoonSession::set('password', $this->frm->getField('password')->getValue());
SpoonSession::set('confirm', $this->frm->getField('confirm')->getValue());
// redirect
SpoonHTTP::redirect('index.php?step=7');
}
}
}
示例4: validateForm
protected function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validation
$fields = $this->frm->getFields();
if ($this->frm->isCorrect()) {
$groups = array();
$profilesAll = 0;
$profileGroups = array();
$users = array();
//--Get all the groups
$groups = $fields["groups"]->getValue();
//--Check if mailengine groups are selected
if (!empty($groups)) {
//--Get the users for the groups
$usersTemp = BackendMailengineModel::getUniqueEmailsFromGroups($groups);
//--Add the groups
if (is_array($usersTemp)) {
$users = array_merge($users, $usersTemp);
}
}
//--Check if there are profile groups checked
if (isset($fields["profile_groups"])) {
//--Get all the groups
$profileGroups = $fields["profile_groups"]->getValue();
if (!empty($profileGroups)) {
//--Get the users for the groups
$usersTemp = BackendMailengineModel::getUniqueEmailsFromProfileGroups($profileGroups);
//--Add the groups
if (is_array($usersTemp)) {
$users = array_merge($users, $usersTemp);
}
}
}
//--Check if all profiles is selected
if (isset($fields["profiles_all"])) {
if ($fields['profiles_all']->getValue() == 1) {
$profilesAll = 1;
$usersTemp = BackendMailengineModel::getUniqueEmailsFromProfiles();
if (is_array($usersTemp)) {
$users = array_merge($users, $usersTemp);
}
}
}
//--Loop all the users and set the e-mail as key to remove duplicate e-mails
$usersTemp = array();
foreach ($users as $user) {
if (!isset($usersTemp[$user['email']])) {
$usersTemp[$user['email']] = $user;
}
}
//--Reset users-array to the unduplicate array
$users = $usersTemp;
//--Count users
$countUsers = count($users);
//--Create label
$labelUsers = $countUsers == 1 ? BL::lbl("User") : BL::lbl("Users");
$this->tpl->assign("users", $users);
$this->tpl->assign("countUsers", $countUsers);
$this->tpl->assign("labelUsers", $labelUsers);
if ($countUsers == 0) {
$this->tpl->assign("errorUsers", true);
$this->tpl->assign("back", BackendModel::createURLForAction($this->action, $this->module) . "&id=" . $this->id);
}
//--Add hidden fields to form
$this->frm_review->addHidden("groups", implode(",", $groups));
$this->frm_review->addHidden("profiles_all", $profilesAll);
$this->frm_review->addHidden("profile_groups", implode(",", $profileGroups));
$this->frm_review->addHidden("start_date", $fields["start_date"]->getValue());
$this->frm_review->addHidden("start_time", $fields["start_time"]->getValue());
//--Parse Form Review
$this->parseFormReview();
} else {
//--Parse Form Preview
$this->parseFormPreview();
}
} elseif ($this->frm_review->isSubmitted()) {
//--Check if form_review is submitted
$fields = $this->frm_review->getFields();
if ($this->frm_review->isCorrect()) {
//--Insert mailing in ready-to-send-database
$readyToSendId = BackendMailengineModel::insertMailingInReadyToSendDatabase($this->id, BackendModel::getUTCDate(null, BackendModel::getUTCTimestamp($fields['start_date'], $fields['start_time'])));
//--Insert users in ready-to-send-database
$groups = $fields["groups"]->getValue();
$profilesAll = $fields["profiles_all"]->getValue();
$profileGroups = $fields["profile_groups"]->getValue();
BackendMailengineModel::insertUsersInReadyToSendDatabase($readyToSendId, $groups, $profileGroups, $profilesAll);
//--Redirect
\SpoonHTTP::redirect(BackendModel::createURLForAction($this->action, $this->module) . "&id=" . $this->id . "&ready=1");
}
} else {
//--Parse Form Preview
$this->parseFormPreview();
}
}
示例5: validateForm
/**
* Validate the form based on the variables in $_POST
*/
private function validateForm()
{
// form submitted
if ($this->frm->isSubmitted()) {
// validate email address
if ($this->frm->getField('different_debug_email')->isChecked()) {
$this->frm->getField('debug_email')->isEmail('Please provide a valid e-mailaddress.');
}
// all valid
if ($this->frm->isCorrect()) {
// get selected modules
$modules = $this->frm->getField('modules')->getValue();
// add blog if example data was checked
if ($this->frm->getField('example_data')->getChecked() && !in_array('blog', $modules)) {
$modules[] = 'blog';
}
// set modules
SpoonSession::set('modules', $modules);
// example data
SpoonSession::set('example_data', $this->frm->getField('example_data')->getChecked());
// debug mode
SpoonSession::set('debug_mode', $this->frm->getField('debug_mode')->getChecked());
// specific debug email address
SpoonSession::set('different_debug_email', $this->frm->getField('different_debug_email')->getChecked());
// specific debug email address text
SpoonSession::set('debug_email', $this->frm->getField('debug_email')->getValue());
// redirect
SpoonHTTP::redirect('index.php?step=5');
}
}
}
示例6: redirectToLoadingPage
/**
* Redirect to the loading page after checking for infinite loops.
*
* @return void
* @param string $action The action to check for infinite loops.
* @param array[optional] $extraParameters The extra parameters to append to the redirect url.
*/
public static function redirectToLoadingPage($action, array $extraParameters = array())
{
// get loop counter
$counter = SpoonSession::exists($action . 'Loop') ? SpoonSession::get($action . 'Loop') : 0;
// loop has run too long - throw exception
if ($counter > 2) {
throw new BackendException('An infinite loop has been detected while getting data from cache for the action "' . $action . '".');
}
// set new counter
SpoonSession::set($action . 'Loop', ++$counter);
// put parameters into a string
$extraParameters = empty($extraParameters) ? '' : '&' . http_build_query($extraParameters);
// redirect to loading page which will get the needed data based on the current action
SpoonHTTP::redirect(BackendModel::createURLForAction('loading') . '&redirect_action=' . $action . $extraParameters);
}
示例7: processRegularRequest
/**
* Process a regular request
*
* @param string $module The requested module.
* @param string $action The requested action.
* @param strring $language The requested language.
*/
private function processRegularRequest($module, $action, $language)
{
// the person isn't logged in? or the module doesn't require authentication
if (!BackendAuthentication::isLoggedIn() && !BackendAuthentication::isAllowedModule($module)) {
// redirect to login
SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/authentication/?querystring=' . urlencode('/' . $this->getQueryString()));
} else {
// does our user has access to this module?
if (!BackendAuthentication::isAllowedModule($module)) {
// if the module is the dashboard redirect to the first allowed module
if ($module == 'dashboard') {
// require navigation-file
require_once BACKEND_CACHE_PATH . '/navigation/navigation.php';
// loop the navigation to find the first allowed module
foreach ($navigation as $key => $value) {
// split up chunks
list($module, $action) = explode('/', $value['url']);
// user allowed?
if (BackendAuthentication::isAllowedModule($module)) {
// redirect to the page
SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/' . $value['url']);
}
}
}
// the user doesn't have access, redirect to error page
SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=module-not-allowed&querystring=' . urlencode('/' . $this->getQueryString()));
} else {
// can our user execute the requested action?
if (!BackendAuthentication::isAllowedAction($action, $module)) {
// the user hasn't access, redirect to error page
SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=action-not-allowed&querystring=' . urlencode('/' . $this->getQueryString()));
} else {
// set the working language, this is not the interface language
BackendLanguage::setWorkingLanguage($language);
$this->setLocale();
$this->setModule($module);
$this->setAction($action);
}
}
}
}
示例8: processQueryString
/**
* Process the query string
*/
private function processQueryString()
{
// store the query string local, so we don't alter it.
$queryString = trim($this->request->getPathInfo(), '/');
// split into chunks
$chunks = (array) explode('/', $queryString);
$hasMultiLanguages = $this->getContainer()->getParameter('site.multilanguage');
// single language
if (!$hasMultiLanguages) {
// set language id
$language = $this->get('fork.settings')->get('Core', 'default_language', SITE_DEFAULT_LANGUAGE);
} else {
// multiple languages
// default value
$mustRedirect = false;
// get possible languages
$possibleLanguages = (array) Language::getActiveLanguages();
$redirectLanguages = (array) Language::getRedirectLanguages();
// the language is present in the URL
if (isset($chunks[0]) && in_array($chunks[0], $possibleLanguages)) {
// define language
$language = (string) $chunks[0];
// try to set a cookie with the language
try {
// set cookie
CommonCookie::set('frontend_language', $language);
} catch (\SpoonCookieException $e) {
// settings cookies isn't allowed, because this isn't a real problem we ignore the exception
}
// set sessions
\SpoonSession::set('frontend_language', $language);
// remove the language part
array_shift($chunks);
} elseif (CommonCookie::exists('frontend_language') && in_array(CommonCookie::get('frontend_language'), $redirectLanguages)) {
// set languageId
$language = (string) CommonCookie::get('frontend_language');
// redirect is needed
$mustRedirect = true;
} else {
// default browser language
// set languageId & abbreviation
$language = Language::getBrowserLanguage();
// try to set a cookie with the language
try {
// set cookie
CommonCookie::set('frontend_language', $language);
} catch (\SpoonCookieException $e) {
// settings cookies isn't allowed, because this isn't a real problem we ignore the exception
}
// redirect is needed
$mustRedirect = true;
}
// redirect is required
if ($mustRedirect) {
// build URL
$URL = rtrim('/' . $language . '/' . $this->getQueryString(), '/');
// when we are just adding the language to the domain, it's a temporary redirect because
// Safari keeps the 301 in cache, so the cookie to switch language doesn't work any more
$redirectCode = $URL == '/' . $language ? 302 : 301;
// set header & redirect
\SpoonHTTP::redirect($URL, $redirectCode);
}
}
// define the language
defined('FRONTEND_LANGUAGE') || define('FRONTEND_LANGUAGE', $language);
// sets the locale file
Language::setLocale($language);
// list of pageIds & their full URL
$keys = Navigation::getKeys();
// rebuild our URL, but without the language parameter. (it's tripped earlier)
$URL = implode('/', $chunks);
$startURL = $URL;
// loop until we find the URL in the list of pages
while (!in_array($URL, $keys)) {
// remove the last chunk
array_pop($chunks);
// redefine the URL
$URL = implode('/', $chunks);
}
// remove language from query string
if ($hasMultiLanguages) {
$queryString = trim(substr($queryString, strlen($language)), '/');
}
// if it's the homepage AND parameters were given (not allowed!)
if ($URL == '' && $queryString != '') {
// get 404 URL
$URL = Navigation::getURL(404);
// remove language
if ($hasMultiLanguages) {
$URL = str_replace('/' . $language, '', $URL);
}
}
// set pages
$URL = trim($URL, '/');
// currently not in the homepage
if ($URL != '') {
// explode in pages
//.........这里部分代码省略.........
示例9: strtotime
if (SpoonSession::exists('id') === false) {
SpoonHTTP::redirect('index.php');
}
$latestCheckIn = CheckIn::getLatestCheckinByUserId(SpoonSession::get('id'));
$daysAgo = (SpoonDate::getDate("m.d.j") - SpoonDate::getDate("m.d.j", strtotime($latestCheckIn->timestamp))) * 100;
$timeAgo = SpoonDate::getDate("H:i:s") - SpoonDate::getDate("H:i:s", strtotime($latestCheckIn->timestamp));
//If the checkin is within 5 hours
//if($timeAgo > -6){
$tpl->assign('oCheckIn', true);
if (SpoonFilter::getGetValue('event', null, '') === 'plus') {
$latestCheckIn->AddTab(SpoonFilter::getGetValue('drinkid', null, ''));
SpoonHTTP::redirect('checkin.php');
} else {
if (SpoonFilter::getGetValue('event', null, '') === 'min') {
$latestCheckIn->DeleteTab(SpoonFilter::getGetValue('drinkid', null, ''));
SpoonHTTP::redirect('checkin.php');
}
}
$tpl->assign('pub_id', $latestCheckIn->pub->pub_id);
$tpl->assign('name', $latestCheckIn->pub->name);
$tpl->assign('longitude', $latestCheckIn->pub->longitude);
$tpl->assign('latitude', $latestCheckIn->pub->latitude);
$tpl->assign('people', $latestCheckIn->pub->getNumberPeople());
$tpl->assign('checkins', $latestCheckIn->pub->getNumberCheckins());
$tabs = $latestCheckIn->getTabs();
if ($tabs[0] !== null) {
$tpl->assign('iTabs', $tabs);
$tpl->assign('oTabs', true);
} else {
$tpl->assign('iTabs', array());
$tpl->assign('oNoTabs', true);
示例10: error_log
error_log($e);
}
}
// facebook javascript
$tpl->assign('appid', $facebook->getAppId());
$tpl->assign('session', json_encode($session));
// facebook buttons
if (!$me) {
$tpl->assign('fbcbutton', '<fb:login-button perms="email"></fb:login-button>');
} else {
$tpl->assign('fbcbutton', '<p class="connected"><img src="img/check.png">Connected to Facebook<p>');
}
// fill in form
if ($me) {
//Spoon::dump($me);
$tpl->assign('fname', $me['first_name']);
$tpl->assign('lname', $me['last_name']);
$tpl->assign('email', $me['email']);
$tpl->assign('fb_uid', $uid);
}
// reeds ingelogd
if (SpoonSession::exists('public_uid')) {
SpoonHTTP::redirect('dashboard.php');
}
/*
* End the register magic
* @joenmaes
*/
// show the output
$tpl->assign('content', $tpl->getContent('templates/register.tpl'));
$tpl->display('templates/layout.tpl');
示例11: Pub
SpoonSession::start();
//Content layout
if (SpoonSession::exists('id') === false) {
SpoonHTTP::redirect('index.php');
}
$lat = SpoonFilter::getGetValue('lat', null, '');
$long = SpoonFilter::getGetValue('long', null, '');
$tpl->assign('formaction', $_SERVER['PHP_SELF'] . '?lat=' . $lat . '&long=' . $long);
$msgFault = '';
$pubname = SpoonFilter::getPostValue('pubname', null, '');
if (SpoonFilter::getPostValue('btnAdd', null, '')) {
if ($pubname === "") {
$msgFault = "Please fill in the name of the pub.";
} else {
if ($lat !== "" && $long !== "") {
$pub = new Pub('');
$pub->name = $pubname;
$pub->latitude = $lat;
$pub->longitude = $long;
$id = $pub->Add();
SpoonHTTP::redirect('pubDetail.php?id=' . $id);
}
}
}
$tpl->assign('pubname', $pubname);
$tpl->assign('msgFault', $msgFault);
$tpl->assign('latitude', $lat);
$tpl->assign('longitude', $long);
// show the output
$tpl->assign('content', $tpl->getContent('templates/addPub.tpl'));
$tpl->display('templates/template.tpl');
示例12: processQueryString
/**
* Process the querystring
*
* @return void
*/
private function processQueryString()
{
// store the querystring local, so we don't alter it.
$queryString = $this->getQueryString();
// find the position of ? (which seperates real URL and GET-parameters)
$positionQuestionMark = strpos($queryString, '?');
// remove the GET-chunk from the parameters
$processedQueryString = $positionQuestionMark === false ? $queryString : substr($queryString, 0, $positionQuestionMark);
// split into chunks, a Backend URL will always look like /<lang>/<module>/<action>(?GET)
$chunks = (array) explode('/', trim($processedQueryString, '/'));
// check if this is a request for a JS-file
$isJS = isset($chunks[1]) && $chunks[1] == 'js.php';
// check if this is a request for a AJAX-file
$isAJAX = isset($chunks[1]) && $chunks[1] == 'ajax.php';
// get the language, this will always be in front
$language = isset($chunks[1]) && $chunks[1] != '' ? SpoonFilter::getValue($chunks[1], array_keys(BackendLanguage::getWorkingLanguages()), '') : '';
// no language provided?
if ($language == '' && !$isJS && !$isAJAX) {
// remove first element
array_shift($chunks);
// redirect to login
SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . SITE_DEFAULT_LANGUAGE . '/' . implode('/', $chunks));
}
// get the module, null will be the default
$module = isset($chunks[2]) && $chunks[2] != '' ? $chunks[2] : 'dashboard';
// get the requested action, if it is passed
if (isset($chunks[3]) && $chunks[3] != '') {
$action = $chunks[3];
} elseif (!$isJS && !$isAJAX) {
// build path to the module and define it. This is a constant because we can use this in templates.
if (!defined('BACKEND_MODULE_PATH')) {
define('BACKEND_MODULE_PATH', BACKEND_MODULES_PATH . '/' . $module);
}
// check if the config is present? If it isn't present there is a huge problem, so we will stop our code by throwing an error
if (!SpoonFile::exists(BACKEND_MODULE_PATH . '/config.php')) {
throw new BackendException('The configfile for the module (' . $module . ') can\'t be found.');
}
// build config-object-name
$configClassName = 'Backend' . SpoonFilter::toCamelCase($module . '_config');
// require the config file, we validated before for existence.
require_once BACKEND_MODULE_PATH . '/config.php';
// validate if class exists (aka has correct name)
if (!class_exists($configClassName)) {
throw new BackendException('The config file is present, but the classname should be: ' . $configClassName . '.');
}
// create config-object, the constructor will do some magic
$config = new $configClassName($module);
// set action
$action = $config->getDefaultAction() !== null ? $config->getDefaultAction() : 'index';
}
// if it is an request for a JS-file or an AJAX-file we only need the module
if ($isJS || $isAJAX) {
// set the working language, this is not the interface language
BackendLanguage::setWorkingLanguage(SpoonFilter::getGetValue('language', null, SITE_DEFAULT_LANGUAGE));
// set current module
$this->setModule(SpoonFilter::getGetValue('module', null, null));
// set action
$this->setAction('index');
} else {
// the person isn't logged in? or the module doesn't require authentication
if (!BackendAuthentication::isLoggedIn() && !BackendAuthentication::isAllowedModule($module)) {
// redirect to login
SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/authentication/?querystring=' . urlencode('/' . $this->getQueryString()));
} else {
// does our user has access to this module?
if (!BackendAuthentication::isAllowedModule($module)) {
// the user doesn't have access, redirect to error page
SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=module-not-allowed&querystring=' . urlencode('/' . $this->getQueryString()));
} else {
// can our user execute the requested action?
if (!BackendAuthentication::isAllowedAction($action, $module)) {
// the user hasn't access, redirect to error page
SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=action-not-allowed&querystring=' . urlencode('/' . $this->getQueryString()));
} else {
// set the working language, this is not the interface language
BackendLanguage::setWorkingLanguage($language);
// is the user authenticated
if (BackendAuthentication::getUser()->isAuthenticated()) {
// set interface language based on the user preferences
BackendLanguage::setLocale(BackendAuthentication::getUser()->getSetting('interface_language', 'nl'));
} else {
// init var
$interfaceLanguage = BackendModel::getModuleSetting('core', 'default_interface_language');
// override with cookie value if that exists
if (SpoonCookie::exists('interface_language') && in_array(SpoonCookie::get('interface_language'), array_keys(BackendLanguage::getInterfaceLanguages()))) {
// set interface language based on the perons' cookies
$interfaceLanguage = SpoonCookie::get('interface_language');
}
// set interface language
BackendLanguage::setLocale($interfaceLanguage);
}
// set current module
$this->setModule($module);
$this->setAction($action);
}
//.........这里部分代码省略.........
示例13: User
$tpl->assign('oNoRecent', true);
}
if ($user->GetTopPubs(5) !== null) {
$tpl->assign('oTopPubs', true);
$tpl->assign('iTopPubs', $user->GetTopPubs(5));
} else {
$tpl->assign('oNoTopPubs', true);
}
$tpl->assign('fb_uid', $user->fb_uid);
$tpl->assign('name', $user->first_name . ' ' . $user->last_name);
$tpl->assign('user_id', $user->user_id);
// if user is logged in and it's not his own profile show add as friend button
if (SpoonSession::exists('public_uid') && SpoonSession::get('public_uid') != $user->user_id) {
$loggedInUser = new User(SpoonSession::get('public_uid'), null, '');
if (!$loggedInUser->isFriend($user->user_id)) {
$tpl->assign('oAddFriend', true);
} else {
$tpl->assign('oDeleteFriend', true);
}
}
if (SpoonFilter::getGetValue('follow', null, '') == 'true') {
$loggedInUser->follow($user->user_id);
SpoonHTTP::redirect('/users/' . $user->user_id);
}
if (SpoonFilter::getGetValue('follow', null, '') == 'false') {
$loggedInUser->unfollow($user->user_id);
SpoonHTTP::redirect('/users/' . $user->user_id);
}
// show the output
$tpl->assign('content', $tpl->getContent('templates/userDetail.tpl'));
$tpl->display('templates/layout.tpl');
示例14: validateForm
/**
* Validate the form based on the variables in $_POST
*/
private function validateForm()
{
// form submitted
if ($this->frm->isSubmitted()) {
// all valid
if ($this->frm->isCorrect()) {
// get selected modules
$modules = $this->frm->getField('modules')->getValue();
// add blog if example data was checked
if ($this->frm->getField('example_data')->getChecked() && !in_array('blog', $modules)) {
$modules[] = 'blog';
}
// set modules
SpoonSession::set('modules', $modules);
// example data
SpoonSession::set('example_data', $this->frm->getField('example_data')->getChecked());
// debug mode
SpoonSession::set('debug_mode', $this->frm->getField('debug_mode')->getChecked());
// redirect
SpoonHTTP::redirect('index.php?step=5');
}
}
}
示例15: date_default_timezone_set
<?php
date_default_timezone_set('Europe/Berlin');
// set include path
ini_set("include_path", ".:../library/");
// required classes
require_once 'spoon/spoon.php';
require_once 'publicApp/publicApp.php';
// facebook php
require_once 'facebook/facebook.php';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array('appId' => '177481728946474', 'secret' => '6d5db3a0e538eb5aa7bebe6ae0bb2efe', 'cookie' => true));
$session = $facebook->getSession();
// Session based API call.
if ($session) {
try {
$fb_uid = $facebook->getUser();
$db = new SpoonDatabase('mysql', 'localhost', 'xqdchsmn_public', 'pRAcHU8Ajath7qa3', 'xqdchsmn_public');
$var = $db->getRecord('SELECT * FROM users WHERE fb_uid = ?', $fb_uid);
if (!empty($var)) {
spoonSession::start();
SpoonSession::set('public_uid', $var['user_id']);
SpoonHTTP::redirect('dashboard.php');
} else {
SpoonHTTP::redirect('register.php');
}
} catch (FacebookApiException $e) {
error_log($e);
}
}