Template-Hack

Beatstyler
Dies ist eine vorgefertigte Schablone.
Bitte fülle soviel aus, wie dir nur Möglich ist, du kannst auch gerne noch mehr Angaben machen.


Template-Hack

Könnte mir bitte mal einer dabei helfen, da ich irgendwas falsch mache

Fehlermeldung:


Link zum Forum oder Screenshot:


nichts
mikes
Hi,

Na das nenne ich mal ne super Fehlerbeschreibung Mauer

Wie wärs mit ner Fehlermedung, genauere Angaben wo es nicht weiter geht?
XeRanoN
Frag am besten im Supportthread des entsprechenden Hacks nach Augenzwinkern .
Beatstyler
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /data/apache/users/kilu.de/beatstyler/www/acp/lib/class_tpl_file.php on line 114

Wie kann ich die Datei install_templates.php aufrufen
XeRanoN
Zitat:
Original von XeRanoN
Frag am besten im Supportthread des entsprechenden Hacks nach Augenzwinkern .


+:
Parse error: Einbaufehler...

+:
Datei einfach im Browser öffnen...
Beatstyler
habe alles so gemacht wie es da stand! Wie rufe ich die im Browser auf?
mikes
Hi,

Also, ich hatte den noch gerade gestern eingabaut, geht wunderbar.

Datei im Broswer öffnen -> Datei anklicken (rechts) -> öffnen mit -> Browser wählen
Beatstyler
könntest de mir da mal bei den Einabu helfen
MrMind
Dateiaufruf geht auch recht simple mit:

ur_zum_forum/install_templates.php (oder halt die gegebenen Unterordner dran hängen)


bei Parse Error Probleme auch die Entsprechenden Code-Zeilen posten, so kann man nachgucken, wo der Fehler ist... Ferndiagnose nur Schemenhaft möglich ^^
Beatstyler
Irgendwo soll da en fehler sein.

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;
case "{imagefolder}": 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;
}
}
?>
MrMind
Ich sagte Codezeilen nicht die ganze File Augenzwinkern


Zitat:
Original von Beatstyler
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /data/apache/users/kilu.de/beatstyler/www/acp/lib/class_tpl_file.php on line 114


Nur diese Zeile +/- 5 weitere Zeilen
Beatstyler
welche cod zeile, weiss ja net ma wo der fehler ist!
MrMind
Wer lesen kann ist klar im Vorteil Augenzwinkern

Zitat:
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /data/apache/users/kilu.de/beatstyler/www/acp/lib/class_tpl_file.php on line 114



Das heißt, in dieser Zeile (114) tritt der Fehler auf bzw. macht sich bemerkbar ... das heißt, dass vorher oder genau in dieser Zeile, was nicht stimmt (daher auch +/-5 Zeilen um vorher/nacher zu gucken).

Die Zeile ermittelst du mit einem simplen Editor (=> Bearbeiten oder Ansicht => Gehe zu Zeile => 114 eintippen)
Beatstyler
105 - 115

}

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;
}
}
?>
MrMind
Mh da scheint allerdings kein Fehler vor zu liegen ... ist das die bearbeitet Version oder ist die Datei unbehandelt vom Hack?


Also: musstest du für den Hack diese Datei bearbeiten oder nicht? wenn ja, was hast du wo eingefügt (ausschnitt von der Anleitung) und ist das die Datei wo du schon was verändert hast oder vor der Veränderung?
Beatstyler
ja die habe bearbeitet, hänge mal beide dateien mit an

wie es hier vorgegeben ist.

###########################################################################
###################################################

suche in acp/lib/class_tpl_file.php

-----------------------

function tpl($templatepackid=0,$subvariablepackid=1,$prefix="") {
$this->subvariablepackid = $subvariablepackid;
$this->templatefolder = $prefix."templates";
}

-----------------------

und ersetze es durch

-----------------------

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'];
}
}

-----------------------
MrMind
Kein Fehler zu finden ... Einbau scheint korrekt zu sein.


Haste mal im Supportthread nach so einem Problem schon gesucht? ich denke mal kaum, dass du da ein Einzelfall bist.
Beatstyler
ne habe ich noch net, gibt es hier so ein Forum.
MrMind
Da wo du den Hack her hast, gibt es ein Supportthread dafür ... ist auch immer Verlinkt in dem Download-Bereich.

Da solltest du dann mal reingucken ... aber bekomm keinen Schreck... das Thema wird locker schon die 30 Seiten erreicht haben ^^
Beatstyler
hm also hier kann ich nichts anderes finden. oder ich bin blind