/**
  * Output the POS template
  */
 public function template_redirect()
 {
     // check is pos
     if (!is_pos('template')) {
         return;
     }
     // check auth
     if (!is_user_logged_in()) {
         add_filter('login_url', array($this, 'login_url'));
         auth_redirect();
     }
     // check privileges
     if (!current_user_can('access_woocommerce_pos')) {
         /* translators: wordpress */
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     // disable cache plugins
     $this->no_cache();
     // last chance before template is rendered
     do_action('woocommerce_pos_template_redirect');
     // add head & footer actions
     add_action('woocommerce_pos_head', array($this, 'head'));
     add_action('woocommerce_pos_footer', array($this, 'footer'));
     // now show the page
     include 'views/template.php';
     exit;
 }
Пример #2
0
/**
 * Redirected den Besucher zur Login page, aber nur, wenn dieser nicht eingelogged ist.
 */
function login_redirect()
{
    if (!is_user_logged_in()) {
        auth_redirect();
        //https://codex.wordpress.org/Function_Reference/auth_redirect
    }
}
Пример #3
0
/**
 * Redirects users that are not logged in to the 'wp-login.php' page.
 * This function is taken from Private Site Feature in "Members" Plugin.
 *
 * @since  0.1.0
 * @author Justin Tadlock <*****@*****.**>
 * @copyright Copyright (c) 2009 - 2016, Justin Tadlock
 */
function fx_private_site_please_log_in()
{
    /* Check if the private site feature is active and if the user is not logged in. */
    if (true === fx_private_site_get_option('enable', false) && !is_user_logged_in()) {
        /* Hook */
        do_action('fx_private_site_before_auth_redirect');
        /* If using BuddyPress and on the register page, don't do anything. */
        if (function_exists('bp_is_activation_page') && bp_is_activation_page()) {
            return;
        }
        if (function_exists('bp_is_register_page') && bp_is_register_page()) {
            return;
        }
        /* WooCommerce: Whitelist My Account Page */
        if (class_exists('WooCommerce')) {
            $myaccount_page_id = get_option('woocommerce_myaccount_page_id');
            if ($myaccount_page_id && is_page($myaccount_page_id)) {
                return;
            }
        }
        /* Redirect to the login page. */
        auth_redirect();
        exit;
    }
}
Пример #4
0
 public function template_files($template_path)
 {
     global $post;
     if ($post) {
         if ('question' == get_post_type() || is_tax('question_category') || ap_opt('base_page') == $post->ID || ap_opt('ask_page') == $post->ID || ap_opt('edit_page') == $post->ID || ap_opt('a_edit_page') == $post->ID || ap_opt('categories_page') == $post->ID || ap_opt('tags_page') == $post->ID || ap_opt('users_page') == $post->ID) {
             $template_path = ap_get_theme_location('index.php');
         }
     }
     if (is_tax('question_category') || is_tax('question_tags')) {
         $template_path = ap_get_theme_location('index.php');
     }
     if ('answer' == get_post_type()) {
         if (is_single()) {
             global $post;
             wp_redirect(get_permalink($post->post_parent));
             exit;
         }
     }
     if ($post && ap_opt('ask_page') == $post->ID) {
         if (!is_user_logged_in()) {
             auth_redirect();
         }
     }
     return $template_path;
 }
Пример #5
0
 /**
  * Forces Login by redirecting to the login page by using the pluggable core function that redirects to
  * the page trying to be accessed after the user has logged in
  *
  */
 public function i4_force_login()
 {
     if (!is_user_logged_in()) {
         //Redirect the user if they are not authenticated
         auth_redirect();
     }
 }
 public function aioi_template_redirect()
 {
     if (substr($_SERVER['REQUEST_URI'], 0, 16) == '/wp-activate.php') {
         return;
     }
     if (substr($_SERVER['REQUEST_URI'], 0, 11) == '/robots.txt') {
         return;
     }
     $options = $this->get_option_aioi();
     if (!$options['aioi_privatesite']) {
         return;
     }
     // We do want a private site
     if (!is_user_logged_in()) {
         auth_redirect();
     } else {
         if (is_multisite()) {
             $this->handle_private_loggedin_multisite($options);
         } else {
             // Bar access to users with no role
             $user = wp_get_current_user();
             if (!$user || !is_array($user->roles) || count($user->roles) == 0) {
                 wp_logout();
                 $output = '<p>' . esc_html('You attempted to login to the site, but you do not have any permissions. If you believe you should have access, please contact your administrator.') . '</p>';
                 wp_die($output);
             }
         }
     }
 }
function aceify_force_login()
{
    global $post;
    if ((is_single() || is_front_page() || is_page()) && !is_page('login') && !is_user_logged_in()) {
        auth_redirect();
    }
}
 /**
  * Check if privacy enforcement is enabled, and redirect users that aren't
  * logged in.
  */
 function enforce_privacy_redirect()
 {
     if ($this->settings->enforce_privacy && !is_user_logged_in()) {
         // our client endpoint relies on the wp admind ajax endpoint
         if (!defined('DOING_AJAX') || !DOING_AJAX || !isset($_GET['action']) || $_GET['action'] != 'openid-connect-authorize') {
             auth_redirect();
         }
     }
 }
Пример #9
0
/**
 * force_login() - checks if a wp_user is logged in. If not, it redirects them to the login page
 * 
 * will redirect to the login page if not
 **/
function fl_check_user()
{
    $current_file_name = basename($_SERVER['REQUEST_URI'], ".php");
    /* supposing filetype .php*/
    $fname = substr($current_file_name, 0, 8);
    if (!is_user_logged_in() && $fname != "wp-login") {
        auth_redirect();
    }
}
Пример #10
0
 /**
  *  set default action
  */
 public function default_action()
 {
     require_once ABSPATH . 'wp-admin/includes/admin.php';
     auth_redirect();
     if (!empty($_POST['task']) && $_POST['task'] == 'contactform.export' && !empty($_POST['form_id'])) {
         self::task_export();
     }
     exit;
 }
Пример #11
0
    /**
     *  set default action
     */
    public function default_action()
    {
        require_once ABSPATH . 'wp-admin/includes/admin.php';
        auth_redirect();
        header('Content-Type: application/javascript');
        $jsHook = array();
        $jsHook['button-addnew-action'] = '$("#wpbody-content .jsn-form-title-heading h2").after(
			            $("<div/>", {"class":"contactform-add-new"}).append(
			                $("<a/>", {"text":"Add New", "href":"javascript:void(0);"})

			            ).append(
			                $("<ul/>", {"class":"contactform-sample-form"}).append(
			                    $("<li/>").append(
			                        $("<a/>", {"class":"", "href":"post-new.php?post_type=wr_cf_post_type", "text":"Blank Form"})
			                    )
			                )
			            )
			        );';
        $jsHook = apply_filters('wr_contactform_js_forms_hook', $jsHook);
        $javascript = '(function ($) {
			    $(function () {
					$(".jsn-modal-overlay,.jsn-modal-indicator").remove();
	                $("body").append($("<div/>", {
	                    "class":"jsn-modal-overlay",
	                    "style":"z-index: 1000; display: inline;"
	                })).append($("<div/>", {
	                    "class":"jsn-modal-indicator",
	                    "style":"display:block"
	                })).addClass("jsn-loading-page");
			        $("#wpbody-content h2 .add-new-h2").hide();
			        $("#search-submit").val(\'Search Forms\');
			        $("#wpbody-content h2 .add-new-h2").parent().after(
			            $("<div/>", {"class":"jsn-form-title-heading"})
			        );
			        $("#wpbody-content h2 .add-new-h2").parent().appendTo($("div.jsn-form-title-heading"));
			        ' . implode('', $jsHook) . '
			        $("#wpbody-content .contactform-add-new > a").click(function () {
			            if ($(".contactform-add-new").hasClass("active")) {
			                $(".contactform-add-new").removeClass("active");
			            } else {
			                $(".contactform-add-new").addClass("active");
			            }
			            return false;
			        });
			        $(document).click(function () {
			            $(".contactform-add-new").removeClass("active");
			        });
			        setTimeout(function () {
		                $("#wpbody-content").show();
			            $(".jsn-modal-overlay,.jsn-modal-indicator").remove();
		           }, 500);
			    });
			})(jQuery);';
        echo '' . $javascript;
        exit;
    }
 /**
  * Handle request to authorization page
  *
  * Handles response from {@see render_page}, then exits to avoid output from
  * default wp-login handlers.
  */
 public function handle_request()
 {
     // Ensure visitors are logged in before serving authorization page
     auth_redirect();
     $response = $this->render_page();
     if (is_wp_error($response)) {
         $this->display_error($response);
     }
     exit;
 }
Пример #13
0
 /**
  * load only on Gmedia admin pages
  */
 public function controller()
 {
     $this->user_options = self::user_options();
     $view = $this->gmediablank ? '_frame' : '';
     $this->display_mode = $this->user_options["display_mode_gmedia{$view}"];
     if (!$this->page || strpos($this->page, 'GrandMedia') === false) {
         return;
     }
     auth_redirect();
     $this->processor();
 }
Пример #14
0
/**
 * Redirects users that are not logged in to the 'wp-login.php' page.
 *
 * @since 0.1.0
 * @uses is_user_logged_in() Checks if the current user is logged in.
 * @uses auth_redirect() Redirects people that are not logged in to the login page.
 */
function members_please_log_in()
{
    /* Check if the private blog feature is active. */
    if (members_get_setting('private_blog')) {
        /* If using BuddyPress and on the register page, don't do anything. */
        if (function_exists('bp_is_current_component') && bp_is_current_component('register')) {
            return;
        } elseif (!is_user_logged_in()) {
            auth_redirect();
        }
    }
}
Пример #15
0
 /**
  *
  */
 public function __construct($i_action, array $i_params)
 {
     $this->parse_get();
     $this->parse_post();
     $this->id = $this->get_id();
     $this->action = $i_action;
     $this->params = $i_params;
     $this->vars = (object) $this->vars;
     if ($this->validate_user_access() === false) {
         header('HTTP/1.1 403 Forbidden');
         \auth_redirect();
     }
 }
