Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2011, 07:11 PM
hilfe-forum hilfe-forum is offline
 
Join Date: Sep 2005
Location: http://www.alpha-board.eu
Posts: 198
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default php via plugin

I just despair.
For weeks now I am looking for a solution but no one can help.

The first Problem is the following

I bind an external php file one with this plugin:

PHP Code:
if (THIS_SCRIPT != 'bls1')
{
    
ob_start();
    include(
'/var/www/alpha/bls/bls1.php');
    
$bls1 ob_get_contents();
    
ob_end_clean();
vB_Template::preRegister('header', array('bls1' => $bls1));  




entry point: global_bootstrap_init_start

I call the template with the header:

{vb: raw BLS1}
on

So far so good just the links appear to the php file to show not only the header template but also at the top of the page.
In the source code shown here:

HTML Code:
linktext 1<a href="http://www.domain.net/"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"


So before DOCTYPE!
And I can not get to prevent this!

However, this problem is only on the forum start page.
From all other sides it works beautifully
Reply With Quote
  #2  
Old 11-01-2011, 08:23 PM
hilfe-forum hilfe-forum is offline
 
Join Date: Sep 2005
Location: http://www.alpha-board.eu
Posts: 198
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Help please??????????
Reply With Quote
  #3  
Old 11-01-2011, 10:34 PM
Disasterpiece's Avatar
Disasterpiece Disasterpiece is offline
 
Join Date: Apr 2007
Location: GER
Posts: 765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

modify your bls1.php so it's a function which returns the string you want, rather than messing with output buffers. vB uses its own output buffers or other plugins that are running on your server, so you might not want to mess with that.
Reply With Quote
  #4  
Old 11-02-2011, 12:17 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe you can use this https://vborg.vbsupport.ru/showthread.php?t=263517 it should work with any version
Reply With Quote
  #5  
Old 11-03-2011, 10:24 PM
hilfe-forum hilfe-forum is offline
 
Join Date: Sep 2005
Location: http://www.alpha-board.eu
Posts: 198
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Disasterpiece View Post
modify your bls1.php so it's a function which returns the string you want, rather than messing with output buffers. vB uses its own output buffers or other plugins that are running on your server, so you might not want to mess with that.
Thanks for the tip
but unfortunately
I can not change the file.
I know nothing about PHP

This PHP file is from a company.
It is to swap links and integrate advertising.

PHP Code:
<?php

//
//BACKLINKSELLER WEBSITE-CODE (ECHO) VERSION 1.7
//

//Ihre Domain-ID. (Diese ist standardmaessig richtig eingestellt)
$BACKLINK_SELLER['DOMAIN_ID'] = '991823185';

//Ihre Account-ID. (Diese ist standardmaessig richtig eingestellt)
$BACKLINK_SELLER['ACCOUNT_ID'] = '27359956';

//Wenn Sie folgenden Parameter auf TRUE setzen, dann
//werden alle Fehlermeldungen ausgegeben und Sie
//k?nnen somit leichter die Fehlerursache feststellen
$BACKLINK_SELLER['DEBUG_FLAG'] = false//true (aktiviert) oder false (deaktiviert)

//Wenn Sie diesen Parameter aktivieren, dann wird von unserem Server
//ein HTML-Code mit einem Beispiel-Textlink zur?ckgeben
//Somit k?nnen Sie die Verbindung mit unserem Server testen,
//auch wenn auf Ihrer Webseite noch keine Textlinks gebucht sind.
//ACHTUNG: BITTE VERGESSEN SIE NICHT, DIESE OPTION
//NACH DEM TEST WIEDER ZU DEAKTIVIEREN
$BACKLINK_SELLER['TEST_FLAG'] = false//true (aktiviert) oder false (deaktiviert)

//Benutzerdefinierte HTML-Code, der vor jedem Textlink hinzugef?gt wird
//(Diese Einstellung ist optional)
$BACKLINK_SELLER['HTML_BEFORE_BACKLINK'] = '';

//Benutzerdefinierte HTML-Code, der nach jedem Textlink hinzugef?gt wird
//(Diese Einstellung ist optional)
$BACKLINK_SELLER['HTML_AFTER_BACKLINK'] = '<br />';

//Hier kann die CSS-Class Bezeichnung definiert werden, welche
//bei jedem Hyperlink hinzugef?gt wird. Zum Beispiel
//<a href='...' class='my_class_name'>...</a>
//(Diese Einstellung ist optional)
$BACKLINK_SELLER['HYPERLINK_CLASS'] = '';

//URL, die zu der Seite Ihrer Webpr?senz f?hrt (z.B. http://www.example.com/my_page/)
//(Die Defaulteinstellung muss in den meisten F?llen nicht ge?ndert werden)
$requestUri $_SERVER['REQUEST_URI'];
if(
substr($requestUri01) == '/') {$requestUri substr($requestUri1);} //remove leading slash
$requestUri str_replace('http://www.alpha-board.eu/'''$requestUri); //make sure that request uri is without domain
$BACKLINK_SELLER['PAGE_URL'] = 'http://www.alpha-board.eu/' $requestUri;

//Mit einem aktivierten Caching wird der zur?ckgegebene HTML-Code
//in einer Datei f?r mindestens eine Stunde gespeichert.
//Bitte definieren Sie auch einen g?ltigen Dateipfad (siehe weiter unten)
//ACHTUNG: WIR EMPFEHLEN DAS CACHING ZU AKTIVIEREN, DA DIES DIE
//ZUGRIFFSZEITEN IHRER WEBSEITE ERH?HT. AUSSERDEM BESEITIGT DAS AKTIVIERTE
//CACHING EINIGE TIMEOUT-PROBLEME, FALLS UNSER SERVER VOR?BERGEHEND NICHT ZUR VERF?GUNG STEHT.
$BACKLINK_SELLER['CACHING_ENABLED_FLAG'] = false//true (aktiviert) oder false (deaktiviert)

//Dateipfad zu der Caching-Datei.
//F?r jede URL wird eine solche Datei angelegt
//ACHTUNG: DIESE DATEI MUSS SCHREIB- UND LESE-RECHTE BESITZEN.
//SIE K?NNEN DIESE RECHTE ?BER DIE CHMOD-EINSTELLUNG SETZEN.
//BITTE KONFIGURIEREN SIE AUCH EINEN UNTERVERZEICHNIS, IN DEM DIESE
//CACHE-DATEIEN ERSTELLT WERDEN - ANSONSTEN WERDEN DIESE DIREKT IM
//ROOT-VERZEICHNISS IHRER WEBPRESENZ ERSTELLT.
$BACKLINK_SELLER['CACHED_FILE_PATH'] = $_SERVER['DOCUMENT_ROOT'] . '/bs-991823185-' md5($BACKLINK_SELLER['PAGE_URL']) . '.txt';

if(!
defined("BACKLINK_SELLER")) {define("BACKLINK_SELLER"serialize($BACKLINK_SELLER));}
if(!
in_array('BacklinkSeller'get_declared_classes())) //if not already declared
{
    class 
BacklinkSeller
    
{
        var 
$config null;
        function 
retrieveHTML()
        {
            
$this->config unserialize(BACKLINK_SELLER);
            
$cachingDirectory substr($this->config['CACHED_FILE_PATH'], 0strrpos($this->config['CACHED_FILE_PATH'], '/') + 1);
            if(
$this->config['CACHING_ENABLED_FLAG'] && is_writable($cachingDirectory)) {return $this->retrieveHTMLWithCaching();}
            return 
$this->retrieveHTMLFromServer();
        }
        function 
retrieveHTMLWithCaching()
        {
            if(
$this->isCachedFileExpired())
            {
                
$response $this->retrieveHTMLFromServer();

                
//if server is down then cache HTML response for max 48 hours
                
if($response == 'UNABLE_TO_CONNECT' && $this->isCachedFileExpired(48))
                {
                    
//backlinkseller server is still not available
                    //in this case we empty cached file
                    
$this->writeHTMLToCachedFile('');
                }
                else
                {
                    
//update cached file
                    
$this->writeHTMLToCachedFile($response);
                }
            }
            return 
$this->loadHTMLFromCachedFile();
        }
        function 
retrieveHTMLFromServer()
        {
            
$request '/channel.php?domain_id=' $this->config['DOMAIN_ID'] .
            
'&account_id=' $this->config['ACCOUNT_ID'] .
            
'&html_before=' urlencode($this->config['HTML_BEFORE_BACKLINK']) .
            
'&html_after=' urlencode($this->config['HTML_AFTER_BACKLINK']) .
            
'&page=' urlencode($this->config['PAGE_URL']) . '&xhtml=1' .
            
'&user_ip=' $_SERVER['REMOTE_ADDR'] .
            
'&class=' urlencode($this->config['HYPERLINK_CLASS']);
            if(
$this->config['TEST_FLAG']) {$request .= '&test=1';}
            @
$socket fsockopen('channel5.backlinkseller.de'80$errorNumber$errorMessage5);
            if(!
$socket) {return 'UNABLE_TO_CONNECT';}
            
$response null;
            
stream_set_timeout($socket5);
            
fwrite($socket'GET ' $request " HTTP/1.1\r\nHost: channel5.backlinkseller.de\r\n\r\n");
            
$response fread($socket1000000);
            
fclose($socket);
            if(
strpos($response"\r\n\r\n") !== false)
            {
$response trim(substr($responsestrpos($response"\r\n\r\n")));}
            if(!
$this->config['DEBUG_FLAG']) //if debug is disabled
            
{
                
//if response contains any message and not HTML code as expected
                
if(substr($response07) == 'ERROR: ' || substr($response04) == 'OK: ')
                {return 
'';} //do not display this message
            
}
            
$response str_replace(array('\"'"\\'"), array('"'"'"), $response); //remove quotes
            
return $response;
        }
        function 
writeHTMLToCachedFile($html)
        {
            
$handle fopen($this->config['CACHED_FILE_PATH'], 'w');
            
flock($handleLOCK_EX);
            
fwrite($handle$html);
            
flock($handleLOCK_UN);
            
fclose($handle);
        }
        function 
loadHTMLFromCachedFile()
        {
            if(
file_exists($this->config['CACHED_FILE_PATH']))
            {return 
file_get_contents($this->config['CACHED_FILE_PATH']);}
            return 
'';
        }
        function 
isCachedFileExpired($hoursToLive 1)
        {
            if(!
file_exists($this->config['CACHED_FILE_PATH'])) {return true;}
            if(
filemtime($this->config['CACHED_FILE_PATH']) < time() - (60 60 $hoursToLive)){return true;}
            return 
false;
        }
    }
}

//output backlinkseller html with backlinks
$backlinkseller = new BacklinkSeller();
echo(
$backlinkseller->retrieveHTML());

?>




Quote:
Originally Posted by Simon Lloyd View Post
Maybe you can use this https://vborg.vbsupport.ru/showthread.php?t=263517 it should work with any version

Thank you I've tried.
It does not unfortunately
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:48 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04797 seconds
  • Memory Usage 2,270KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_html
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete