Thread: Integration with vBulletin - Soccer Betting Game ("Fussball-Tippspiele")
View Single Post
  #1626  
Old 11-29-2015, 04:50 PM
Antonio Pereira Antonio Pereira is offline
 
Join Date: Sep 2007
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Martin64 View Post
The mod is working fine and the leagues are updated regularly. If you're having issues, read on.

Starting with vBulletin 4.2.3 (I think, I skipped a couple of 4.2.2 PL versions), fsockopen support was dropped by vBulletin. I think it was dropped for security reasons, I haven't looked into it though. What this means is that your forum is unable to connect to the league update database since it's using fsockopen to communicate.

To find out if this is the reason your leagues aren't being updated automatically, go to Admin CP > Football Betting > Diagnostics. The response code of XML-RPC Client-Test ("ping?") should be "pong". If it says "error", do this to re-enable fsockopen support:

Open includes/class_vurl.php

Search for

PHP Code:
var $classnames = array('cURL'); 
Replace with:

PHP Code:
var $classnames = array('cURL''fsockopen'); 
Right at the bottom of the file, search for:

PHP Code:
return VURL_HANDLED;
        }
        return 
VURL_NEXT;
    }

Below it, add:

PHP Code:
class vB_vURL_fsockopen        
{        
    
/**        
    * String that holds the cURL callback data        
    *        
    * @var    string        
    */        
    
var $response_text '';        
    
/**        
    * String that holds the cURL callback data        
    *        
    * @var    string        
    */        
    
var $response_header '';        
    
/**        
    * vB_vURL object        
    *        
    * @var    object        
    */        
    
var $vurl null;        
    
/**        
    * Filepointer to the temporary file        
    *        
    * @var    resource        
    */        
    
var $fp null;        
    
/**        
    * Length of the current response        
    *        
    * @var    integer        
    */        
    
var $response_length 0;        
    
/**        
    * If the current result is when the max limit is reached        
    *        
    * @var    integer        
    */        
    
var $max_limit_reached false;        
    
/**        
    * Constructor        
    *        
    * @param    object    Instance of a vB_vURL Object        
    */        
    
function vB_vURL_fsockopen(&$vurl_registry)        
    {        
        if (!(
$vurl_registry instanceof vB_vURL))        
        {        
            
trigger_error('Direct Instantiation of ' __CLASS__ ' prohibited.'E_USER_ERROR);        
        }        
        
$this->vurl =& $vurl_registry;        
    }        
    
/**        
     * Tests sockets for ssl support.        
     *        
     * @return    bool    Success        
     *        
     */        
    
function test_ssl()        
    {        
        return 
function_exists('openssl_open');        
    }        
    
/**        
    * Clears all previous request info        
    */        
    
function reset()        
    {        
        
$this->response_text '';        
        
$this->response_header '';        
        
$this->response_length 0;        
        
$this->max_limit_reached false;        
    }        
    
/**        
    * Inflates the response if its gzip or deflate        
    */        
    
function inflate_response($type)        
    {        
        if (!empty(
$this->response_text))        
        {        
            switch(
$type)        
            {        
                case 
'gzip':        
                    if (
$this->response_text[0] == "\x1F" AND $this->response_text[1] == "\x8b")        
                    {        
                        if (
$inflated = @gzinflate(substr($this->response_text10)))        
                        {        
                            
$this->response_text $inflated;        
                        }        
                    }        
                break;        
                case 
'deflate':        
                    if (
$this->response_text[0] == "\x78" AND $this->response_text[1] == "\x9C" AND $inflated = @gzinflate(substr($this->response_text2)))        
                    {        
                        
$this->response_text $inflated;        
                    }        
                    else if (
$inflated = @gzinflate($this->response_text))        
                    {        
                        
$this->response_text $inflated;        
                    }        
                break;        
            }        
        }        
        else        
        {        
            
$compressed_file $this->vurl->tmpfile;        
            if (
$gzfp = @gzopen($compressed_file'r'))        
            {        
                if (
$newfp = @fopen($this->vurl->tmpfile 'u''w'))        
                {        
                    
$this->vurl->tmpfile $this->vurl->tmpfile 'u';        
                    if (
function_exists('stream_copy_to_stream'))        
                    {        
                        
stream_copy_to_stream($gzfp$newfp);        
                    }        
                    else        
                    {        
                        while(!
gzeof($gzfp))        
                        {        
                            
fwrite($fpgzread($gzfp20480));        
                        }        
                    }        
                    
fclose($newfp);        
                }        
                
fclose($gzfp);        
                @
unlink($compressed_file);        
            }        
        }        
    }        
    
/**        
    * Callback for handling the request body        
    *        
    * @param    string        Request        
    *        
    * @return    integer        length of the request        
    */        
    
function callback_response($response)        
    {        
        
$chunk_length strlen($response);        
        
// no filepointer and we're using or about to use more than 100k        
        
if (!$this->fp AND $this->response_length $chunk_length >= 1024*100)        
        {        
            if (
$this->fp = @fopen($this->vurl->tmpfile'wb'))        
            {        
                
fwrite($this->fp$this->response_text);        
                unset(
$this->response_text);        
            }        
        }        
        if (
$response)        
        {        
            if (
$this->fp)        
            {        
                
fwrite($this->fp$response);        
            }        
            else        
            {        
                
$this->response_text .= $response;        
            }        
        }        
        
$this->response_length += $chunk_length;        
        if (
$this->vurl->options[VURL_MAXSIZE] AND $this->response_length $this->vurl->options[VURL_MAXSIZE])        
        {        
            
$this->max_limit_reached true;        
            
$this->vurl->set_error(VURL_ERROR_MAXSIZE);        
            return 
false;        
        }        
        return 
$chunk_length;        
    }        
    
/**        
    * Performs fetching of the file if possible        
    *        
    * @return    integer        Returns one of two constants, VURL_NEXT or VURL_HANDLED        
    */        
    
function exec()        
    {        
        static 
$location_following_count 0;        
        
$urlinfo $this->vurl->registry->input->parse_url($this->vurl->options[VURL_URL]);        
        if (empty(
$urlinfo['port']))        
        {        
            if (
$urlinfo['scheme'] == 'https')        
            {        
                
$urlinfo['port'] = 443;        
            }        
            else        
            {        
                
$urlinfo['port'] = 80;        
            }        
        }        
        if (empty(
$urlinfo['path']))        
        {        
            
$urlinfo['path'] = '/';        
        }        
        if (
$urlinfo['scheme'] == 'https')        
        {        
            if (!
function_exists('openssl_open'))        
            {        
                
$this->vurl->set_error(VURL_ERROR_SSL);        
                return 
VURL_NEXT;        
            }        
            
$scheme 'ssl://';        
        }        
        if (
$request_resource = @fsockopen($scheme $urlinfo['host'], $urlinfo['port'], $errno$errstr$this->vurl->options[VURL_TIMEOUT]))        
        {        
            
$headers = array();        
            if (
$this->vurl->bitoptions VURL_NOBODY)        
            {        
                
$this->vurl->options[VURL_CUSTOMREQUEST] = 'HEAD';        
            }        
            if (
$this->vurl->options[VURL_CUSTOMREQUEST])        
            {        
                
$headers[] = $this->vurl->options[VURL_CUSTOMREQUEST] . $urlinfo[path]. ($urlinfo['query'] ? "?$urlinfo[query]'') . " HTTP/1.0";        
            }        
            else if (
$this->vurl->bitoptions VURL_POST)        
            {        
                
$headers[] = "POST $urlinfo[path]. ($urlinfo['query'] ? "?$urlinfo[query]'') . " HTTP/1.0";        
                if (empty(
$this->vurl->headerkey['content-type']))        
                {        
                    
$headers[] = 'Content-Type: application/x-www-form-urlencoded';        
                }        
                if (empty(
$this->vurl->headerkey['content-length']))        
                {        
                    
$headers[] = 'Content-Length: ' strlen($this->vurl->options[VURL_POSTFIELDS]);        
                }        
            }        
            else        
            {        
                
$headers[] = "GET $urlinfo[path]. ($urlinfo['query'] ? "?$urlinfo[query]'') . " HTTP/1.0";        
            }        
            
$headers[] = "Host: $urlinfo[host]";        
            if (!empty(
$this->vurl->options[VURL_HTTPHEADER]))        
            {        
                
$headers array_merge($headers$this->vurl->options[VURL_HTTPHEADER]);        
            }        
            if (
$this->vurl->options[VURL_ENCODING])        
            {        
                
$encodemethods explode(','$this->vurl->options[VURL_ENCODING]);        
                
$finalmethods = array();        
                foreach (
$encodemethods AS $type)        
                {        
                    
$type strtolower(trim($type));        
                    if (
$type == 'gzip' AND function_exists('gzinflate'))        
                    {        
                        
$finalmethods[] = 'gzip';        
                    }        
                    else if (
$type == 'deflate' AND function_exists('gzinflate'))        
                    {        
                        
$finalmethods[] = 'deflate';        
                    }        
                    else        
                    {        
                        
$finalmethods[] = $type;        
                    }        
                }        
                if (!empty(
$finalmethods))        
                {        
                    
$headers[] = "Accept-Encoding: " implode(', '$finalmethods);        
                }        
            }        
            
$output implode("\r\n"$headers) . "\r\n\r\n";        
            if (
$this->vurl->bitoptions VURL_POST)        
            {        
                
$output .= $this->vurl->options[VURL_POSTFIELDS];        
            }        
            
$result false;        
            if (
fputs($request_resource$outputstrlen($output)))        
            {        
                
stream_set_timeout($request_resource$this->vurl->options[VURL_TIMEOUT]);        
                
$in_header true;        
                
$result true;        
                while (!
feof($request_resource))        
                {        
                    
$response = @fread($request_resource2048);        
                    if (
$in_header)        
                    {        
                        
$header_end_position strpos($response"\r\n\r\n");        
                        if (
$header_end_position === false)        
                        {        
                            
$this->response_header .= $response;        
                        }        
                        else        
                        {        
                            
$this->response_header .= substr($response0$header_end_position);        
                            
$in_header false;        
                            
$response substr($response$header_end_position 4);        
                        }        
                    }        
                    if (
$this->callback_response($response) != strlen($response))        
                    {        
                        
$result false;        
                        break;        
                    }        
                }        
                
fclose($request_resource);        
            }        
            if (
$this->fp)        
            {        
                
fclose($this->fp);        
                
$this->fp null;        
            }        
            if (
$result !== false OR (!$this->vurl->options[VURL_DIEONMAXSIZE] AND $this->max_limit_reached))        
            {        
                if (
$this->vurl->bitoptions VURL_FOLLOWLOCATION AND preg_match("#\r\nLocation: (.*)(\r\n|$)#siU"$this->response_header$location) AND $location_following_count $this->vurl->options[VURL_MAXREDIRS])        
                {        
                    
$location_following_count++;        
                    
$this->vurl->set_option(VURL_URLtrim($location[1]));        
                    
$this->reset();        
                    return 
$this->exec();        
                }        
                
// need to handle gzip if it was used        
                
if (function_exists('gzinflate'))        
                {        
                    if (
stristr($this->response_header"Content-encoding: gzip\r\n") !== false)        
                    {        
                        
$this->inflate_response('gzip');        
                    }        
                    else if (
stristr($this->response_header"Content-encoding: deflate\r\n") !== false)        
                    {        
                        
$this->inflate_response('deflate');        
                    }        
                }        
                return 
VURL_HANDLED;        
            }        
        }        
        return 
VURL_NEXT;        
    }        

Save the file and upload. Run the diagnostics again to verify that it's working.

This dont work for me.
XML-RPC Client-Test ("ping?") "ERROR!"

Anyone have this working?
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01437 seconds
  • Memory Usage 2,144KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete