NFO-Anzeige als Grafik innerhalb der Threads.

(c) 2007 M.Ssykor m.ssykor@iDreamFactory.de

Version 1.0




Systemvorraussetzungen: GDLIB muss installiert sein und TTF-font-Untersttzung muss aktiv sein.

A: benutze die beigefgte class_parse.php (wbb 2.3.6) und lade sie in das
Verzeichnis acp/lib/ innerhalb deiner wbb-installation. Fahre dann mit C fort...

ODER

B: Lade acp/lib/class_parse.php in einen Editor und ndere die folgenden Dinge, falls
Du an der Datei (wegen einem anderen Hackeinbau) schon etwas verndert haben solltest oder
eine ltere Version benutzt.

B1: Suche nach (das ist in der funktion doparse)

		// cache code
		if ($this->usecode == 1 && $allowbbcode == 1) {
			$this->tempsave['php'] = array();
			$this->tempsave['code'] = array();
			$this->index['php'] = -1;
			$this->index['code'] = -1;
			$post = preg_replace("/(\[(php|code)\])(.*)(\[\/\\2\])/seiU", "\$this->cachecode('\\3','\\2')", $post);
		}

Ersetze dies durch

		// cache code
		if ($this->usecode == 1 && $allowbbcode == 1) {
			$this->tempsave['php'] = array();
			$this->tempsave['code'] = array();
			$this->tempsave['nfo'] = array();
			$this->index['php'] = -1;
			$this->index['code'] = -1;
			$this->index['nfo'] = -1;
			$post = preg_replace("/(\[(php|code|nfo)\])(.*)(\[\/\\2\])/seiU", "\$this->cachecode('\\3','\\2')", $post);
		}

B2: Suche nach (immer noch in der funktion doparse)

		// insert code
		if ($this->usecode == 1 && $allowbbcode == 1 && ($this->index['php'] != -1 || $this->index['code'] != -1)) $post = $this->replacecode($post);

und ersetze es durch

		// insert code
		if ($this->usecode == 1 && $allowbbcode == 1 && ($this->index['php'] != -1 || $this->index['code'] != -1  || $this->index['nfo'] != -1)) $post = $this->replacecode($post);


B3: Suche nach (das ist nun in der funktion codeformat)

		}
		else {
			$code = $this->stripSlashes($code);
			$code = htmlconverter($code);


und ersetze es durch

		} elseif ($mode == "nfo") {
			$code = $this->stripSlashes($code);
			$fname = md5($code);
			$file = explode("\n",$code);
  	  $font = './acp/lib/ASCII.ttf';
	    $zeilen = count($file);
    	// max. Zeilenbreite ermitteln
	    $temp = array();
  	  foreach( $file as $val) $temp[] = strlen($val);
    	$max = max($temp);
			$TS = Imagettfbbox(11, 0, $font, "X");
	    // Breite fr Grafik
			$text_width = abs ($TS[4]-$TS[0]);
  	  $bb = $text_width * $max;
    	// Hhe fr Grafik
			$fh = abs ($TS[5]-$TS[1]);
  	  $hh = $fh * $zeilen;
	    ###########################################################
  	  // neue Grafik erzeugen
    	$im = ImageCreateTrueColor( $bb, $hh);
	    // Farben definieren
  	  $WS = ImageColorAllocate($im, 255, 255, 255); // weiss
    	$SW = ImageColorAllocate($im, 50, 50, 50); // grauton
	    // Hintergrund mit Farbe fllen
  	  ImageFill ($im, 0, 0, $WS);
	    // TXT-Datei Zeilenweise auslesen und in Grafik schreiben
  	  $cc = 0;
    	foreach( $file as $val) {
	    	$step = $fh * $cc++;
		    $val = preg_replace('#(\r|\n)#', '', $val);
				ImageTTFText($im, $fh, 0, 0, $step, $SW, $font, $val);
	    }
  	  // Grafik speichern, und Speicher frei geben
	    ImagePNG($im, './images/nfo/'.$fname.'.png');
	    ImageDestroy($im); // nicht vergessen :-)
			$height = ($style['smallfontsize'] + 3) * $linecount + 50;
			eval("\$code = \"".$tpl->get("codetagnfo")."\";");
		}
		else {
			$code = $this->stripSlashes($code);
			$code = htmlconverter($code);


B4: DATEI SPEICHERN UND HOCHLADEN


C: Nun im ACP ein neues Template namens "codetagnfo" erstellen:


<table align='center' style='width:98%; table-layout: fixed;'>
 <tr>
  <td><div style='<if($filename != 'print.php')><then>overflow: auto; height: {$height}px; </then></if>width: 100%;'>
   <table cellpadding='4' cellspacing='1' style='width:100%' class='tableinborder'>
    <tr class='smallfont'>
     <td class='tablecat'<if($linenumbers!="")><then> colspan='2'</then></if>><span class='smallfont'><b>NFO</b></span></td>
    </tr>
    <tr class='smallfont'>
     <td valign='top' class='inposttable' nowrap='nowrap' align='left' style='width:100%'><img src="./images/nfo/{$fname}.png" /></td>
    </tr>
   </table>
  </div></td>
 </tr>
</table>

Speichern, und dann Templates cachen.

D: Die Datei ASCII.ttf muss ins Verzeichnis ACP/LIB/ kopiert werden.

E: Im Verzeichnis images des WBB-Ordners einen Ordner "nfo" anlegen und mit chmod 777 versehen.

F: So, das sollte es gewesen sein. Also; F, wie Fertig :-)

MfG Manfred Ssykor alias DonManfred

Support gibt es hier: http://www.v-gn.de/wbb/