crabs_cms-1.0.4 ©2006-2008 - Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)
1 <?php 2 // 3 // ============================================================================= 4 // crabs_cms-1.0.4 : Crabs Contents Management System 5 // Copyright (C) 2006-2008 : 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 $RACINE='../..' ; 25 26 include( $RACINE.'/pinfo.php' ) ; 27 include( $RACINE.'/LIB/param.php' ) ; 28 include( $RACINE.'/LIB/util.php' ) ; 29 include( $RACINE.'/LIB/xml.php' ) ; 30 include( $RACINE.'/LIB/mysql.php' ) ; 31 include( $RACINE.'/LIB/generer.php' ) ; 32 33 if ( !array_key_exists( 'w', $_GET ) ) 34 { 35 $xsl = 'gestion.xsl' ; 36 include( $RACINE.'/LIB/xml_session.php' ) ; 37 // webmaster et bureau peuvent publier 38 $publie = ( $user['webmaster'] == 'Y' ) || ( $user['bureau'] == 'Y' ) ; 39 if ( !$publie ) 40 { header( 'Location: index.php' ) ; exit ; } 41 $publie = $xml->addElement( 'tout_publier' ) ; 42 $publie->addElement('publie', array( 43 'quoi'=>'Dossiers & articles', 44 'mode'=>'dossier', 'info'=>'' ) ) ; 45 $publie->addElement('publie', array( 46 'quoi'=>'Calendrier', 47 'mode'=>'cal', 'info'=>'' ) ) ; 48 $c = new MYSQL ; 49 $tbl = $DB_PRFX.'pha' ; 50 $sql = "SELECT court FROM $tbl WHERE publie='Y' ORDER BY court" ; 51 $res = $c->query( $sql ) ; 52 while ( $r = mysql_fetch_object( $res ) ) 53 { 54 $court = toXML( fromMYSQL( $r->court ), true ) ; 55 $publie->addElement('publie', array( 56 'quoi'=>"Album $court", 57 'mode'=>'album', 58 'info'=>"$court" ) ) ; 59 } 60 mysql_freeresult( $res ) ; 61 $xml->affiche() ; 62 exit ; 63 } 64 // ATTENTION ICI DU HTTP REQUEST... 65 66 include( $RACINE.'/LIB/only_session.php' ) ; 67 header( 'Content-type: text/plain' ) ; 68 // webmaster et bureau peuvent publier 69 $publie = ( $user['webmaster'] == 'Y' ) || ( $user['bureau'] == 'Y' ) ; 70 if ( !$publie ) { echo "PAS LE DROIT" ; exit ; } 71 72 $w = fromGET( 'w' ) ; 73 $c = new MYSQL ; 74 if ( $w == 'liste_tout_publier' ) 75 { 76 $sep = '' ; 77 $mode = fromGET('m') ; 78 if ( $mode == 'dossier' ) 79 { 80 $sql ="SELECT dossier, numero FROM ${DB_PRFX}article"; 81 $sql.=" ORDER BY dossier DESC, numero DESC"; 82 $res = $c->query( $sql ) ; 83 while ( $r = mysql_fetch_object( $res ) ) 84 { echo $sep,'a:',$r->dossier,':',$r->numero ; $sep = '|' ; } 85 mysql_freeresult( $res ) ; 86 87 $tbl = $DB_PRFX.'dossier' ; 88 $sql="SELECT court FROM $tbl ORDER BY court DESC"; 89 $res = $c->query( $sql ) ; 90 while ( $r = mysql_fetch_object( $res ) ) 91 { 92 if ( $r->court == 'cal' ) continue ; 93 echo $sep,'d:',$r->court ; $sep = '|' ; 94 } 95 mysql_freeresult( $res ) ; 96 exit ; 97 } 98 if ( $mode == 'album' ) 99 { 100 // -> il faut retrouver album depuis court pour la requette sur phf 101 $court = fromGET('i') ; 102 $sql ="SELECT numero FROM ${DB_PRFX}pha WHERE court='$court'" ; 103 $res = $c->query( $sql ) ; 104 $r = mysql_fetch_object( $res ) ; 105 $album = $r->numero ; 106 $sql ="SELECT numero FROM ${DB_PRFX}phf" ; 107 $sql.=" WHERE album='$album' ORDER BY numero" ; 108 $res = $c->query( $sql ) ; $n = 0 ; 109 while ( $r = mysql_fetch_object( $res ) ) 110 { echo $sep,'p:p:',$court,':',$r->numero ; $sep = '|' ; $n++ ; } 111 mysql_freeresult( $res ) ; 112 $nbpage = (int)( ($n+14) / 15 ) ; 113 for( $i=0; $i<$nbpage; $i++ ) 114 { echo $sep,'p:a:',$court,':',$i ; $sep = '|' ; } 115 exit ; 116 } 117 if ( $mode == 'cal' ) 118 { 119 echo "c:courante" ; 120 $sql ="SELECT DISTINCT(saison) FROM ${DB_PRFX}cal ORDER BY saison" ; 121 $res = $c->query( $sql ) ; 122 while ( $r = mysql_fetch_object( $res ) ) 123 echo '|c:',$r->saison ; 124 mysql_freeresult( $res ) ; 125 exit ; 126 } 127 } 128 $cmd = explode( ':', $w ) ; $xml_string=''; $do_xslt = false ; $html = '' ; 129 if ( $cmd[0] == 'p' ) $root = '..' ; 130 include( $RACINE.'/LIB/xml_publie.php' ) ; 131 if ( $cmd[0] == 'a' ) 132 { 133 $dossier = $cmd[1] ; $numero = $cmd[2] ; 134 generer_article( $publie, $c, $dossier, $numero ) ; 135 $xml_string = $publie->toString() ; 136 $do_xslt = true ; $html = '/'.$dossier.'_'.$numero.'.html' ; 137 } 138 if ( $cmd[0] == 'd' ) 139 { 140 $dossier = $cmd[1] ; 141 if ( $dossier == 'accueil' ) 142 { 143 generer_accueil( $publie, $c ) ; 144 $html = '/index.html' ; 145 } 146 else if ( $dossier == 'nouveautes' ) 147 { 148 generer_nouveautes( $publie, $c ) ; 149 $html = '/nouveautes.html' ; 150 } 151 else 152 { 153 generer_dossier( $publie, $c, $dossier ) ; 154 $html = '/'.$dossier.'.html' ; 155 } 156 $xml_string = $publie->toString() ; 157 $do_xslt = true ; 158 } 159 if ( $cmd[0] == 'c' ) 160 { 161 if ( $cmd[1] == 'courante' ) 162 { 163 $html = '/cal.html' ; 164 generer_cal( $publie, $c, false ) ; 165 } 166 else 167 { 168 $html = '/cal_'.$cmd[1].'.html' ; 169 generer_cal( $publie, $c, $cmd[1] ) ; 170 } 171 $xml_string = $publie->toString() ; 172 $do_xslt = true ; 173 } 174 else if ( $cmd[0] == 'p' ) 175 { 176 if ( $cmd[1] == 'p' ) // une photo 177 { 178 $html = '/PHOTOS/'.$cmd[2].'_p_'.$cmd[3].'.html' ; 179 generer_photo( $publie, $c, $cmd[2], $cmd[3] ) ; 180 $xml_string = $publie->toString() ; 181 $do_xslt = true ; 182 } 183 else 184 { 185 $html = '/PHOTOS/'.$cmd[2].'_a_'.$cmd[3].'.html' ; 186 generer_album( $publie, $c, $cmd[2], $cmd[3] ) ; 187 $xml_string = $publie->toString() ; 188 $do_xslt = true ; 189 } 190 } 191 if ( $do_xslt ) 192 { 193 $xml = new DOMDocument; 194 $xml->loadXML( $xml_string ) ; 195 $xsl = new DOMDocument; 196 $xsl->load( $RACINE.'/STYLE/site.xsl' ) ; 197 $proc = new XSLTProcessor; 198 $proc->importStyleSheet( $xsl ); 199 file_put_contents( $RACINE.$html, $proc->transformToXML( $xml ) ) ; 200 echo toJS( "Génération de $html ok" ) ; 201 } 202 ?>
Date de génération : 24/10/2008 21:34