Template Hack Code

Psycadelic
Moin

Ich bin nun dabei gewesen den Portal Hack und diesen Template
Hack zu installieren.Mit dem Portal hat alles so weit geklappt glaub ich. Auf jeden Fall wird alles richtig angezeigt. Dann habe ich mich rangemacht den Template Hack zu installieren. Habe die Dateien hochgeladen dann install_templates.php aufgerufen und danach die Datei gelöscht. So wie es da Stand. Dann musste ich ja einige Dateien wieder per Hand verändern so wie beim Portal auch. Bin genau nach der txt datei vorgegangen und habe alle Dateien geändert. Bloß bei der vorletzten Änderung hatte ich ein Problem.
Die gewünschte Stelle die ich erweitern sollte habe ich aber nicht gefunden mit der Suchfunktion von UltraEdit.

Es handelt sich um:

acp/lib/class_tpl_file.php

Dort sollte ich

case "{!DOCTYPE}": $template = $this->str_replace($row['variable'],$row['substitute'],$template); break;

erweitern mit

case "{imagefolder}": break;


Wie gesagt ich habe diese Stelle in der Datei nicht gefunden alle anderen Stellen konnte ich verändern wie es in der txt Datei drin stand.

In meinem ACP habe ich auch schon Templatepack hinzufügen etc.


Wollte nun fragen ob die Funktion wirklich funktioniert.


Hier mein Forum:


http://www.thunderstruck-guild.de/wbblite/portal.php




Vielen Dank für die Hilfe
Slugger
Glaub mir, die Stelle existiert Zunge raus

Bei weiteren Fragen am besten direkt im Supportthread!
Psycadelic
öhm ich habe die datei mit ultra edit durchsucht und er findet diese stelle nicht.


hier mal meine class_tpl_file.php



