You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
5.4 KiB
PHP
170 lines
5.4 KiB
PHP
<?php
|
|
//
|
|
// Anfang: Start Session und Inits
|
|
//
|
|
session_start();
|
|
|
|
include "include/sysvariable_inc.php";
|
|
include "include/funktions_inc.php";
|
|
include "sys/printhtml.php";
|
|
if ($_GET["sprache"] != ""){
|
|
$sys_sprache = $_GET["sprache"];
|
|
setcookie($sys_projektname."Sprache",$sys_sprache,time()+ 40000000,"/");
|
|
}
|
|
else if( !$_COOKIE[$sys_projektname."Sprache" ] ){
|
|
$sys_sprache = "deu";
|
|
setcookie($sys_projektname."Sprache",$sys_sprache,time()+ 40000000,"/");
|
|
}
|
|
else {
|
|
$sys_sprache = $_COOKIE[$sys_projektname."Sprache"];
|
|
}
|
|
$sys_admin = $_COOKIE[$sys_projektname."Admin"];
|
|
include "include/navigation_data.php";
|
|
?>
|
|
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<title>Generate</title>
|
|
</head>
|
|
<body>
|
|
|
|
<?php
|
|
global $err;
|
|
global $anker;
|
|
global $ierr;
|
|
$err = false;
|
|
$ierr = 0;
|
|
$sys_path_html = $sys_path.$verz_html;
|
|
$sys_path_hgen = $sys_path_html.'.gen';
|
|
if (!is_dir($sys_path_hgen)){
|
|
EchoText('Lege Verzeichniss <big>'.$sys_path_html.'.gen</big> an');
|
|
mkdir($sys_path_hgen);
|
|
if (!is_dir($sys_path_hgen) || !is_writeable($sys_path_hgen)){
|
|
PrintFehler('Konnte Verzeichniss <big>'.$sys_path_html.'.gen</big> nicht anlegen');
|
|
}
|
|
}
|
|
if (!$err){
|
|
if (!is_writeable($sys_path_hgen)){
|
|
PrintFehler('Verzeichniss <big>'.$sys_path_html.'.gen</big> ist schreibgeschützt');
|
|
}
|
|
}
|
|
if (!$err){
|
|
EchoText('<hr><b>Lösche Verzeichnisinhalte in '.$sys_path_hgen.'</b>');
|
|
if ($fudir = opendir($sys_path_hgen))
|
|
{
|
|
while (false !== ($file = readdir($fudir))) {
|
|
if ($file != '.' && $file != '..'){
|
|
EchoText('lösche File '.$file);
|
|
if (!is_writeable($sys_path_hgen.'/'.$file) || !unlink($sys_path_hgen.'/'.$file)){
|
|
PrintFehler('Konnte File '.$sys_path_hgen.'/'.$file.' nicht löschen');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
closedir($fudir);
|
|
}
|
|
$sys_path_info = $sys_path.$verz_info;
|
|
$sys_path_igen = $sys_path_info.'.gen';
|
|
if (!is_dir($sys_path_igen)){
|
|
EchoText('Lege Verzeichniss <big>'.$sys_path_info.'.gen</big> an');
|
|
mkdir($sys_path_igen);
|
|
if (!is_dir($sys_path_igen) || !is_writeable($sys_path_igen)){
|
|
PrintFehler('Konnte Verzeichniss <big>'.$sys_path_info.'.gen</big> nicht anlegen');
|
|
}
|
|
}
|
|
if (!$err){
|
|
if (!is_writeable($sys_path_igen)){
|
|
PrintFehler('Verzeichniss <big>'.$sys_path_info.'.gen</big> ist schreibgeschützt');
|
|
}
|
|
}
|
|
if (!$err){
|
|
EchoText('<hr><b>Lösche Verzeichnisinhalte in '.$sys_path_igen.'</b>');
|
|
if ($fudir = opendir($sys_path_igen)){
|
|
while (false !== ($file = readdir($fudir))) {
|
|
if ($file != '.' && $file != '..'){
|
|
EchoText('lösche File '.$file);
|
|
if (!is_writeable($sys_path_igen.'/'.$file) || !unlink($sys_path_igen.'/'.$file)){
|
|
PrintFehler('Konnte File '.$sys_path_igen.'/'.$file.' nicht löschen');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
closedir($fudir);
|
|
}
|
|
|
|
|
|
// Generierung
|
|
if (!$err){
|
|
$sys_admin = false; // Keine Adminrechte bei Generierung
|
|
EchoText('<hr><b>Starte Generierung:</b>');
|
|
$last_nKey = '';
|
|
reset($navigation);
|
|
while (list ($nKey,list($ntxt,$nhtml,$ninfo,$nfunkt,$nmenu)) = each ($navigation)) {
|
|
// test auf *label
|
|
if( ($nKey[0] == '*' & $nmenu !='hauptmenu') or $nKey[0] == '$'){
|
|
$last_nKey = $nKey;
|
|
}
|
|
else{
|
|
if ($last_nKey[0] != '$'){
|
|
if ($nfunkt == '' && $nhtml != '' && file_exists($sys_path_html.'/'.$nhtml)){
|
|
if (strpos($nhtml,'.php')){
|
|
EchoText('Generiere: '. $verz_html.'.gen/'.$nhtml);
|
|
}
|
|
else{
|
|
EchoText('Generiere: '. $verz_html.'.gen/'.str_replace('.html','.php',$nhtml));
|
|
}
|
|
if (strpos($nhtml,'.php')){
|
|
$afile = $verz_html . '/'.$nhtml;
|
|
if ($lfile = fopen($afile,'r')){
|
|
$buffer = fread($lfile,filesize ($afile));
|
|
fclose ($lfile);
|
|
if ($lfile = fopen($sys_path_hgen.'/'.$nhtml, 'w')){
|
|
fwrite($lfile,$buffer);
|
|
fclose ($lfile);
|
|
}
|
|
else{
|
|
PrintFehler('Konnte File nicht schreiben: '.$sys_path_hgen.'/'.$nhtml);
|
|
}
|
|
}
|
|
else{
|
|
PrintFehler('Konnte File nicht lesen: '.$verz_html . '/'.$nhtml);
|
|
}
|
|
}
|
|
else{
|
|
Get_Anker_Styles_HX($verz_html . "/" . $nhtml,'a');
|
|
if ($lfile = fopen($sys_path_hgen.'/'.str_replace('.html','.php',$nhtml), 'w')){
|
|
// Hmtlseite genereiern
|
|
$html_file = PrintHtml($verz_html.'/'.$nhtml);
|
|
// Dynamische links dynamisch lassen
|
|
$buffer = str_replace($_SERVER['PHP_SELF'],'<?php echo $_SERVER[\'PHP_SELF\']; ?>',$html_file);
|
|
fwrite($lfile,$buffer);
|
|
fclose ($lfile);
|
|
}
|
|
else{
|
|
PrintFehler('Konnte File nicht schreiben: '.$sys_path_hgen.'/'.$nhtml);
|
|
}
|
|
}
|
|
}
|
|
if ($nfunkt == '' && $ninfo != '' && file_exists($sys_path_info.'/'.$ninfo)){
|
|
EchoText('Generiere: '. $verz_info.'.php/'.str_replace('.html','.php',$ninfo));
|
|
if ($lfile = fopen($sys_path_igen.'/'.str_replace('.html','.php',$ninfo), 'w')){
|
|
// Hmtlseite genereiern
|
|
$html_file = PrintHtml($verz_info.'/'.$ninfo);
|
|
// Dynamische links dynamisch lassen
|
|
$buffer = str_replace($_SERVER['PHP_SELF'],'<?php echo $_SERVER[\'PHP_SELF\']; ?>',$html_file);
|
|
fwrite($lfile,$buffer);
|
|
fclose ($lfile);
|
|
}
|
|
else{
|
|
PrintFehler('Konnte File nicht schreiben: '.$sys_path_igen.'/'.$ninfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
EchoText('<hr><b>Generierung abgeschlossen</b>');
|
|
echo '<hr><br><br>';
|
|
echo '<a href="'.$_GET['ap'].'">Zurück zur Doku</a>';
|
|
?>
|