View Single Post
  #221  
Old 03-16-2006, 09:14 AM
Orcun Orcun is offline
 
Join Date: Dec 2005
Location: Ankara
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I changed the plug-in code just to use the XML file written by Lynx.
Also, when I remove @fsockopen, It says It cannot connect to the IP specified on port 5555.

fsockopen should be blocked by a Firewall.

Here's the new code for the plugin.

PHP Code:
$scdef $vbulletin->options['scname_full'];
$scip $vbulletin->options['scip_full'];
$scport $vbulletin->options['scport_full'];
$scpass $vbulletin->options['scpass_full'];
$ircsite $vbulletin->options['scirc_full'];
$file $vbulletin->options['scxml_full'];
$cache_tolerance $vbulletin->options['scupdate_full'];

// Check if Cache needs an update
        
if (file_exists($file)) {
            
clearstatcache();  
            
$time_difference time() - filemtime($file); 
        } else {
            
$time_difference $cache_tolerance;  // force update
        
}

        
// Outputs the cached file after new data
    
$xmlcache fopen($file,"r");
    
$page '';
    if(
$xmlcache){
         while (!
feof($xmlcache)) {
           
$page .= fread($xmlcache8192);
         }
        
                
fclose($xmlcache);
    }        
    else{
        
// outputs the cached file
    
$xmlcache fopen($file,"r");
    
$page '';
        if(
$xmlcache){
              while (!
feof($xmlcache)) {
                 
$page .= fread($xmlcache8192);
              }

                
fclose($xmlcache);
                }
        }

//define  xml elements
            
$loop = array("AVERAGETIME""CURRENTLISTENERS""PEAKLISTENERS""MAXLISTENERS""SERVERGENRE""SERVERURL""SERVERTITLE""SONGTITLE""SONGURL""IRC""ICQ" ,"AIM""WEBHITS""STREAMHITS""LISTEN""STREAMSTATUS""BITRATE""CONTENT");
            
$y=0;
        while(
$loop[$y]!=''){
          
$pageed ereg_replace(".*<$loop[$y]>"""$page);
          
$scphp strtolower($loop[$y]);
          $
$scphp ereg_replace("</$loop[$y]>.*"""$pageed);
      if(
$loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
           $
$scphp urldecode($$scphp);
            ;
          
$y++;
        }
//end intro xml elements

//get song info and history
            
$pageed ereg_replace(".*<SONGHISTORY>"""$page);
            
$pageed ereg_replace("<SONGHISTORY>.*"""$pageed);
            
$songatime explode("<SONG>"$pageed);
            
$r=1;
        while(
$songatime[$r]!=""){
          
$t=$r-1;
          
$playedat[$t] = ereg_replace(".*<PLAYEDAT>"""$songatime[$r]);
          
$playedat[$t] = ereg_replace("</PLAYEDAT>.*"""$playedat[$t]);
          
$song[$t] = ereg_replace(".*<TITLE>"""$songatime[$r]);
          
$song[$t] = ereg_replace("</TITLE>.*"""$song[$t]);
          
$song[$t] = urldecode($song[$t]);
          
$dj[$t] = ereg_replace(".*<SERVERTITLE>"""$page);
          
$dj[$t] = ereg_replace("</SERVERTITLE>.*"""$pageed);
            
$r++;
        }

        
$averagemin round($averagetime/60,2);
        
$irclink 'irc://'.$ircsite.'/'.$irc.'';
        
$listenamp 'http://'.$scip.':'.$scport.'/listen.pls';
        
$listenlnk 'http://'.$scip.':'.$scport.'';

// Player template requests
        
if ($_REQUEST['do'] == 'mp'){ // MP popup link
        
eval('print_output("' fetch_template('forumhome_shoutcast_mp') . '");'); 
        }
        if (
$_REQUEST['do'] == 'rp'){ // RP popup link 
        
eval('print_output("' fetch_template('forumhome_shoutcast_rp') . '");'); 
        }
        if (
$_REQUEST['do'] == 'qt'){ // QT popup link
        
eval('print_output("' fetch_template('forumhome_shoutcast_qt') . '");'); 
        }

//display stats
        
if($time_difference <= $cache_tolerance){
                if(
$streamstatus == "1"){
                    
$search_text '<!-- end logged-in users -->';
                    
$vbulletin->templatecache['FORUMHOME'] = str_replace($search_text,
                    
$search_text.fetch_template('forumhome_shoutcast'),$vbulletin->templatecache['FORUMHOME']);
                } else {
                    
$search_text '<!-- end logged-in users -->';
                    
$vbulletin->templatecache['FORUMHOME'] = str_replace($search_text,
                    
$search_text.fetch_template('forumhome_shoutcast_off'),$vbulletin->templatecache['FORUMHOME']);
                }
        } 
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01766 seconds
  • Memory Usage 1,862KB
  • 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
  • (1)bbcode_php
  • (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