/**
 * Redirects users that are not logged in to the 'wp-login.php' page.
 *
 * @since  0.1.0
 * @access public
 * @return void
 */
function members_please_log_in()
{
    // Check if the private blog feature is active and if the user is not logged in.
    if (members_is_private_blog() && !is_user_logged_in()) {
        // If using BuddyPress and on the register page, don't do anything.
        if (function_exists('bp_is_current_component') && bp_is_current_component('register')) {
            return;
        }
        // Redirect to the login page.
        auth_redirect();
        exit;
    }
}
Пример #17
0
 function go_solo()
 {
     $dispatch = isset($_POST['buttonsnapdispatch']) ? $_POST['buttonsnapdispatch'] : @$_GET['buttonsnapdispatch'];
     if ($dispatch != '') {
         auth_redirect();
         $selection = isset($_POST['selection']) ? $_POST['selection'] : @$_GET['selection'];
         $selection = apply_filters($dispatch, $selection);
         die($selection);
     }
     if (isset($_GET['docss'])) {
         auth_redirect();
         do_action('marker_css');
         die;
     }
 }
 /**
  *  set default action
  */
 public function default_action()
 {
     require_once ABSPATH . 'wp-admin/includes/admin.php';
     auth_redirect();
     if (!empty($_GET['form_id'])) {
         global $wpdb;
         $get_formid = $_GET['form_id'];
         $postId = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE  meta_key='form_id' AND meta_value=%d", (int) $get_formid));
         if (empty($postId)) {
             $postId = (int) $get_formid;
         }
         self::duplicate($postId);
     }
     exit;
 }
Пример #19
0
function process_exterior_pages()
{
    if (rgempty("gf_pdf", $_GET)) {
        return;
    }
    //ensure users are logged in
    if (!is_user_logged_in()) {
        auth_redirect();
    }
    switch (rgget("gf_pdf")) {
        case "print-entry":
            require_once "render_to_pdf.php";
            break;
    }
    exit;
}
Пример #20
0
 public static function process_exterior_pages()
 {
     if (rgempty("gf_page", $_GET)) {
         return;
     }
     //ensure users are logged in
     if (!is_user_logged_in()) {
         auth_redirect();
     }
     switch (rgget("gf_page")) {
         case "directory_columns":
             require_once "select_directory_columns.php";
             break;
     }
     exit;
 }
/**
 * Check if the user is allowed to view the content (forum/topic/post)
 * Show a 404 error if the user does not have a permission to access the content
 */
function tehnik_bpp_enforce_permissions()
{
    // Bail if not viewing a bbPress item
    if (!is_bbpress()) {
        return;
    }
    // Bail if not viewing a single item or if user has caps
    if (!is_singular() || bbp_is_user_keymaster() || current_user_can('read_hidden_forums')) {
        return;
    }
    if (!tehnik_bpp_can_user_view_post()) {
        if (!is_user_logged_in()) {
            auth_redirect();
        } else {
            bbp_set_404();
        }
    }
}
 function MaybeRedirect()
 {
     // If the user is logged in, then abort
     if (current_user_can('read')) {
         return;
     }
     $settings = get_option('registered-users-only');
     // Feeds
     if (1 == $settings['feeds'] && is_feed()) {
         return;
     }
     // This is a base array of pages that will be EXCLUDED from being blocked
     $this->exclusions = array('wp-login.php', 'wp-register.php', 'wp-cron.php', 'wp-trackback.php', 'wp-app.php', 'xmlrpc.php');
     // If the current script name is in the exclusion list, abort
     if (in_array(basename($_SERVER['PHP_SELF']), apply_filters('registered-users-only_exclusions', $this->exclusions))) {
         return;
     }
     // Still here? Okay, then redirect to the login form
     auth_redirect();
 }
