Site PHP+MySQL Evénementiel

crabs_web_event-2.0 ©2005-2006 - Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)

~~ / ADMIN / template.php
Makefile install.php menu_inc.php index.php vars_done.php event_creer.php event.php event_mod.php event_done.php event_sup.php event_visu.php annonce_creer.php annonce.php annonce_mod.php annonce_done.php annonce_sup.php annonce_visu.php svg.php resto.php page.php template.php bloquer.php style.css
    1 <?php
    2 //
    3 // =============================================================================
    4 //  crabs_web_event-2.0 : Site PHP+MySQL Evénementiel
    5 //  Copyright (C) 2005-2006 : Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)
    6 //
    7 //  Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    8 //  et/ou le modifier en respectant les termes de la GNU General Public License
    9 //  version 2 ou (suite a votre propre choix) une version ulterieure.
   10 //
   11 //  Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   12 //  sans aucune garantie, meme si il est associe a un produit qui vous en
   13 //  propose une. Conformez-vous a la GNU General Public License pour avoir
   14 //  plus de precisions.
   15 //
   16 //  L'auteur ne peut etre tenu responsable de l'utilisation faite des
   17 //  composantes associees a ce projet (en partie ou dans leur totalite).
   18 //
   19 //  Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   20 //  de ce projet sous le nom gnu_gpl.txt
   21 //
   22 // =============================================================================
   23 //
   24 include( '../LIB/param.php' ) ;
   25 include( '../LIB/class_mysql.php' ) ;
   26 include( '../LIB/util.php' ) ;
   27 include( 'CLASS/xml.php' ) ;
   28 $templates = array(
   29     'e'=> array(
   30         'f'=>'event',
   31         'n'=>'Evénement ŕ venir',
   32         'vars'=> array(
   33             'titre'=>'[[TITRE]]',
   34             'texte'=>'[[TEXTE]]',
   35             'lieu'=>'[[LIEU]]',
   36             'datefr'=>'[[DATEFR]]',
   37             'date'=>'[[DATE]]'
   38             )
   39         ),
   40     'p'=> array(
   41         'f'=>'passe',
   42         'n'=>'Evénement passé',
   43         'vars'=> array(
   44             'titre'=>'[[TITRE]]',
   45             'texte'=>'[[TEXTE]]',
   46             'lieu'=>'[[LIEU]]',
   47             'datefr'=>'[[DATEFR]]',
   48             'date'=>'[[DATE]]'
   49             )
   50         ),
   51     'a'=> array(
   52         'f'=>'annonce',
   53         'n'=>'Annonce',
   54         'vars'=> array(
   55             'id'=>'[[ID]]',
   56             'titre'=>'[[TITRE]]',
   57             'texte'=>'[[TEXTE]]',
   58             'creeefr'=>'[[CREEEFR]]',
   59             'creee'=>'[[CREEE]]',
   60             'modiffr'=>'[[MODIFFR]]',
   61             'modif'=>'[[MODIF]]'
   62             )
   63         )
   64     ) ;
   65 if ( array_key_exists( 't', $_POST ) )
   66     {
   67     $t = fromPOST( 't' ) ;
   68     $nom = $templates[$t]['f'] ;
   69     $fichier = $nom.'.tmpl' ;
   70     $tmpl = fromPost( 'template' ) ;
   71     // Le template brut
   72     $fd = fopen( '../TEMPLATE/'.$fichier, 'w' ) ;
   73     fwrite( $fd, $tmpl ) ;
   74     fclose( $fd ) ;
   75     // Le template en PHP
   76     $tmpl = str_replace( '$', '\\$', $tmpl ) ;
   77     $tmpl = str_replace( "\r", '', $tmpl ) ;
   78     foreach ( $templates[$t]['vars'] as $var => $val )
   79         $tmpl = str_replace( $val, '$TV'.$var, $tmpl ) ;
   80     $fichier = $templates[$t]['f'].'.php' ;
   81     $cle = 'VV'.substr( md5( uniqid( rand(), true ) ), 0, 8 ) ;
   82     $fd = fopen( '../TEMPLATE/'.$fichier, 'w' ) ;
   83     fwrite( $fd, "<?php\n" ) ;
   84     fwrite( $fd, "\$template_$nom = <<<$cle\n" ) ;
   85     fwrite( $fd, $tmpl."\n\n" ) ;
   86     fwrite( $fd, "$cle;\n" ) ;
   87     fwrite( $fd, "\$utf8_template_$nom = <<<$cle\n" ) ;
   88     fwrite( $fd, utf8_encode($tmpl)."\n\n" ) ;
   89     fwrite( $fd, "$cle;\n" ) ;
   90     fwrite( $fd, "?>\n" ) ;
   91     fclose( $fd ) ;
   92     }
   93 else
   94     $t = fromGET( 't', 'e' ) ;
   95 $fichier = $templates[$t]['f'].'.tmpl' ;
   96 $xml = new XML ;
   97 $xml->xsl = relative2absolute( 'XSL/admin.xsl' ) ;
   98 $demo = demoMode( '..' ) ;
   99 if ( $demo )
  100     $xml->addElementText( 'titre', 'Template : DEMO' ) ;
  101 else
  102     $xml->addElementText( 'titre', 'Template' ) ;
  103 include( 'menu_inc.php' ) ;
  104 
  105 $cnt = @file_get_contents( '../TEMPLATE/'.$fichier ) ;
  106 if ( $cnt == false ) $cnt="" ;
  107 $cnt = toXML( $cnt ) ;
  108 $page = $xml->addElementText( 'template', $cnt,
  109     array( 't'=>$t, 'f'=>$fichier, 'nom'=>$templates[$t]['n'] ) ) ;
  110 
  111 $vars = 'Variables disponibles ' ; $sep=': ' ;
  112 foreach ( $templates[$t]['vars'] as $v )
  113     {
  114     $vars.= $sep . $v ;
  115     $sep = ', ' ;
  116     }
  117 $xml->addElementText( 'comment', toXML($vars) ) ;
  118 if ( $demo )
  119     $xml->addElementText( 'comment', 'Mode démo: Edition template inactive' ) ;
  120 $xml->affiche() ;
  121 ?>
Makefile install.php menu_inc.php index.php vars_done.php event_creer.php event.php event_mod.php event_done.php event_sup.php event_visu.php annonce_creer.php annonce.php annonce_mod.php annonce_done.php annonce_sup.php annonce_visu.php svg.php resto.php page.php template.php bloquer.php style.css
~~ / ADMIN / template.php

Haut de page

Contacter crabs

Date de génération : 22/09/2011 21:48