Ejemplo n.º 1
0
/**
 * Function is responsible for forcing the page to be ssl
 *
 * @return unknown
 */
function force_ssl($url = null)
{
    //loading configuration settings
    $five_config = fiveConfigurations();
    //reasons to return
    if ($five_config->base->force_ssl == '') {
        return false;
    }
    if (BRequest::getVar("HTTPS", false) == "on") {
        return false;
    }
    if (BRequest::getVar("SERVER_PORT", false) == 443) {
        return false;
    }
    if (is_null($url)) {
        //redirect( SITE_BASEURL_SECURE.substr($_SERVER['REQUEST_URI'],1) );
        $url = BRequest::getVar("SERVER_NAME", url()) . BRequest::getVar("REQUEST_URI");
    }
    //redirect to secure url
    redirect($url);
}
Ejemplo n.º 2
0
defined('ABSPATH') or _die("Cannot access pages directly.");
/**
 * Request XML File 
 * 
 * This is the xml schema that we're using to request data
 * from Internet Secure Merchant Direct.
 */
defined("ITERNETSECUREXML") or define("ITERNETSECUREXML", dirname(__FILE__) . DS . "InternetSecure.xml");
/**
 * Response URL
 * 
 * Internet Secure Merchant Direct will respond back to us
 * with the results. Here's the url that we want them to respond
 * back to.
 */
$five_config = fiveConfigurations();
defined("ITERNETSECURERESPONSE") or define("ITERNETSECURERESPONSE", $five_config->base->url . "?five_ajax=CCresponse");
/**
 * AUTHORIZING
 * 
 * Function is responsible for making sure that the credit 
 * card has money on it.
 * 
 * @param unknown_type $data
 * @param unknown_type $fiveConfig
 * @param unknown_type $testMode
 */
function InternetSecureAuthorize($data, $config, $testMode)
{
    //If we're not using this gateway then exit
    if ($data['gateway'] != 'InternetSecure') {
Ejemplo n.º 3
0
function pms_path_site()
{
    //loading configuration settings
    $five_config = fiveConfigurations();
    return $five_config->base->url;
}
Ejemplo n.º 4
0
/**
 * Retrieve the raw response from the HTTP request using the GET method.
 *
 * @see wp_remote_request() For more information on the response array format.
 *
 * @since 2.7.0
 *
 * @param string $url Site URL to retrieve.
 * @param array $args Optional. Override the defaults.
 * @return WP_Error|array The response or WP_Error on failure.
 */
function five_remote_get($url, $args = array())
{
    //initializing
    $defaults = array('method' => 'POST', 'timeout' => apply_filters('http_request_timeout', 5), 'redirection' => apply_filters('http_request_redirection_count', 5), 'httpversion' => apply_filters('http_request_version', '1.0'), 'user-agent' => apply_filters('http_headers_useragent', '5TwentyStudiosCMS/1.0; http://www.5twentystudios.com'), 'blocking' => true, 'headers' => array(), 'cookies' => array(), 'body' => null, 'compress' => false, 'decompress' => true, 'sslverify' => true);
    $r = five_parse_args($args, $defaults);
    $r = apply_filters('http_request_args', $r, $url);
    // Allow plugins to short-circuit the request
    $pre = apply_filters('pre_http_request', false, $r, $url);
    if (false !== $pre) {
        return $pre;
    }
    $fiveConfig = fiveConfigurations();
    $arrURL = parse_url($url);
    if (empty($url) || empty($arrURL['scheme'])) {
        return array('error' => 'http_request_insufficient_data', '' => 'A valid URL was not provided.');
    }
    // Determine if this is a https call and pass that on to the transport functions
    // so that we can blacklist the transports that do not support ssl verification
    $r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
    // Determine if this request is to OUR install of WordPress
    $homeURL = parse_url($fiveConfig->base->url);
    $r['local'] = $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host'];
    unset($homeURL);
    if (is_null($r['headers'])) {
        $r['headers'] = array();
    }
    if (!is_array($r['headers'])) {
        $processedHeaders = BCurl::processHeaders($r['headers']);
        $r['headers'] = $processedHeaders['headers'];
    }
    if (isset($r['headers']['User-Agent'])) {
        $r['user-agent'] = $r['headers']['User-Agent'];
        unset($r['headers']['User-Agent']);
    }
    if (isset($r['headers']['user-agent'])) {
        $r['user-agent'] = $r['headers']['user-agent'];
        unset($r['headers']['user-agent']);
    }
    if (BCurl::encoding_is_available()) {
        $r['headers']['Accept-Encoding'] = BCurl::accept_encoding();
    }
    if (empty($r['body'])) {
        $r['body'] = null;
        // Some servers fail when sending content without the content-length header being set.
        // Also, to fix another bug, we only send when doing POST and PUT and the content-length
        // header isn't already set.
        if (($r['method'] == 'POST' || $r['method'] == 'PUT') && !isset($r['headers']['Content-Length'])) {
            $r['headers']['Content-Length'] = 0;
        }
    } else {
        if (is_array($r['body']) || is_object($r['body'])) {
            if (!version_compare(phpversion(), '5.1.2', '>=')) {
                $r['body'] = _http_build_query($r['body'], null, '&');
            } else {
                $r['body'] = http_build_query($r['body'], null, '&');
            }
            $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset');
            $r['headers']['Content-Length'] = strlen($r['body']);
        }
        if (!isset($r['headers']['Content-Length']) && !isset($r['headers']['content-length'])) {
            $r['headers']['Content-Length'] = strlen($r['body']);
        }
    }
    //finally..  make the request
    $bcurl = new BCurl();
    $response = $bcurl->request($url, $r);
    return $response;
}
Ejemplo n.º 5
0
 /**
  * Create a configuration object
  *
  * @access private
  * @param string	The path to the configuration file
  * @param string	The type of the configuration file
  * @return object JRegistry
  * @since 1.5
  */
 function &_createConfig()
 {
     $five_config = fiveConfigurations();
     return $five_config;
 }