Пример #23
0
/**
* Creates shortcode fep_article_list
*
* @return string: HTML content for the shortcode
*
*/
function fep_manage_posts()
{
    $fep_misc = get_option('fep_misc');
    if (!is_user_logged_in()) {
        if (isset($fep_misc['disable_login_redirection']) && $fep_misc['disable_login_redirection']) {
            return 'You need to <a href="' . wp_login_url(get_permalink()) . '" title="Login">log in</a> to see this page.';
        } else {
            auth_redirect();
        }
    }
    global $current_user;
    get_currentuserinfo();
    ob_start();
    if (isset($_GET['fep_id']) && isset($_GET['fep_action']) && $_GET['fep_action'] == 'edit') {
        include dirname(dirname(__FILE__)) . '/views/submission-form.php';
    } else {
        include dirname(dirname(__FILE__)) . '/views/post-tabs.php';
    }
    return ob_get_clean();
}
Пример #24
0
function ua_webtide_check_for_members_only($wp)
{
    global $post;
    // Only do for front end
    if (is_admin()) {
        return;
    }
    // Is this page for members only?
    // Make sure we're viewing a single post and have a post ID
    // Can't return early because we need to set the constant
    $is_members_only_page = is_singular() && isset($post) && isset($post->ID) && $post->ID > 0 && strcasecmp('yes', get_post_meta($post->ID, 'is_members_only_page', true)) == 0 ? true : false;
    // Is the user a WebTide member?
    define('IS_WEBTIDE_MEMBERS_ONLY_PAGE', $is_members_only_page);
    // Is this page isn't for members only, get out of here
    if (!$is_members_only_page) {
        return;
    }
    // If user isn't logged in, so force authentication
    if (!current_user_can('is_webtide_member')) {
        auth_redirect();
    }
}
Пример #25
0
 /**
  * Direct index.php to the appropriate function
  * 
  * @return bool
  **/
 public static function direct()
 {
     //If viewing the visual editor, stop the template loading and show the visual editor.
     if (self::is_visual_editor()) {
         //If user is logged in and can't visually edit, loop them back to normal template.
         if (is_user_logged_in() && !HeadwayCapabilities::can_user_visually_edit()) {
             wp_die('You have insufficient permissions to use the Headway Visual Editor.<br /><br /><a href="' . home_url() . '">Return to Home</a>');
             return false;
             //If the user isn't logged in at all, log 'em in and loop back to visual editor as long as debug mode isn't active
         } elseif (!is_user_logged_in() && !HeadwayOption::get('debug-mode')) {
             return auth_redirect();
         }
         HeadwayVisualEditor::display();
         die;
         //Theme Preview
     } elseif (self::is_theme_preview()) {
         return wp_die('Headway and Headway Child Themes cannot be previewed.  Please activate the theme if you wish to see how it looks.');
     } elseif (self::is_grid()) {
         Headway::load('visual-editor/iframe-grid');
         HeadwayVisualEditorIframeGrid::show();
         die;
     }
 }
    /**
     *  set default action
     */
    public function default_action()
    {
        require_once ABSPATH . 'wp-admin/includes/admin.php';
        auth_redirect();
        header('Content-Type: application/javascript');
        $controls = array();
        $controls['single-line-text'] = WR_CF_Gadget_Controls_Single_Line_Text::register();
        $controls['choices'] = WR_CF_Gadget_Controls_Choices::register();
        $controls['dropdown'] = WR_CF_Gadget_Controls_Dropdown::register();
        $controls['paragraph-text'] = WR_CF_Gadget_Controls_Paragraph_Text::register();
        $controls['checkboxes'] = WR_CF_Gadget_Controls_Checkboxes::register();
        $controls['list'] = WR_CF_Gadget_Controls_List::register();
        $controls['static-content'] = WR_CF_Gadget_Controls_Static_Content::register();
        $controls['form-captcha'] = WR_CF_Gadget_Controls_Form_Captcha::register();
        $controls['form-actions'] = WR_CF_Gadget_Controls_Form_Actions::register();
        $controls['google-maps'] = WR_CF_Gadget_Controls_Google_Maps::register();
        $controls['name'] = WR_CF_Gadget_Controls_Name::register();
        $controls['email'] = WR_CF_Gadget_Controls_Email::register();
        $controls['file-upload'] = WR_CF_Gadget_Controls_File_Upload::register();
        $controls['likert'] = WR_CF_Gadget_Controls_Likert::register();
        $controls['address'] = WR_CF_Gadget_Controls_Address::register();
        $controls['website'] = WR_CF_Gadget_Controls_Website::register();
        $controls['date'] = WR_CF_Gadget_Controls_Date::register();
        $controls['country'] = WR_CF_Gadget_Controls_Country::register();
        $controls['number'] = WR_CF_Gadget_Controls_Number::register();
        $controls['phone'] = WR_CF_Gadget_Controls_Phone::register();
        $controls['currency'] = WR_CF_Gadget_Controls_Currency::register();
        $controls['password'] = WR_CF_Gadget_Controls_Password::register();
        $controls = apply_filters('wr_contactform_filter_visualdesign_controls', $controls);
        $javascript = '(function ($) {
			    var t = $.parseJSON($("#wr_contactform_languages").val());
			    ' . implode(' ', $controls) . '
			})(jQuery);';
        echo '' . $javascript;
        exit;
    }
