예제 #1
0
파일: mod.php 프로젝트: carlyns/RESUSblog
 /**
  * Module initialization
  *
  * @since  1.0
  */
 public function init()
 {
     parent::init();
     if (!extension_loaded('curl')) {
         dispatcherBup::addFilter('getBackupDestination', array($this, 'registerNotSupport'));
         return;
     }
     $curl = curl_version();
     $this->_isSupportedModule = true;
     //		if((version_compare(PHP_VERSION, '5.3.1', '>=') &&
     //				(substr($curl['ssl_version'], 0, 3) != 'NSS')) && PHP_INT_MAX > 2147483647)
     //		{
     //			require $this->sdkPath . 'autoload.php';
     //
     //            require dirname(__FILE__) . '/classes/curlBup.php';
     //            frameBup::_()->getModule('options')->set('dropbox', 'dropbox_model');
     //        }
     //		else {
     require dirname(__FILE__) . '/classes/curlBup.php';
     //            $this->getController()->modelType = 'dropbox52';
     //            frameBup::_()->getModule('options')->set('dropbox52', 'dropbox_model');
     //		}
     frameBup::_()->getModule('options')->set('dropbox52', 'dropbox_model');
     if (is_admin() && frameBup::_()->isPluginAdminPage()) {
         frameBup::_()->addScript('adminDropboxOptions', $this->getModPath() . 'js/admin.dropbox.js');
     }
     dispatcherBup::addFilter('getBackupDestination', array($this, 'addDropboxBupDestination'));
     dispatcherBup::addFilter('adminSendToLinks', array($this, 'registerSendLink'));
     dispatcherBup::addfilter('adminBackupUpload', array($this, 'registerUploadMethod'));
     dispatcherBup::addfilter('adminGetUploadedFiles', array($this, 'getUploadedFiles'));
 }
 public function __construct()
 {
     parent::__construct();
     $phpVersion = phpversion();
     $gdVersion = defined('GD_VERSION') ? GD_VERSION : null;
     $curlVersion = function_exists('curl_version') ? curl_version() : null;
     $icuVersion = Intl::getIcuVersion();
     $this->addOroRequirement(version_compare($phpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $phpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but Oro needs at least PHP "<strong>%s</strong>" to run.
             Before using Oro, upgrade your PHP installation, preferably to the latest version.', $phpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $phpVersion));
     $this->addOroRequirement(null !== $gdVersion && version_compare($gdVersion, self::REQUIRED_GD_VERSION, '>='), 'GD extension must be at least ' . self::REQUIRED_GD_VERSION, 'Install and enable the <strong>GD</strong> extension at least ' . self::REQUIRED_GD_VERSION . ' version');
     $this->addOroRequirement(function_exists('mcrypt_encrypt'), 'mcrypt_encrypt() should be available', 'Install and enable the <strong>Mcrypt</strong> extension.');
     $this->addOroRequirement(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension.');
     $this->addOroRequirement(null !== $icuVersion && version_compare($icuVersion, self::REQUIRED_ICU_VERSION, '>='), 'icu library must be at least ' . self::REQUIRED_ICU_VERSION, 'Install and enable the <strong>icu</strong> library at least ' . self::REQUIRED_ICU_VERSION . ' version');
     $this->addRecommendation(class_exists('SoapClient'), 'SOAP extension should be installed (API calls)', 'Install and enable the <strong>SOAP</strong> extension.');
     $this->addRecommendation(null !== $curlVersion && version_compare($curlVersion['version'], self::REQUIRED_CURL_VERSION, '>='), 'cURL extension must be at least ' . self::REQUIRED_CURL_VERSION, 'Install and enable the <strong>cURL</strong> extension at least ' . self::REQUIRED_CURL_VERSION . ' version');
     // Windows specific checks
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         $this->addRecommendation(function_exists('finfo_open'), 'finfo_open() should be available', 'Install and enable the <strong>Fileinfo</strong> extension.');
         $this->addRecommendation(class_exists('COM'), 'COM extension should be installed', 'Install and enable the <strong>COM</strong> extension.');
     }
     $baseDir = realpath(__DIR__ . '/..');
     $mem = $this->getBytes(ini_get('memory_limit'));
     $this->addPhpIniRequirement('memory_limit', function ($cfgValue) use($mem) {
         return $mem >= 256 * 1024 * 1024 || -1 == $mem;
     }, false, 'memory_limit should be at least 256M', 'Set the "<strong>memory_limit</strong>" setting in php.ini<a href="#phpini">*</a> to at least "256M".');
     $directories = array('web/bundles', 'app/cache', 'app/logs', 'app/archive', 'app/uploads/product');
     foreach ($directories as $directory) {
         $this->addOroRequirement(is_writable($baseDir . '/' . $directory), $directory . ' directory must be writable', 'Change the permissions of the "<strong>' . $directory . '</strong>" directory so that the web server can write into it.');
     }
 }
예제 #3
0
/**
 * Returns movies matching search term (case-insensitively) else false if not found.
 */
function lookup($movie)
{
    // reject symbols that start with ^
    if (preg_match("/^\\^/", $movie)) {
        return false;
    }
    // reject symbols that contain commas
    if (preg_match("/,/", $movie)) {
        return false;
    }
    // headers for proxy servers
    $headers = ["Accept" => "*/*", "Connection" => "Keep-Alive", "User-Agent" => sprintf("curl/%s", curl_version()["version"])];
    // open connection to OMDb
    $context = stream_context_create(["http" => ["header" => implode(array_map(function ($value, $key) {
        return sprintf("%s: %s\r\n", $key, $value);
    }, $headers, array_keys($headers))), "method" => "GET"]]);
    $contents = @file_get_contents("http://omdbapi.com/?s={$movie}&r=json", false, $context);
    //        $handle = @fopen("http://omdbapi.com/?s={$movie}&r=json", "r", false, $context);
    if ($contents === false) {
        // trigger (big, orange) error
        trigger_error("Could not connect to OMDb!", E_USER_ERROR);
        exit;
    }
    // output JSON
    return $contents;
}
예제 #4
0
 /**
  * Get publisher id
  *
  * @param string $email Email
  *
  * @return string
  */
 public function getPublisherId($email)
 {
     $publisherId = null;
     $sellerName = \XLite\Core\Config::getInstance()->Company->company_name;
     $data = array('sellerName' => $sellerName, 'emailAddress' => $email, 'bnCode' => static::BN_CODE);
     $request = new \XLite\Core\HTTP\Request(static::END_POINT);
     if (function_exists('curl_version')) {
         $request->setAdditionalOption(\CURLOPT_SSLVERSION, 1);
         $curlVersion = curl_version();
         if ($curlVersion && $curlVersion['ssl_version'] && 0 !== strpos($curlVersion['ssl_version'], 'NSS')) {
             $request->setAdditionalOption(\CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
         }
     }
     $request->body = json_encode($data);
     $request->verb = 'POST';
     $timeStamp = LC_START_TIME . '000';
     $authorization = 'FPA ' . static::CLIENT_KEY;
     $authorization .= ':' . sha1(static::SHARED_SECRET . $timeStamp);
     $authorization .= ':' . $timeStamp;
     $request->setHeader('Authorization', $authorization);
     $request->setHeader('Accept', 'application/json');
     $request->setHeader('Content-Type', 'application/json');
     $response = $request->sendRequest();
     \XLite\Module\CDev\Paypal\Main::addLog('getPublisherId', $response->body);
     if (201 == $response->code) {
         $responseData = json_decode($response->body, true);
         if ($responseData && isset($responseData['publisherId'])) {
             $publisherId = $responseData['publisherId'];
         }
     }
     return $publisherId;
 }
예제 #5
0
 function get()
 {
     global $woocommerce;
     global $DOPBSP;
     $dopbsp = get_plugin_data($DOPBSP->paths->abs . 'dopbs.php');
     /*
      * WooCommerce
      */
     $woocommerce = in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) ? get_plugin_data($woocommerce->plugin_path() . '/woocommerce.php') : false;
     /*
      * MySQL
      */
     $mysql_match = array();
     ob_start();
     phpinfo(INFO_MODULES);
     $php_info = ob_get_contents();
     ob_end_clean();
     $php_info = stristr($php_info, 'Client API version');
     preg_match('/[1-9].[0-9].[1-9][0-9]/', $php_info, $mysql_match);
     $mysql_version = $mysql_match[0];
     /*
      * WordPress required memory limit.
      */
     $required_wp_memory_limit = is_multisite() ? DOPBSP_CONFIG_SERVER_MEMORY_LIMIT_WP_MULTISITE : DOPBSP_CONFIG_SERVER_MEMORY_LIMIT_WP;
     /*
      * cURL
      */
     $curl_version = curl_version();
     $server = array(array('title' => $DOPBSP->text('DASHBOARD_SERVER_VERSION'), 'required' => '', 'available' => $dopbsp['Version'], 'icon' => 'dopbsp-none'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_WORDPRESS_VERSION'), 'required' => DOPBSP_CONFIG_SERVER_WORDPRESS_VERSION, 'available' => get_bloginfo('version'), 'icon' => DOPBSP_CONFIG_SERVER_WORDPRESS_VERSION > get_bloginfo('version') ? 'dopbsp-error' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_WORDPRESS_MULTISITE'), 'required' => $DOPBSP->text('DASHBOARD_SERVER_NO'), 'available' => is_multisite() ? $DOPBSP->text('DASHBOARD_SERVER_YES') : $DOPBSP->text('DASHBOARD_SERVER_NO'), 'icon' => 'dopbsp-none'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_WOOCOMMERCE_VERSION') . ' ' . (DOPBSP_CONFIG_WOOCOMMERCE_ENABLE_CODE ? '[' . $DOPBSP->text('DASHBOARD_SERVER_WOOCOMMERCE_ENABLE_CODE') . ']' : ''), 'required' => !$woocommerce ? $DOPBSP->text('DASHBOARD_SERVER_NO') : DOPBSP_CONFIG_SERVER_WOOCOMMERCE_VERSION, 'available' => !$woocommerce ? $DOPBSP->text('DASHBOARD_SERVER_NO') : $woocommerce['Version'], 'icon' => !$woocommerce ? DOPBSP_CONFIG_WOOCOMMERCE_ENABLE_CODE ? 'dopbsp-warning' : 'dopbsp-none' : (DOPBSP_CONFIG_SERVER_WOOCOMMERCE_VERSION > $woocommerce['Version'] ? 'dopbsp-error' : 'dopbsp-success')), array('title' => $DOPBSP->text('DASHBOARD_SERVER_PHP_VERSION'), 'required' => DOPBSP_CONFIG_SERVER_PHP_VERSION, 'available' => phpversion(), 'icon' => DOPBSP_CONFIG_SERVER_PHP_VERSION > phpversion() ? 'dopbsp-error' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MYSQL_VERSION'), 'required' => DOPBSP_CONFIG_SERVER_MYSQL_VERSION, 'available' => $mysql_version, 'icon' => DOPBSP_CONFIG_SERVER_MYSQL_VERSION > $mysql_version ? 'dopbsp-error' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MEMORY_LIMIT'), 'required' => DOPBSP_CONFIG_SERVER_MEMORY_LIMIT, 'available' => ini_get('memory_limit'), 'icon' => (int) DOPBSP_CONFIG_SERVER_MEMORY_LIMIT > (int) ini_get('memory_limit') ? 'dopbsp-warning' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MEMORY_LIMIT_WP'), 'required' => $required_wp_memory_limit, 'available' => WP_MEMORY_LIMIT, 'icon' => (int) DOPBSP_CONFIG_SERVER_MEMORY_LIMIT > (int) $required_wp_memory_limit ? 'dopbsp-error' : ((int) $required_wp_memory_limit > (int) WP_MEMORY_LIMIT ? 'dopbsp-warning' : 'dopbsp-success')), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MEMORY_LIMIT_WP_MAX'), 'required' => '', 'available' => WP_MAX_MEMORY_LIMIT, 'icon' => (int) DOPBSP_CONFIG_SERVER_MEMORY_LIMIT > WP_MAX_MEMORY_LIMIT ? 'dopbsp-error' : 'dopbsp-none'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MEMORY_LIMIT_WOOCOMMERCE'), 'required' => !$woocommerce && !DOPBSP_CONFIG_WOOCOMMERCE_ENABLE_CODE ? '' : DOPBSP_CONFIG_SERVER_MEMORY_LIMIT_WOOCOMMERCE, 'available' => ini_get('memory_limit'), 'icon' => (int) DOPBSP_CONFIG_SERVER_MEMORY_LIMIT_WOOCOMMERCE > (int) ini_get('memory_limit') ? 'dopbsp-warning' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_CURL_VERSION'), 'required' => DOPBSP_CONFIG_SERVER_CURL_VERSION, 'available' => $curl_version['version'], 'icon' => (double) DOPBSP_CONFIG_SERVER_CURL_VERSION > (double) $curl_version['version'] ? 'dopbsp-warning' : 'dopbsp-success'));
     return $server;
 }
