本文整理汇总了PHP中Utils::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::redirect方法的具体用法?PHP Utils::redirect怎么用?PHP Utils::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils
的用法示例。
在下文中一共展示了Utils::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_import
/**
* Handles the submission of the import form, importing data from a WordPress database.
* This function should probably be broken into an importer class, since it is WordPress-specific.
*/
public function post_import()
{
if (!isset($_POST['importer'])) {
Utils::redirect(URL::get('display_import'));
}
$this->get_import();
}
示例2: action_form_publish
public function action_form_publish($form, $post)
{
$selector = $form->append('wrapper', 'type_selector');
$selector->class = 'container';
// Utils::debug( 'bob' );
if (Controller::get_var('to_type') != NULL && $post->content_type != Controller::get_var('to_type')) {
/* set type */
$post->content_type = Post::type(Controller::get_var('to_type'));
$post->update();
Utils::redirect(URL::get('admin', 'page=publish&id=' . $post->id));
// Refresh view
}
foreach (Post::list_active_post_types() as $type) {
if ($type != 0) {
if ($post->id == 0) {
$url = URL::get('admin', 'page=publish&content_type=' . Post::type_name($type));
} else {
$url = URL::get('admin', 'page=publish&to_type=' . Post::type_name($type) . '&id=' . $post->id);
}
$html = '<a href="' . $url . '"';
if (Post::type_name($type) == $post->content_type || $type == $post->content_type) {
$html .= ' class="active"';
}
$html .= '>' . Post::type_name($type) . '</a>';
$selector->append('static', 'type_selector_' . $type, $html);
}
}
$selector->move_before($selector, $form);
return $form;
}
示例3: run
public function run()
{
$msg = '';
if (!empty($_POST['submit'])) {
if (!empty($_POST['password'])) {
$user = new User();
if ($user->findUserByUsername($_POST['username'])) {
if ($user->getForgot_hash() == $_REQUEST['token']) {
$password = '{crypt}' . Utils::encryptPassword($_POST['password']);
$user->setPassword($password)->setForgot_hash(md5(uniqid()))->save();
Utils::sendTemplateEmail($_POST['username'], 'changed_pass', array('app_name' => APP_NAME));
Utils::redirect('./');
}
} else {
$msg = 'The link to reset your password has expired or is invalid. <a href="./forgot">Please try again.</a>';
}
} else {
$msg = "Please enter a password!";
}
}
if (empty($_REQUEST['token'])) {
// no required information specified, redirect user
$this->view = null;
Utils::redirect('./');
}
$this->write('msg', $msg);
$this->write('un', isset($_REQUEST['un']) ? base64_decode($_REQUEST['un']) : "");
$this->write('token', $_REQUEST['token']);
parent::run();
}
示例4: post_import
/**
* Handles the submission of the import form, importing data from a WordPress database.
* This function should probably be broken into an importer class, since it is WordPress-specific.
*/
public function post_import()
{
if (!isset($_POST['importer'])) {
Utils::redirect(URL::get('admin', 'page=import'));
}
$this->get_import();
}
示例5: getContent
public function getContent()
{
if (LoggedUser::whoIsLogged()) {
if (isset($_COOKIE['ref_url'])) {
$url = $_COOKIE['ref_url'];
$absolute = FALSE;
} else {
$page = PageActionMap::getPageByTypeAndLanguage('rooms');
$url = PageActionMap::createUrl($page['alias']);
$absolute = TRUE;
}
Utils::redirect($url, $absolute);
}
if (Utils::post('login')) {
MySmarty::assign('username', Utils::post('username'));
$validation = LoggedUser::userLogin();
//var_Dump($validation);exit();
if ($validation === TRUE) {
Utils::redirect(Utils::getActualUrlWithoutGetParameters(), FALSE);
} else {
MySmarty::assign('errors', $validation);
}
}
return MySmarty::fetch('login.tpl');
}
示例6: getContent
public function getContent()
{
$loggedUser = LoggedUser::whoIsLogged();
if ($loggedUser !== NULL) {
LoggedUser::userLogout();
}
Utils::redirect(Utils::getActualUrl(), FALSE);
}
示例7: updated_config
public function updated_config(FormUI $ui)
{
Session::notice(_t('Settings saved.', 's3siloplugin'));
$ui->save();
if (is_null(Options::get('s3_bucket'))) {
Session::notice(_t('Please select a bucket from your S3 account.', 's3siloplugin'));
}
Utils::redirect();
}
示例8: filter_do_replace
/**
* Handler FormUI success action and do the replacement
**/
public function filter_do_replace($show_form, $form)
{
if (DB::query('UPDATE {posts} SET content = REPLACE(content, ? , ?)', array($form->search->value, $form->replace->value))) {
Session::notice(sprintf(_t('Successfully replaced \'%s\' with \'%s\' in all posts'), $form->search->value, $form->replace->value));
Utils::redirect(URL::get('admin', array('page' => 'plugins', 'configure' => Plugins::id_from_file(__FILE__), 'configaction' => _t('Replace'))), false);
} else {
Session::error(_t('There was an error with replacement.'));
}
return false;
}
示例9: logout
public function logout($redirect = null)
{
unset($this->user);
unset($this->token);
Session::instance('ThinSession')->forgetAuthToken();
Session::instance('ThinSession')->forgetAuthUser();
if (null !== $redirect) {
Utils::redirect($redirect);
}
}
示例10: action_init
/**
* function action_init
* A function which makes sure we are good to go for plugin activation.
*/
public function action_init()
{
if (!class_exists('RenderCache')) {
Session::error(_t("LaTeX activation failed. This plugin requires the RenderCache class which was not found."));
Plugins::deactivate_plugin(__FILE__);
//Deactivate plugin
Utils::redirect();
//Refresh page. Unfortunately, if not done so then results don't appear
}
}
示例11: do_success
/**
* This control only executes its on_success callbacks when it was clicked
* @return bool|string A string to replace the rendering of the form with, or false
*/
public function do_success($form)
{
$actions = $this->get_setting('actions', array());
if (isset($actions[$this->value])) {
if (isset($actions[$this->value]['fn']) && is_callable($actions[$this->value]['fn'])) {
$fn = $actions[$this->value]['fn'];
call_user_func($fn, $form);
} elseif (isset($actions[$this->value]['href']) && is_string(isset($actions[$this->value]['href']))) {
Utils::redirect($actions[$this->value]['href'], true);
}
}
return parent::do_success($form);
}
示例12: action_init
/**
* Initialize by added directory variables
*/
public function action_init()
{
$this->logs = dirname(__FILE__) . '/logs';
$this->cache = dirname(__FILE__) . '/cache';
if (!$this->confirm_dirs($error)) {
Session::error("Clickheat error: {$error}");
Plugins::deactivate_plugin(__FILE__);
// Deactivate plugin
Utils::redirect();
//Refresh page
exit;
}
}
示例13: run
public function run()
{
$msg = "";
$to = 1;
$user = new User();
if (isset($_REQUEST['str'])) {
$email = mysql_real_escape_string(base64_decode($_REQUEST['str']));
$confirm_string = substr($_REQUEST['cs'], 0, 10);
// verify the email belongs to a user
if ($user->findUserByUsername($email) && substr($user->getConfirm_string(), 0, 10) == $confirm_string) {
$sql = "\n UPDATE " . USERS . "\n SET\n confirm_string = '',\n confirm = 1,\n is_active = 1\n WHERE username = '" . $email . "'";
mysql_query($sql);
// send welcome email
Utils::sendTemplateEmail($user->getUsername(), 'welcome', array('nickname' => $user->getNickname()), 'Worklist <contact@worklist.net>');
User::login($user, false);
//Optionally can login with confirm URL
$jumbotron = "\n <h2>Welcome to Worklist!</h2>\n <p>\n Click on a job and add your bid, or come join us in our \n <a href='https://gitter.im/highfidelity/worklist' target='_blank'>public chat room</a>.\n Questions? Check out the <a href='./help'>help tab</a>.\n </p>";
} else {
Utils::redirect('./');
}
} elseif (isset($_REQUEST['ppstr'])) {
// paypal address confirmation
$paypal_email = mysql_real_escape_string(base64_decode($_REQUEST['ppstr']));
$hash = mysql_real_escape_string($_REQUEST['pp']);
// verify the email belongs to a user
if (!$user->findUserByPPUsername($paypal_email, $hash)) {
// hacking attempt, or some other error
Utils::redirect('./');
} else {
$user->setPaypal_verified(true);
$user->setPaypal_hash('');
$user->save();
$jumbotron = "\n <h2>Thank you for confirming your Paypal address.</h2>\n <p>You can now bid on items in the Worklist!</p>";
}
} elseif (isset($_REQUEST['emstr'])) {
// new email address confirmation
$new_email = mysql_real_escape_string(base64_decode($_REQUEST['emstr']));
if (!$user->findUserByUsername($_SESSION['username'])) {
Utils::redirect('login');
//we are not logged in
}
//save new email
$user->setUsername($new_email);
$user->save();
$_SESSION['username'] = $new_email;
$jumbotron = "<h2>Thank you for confirming your changed email address.</h2>";
}
$jobs = new JobController();
$jobs->view->jumbotron = $jumbotron;
$jobs->listView();
}
示例14: action_admin_theme_get_rules
function action_admin_theme_get_rules($handler, $theme)
{
$handler_vars = $handler->handler_vars;
if (isset($handler_vars['names'])) {
foreach ($handler_vars['names'] as $key => $name) {
$changes = array('name' => $name, 'parse_regex' => $handler_vars['regexes'][$key], 'action' => $handler_vars['actions'][$key], 'priority' => $handler_vars['priorities'][$key], 'description' => $handler_vars['descriptions'][$key]);
self::add_rewrite_rule($key, $changes);
}
Session::notice(_t('Rewrite rules updated.'));
Utils::redirect();
}
$theme->display('rules');
exit;
}
示例15: action_init
/**
* Initialize some internal values when plugin initializes
*/
public function action_init()
{
$user_path = HABARI_PATH . '/' . Site::get_path('user', true);
$this->root = $user_path . 'files';
//Options::get('simple_file_root');
$this->url = Site::get_url('user', true) . 'files';
//Options::get('simple_file_url');
if (!$this->check_files()) {
Session::error(_t("Habari Silo activation failed. The web server does not have permission to create the 'files' directory for the Habari Media Silo."));
Plugins::deactivate_plugin(__FILE__);
//Deactivate plugin
Utils::redirect();
//Refresh page. Unfortunately, if not done so then results don't appear
}
}