Ejemplo n.º 1
0
/**
 * 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;
}
Ejemplo n.º 2
0
/**
 * 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;
}
Ejemplo n.º 3
0
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;
        }
    }
}
Ejemplo n.º 4
0
/**
 * 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());
    }
}
Ejemplo n.º 5
0
<?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;
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;
    }
}
Ejemplo n.º 7
0
<?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);
Ejemplo n.º 8
0
                } 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'));
Ejemplo n.º 9
0
function bb_repermalink()
{
    global $page;
    $location = bb_get_location();
    $uri = $_SERVER['REQUEST_URI'];
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
    } else {
        $id = bb_get_path();
    }
    $_original_id = $id;
    do_action('pre_permalink', $id);
    $id = apply_filters('bb_repermalink', $id);
    switch ($location) {
        case 'front-page':
            $path = null;
            $querystring = null;
            if ($page > 1) {
                if (bb_get_option('mod_rewrite')) {
                    $path = 'page/' . $page;
                } else {
                    $querystring = array('page' => $page);
                }
            }
            $permalink = bb_get_uri($path, $querystring, BB_URI_CONTEXT_HEADER);
            $issue_404 = true;
            break;
        case 'forum-page':
            if (empty($id)) {
                $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
                break;
            }
            global $forum_id, $forum;
            $forum = bb_get_forum($id);
            $forum_id = $forum->forum_id;
            $permalink = get_forum_link($forum->forum_id, $page);
            break;
        case 'topic-edit-page':
        case 'topic-page':
            if (empty($id)) {
                $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
                break;
            }
            global $topic_id, $topic;
            $topic = get_topic($id);
            $topic_id = $topic->topic_id;
            $permalink = get_topic_link($topic->topic_id, $page);
            break;
        case 'profile-page':
            // This handles the admin side of the profile as well.
            global $user_id, $user, $profile_hooks, $self;
            if (isset($_GET['id'])) {
                $id = $_GET['id'];
            } elseif (isset($_GET['username'])) {
                $id = $_GET['username'];
            } else {
                $id = bb_get_path();
            }
            $_original_id = $id;
            if (!$id) {
                $user = bb_get_current_user();
                // Attempt to go to the current users profile
            } else {
                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);
}
Ejemplo n.º 10
0
<?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 {
Ejemplo n.º 11
0
 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;
     }
 }
Ejemplo n.º 12
0
                         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')) {
Ejemplo n.º 13
0
<?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;
Ejemplo n.º 14
0
<?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));
Ejemplo n.º 15
0
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);
}
Ejemplo n.º 16
0
 /**
  * export()
  *
  * Export settings to a backup file.
  *
  * @since 1.0.0
  * @uses global $nxtdb
  */
 function export()
 {
     global $nxtdb;
     check_admin_referer('woothemes-backup-export');
     // Security check.
     $export_options = array('all', 'theme', 'seo', 'sidebar', 'framework');
     if (!in_array(strip_tags($_POST['export-type']), $export_options)) {
         return;
     }
     // No invalid exports, please.
     $export_type = esc_attr(strip_tags($_POST['export-type']));
     $settings = array();
     $query = $this->construct_database_query($export_type);
     // Error trapping for the export.
     if ($query == '') {
         nxt_redirect(admin_url('admin.php?page=' . $this->token . '&error-export=true'));
         return;
     }
     // If we get to this stage, all is safe so run the query.
     $results = $nxtdb->get_results($query);
     foreach ($results as $result) {
         $settings[$result->option_name] = $result->option_value;
     }
     // End FOREACH Loop
     // Remove the "blogname" and "blogdescription" fields
     unset($settings['blogname']);
     unset($settings['blogdescription']);
     if (!$settings) {
         return;
     }
     // Add our custom marker, to ensure only valid files are imported successfully.
     $settings['woothemes-backup-validator'] = date('Y-m-d h:i:s');
     // Generate the export file.
     $output = json_encode((array) $settings);
     header('Content-Description: File Transfer');
     header('Cache-Control: public, must-revalidate');
     header('Pragma: hack');
     header('Content-Type: text/plain');
     header('Content-Disposition: attachment; filename="' . $this->token . '-' . date('Ymd-His') . '.json"');
     header('Content-Length: ' . strlen($output));
     echo $output;
     exit;
 }