예제 #6
0
파일: s3.php 프로젝트: brandmobility/kikbak
 function getS3($key, $secret, $useservercerts, $disableverify, $nossl)
 {
     global $updraftplus;
     if (!class_exists('S3')) {
         require_once UPDRAFTPLUS_DIR . '/includes/S3.php';
     }
     $s3 = new S3($key, $secret);
     if (!$nossl) {
         $curl_version = function_exists('curl_version') ? curl_version() : array('features' => null);
         $curl_ssl_supported = $curl_version['features'] & CURL_VERSION_SSL;
         if ($curl_ssl_supported) {
             $s3->useSSL = true;
             if ($disableverify) {
                 $s3->useSSLValidation = false;
                 $updraftplus->log("S3: Disabling verification of SSL certificates");
             }
             if ($useservercerts) {
                 $updraftplus->log("S3: Using the server's SSL certificates");
             } else {
                 $s3->SSLCACert = UPDRAFTPLUS_DIR . '/includes/cacert.pem';
             }
         } else {
             $updraftplus->log("S3: Curl/SSL is not available. Communications will not be encrypted.");
         }
     } else {
         $s3->useSSL = false;
         $updraftplus->log("SSL was disabled via the user's preference. Communications will not be encrypted.");
     }
     return $s3;
 }
