当前位置: 首页>>代码示例>>PHP>>正文


PHP Utils::redirect方法代码示例

本文整理汇总了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();
 }
开发者ID:habari,项目名称:system,代码行数:11,代码来源:adminimporthandler.php

示例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;
 }
开发者ID:habari-extras,项目名称:supertypes,代码行数:30,代码来源:supertypes.plugin.php

示例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();
 }
开发者ID:MaitreyaBuddha,项目名称:worklist,代码行数:30,代码来源:ResetPass.php

示例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();
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:11,代码来源:adminimporthandler.php

示例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');
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:25,代码来源:LoginAction.php

示例6: getContent

 public function getContent()
 {
     $loggedUser = LoggedUser::whoIsLogged();
     if ($loggedUser !== NULL) {
         LoggedUser::userLogout();
     }
     Utils::redirect(Utils::getActualUrl(), FALSE);
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:8,代码来源:LogoutAction.php

示例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();
 }
开发者ID:ringmaster,项目名称:s3silo,代码行数:9,代码来源:s3silo.plugin.php

示例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;
 }
开发者ID:habari-extras,项目名称:freeplace,代码行数:13,代码来源:freeplace.plugin.php

示例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);
     }
 }
开发者ID:schpill,项目名称:thin,代码行数:10,代码来源:Auth.php

示例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
     }
 }
开发者ID:justinjstark,项目名称:jLaTeX,代码行数:14,代码来源:jLaTeX.plugin.php

示例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);
 }
开发者ID:habari,项目名称:system,代码行数:17,代码来源:formcontroldropbutton.php

示例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;
     }
 }
开发者ID:habari-extras,项目名称:clickheat,代码行数:16,代码来源:clickheat.plugin.php

示例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();
 }
开发者ID:MaitreyaBuddha,项目名称:worklist,代码行数:51,代码来源:Confirmation.php

示例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;
 }
开发者ID:habari-extras,项目名称:rewriter,代码行数:14,代码来源:rewriter.plugin.php

示例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
     }
 }
开发者ID:anupom,项目名称:my-blog,代码行数:18,代码来源:habarisilo.plugin.php


注:本文中的Utils::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。