/** * Checks SSL connection and user permissions before render or process * registration form. * * @since 4.1.0 * * @access private * @param Domainmap_Reseller $reseller Current reseller. */ private function _check_ssl_and_security($reseller) { // check if user has permissions if (!check_admin_referer(Domainmap_Plugin::ACTION_SHOW_REGISTRATION_FORM, 'nonce') || !current_user_can('manage_network_options')) { status_header(403); exit; } // check if ssl connection is not used if ($reseller->registration_over_ssl() && !is_ssl()) { // ssl connection is not used, so if you logged in then redirect him // to https page, otherwise redirect him to login page $user_id = get_current_user_id(); if ($user_id) { // propagate SSL auth cookie wp_set_auth_cookie($user_id, true, true); // redirect to https version of this registration page wp_redirect(add_query_arg(array('action' => Domainmap_Plugin::ACTION_SHOW_REGISTRATION_FORM, 'nonce' => wp_create_nonce(Domainmap_Plugin::ACTION_SHOW_REGISTRATION_FORM), 'reseller' => filter_input(INPUT_GET, 'reseller')), admin_url('admin-ajax.php', 'https'))); exit; } else { // redirect to login form $this->redirect_to_login_form(); } } }
/** * Returns domain available response HTML with a link on purchase form or paypal checkout. * * @since 4.0.0 * * @access public * @global ProSites $psts The instance of ProSites plugin class. * @param string $sld The actual SLD. * @param string $tld The actual TLD. * @param string $purchase_link The purchase URL. * @return string Response HTML. */ public function get_domain_available_response($sld, $tld, $purchase_link = false) { global $psts; if ($psts) { if ($this->_get_gateway() == self::GATEWAY_PROSITES) { $locale = apply_filters('domainmap_locale', get_locale()); if (!preg_match('/^[a-z]{2}_[A-Z]{2}$/', $locale)) { $locale = 'en_US'; } return parent::get_domain_available_response($sld, $tld, sprintf(' <form class="domainmapping-paypal-form" action="%s"> <input type="hidden" name="action" value="%s"> <input type="hidden" name="nonce" value="%s"> <input type="hidden" name="sld" value="%s"> <input type="hidden" name="tld" value="%s"> <button type="submit" class="domainmapping-transparent-button"><img src="http://www.paypalobjects.com/%s/i/btn/btn_buynow_LG.gif" alt="%s"></button> </form> ', admin_url('admin-ajax.php'), Domainmap_Plugin::ACTION_PAYPAL_PURCHASE, wp_create_nonce(Domainmap_Plugin::ACTION_PAYPAL_PURCHASE), $sld, $tld, $locale, __('Purchase this domain with PayPal Express Checkout.', 'domainmap'))); } } return parent::get_domain_available_response($sld, $tld, $purchase_link); }
/** * Returns array of resellers. * * @since 4.0.0 * * @access public * @return array The array of resellers. */ public function get_resellers() { if (is_null($this->_resellers)) { $this->_resellers = array(); $resellers = apply_filters('domainmapping_resellers', array()); foreach ($resellers as $reseller) { if (is_object($reseller) && is_a($reseller, 'Domainmap_Reseller')) { $this->_resellers[Domainmap_Reseller::encode_reseller_class(get_class($reseller))] = $reseller; } } } return $this->_resellers; }
/** * Extra controls to be displayed between bulk actions and pagination * * @since 3.1.0 * @access protected */ public function extra_tablenav($which) { $current_type = filter_input(INPUT_GET, 'type'); ?> <div class="alignleft actions"><?php if ('top' == $which) { ?> <select name="type"> <option value=""><?php _e('Show all actions', 'domainmap'); ?> </option> <?php foreach (Domainmap_Reseller::get_request_types() as $type => $label) { printf('<option%s value="%s">%s</option>', selected($type, $current_type, false), esc_attr($type), esc_html($label)); } ?> </select><?php submit_button(__('Filter'), 'button', false, false, array('id' => 'post-query-submit')); } ?> </div><?php }