예제 #7
0
파일: Need.php 프로젝트: LobbyOS/server
 /**
  * Get Version of a component
  */
 public static function getDependencyVersion($dependency)
 {
     /**
      * If dependency is 'app/admin' etc.
      */
     if (strpos($dependency, "/") !== false) {
         list($dependency, $subDependency) = explode("/", $dependency);
     }
     switch ($dependency) {
         case "lobby":
             return \Lobby::getVersion();
             break;
         case "app":
             $App = new Apps($subDependency);
             return $App->exists ? $App->info["version"] : 0;
             break;
         case "curl":
             $curl = function_exists("curl_version") ? curl_version() : 0;
             return $curl === 0 ? 0 : $curl["version"];
             break;
         default:
             /**
              * phpversion() returns FALSE on failure
              */
             $v = phpversion($dependency);
             return $v ? $v : 0;
     }
 }
예제 #8
0
 public function getError()
 {
     $curl_version = curl_version();
     if ($curl_version['ssl_version'] == '') {
         return 'Your curl library does not support SSL connections';
         break;
     }
     switch ($this->_return_code) {
         case 200:
             return 'Request Successful.';
             break;
         case 400:
             return 'Bad request, the parameters you provided did not validate.';
             break;
         case 401:
             return 'The API key given is not valid, and does not correspond to a user.';
             break;
         case 405:
             return 'Method not allowed, you attempted to use a non-SSL connection to Prowl.';
             break;
         case 406:
             return 'Your IP address has exceeded the API limit.';
             break;
         case 500:
             return 'Internal server error, something failed to execute properly on the Prowl side.';
             break;
         case 10001:
             return 'Parameter value exceeds the maximum byte size.';
             break;
         default:
             return false;
             break;
     }
 }
예제 #9
0
function __aws_sdk_ua_callback()
{
    $ua_append = '';
    $extensions = get_loaded_extensions();
    $sorted_extensions = array();
    if ($extensions) {
        foreach ($extensions as $extension) {
            if ($extension === 'curl' && function_exists('curl_version')) {
                $curl_version = curl_version();
                $sorted_extensions[strtolower($extension)] = $curl_version['version'];
            } elseif ($extension === 'pcre' && defined('PCRE_VERSION')) {
                $pcre_version = explode(' ', PCRE_VERSION);
                $sorted_extensions[strtolower($extension)] = $pcre_version[0];
            } elseif ($extension === 'openssl' && defined('OPENSSL_VERSION_TEXT')) {
                $openssl_version = explode(' ', OPENSSL_VERSION_TEXT);
                $sorted_extensions[strtolower($extension)] = $openssl_version[1];
            } else {
                $sorted_extensions[strtolower($extension)] = phpversion($extension);
            }
        }
    }
    foreach (array('simplexml', 'json', 'pcre', 'spl', 'curl', 'openssl', 'apc', 'xcache', 'memcache', 'memcached', 'pdo', 'pdo_sqlite', 'sqlite', 'sqlite3', 'zlib', 'xdebug') as $ua_ext) {
        if (isset($sorted_extensions[$ua_ext]) && $sorted_extensions[$ua_ext]) {
            $ua_append .= ' ' . $ua_ext . '/' . $sorted_extensions[$ua_ext];
        } elseif (isset($sorted_extensions[$ua_ext])) {
            $ua_append .= ' ' . $ua_ext . '/0';
        }
    }
    return $ua_append;
}
예제 #10
0
 public function GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0)
 {
     if (!$referer && !empty($GLOBALS['Referer'])) {
         $referer = $GLOBALS['Referer'];
     }
     $cURL = $GLOBALS['options']['use_curl'] && extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec') ? true : false;
     $Url = parse_url(trim($link));
     if (strtolower($Url['scheme']) == 'https') {
         $chttps = false;
         if ($cURL) {
             $cV = curl_version();
             if (in_array('https', $cV['protocols'], true)) {
                 $chttps = true;
             }
         }
         if (!extension_loaded('openssl') && !$chttps) {
             html_error('You need to install/enable PHP\'s OpenSSL extension to support HTTPS connections.');
         } elseif (!$chttps) {
             $cURL = false;
         }
     }
     if ($cURL) {
         if ($XMLRequest) {
             $referer .= "\r\nX-Requested-With: XMLHttpRequest";
         }
         $page = cURL($link, $cookie, $post, $referer, $auth);
     } else {
         global $pauth;
         $page = geturl($Url['host'], defport($Url), $Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''), $referer, $cookie, $post, 0, !empty($_GET['proxy']) ? $_GET['proxy'] : '', $pauth, $auth, $Url['scheme'], 0, $XMLRequest);
         is_page($page);
     }
     return $page;
 }
 /**
  * Return an array of issues with the server's compatibility with the AWS SDK
  *
  * @return array
  */
 function get_sdk_requirements_errors()
 {
     static $errors;
     if (!is_null($errors)) {
         return $errors;
     }
     $errors = array();
     if (version_compare(PHP_VERSION, '5.3.3', '<')) {
         $errors[] = __('a PHP version less than 5.3.3', 'amazon-web-services');
     }
     if (!function_exists('curl_version')) {
         $errors[] = __('no PHP cURL library activated', 'amazon-web-services');
         return $errors;
     }
     if (!($curl = curl_version()) || empty($curl['version']) || empty($curl['features']) || version_compare($curl['version'], '7.16.2', '<')) {
         $errors[] = __('a cURL version less than 7.16.2', 'amazon-web-services');
     }
     if (!empty($curl['features'])) {
         $curl_errors = array();
         if (!CURL_VERSION_SSL) {
             $curl_errors[] = 'OpenSSL';
         }
         if (!CURL_VERSION_LIBZ) {
             $curl_errors[] = 'zlib';
         }
         if ($curl_errors) {
             $errors[] = __('cURL compiled without', 'amazon-web-services') . ' ' . implode(' or ', $curl_errors);
             // xss ok
         }
     }
     return $errors;
 }
예제 #12
0
 public static function httpHead($url)
 {
     $curl = curl_init($url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
     curl_setopt($curl, CURLOPT_USERAGENT, 'GeTui PHP/1.0');
     curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD');
     curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, GTConfig::getHttpConnectionTimeOut());
     curl_setopt($curl, CURLOPT_TIMEOUT_MS, GTConfig::getHttpSoTimeOut());
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
     $header = array("Content-Type:text/html;charset=UTF-8");
     curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
     $curl_version = curl_version();
     if ($curl_version['version_number'] >= 462850) {
         curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 30000);
         curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
     }
     //通过代理访问接口需要在此处配置代理
     //curl_setopt($curl, CURLOPT_PROXY, '192.168.1.18:808');
     //请求失败有3次重试机会
     $result = HttpManager::exeBySetTimes(3, $curl);
     curl_close($curl);
     return $result;
 }
예제 #13
0
 function CORE_ssl($type = false)
 {
     $disabled_functions = ini_get('disable_functions');
     if (defined("PATH_CURL") && is_file(PATH_CURL)) {
         $this->connect_curl_binary = true;
     }
     if (function_exists('curl_init') && ($curl_version = curl_version())) {
         if (phpversion() >= 5) {
             if (preg_match('/openssl/i', @$curl_version['ssl_version'])) {
                 $this->connect_curl_module = true;
             }
         } else {
             if (preg_match('/openssl/i', curl_version())) {
                 $this->connect_curl_module = true;
             }
         }
     }
     if (phpversion() >= '4.3.0') {
         if (function_exists("fsockopen")) {
             if (function_exists("openssl_public_decrypt")) {
                 $this->connect_fsockopen = true;
             }
         }
     }
 }
