|
Server IP : 10.111.40.2 / Your IP : 216.73.217.145 Web Server : Apache System : Linux webd002.cluster111.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : comimage ( 586) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/comimage/baticlean.net/inc/classes/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
//*****************************************************
// CLASS METIER POUR GERER LES APPLICATIONS METIER
//*****************************************************
class Metier{
function __construct(){
}
public function getChamps($bdd, $retour, $table, $champs, $valeur){
$result = $bdd->prepare("SELECT `".$retour."` FROM `".$table."` WHERE `".$champs."`=?");
$result->execute(array($valeur));
$data = $result->fetch(PDO::FETCH_OBJ);
$result->closeCursor();
return $data->$retour;
}
public function deleteUnElement($bdd, $table, $champs, $valeur){
$result = $bdd->prepare("DELETE FROM `".$table."` WHERE `".$champs."`=?");
$result->execute(array($valeur));
$result->closeCursor();
}
public function getTable($bdd, $table, $champs, $valeur){
$result = $bdd->prepare("SELECT * FROM `".$table."` WHERE `".$champs."`=?");
$result->execute(array($valeur));
$data = $result->fetch(PDO::FETCH_OBJ);
$result->closeCursor();
return $data;
}
public function getTableAnd($bdd, $table, $champs, $valeur, $etand, $valetand){
$result = $bdd->prepare("SELECT * FROM `".$table."` WHERE `".$champs."`=? AND `".$etand."`='".$valetand."'");
$result->execute(array($valeur));
$data = $result->fetch(PDO::FETCH_OBJ);
$result->closeCursor();
return $data;
}
public function getTableWhere($bdd, $table, $where){
$result = $bdd->prepare("SELECT * FROM `".$table."` WHERE ".$where);
$result->execute(array($valeur));
$data = $result->fetch(PDO::FETCH_OBJ);
$result->closeCursor();
return $data;
}
public function updateUnElement($bdd, $table, $set_champs, $set_valeur, $champs, $valeur){
$result = $bdd->prepare("UPDATE `".$table."` SET `".$set_champs."`=? WHERE `".$champs."`=?");
$result->execute(array($set_valeur,$valeur));
$result->closeCursor();
}
public function compter($bdd, $table, $champs, $valeur,$option){
if($option == "all"){
$result = $bdd->prepare("SELECT COUNT(*) AS compter FROM `".$table."`");
$result->execute();
}
else{
$result = $bdd->prepare("SELECT COUNT(*) AS compter FROM `".$table."` WHERE `".$champs."`=?");
$result->execute(array($valeur));
}
$data = $result->fetch(PDO::FETCH_OBJ);
$result->closeCursor();
return $data->compter;
}
public function executerRetourObjet($bdd, $requete){
$result = $bdd->prepare($requete);
$result->execute();
$data = $result->fetch(PDO::FETCH_OBJ);
$result->closeCursor();
return $data;
}
public function executerSansRetour($bdd, $requete){
$result = $bdd->prepare($requete);
$result->execute();
$result->closeCursor();
}
public function executerSansRetourex($bdd, $requete, $ex){
$result = $bdd->prepare($requete);
$result->execute($ex);
$result->closeCursor();
}
public function executerSansRetourtb($bdd, $requete, $tb){
$bdd->beginTransaction();
$result = $bdd->prepare($requete);
$result->execute($tb);
$bdd->commit();
$result->closeCursor();
}
public function extraireDroite($str,$nbr){
return substr($str,-$nbr);
}
public function extraireGauche($str,$nbr){
return substr($str,0,$nbr);
}
public function chargementPhoto($upfile, $upfile_size, $upfile_name, $rep_original, $rep_redimens, $rep_miniature, $nommage,$unique,$larg_maxi,$haut_maxi,$color1,$color2,$color3){
$confirm = "";
$maxsize=20000*1024; //Taille maximale des fichiers qui seront uploadés (en octet)
$ex1 = ".jpg"; $ex2 = ".jpeg"; $ex3 = ".gif"; $ex4 = ".png";
if (!empty($upfile)){
$extension = 0;
//vérifie que le fichier est non vide
if ($upfile_size > 0){
//vérifie si la taille du fichier ne dépasse pas la limite
if ($upfile_size > $maxsize){
//fichier trop grand
$extension = 1;
}
else{
//taille correcte, vérification du type de fichier
$type = strtolower($this->extraireDroite($upfile_name,4));
if ($type == $ex1 || $type == $ex2 || $type == $ex3 || $type == $ex4){
//sauvegarde du fichier uploadé
//$savefile = $unique.".".$type;
$savefile = $unique.$type;
$filename = $rep_original.$nommage.$savefile;
move_uploaded_file($upfile, $rep_original.$nommage.$savefile);
//----------CREATION IMAGE REDIMENSIONNEE------------------
$image_redimensionnee = creationImage($larg_maxi, $haut_maxi, $type, $savefile, 'redi', $nommage,$color1,$color2,$color3);
//----------CREATION IMAGE MINIATURE------------------
$image_miniature = creationImage(100, 100, $type, $savefile, 'mini', $nommage,$color1,$color2,$color3);
//ASSURER QUE CHAQUE VALEUR SOIT CORRECTE
if(is_numeric($savefile) || is_numeric($image_redimensionnee) || is_numeric($image_miniature)){
$extension = 2;
}
else{
$extension = $nommage.$savefile;
}
}
else{
$extension = 3;
}
}
}
else{
$extension = 4;
}
}
else{
$extension = 5;
}
return $extension;
}
public function initialiserTable($bdd, $table){
$result = $bdd->prepare("TRUNCATE TABLE `".$table."`");
$result->execute();
$result->closeCursor();
}
public function listingArticlesBlogAdmin($bdd, $premiere,$nombreDePages,$compl){
$th = ($_GET['cat']>0)?'<th>ORDRE</th>':''; $order = ($_GET['cat']>0)?'ordre':'id';
echo '<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th> ID </th>' ."\n".
'<th> STATUT </th>' ."\n";
echo ($_COOKIE['apseudo'] == "sadmin")?'<th>INFO</th>' ."\n":'';
echo '<th>TITRE</th>' ."\n".
'<th>CATEGORIE</th>' ."\n".
''.$th.'' ."\n";
echo ($_COOKIE['apseudo'] == "sadmin")?'<th>MTR</th>' ."\n":'';
echo '<th>ACTIONS</th>' ."\n".
'</tr>'."\n";
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_BLOG."` ".$compl." ORDER BY `".$order."` ASC LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute();
$bgn=2;
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$categorie = $this->getChamps($bdd,"page",TABLE_PAGES_WEB,"id",$sql->categorie);
$on = ($sql->enligne == 0)?'<a href="./pop.php?ad=mod_statut_online&mod=1&p=blog&id='.$sql->id.'"><img src="images/on.png"/></a>':'<a href="./pop.php?ad=mod_statut_online&mod=0&p=art&id='.$sql->id.'"><img src="images/off.png"/></a>';
if($bgn == 2) $bgn = 1; else $bgn =2;
?>
<tr class="<?php echo 'bgn-'.$bgn; ?>">
<td style="font-weight:bold;font-size:18px;"><?php echo $sql->id; ?></td>
<td><?php echo $on; ?></td>
<?php
if($_COOKIE['apseudo'] == "sadmin"){
?><td style="color:#A191C0;font-style:italic;">G<?php echo $sql->gabarit; ?> / C<?php echo $sql->modele; ?></td><?php
}
?>
<td style="width:550px;text-align:left;"><a href="pop.php?ad=voir_article&id=<?php echo $sql->id; ?>" target="_blank"><?php echo $sql->titre; ?></a></td>
<td><?php echo $categorie; ?></td>
<?php
if($_GET['cat']>0){
?>
<td style="width:100px;">
<input type="text" name="ordre<?php echo $sql->id; ?>" id="ordre<?php echo $sql->id; ?>" value="<?php echo $sql->ordre; ?>" size="2"/>
<input type="button" value=" GO " onclick="window.top.location.href='pop.php?ad=mod_ordre_blog&ordre='+document.getElementById('ordre<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'" />
</td>
<?php
}
?>
<?php
if($_COOKIE['apseudo'] == "sadmin"){
$img = ($sql->maitre == 0)?'<img src="images/off.png" style="opacity:0.5;"/>':'<img src="images/on.png"/>';
$change = ($sql->maitre == 0)?1:0;
echo '<td><a href="./actions.php?do=change_maitre&id='.$sql->id.'&etat='.$change.'&p=art">'.$img.'</a></td>';
$step = 3;
}
else{
$step = 2;
}
?>
<td style="width:80px;">
<a href="./gabarit.php?model_p=a&step=<?php echo $step; ?>&model=<?php echo $sql->modele;?>&gab=<?php echo $sql->gabarit;?>&iddiv=<?php echo $sql->id;?>"><img src="images/modifier.png" alt="" /></a>
<?php
if($sql->id == 1){
?><img src="images/supprimer.png" alt="" style="cursor:pointer;opacity:0.5;"/><?php
}
else{
?><img src="images/supprimer.png" alt="" onclick="confirmerAction('./gabarit.php?do=del_ads&model_p=a&iddiv=<?php echo $sql->id;?>');" style="cursor:pointer;"/><?php
}
?>
</td>
</tr>
<?php
}
$mysql->closeCursor();
echo '</table>';
}
public function menuCategorieBlog($bdd, $categorie_id){
$i = 1;
echo '<select name="cat">';
$mysql = $bdd->prepare("SELECT `id`,`page` FROM `".TABLE_PAGES_WEB."` ORDER BY `page`");
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
if($categorie_id == $sql->id){
echo '<option value="'.$sql->id.'" selected '.$style.'> '.$sql->page.' </option>';
}
else{
echo '<option value="'.$sql->id.'" '.$style.'> '.$sql->page.' </option>';
}
$i++;
}
$mysql->closeCursor();
echo '</select>';
}
public function menuCategoriesArticles($bdd, $categorie_id){
$i = 1;
echo '<select name="cat">';
$mysql = $bdd->prepare("SELECT `id`,`page` FROM `".TABLE_PAGES_WEB."` WHERE `categorie_blog`=1 ORDER BY `page`");
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
if($categorie_id == $sql->id){
echo '<option value="'.$sql->id.'" selected '.$style.'> '.$sql->page.' </option>';
}
else{
echo '<option value="'.$sql->id.'" '.$style.'> '.$sql->page.' </option>';
}
$i++;
}
$mysql->closeCursor();
echo '</select>';
}
public function menuDeroulantBlogAdmin($bdd, $categorie_id){
echo '<select name="f" style="width:200px">'."\n";
echo '<option value="0"> Toutes les catégories</option>'."\n";
$mysql = $bdd->prepare("SELECT `id`,`page` FROM `".TABLE_PAGES_WEB."` ORDER BY `page`");
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
if($categorie_id == $sql->id){
echo '<option value="'.$sql->id.'" selected> '.$sql->page.' </option>'."\n";
}
else{
echo '<option value="'.$sql->id.'"> '.$sql->page.' </option>'."\n";
}
}
$mysql->closeCursor();
echo '</select>'."\n";
}
public function majEmails($bdd){
$a_emails = array(); $mails = array(); $a_emails_confirmation = array();
$m = $bdd->prepare("SELECT `email` FROM `".TABLE_MAILINGLIST."` WHERE `confirmer`=1 GROUP BY `email` ORDER BY `id`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
array_push($a_emails,$s->email);
}
$m->closeCursor();
//**************** enlever les doublons *************************
$m_bis = $bdd->prepare("SELECT `email`,`confirmer` FROM `".TABLE_MAILINGLIST."` GROUP BY `email` ORDER BY `id`");
$m_bis->execute();
while($s_bis = $m_bis->fetch(PDO::FETCH_OBJ)){
array_push($mails,$s_bis->email);
array_push($a_emails_confirmation,$s_bis->confirmer);
}
$m_bis->closeCursor();
$this->initialiserTable($bdd,TABLE_MAILINGLIST);
for($i=0;$i<count($mails);$i++){
$deja = $this->compter($bdd,TABLE_MAILINGLIST,"email",$mails[$i],"");
if($deja == 0){
$this->executerSansRetourex($bdd,"INSERT INTO `".TABLE_MAILINGLIST."` (`email`, `envoi`, `confirmer`) VALUES (?, ?, ?)", array($mails[$i], $emails_envoi[$i], $a_emails_confirmation[$i]));
}
}
//****************************************************************
return array_unique($a_emails);
}
public function listingEmails($bdd, $premiere,$nombreDePages){
echo '<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th style="width:18px;"> </th>' ."\n".
'<th>EMAIL</th>' ."\n".
'<th style="width:70px;">ON/OFF</th>' ."\n".
'<th style="width:220px;">ACTIONS</th>' ."\n".
'</tr>'."\n";
if($_GET['f'] > 0 && $_GET['f'] != ""){
$filtre = ($_GET['f'] == 1)?" WHERE `confirmer`=0 ":" WHERE `confirmer`=1 ";
}
else{
$filtre = "";
}
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_MAILINGLIST."` ".$filtre." ORDER BY `email` LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
?>
<tr>
<td><?php echo $sql->id; ?></td>
<td><?php echo $sql->email; ?></td>
<td><?php echo ($sql->confirmer == 0)?'<a href="./newsletter.php?do=gestion&id='.$sql->id.'&page='.$_GET['page'].'&sc=email_statut&stat=1"><img src="images/off.png" alt="" /></a>':'<a href="./newsletter.php?do=gestion&id='.$sql->id.'&page='.$_GET['page'].'&sc=email_statut&stat=0"><img src="images/on.png" alt="" /></a>'; ?></td>
<td>
<a href="./newsletter.php?do=gestion&id=<?php echo $sql->id;?>&sc=mod&page=<?php echo minuscule($_GET['page']);?>&f=<?php echo minuscule($_GET['f']);?>"><img src="images/modifier.png" alt="" /></a>
<a href="./newsletter.php?do=gestion&id=<?php echo $sql->id;?>&sc=del&page=<?php echo minuscule($_GET['page']);?>&f=<?php echo minuscule($_GET['f']);?>"><img src="images/supprimer.png" alt="" /></a>
</td>
</tr>
<?php
}
$mysql->closeCursor();
echo '</table>';
}
public function listerComptesGestionDroitsAdmin($bdd, $premier,$limite){
$array = array();
$result = $bdd->prepare("SELECT * FROM `".TABLE_ADMINISTRATION."` LIMIT ".$premier.",".$limite);
$result->execute();
$bgn = 2;
while ($s = $result->fetch(PDO::FETCH_OBJ)){
if($bgn == 1) $bgn = 2; else $bgn = 1;
$acces = explode(":",$s->acces);
$a_module = array();
foreach($acces as $key){
array_push($a_module,utf8_decode($this->getChamps($bdd,"page",TABLE_MOD_GESTION_DROITS_ADMIN,"id",$key)));
}
if($s->id == 1){
$url1 = 'ajouter/modifier';
$url2 = 'supprimer';
}
else{
$url1 = fenetrePopUp('pop.php?ad=modif_droits&idu='.$s->id,450,400,'<u>ajouter/modifier</u>');
$url2 = fenetrePopUp('pop.php?ad=del_droits&idu='.$s->id,300,300,'<span style="color:red;text-decoration:underline;">supprimer</span>');
}
array_push($array,'<tr class="bgn-'.$bgn.'">' ."\n".
'<td>'.$s->id.'</td>' ."\n".
'<td>'.$s->pseudo.'</td>' ."\n".
'<td>'.date("d/m/y",$s->date_last_visite).'</td>' ."\n".
'<td>'.implode(" | ",$a_module).'</td>' ."\n".
'<td>' ."\n".
''.$url1.' | ' .
''.$url2.'' .
'</td>' ."\n".
'</tr>'."\n");
}
$result->closeCursor();
return implode("\n",$array);
}
public function getListeDroitsAdmin($bdd, $module){
$array = array(); $a_module = array(); $a_module = explode(":",$module);
if($module){
$result = $bdd->prepare("SELECT * FROM `".TABLE_MOD_GESTION_DROITS_ADMIN."`");
$result->execute();
while ($sql = $result->fetch(PDO::FETCH_OBJ)){
if(in_array($sql->id,$a_module)){
array_push($array,'<tr>' ."\n".
'<td><input type="checkbox" name="c_'.$sql->id.'" value="'.$sql->id.'" checked/></td>' ."\n".
'<td>'.utf8_decode($sql->page).'</td>' ."\n".
'</tr>'."\n");
}
else{
array_push($array,'<tr>' ."\n".
'<td><input type="checkbox" name="c_'.$sql->id.'" value="'.$sql->id.'"/></td>' ."\n".
'<td>'.utf8_decode($sql->page).'</td>' ."\n".
'</tr>'."\n");
}
}
$result->closeCursor();
}
else{
$result = $bdd->prepare("SELECT * FROM `".TABLE_MOD_GESTION_DROITS_ADMIN."`");
$result->execute();
while ($sql = $result->fetch(PDO::FETCH_OBJ)){
array_push($array,'<tr>' ."\n".
'<td><input type="checkbox" name="c_'.$sql->id.'" value="'.$sql->id.'"/></td>' ."\n".
'<td>'.utf8_decode($sql->page).'</td>' ."\n".
'</tr>'."\n");
}
$result->closeCursor();
}
return implode("\n",$array);
}
public function afficher_liste_page($parent, $niveau, $array, $trait, $bgnum) {
$html = "";
$niveau_precedent = 0;
if (!$niveau && !$niveau_precedent){
$html .= "";
}
foreach ($array as $noeud) {
if ($parent == $noeud['id_parent']) {
if ($niveau_precedent < $niveau){
$trait = '_'.$trait;
}
if($bgnum == 1){
$bgnum = 2;
}else{
$bgnum = 1;
}
$html .= '<tr class="bgn-'.$bgnum.'">'."\n"
.'<td style="font-weight:bold;font-size:18px;">'.$noeud['id'].'</td>'."\n"
.'<td>'.$noeud['on'].'</td>'."\n"
.'<td class="t-left t-list">'."\n"
.'<a href="pop.php?ad=voir_page&id='.$noeud['id'].'" target="_blank">'.$trait.$noeud['page'].'</a>'."\n"
.'</td>'."\n";
if($_COOKIE['apseudo'] == "sadmin"){
$html .= '<td style="color:#A191C0;font-style:italic;">G'.$noeud['gabarit'].' / C'.$noeud['modele'].'</td>'."\n";
}
$html .= '<td style="text-align:left;">'.$noeud['titre'].'</td>'."\n";
$html .= '<td style="width:90px;">'."\n";
$html .= '<input type="text" name="ordre'.$noeud['id'].'" id="ordre'.$noeud['id'].'" value="'.$noeud['ordre'].'" size="2"/>'."\n";
$html .= '<input type="button" value=" GO " onclick="window.top.location.href=\'pop.php?ad=mod_ordre_page&ordre=\'+document.getElementById(\'ordre'.$noeud['id'].'\').value+\'&id='.$noeud['id'].'\'" />'."\n";
$html .= '</td>'."\n";
$html .= '<td>'."\n";
if($noeud['id'] == 1 || $noeud['id'] == 6){
$html .= '<img src="images/on.png" style="opacity:0.5;"/>';
}
else{
if($noeud['menu'] == 0){
$onmn = 1;
$onim = '<img src="images/off.png"/>';
}else{
$onmn = 0;
$onim = '<img src="images/on.png"/>';
}
$html .= '<a href="./editermespages.php?do=menu&id='.$noeud['id'].'&on='.$onmn.'">'.$onim.'</a>';
}
$html .= '</td>'."\n";
$html .= '<td>'."\n";
if($noeud['id'] == 1 || $noeud['id'] == 6){
$html .= '<img src="images/on.png" style="opacity:0.5;"/>';
}
else{
if($noeud['footer'] == 0){
$onmn = 1;
$onim = '<img src="images/off.png"/>';
}else{
$onmn = 0;
$onim = '<img src="images/on.png"/>';
}
$html .= '<a href="./editermespages.php?do=footer&id='.$noeud['id'].'&on='.$onmn.'">'.$onim.'</a>';
}
$html .= '</td>'."\n";
$html .= '<td>'."\n";
if($noeud['id'] == 1 || $noeud['id'] == 6){
$html .= '<img src="images/on.png" style="opacity:0.5;"/>';
}
else{
if($noeud['editeur_off'] == 0){
$onmn = 1;
$onim = '<img src="images/on.png"/>';
}else{
$onmn = 0;
$onim = '<img src="images/off.png"/>';
}
$html .= '<a href="./editermespages.php?do=editeur&id='.$noeud['id'].'&on='.$onmn.'">'.$onim.'</a>';
}
$html .= '</td>'."\n";
$html .= '<td>'."\n";
if($noeud['id'] != 9){
$html .= '<img src="images/off.png" style="opacity:0.5;"/>';
}
else{
$html .= '<img src="images/on.png" style="opacity:0.5;"/>';
}
$html .= '</td>'."\n";
if($_COOKIE['apseudo'] == "sadmin"){
$img = ($noeud['maitre'] == 0)?'<img src="images/off.png" style="opacity:0.5;"/>':'<img src="images/on.png"/>';
$change = ($noeud['maitre'] == 0)?1:0;
$html .= '<td><a href="./actions.php?do=change_maitre&id='.$noeud['id'].'&etat='.$change.'&p=web">'.$img.'</a></td>';
$step = 3;
}
else{
$step = 2;
}
$html .= '<td>'."\n";
$html .= '<a href="./gabarit.php?model_p=p&step='.$step.'&model='.$noeud['modele'].'&gab='.$noeud['gabarit'].'&iddiv='.$noeud['id'].'&template='.$noeud['template'].'&parent='.$noeud['id_parent'].'"><img src="images/modifier.png" alt="" /></a>'."\n";
$refus = pagesWebProtegees();
if(in_array($noeud['id'],$refus)){
$html .= '
<img src="images/supprimer.png" alt="" style="opacity:0.4;"/>';
}
else{
$html .= '
<img src="images/supprimer.png" alt="" onclick="confirmerAction(\'./gabarit.php?do=del_ads&model_p=p&iddiv='.$noeud['id'].'\');" style="cursor:pointer;"/>';
}
$html .= '</td>'."\n";
$html .= '</tr>'."\n";
$niveau_precedent = $niveau;
$html .= $this->afficher_liste_page($noeud['id'], ($niveau + 1), $array, $trait, $bgnum);
}
}
if (($niveau_precedent == $niveau) && ($niveau_precedent != 0)) $html .= "";
else if ($niveau_precedent == $niveau) $html .= "";
else $html .= "";
return $html;
}
public function listingPagesWeb($bdd, $premiere,$nombreDePages){
echo '<p style="padding:5px;">LEGENDE : <span style="color:red;">(M)</span> : MENU / <span style="color:red;">(F)</span> : FOOTER / <span style="color:red;">(E)</span> : AVEC EDITEUR / <span style="color:red;">(O)</span> : ORDRE AFFICHAGE / <span style="color:red;">(ST)</span> : <span style="color:green;">ON</span> = ARTICLE EN LIGNE / <span style="color:red;">(R)</span> : RUBRIQUE</p>';
echo '<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th> ID </th>' ."\n".
'<th> ST </th>' ."\n".
'<th>PAGE</th>' ."\n";
echo ($_COOKIE['apseudo'] == "sadmin")?'<th>INFO</th>' ."\n":'';
echo '<th>TITRE</th>' ."\n".
'<th>O</th>' ."\n".
'<th>M</th>' ."\n".
'<th>F</th>' ."\n".
'<th>E</th>' ."\n".
'<th>R</th>' ."\n";
echo ($_COOKIE['apseudo'] == "sadmin")?'<th>MTR</th>' ."\n":'';
echo '<th style="width:80px;">ACTIONS</th>' ."\n".
'</tr>'."\n";
$exception = (STATUT_ACTUALITES == 1)?"":" WHERE `id`!=9 ";
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_PAGES_WEB."` ".$exception." ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
if($sql->id == 1 || $sql->id == 6 || ($sql->id == 9 && STATUT_ACTUALITES == 1)){
$on = ($sql->enligne == 0)?'<a href="./pop.php?ad=mod_statut_online&mod=1&p=web&id='.$sql->id.'"><img src="images/on.png"/></a>':'<a href="./pop.php?ad=mod_statut_online&mod=0&p=web&id='.$sql->id.'"><img src="images/off.png"/></a>';
}
else{
$on = ($sql->enligne == 0)?'<a href="./pop.php?ad=mod_statut_online&mod=1&p=web&id='.$sql->id.'"><img src="images/on.png"/></a>':'<a href="./pop.php?ad=mod_statut_online&mod=0&p=web&id='.$sql->id.'"><img src="images/off.png"/></a>';
}
/* RECUPERATION DONNEES*/
$niveaulistpage[] = array(
'id' => $sql->id,
'enligne' => $sql->enligne,
'page' => $sql->page,
'gabarit' => $sql->gabarit,
'modele' => $sql->modele,
'titre' => $sql->titre,
'ordre' => $sql->ordre,
'menu' => $sql->menu,
'footer' => $sql->footer,
'editeur_off' => $sql->editeur_off,
'maitre' => $sql->maitre,
'id_parent' => $sql->id_parent,
'template' => $sql->template,
'on' => $on,
);
}
$mysql->closeCursor();
echo $this->afficher_liste_page(0, 0, $niveaulistpage, "", 2);
echo '</table>';
}
public function afficher_menu($parent, $niveau, $array, $class) {
$html = "";
$niveau_precedent = 0;
$csstxt = $class;
$csscmp = 1;
if (!$niveau && !$niveau_precedent){
$html .= "\n<ul>\n";
}
foreach ($array as $noeud) {
if ($parent == $noeud['parent_id']) {
if ($niveau_precedent < $niveau){
$html .= "\n<ul>\n";
$csstxt = 's'.$csstxt;
}
$html .= '<li class="'.$csstxt.'-'.sprintf("%02d", $csscmp).'"><a href="'.$noeud['url'].'" title="'.$noeud['nom_categorie'].'"><span>' . $noeud['nom_categorie'].'</span></a>';
$csscmp++;
$niveau_precedent = $niveau;
$html .= $this->afficher_menu($noeud['page_id'], ($niveau + 1), $array, $csstxt);
}
}
if (($niveau_precedent == $niveau) && ($niveau_precedent != 0)) $html .= "</ul>\n</li>\n";
else if ($niveau_precedent == $niveau) $html .= "</ul>\n";
else $html .= "</li>\n";
return $html;
}
public function afficherMenuTop($bdd){
$rst = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_RUBRIQUES."` ORDER by `rub` LIMIT 1");
$rst->execute(array($c->id));
while ($r = $rst->fetch(PDO::FETCH_OBJ)){
$im = $this->executerRetourObjet($bdd,"SELECT `nom` FROM `".TABLE_DIAPO_IMGS."` WHERE `id_cat`=".$c->id." AND `id_rub`=".$r->id." ORDER by `ordre` LIMIT 0,1");
$lienPRE = '<a href="'.HTTP_SERVEUR.urlRewriting($r->rub).'-'.$r->id.'.html">';
$lienSUF = '</a>';
$urlREA = urlRewriting($r->rub).'-'.$r->id;
}
$rst->closeCursor();
define("__LIEN_PRE__", $lienPRE);
define("__LIEN_SUF__", $lienSUF);
define("__URL_REA__", $urlREA);
$exception = (STATUT_ACTUALITES == 1)?"":" AND `id`!=9 ";
$m = $bdd->prepare("SELECT `id`,`page`,`id_parent` FROM `".TABLE_PAGES_WEB."` WHERE `menu`=1 AND `enligne`=0 ".$exception." ORDER BY `ordre`");
$m->execute();
/*echo '<ul>';
$clmn = 1;*/
while($s = $m->fetch(PDO::FETCH_OBJ)){
if($s->id == 1){
$categories[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => HTTP_SERVEUR
);
}else{
if((STATUT_LISTE_REA == 0) and ($s->id == 2)){
$categories[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => HTTP_SERVEUR.$urlREA.'.html'
);
}else{
$categories[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => HTTP_SERVEUR.urlRewriting($s->page).'-'.$s->id.'.php'
);
}
}
}
$m->closeCursor();
echo $this->afficher_menu(0, 0, $categories, 'tnav');
}
public function planSite($bdd, $classmn){
//lister les rubriques associées
$rst = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_RUBRIQUES."` ORDER by `rub` LIMIT 1");
$rst->execute(array($c->id));
while ($r = $rst->fetch(PDO::FETCH_OBJ)){
$im = $this->executerRetourObjet($bdd,"SELECT `nom` FROM `".TABLE_DIAPO_IMGS."` WHERE `id_cat`=".$c->id." AND `id_rub`=".$r->id." ORDER by `ordre` LIMIT 0,1");
$urlREA = HTTP_SERVEUR.urlRewriting($r->rub).'-'.$r->id.'.html';
}
$rst->closeCursor();
define("__URL_REA__", $urlREA);
//les pages web
$exception = (STATUT_ACTUALITES == 1)?"":" AND `id`!=9 ";
$m = $bdd->prepare("SELECT `id`,`page`, `id_parent` FROM `".TABLE_PAGES_WEB."` WHERE `enligne`=0 AND `id`!=6 ".$exception." ORDER BY `ordre`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
if($s->id == 1){
$smartphonenav[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => HTTP_SERVEUR
);
}else{
if((STATUT_LISTE_REA == 0) and ($s->id == 2)){
$smartphonenav[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => __URL_REA__
);
}else{
$smartphonenav[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => HTTP_SERVEUR.urlRewriting($s->page).'-'.$s->id.'.php'
);
}
}
}
$m->closeCursor();
//les pages web >> articles
$m = $bdd->prepare("SELECT `id`,`titre` FROM `".TABLE_BLOG."` WHERE `enligne`=0 ORDER BY `ordre`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
$smartphonenav[] = array(
'parent_id' => $s->id_parent,
'page_id' => 'a'.$s->id,
'nom_categorie' => $s->titre,
'url' => HTTP_SERVEUR.'article-'.$s->id.'-'.urlRewriting($s->titre).'.php'
);
/*array_push($a_urls,HTTP_SERVEUR."t-a-".$s->id."-".urlRewriting($s->titre).".php");
array_push($a_option,ucfirst(getData($s->titre)));*/
}
$m->closeCursor();
return $this->afficher_menu(0, 0, $smartphonenav, $classmn);
}
public function afficherMenuColonne($bdd){
echo '<div id="menu">'."\n";
$m = $bdd->prepare("SELECT `id`,`page` FROM `".TABLE_PAGES_WEB."` WHERE `menu`=1 AND `enligne`=0 ORDER BY `ordre`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
//tester si articles présents
$compter = $this->compter($bdd,TABLE_BLOG,"categorie",$s->id,"");
if($compter > 0){
echo '<div class="menu" id="menu'.$s->id.'">' ."\n".
'<p><img src="'.HTTP_IMAGES.'puce2.gif" alt="'.ucfirst($s->page).'" style="position:relative;top:3px;"/><a href="'.HTTP_SERVEUR.'p-'.$s->id.'-'.urlRewriting($s->page).'.php" class="direct" style="font-size:16px;font-weight:bold;text-decoration:none;">'.ucfirst($s->page).'</a></p>' ."\n".
'<div class="sousmenu" id="sousmenu'.$s->id.'">'."\n";
//les articles de la catégorie
$c = $bdd->prepare("SELECT `id`,`titre` FROM `".TABLE_BLOG."` WHERE `categorie`=? AND `enligne`=0 ORDER BY `ordre`");
$c->execute(array($s->id));
while($sous = $c->fetch(PDO::FETCH_OBJ)){
echo '<div><img style="position:relative;top:2px;" alt="'.$sous->titre.'" src="'.HTTP_IMAGES.'puce.gif"> <a href="'.HTTP_SERVEUR.'a-'.$sous->id.'-'.urlRewriting($sous->titre).'.php">'.ucfirst($sous->titre).'</a></div>'."\n";
}
$c->closeCursor();
echo '</div>'."\n";
echo '</div>'."\n";
}
else{
echo '<div class="menu" id="menu'.$s->id.'">' ."\n".
'<p><img src="'.HTTP_IMAGES.'puce2.gif" alt="'.ucfirst($s->page).'" style="position:relative;top:3px;"/><a href="'.HTTP_SERVEUR.'p-'.$s->id.'-'.urlRewriting($s->page).'.php" class="direct" style="font-size:16px;font-weight:bold;text-decoration:none;">'.ucfirst($s->page).'</a></p>' ."\n".
'</div>'."\n";
}
}
$m->closeCursor();
echo '</div>'."\n";
}
public function footer($bdd){
$m = $bdd->prepare("SELECT `id`,`page` FROM `".TABLE_PAGES_WEB."` WHERE `menu`=1 AND `enligne`=0 ORDER BY `ordre`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
//tester si articles présents
$compter = $this->compter($bdd,TABLE_BLOG,"categorie",$s->id,"");
if($compter > 0){
echo '<div class="cat">' ."\n".
'<p><img src="'.HTTP_IMAGES.'puce2.png" alt="'.ucfirst($s->page).'" style="position:relative;top:3px;"/> <a href="'.HTTP_SERVEUR.'p-'.$s->id.'-'.urlRewriting($s->page).'.php" class="direct">'.ucfirst($s->page).'</a></p>'."\n";
//les articles de la catégorie
$c = $bdd->prepare("SELECT `id`,`titre` FROM `".TABLE_BLOG."` WHERE `categorie`=? AND `enligne`=0 ORDER BY `ordre`");
$c->execute(array($s->id));
while($sous = $c->fetch(PDO::FETCH_OBJ)){
echo '<p class="sousCat">- <a href="'.HTTP_SERVEUR.'a-'.$sous->id.'-'.urlRewriting($sous->titre).'.php">'.ucfirst($sous->titre).'</a></p>'."\n";
}
$c->closeCursor();
echo '</div>'."\n";
}
else{
echo '<div class="cat"><img src="'.HTTP_IMAGES.'puce2.png" alt="'.ucfirst($s->page).'" style="position:relative;top:3px;"/> <a href="'.HTTP_SERVEUR.'p-'.$s->id.'-'.urlRewriting($s->page).'.php" class="direct">'.ucfirst($s->page).'</a></div>'."\n";
}
}
$m->closeCursor();
}
public function bottomFooter($bdd){
$rst = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_RUBRIQUES."` ORDER by `rub` LIMIT 1");
$rst->execute(array($c->id));
while ($r = $rst->fetch(PDO::FETCH_OBJ)){
$im = $this->executerRetourObjet($bdd,"SELECT `nom` FROM `".TABLE_DIAPO_IMGS."` WHERE `id_cat`=".$c->id." AND `id_rub`=".$r->id." ORDER by `ordre` LIMIT 0,1");
$lienPRE = '<a href="'.HTTP_SERVEUR.urlRewriting($r->rub).'-'.$r->id.'.html">';
$lienSUF = '</a>';
$urlREA = urlRewriting($r->rub).'-'.$r->id;
}
$rst->closeCursor();
define("__LIEN_PRE__", $lienPRE);
define("__LIEN_SUF__", $lienSUF);
define("__URL_REA__", $urlREA);
$exception = (STATUT_ACTUALITES == 1)?"":" AND `id`!=9 ";
$m = $bdd->prepare("SELECT `id`,`page`,`id_parent` FROM `".TABLE_PAGES_WEB."` WHERE `footer`=1 AND `enligne`=0 ".$exception." ORDER BY `ordre`");
$m->execute();
/*echo '<ul>';
$clmn = 1;*/
while($s = $m->fetch(PDO::FETCH_OBJ)){
if($s->id == 1){
$categories[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => HTTP_SERVEUR
);
}else{
if((STATUT_LISTE_REA == 0) and ($s->id == 2)){
$categories[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => HTTP_SERVEUR.$urlREA.'.html'
);
}else{
$categories[] = array(
'parent_id' => $s->id_parent,
'page_id' => $s->id,
'nom_categorie' => $s->page,
'url' => HTTP_SERVEUR.urlRewriting($s->page).'-'.$s->id.'.php'
);
}
}
}
$m->closeCursor();
echo $this->afficher_menu(0, 0, $categories, 'bnav');
}
public function listLinktiny($bdd){
$m = $bdd->prepare("SELECT `id`,`page` FROM `".TABLE_PAGES_WEB."` WHERE `page`!=404 AND `enligne`=0 AND `id`!=1 ORDER BY `ordre`");
$m->execute();
echo 'link_list: [
{title: "Accueil", value: "'.HTTP_SERVEUR.'"},'."\n";
while($s = $m->fetch(PDO::FETCH_OBJ)){
echo '{title: "'.ucfirst(html_entity_decode(html_entity_decode($s->page, ENT_QUOTES | ENT_XML1, 'UTF-8'))).'", value: "'.HTTP_SERVEUR.urlRewriting($s->page).'-'.$s->id.'.php"},'."\n";
}
echo '],'."\n";
$m->closeCursor();
}
public function listerFluxXml($bdd){
$m = $bdd->prepare("SELECT `id`,`page`,`description` FROM `".TABLE_PAGES_WEB."` WHERE `id`!=6 AND `enligne`=0 ORDER BY `id`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
if($s->id == 1){
echo "<item>\n"
."<title>".FLUX_TITRE."</title>\n"
."<link>".HTTP_SERVEUR."</link>\n"
."<description>".extrait(FLUX_DESC,15)."</description>\n"
."</item>\n";
}
else{
echo "<item>\n"
."<title>".ucfirst(getData($s->page))."</title>\n"
."<link>".HTTP_SERVEUR.urlRewriting($s->page)."-".$s->id.".php</link>\n"
."<description>".extrait($s->description,15)."</description>\n"
."</item>\n";
}
}
$m->closeCursor();
}
public function getLiensXml($bdd){
//lister les pages
$m = $bdd->prepare("SELECT `id`,`page` FROM `".TABLE_PAGES_WEB."` WHERE `id`!=1 AND `id`!=6 AND `enligne`=0 ORDER BY `id`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
echo "<url>\n"
."<loc>".HTTP_SERVEUR.urlRewriting($s->page)."-".$s->id.".php</loc>\n"
."</url>\n";
}
$m->closeCursor();
//lister les articles
$m = $bdd->prepare("SELECT `id`,`titre` FROM `".TABLE_BLOG."` WHERE `enligne`=0 ORDER BY `id`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
echo "<url>\n"
."<loc>".HTTP_SERVEUR."article-".urlRewriting($s->titre)."-".$s->id.".php</loc>\n"
."</url>\n";
}
$m->closeCursor();
}
public function ulpoadAllFiles($upfile, $upfile_size, $upfile_name, $rep_original){
$confirm = "";
if (!empty($upfile)){
$extension = "";
//vérifie que le fichier est non vide
if ($upfile_size > 0){
//taille correcte, vérification du type de fichier
$type = strtolower($this->extraireDroite($upfile_name,4));
//sauvegarde du fichier uploadé
$savefile = time().".".$type;
/*$filename = $rep_original.$savefile;
if(file_exists($filename)){
unlink($rep_original.$savefile);
}*/
move_uploaded_file($upfile, $rep_original.$savefile);
//ASSURER QUE CHAQUE VALEUR SOIT CORRECTE
if(is_numeric($savefile)){
$extension = 0;
}
else{
$extension = $savefile;
}
}
else{
$extension = 0;
}
}
else{
$extension = 0;
}
return $extension;
}
public function chargerMenuSmartphone($bdd){
echo '<div id="smartnav">'.$this->planSite($bdd, 'rnav').'</div>';
}
function afficherMenuBlog($bdd){
echo '<div id="menuBLOG">'."\n";
$m = $bdd->prepare("SELECT `id`,`page` FROM `".TABLE_PAGES_WEB."` WHERE `categorie_blog`=1 AND `enligne`=0 ORDER BY `ordre`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
echo '<div class="menu">' ."\n".
'<p><img src="'.HTTP_IMAGES.'puce2.gif" alt="'.ucfirst($s->page).'" style="position:relative;top:3px;"/><a href="'.HTTP_SERVEUR.'p-'.$s->id.'-'.urlRewriting($s->page).'.php" class="direct">'.ucfirst($s->page).'</a></p>' ."\n".
'</div>'."\n";
}
$m->closeCursor();
echo '</div>'."\n";
}
public function listingBlogParCategorie($bdd,$premiere,$nombreDePages,$categorie_id){
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_BLOG."` WHERE `categorie`=? AND `enligne`=0 ORDER BY `heure` DESC LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute(array($categorie_id));
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
?>
<div class="listBlog encadre">
<p class="title"><a href="./a-<?php echo $sql->id;?>-<?php echo urlRewriting($sql->titre);?>.php"><?php echo ucfirst($sql->titre);?></a></p>
<p class="desc"><?php echo $sql->description;?></p>
<p class="date">posté le, <?php echo date("d/m/y",$sql->heure);?></p>
</div>
<?php
}
$mysql->closeCursor();
echo '<p style="clear:both;"></p>';
}
public function totalAujourdhui($bdd){
$debut = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $fin = mktime(24, 0, 0, date("m"), date("d"), date("Y"));
$array = array(); $array_heure = array(); $array_fusion = array(); $array_value = array();
//******** PAGES WEB *************
$e = $bdd->prepare("SELECT * FROM `".TABLE_PAGES_WEB."` WHERE `id`!=1 AND `id`!=6 AND `enligne`=0 AND `heure` BETWEEN ".$debut." AND ".$fin." ORDER BY `id`");
$e->execute();
while($f = $e->fetch(PDO::FETCH_OBJ)){
array_push($array,"1:".$f->id);
array_push($array_heure,$f->heure);
}
$e->closeCursor();
//******** BLOG *************
$c = $bdd->prepare("SELECT * FROM `".TABLE_BLOG."` WHERE `enligne`=0 AND `heure` BETWEEN ".$debut." AND ".$fin." ORDER BY `id`");
$c->execute();
while($d = $c->fetch(PDO::FETCH_OBJ)){
array_push($array,"2:".$d->id);
array_push($array_heure,$d->heure);
}
$c->closeCursor();
//fusionner les clés et valeurs
$array_fusion = array_combine($array_heure, $array);
//du plus grand au plus petit
krsort($array_fusion);
//injecter les valeurs
foreach($array_fusion as $value){
array_push($array_value,$value);
}
return $array_value;
}
public function listerAtomPagesWebXml($bdd){
$aujourdhui = $this->totalAujourdhui($bdd);
foreach($aujourdhui as $ky){
$tp = explode(":",$ky);
$genre = $tp[0];
$id = $tp[1];
if($genre == 1){
//******** PAGES WEB *************
$pgw = $this->getTable($bdd,TABLE_PAGES_WEB,"id",$id);
?>
<entry>
<title><?php echo ucfirst(getData($pgw->titre)); ?></title>
<updated><?php echo date(DATE_ATOM,$pgw->heure); ?></updated>
<author>
<name><?php echo NOM_SITEWEB; ?></name>
</author>
<id><?php echo HTTP_SERVEUR.urlRewriting($pgw->page)."-".$pgw->id.".php"; ?></id>
<link type="text/html" href="<?php echo HTTP_SERVEUR.urlRewriting($pgw->page)."-".$pgw->id.".php"; ?>" />
<summary><?php echo extrait($pgw->description,15); ?></summary>
</entry>
<?php
}
else{
//******** ARTICLE *************
$blog = $this->getTable($bdd,TABLE_BLOG,"id",$id);
?>
<entry>
<title><?php echo ucfirst(getData($blog->titre)); ?></title>
<updated><?php echo date(DATE_ATOM,$blog->heure); ?></updated>
<author>
<name><?php echo NOM_SITEWEB; ?></name>
</author>
<id><?php echo HTTP_SERVEUR."article-".urlRewriting($blog->titre)."-".$blog->id.".php"; ?></id>
<link type="text/html" href="<?php echo HTTP_SERVEUR."article-".urlRewriting($blog->titre)."-".$blog->id.".php"; ?>" />
<summary><?php echo extrait($blog->description,15); ?></summary>
</entry>
<?php
}
}
}
function listingDiapoPhotosAccueil($bdd,$premiere,$nombreDePages){
echo '<form action="diapo.php" method="get">' ."\n".
'<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th><input type="checkbox" onclick="CocheTout(this, \'ids[]\');"></th>' ."\n".
'<th style="width:100px;"> </th>' ."\n".
'<th>DIM.</th>' ."\n".
'<th>AFFICHAGE EXCLUSIF SUR PAGES/ARTICLES</th>' ."\n".
'<th>ORDRE</th>' ."\n".
'<th style="width:180px;">ACTIONS</th>' ."\n".
'</tr>'."\n";
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_ACCUEIL."` ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute();
$bgn = 2;
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
if($bgn == 1){
$bgn = 2;
}else{
$bgn = 1;
}
?>
<tr class="<?php echo 'bgn-'.$bgn; ?>">
<td>
<input type="checkbox" name="ids[]" value="<?php echo $sql->id; ?>">
</td>
<td><?php echo '<img src="'.HTTP_MINIATURE.$sql->nom.'"/>'; ?></td>
<td style="text-align:center;"><?php echo $sql->larg." X ".$sql->haut; ?></td>
<td style="text-align:justify;font-style: italic;font-weight: bold;">
<?php
$array1 = explode("|",$sql->affichage_pw);
$array2 = explode("|",$sql->affichage_art);
//lister les pages
echo '<p><u>PAGES WEB</u> ';
foreach($array1 as $a){
$p = str_replace("p", "", $a);
$pw = $this->getTable($bdd,TABLE_PAGES_WEB, "id", $p);
echo " : ".$pw->page." : ";
}
echo '</p>';
echo '<p><u>ARTICLES</u> ';
//lister les articles
foreach($array2 as $a){
$p = str_replace("a", "", $a);
$pw = $this->getTable($bdd,TABLE_BLOG, "id", $p);
echo " : ".$pw->titre." : ";
}
echo '</p>';
?>
</td>
<td style="width:90px;">
<input type="text" name="ordre<?php echo $sql->id; ?>" id="ordre<?php echo $sql->id; ?>" value="<?php echo $sql->ordre; ?>" size="2"/>
<input type="button" value=" GO " onclick="window.top.location.href='pop.php?ad=mod_ordre_phome&ordre='+document.getElementById('ordre<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'" />
</td>
<td>
<a href="./diapo.php?do=mod&id=<?php echo $sql->id;?>"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('diapo.php?do=del&id=<?php echo $sql->id;?>');" style="cursor:pointer;"/>
</td>
</tr>
<?php
}
$mysql->closeCursor();
echo '</table>'."\n"
.'<p>'."\n"
.'<input type="hidden" name="do" value="delmedias">'."\n"
.'<input type="submit" value=" Supprimer " style="cursor:pointer;"></p>'."\n"
.'</form>';
}
public function arborescenceDiaporama($bdd){
$result = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_CATEGORIES."` ORDER by `cat`");
$result->execute();
while ($mysql = $result->fetch(PDO::FETCH_OBJ)){
?>
<p style="font-size:20px;color: #F18C00;font-weight:bold;">
<a href="diapo1.php?do=r&ctg=<?php echo $mysql->id; ?>&sc=aj" title="Ajouter une rubrique"><img src="images/ajout.png" alt="" /></a>
<a href="diapo1.php?ctg=<?php echo $mysql->id; ?>&sc=md" style="margin:0px 7px;" title="Modifier une catégorie"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('diapo1.php?ctg=<?php echo $mysql->id; ?>&sc=del');" style="cursor:pointer;" title="Supprimer une catégorie"/> : <?php echo $mysql->cat; ?>
</p>
<?php
$rst = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_RUBRIQUES."` WHERE `cat`=? ORDER by `rub`");
$rst->execute(array($mysql->id));
while ($s = $rst->fetch(PDO::FETCH_OBJ)){
$t = $this->executerRetourObjet($bdd,"SELECT COUNT(*) AS tt FROM `".TABLE_DIAPO_IMGS."` WHERE `id_cat`=".$mysql->id." AND `id_rub`=".$s->id);
?>
<p style="font-size:13px;font-weight:bold;padding-left:120px;margin-top:10px;">
<img src="images/niveau.png" alt="" />
<a href="diapo1.php?do=r&rbe=<?php echo $s->id; ?>&sc=md&ctg=<?php echo $mysql->id; ?>" title="Modifier une rubrique"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('diapo1.php?do=r&rbe=<?php echo $s->id; ?>&sc=del&ctg=<?php echo $mysql->id; ?>');" style="cursor:pointer;margin-left:10px;" title="Supprimer une rubrique"/> : <?php echo $s->rub; ?>
</p>
<p style="margin-left:120px;background-color: #DADADA;padding:3px;">
<i>Mes photos (<?php echo $t->tt; ?>)</i>:
<a href="diapo1.php?do=add_p&idr=<?php echo $s->id; ?>&idc=<?php echo $mysql->id; ?>" style="margin-left:7px;color: red;text-decoration: underline;">+ Ajouter</a>
<a href="diapo1.php?do=s&idr=<?php echo $s->id; ?>&idc=<?php echo $mysql->id; ?>" style="margin-left:7px;color: red;text-decoration: underline;">Consulter</a>
<?php
if(TYPE_DIAPORAMA == 2){
$etat = ($s->description)?1:0;
?>
<a name="" style="margin-left:7px;color: red;text-decoration: underline;cursor:pointer;" onclick="bascule('div<?php echo $s->id; ?>');">Fiche descriptive (<?php echo $etat; ?>)</a>
<?php
}
?>
</p>
<?php
if(TYPE_DIAPORAMA == 2){
?>
<div id="div<?php echo $s->id; ?>" style="display:none;">
<p style="font-weight:bold;padding-left:120px;">Fiche descriptive de l'activité</p>
<form action="diapo1.php?do=add_desc&idr=<?php echo $s->id; ?>" method="post">
<p style="margin-left:120px;"><textarea name="desc" rows="5" style="width:100%;"><?php echo str_replace("<br />", "", $s->description); ?></textarea></p>
<p style="text-align: right;margin-top: 5px;"><?php echo bouton("bt".$s->id, "bt1".$s->id, "envoyer", 0, "right"); ?></p>
</form>
</div>
<?php
}
}
$rst->closeCursor();
}
$result->closeCursor();
}
public function getSelect($bdd,$table, $name, $selected,$var1,$var2,$where){
$array = array();$i = 1;
array_push($array, '<select name="'.$name.'">' .
'<option value="0"> Sélectionner</option>');
$result = $bdd->prepare("SELECT `".$var1."`, `".$var2."` FROM `".$table."` ".$where." ORDER by `".$var2."`");
$result->execute();
while ($mysql = $result->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
if($selected == $mysql->$var1){
//UNE VALEUR A DEJA ETE SAISIE
array_push($array, '<option value="'.$mysql->$var1.'" selected '.$style.'> '.ucfirst($mysql->$var2).'</option>');
}
else{
array_push($array, '<option value="'.$mysql->$var1.'" '.$style.'> '.ucfirst($mysql->$var2).'</option>');
}
$i++;
}
$result->closeCursor();
array_push($array, '</select>');
return implode("\n",$array);
}
public function getSelecttemp($bdd,$table, $name, $selected, $var1, $var2, $var3, $where){
$array = array();$i = 1;
array_push($array, '<select name="'.$name.'">' .
'<option value="0"> Par défaut</option>');
$result = $bdd->prepare("SELECT `".$var1."`, `".$var2."`, `".$var3."` FROM `".$table."` ".$where." ORDER by `".$var2."`");
$result->execute();
while ($mysql = $result->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
if($selected == $mysql->$var1){
//UNE VALEUR A DEJA ETE SAISIE
array_push($array, '<option value="'.$mysql->$var1.'" selected '.$style.'> '.ucfirst($mysql->$var2).'</option>');
}
else{
array_push($array, '<option value="'.$mysql->$var1.'" '.$style.'> '.ucfirst($mysql->$var2).' ('.$mysql->$var3.' champs)</option>');
}
$i++;
}
$result->closeCursor();
array_push($array, '</select>');
return implode("\n",$array);
}
public function listingDiapoPhotosParRubrique($bdd,$premiere,$nombreDePages,$id_cat,$id_rub){
echo '<form action="diapo1.php" method="get">' ."\n".
'<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th><input type="checkbox" onclick="CocheTout(this, \'ids[]\');"></th>' ."\n".
'<th style="width:100px;"> </th>' ."\n".
'<th colspan="2">INFOS</th>' ."\n".
'<th>ORDRE</th>' ."\n".
'<th style="width:180px;">ACTIONS</th>' ."\n".
'</tr>'."\n";
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_IMGS."` WHERE `id_cat`=? AND `id_rub`=? ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute(array($id_cat,$id_rub));
$bgn = 2;
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
if($bgn == 1) $bgn = 2; else $bgn = 1;
?>
<tr class="<?php echo 'bgn-'.$bgn; ?>">
<td>
<input type="checkbox" name="ids[]" value="<?php echo $sql->id; ?>">
</td>
<td><?php echo '<img src="'.HTTP_MINIATURE.$sql->nom.'"/>'; ?></td>
<td style="text-align:center;">
<p style="padding-bottom:1px;font-weight: bold;font-size: 18px">
<textarea style="overflow:hidden; border:none; background:none;" readonly ondblclick="this.readOnly='';" cols="40" rows="3" style="border:none;" id="titreinp<?php echo $sql->id; ?>" name="titre" class="input-infosph" onChange="window.top.location.href='pop.php?modinfo=mod_titre&titre='+document.getElementById('titreinp<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'"><?php echo $sql->titre; ?></textarea>
</p>
</td>
<td>
<p style="padding:1px;text-align: right;color: grey;"><i><?php echo $sql->nom; ?></i></p>
</td>
<td style="width:90px;">
<input type="text" name="ordre<?php echo $sql->id; ?>" id="ordre<?php echo $sql->id; ?>" value="<?php echo $sql->ordre; ?>" size="2"/>
<input type="button" value=" GO " onclick="window.top.location.href='pop.php?ad=mod_ordre_diapo&ordre='+document.getElementById('ordre<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'" />
</td>
<td>
<a href="./diapo1.php?do=mod&id=<?php echo $sql->id;?>&idc=<?php echo $id_cat; ?>&idr=<?php echo $id_rub; ?>"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('diapo1.php?do=del&id=<?php echo $sql->id;?>&idc=<?php echo $id_cat; ?>&idr=<?php echo $id_rub; ?>');" style="cursor:pointer;"/>
</td>
</tr>
<?php
}
$mysql->closeCursor();
echo '</table>'."\n"
.'<p>'."\n"
.'<input type="hidden" name="do" value="delmedias">'."\n"
.'<input type="submit" value=" Supprimer " style="cursor:pointer;"></p>'."\n"
.'</form>';
}
public function listingMediaPhotos($bdd,$premiere,$nombreDePages,$id_page){
echo '<form action="media.php" method="get">' ."\n".
'<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th><input type="checkbox" onclick="CocheTout(this, \'ids[]\');"></th>' ."\n".
'<th style="width:100px;"> </th>' ."\n".
'<th>INFOS</th>' ."\n".
'<th>ORDRE</th>' ."\n".
'<th style="width:180px;">ACTIONS</th>' ."\n".
'</tr>'."\n";
if($id_page!=0){
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_IMGS."` WHERE `id_page`=".$id_page." ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
}else{
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_IMGS."` WHERE `id_page`>0 ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
}
$mysql->execute(array($id_cat,$id_rub,$id_page));
$bgn = 2;
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
if($bgn == 1) $bgn = 2; else $bgn = 1;
$pag = $this->executerRetourObjet($bdd, "SELECT * FROM `".TABLE_PAGES_WEB."` WHERE `id` = ".$sql->id_page);
?>
<tr class="<?php echo 'bgn-'.$bgn; ?>">
<td>
<input type="checkbox" name="ids[]" value="<?php echo $sql->id; ?>">
</td>
<td><?php echo '<img src="'.HTTP_MINIATURE.$sql->nom.'"/>'; ?></td>
<td style="text-align:center;">
<p style="padding-bottom:1px;font-weight: bold;font-size: 18px">
<textarea style="overflow:hidden; border:none; background:none;" readonly ondblclick="this.readOnly='';" cols="40" rows="3" style="border:none;" id="titreinp<?php echo $sql->id; ?>" name="titre" class="input-infosph" onChange="window.top.location.href='pop.php?modinfo=mod_titre&titre='+document.getElementById('titreinp<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'"><?php echo $sql->titre; ?></textarea>
</p>
</td>
<?php /* <td>
<p style="padding:1px;text-align: center;color: grey;"><i><?php echo $pag->page; ?></i></p>
</td>
<td>
<p style="padding:1px;text-align: right;color: grey;"><i><?php echo $sql->nom; ?></i></p>
</td>
*/ ?>
<td style="width:90px;">
<input type="text" name="ordre<?php echo $sql->id; ?>" id="ordre<?php echo $sql->id; ?>" value="<?php echo $sql->ordre; ?>" size="2"/>
<input type="button" value=" GO " onclick="window.top.location.href='pop.php?ad=mod_ordre_diapo&ordre='+document.getElementById('ordre<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'" />
</td>
<td>
<a href="./media.php?do=modmedia&id=<?php echo $sql->id;?>&idp=<?php echo $sql->id_page; ?>&idr=<?php echo $sql->id_rub; ?>"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('media.php?do=delmedia&id=<?php echo $sql->id;?>&idp=<?php echo $id_page; ?>');" style="cursor:pointer;"/>
</td>
</tr>
<?php
}
$mysql->closeCursor();
echo '</table>'."\n"
.'<p>'."\n"
.'<input type="hidden" name="do" value="delmedias">'."\n"
.'<input type="submit" value=" Supprimer " style="cursor:pointer;"></p>'."\n"
.'</form>';
}
public function listingMediaPhotosParPages($bdd,$premiere,$nombreDePages,$id_page,$id_rub){
echo '<form action="media.php" method="get">' ."\n".
'<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th><input type="checkbox" onclick="CocheTout(this, \'ids[]\');"></th>' ."\n".
'<th style="width:100px;"> </th>' ."\n".
'<th>INFOS</th>' ."\n".
'<th>ORDRE</th>' ."\n".
'<th style="width:180px;">ACTIONS</th>' ."\n".
'</tr>'."\n";
if($id_page!=0){
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_IMGS."` WHERE `id_page`=".$id_page." AND `id_rub`=".$id_rub." ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
}else{
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_IMGS."` WHERE `id_page`>0 AND `id_rub`=".$id_rub." ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
}
$mysql->execute(array($id_cat,$id_rub,$id_page));
$bgn = 2;
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
if($bgn == 1) $bgn = 2; else $bgn = 1;
//$pag = $this->executerRetourObjet($bdd, "SELECT * FROM `".TABLE_PAGES_WEB."` WHERE `id` = ".$sql->id_page);
?>
<tr class="<?php echo 'bgn-'.$bgn; ?>">
<td>
<input type="checkbox" name="ids[]" value="<?php echo $sql->id; ?>">
</td>
<td><?php echo '<img src="'.HTTP_MINIATURE.$sql->nom.'"/>'; ?></td>
<td style="text-align:center;">
<p style="padding-bottom:1px;font-weight: bold;font-size: 18px">
<textarea style="overflow:hidden; border:none; background:none;" readonly ondblclick="this.readOnly='';" cols="40" rows="3" style="border:none;" id="titreinp<?php echo $sql->id; ?>" name="titre" class="input-infosph" onChange="window.top.location.href='pop.php?modinfo=mod_titre&titre='+document.getElementById('titreinp<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'"><?php echo $sql->titre; ?></textarea>
</p>
</td>
<?php /*
<td>
<p style="padding:1px;text-align: center;color: grey;"><i><?php echo $pag->page; ?></i></p>
</td>
<td>
<p style="padding:1px;text-align: right;color: grey;"><i><?php echo $sql->nom; ?></i></p>
</td>
*/ ?>
<td style="width:90px;">
<input type="text" name="ordre<?php echo $sql->id; ?>" id="ordre<?php echo $sql->id; ?>" value="<?php echo $sql->ordre; ?>" size="2"/>
<input type="button" value=" GO " onclick="window.top.location.href='pop.php?ad=mod_ordre_diapo&ordre='+document.getElementById('ordre<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'" />
</td>
<td>
<a href="./media.php?do=modmedia&id=<?php echo $sql->id;?>&idp=<?php echo $sql->id_page; ?>&idr=<?php echo $sql->id_rub; ?>"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('media.php?do=delmedia&id=<?php echo $sql->id;?>&idp=<?php echo $id_page; ?>');" style="cursor:pointer;"/>
</td>
</tr>
<?php
}
$mysql->closeCursor();
echo '</table>'."\n"
.'<p>'."\n"
.'<input type="hidden" name="do" value="delmedias">'."\n"
.'<input type="submit" value=" Supprimer " style="cursor:pointer;"></p>'."\n"
.'</form>';
}
public function delImgs($bdd,$id,$nature){
$r1 = REPERTOIRE_IMAGE_ORIGINAL;$r2 = REPERTOIRE_IMAGE_REDIMENSIONNEE;$r3 = REPERTOIRE_IMAGE_MINIATURE;
$champ = ($nature == "cat")?'id_cat':'id_rub';
$result = $bdd->prepare("SELECT `nom`,`id` FROM `".TABLE_DIAPO_IMGS."` WHERE `".$champ."`=?");
$result->execute(array($id));
while ($mysql = $result->fetch(PDO::FETCH_OBJ)){
effacerPhoto($r1, $r2, $r3, $mysql->nom);
$this->deleteUnElement($bdd,TABLE_DIAPO_IMGS,"id",$mysql->id);
}
$result->closeCursor();
}
public function listingBlocs($bdd,$premiere,$nombreDePages){
echo '<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th>ID</th>' ."\n".
'<th>TITRE</th>' ."\n".
'<th>ACTIONS</th>' ."\n".
'</tr>'."\n";
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_BLOC."` ORDER BY `id` ASC LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
if($bgn == 1) $bgn = 2; else $bgn = 1;
?>
<tr class="<?php echo 'bgn-'.$bgn; ?>">
<td style="font-size:18px;width:50px;text-align: center;"><?php echo normaliserDIV("", "", $sql->id); ?></td>
<td style="font-size:18px;"><?php echo $sql->titre; ?></td>
<td style="width:170px;">
<a href="./bloc.php?do=mod&id=<?php echo $sql->id;?>"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('bloc.php?do=del&id=<?php echo $sql->id;?>');" style="cursor:pointer;"/>
</td>
</tr>
<?php
}
$mysql->closeCursor();
echo '</table>';
}
private function scanDiaporama($bdd,$contenu,$web,$model_p){
if(substr(strip_tags($contenu), 0,2) == "||"){
$contenu = str_replace("||", "", strip_tags($contenu));
return $this->diaporamaAccueil($bdd,$contenu,$web,$model_p);
}
else{
return $contenu;
}
}
public function listingBlocsCorpsDePage($bdd,$web,$nature,$sql,$type,$genre){
$id = ($sql->id > 0)?$sql->id:0;$avant = array();$apres = array();$model_p = ($_GET['model_p'] != "")?minuscule($_GET['model_p']):"p";
$rst = $bdd->prepare("SELECT * FROM `".TABLE_ASSOCIER_BLOC."` WHERE `page_id`=? AND `model_p`=? AND `nature`=? AND `contenu_id`=? ORDER BY `id`");
$rst->execute(array($web->id,$model_p,$nature,$id));
while ($my = $rst->fetch(PDO::FETCH_OBJ)){
$bloc = $this->getTable($bdd,TABLE_BLOC,"id",$my->bloc_id);
//***** AFFICHAGE DU BLOC AVANT BLOC CORPS DE PAGE ******
if($my->avant_apres == 1){
if($genre == 1){
$contenu = $this->scanDiaporama($bdd,getData($bloc->description),$web,$model_p);
array_push($avant, '<div class="'.normaliserDIV("","",$bloc->id).'">'.$contenu.'</div>');
}
else{
array_push($avant, '<tr><td colspan="6" style="text-align:center;background-color: red;color: white;font-weight: bold;">'.normaliserDIV("","",$bloc->id).' : '.$bloc->titre.'</td></tr>');
}
}
//***** AFFICHAGE DU BLOC APRES BLOC CORPS DE PAGE ******
if($my->avant_apres == 2){
if($genre == 1){
$contenu = $this->scanDiaporama($bdd,getData($bloc->description),$web,$model_p);
array_push($apres, '<div class="'.normaliserDIV("","",$bloc->id).'">'.$contenu.'</div>');
}
else{
array_push($apres, '<tr><td colspan="6" style="text-align:center;background-color: red;color: white;font-weight: bold;">'.normaliserDIV("","",$bloc->id).' : '.$bloc->titre.'</td></tr>');
}
}
}
$rst->closeCursor();
return ($type == 1)?implode("\n", $avant):implode("\n", $apres);
}
private function listingBlocsColonnes($bdd,$web,$nature,$sql,$type,$genre){
$id = ($sql->id > 0)?$sql->id:0;$avant = array();$apres = array();$model_p = ($_GET['model_p'] != "")?minuscule($_GET['model_p']):"p";
$rst = $bdd->prepare("SELECT * FROM `".TABLE_ASSOCIER_BLOC."` WHERE `page_id`=? AND `model_p`=? AND `nature`=? AND `contenu_id`=? ORDER BY `id`");
$rst->execute(array($web->id,$model_p,$nature,$id));
while ($my = $rst->fetch(PDO::FETCH_OBJ)){
$bloc = $this->getTable($bdd,TABLE_BLOC,"id",$my->bloc_id);
//***** AFFICHAGE DU BLOC AVANT BLOC CORPS DE PAGE ******
if($my->avant_apres == 1){
if($genre == 1){
array_push($avant, '<div class="'.normaliserDIV("","",$bloc->id).'">'.getData($bloc->description).'</div>');
}
else{
array_push($avant, '<tr><td colspan="6" style="text-align:center;background-color: red;color: white;font-weight: bold;">'.normaliserDIV("","",$bloc->id).' : '.$bloc->titre.'</td></tr>');
}
}
//***** AFFICHAGE DU BLOC APRES BLOC CORPS DE PAGE ******
if($my->avant_apres == 2){
if($genre == 1){
array_push($apres, '<div class="'.normaliserDIV("","",$bloc->id).'">'.getData($bloc->description).'</div>');
}
else{
array_push($apres, '<tr><td colspan="6" style="text-align:center;background-color: red;color: white;font-weight: bold;">'.normaliserDIV("","",$bloc->id).' : '.$bloc->titre.'</td></tr>');
}
}
}
$rst->closeCursor();
return ($type == 1)?implode("\n", $avant):implode("\n", $apres);
}
public function listingContenusSupplementaires($bdd,$premiere,$nombreDePages, $web, $nature){
if($nature == 1 || $nature == 3){
//colonnes
$avant = array();$apres = array();
echo '<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th>ID</th>' ."\n".
'<th>ORDRE</th>' ."\n".
'<th style="width:70px;"> </th>' ."\n".
'</tr>'."\n";
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_CONTENUS_SUPPL."` WHERE `page_id`=? AND `model_p`=? AND `nature`=? ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute(array($web->id,minuscule($_GET['model_p']),$nature));
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$div = normaliserDIV($web->div,$nature,$sql->id);
//lister les blocs
echo $this->listingBlocsColonnes($bdd,$web,$nature,$sql,1,0);
?>
<tr>
<td style="font-weight:bold;text-align:left;"><?php echo $div; ?></td>
<td style="width:90px;">
<input type="text" name="ordre<?php echo $sql->id; ?>" id="ordre<?php echo $sql->id; ?>" value="<?php echo $sql->ordre; ?>" size="2"/>
<input type="button" value=" GO " onclick="window.top.location.href='pop.php?ad=mod_ordre_contenu_supp&ordre='+document.getElementById('ordre<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'" />
</td>
<td style="text-align:left;">
<a href="./gabarit.php?do=mod_contenu_suppl&nature=<?php echo $nature; ?>&page=<?php echo minuscule($_GET['page']); ?>&model_p=<?php echo minuscule($_GET['model_p']); ?>&step=3&model=<?php echo minuscule($_GET['model']); ?>&gab=<?php echo minuscule($_GET['gab']); ?>&iddiv=<?php echo minuscule($_GET['iddiv']); ?>&template=<?php echo minuscule($_GET['template']); ?>&parent=<?php echo minuscule($_GET['parent']); ?>&idcs=<?php echo $sql->id; ?>"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('gabarit.php?do=del_contenu_suppl&idcs=<?php echo $sql->id;?>&step=3');" style="cursor:pointer;"/>
</td>
</tr>
<?php
echo $this->listingBlocsColonnes($bdd,$web,$nature,$sql,2,0);
}
$mysql->closeCursor();
echo '</table>';
}
else{
$nb = ($nature == 3)?20:25;
echo '<form action="actions.php?do=mod_class" method="post">'
. '<table class="tableau">' ."\n".
'<tr>' ."\n".
'<th> </th>' ."\n".
'<th style="width:100px;">ID</th>' ."\n".
'<th>EXTRAIT</th>' ."\n".
'<th>ORDRE</th>' ."\n".
'<th style="width:70px;"> </th>' ."\n".
'</tr>'."\n";
//lister les blocs avant le bloc par défaut
echo $this->listingBlocsCorpsDePage($bdd,$web,$nature,0,1,0);
?>
<tr>
<td style="width:12px;text-align:center;"><input type="checkbox" name="nclass[]" value="x<?php echo minuscule($_GET['model_p']).":".$web->id; ?>"/></td>
<td style="font-weight:bold;text-align:left;">
<p><?php echo $web->div; ?></p>
<p style="font-style:italic;"><img src="images/class.png"/>:<span style="color:red;"><?php echo $web->maclass; ?></span></p>
</td>
<td style="text-align:justify;"><?php echo extrait($web->article, $nb); ?>...</td>
<td style="width:90px;"> </td>
<td style="text-align:left;"><a href="./gabarit.php?do=mod_contenu&nature=<?php echo $nature; ?>&page=<?php echo minuscule($_GET['page']); ?>&model_p=<?php echo minuscule($_GET['model_p']); ?>&step=3&model=<?php echo minuscule($_GET['model']); ?>&gab=<?php echo minuscule($_GET['gab']); ?>&iddiv=<?php echo $web->id; ?>&template=<?php echo $web->template; ?>&parent=<?php echo $web->id_parent; ?>"><img src="images/modifier.png" alt="" /></a></td>
</tr>
<?php
//lister les blocs après le bloc par défaut
echo $this->listingBlocsCorpsDePage($bdd,$web,$nature,0,2,0);
if($_GET['model'] == 2 || $web->template != 0) {
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_CONTENUS_SUPPL."` WHERE `page_id`=? AND `model_p`=? AND `nature`=? ORDER BY `ordre` ASC LIMIT ".$premiere.",".$nombreDePages);
$mysql->execute(array($web->id,minuscule($_GET['model_p']),$nature));
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$div = normaliserDIV($web->div,$nature,$sql->id);
//lister les blocs avant le bloc par défaut
echo $this->listingBlocsCorpsDePage($bdd,$web,$nature,$sql,1,0);
?>
<tr>
<td style="width:12px;text-align:center;"><input type="checkbox" name="nclass[]" value="<?php echo minuscule($_GET['model_p']).":".$sql->id; ?>"/></td>
<td style="font-weight:bold;text-align:left;">
<p><?php echo $div; ?></p>
<p style="font-style:italic;"><img src="images/class.png"/>:<span style="color:red;"><?php echo $sql->maclass; ?></span></p>
</td>
<td style="text-align:justify;"><?php echo extrait($sql->contenu, $nb); ?>...</td>
<td style="width:90px;">
<input type="text" name="ordre<?php echo $sql->id; ?>" id="ordre<?php echo $sql->id; ?>" value="<?php echo $sql->ordre; ?>" size="2"/>
<input type="button" value=" GO " onclick="window.top.location.href='pop.php?ad=mod_ordre_contenu_supp&ordre='+document.getElementById('ordre<?php echo $sql->id; ?>').value+'&id=<?php echo $sql->id; ?>'" />
</td>
<td style="text-align:left;">
<a href="./gabarit.php?do=mod_contenu_suppl&nature=<?php echo $nature; ?>&page=<?php echo minuscule($_GET['page']); ?>&model_p=<?php echo minuscule($_GET['model_p']); ?>&step=3&model=<?php echo minuscule($_GET['model']); ?>&gab=<?php echo minuscule($_GET['gab']); ?>&iddiv=<?php echo minuscule($_GET['iddiv']); ?>&template=<?php echo $web->template; ?>&idcs=<?php echo $sql->id; ?>"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction('gabarit.php?do=del_contenu_suppl&idcs=<?php echo $sql->id;?>&step=3');" style="cursor:pointer;"/>
</td>
</tr>
<?php
//lister les blocs après le bloc par défaut
echo $this->listingBlocsCorpsDePage($bdd,$web,$nature,$sql,2,0);
}
$mysql->closeCursor();
}
?>
<tr>
<td colspan="5" style="text-align:left;font-style: italic;">Nommer ma class : <input type="text" name="maclass"/></td>
</tr>
<tr>
<td colspan="5"><?php echo bouton("bt1-1", "bt2", "envoyer", 0, "right"); ?></td>
</tr>
</table>
</form>
<?php
}
}
public function associerBloc($bdd,$web,$name,$nature){
$array = array();$i = 1;
array_push($array, '<select name="'.$name.'">');
$result = $bdd->prepare("SELECT `id`, `titre` FROM `".TABLE_BLOC."` WHERE `id` NOT IN (SELECT `bloc_id` FROM `".TABLE_ASSOCIER_BLOC."` WHERE `page_id`=? AND `model_p`=? AND `nature`=?) ORDER by `titre`");
$result->execute(array($web->id,minuscule($_GET['model_p']),$nature));
while ($mysql = $result->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
array_push($array, '<option value="'.$mysql->id.'" '.$style.'> '.ucfirst($mysql->titre).'</option>');
$i++;
}
$result->closeCursor();
array_push($array, '</select>');
return implode("\n",$array);
}
public function associerBlocContenu($bdd,$web,$name,$nature){
$array = array();$i = 1;
array_push($array, '<select name="'.$name.'">');
if($nature == 2){
array_push($array, '<option value="0"> '.normaliserDIV($web->div,$nature,"").'</option>');
}
$result = $bdd->prepare("SELECT `id` FROM `".TABLE_CONTENUS_SUPPL."` WHERE `page_id`=? AND `model_p`=? AND `nature`=? ORDER by `ordre`");
$result->execute(array($web->id,minuscule($_GET['model_p']),$nature));
while ($mysql = $result->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
array_push($array, '<option value="'.$mysql->id.'" '.$style.'> '.normaliserDIV($web->div,$nature,$mysql->id).'</option>');
$i++;
}
$result->closeCursor();
array_push($array, '</select>');
return implode("\n",$array);
}
public function listerBlocContenu($bdd,$web,$nature){
$result = $bdd->prepare("SELECT * FROM `".TABLE_ASSOCIER_BLOC."` WHERE `page_id`=? AND `model_p`=? AND `nature`=? ORDER by `id`");
$result->execute(array($web->id,minuscule($_GET['model_p']),$nature));
while ($sql = $result->fetch(PDO::FETCH_OBJ)){
$bloc = $this->getTable($bdd,TABLE_BLOC,"id",$sql->bloc_id);
$contents = $this->getTable($bdd,TABLE_CONTENUS_SUPPL,"id",$sql->contenu_id);
?>
<div class="encadre">
<p><img src="images/warning.gif"/> <strong><?php echo ucfirst($bloc->titre);?></strong> s'affiche <u><?php echo ($sql->avant_apres == 1)?"avant":"après";?></u> <strong><?php echo normaliserDIV($web->div,$nature,$contents->id);?></strong></p>
<p style="text-align:right;margin-top: 4px;"><img src="images/supprimer.png" alt="" onclick="confirmerAction('gabarit.php?do=del_assoc_bloc&id=<?php echo $sql->id;?>&step=3');" style="cursor:pointer;"/></p>
</div>
<?php
}
$result->closeCursor();
}
public function delAds($bdd,$web){
//supprimer les contenus suppl.
$r = $bdd->prepare("DELETE FROM `".TABLE_CONTENUS_SUPPL."` WHERE `page_id`=? AND `model_p`=?");
$r->execute(array($web->id,minuscule($_GET['model_p'])));
$r->closeCursor();
//supprimer les blocs associés
$r = $bdd->prepare("DELETE FROM `".TABLE_ASSOCIER_BLOC."` WHERE `page_id`=? AND `model_p`=?");
$r->execute(array($web->id,minuscule($_GET['model_p'])));
$r->closeCursor();
//supprimer la page
if($_GET['model_p'] == "p"){
$this->deleteUnElement($bdd,TABLE_PAGES_WEB,"id",$web->id);
}
else{
$this->deleteUnElement($bdd,TABLE_BLOG,"id",$web->id);
}
}
public function getColonne($bdd,$web,$nature,$model_p){
$avant = array();$apres = array();
$result = $bdd->prepare("SELECT * FROM `".TABLE_CONTENUS_SUPPL."` WHERE `page_id`=? AND `model_p`=? AND `nature`=? ORDER by `ordre`");
$result->execute(array($web->id,$model_p,$nature));
while ($s = $result->fetch(PDO::FETCH_OBJ)){
//***** AFFICHAGE DU BLOC AVANT BLOC COLONNE ******
echo $this->listingBlocsColonnes($bdd,$web,$nature,$s,1,1);
//***** AFFICHAGE DU BLOC COLONNE ******
echo '<div class="'.normaliserDIV($web->div,$nature,$s->id).'">'.getData($s->contenu).'</div>'."\n";
//***** AFFICHAGE DU BLOC APRES BLOC COLONNE ******
echo $this->listingBlocsColonnes($bdd,$web,$nature,$s,2,1);
}
$result->closeCursor();
}
public function getCorps($bdd,$web,$nature,$model_p){
//corps de page initial
if($model_p != ""){
//lister les blocs avant
echo $this->listingBlocsCorpsDePage($bdd, $web, 2, 0, 1, 1);
echo '<div class="'.$web->div.' '.$web->maclass.'">'.getData($web->article).'</div>'."\n";
//lister les blocs après
echo $this->listingBlocsCorpsDePage($bdd, $web, 2, 0, 2, 1);
}
if ($nature == 2){
$result = $bdd->prepare("SELECT * FROM `".TABLE_CONTENUS_SUPPL."` WHERE `page_id`=? AND `model_p`=? AND `nature`=? ORDER by `ordre`");
$result->execute(array($web->id,$model_p,$nature));
while ($s = $result->fetch(PDO::FETCH_OBJ)){
//***** AFFICHAGE DU CORPS SUPPL. ******
//lister les blocs avant
echo $this->listingBlocsCorpsDePage($bdd, $web, $nature, $s, 1, 1);
echo '<div class="'.normaliserDIV($web->div,$nature,$s->id).' '.$s->maclass.'">'.getData($s->contenu).'</div>'."\n";
//lister les blocs après
echo $this->listingBlocsCorpsDePage($bdd, $web, $nature, $s, 2, 1);
}
$result->closeCursor();
}
if ($web->id == 5 && $model_p == "p"){
//plan du site = générer les liens du site
echo '<div class="sitemap">';
echo $this->planSite($bdd, 'sitemap');
echo '</div>';
}
if ($web->id == 7 && $model_p == "p"){
//mentions légales = générer les crédits photos
mentionsLegales();
}
if ($web->id == 4 && $model_p == "p"){
//générer GOOGLEMAP
}
if($web->id == 3 && $model_p == "p"){
//formulaire de contact
formulaireDeContact();
//générer GOOGLEMAP
echo '<div class="map-google">';
echo '<iframe src="'.URL_GOOGLEMAP.'"></iframe>';
echo '</div>';
}
if($web->id == 2 && $model_p == "p"){
//lister le diaporama par les catégories/rubriques
$this->diaporamaCategories($bdd,$web,$model_p);
}
$this->loadExternalFile($bdd, $web->id, $model_p);
//********* CHARGER LE DIAPORAMA ***********
if($model_p == ""){
$this->diaporama($bdd,$web);
}
//***************************************************
}
public function loadExternalFile($bdd, $vPageId, $vPageModel){
//********* CHARGER LES FICHIERS EXTERNES ***********
$new_page = R_FICHIERS_SUPPL."p".$vPageId.".php";
if (file_exists($new_page) && $vPageModel != "") {
include $new_page;
return $vExternalFileContent;
}
//***************************************************
return '';
}
public function diaporamaMenu($bdd,$web,$model_p){
$result = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_CATEGORIES."` ORDER by `cat`");
$result->execute();
echo '<div class="nav-diapo">';
while ($c = $result->fetch(PDO::FETCH_OBJ)){
echo '<p class="titre-diapo">'.ucfirst($c->cat).'</p>';
//lister les rubriques associées
$rst = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_RUBRIQUES."` WHERE `cat`=? ORDER by `rub`");
$rst->execute(array($c->id));
?>
<ul>
<?php
while ($r = $rst->fetch(PDO::FETCH_OBJ)){
$im = $this->executerRetourObjet($bdd,"SELECT `nom` FROM `".TABLE_DIAPO_IMGS."` WHERE `id_cat`=".$c->id." AND `id_rub`=".$r->id." ORDER by `ordre` LIMIT 0,1");
$classon='';
if(isset($_GET['id']) and $_GET['id'] == $r->id) $classon='class="link-play"';
$img = miniature($im->nom, 100, 100, ucfirst($r->rub));
$lien1 = ($im->nom != "")?'<a href="'.HTTP_SERVEUR.urlRewriting($r->rub).'-'.$r->id.'.html">':'<a href="javascript:void(0)" class="link-disable">';
$lien2 = ($im->nom != "")?'</a>':'</a>';
?>
<li <?php echo $classon; ?>><?php echo $lien1.ucfirst($r->rub).$lien2; ?></li>
<?php
}
?>
</ul>
<?php
$rst->closeCursor();
}
echo '</div>';
$result->closeCursor();
}
public function diaporama($bdd,$web){
$cat = $this->getTable($bdd,TABLE_DIAPO_CATEGORIES,"id",$web->cat);
$nom_p = urlRewriting($web->rub);
$title = $cat->cat." >> ".$web->rub;
?>
<?php /* <p class="diapo-breadcrumb center"><a href="<?php echo HTTP_SERVEUR; ?>diapo-2.php">Diaporama</a> >> <a href="<?php echo HTTP_SERVEUR.$nom_p.'-'.$web->id; ?>.html"><?php echo $title; ?></a></p> */ ?>
<div id="diapo-container">
<?php $this->diaporamaMenu($bdd,$web,$model_p); ?>
<div id="diapo-inner">
<ul class="pgwSlideshow">
<?php
$m = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_IMGS."` WHERE `id_cat`=? AND `id_rub`=? ORDER BY `ordre`");
$m->execute(array($cat->id,$web->id));
while($s = $m->fetch(PDO::FETCH_OBJ)){
?>
<li><img src="<?php echo HTTP_REDIMENSIONNEE.$s->nom; ?>" alt="<?php echo ucfirst($s->titre); ?>" /></li>
<?php
}
$m->closeCursor();
?>
</ul>
</div>
<?php
if(TYPE_DIAPORAMA == 2){
echo '<div id="descREA"><p style="text-align:justify;padding:5px;margin-top:20px;">'.$web->description.'</p></div>';
}
?>
<div class="clear"></div>
</div><!-- #diapo-container -->
<?php
}
public function navigation($bdd,$web,$model_p,$nom_p){
echo '<div class="breadcrumb">Navigation : ';
echo '<a href="'.HTTP_SERVEUR.'">Accueil</a>';
if($model_p == ""){
//diaporama
echo ' >> <a href="'.HTTP_SERVEUR.$nom_p.'-'.$web->id.'.html">'.ucfirst($web->rub).'</a>';
}
else{
if($model_p == "p"){
if($web->id != 1 && $web->id > 0){
echo ' >> <a href="'.HTTP_SERVEUR.$nom_p.'-'.$web->id.'.php">'.ucfirst($web->page).'</a>';
}
}
else{
$actu = $this->getTable($bdd, TABLE_PAGES_WEB, "id", 9);
echo ' >> <a href="'.HTTP_SERVEUR.urlRewriting($actu->page).'-9.php">'.ucfirst($actu->page).'</a> >> <a href="'.HTTP_SERVEUR.'article-'.$nom_p.'-'.$web->id.'.php">'.ucfirst($web->titre).'</a>';
}
}
echo '</div>';
}
public function diaporamaCategories($bdd,$web,$model_p){
$result = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_CATEGORIES."` ORDER by `cat`");
$result->execute();
while ($c = $result->fetch(PDO::FETCH_OBJ)){
echo '<div class="diapo-ttl">'.ucfirst($c->cat).'</div><div class="diapo-list-container">';
//lister les rubriques associées
$rst = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_RUBRIQUES."` WHERE `cat`=? ORDER by `rub`");
$rst->execute(array($c->id));
while ($r = $rst->fetch(PDO::FETCH_OBJ)){
$im = $this->executerRetourObjet($bdd,"SELECT `nom` FROM `".TABLE_DIAPO_IMGS."` WHERE `id_cat`=".$c->id." AND `id_rub`=".$r->id." ORDER by `ordre` LIMIT 0,1");
$img = miniature($im->nom, 100, 100, ucfirst($r->rub));
$lien1 = ($im->nom != "")?'<a href="'.HTTP_SERVEUR.urlRewriting($r->rub).'-'.$r->id.'.html">':'';
$lien2 = ($im->nom != "")?'</a>':'';
?>
<div class="diapo-list">
<div class="diapo-img"><?php echo $lien1.$img.$lien2; ?></div>
<div class="diapo-link"><?php echo $lien1.ucfirst($r->rub).$lien2; ?></div>
</div>
<?php
}
$rst->closeCursor();
echo '</div><div class="clear"></div>';
}
$result->closeCursor();
}
public function diaporamaAccueil($bdd,$genre,$web,$model_p){
$a1 = explode("|",$web->affichage_pw); $a2 = explode("|",$web->affichage_art);$array = array();
if($model_p == "p"){
$c = $this->executerRetourObjet($bdd,"SELECT COUNT(*) AS total FROM `".TABLE_DIAPO_ACCUEIL."` WHERE `affichage_pw` LIKE '%p".$web->id."%'");
if($c->total == 0){
$where = " WHERE `affichage_pw`='px' ";
}
else{
$where = " WHERE `affichage_pw` LIKE '%p".$web->id."%' ";
}
}
else{
$c = $this->executerRetourObjet($bdd,"SELECT COUNT(*) AS total FROM `".TABLE_DIAPO_ACCUEIL."` WHERE `affichage_art` LIKE '%a".$web->id."%'");
if($c->total == 0){
$where = " WHERE `affichage_art`='ax' ";
}
else{
$where = " WHERE `affichage_art` LIKE '%a".$web->id."%' ";
}
}
array_push($array, '<div id="jssor_1" style="position:relative;margin:0 auto;top:0px;left:0px;width:'.DIM_LARGEUR_DIAPO_ACCUEIL.'px;height:'.DIM_HAUTEUR_DIAPO_ACCUEIL.'px;overflow:hidden;visibility:hidden;">');
array_push($array, '<div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:'.DIM_LARGEUR_DIAPO_ACCUEIL.'px;height:'.DIM_HAUTEUR_DIAPO_ACCUEIL.'px;overflow:hidden;">');
//array_push($array, '<div id="slider-inner-'.$genre.'">');
//array_push($array, '<div class="slider-wrapper theme-default">');
//array_push($array, '<div id="slider" class="nivoSlider">');
// array_push($array, '<ul>');
//========== lister les images =======================
$m = $bdd->prepare("SELECT * FROM `".TABLE_DIAPO_ACCUEIL."` ".$where." ORDER BY `ordre`");
$m->execute();
while($s = $m->fetch(PDO::FETCH_OBJ)){
array_push($array, '<div><img src="'.HTTP_REDIMENSIONNEE.$s->nom.'" width="'.DIM_LARGEUR_DIAPO_ACCUEIL.'" height="'.DIM_HAUTEUR_DIAPO_ACCUEIL.'" alt="'.ATTRIBUT_ALT.'"/></div>');
}
$m->closeCursor();
//=====================================================
//array_push($array, '</ul>');
array_push($array, '</div>');
array_push($array, '</div>');
//array_push($array, '</div>');
return implode("\n", $array);
}
public function selectMD($bdd,$selection,$nature,$name){
$table = ($nature == 1)?TABLE_PAGES_WEB:TABLE_BLOG; $champ = ($nature == 1)?"page":"titre"; $prefixe = ($nature == 1)?"p":"a";$i = 1;
$array = explode("|", $selection);
echo '<select name="'.$name.'[]" id="'.$name.'" size="10" multiple>';
if(in_array($prefixe."x", $array)){
echo '<option value="'.$prefixe.'x" selected> - Toutes les pages </option>';
}
else{
echo '<option value="'.$prefixe.'x"> - Toutes les pages </option>';
}
$mysql = $bdd->prepare("SELECT * FROM `".$table."` ORDER BY `".$champ."`");
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
if(in_array($prefixe.$sql->id, $array)){
echo '<option value="'.$prefixe.$sql->id.'" selected '.$style.'> - '.ucfirst($sql->$champ).' </option>';
}
else{
echo '<option value="'.$prefixe.$sql->id.'" '.$style.'> - '.ucfirst($sql->$champ).' </option>';
}
$i++;
}
$mysql->closeCursor();
echo '</select>';
}
public function listerIbrowserParRepertoire($bdd,$rep_id,$input){
$array = array("",R_IBROWSER_IMG,R_IBROWSER_GALERIE,R_IBROWSER_GALERIE1,R_IBROWSER_GALERIE2,R_IBROWSER_GALERIE3);$cpt = 1;
$array_url = array("","../images/ibrowser/","../images/ibrowser/galerie/","../images/ibrowser/galerie1/","../images/ibrowser/galerie2/","../images/ibrowser/galerie3/");
$files = scandir(RACINE.'/'.$array[$rep_id]);
foreach($files as $file){
$filename = RACINE.'/'.$array[$rep_id].$file;
if(is_file($filename)){
echo '<p style="cursor:pointer;padding:3px;border-radius:5px;border:1px solid grey;background-color:#cbcbcb;font-weight:bold;" onclick="insertImg(\''.$array_url[$rep_id].$file.'\',\''.$input.'\');">'.$file.'</p>';
$cpt++;
}
}
}
public function selectPgwA($bdd,$nature,$name){
$table = ($nature == "p")?TABLE_PAGES_WEB:TABLE_BLOG; $champ = ($nature == "p")?"page":"titre";$i = 1;
$vRetour = '<select name="'.$name.'" id="'.$name.'">';
$vRetour .= '<option value="0"> Sélectionner </option>';
$mysql = $bdd->prepare("SELECT * FROM `".$table."` ORDER BY `".$champ."`");
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
$vRetour .= '<option value="'.$sql->id.'" '.$style.'> (G'.$sql->gabarit.':C'.$sql->modele.') '.ucfirst($sql->$champ).' </option>';
$i++;
}
$mysql->closeCursor();
$vRetour .= '</select>';
return $vRetour;
}
public function duplicatePage($bdd,$page_id,$model_page_id,$nature){
$original = array();$nouveau = array();$table = ($nature == "p")?TABLE_PAGES_WEB:TABLE_BLOG;
//lister les contenu associés
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_CONTENUS_SUPPL."` WHERE `page_id`=? AND `model_p`=? ORDER BY `id`");
$mysql->execute(array($model_page_id,$nature));
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$this->executerSansRetourex($bdd,"INSERT INTO `".TABLE_CONTENUS_SUPPL."`(`page_id`,`model_p`,`nature`,`contenu`,`ordre`,`maclass`,`unique`)
VALUES(?, ?, ?, ?, ?, ?, ?)", array($page_id, $sql->model_p, $sql->nature, $sql->contenu, $sql->ordre, $sql->maclass, $sql->id));
$id = $this->getChamps($bdd,"id",TABLE_CONTENUS_SUPPL,"unique",$sql->id);
array_push($original,$sql->id);
array_push($nouveau,$id);
}
$mysql->closeCursor();
//lister les blocs associés
for($i=0;$i<count($original);$i++){
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_ASSOCIER_BLOC."` WHERE `contenu_id`=? ORDER BY `id`");
$mysql->execute(array($original[$i]));
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$contenu_id = $nouveau[$i];
$this->executerSansRetourex($bdd,"INSERT INTO `".TABLE_ASSOCIER_BLOC."`(`page_id`,`model_p`,`nature`,`bloc_id`,`avant_apres`,`contenu_id`)
VALUES(?, ?, ?, ?, ?, ?)", array($page_id, $sql->model_p, $sql->nature, $sql->bloc_id, $sql->avant_apres, $contenu_id));
}
$mysql->closeCursor();
}
//mise à jour de la page maitre en cas d'ajout d'une class générique
$maclass = $this->getChamps($bdd,"maclass",$table,"id",$model_page_id);
$this->updateUnElement($bdd, $table, "maclass", $maclass, "id", $page_id);
//lister les blocs associés par rapport au contenu_id = 0
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_ASSOCIER_BLOC."` WHERE `page_id`=? AND `model_p`=? AND `contenu_id`=? AND `nature`=? ORDER BY `id`");
$mysql->execute(array($model_page_id,$nature,0,2));
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$this->executerSansRetourex($bdd,"INSERT INTO `".TABLE_ASSOCIER_BLOC."`(`page_id`,`model_p`,`nature`,`bloc_id`,`avant_apres`,`contenu_id`)
VALUES (?, ?, ?, ?, ?, ?)", array($page_id, $sql->model_p, $sql->nature, $sql->bloc_id, $sql->avant_apres,0));
}
$mysql->closeCursor();
}
public function listeDesActualites($bdd){
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_BLOG."` WHERE `enligne`=0 ORDER BY `heure` DESC");
$mysql->execute();
$vRetour = '';
$modelpage = 'a';
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$url = HTTP_SERVEUR.'article-'.$sql->id.'-'.urlRewriting($sql->titre).'.php';
$vRetour .= '<div class="extraitArt">
<h3 class="intitule"><a href="'. $url.'">'. ucfirst($sql->titre).'</a></h3>
<div class="p-article"><a href="'. $url.'">'.getImgArt('thumbs', '1', 0, '', 0, '', $sql->id, $modelpage).'</a></div>
<p class="extrait">'.extrait($sql->article, 30).'</p>
<p class="date">publié, le : '.date("d/m/Y",$sql->heure).'</p>
<p class="liresuite"><a href="'. $url.'">[Lire la suite]</a></p>
</div>';
}
$mysql->closeCursor();
return $vRetour;
}
public function listePromo($bdd){
$mysql = $bdd->prepare("SELECT * FROM `".TABLE_BLOG."` WHERE `enligne`=0 ORDER BY `heure` ASC");
$mysql->execute();
$vRetour = '';
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$url = HTTP_SERVEUR.'article-'.urlRewriting($sql->titre).'-'.$sql->id.'.php';
$vRetour .= '<div class="prom">
<div class="ttl_prom"><h2>'. ucfirst($sql->titre).'</h2></div>
<div class="texte-slides">
<p class="date">publié, le : '.date("d/m/Y",$sql->heure).'</p>
<p>'.extrait($sql->description, 500).'</p>
<a href="'. $url.'" title="'. ucfirst($sql->titre).'" class="details">+ de detail</a>
</div>
</div>';
}
$mysql->closeCursor();
return $vRetour;
}
public function getListeTemplatesDB($bdd){
$table = TABLE_TEMPLATES;
$result = $bdd->prepare("SELECT * FROM `".$table."`");
$result->execute(array());
$vHtml = '<table class="tableau">';
$vHtml .= '<tr><th>Nom</th><th>Nombre de champs</th><th>Fichier</th><th>Actions</th></tr>';
$bgnum = 2;
while($vTemplate = $result->fetch(PDO::FETCH_OBJ)) {
if($bgnum == 1){
$bgnum = 2;
}else{
$bgnum = 1;
}
$vHtml .= '<tr class="bgn-'.$bgnum.'"><td>'.$vTemplate->nom.'</td><td>'.$vTemplate->nbr_champs.
'</td><td>'.$vTemplate->fichier.'</td>'.
'<td style="width:80px;">
<a href="./templates.php?do=mod&id='.$vTemplate->id.'"><img src="images/modifier.png" alt="" /></a>
<img src="images/supprimer.png" alt="" onclick="confirmerAction(\'templates.php?do=del&id='.$vTemplate->id.'\');" style="cursor:pointer;"/>'.
'</td>'
.'</tr>';
}
$vHtml .= '</table>';
$result->closeCursor();
return $vHtml;
}
function getHtmlForTemplate($bdd) {
return "<h2>[Tous les templates]</h2>".
'<p style="text-align:right;padding:5px;"><a href="./templates.php?do=add">+ ajouter un template</a></p>'.
$this->getListeTemplatesDB($bdd, "SELECT * from `templates`");
}
function handlePostForTemplate($bdd, $post, $id) {
if ($id) {
$query = sprintf("UPDATE `%s` SET `nom` = '%s', nbr_champs = %d WHERE `id`= %d", TABLE_TEMPLATES, $post['nom'], $post['nbr_champs'], $id);
$filename = $post["filename"];
} else {
$filename = "t".ucfirst(strtolower($post['nom']));
$query = sprintf("INSERT INTO `%s` (`nom`, `nbr_champs`, `fichier`) VALUES ('%s', '%d', '%s')", TABLE_TEMPLATES, $post['nom'], $post['nbr_champs'], $filename);
}
$this->executerSansRetour($bdd,$query);
file_put_contents(sprintf("../themes/templates/%s.php", $filename), stripslashes($post['filecontent']));
return True;
}
public function selectFieldForTemplate($bdd){
$table = TABLE_TEMPLATES;
$i = 1;
$vRetour = '<select name="template" id="template">';
$vRetour .= '<option value="0"> Sélectionner </option>';
$mysql = $bdd->prepare("SELECT * FROM `".$table."` ORDER BY `nom`");
$mysql->execute();
while($sql = $mysql->fetch(PDO::FETCH_OBJ)){
$style = ($i%2)?'style="background-color:#DFDFDF;font-weight:bold;"':'';
$vRetour .= '<option value="'.$sql->id.'" '.$style.'> '. $sql->nom.' ('.$sql->nbr_champs.' champs(s))' .' </option>';
$i++;
}
$mysql->closeCursor();
$vRetour .= '</select>';
return $vRetour;
}
public function deleteTemplate($bdd, $vId) {
$vTemplate = $this->getTable($bdd, TABLE_TEMPLATES, 'id', $vId);
$filename = sprintf("../themes/templates/%s.php", $vTemplate->fichier);
$this->deleteUnElement($bdd, TABLE_TEMPLATES, 'id', $vId);
if (is_file($filename))
unlink($filename);
}
public function afficher_niveau_page($parent, $niveau, $array, $trait) {
$html = "";
$niveau_precedent = 0;
if (!$niveau && !$niveau_precedent){
$html .= "";
}
foreach ($array as $noeud) {
if ($parent == $noeud['parent_id']) {
if ($niveau_precedent < $niveau){
//if($noeud['parent_id'] != 0)
$trait .= "_";
}
$html .= '<option value="'.$noeud['id'].'" '.$noeud['varselected'].' style="background:#eee;"> '.$trait.$noeud['nom_categorie'].'</option>'."\n";
$niveau_precedent = $niveau;
$html .= $this->afficher_niveau_page($noeud['id'], ($niveau + 1), $array, $trait);
}
}
if (($niveau_precedent == $niveau) && ($niveau_precedent != 0)) $html .= "";
else if ($niveau_precedent == $niveau) $html .= "";
else $html .= "";
return $html;
}
public function listparent($bdd, $selected){
$m = $bdd->prepare("SELECT * FROM `".TABLE_PAGES_WEB."` WHERE `page`!=404 AND `enligne`=0 ORDER BY `ordre`");
$m->execute();
echo '<select name="parent" id="idparent">'."\n".
'<option value="0"> Sélectionner </option>'."\n";
while($s = $m->fetch(PDO::FETCH_OBJ)){
if($selected == $s->id){
$varselected = 'selected';
}else{
$varselected = "";
}
$niveaupagesel[] = array(
'parent_id' => $s->id_parent,
'id' => $s->id,
'nom_categorie' => $s->page,
'varselected' => $varselected,
);
$i++;
}
echo $this->afficher_niveau_page(0, 0, $niveaupagesel, "");
echo '</select>'."\n";
$m->closeCursor();
}
}