本文整理汇总了PHP中nxt_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP nxt_redirect函数的具体用法?PHP nxt_redirect怎么用?PHP nxt_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nxt_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect_post
/**
* Redirect to previous page.
*
* @param int $post_id Optional. Post ID.
*/
function redirect_post($post_id = '')
{
if (isset($_POST['save']) || isset($_POST['publish'])) {
$status = get_post_status($post_id);
if (isset($_POST['publish'])) {
switch ($status) {
case 'pending':
$message = 8;
break;
case 'future':
$message = 9;
break;
default:
$message = 6;
}
} else {
$message = 'draft' == $status ? 10 : 1;
}
$location = add_query_arg('message', $message, get_edit_post_link($post_id, 'url'));
} elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
$location = add_query_arg('message', 2, nxt_get_referer());
$location = explode('#', $location);
$location = $location[0] . '#postcustom';
} elseif (isset($_POST['deletemeta']) && $_POST['deletemeta']) {
$location = add_query_arg('message', 3, nxt_get_referer());
$location = explode('#', $location);
$location = $location[0] . '#postcustom';
} elseif ('post-quickpress-save-cont' == $_POST['action']) {
$location = "post.php?action=edit&post={$post_id}&message=7";
} else {
$location = add_query_arg('message', 4, get_edit_post_link($post_id, 'url'));
}
nxt_redirect(apply_filters('redirect_post_location', $location, $post_id));
exit;
}
示例2: w3_network_activate_error
/**
* W3 Network activation error
*
* @return void
*/
function w3_network_activate_error()
{
w3_activation_cleanup();
nxt_redirect(plugins_url('pub/network_activation.php', W3TC_FILE));
echo '<p><strong>W3 Total Cache Error:</strong> plugin cannot be activated network-wide.</p>';
echo '<p><a href="javascript:history.back(-1);">Back</a>';
exit;
}
示例3: wlcms_check_for_login
function wlcms_check_for_login()
{
if (get_option('wlcms_o_enable_login_redirect')) {
$segments = explode('/', $_SERVER['REQUEST_URI']);
if ($segments[count($segments) - 1] == 'login') {
nxt_redirect(get_bloginfo('url') . '/nxt-login.php');
exit;
}
}
}
示例4: openid_redirect
/**
* Send the user to their OpenID provider to authenticate.
*
* @param Auth_OpenID_AuthRequest $auth_request OpenID authentication request object
* @param string $trust_root OpenID trust root
* @param string $return_to URL where the OpenID provider should return the user
*/
function openid_redirect($auth_request, $trust_root, $return_to)
{
do_action('openid_redirect', $auth_request, $trust_root, $return_to);
$message = $auth_request->getMessage($trust_root, $return_to, false);
if (Auth_OpenID::isFailure($message)) {
return openid_error('Could not redirect to server: ' . $message->message);
}
$_SESSION['openid_return_to'] = $message->getArg(Auth_OpenID_OPENID_NS, 'return_to');
// send 302 redirect or POST
if ($auth_request->shouldSendRedirect()) {
$redirect_url = $auth_request->redirectURL($trust_root, $return_to);
nxt_redirect($redirect_url);
} else {
openid_repost($auth_request->endpoint->server_url, $message->toPostArgs());
}
}
示例5: nxt_redirect
<?php
/**
* Multisite upgrade administration panel.
*
* @package NXTClass
* @subpackage Multisite
* @since 3.0.0
*/
require_once 'admin.php';
nxt_redirect(network_admin_url('upgrade.php'));
exit;
示例6: bb_get_current_admin_menu
function bb_get_current_admin_menu()
{
global $bb_menu, $bb_submenu, $bb_admin_page, $bb_current_menu, $bb_current_submenu;
foreach ($bb_submenu as $m => $b) {
foreach ($b as $s) {
if ($s[2] == $bb_admin_page) {
$bb_current_submenu = $s;
$bb_current_menu = $m;
break;
}
}
}
if (!isset($bb_current_menu)) {
$bb_current_menu = $bb_menu[0];
$bb_current_submenu = $bb_submenu['index.php'][5];
} else {
foreach ($bb_menu as $m) {
if ($m[2] == $bb_current_menu) {
$bb_current_menu = $m;
break;
}
}
}
if ($bb_current_submenu && !bb_current_user_can($bb_current_submenu[1]) || !bb_current_user_can($bb_current_menu[1])) {
nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
exit;
}
}
示例7: bb_die
<?php
require_once 'admin.php';
if (!bb_current_user_can('manage_forums')) {
bb_die(__("You don't have the authority to mess with the forums."));
}
if (!isset($_POST['action'])) {
nxt_redirect(bb_get_uri('bb-admin/forums.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_ADMIN));
exit;
}
$sent_from = nxt_get_referer();
switch ($_POST['action']) {
case 'add':
if (!isset($_POST['forum_name']) || '' === $_POST['forum_name']) {
bb_die(__('Bad forum name. Go back and try again.'));
}
bb_check_admin_referer('add-forum');
if (false !== bb_new_forum($_POST)) {
bb_safe_redirect($sent_from);
exit;
} else {
bb_die(__('The forum was not added'));
}
break;
case 'update':
bb_check_admin_referer('update-forum');
if (!($forums = bb_get_forums())) {
bb_die(__('No forums to update!'));
}
if ((int) $_POST['forum_id'] && isset($_POST['forum_name']) && '' !== $_POST['forum_name']) {
bb_update_forum($_POST);
示例8: elseif
} elseif ('blocked' != $role && array_key_exists('blocked', $user->capabilities)) {
bb_fix_password($user->ID);
}
}
foreach ($profile_admin_keys as $key => $label) {
if (${$key} != '' || isset($user->{$key})) {
bb_update_usermeta($user->ID, $key, ${$key});
}
}
foreach ($assignable_caps as $cap => $label) {
if (!($already = array_key_exists($cap, $user->capabilities)) && ${$cap}) {
$user_obj->add_cap($cap);
} elseif (!${$cap} && $already) {
$user_obj->remove_cap($cap);
}
}
}
if (bb_current_user_can('change_user_password', $user->ID) && !empty($_POST['pass1'])) {
$_POST['pass1'] = addslashes($_POST['pass1']);
bb_update_user_password($user->ID, $_POST['pass1']);
if (bb_get_current_user_info('ID') == $user->ID) {
bb_clear_auth_cookie();
bb_set_auth_cookie($user->ID);
}
}
do_action('profile_edited', $user->ID);
nxt_redirect(add_query_arg('updated', 'true', get_user_profile_link($user->ID)));
exit;
}
}
bb_load_template('profile-edit.php', array('profile_info_keys', 'profile_admin_keys', 'assignable_caps', 'user_email', 'bb_roles', 'errors', 'self'));
示例9: bb_repermalink
//.........这里部分代码省略.........
if (bb_get_option('mod_rewrite') === 'slugs') {
if (!($user = bb_get_user_by_nicename($id))) {
$user = bb_get_user($id);
}
} else {
if (!($user = bb_get_user($id))) {
$user = bb_get_user_by_nicename($id);
}
}
}
if (!$user || 1 == $user->user_status && !bb_current_user_can('moderate')) {
bb_die(__('User not found.'), '', 404);
}
$user_id = $user->ID;
bb_global_profile_menu_structure();
$valid = false;
if ($tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2)) {
foreach ($profile_hooks as $valid_tab => $valid_file) {
if ($tab == $valid_tab) {
$valid = true;
$self = $valid_file;
}
}
}
if ($valid) {
$permalink = get_profile_tab_link($user->ID, $tab, $page);
} else {
$permalink = get_user_profile_link($user->ID, $page);
unset($self, $tab);
}
break;
case 'favorites-page':
$permalink = get_favorites_link();
break;
case 'tag-page':
// It's not an integer and tags.php pulls double duty.
$id = isset($_GET['tag']) ? $_GET['tag'] : false;
if (!$id || !bb_get_tag((string) $id)) {
$permalink = bb_get_tag_page_link();
} else {
global $tag, $tag_name;
$tag_name = $id;
$tag = bb_get_tag((string) $id);
$permalink = bb_get_tag_link(0, $page);
// 0 => grabs $tag from global.
}
break;
case 'view-page':
// Not an integer
if (isset($_GET['view'])) {
$id = $_GET['view'];
} else {
$id = bb_get_path();
}
$_original_id = $id;
global $view;
$view = $id;
$permalink = get_view_link($view, $page);
break;
default:
return;
break;
}
nxt_parse_str($_SERVER['QUERY_STRING'], $args);
$args = urlencode_deep($args);
if ($args) {
$permalink = add_query_arg($args, $permalink);
if (bb_get_option('mod_rewrite')) {
$pretty_args = array('id', 'page', 'tag', 'tab', 'username');
// these are already specified in the path
if ($location == 'view-page') {
$pretty_args[] = 'view';
}
foreach ($pretty_args as $pretty_arg) {
$permalink = remove_query_arg($pretty_arg, $permalink);
}
}
}
$permalink = apply_filters('bb_repermalink_result', $permalink, $location);
$domain = bb_get_option('domain');
$domain = preg_replace('/^https?/', '', $domain);
$check = preg_replace('|^.*' . trim($domain, ' /') . '|', '', $permalink, 1);
$uri = rtrim($uri, " \t\n\r\v?");
$uri = str_replace('/index.php', '/', $uri);
global $bb_log;
$bb_log->debug($uri, 'bb_repermalink() ' . __('REQUEST_URI'));
$bb_log->debug($check, 'bb_repermalink() ' . __('should be'));
$bb_log->debug($permalink, 'bb_repermalink() ' . __('full permalink'));
$bb_log->debug(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : null, 'bb_repermalink() ' . __('PATH_INFO'));
if ($check != $uri && $check != str_replace(urlencode($_original_id), $_original_id, $uri)) {
if ($issue_404 && rtrim($check, " \t\n\r\v/") !== rtrim($uri, " \t\n\r\v/")) {
status_header(404);
bb_load_template('404.php');
} else {
nxt_redirect($permalink);
}
exit;
}
do_action('post_permalink', $permalink);
}
示例10: nxt_redirect
<?php
/**
* Theme editor administration panel.
*
* @package NXTClass
* @subpackage Administration
*/
/** NXTClass Administration Bootstrap */
require_once './admin.php';
if (is_multisite() && !is_network_admin()) {
nxt_redirect(network_admin_url('theme-editor.php'));
exit;
}
if (!current_user_can('edit_themes')) {
nxt_die('<p>' . __('You do not have sufficient permissions to edit templates for this site.') . '</p>');
}
$title = __("Edit Themes");
$parent_file = 'themes.php';
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p>
<p>' . __('Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '</p>
<p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Lookup takes you to a web page with reference material about that particular function.') . '</p>
<p>' . __('After typing in your edits, click Update File.') . '</p>
<p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p>
<p>' . __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="http://codex.nxtclass.org/Child_Themes" target="_blank">child theme</a> instead.') . '</p>' . (is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '')));
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Theme_Development" target="_blank">Documentation on Theme Development</a>') . '</p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Using_Themes" target="_blank">Documentation on Using Themes</a>') . '</p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Editing_Files" target="_blank">Documentation on Editing Files</a>') . '</p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Template_Tags" target="_blank">Documentation on Template Tags</a>') . '</p>' . '<p>' . __('<a href="http://nxtclass.org/support/" target="_blank">Support Forums</a>') . '</p>');
nxt_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme', 'dir'));
$themes = get_themes();
if (empty($theme)) {
$theme = get_current_theme();
} else {
示例11: create_new_and_redirect
function create_new_and_redirect()
{
//echo 'workin?';
if (isset($_GET['new_wiki_page']) && $_GET['new_wiki_page'] == 'true' && nxt_verify_nonce($_GET['nonce'], 'nxtw_new_page_nonce')) {
global $nxt_version;
global $nxtdb;
$new_wiki = array();
$title = strip_tags($_GET['title']);
$pieces = explode(':', $title, 2);
if (count($pieces) == 2) {
list($namespace, $topic) = $pieces;
$namespace = strtolower(preg_replace('/[ -]+/', '-', $namespace));
$parent_id = $nxtdb->get_var('SELECT id FROM `' . $nxtdb->posts . '` WHERE post_name = "' . $namespace . '"');
if ($parent_id) {
$new_wiki['post_parent'] = $parent_id;
}
} else {
$namespace = '';
$topic = $title;
}
$topic = strtolower(preg_replace('/[ -]+/', '-', $topic));
$url = get_option('siteurl') . '/wiki/' . ($namespace ? $namespace . '/' : '') . $topic;
$new_wiki['post_name'] = $topic;
$new_wiki['post_title'] = $title;
$new_wiki['post_content'] = 'Click the "Edit" tab to add content to this page.';
$new_wiki['guid'] = $url;
$new_wiki['post_status'] = 'publish';
if ($nxt_version >= 3.0) {
$new_wiki['post_type'] = 'wiki';
}
$new_wiki_id = nxt_insert_post($new_wiki);
if ($nxt_version <= 3.0) {
update_post_meta($new_wiki_id, '_wiki_page', 1);
}
nxt_redirect($url);
exit;
}
}
示例12: update_blog_status
update_blog_status($val, 'spam', '1');
set_time_limit(60);
break;
case 'notspam':
$blogfunction = 'all_notspam';
update_blog_status($val, 'spam', '0');
set_time_limit(60);
break;
}
} else {
nxt_die(__('You are not allowed to change the current site.'));
}
}
nxt_safe_redirect(add_query_arg(array('updated' => 'true', 'action' => $blogfunction), nxt_get_referer()));
} else {
nxt_redirect(network_admin_url('sites.php'));
}
exit;
break;
case 'archiveblog':
check_admin_referer('archiveblog');
if (!current_user_can('manage_sites')) {
nxt_die(__('You do not have permission to access this page.'));
}
update_blog_status($id, 'archived', '1');
nxt_safe_redirect(add_query_arg(array('updated' => 'true', 'action' => 'archive'), nxt_get_referer()));
exit;
break;
case 'unarchiveblog':
check_admin_referer('unarchiveblog');
if (!current_user_can('manage_sites')) {
示例13: nxt_redirect
<?php
/**
* Multisite users administration panel.
*
* @package NXTClass
* @subpackage Multisite
* @since 3.0.0
*/
require_once './admin.php';
nxt_redirect(network_admin_url('users.php'));
exit;
示例14: nxt_redirect
<?php
require 'admin-action.php';
nxt_redirect(bb_get_uri('bb-admin/options-permalinks.php', null, BB_URI_CONTEXT_BB_ADMIN + BB_URI_CONTEXT_HEADER));
示例15: bp_has_message_threads
function bp_has_message_threads($args = '')
{
global $bp, $messages_template;
$defaults = array('user_id' => $bp->loggedin_user->id, 'box' => 'inbox', 'per_page' => 10, 'max' => false, 'type' => 'all');
$r = nxt_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
if ('notices' == $bp->current_action && !is_super_admin()) {
nxt_redirect($bp->displayed_user->id);
} else {
if ('inbox' == $bp->current_action) {
bp_core_delete_notifications_by_type($bp->loggedin_user->id, $bp->messages->id, 'new_message');
}
if ('sentbox' == $bp->current_action) {
$box = 'sentbox';
}
if ('notices' == $bp->current_action) {
$box = 'notices';
}
$messages_template = new BP_Messages_Box_Template($user_id, $box, $per_page, $max, $type);
}
return apply_filters('bp_has_message_threads', $messages_template->has_threads(), $messages_template);
}