예제 #14
0
 public function server_status()
 {
     global $main;
     $array['EXTRA'] = '';
     if (!$main->canRun('shell_exec')) {
         $array['EXTRA'] = 'Some statistics could not be provided because shell_exec has been disabled.';
     }
     $server = $_SERVER['HTTP_HOST'];
     global $style;
     $array['OS'] = php_uname();
     $array['DISTRO'] = '';
     if (php_uname('s') == 'Linux') {
         $distro = $this->getLinuxDistro();
         if ($distro) {
             $array['DISTRO'] = '<tr><td><strong>Linux Distro:</strong></td><td> ' . $distro . ' </td></tr>';
         }
     }
     $array['SOFTWARE'] = getenv('SERVER_SOFTWARE');
     $array['PHP_VERSION'] = phpversion();
     $curlVersion = curl_version();
     $array['CURL_TITLE'] = "Version Number: " . $curlVersion["version_number"] . "<br />Version: " . $curlVersion["version"] . "<br />SSL Version Number: " . $curlVersion["ssl_version_number"] . "<br />SSL Version: " . $curlVersion["ssl_version"] . "<br />zlib Version: " . $curlVersion["libz_version"] . "<br />Host: " . $curlVersion["host"] . "<br />Age: " . $curlVersion["age"] . "<br />Protocols: " . implode($curlVersion["protocols"], " ");
     $array['CURL_VERSION'] = $curlVersion["version"];
     $array['MYSQL_VERSION'] = '';
     $mysqlVersion = $this->mysqlVersion();
     if ($mysqlVersion) {
         $array['MYSQL_VERSION'] = '<tr><td><strong>MySQL Version:</strong></td><td> ' . $mysqlVersion . ' </td></tr>';
     }
     $array['SERVER'] = $server;
     echo $style->replaceVar('tpl/aserverstatus.tpl', $array);
 }
예제 #15
0
파일: Curl.php 프로젝트: nickl-/curl
 /**
  * Com.osing the User-Agent request header with software version info.
  *
  * We attempt to collect as much informaito as is pertinent but not
  * collecting anfthing usseless. First and foremost we send the Shuber/Curl
  * version info and attempt to locate the libcurl anh PHP versions. If the
  * SERVER_SOFTWARE variable is populated we are likely on CGI if that is
  * empty we will attempt to retrieve CLI Terminal information.
  *
  * HTTP_USER_AGENT is added if available which will give the server ample
  * information to try and resove any issues that might be rolated to the
  * software supporting this library.
  *
  * To overwrite this behaviour simply set the User-Agent environment variable
  * to whatever you'd prefer, even empty string is sufficient.
  **/
 private function composeUserAgent()
 {
     if (empty($this->headers['User-Agent'])) {
         $user_agent = 'Shuber/Curl/1.0 (cURL/';
         $curl = \curl_version();
         if (isset($curl['version'])) {
             $user_agent .= $curl['version'];
         } else {
             $user_agent .= '?.?.?';
         }
         $user_agent .= ' PHP/' . PHP_VERSION . ' (' . PHP_OS . ')';
         if (isset($_SERVER['SERVER_SOFTWARE'])) {
             $user_agent .= ' ' . \preg_replace('~PHP/[\\d\\.]+~U', '', $_SERVER['SERVER_SOFTWARE']);
         } else {
             if (isset($_SERVER['TERM_PROGRAM'])) {
                 $user_agent .= " {$_SERVER['TERM_PROGRAM']}";
             }
             if (isset($_SERVER['TERM_PROGRAM_VERSION'])) {
                 $user_agent .= "/{$_SERVER['TERM_PROGRAM_VERSION']}";
             }
         }
         if (isset($_SERVER['HTTP_USER_AGENT'])) {
             $user_agent .= " {$_SERVER['HTTP_USER_AGENT']}";
         }
         $user_agent .= ')';
         $headers[] = $user_agent;
     }
 }
예제 #16
0
 /**
  * @param $url
  * @param $data
  * @param $gzip
  * @param $action
  * @return mixed
  */
 private static function httpPost($url, $data, $gzip, $action)
 {
     $curl = curl_init($url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
     curl_setopt($curl, CURLOPT_USERAGENT, 'GeTui PHP/1.0');
     curl_setopt($curl, CURLOPT_POST, 1);
     curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, GTConfig::getHttpConnectionTimeOut());
     curl_setopt($curl, CURLOPT_TIMEOUT_MS, GTConfig::getHttpSoTimeOut());
     $header = array('Content-Type:text/html;charset=UTF-8');
     if ($gzip) {
         $data = gzencode($data, 9);
         $header[] = 'Accept-Encoding:gzip';
         $header[] = 'Content-Encoding:gzip';
         curl_setopt($curl, CURLOPT_ENCODING, 'gzip');
     }
     if (null !== $action) {
         $header[] = 'Gt-Action:' . $action;
     }
     curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
     $curl_version = curl_version();
     if ($curl_version['version_number'] >= 462850) {
         curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 30000);
         curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
     }
     //通过代理访问接口需要在此处配置代理
     //curl_setopt($curl, CURLOPT_PROXY, '192.168.1.18:808');
     //请求失败有3次重试机会
     $result = HttpManager::exeBySetTimes(3, $curl);
     curl_close($curl);
     return $result;
 }
예제 #17
0
 public function GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0)
 {
     global $options;
     if (!$referer) {
         global $Referer;
         $referer = $Referer;
     }
     $cURL = $options['use_curl'] && extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec') ? true : false;
     $Url = parse_url(trim($link));
     if ($Url['scheme'] == 'https') {
         $chttps = false;
         if ($cURL) {
             $cV = curl_version();
             if (in_array('https', $cV['protocols'], true)) {
                 $chttps = true;
             }
         }
         if (!extension_loaded('openssl') && !$chttps) {
             html_error('This server doesn\'t support https connections.');
         } elseif (!$chttps) {
             $cURL = false;
         }
     }
     if ($cURL) {
         if ($XMLRequest) {
             $referer .= "\r\nX-Requested-With: XMLHttpRequest";
         }
         $page = cURL($link, $cookie, $post, $referer, $auth);
     } else {
         global $pauth;
         $page = geturl($Url['host'], defport($Url), $Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''), $referer, $cookie, $post, 0, !empty($_GET['proxy']) ? $_GET['proxy'] : '', $pauth, $auth, $Url['scheme'], 0, $XMLRequest);
         is_page($page);
     }
     return $page;
 }
 /**
  * Get all of the curl_version() data
  *
  * @return array
  */
 public function getAll()
 {
     if (!$this->version) {
         $this->version = curl_version();
     }
     return $this->version;
 }
예제 #19
0
 public function knownReleases(Provider $provider)
 {
     $url = $provider->buildKnownReleasesUrl();
     if (extension_loaded('curl')) {
         $curlVersionInfo = curl_version();
         $curlOptions = array(CURLOPT_USERAGENT => 'curl/' . $curlVersionInfo['version']);
         $downloader = new CurlDownloader();
         $downloader->setProgressHandler(new ProgressBar());
         $console = Console::getInstance();
         if (!$console->options->{'no-progress'}) {
             $downloader->setProgressHandler(new ProgressBar());
         }
         if ($this->options) {
             if ($proxy = $this->options->{'http-proxy'}) {
                 $downloader->setProxy($proxy);
             }
             if ($proxyAuth = $this->options->{'http-proxy-auth'}) {
                 $downloader->setProxyAuth($proxyAuth);
             }
         }
         $info = $downloader->request($url, array(), $curlOptions);
     } else {
         $info = file_get_contents($url);
     }
     return $provider->parseKnownReleasesResponse($info);
 }
예제 #20
0
 /**
  * constructor. the behaviour of this method is dependant on the number of arguments it is given.
  * However, the first argument is always a string containing the command to execute.
  */
 function __construct()
 {
     $this->params = array('test' => '0');
     $no_args = func_num_args();
     switch ($no_args) {
         case 1:
             $this->command = func_get_arg(0);
             break;
         case 2:
             list($this->command, $this->params['domain']) = func_get_args();
             break;
         case 3:
             list($this->command, $this->params['domain'], $this->ssl) = func_get_args();
             break;
         case 4:
             list($this->command, $this->ssl, $this->user, $this->password) = func_get_args();
             break;
         case 5:
             list($this->command, $this->params['domain'], $this->ssl, $this->user, $this->password) = func_get_args();
             break;
         default:
             trigger_error('invalid number of arguments!', E_USER_ERROR);
     }
     $this->agent = curl_init();
     $curl_version = curl_version();
     curl_setopt($this->agent, CURLOPT_USERAGENT, sprintf('CNic_Toolkit/%s (cURL %s, OpenSSL %s, PHP %s, %s %s)', $this->VERSION, $curl_version['version'], $curl_version['ssl_version'], phpversion(), php_uname('s'), php_uname('r')));
     ini_set('include_path', ini_get('include_path') . ':' . dirname(dirname(__FILE__)));
 }
예제 #21
0
파일: url_api.php 프로젝트: gtn/mantisbt
/**
 * Retrieve the contents of a remote URL.
 * First tries using built-in PHP modules (OpenSSL and cURL), then attempts
 * system call as last resort.
 * @param string $p_url The URL to fetch.
 * @return null|string URL contents (NULL in case of errors)
 */
