Пример #1
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function set500($message = 'Internal Server Error')
 {
     $this->_cms->trigger(AbstractEvents::EVENT_SHUTDOWN);
     $this->_cms->trigger(AbstractEvents::EVENT_SHUTDOWN . '.500', [&$message]);
     $trace = '';
     if ($this->_cms['config']->isDebug()) {
         ob_start();
         debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
         $trace = '<pre>' . ob_get_contents() . '</pre>';
         ob_end_clean();
     }
     Ob::clean();
     status_header(500);
     $this->noCache();
     $this->setHeader('Content-Type', 'text/html; charset=utf-8');
     \_default_wp_die_handler($message . '<hr>' . $trace, '', array('response' => 500, 'back_link' => true));
 }
Пример #2
0
 function fruitfulhandleWpCommentError($message, $title = '', $args = array())
 {
     if (!is_admin() && !empty($_POST['comment_post_ID']) && is_numeric($_POST['comment_post_ID'])) {
         $_SESSION['formError'] = $message;
         $denied = array('submit', 'comment_post_ID', 'comment_parent');
         foreach ($_POST as $key => $value) {
             if (!in_array($key, $denied)) {
                 $_SESSION['formFields'][$key] = stripslashes($value);
             }
         }
         session_write_close();
         wp_safe_redirect(get_permalink($_POST['comment_post_ID']) . '#fruitfulCommentError', 302);
         exit;
     } else {
         _default_wp_die_handler($message, $title, $args);
     }
 }
 function wp_die($message, $title = '', $args = array())
 {
     $passedmessage = $message;
     if (function_exists('is_wp_error') && is_wp_error($message)) {
         $errors = $message->get_error_messages();
         switch (count($errors)) {
             case 0:
                 $message = '';
                 break;
             case 1:
                 $message = "<p>{$errors[0]}</p>";
                 break;
             default:
                 $message = "<ul>\n\t\t<li>" . join("</li>\n\t\t<li>", $errors) . "</li>\n\t</ul>";
                 break;
         }
     }
     newrelic_notice_error($title . ' ' . $message);
     if (function_exists('_default_wp_die_handler')) {
         _default_wp_die_handler($passedmessage, $title = '', $args);
     } else {
         die($message);
     }
 }