<?php
class tpl {

var $templates = array();
var $subvariablepackid = 0;
var $templatefolders = array();
var $imagefolders = array();
var $images = array();

/* constuctor */
function tpl($templatepackid=0,$subvariablepackid=1,$prefix="") {
global $db, $n;
$this->subvariablepackid = $subvariablepackid;
if(!$templatepackid) $this->templatefolders[] = $prefix."templates";
$result = $db->query("SELECT * FROM bb".$n."_templatepacks");
while($row = $db->fetch_array($result)) $templatepacks[$row['templatepackid']] = $row;
while($templatepackid != 0) {
$this->templatefolders[] = $prefix.$templatepacks[$templatepackid]['templatefolder'];
if($templatepacks[$templatepackid]['parent_templatepackid']==-1) {
$this->templatefolders[] = $prefix."templates";
break;
}
else $templatepackid = $templatepacks[$templatepackid]['parent_templatepackid'];
}
$result = $db->query("SELECT * FROM bb".$n."_subvariablepacks LEFT JOIN bb".$n."_subvariables USING (subvariablepackid) WHERE variable = '{imagefolder}'");
while($row = $db->fetch_array($result)) $subvariablepacks[$row['subvariablepackid']] = $row;
$varlist = "''";
while($subvariablepackid != 0) {
$this->imagefolders[] = $subvariablepacks[$subvariablepackid]['substitute'];
$subvariablepackid = $subvariablepacks[$subvariablepackid]['parent_subvariablepackid'];
}
}

/* get template */
function get($templatename) {
if(!isset($this->templates[$templatename])) {
for ($j=0;$j<count($this->templatefolders);$j++) {
if(file_exists($this->templatefolders[$j]."/$templatename.tpl")) {
$this->templates[$templatename]=str_replace("\"","\\\"",implode("",file($th
is->templatefolders[$j]."/$templatename.tpl")));
break;
}
}
}
return $this->templates[$templatename];
}

/* print template */
function output($template) {
headers::send();
$template = $this->replacevars($template);
print($template);
}

/* replace vars */
function replacevars($template) {
global $db, $n, $pmpopup, $PHP_SELF;

$hash="";
if(strstr($template,"<title>")) {

$hash = md5(uniqid(microtime()));
$x = strpos($template,"<title>");
$y = strpos($template,"</title>");

$temp = substr($template,$x,$y-$x+cool ;
$template = substr($template,0,$x) . $hash . substr($template,$y+cool ;
}
preg_match_all("/(\{imagefolder\})\/([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))/si
U", $template, $matches);
for($j=0; $j<count($matches[0]); $j++) {
if(!isset($this->images[$matches[2][$j]])) {
for ($k=0;$k<count($this->imagefolders);$k++) {
if(file_exists($this->imagefolders[$k]."/".$matches[2][$j])) {
$this->images[$matches[2][$j]] = $this->imagefolders[$k]."/".$matches[2][$j];
break;
}
}
}
$tmp = $matches[1][$j]."/".$matches[2][$j];
$template = str_replace($tmp,$this->images[$matches[2][$j]],$template);
}
$result = $db->query("SELECT variable,substitute FROM bb".$n."_subvariables WHERE subvariablepackid = '".$this->subvariablepackid."'");
while($row = $db->fetch_array($result)) {
if(isset($row['variable']) && $row['variable'] && isset($row['substitute'])
&& $row['substitute']) {
switch($row['variable']) {
case "<body":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{css}":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{cssfile}":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{imagelogo}":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{!DOCTYPE}":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
default:
$template = str_replace($row['variable'],$row['substitute'],$template);
}
}
}

if($hash!="") $template = str_replace($hash,$temp,$template);
return $template;
}

function str_replace($search,$replace,$text) {
if(strstr($text,$search)) {
$x = strpos($text,$search);
return substr($text,0,$x) . $replace . substr($text,$x+strlen($search));
}
else return $text;
}
}
?>


Sehr komisch da is es auch drin aber warum findet der editor den string net? XD habs jetzt eingefügt
Slugger
Na weil du vielleicht den ganzen code statt einzelnen codeteilen eingegeben hast!
Biggi
Zitat:
Original von Psycadelic
öhm ich habe die datei mit ultra edit durchsucht und er findet diese stelle nicht.


hier mal meine class_tpl_file.php



<?php
class tpl {

var $templates = array();
var $subvariablepackid = 0;
var $templatefolders = array();
var $imagefolders = array();
var $images = array();

/* constuctor */
function tpl($templatepackid=0,$subvariablepackid=1,$prefix="") {
global $db, $n;
$this->subvariablepackid = $subvariablepackid;
if(!$templatepackid) $this->templatefolders[] = $prefix."templates";
$result = $db->query("SELECT * FROM bb".$n."_templatepacks");
while($row = $db->fetch_array($result)) $templatepacks[$row['templatepackid']] = $row;
while($templatepackid != 0) {
$this->templatefolders[] = $prefix.$templatepacks[$templatepackid]['templatefolder'];
if($templatepacks[$templatepackid]['parent_templatepackid']==-1) {
$this->templatefolders[] = $prefix."templates";
break;
}
else $templatepackid = $templatepacks[$templatepackid]['parent_templatepackid'];
}
$result = $db->query("SELECT * FROM bb".$n."_subvariablepacks LEFT JOIN bb".$n."_subvariables USING (subvariablepackid) WHERE variable = '{imagefolder}'");
while($row = $db->fetch_array($result)) $subvariablepacks[$row['subvariablepackid']] = $row;
$varlist = "''";
while($subvariablepackid != 0) {
$this->imagefolders[] = $subvariablepacks[$subvariablepackid]['substitute'];
$subvariablepackid = $subvariablepacks[$subvariablepackid]['parent_subvariablepackid'];
}
}

/* get template */
function get($templatename) {
if(!isset($this->templates[$templatename])) {
for ($j=0;$j<count($this->templatefolders);$j++) {
if(file_exists($this->templatefolders[$j]."/$templatename.tpl")) {
$this->templates[$templatename]=str_replace("\"","\\\"",implode("",file($th
is->templatefolders[$j]."/$templatename.tpl")));
break;
}
}
}
return $this->templates[$templatename];
}

/* print template */
function output($template) {
headers::send();
$template = $this->replacevars($template);
print($template);
}

/* replace vars */
function replacevars($template) {
global $db, $n, $pmpopup, $PHP_SELF;

$hash="";
if(strstr($template,"<title>")) {

$hash = md5(uniqid(microtime()));
$x = strpos($template,"<title>");
$y = strpos($template,"</title>");

$temp = substr($template,$x,$y-$x+cool ;
$template = substr($template,0,$x) . $hash . substr($template,$y+cool ;
}
preg_match_all("/(\{imagefolder\})\/([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))/si
U", $template, $matches);
for($j=0; $j<count($matches[0]); $j++) {
if(!isset($this->images[$matches[2][$j]])) {
for ($k=0;$k<count($this->imagefolders);$k++) {
if(file_exists($this->imagefolders[$k]."/".$matches[2][$j])) {
$this->images[$matches[2][$j]] = $this->imagefolders[$k]."/".$matches[2][$j];
break;
}
}
}
$tmp = $matches[1][$j]."/".$matches[2][$j];
$template = str_replace($tmp,$this->images[$matches[2][$j]],$template);
}
$result = $db->query("SELECT variable,substitute FROM bb".$n."_subvariables WHERE subvariablepackid = '".$this->subvariablepackid."'");
while($row = $db->fetch_array($result)) {
if(isset($row['variable']) && $row['variable'] && isset($row['substitute'])
&& $row['substitute']) {
switch($row['variable']) {
case "<body":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{css}":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{cssfile}":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{imagelogo}":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{!DOCTYPE}":
$template = $this->str_replace($row['variable'],$row['substitute'],$template); break;

default:
$template = str_replace($row['variable'],$row['substitute'],$template);
}
}
}

if($hash!="") $template = str_replace($hash,$temp,$template);
return $template;
}

function str_replace($search,$replace,$text) {
if(strstr($text,$search)) {
$x = strpos($text,$search);
return substr($text,0,$x) . $replace . substr($text,$x+strlen($search));
}
else return $text;
}
}
?>


Sehr komisch da is es auch drin aber warum findet der editor den string net? XD habs jetzt eingefügt


Und wenn du Code mit dem Code-BBCode eingibst, werden auch keine Zeichen in Smilies umgewandelt und die Zeileneinrückungen gehen auch nicht verloren. Augenzwinkern