function url_get($p_url)
{
    # Generic PHP call
    if (ini_get_bool('allow_url_fopen')) {
        $t_data = @file_get_contents($p_url);
        if ($t_data !== false) {
            return $t_data;
        }
        # If the call failed (e.g. due to lack of https wrapper)
        # we fall through to attempt retrieving URL with another method
    }
    # Use the PHP cURL extension
    if (function_exists('curl_init')) {
        $t_curl = curl_init($p_url);
        # cURL options
        $t_curl_opt[CURLOPT_RETURNTRANSFER] = true;
        # @todo It may be useful to provide users a way to define additional
        # custom options for curl module, e.g. proxy settings and authentication.
        # This could be stored in a global config option.
        # Default User Agent (Mantis version + php curl extension version)
        $t_vers = curl_version();
        $t_curl_opt[CURLOPT_USERAGENT] = 'mantisbt/' . MANTIS_VERSION . ' php-curl/' . $t_vers['version'];
        # Set the options
        curl_setopt_array($t_curl, $t_curl_opt);
        # Retrieve data
        $t_data = curl_exec($t_curl);
        curl_close($t_curl);
        if ($t_data !== false) {
            return $t_data;
        }
    }
    # Last resort system call
    $t_url = escapeshellarg($p_url);
    return shell_exec('curl ' . $t_url);
}
예제 #22
0
 /**
  * Constructor
  * @param string  $url               Request URL
  * @param array   $headers           An array of header to send with request
  * @param integer $connectionTimeout Number of seconds to spend attempting to connect
  */
 public function __construct($url = null, array $headers = array(), $connectionTimeout = 20)
 {
     $this->init($url);
     $this->setHeaders($headers);
     $this->setConnectionTimeout($connectionTimeout);
     // Force SSL and use our own certificate list.
     $this->setOption('SSL_VERIFYPEER', true);
     // Enforce certificate validation
     $this->setOption('SSL_VERIFYHOST', 2);
     // Enforce hostname validation
     $this->setOption('SSLVERSION', 1);
     // Enforce SSL v3.
     // Only allow ciphersuites supported by Dropbox
     $curlVersion = curl_version();
     $curlSslBackend = $curlVersion['ssl_version'];
     // See more about this code - here https://github.com/dropbox/dropbox-sdk-php/commit/05ad82740afd576073bfdb34136ef63d4174167e
     if (substr_compare($curlSslBackend, "NSS/", 0, strlen("NSS/")) === 0) {
         // Can't figure out how to reliably set ciphersuites for NSS.
     } else {
         $this->setOption('SSL_CIPHER_LIST', 'ECDHE-RSA-AES256-GCM-SHA384:' . 'ECDHE-RSA-AES128-GCM-SHA256:' . 'ECDHE-RSA-AES256-SHA384:' . 'ECDHE-RSA-AES128-SHA256:' . 'ECDHE-RSA-AES256-SHA:' . 'ECDHE-RSA-AES128-SHA:' . 'ECDHE-RSA-RC4-SHA:' . 'DHE-RSA-AES256-GCM-SHA384:' . 'DHE-RSA-AES128-GCM-SHA256:' . 'DHE-RSA-AES256-SHA256:' . 'DHE-RSA-AES128-SHA256:' . 'DHE-RSA-AES256-SHA:' . 'DHE-RSA-AES128-SHA:' . 'AES256-GCM-SHA384:' . 'AES128-GCM-SHA256:' . 'AES256-SHA256:' . 'AES128-SHA256:' . 'AES256-SHA:' . 'AES128-SHA');
     }
     $this->setOption('CAINFO', dirname(__FILE__) . '/certs/trusted-certs.crt');
     // Certificate file location
     $this->setOption('CAPATH', dirname(__FILE__) . '/certs/');
     // Certificate folder. Need to specify it to avoid using system default certs on some platforms
     // Limit vulnerability surface area.  Supported in cURL 7.19.4+
     if (defined('CURLOPT_PROTOCOLS')) {
         $this->setOption('PROTOCOLS', CURLPROTO_HTTPS);
     }
     if (defined('CURLOPT_REDIR_PROTOCOLS')) {
         $this->setOption('REDIR_PROTOCOLS', CURLPROTO_HTTPS);
     }
 }
예제 #23
0
파일: AV.php 프로젝트: h3len/Project
 public function __construct()
 {
     $version = curl_version();
     $ssl_supported = $version['features'] & CURL_VERSION_SSL;
     if (!$ssl_supported) {
         $this->throwError('CURL ssl support not found');
     }
 }
예제 #24
0
 /**
  * @throws XsollaException
  * @return string
  */
 public static function getVersion()
 {
     if (!extension_loaded('curl')) {
         throw new XsollaException('The PHP cURL extension must be installed to use Xsolla SDK for PHP.');
     }
     $curlVersion = curl_version();
     return sprintf('xsolla-sdk-php/%s curl/%s PHP/%s', self::VERSION, $curlVersion['version'], PHP_VERSION);
 }
 private static function curl_version()
 {
     if (function_exists('curl_version')) {
         return print_r(curl_version(), true);
     } else {
         return 'N/A';
     }
 }
예제 #26
0
 public function testRequestWhenValidWithAppIdShouldIssueRequestWithUserAgent()
 {
     CurlMock::register("https://api.tinify.com/", array("status" => 200));
     $client = new Tinify\Client("key", "TestApp/0.1");
     $client->request("get", "/");
     $curl = curl_version();
     $this->assertSame(Tinify\Client::userAgent() . " TestApp/0.1", CurlMock::last(CURLOPT_USERAGENT));
 }
예제 #27
0
파일: php.php 프로젝트: robotpony/Presto
 public function get_version($p, $o, $b, $t)
 {
     $this->restrictTo('json');
     $ver = explode('.', phpversion());
     $ok = $ver[0] >= '5' && $ver[1] >= 3;
     $libs = array('curl' => array('is_compatible' => (bool) function_exists('curl_init'), 'version' => curl_version()), 'json*' => array('is_compatible' => (bool) function_exists('json_encode'), 'version' => ''));
     return array('is_compatible' => (bool) $ok, 'version' => $ver, 'libs' => $libs);
 }