Пример #27
0
 public static function process_exterior_pages()
 {
     if (rgempty('gf_page', $_GET)) {
         return;
     }
     $page = rgget('gf_page');
     $is_legacy_upload_page = $_SERVER['REQUEST_METHOD'] == 'POST' && $page == 'upload';
     if ($is_legacy_upload_page && (!defined('DOING_AJAX') || !DOING_AJAX)) {
         _doing_it_wrong('gf_page=upload', 'gf_page=upload is now deprecated. Use GFCommon::get_upload_page_slug() instead', '1.9.6.13');
     }
     $is_upload_page = $_SERVER['REQUEST_METHOD'] == 'POST' && $page == GFCommon::get_upload_page_slug();
     if ($is_upload_page || $is_legacy_upload_page) {
         require_once GFCommon::get_base_path() . '/includes/upload.php';
         exit;
     }
     //ensure users are logged in
     if (!is_user_logged_in()) {
         auth_redirect();
     }
     switch ($page) {
         case 'preview':
             require_once GFCommon::get_base_path() . '/preview.php';
             break;
         case 'print-entry':
             require_once GFCommon::get_base_path() . '/print-entry.php';
             break;
         case 'select_columns':
             require_once GFCommon::get_base_path() . '/select_columns.php';
             break;
     }
     exit;
 }
Пример #28
0
function ti_stop_guests()
{
    global $post;
    if ($post->post_type == 'forum') {
        if (!is_user_logged_in()) {
            auth_redirect();
        }
    }
}
Пример #29
0
 /**
  * Start preview and customize theme.
  *
  * Check if customize query variable exist. Init filters to filter the current theme.
  *
  * @since 3.4.0
  */
 public function setup_theme()
 {
     send_origin_headers();
     $doing_ajax_or_is_customized = $this->doing_ajax() || isset($_POST['customized']);
     if (is_admin() && !$doing_ajax_or_is_customized) {
         auth_redirect();
     } elseif ($doing_ajax_or_is_customized && !is_user_logged_in()) {
         $this->wp_die(0);
     }
     show_admin_bar(false);
     if (!current_user_can('customize')) {
         $this->wp_die(-1);
     }
     $this->original_stylesheet = get_stylesheet();
     $this->theme = wp_get_theme(isset($_REQUEST['theme']) ? $_REQUEST['theme'] : null);
     if ($this->is_theme_active()) {
         // Once the theme is loaded, we'll validate it.
         add_action('after_setup_theme', array($this, 'after_setup_theme'));
     } else {
         // If the requested theme is not the active theme and the user doesn't have the
         // switch_themes cap, bail.
         if (!current_user_can('switch_themes')) {
             $this->wp_die(-1);
         }
         // If the theme has errors while loading, bail.
         if ($this->theme()->errors()) {
             $this->wp_die(-1);
         }
         // If the theme isn't allowed per multisite settings, bail.
         if (!$this->theme()->is_allowed()) {
             $this->wp_die(-1);
         }
     }
     $this->start_previewing_theme();
 }
Пример #30
0
        /*
         * If there are 50 or fewer sites, run every time. Otherwise, throttle to reduce load:
         * attempt to do no more than threshold value, with some +/- allowed.
         */
        if ($c <= 50 || $c > 50 && mt_rand(0, (int) ($c / 50)) == 1) {
            require_once ABSPATH . WPINC . '/http.php';
            $response = wp_remote_get(admin_url('upgrade.php?step=1'), array('timeout' => 120, 'httpversion' => '1.1'));
            /** This action is documented in wp-admin/network/upgrade.php */
            do_action('after_mu_upgrade', $response);
            unset($response);
        }
        unset($c);
    }
}
require_once ABSPATH . 'wp-admin/includes/admin.php';
auth_redirect();
// Schedule trash collection
if (!wp_next_scheduled('wp_scheduled_delete') && !wp_installing()) {
    wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
}
set_screen_options();
$date_format = __('F j, Y');
$time_format = __('g:i a');
wp_enqueue_script('common');
/**
 * $pagenow is set in vars.php
 * $wp_importers is sometimes set in wp-admin/includes/import.php
 * The remaining variables are imported as globals elsewhere, declared as globals here
 *
 * @global string $pagenow
 * @global array  $wp_importers