vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   php via plugin (https://vborg.vbsupport.ru/showthread.php?t=273122)

hilfe-forum 10-31-2011 07:11 PM

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

hilfe-forum 11-01-2011 08:23 PM

Help please??????????

Disasterpiece 11-01-2011 10:34 PM

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.

Simon Lloyd 11-02-2011 12:17 AM

Maybe you can use this https://vborg.vbsupport.ru/showthread.php?t=263517 it should work with any version :)

hilfe-forum 11-03-2011 10:24 PM

Quote:

Originally Posted by Disasterpiece (Post 2263587)
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 (Post 2263620)
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


All times are GMT. The time now is 06:26 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.01163 seconds
  • Memory Usage 1,801KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete