Der komplette code:
[code]<?php
#-------------------------------------------------------------------------
index.php eine Kontrollerdatei für flexible PHP Webs
Version: 0.84
#-------------------------------------------------------------------------
This is © 2008 by Jan Alfred Czarnowski (piratos@coftware.de)
#-------------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#-------------------------------------------------------------------------
$timeparts = explode(" ",microtime());
$starttime = $timeparts[1].substr($timeparts[0],1);
#Nachfolgende Variableninhalte sind anzupassen
$sitename=‘oens.de.vu’; // Name der Website
$xajaxseiten=array(‘pipicturesslideshow’,‘gbuch’); // Seiten die Xajax nutzen = automatisches laden von Xajax
$usexajax=false; // auf false lassen, wenn Xajax über $xajaxseiten geladen wird
#--------------------------------------------
$webcfg=get_loaded_extensions ();
$use_sqlite =in_array(‘PDO’,$webcfg) && in_array(‘pdo_sqlite’,$webcfg);
if (!$use_sqlite)
{
$use_sqlite =(in_array(‘SQLite’,$webcfg) or in_array(‘sqlite’,$webcfg)) && function_exists(‘sqlite_open’);
$PDO=false;
}
else
$PDO=true;
#$use_sqlite=0; // Diese Auskommentierung entfernen wenn grundsätzlich kein Sqlite benutzt werden soll.
class TPLE
{
var $PLUGIN_DIR = ‘plugins/’;
var $VARS = array();
function assign($key, $val=null)
{
$this->VARS[$key] = $val;
}
function display($tpl_file)
{
if(!is_file($tpl_file))
exit("Templatedatei $tpl_file nicht vorhanden");
$TPL = &$this->VARS;
include($tpl_file);
}
function fetch($tpl_file)
{ $out='';
if(is_file($tpl_file))
{
$code=file_get_contents($tpl_file);
ob_start();
@eval('?>'.$code);
$out=ob_get_contents();
ob_end_clean();
}
return $out;
}
function varfetch($code)
{ $out="";
ob_start();
@eval('?>'.$code);
$out=ob_get_contents();
ob_end_clean();
return $out;
}
function plugin($func_name)
{
$func_file = $this->PLUGIN_DIR . $func_name . '.php';
if(!is_file($func_file))
exit("Plugin $func_file ist nicht vorhanden");
include_once($func_file);
$code = "return $func_name(";
if(func_num_args() > 1) {
$args = array_slice(func_get_args(), 1);
for($x=0; $x<count($args); $x++) {
if($x>0) $code .= ',';
$code .= '$args[' . $x . ']';
}
}
$code .= ");";
return eval($code);
}
}
$root_path=dirname(FILE);
set_magic_quotes_runtime(false);
#ini_set(“session.use_trans_sid”, “0”); // schaltet die SID übergabe per GET Parameter AUS
#ini_set(“arg_separator.output”,"&");
#ini_set(‘url_rewriter.tags’, ‘’);
@session_name(md5($root_path.’_PowerSite’));
if (!@session_id()) @session_start();
$xajax=null;
if(strstr($_SERVER[“HTTP_ACCEPT_ENCODING”],“gzip”))
@ob_start(“ob_gzhandler”);
else
@ob_start();
$menu=null;
if (isset($_REQUEST[‘sprache’]))
{
$sprache=$_REQUEST[‘sprache’];
if ($sprache==‘de’)$sprache=’’;
}
elseif (isset($_SESSION[‘sprache’]))
$sprache=$_SESSION[‘sprache’];
else
$sprache=’’;
$_SESSION[‘sprache’]=$sprache;
if (isset($_SESSION[‘powersiteadmin’])) $ist_admin=true; else $ist_admin=false;
if ($use_sqlite)
{
if ($PDO)
{
$db = new PDO(‘sqlite:data/powersite_data’);
$db->query(“PRAGMA short_column_names = 1;”);
$sth = $db->prepare(“SELECT name FROM sqlite_master WHERE type=‘table’ ORDER BY name;”);
print_r($sth);
print_r($db);
die();
$sth->execute();
$sqlite_tables=false;
while ($row = $sth->fetch())
{ if ($row['name']<>'sqlite_sequence')
$sqlite_tables[]=$row['name'];
}
}
else
{ $sqlite_tables=false;
$db = sqlite_open ('data/powersite_data.sq2', 0666);
$r=sqlite_query($db,"PRAGMA short_column_names = 1;");
$r=sqlite_query($db,"SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;");
$rows=sqlite_fetch_all($r);
if (count($rows)>0)
{
foreach ($rows as $rr)
{
if($rr['name']<>'sqlite_sequence')
$sqlite_tables[]=$rr['name'];
}
}
}
}
else
$db=false;
$server=‘http://’ . $_SERVER[‘HTTP_HOST’] . substr($_SERVER[‘PHP_SELF’], 0, strlen($_SERVER[‘PHP_SELF’]) - 10);
$dir=substr($_SERVER[‘PHP_SELF’], 0, strlen($_SERVER[‘PHP_SELF’]) - 10);
if ($dir == ‘/’) $dir =’’;
$root_url=“http://”.$_SERVER[‘SERVER_NAME’].$dir;
$tpl =& new TPLE();
$tpl->assign(‘root_url’,$root_url);
$tpl->assign(‘root_path’,$root_path);
$tpl->assign(‘query_var’,‘seite’);
$tpl->assign(‘ist_admin’,$ist_admin);
$tpl->assign(‘webcfg’,$webcfg);
$tpl->assign(‘sqlitetables’,$sqlite_tables);
$tpl->assign(‘PDO’,$PDO);
//Ablageort für die Inhalte festlegen
$htmlfolder=‘html/’;
$tpl->assign(‘htmlfolder’,$htmlfolder);
// Seitennamen holen http://meinweb.de/index.php?seite=meineseite oder was auch immer default setzen
$seite = isset($_REQUEST[‘seite’]) ? $_REQUEST[‘seite’] :‘start’;
if (isset($_REQUEST[‘tpl’]) && trim($_REQUEST[‘tpl’])<>’’)
$template=$_REQUEST[‘tpl’];
elseif (isset($_SESSION[‘tpl’]) && trim($_SESSION[‘tpl’])<>’’)
$template=$_SESSION[‘tpl’];
else
$template=‘index.tpl.php’;
$_SESSION[‘tpl’]=$template;
$special = isset($_REQUEST[‘special’]) ? $_REQUEST[‘special’] :2;
$tpl->assign(‘special’,$special);
// Zuweisen und aus File holen Dateinamen setzt sich aus ablageort + seitennamen plus endung .html zusammen
$tpl->assign(‘seite’,$seite);
$tpl->assign(‘sprache’,$sprache);
$meta_name=’’;
if ($sprache==’’)
{
if (!file_exists($htmlfolder.$seite.’.html.php’)) $seite=‘404’;
$cc_name=$htmlfolder.$seite.’.html.php’;
if (file_exists($htmlfolder.$seite.’.meta.php’))
$meta_name=$htmlfolder.$seite.’.meta.php’;
if (file_exists($htmlfolder.$seite.’_a.html.php’))
{
$t2=$tpl->fetch($htmlfolder.$seite.’_a.html.php’);
$tpl->assign(‘inhalt_a’,$t2);
}
else
$tpl->assign(‘inhalt_a’,’’);
if (file_exists($htmlfolder.$seite.’_b.html.php’))
{
$t2=$tpl->fetch($htmlfolder.$seite.’_b.html.php’);
$tpl->assign(‘inhalt_b’,$t2);
}
else
$tpl->assign(‘inhalt_b’,’’);
$t2=null;
}
else
{
if (!file_exists($htmlfolder.$sprache.’/’.$seite.’.html.php’))
{
$seite=‘404’;
$tpl->assign(‘inhalt_a’,’’);
$tpl->assign(‘inhalt_b’,’’);
}
else
{
if (file_exists($htmlfolder.$sprache.’/’.$seite.’_a.html.php’))
{
$t2=$tpl->fetch($htmlfolder.$sprache.’/’.$seite.’_a.html.php’);
$tpl->assign(‘inhalt_a’,$t2);
}
else
$tpl->assign(‘inhalt_a’,’’);
if (file_exists($htmlfolder.$sprache.’/’.$seite.’_b.html.php’))
{
$t2=$tpl->fetch($htmlfolder.$sprache.’/’.$seite.’_b.html.php’);
$tpl->assign(‘inhalt_b’,$t2);
}
else
$tpl->assign(‘inhalt_b’,’’);
$t2=null;
}
$cc_name=$htmlfolder.$sprache.’/’.$seite.’.html.php’;
if (file_exists($htmlfolder.$sprache.’/’.$seite.’.meta.php’))
$meta_name=$htmlfolder.$sprache.’/’.$seite.’.meta.php’;
}
$tpl->assign(‘meta_name’,$meta_name);
$tpl->assign(‘inhalt’,"$cc_name");
$tpl->assign(‘alias’,$seite);
$tpl->assign(‘sitename’,$sitename);
$kurl=$root_url.’/index.php?seite=’.$seite;
if ($sprache ==’’) $kurl .=’&sprache=de’;else $kurl .=’&sprache=’.$sprache;
$tpl->assign(‘komplett_url’,$kurl);
if ($usexajax or in_array($seite,$xajaxseiten))
{
require(‘xajax/xajaxAIO.inc.php’);
$xajax = new xajax();
require(‘inc_xajax_functions.php’);
$headtext = $xajax->getJavascript(‘xajax’)."\n";
$tpl->assign(‘xajaxheader’,$headtext);
unset($headtext);
}
// Zwamgsweise UTF 8
if (!headers_sent())
header(“Content-Type: text/html; charset= UTF-8”);
$tpl->display(‘templates/’.$template);
$tpl=null;$xajax=null;$db=null;
// Zeit und RAM Verbrauch ermitteln
$timeparts = explode(" ",microtime());
$gesamt = $timeparts[1].substr($timeparts[0],1) -$starttime;
// Als Kommentar die Werte ausgeben
echo ‘’;
ob_end_flush();
?> [/code]
wenn ihr auf oens.bplaced.net/test geht hab ich mal die grundsite hochgeladen und da gehts, ich brauch jetzt echt iwie hilfe!!