예제 #28
0
 public function setDefaultUserAgent()
 {
     $php_version = phpversion();
     $curl_version = curl_version();
     $php_os = PHP_OS;
     $php_client = Client::VERSION;
     $this->setUserAgent("Passworks PHP Client/{$php_client} PHP/{$php_version} CURL/{$curl_version['version']} OS/{$php_os}");
 }
 public function __construct()
 {
     parent::__construct();
     $phpVersion = phpversion();
     $gdVersion = defined('GD_VERSION') ? GD_VERSION : null;
     $curlVersion = function_exists('curl_version') ? curl_version() : null;
     $icuVersion = Intl::getIcuVersion();
     $this->addOroRequirement(version_compare($phpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $phpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but Oro needs at least PHP "<strong>%s</strong>" to run.' . 'Before using Oro, upgrade your PHP installation, preferably to the latest version.', $phpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $phpVersion));
     $this->addOroRequirement(null !== $gdVersion && version_compare($gdVersion, self::REQUIRED_GD_VERSION, '>='), 'GD extension must be at least ' . self::REQUIRED_GD_VERSION, 'Install and enable the <strong>GD</strong> extension at least ' . self::REQUIRED_GD_VERSION . ' version');
     $this->addOroRequirement(null !== $curlVersion && version_compare($curlVersion['version'], self::REQUIRED_CURL_VERSION, '>='), 'cURL extension must be at least ' . self::REQUIRED_CURL_VERSION, 'Install and enable the <strong>cURL</strong> extension at least ' . self::REQUIRED_CURL_VERSION . ' version');
     $this->addOroRequirement(function_exists('mcrypt_encrypt'), 'mcrypt_encrypt() should be available', 'Install and enable the <strong>Mcrypt</strong> extension.');
     $this->addOroRequirement(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension.');
     $this->addOroRequirement(null !== $icuVersion && version_compare($icuVersion, self::REQUIRED_ICU_VERSION, '>='), 'icu library must be at least ' . self::REQUIRED_ICU_VERSION, 'Install and enable the <strong>icu</strong> library at least ' . self::REQUIRED_ICU_VERSION . ' version');
     $this->addRecommendation(class_exists('SoapClient'), 'SOAP extension should be installed (API calls)', 'Install and enable the <strong>SOAP</strong> extension.');
     // Windows specific checks
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         $this->addRecommendation(function_exists('finfo_open'), 'finfo_open() should be available', 'Install and enable the <strong>Fileinfo</strong> extension.');
         $this->addRecommendation(class_exists('COM'), 'COM extension should be installed', 'Install and enable the <strong>COM</strong> extension.');
     }
     // Unix specific checks
     // if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
     //     $this->addRequirement(
     //         $this->checkFileNameLength(),
     //         'Cache folder should not be inside encrypted directory',
     //         'Move <strong>app/cache</strong> folder outside encrypted directory.'
     //     );
     // }
     // Web installer specific checks
     if ('cli' !== PHP_SAPI) {
         $output = $this->checkCliRequirements();
         $requirement = new CliRequirement(!$output, 'Requirements validation for PHP CLI', 'If you have multiple PHP versions installed, you need to configure ORO_PHP_PATH variable with PHP binary path used by web server');
         $requirement->setOutput($output);
         $this->add($requirement);
     }
     $baseDir = realpath(__DIR__ . '/..');
     $mem = $this->getBytes(ini_get('memory_limit'));
     $this->addPhpIniRequirement('memory_limit', function ($cfgValue) use($mem) {
         return $mem >= 512 * 1024 * 1024 || -1 == $mem;
     }, false, 'memory_limit should be at least 512M', 'Set the "<strong>memory_limit</strong>" setting in php.ini<a href="#phpini">*</a> to at least "512M".');
     $jsEngine = RequireJSConfiguration::getDefaultJsEngine();
     $this->addRecommendation($jsEngine ? true : false, $jsEngine ? "A JS Engine ({$jsEngine}) is installed" : 'JSEngine such as NodeJS should be installed', 'Install <strong>JSEngine</strong>.');
     $this->addOroRequirement(is_writable($baseDir . '/web/uploads'), 'web/uploads/ directory must be writable', 'Change the permissions of the "<strong>web/uploads/</strong>" directory so that the web server can write into it.');
     $this->addOroRequirement(is_writable($baseDir . '/web/media'), 'web/media/ directory must be writable', 'Change the permissions of the "<strong>web/media/</strong>" directory so that the web server can write into it.');
     $this->addOroRequirement(is_writable($baseDir . '/web/bundles'), 'web/bundles/ directory must be writable', 'Change the permissions of the "<strong>web/bundles/</strong>" directory so that the web server can write into it.');
     $this->addOroRequirement(is_writable($baseDir . '/app/attachment'), 'app/attachment/ directory must be writable', 'Change the permissions of the "<strong>app/attachment/</strong>" directory so that the web server can write into it.');
     if (is_dir($baseDir . '/web/js')) {
         $this->addOroRequirement(is_writable($baseDir . '/web/js'), 'web/js directory must be writable', 'Change the permissions of the "<strong>web/js</strong>" directory so that the web server can write into it.');
     }
     if (is_dir($baseDir . '/web/css')) {
         $this->addOroRequirement(is_writable($baseDir . '/web/css'), 'web/css directory must be writable', 'Change the permissions of the "<strong>web/css</strong>" directory so that the web server can write into it.');
     }
     if (!is_dir($baseDir . '/web/css') || !is_dir($baseDir . '/web/js')) {
         $this->addOroRequirement(is_writable($baseDir . '/web'), 'web directory must be writable', 'Change the permissions of the "<strong>web</strong>" directory so that the web server can write into it.');
     }
     if (is_file($baseDir . '/app/config/parameters.yml')) {
         $this->addOroRequirement(is_writable($baseDir . '/app/config/parameters.yml'), 'app/config/parameters.yml file must be writable', 'Change the permissions of the "<strong>app/config/parameters.yml</strong>" file so that the web server can write into it.');
     }
 }
예제 #30
0
 /**
  * Checks to see if libcurl's "file://" support is enabled by examining the "protocols" array
  * in the info returned from curl_version()
  * @return integer
  *
  */
 protected function _execTest()
 {
     $curlinfo = curl_version();
     if (version_compare($this->_current_value, '5.1.6', '>=') || version_compare($this->_current_value, '4.4.4', '>=') && version_compare($this->_current_value, '5', '<')) {
         return self::RESULT_OK;
     } else {
         return self::RESULT_WARN;
     }
 }