Ejemplo n.º 17
0
function remote_login_js()
{
    global $current_blog, $current_user, $nxtdb;
    if (0 == get_site_option('dm_remote_login')) {
        return false;
    }
    $nxtdb->dmtablelogins = $nxtdb->base_prefix . 'domain_mapping_logins';
    $hash = get_dm_hash();
    if (false == isset($_SERVER['HTTPS'])) {
        $_SERVER['HTTPS'] = 'Off';
    }
    $protocol = 'on' == strtolower($_SERVER['HTTPS']) ? 'https://' : 'http://';
    if ($_GET['dm'] == $hash) {
        if ($_GET['action'] == 'load') {
            if (!is_user_logged_in()) {
                exit;
            }
            $key = md5(time() . mt_rand());
            $nxtdb->query($nxtdb->prepare("INSERT INTO {$nxtdb->dmtablelogins} ( `id`, `user_id`, `blog_id`, `t` ) VALUES( %s, %d, %d, NOW() )", $key, $current_user->ID, $_GET['blogid']));
            $url = add_query_arg(array('action' => 'login', 'dm' => $hash, 'k' => $key, 't' => mt_rand()), $_GET['back']);
            echo "window.location = '{$url}'";
            exit;
        } elseif ($_GET['action'] == 'login') {
            if ($details = $nxtdb->get_row($nxtdb->prepare("SELECT * FROM {$nxtdb->dmtablelogins} WHERE id = %s AND blog_id = %d", $_GET['k'], $nxtdb->blogid))) {
                if ($details->blog_id == $nxtdb->blogid) {
                    $nxtdb->query($nxtdb->prepare("DELETE FROM {$nxtdb->dmtablelogins} WHERE id = %s", $_GET['k']));
                    $nxtdb->query($nxtdb->prepare("DELETE FROM {$nxtdb->dmtablelogins} WHERE t < %d", time() - 120));
                    // remote logins survive for only 2 minutes if not used.
                    nxt_set_auth_cookie($details->user_id);
                    nxt_redirect(remove_query_arg(array('dm', 'action', 'k', 't', $protocol . $current_blog->domain . $_SERVER['REQUEST_URI'])));
                    exit;
                } else {
                    nxt_die(__("Incorrect or out of date login key", 'nxtclass-mu-domain-mapping'));
                }
            } else {
                nxt_die(__("Unknown login key", 'nxtclass-mu-domain-mapping'));
            }
        } elseif ($_GET['action'] == 'logout') {
            if ($details = $nxtdb->get_row($nxtdb->prepare("SELECT * FROM {$nxtdb->dmtablelogins} WHERE id = %d AND blog_id = %d", $_GET['k'], $_GET['blogid']))) {
                $nxtdb->query($nxtdb->prepare("DELETE FROM {$nxtdb->dmtablelogins} WHERE id = %s", $_GET['k']));
                $blog = get_blog_details($_GET['blogid']);
                nxt_clear_auth_cookie();
                nxt_redirect(trailingslashit($blog->siteurl) . "nxt-login.php?loggedout=true");
                exit;
            } else {
                nxt_die(__("Unknown logout key", 'nxtclass-mu-domain-mapping'));
            }
        }
    }
}
Ejemplo n.º 18
0
function do_undismiss_core_update()
{
    $version = isset($_POST['version']) ? $_POST['version'] : false;
    $locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US';
    $update = find_core_update($version, $locale);
    if (!$update) {
        return;
    }
    undismiss_core_update($version, $locale);
    nxt_redirect(nxt_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core'));
    exit;
}
Ejemplo n.º 19
0
            if (isset($_REQUEST['bulk_edit'])) {
                $done = bulk_edit_posts($_REQUEST);
                if (is_array($done)) {
                    $done['updated'] = count($done['updated']);
                    $done['skipped'] = count($done['skipped']);
                    $done['locked'] = count($done['locked']);
                    $sendback = add_query_arg($done, $sendback);
                }
            }
            break;
    }
    $sendback = remove_query_arg(array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback);
    nxt_redirect($sendback);
    exit;
} elseif (!empty($_REQUEST['_nxt_http_referer'])) {
    nxt_redirect(remove_query_arg(array('_nxt_http_referer', '_nxtnonce'), stripslashes($_SERVER['REQUEST_URI'])));
    exit;
}
$nxt_list_table->prepare_items();
nxt_enqueue_script('inline-edit-post');
$title = $post_type_object->labels->name;
if ('post' == $post_type) {
    get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.') . '</p>'));
    get_current_screen()->add_help_tab(array('id' => 'screen-content', 'title' => __('Screen Content'), 'content' => '<p>' . __('You can customize the display of this screen&#8217;s contents in a number of ways:') . '</p>' . '<ul>' . '<li>' . __('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.') . '</li>' . '<li>' . __('You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts.') . '</li>' . '<li>' . __('You can view posts in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right.') . '</li>' . '<li>' . __('You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.') . '</li>' . '</ul>'));
    get_current_screen()->add_help_tab(array('id' => 'action-links', 'title' => __('Available Actions'), 'content' => '<p>' . __('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:') . '</p>' . '<ul>' . '<li>' . __('<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.') . '</li>' . '<li>' . __('<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.') . '</li>' . '<li>' . __('<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.') . '</li>' . '<li>' . __('<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.') . '</li>' . '</ul>'));
    get_current_screen()->add_help_tab(array('id' => 'bulk-actions', 'title' => __('Bulk Actions'), 'content' => '<p>' . __('You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.') . '</p>' . '<p>' . __('When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.') . '</p>'));
    get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Posts_Screen" target="_blank">Documentation on Managing Posts</a>') . '</p>' . '<p>' . __('<a href="http://nxtclass.org/support/" target="_blank">Support Forums</a>') . '</p>');
} elseif ('page' == $post_type) {
    get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.') . '</p>'));
    get_current_screen()->add_help_tab(array('id' => 'managing-pages', 'title' => __('Managing Pages'), 'content' => '<p>' . __('Managing pages is very similar to managing posts, and the screens can be customized in the same way.') . '</p>' . '<p>' . __('You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.') . '</p>'));
    get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Pages_Screen" target="_blank">Documentation on Managing Pages</a>') . '</p>' . '<p>' . __('<a href="http://nxtclass.org/support/" target="_blank">Support Forums</a>') . '</p>');
Ejemplo n.º 20
0
/**
 * Redirects to the installer if NXTClass is not installed.
 *
 * Dies with an error message when multisite is enabled.
 *
 * @access private
 * @since 3.0.0
 */
function nxt_not_installed()
{
    if (is_multisite()) {
        if (!is_blog_installed() && !defined('nxt_INSTALLING')) {
            nxt_die(__('The site you have requested is not installed properly. Please contact the system administrator.'));
        }
    } elseif (!is_blog_installed() && false === strpos($_SERVER['PHP_SELF'], 'install.php') && !defined('nxt_INSTALLING')) {
        $link = nxt_guess_url() . '/nxt-admin/install.php';
        require ABSPATH . nxtINC . '/kses.php';
        require ABSPATH . nxtINC . '/pluggable.php';
        require ABSPATH . nxtINC . '/formatting.php';
        nxt_redirect($link);
        die;
    }
}
Ejemplo n.º 21
0
 /**
  * screen_handler( $action_vars )
  *
  * Gradebook screens handler.
  * Handles uris like groups/ID/courseware/assignment/args/gradebook
  */
 function screen_handler($action_vars)
 {
     if (reset($action_vars) == 'assignment') {
         $current_assignment = BPSP_Assignments::is_assignment($action_vars[1]);
         if (isset($action_vars[1]) && null != $current_assignment) {
             $this->current_assignment = $current_assignment;
         } else {
             nxt_redirect(nxt_redirect(get_option('siteurl')));
         }
         if (count($action_vars) > 3 && 'gradebook' == $action_vars[2] && 'clear' == $action_vars[3]) {
             add_filter('courseware_group_template', array(&$this, 'clear_gradebook_screen'));
         } elseif (count($action_vars) > 3 && 'gradebook' == $action_vars[2] && 'import' == $action_vars[3]) {
             add_filter('courseware_group_template', array(&$this, 'import_gradebook_screen'));
         } elseif (isset($action_vars[2]) && 'gradebook' == $action_vars[2]) {
             do_action('courseware_gradebook_screen');
             add_filter('courseware_group_template', array(&$this, 'gradebook_screen'));
         }
     }
 }
Ejemplo n.º 22
0
 /**
  * screen_handler( $action_vars )
  *
  * Assignment screens handler.
  * Handles uris like groups/ID/courseware/assignments/args
  */
 function screen_handler($action_vars)
 {
     if (reset($action_vars) == 'new_assignment') {
         $this->current_course = BPSP_Courses::is_course();
         //Load editor
         add_action('bp_head', array(&$this, 'load_editor'));
         do_action('courseware_list_assignments_screen');
         do_action('courseware_new_assignment_screen');
         add_filter('courseware_group_template', array(&$this, 'new_assignment_screen'));
     } elseif (reset($action_vars) == 'assignment') {
         $current_assignment = BPSP_Assignments::is_assignment($action_vars[1]);
         if (isset($action_vars[1]) && null != $current_assignment) {
             $this->current_assignment = $current_assignment;
         } else {
             nxt_redirect(nxt_redirect(get_option('siteurl')));
         }
         if (isset($action_vars[2]) && 'edit' == $action_vars[2]) {
             // Try to serve the form data
             if (isset($_GET['get_form_data'])) {
                 $this->get_form_data();
             }
             add_action('bp_head', array(&$this, 'load_editor'));
             do_action('courseware_edit_assignment_screen');
             add_filter('courseware_group_template', array(&$this, 'edit_assignment_screen'));
         } elseif (isset($action_vars[2]) && 'delete' == $action_vars[2]) {
             add_filter('courseware_group_template', array(&$this, 'delete_assignment_screen'));
         } elseif (isset($action_vars[2]) && 'enable_forum' == $action_vars[2]) {
             do_action('courseware_bibliography_screen');
             add_filter('courseware_group_template', array(&$this, 'enable_forum_assignment_screen'));
         } else {
             do_action('courseware_bibliography_screen');
             do_action('courseware_assignment_screen');
             add_filter('courseware_group_template', array(&$this, 'single_assignment_screen'));
         }
         do_action('courseware_assignment_screen_handler', $action_vars);
     } elseif (reset($action_vars) == 'assignments') {
         do_action('courseware_list_assignments_screen');
         add_filter('courseware_group_template', array(&$this, 'list_assignments_screen'));
     }
 }
Ejemplo n.º 23
0
<?php

require 'admin.php';
if (!bb_current_user_can('manage_tags')) {
    bb_die(__('You are not allowed to manage tags.'));
}
$tag_id = (int) $_POST['id'];
$tag = stripslashes($_POST['tag']);
bb_check_admin_referer('rename-tag_' . $tag_id);
if (!($old_tag = bb_get_tag($tag_id))) {
    bb_die(__('Tag not found.'));
}
if ($tag = bb_rename_tag($tag_id, $tag)) {
    nxt_redirect(bb_get_tag_link());
} else {
    bb_die(printf(__('There already exists a tag by that name or the name is invalid. <a href="%s">Try Again</a>'), nxt_get_referer()));
}
exit;
Ejemplo n.º 24
0
function bp_core_admin_pages_setup_handler()
{
    global $nxtdb, $bp;
    if (isset($_POST['bp-admin-pages-submit']) || isset($_POST['bp-admin-pages-single'])) {
        if (!check_admin_referer('bp-admin-pages-setup')) {
            return false;
        }
        // Then, update the directory pages
        if (isset($_POST['bp_pages'])) {
            $directory_pages = array();
            foreach ((array) $_POST['bp_pages'] as $key => $value) {
                if (!empty($value)) {
                    $directory_pages[$key] = (int) $value;
                }
            }
            bp_core_update_directory_page_ids($directory_pages);
        }
        $base_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings', 'updated' => 'true'), 'admin.php'));
        nxt_redirect($base_url);
    }
}
Ejemplo n.º 25
0
/**
 * Attempts activation of plugin in a "sandbox" and redirects on success.
 *
 * A plugin that is already activated will not attempt to be activated again.
 *
 * The way it works is by setting the redirection to the error before trying to
 * include the plugin file. If the plugin fails, then the redirection will not
 * be overwritten with the success message. Also, the options will not be
 * updated and the activation hook will not be called on plugin error.
 *
 * It should be noted that in no way the below code will actually prevent errors
 * within the file. The code should not be used elsewhere to replicate the
 * "sandbox", which uses redirection to work.
 *
 * If any errors are found or text is outputted, then it will be captured to
 * ensure that the success redirection will update the error redirection.
 *
 * @since 1.0
 *
 * @param string $plugin Plugin path to main plugin file with plugin data.
 * @param string $redirect Optional. URL to redirect to.
 * @return nxt_Error|null nxt_Error on invalid file or null on success.
 */
function bb_activate_plugin($plugin, $redirect = '')
{
    $active_plugins = (array) bb_get_option('active_plugins');
    $plugin = bb_plugin_basename(trim($plugin));
    $valid_path = bb_validate_plugin($plugin);
    if (is_nxt_error($valid_path)) {
        return $valid_path;
    }
    if (in_array($plugin, $active_plugins)) {
        return false;
    }
    if (!empty($redirect)) {
        // We'll override this later if the plugin can be included without fatal error
        nxt_redirect(add_query_arg('_scrape_nonce', bb_create_nonce('scrape-plugin_' . $plugin), $redirect));
    }
    ob_start();
    @(include $valid_path);
    // Add to the active plugins array
    $active_plugins[] = $plugin;
    ksort($active_plugins);
    bb_update_option('active_plugins', $active_plugins);
    do_action('bb_activate_plugin_' . $plugin);
    ob_end_clean();
    return $valid_path;
}
Ejemplo n.º 26
0
     nxt_redirect($location);
     exit;
     break;
 default:
     if (!empty($_REQUEST['_nxt_http_referer'])) {
         $location = remove_query_arg(array('_nxt_http_referer', '_nxtnonce'), stripslashes($_SERVER['REQUEST_URI']));
         if (!empty($_REQUEST['paged'])) {
             $location = add_query_arg('paged', (int) $_REQUEST['paged']);
         }
         nxt_redirect($location);
         exit;
     }
     $nxt_list_table->prepare_items();
     $total_pages = $nxt_list_table->get_pagination_arg('total_pages');
     if ($pagenum > $total_pages && $total_pages > 0) {
         nxt_redirect(add_query_arg('paged', $total_pages));
         exit;
     }
     nxt_enqueue_script('admin-tags');
     if (current_user_can($tax->cap->edit_terms)) {
         nxt_enqueue_script('inline-edit-tax');
     }
     if ('category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy) {
         $help = '';
         if ('category' == $taxonomy) {
             $help = '<p>' . sprintf(__('You can use categories to define sections of your site and group related posts. The default category is &#8220;Uncategorized&#8221; until you change it in your <a href="%s">writing settings</a>.'), 'options-writing.php') . '</p>';
         } elseif ('link_category' == $taxonomy) {
             $help = '<p>' . __('You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.') . '</p>';
         } else {
             $help = '<p>' . __('You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there&#8217;s no relationship from one tag to another.') . '</p>';
         }
Ejemplo n.º 27
0
<?php

require 'admin-action.php';
$topic_id = (int) $_GET['id'];
$topic = get_topic($topic_id);
if (!$topic) {
    bb_die(__('There is a problem with that topic, pardner.'));
}
if (!bb_current_user_can('close_topic', $topic_id)) {
    nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    exit;
}
bb_check_admin_referer('close-topic_' . $topic_id);
if (topic_is_open($topic_id)) {
    bb_close_topic($topic_id);
    $message = 'closed';
} else {
    bb_open_topic($topic_id);
    $message = 'opened';
}
if ($sendto = nxt_get_referer()) {
    $sendto = remove_query_arg('message', $sendto);
    $sendto = add_query_arg('message', $message, $sendto);
} else {
    $sendto = get_topic_link($topic_id);
}
bb_safe_redirect($sendto);
exit;
Ejemplo n.º 28
0
 * A multi-step process allowing the user to enable a network of NXTClass sites.
 *
 * @since 3.0.0
 *
 * @package NXTClass
 * @subpackage Administration
 */
define('nxt_INSTALLING_NETWORK', true);
/** NXTClass Administration Bootstrap */
require_once './admin.php';
if (!is_super_admin()) {
    nxt_die(__('You do not have sufficient permissions to manage options for this site.'));
}
if (is_multisite()) {
    if (!is_network_admin()) {
        nxt_redirect(network_admin_url('setup.php'));
        exit;
    }
    if (!defined('MULTISITE')) {
        nxt_die(__('The Network creation panel is not for NXTClass MU networks.'));
    }
}
// We need to create references to ms global tables to enable Network.
foreach ($nxtdb->tables('ms_global') as $table => $prefixed_table) {
    $nxtdb->{$table} = $prefixed_table;
}
/**
 * Check for an existing network.
 *
 * @since 3.0.0
 * @return Whether a network exists.
Ejemplo n.º 29
0
 function step_finish_save()
 {
     if (isset($_POST['submit'])) {
         check_admin_referer('bpwizard_finish');
         // Update the DB version in the database
         // Stored in sitemeta. Do not use bp_update_option()
         update_site_option('bp-db-version', $this->new_version);
         delete_site_option('bp-core-db-version');
         // Delete the setup cookie
         @setcookie('bp-wizard-step', '', time() - 3600, COOKIEPATH);
         // Load BP and hook the admin menu, so that the redirect is successful
         if (!function_exists('bp_core_update_message')) {
             require nxt_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-admin.php';
         }
         bp_core_add_admin_menu();
         // Redirect to the BuddyPress dashboard
         $redirect = bp_core_update_do_network_admin() ? add_query_arg(array('page' => 'bp-general-settings'), network_admin_url('admin.php')) : add_query_arg(array('page' => 'bp-general-settings'), admin_url('admin.php'));
         nxt_redirect($redirect);
         return true;
     }
     return false;
 }
Ejemplo n.º 30
0
<?php

require './bb-load.php';
bb_auth('logged_in');
if (!bb_is_user_logged_in()) {
    bb_die(__('You need to be logged in to add a tag.'));
}
$topic_id = (int) @$_POST['id'];
$page = (int) @$_POST['page'];
$tag = @$_POST['tag'];
$tag = stripslashes($tag);
bb_check_admin_referer('add-tag_' . $topic_id);
if (!($topic = get_topic($topic_id))) {
    bb_die(__('Topic not found.'));
}
if (bb_add_topic_tags($topic_id, $tag)) {
    nxt_redirect(get_topic_link($topic_id, $page));
} else {
    bb_die(__('The tag was not added.  Either the tag name was invalid or the topic is closed.'));
}
exit;