Пример #4
0
function _wp_die_handler( $message, $title = '', $args = array() ) {
	if ( !$GLOBALS['_wp_die_disabled'] ) {
		_default_wp_die_handler( $message, $title, $args );
	} else {
		//Ignore at our peril
	}
}
Пример #5
0
    /**
     * Fired when plugin is deactivated
     */
    function on_deactivation()
    {
        global $pagenow;
        if (!current_user_can('activate_plugins')) {
            return;
        }
        $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
        check_admin_referer("deactivate-plugin_{$plugin}");
        if ($pagenow == 'plugins.php') {
            $wr_mm_action = 'wr_mm_deactivate';
            if (is_network_admin()) {
                $plugin_url = network_admin_url('plugins.php');
            } else {
                $plugin_url = admin_url('plugins.php');
            }
            $deactivate_one = isset($_POST['action']) ? false : true;
            // show Confirmation form before doing deactivate
            if (!isset($_REQUEST['wr_mm_wpnonce']) && !isset($_REQUEST['wr_back'])) {
                // create wr_nonce
                $wr_mm_nonce = wp_create_nonce($wr_mm_action);
                $method = $deactivate_one ? 'GET' : 'POST';
                $back_text = __('No, take me back', WR_MEGAMENU_TEXTDOMAIN);
                if ($deactivate_one) {
                    $back_btn = "<a href='{$plugin_url}' class='button button-large'>" . $back_text . '</a>';
                } else {
                    $back_btn = "<input type='submit' name='wr_back' class='button button-large' value='" . $back_text . "'>";
                }
                $form = " action='{$plugin_url}' method='{$method}' ";
                $fields = '';
                foreach ($_REQUEST as $key => $value) {
                    if (!is_array($value)) {
                        $fields .= "<input type='hidden' name='{$key}' value='{$value}' />";
                    } else {
                        foreach ($value as $p) {
                            $fields .= "<input type='hidden' name='{$key}[]' value='{$p}' />";
                        }
                    }
                }
                $fields .= "<input type='hidden' name='wr_mm_wpnonce' value='{$wr_mm_nonce}' />";
                // show message
                ob_start();
                ?>
				<p>
					<?php 
                _e('After deactivating, all data will be deleted. Are you sure you want to deactivate MegaMenu plugin?', WR_MEGAMENU_TEXTDOMAIN);
                ?>
				</p>
				<center>
					<form <?php 
                echo balanceTags($form);
                ?>
>
						<?php 
                echo balanceTags($fields);
                ?>
						<input type="submit" name="wr_deactivate" class="button button-large"
							   value="<?php 
                _e('Yes, deactivate plugin', WR_MEGAMENU_TEXTDOMAIN);
                ?>
"
							   style="background: #d9534f; color: #fff; text-shadow: none; border: none;">
						<?php 
                echo balanceTags($back_btn);
                ?>
					</form>
				</center>
				<p style="font-style: italic; font-size: 12px; margin-top: 20px;">
                    <?php 
                _e('Or if you want to deactivate without removing data and configurations, click on the button below', WR_MEGAMENU_TEXTDOMAIN);
                ?>
				</p>
				<center>
					<form <?php 
                echo balanceTags($form);
                ?>
>
						<?php 
                echo balanceTags($fields);
                ?>
						<input type="submit" name="wr_deactivate_light"
							   class="button button-large"
                               value="<?php 
                _e('Deactivate without removing data', WR_MEGAMENU_TEXTDOMAIN);
                ?>
"
							   style="background: #f0ad4e; color: #fff; text-shadow: none; border: none;">
					</form>
				</center>

				<?php 
                $message = ob_get_clean();
                // Change page title
                _default_wp_die_handler($message, __('WordPress &rsaquo; Confirmation', WR_MEGAMENU_TEXTDOMAIN));
                exit;
            } else {
                // get nonce
                $wr_mm_nonce = esc_sql($_REQUEST['wr_mm_wpnonce']);
                $nonce = wp_verify_nonce($wr_mm_nonce, $wr_mm_action);
                // if nonce is invalid
                if (!in_array($nonce, array(1, 2))) {
                    _default_wp_die_handler(__('Nonce is invalid!', WR_MEGAMENU_TEXTDOMAIN));
                    exit;
                }
                // do action when customer choose "take me back" in confirmation form
                if (isset($_REQUEST['wr_back'])) {
                    // remove WR MegaMenu from the checked list
                    if (($key = array_search($plugin, $_REQUEST['checked'])) !== false) {
                        unset($_REQUEST['checked'][$key]);
                    }
                    // Overwrite list of checked plugins to deactivating
                    $_POST['checked'] = $_REQUEST['checked'];
                } else {
                    if (isset($_REQUEST['wr_deactivate'])) {
                        $posts = get_posts(array('post_type' => array('wr_megamenu_profile'), 'post_status' => 'any'));
                        if ($posts) {
                            foreach ($posts as $post) {
                                delete_post_meta($post->ID, WR_MEGAMENU_META_KEY);
                                delete_post_meta($post->ID, WR_MEGAMENU_META_KEY . '_themes_options');
                                delete_post_meta($post->ID, '_wr_megamenu_profile_location_');
                                delete_post_meta($post->ID, '_wr_megamenu_css_files');
                                delete_post_meta($post->ID, '_wr_megamenu_css_custom');
                                wp_delete_post($post->ID);
                            }
                        }
                        // delete meta and posts blog all
                        if (is_network_admin()) {
                            global $wpdb;
                            // get list id blog all
                            $list_prefix_musite = $wpdb->get_results("SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A);
                            if ($list_prefix_musite && count($list_prefix_musite) > 1) {
                                foreach ($list_prefix_musite as $key => $value) {
                                    if ($value['blog_id'] == 1) {
                                        continue;
                                    }
                                    $prefix = $wpdb->prefix . $value['blog_id'] . '_';
                                    // get list id megamenu posts
                                    $posts = $wpdb->get_results("\n\t\t\t\t\t\t\t\t\t\tSELECT ID \n\t\t\t\t\t\t\t\t\t\tFROM {$prefix}posts \n\t\t\t\t\t\t\t\t\t\tWHERE post_type = 'wr_megamenu_profile'\n\t\t\t\t\t\t\t\t\t\t", ARRAY_A);
                                    if ($posts) {
                                        foreach ($posts as $key_posts => $value_posts) {
                                            // delete post meta key
                                            $wpdb->query("\n\t\t\t\t\t\t\t\t\t\t\t\tDELETE FROM {$prefix}postmeta\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE (\n\t\t\t\t\t\t\t\t\t\t\t\t\tmeta_key = '" . WR_MEGAMENU_META_KEY . "' OR\n\t\t\t\t\t\t\t\t\t\t\t\t\tmeta_key = '" . WR_MEGAMENU_META_KEY . "_themes_options' OR\n\t\t\t\t\t\t\t\t\t\t\t\t\tmeta_key = '_wr_megamenu_profile_location_' OR\n\t\t\t\t\t\t\t\t\t\t\t\t\tmeta_key = '_wr_megamenu_css_files' OR\n\t\t\t\t\t\t\t\t\t\t\t\t\tmeta_key = '_wr_megamenu_css_custom'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) AND \n\t\t\t\t\t\t\t\t\t\t\t\t\tpost_id = {$value_posts['ID']}\n\t\t\t\t\t\t\t\t\t\t\t\t");
                                            // delete posts
                                            $wpdb->query("\n\t\t\t\t\t\t\t\t\t\t\t\tDELETE FROM {$prefix}posts\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE ID = {$value_posts['ID']}\n\t\t\t\t\t\t\t\t\t\t\t\t");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
 public function AccessFormProcess()
 {
     if ($_POST['submit_ticket'] && $_POST['rand_check_frontend']) {
         $ky_fullname = isset($_POST['ky_fullname']) ? trim(strip_tags($_POST['ky_fullname'])) : null;
         $ky_subject = isset($_POST['ky_subject']) ? trim($_POST['ky_subject']) : null;
         $ky_email = isset($_POST['ky_email']) ? trim($_POST['ky_email']) : null;
         $ky_ticketpriority = isset($_POST['ky_ticketpriority']) ? trim($_POST['ky_ticketpriority']) : null;
         $ky_tickettype = isset($_POST['ky_tickettype']) ? trim(strip_tags($_POST['ky_tickettype'])) : null;
         $ky_department = isset($_POST['ky_department']) ? trim($_POST['ky_department']) : null;
         $ky_contents = isset($_POST['ky_contents']) ? trim($_POST['ky_contents']) : null;
         $rand_check_frontend = isset($_POST['rand_check_frontend']) ? trim($_POST['rand_check_frontend']) : null;
         if ('' == $ky_fullname || '' == $ky_subject || '' == $ky_email || '' == $ky_ticketpriority || '' == $ky_tickettype || '' == $ky_department) {
             _default_wp_die_handler(__('<strong>ERROR</strong>: please fill all the required fields which are mandatory ! Unable to Proceed further !'));
         } elseif (!is_email($ky_email)) {
             wp_die(__('<strong>ERROR</strong>: please enter a valid email address.'));
         } elseif ('' == $ky_contents) {
             wp_die(__('<strong>ERROR</strong>: please type a message information'));
         }
         if ($_SESSION['storeVar'] == $rand_check_frontend) {
             return false;
         }
         $create_ticket = $this->kayakoAPI->CreateTicketRESTAPI($ky_fullname, $ky_email, $ky_contents, $ky_subject, $ky_department, 1, $ky_ticketpriority, $ky_tickettype);
         $ticketID = $create_ticket['result']['ticket']['0']['displayid'];
         $get_ticket_URL = $this->kayakoAPI->_ticket_url($ticketID);
         if ($create_ticket['errorReceived']) {
             if (stristr($create_ticket['errorReceived'], "SMTP")) {
                 $this->getErrorMsg = new WP_Error('kayako_ticket_creation', __("<div class='frontend_errormessage'><strong>Error : </strong>There is an issue with SMTP configuration. Please check your helpdesk details ! </div>"));
             } else {
                 $this->getErrorMsg = new WP_Error('kayako_ticket_creation', __("<div class='frontend_errormessage'><strong>Error : </strong>There is some technical issue occured, not able to create ticket ! </div>"));
             }
             $_SESSION['storeVar'] = $rand_check_frontend;
         } else {
             $this->getErrorMsg = new WP_Error('kayako_ticket_creation', __("<div class='frontend_successmessage'>Your Ticket has been created successfully ! Your generated ticket ID is <a href= '" . $get_ticket_URL . "' target = '_blank'>#" . $ticketID . " </a></div>"));
             $this->ticketInfoContainer = $create_ticket;
             $_SESSION['storeVar'] = $rand_check_frontend;
         }
     }
 }
Пример #7
0
    /**
     * Deactivate handle
     *
     * @global type $pagenow
     * @global type $wpdb
     */
    function do_deactivate()
    {
        global $pagenow;
        if ($pagenow == 'plugins.php') {
            $deactivate_action = false;
            $ig_pb_plugin = 'ig-pagebuilder/ig-pagebuilder.php';
            // check if single deactivate plugin/ bulk deactivate plugins
            if (!empty($_REQUEST['action']) && in_array($_REQUEST['action'], array('deactivate-selected', 'deactivate'))) {
                $action = $_REQUEST['action'];
                if ($action == 'deactivate' && $_REQUEST['plugin'] == $ig_pb_plugin || $action == 'deactivate-selected' && in_array($ig_pb_plugin, $_REQUEST['checked'])) {
                    $deactivate_action = true;
                }
            }
            if ($deactivate_action) {
                $ig_action = 'ig_deactivate';
                $plugin_url = admin_url('plugins.php');
                // check whether delete only IG PageBuilder OR Bulk deactivate plugins
                $deactivate_one = isset($_POST['action']) ? false : true;
                // show Confirmation form before doing deactivate
                if (!isset($_REQUEST['ig_wpnonce']) && !isset($_REQUEST['ig_back'])) {
                    // create ig_nonce
                    $ig_nonce = wp_create_nonce($ig_action);
                    $method = $deactivate_one ? 'GET' : 'POST';
                    $back_text = __('No, take me back', IGPBL);
                    if ($deactivate_one) {
                        $back_btn = "<a href='{$plugin_url}' class='button button-large'>" . $back_text . '</a>';
                    } else {
                        $back_btn = "<input type='submit' name='ig_back' class='button button-large' value='" . $back_text . "'>";
                    }
                    $form = " action='{$plugin_url}' method='{$method}' ";
                    $fields = '';
                    foreach ($_REQUEST as $key => $value) {
                        if (!is_array($value)) {
                            $fields .= "<input type='hidden' name='{$key}' value='{$value}' />";
                        } else {
                            foreach ($value as $p) {
                                $fields .= "<input type='hidden' name='{$key}[]' value='{$p}' />";
                            }
                        }
                    }
                    $fields .= "<input type='hidden' name='ig_wpnonce' value='{$ig_nonce}' />";
                    // show message
                    ob_start();
                    ?>
					<p>
						<?php 
                    _e('After deactivating, all content built with PageBuilder will be parsed to plain HTML code. Are you sure you want to deactivate PageBuilder plugin?', IGPBL);
                    ?>
					</p>
					<center>
						<form <?php 
                    echo balanceTags($form);
                    ?>
>
							<?php 
                    echo balanceTags($fields);
                    ?>
							<input type="submit" name="ig_deactivate" class="button button-large" value="<?php 
                    _e('Yes, deactivate plugin', IGPBL);
                    ?>
" style="background: #d9534f;color: #fff;text-shadow:none;border:none;">
							<?php 
                    echo balanceTags($back_btn);
                    ?>
						</form>
					</center>
					<p style="font-style: italic; font-size: 12px;margin-top: 20px;">
						<?php 
                    _e("Or if you want to deactivate without parsing 'content built with PageBuilder' to HTML code, click on the button below", IGPBL);
                    ?>
					</p>
					<center>
						<form <?php 
                    echo balanceTags($form);
                    ?>
>
							<?php 
                    echo balanceTags($fields);
                    ?>
							<input type="submit" name="ig_deactivate_light" class="button button-large" value="<?php 
                    _e('Deactivate without parsing data', IGPBL);
                    ?>
" style="background: #f0ad4e;color: #fff;text-shadow:none;border:none;">
						</form>
					</center>
					<?php 
                    $message = ob_get_clean();
                    // Change page title
                    _default_wp_die_handler($message, __('WordPress &rsaquo; Confirmation', IGPBL));
                    exit;
                } else {
                    // get nonce
                    $ig_nonce = esc_sql($_REQUEST['ig_wpnonce']);
                    $nonce = wp_verify_nonce($ig_nonce, $ig_action);
                    // if nonce is invalid
                    if (!in_array($nonce, array(1, 2))) {
                        _default_wp_die_handler(__('Nonce is invalid!', IGPBL));
                        exit;
                    }
                    // do action when customer choose "take me back" in confirmation form
                    if (isset($_REQUEST['ig_back'])) {
                        // remove IG PageBuilder from the checked list
                        if (($key = array_search($ig_pb_plugin, $_REQUEST['checked'])) !== false) {
                            unset($_REQUEST['checked'][$key]);
                        }
                        // Overwrite list of checked plugins to deactivating
                        $_POST['checked'] = $_REQUEST['checked'];
                    } else {
                        if (isset($_REQUEST['ig_deactivate'])) {
                            global $wpdb;
                            // update post content = value of '_ig_html_content', deactivate pagebuilder
                            $meta_key1 = 1;
                            $meta_key2 = '_ig_html_content';
                            $meta_key3 = '_ig_deactivate_pb';
                            $wpdb->query($wpdb->prepare("\n\t\t\t\t\t\t\t\tUPDATE\t\t{$wpdb->posts} p\n\t\t\t\t\t\t\t\tLEFT JOIN\t{$wpdb->postmeta} p1\n\t\t\t\t\t\t\t\t\t\t\tON p1.post_id = p.ID\n\t\t\t\t\t\t\t\tLEFT JOIN\t{$wpdb->postmeta} p2\n\t\t\t\t\t\t\t\t\t\t\tON p2.post_id = p.ID\n\t\t\t\t\t\t\t\tSET\t\t\tpost_content = p1.meta_value, p2.meta_value = %d\n\t\t\t\t\t\t\t\tWHERE\t\tp1.meta_key = %s\n\t\t\t\t\t\t\t\t\t\t\tAND p2.meta_key = %s\n\t\t\t\t\t\t\t\t", $meta_key1, $meta_key2, $meta_key3));
                            // delete pagebuilder content
                            IG_Pb_Utils_Common::delete_meta_key(array('_ig_page_builder_content', '_ig_page_active_tab'));
                            do_action('ig_pb_deactivate');
                        }
                    }
                }
            }
        }
    }
Пример #8
0
function frederick_die_handler($message, $title = '', $args = array())
{
    $errorTemplate = get_theme_root() . '/' . get_template() . '/error.php';
    if (!is_admin() && file_exists($errorTemplate)) {
        $defaults = array('response' => 500);
        $r = wp_parse_args($args, $defaults);
        $have_gettext = function_exists('__');
        if (function_exists('is_wp_error') && is_wp_error($message)) {
            if (empty($title)) {
                $error_data = $message->get_error_data();
                if (is_array($error_data) && isset($error_data['title'])) {
                    $title = $error_data['title'];
                }
            }
            $errors = $message->get_error_messages();
            switch (count($errors)) {
                case 0:
                    $message = '';
                    break;
                case 1:
                    $message = "<p>{$errors[0]}</p>";
                    break;
                default:
                    $message = "<ul>\n\t\t<li>" . join("</li>\n\t\t<li>", $errors) . "</li>\n\t</ul>";
                    break;
            }
        } elseif (is_string($message)) {
            $message = "<p>{$message}</p>";
        }
        if (isset($r['back_link']) && $r['back_link']) {
            $back_text = $have_gettext ? '&laquo; Back' : '&laquo; Back';
            $message .= "\n<p><a href='javascript:history.back()'>{$back_text}</a></p>";
        }
        if (empty($title)) {
            $title = $have_gettext ? 'WordPress &rsaquo; Error' : 'WordPress &rsaquo; Error';
        }
        require_once $errorTemplate;
        die;
    } else {
        _default_wp_die_handler($message, $title, $args);
    }
}
Пример #9
0
function wpac_default_wp_die_handler($message, $title = '', $args = array())
{
    // Set X-WPAC-ERROR if script "dies" when posting comment
    if (wpac_is_ajax_request()) {
        header('X-WPAC-ERROR: 1');
    }
    return _default_wp_die_handler($message, $title, $args);
}
Пример #10
0
 public function on_export_template_error(\WP_Error $error)
 {
     _default_wp_die_handler($error->get_error_message(), 'Elementor Library');
 }
Пример #11
0
 /**
  * Renders registration form.
  *
  * @since 4.1.0
  *
  * @access public
  */
 public function render_registration_form()
 {
     // check reseller
     $reseller = filter_input(INPUT_GET, 'reseller');
     $resellers = $this->_plugin->get_resellers();
     if (!isset($resellers[$reseller])) {
         status_header(404);
         exit;
     }
     // check whether reseller supports accounts registration
     $reseller = $resellers[$reseller];
     if (!$reseller->support_account_registration()) {
         _default_wp_die_handler(__("The reseller doesn't support account registration.", 'domainmap'));
     }
     // check ssl and security
     $this->_check_ssl_and_security($reseller);
     // process post request
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && $reseller->regiser_account()) {
         wp_redirect(add_query_arg(array('page' => 'domainmapping_options', 'tab' => 'reseller-options', 'registered' => 'true'), network_admin_url('settings.php', 'http')));
         exit;
     }
     define('IFRAME_REQUEST', true);
     // enqueue scripts
     wp_enqueue_script('jquery-payment');
     wp_enqueue_script('domainmapping-admin');
     // enqueue styles
     wp_enqueue_style('bootstrap-glyphs');
     wp_enqueue_style('google-font-lato');
     wp_enqueue_style('domainmapping-admin');
     // render registration form
     wp_iframe(array($reseller, 'render_registration_form'));
     exit;
 }
Пример #12
0
 public function wp_die()
 {
     _default_wp_die_handler(__('You do not have sufficient permissions to access this page.'));
 }