<?php
session_start();
error_reporting(0);

/*****************************************************************************************
                        Artiphp 2.5.0 - module annuaire
               copyright : Ronald Guérin - webmaster@artiloo.com
                            http://www.artiloo.com
                      Dernière mise à jour : 13 novembre 2003
******************************************************************************************/

//connection à la base
//--------------------
  include("../artzone/connect.php");
  include("../outils/identification2.php");   //  zone membre
  include("../outils/identimprime.php");

//Définition module
//-----------------
  $mod_present="Agenda";

// langue
//--------------------
  if ($_SESSION['SESSION_IDSKIN']) {
  } else {
  include("../outils/donneeSkin.php"); 
  }
  $SESSION_LANGSKIN=$_SESSION['SESSION_LANGSKIN'];
  if (!$SESSION_LANGSKIN) { $SESSION_LANGSKIN="fr"; }
  include("../langages/$SESSION_LANGSKIN/index.php");

//dictionnaire specifique au module
  include("../langages/$SESSION_LANGSKIN/agenda.php");


// autorisation
//--------------------
  $requete="select visumodule from ".$extension."module where nomModule='Agenda'";
  $result=mysql_query($requete, $link);
   $autorisation=mysql_fetch_object($result);

   $SESSION_STATUT=$_SESSION['SESSION_STATUT'];

   if ($autorisation->visumodule=='1') {
     if ($SESSION_STATUT!="artadmin" && $SESSION_STATUT!="auteurqal" && $SESSION_STATUT!="auteur" && $SESSION_STATUT!="inscrit") {  
     header("Location: ../outils/erreur.php?ec=2");
     exit();
     }
   } elseif ($autorisation->visumodule=='2') {
     if ($SESSION_STATUT!="artadmin" && $SESSION_STATUT!="auteurqal" && $SESSION_STATUT!="auteur") {  
     header("Location: ../outils/erreur.php?ec=2");
     exit();
     }
   } elseif ($autorisation->visumodule=='3') {
     if ($SESSION_STATUT!="artadmin" && $SESSION_STATUT!="auteurqal") {  
     header("Location: ../outils/erreur.php?ec=2");
     exit();
     }
   } elseif ($autorisation->visumodule=='4') {
     if ($SESSION_STATUT!="artadmin") {  
     header("Location: ../outils/erreur.php?ec=2");
     exit();
     }
   }

// metatags
//--------------------
  include("../metatags/metaagenda.php");
  $metatitle="$LG_METATITLE";
  $metaDescription="$LG_METADESC";



  $date=$_GET['date'];



//transformation date
//-------------------
		$month10 	= substr($date, 4 ,2);
		$day10 		= substr($date, 6, 2);
		$year10		= substr($date, 0 ,4);

$affichage="".$day10."/".$month10."/".$year10."";
$datetable="".$year10."-".$month10."-".$day10."";


  $cat=$_GET['cat'];
  $cat3=$_GET['cat3'];
  $nomcat=$_GET['nomcat'];
  $nom3cat=$_GET['nom3cat'];

  $page=$_GET['page'];
  $limit=$_GET['limit'];

  $cat = intval($cat);
  $cat3 = intval($cat3);
  $page = intval($page);
  $limit = intval($limit);


/*********************************************/
/********* affichage par categorie ***********/
/*********************************************/

if ($cat) {

	if (!$nomcat) {
	$requete5="select nomCategorie from ".$extension."sortircat where id_categorie=$cat";
	$result5=mysql_query($requete5, $link);
	$recherchenomcat=mysql_fetch_object($result5);
        $nomcat = stripslashes($recherchenomcat->nomCategorie);
	}

  // metatags --------------------------------
  $nCat = htmlspecialchars($nomcat);
  $metatitle="".$LG_METACAT." ".$nCat."";
  $metaDescription="".$nCat." - ".$LG_METADESCCAT."";
  //-------------------------------------------


// entete de page


  $entete= "<font class=\"entete\"><a href=\"../welcome/index.php\" class=\"entete\">$LG_ACCUEIL</a>/<a href=\"index.php\" class=\"entete\">Tous les événements</a>/".$nomcat."/le ".$affichage."</font>\n";


  //----------------------------------------
  $entetepage= "<p align=\"right\"><font class=\"entetepage\">$LG_RESULPERPG \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?cat=".$cat."&date=".$date."&page=".$page."&limit=5\" class=\"entetepage\">5</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?cat=".$cat."&date=".$date."&page=".$page."&limit=10\" class=\"entetepage\">10</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?cat=".$cat."&date=".$date."&page=".$page."&limit=20\" class=\"entetepage\">20</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?cat=".$cat."&date=".$date."&page=".$page."&limit=50\" class=\"entetepage\">50</a>&nbsp;&nbsp;</font>\n";
  //-----------------------------------------



//pagination le limit défini le nombre d'enregistrement par page
//---------------------------------------------------------------

  if (!($limit)) {
   $limit = 10;
  } 
  if (!($page)) {
   $page = 0;
  }

  // comptage des enregistrements

  $requete="select id_sortir from ".$extension."sortir where ordateinSortir<=$date and ordateoutSortir>=$date and (idCat=$cat or idCat2=$cat)";
  $result=mysql_query($requete, $link);
  $rows=mysql_num_rows($result);


  if ($rows==0) {
    $listesortir="<p><strong><font color=\"#FF0000\" size=\"2\">Aucune manifestation n'est programmée pour cette période, dans cette catégorie</font></strong>\n";
  }

  $pages = intval($rows/$limit); 


  if ($rows%$limit) {
   $pages++;} 

  $current = ($page/$limit) + 1; 

  if (($pages < 1) || ($pages == 0)) {
   $total = 1;} 

  else {
   $total = $pages;} 

  $first = $page + 1; 

  if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {
   $last = $page + $limit;} 
 
  else{
   $last = $rows;
  } 

//---------------------------------------------------------------------------
mysql_free_result($result);
//---------------------------------------------------------------------------

     $style[0]="right";
     $style[1]="left";
     $i=1;

     $requete="select * from ".$extension."sortir, ".$extension."sortircat2 where ordateinSortir<=$date and ordateoutSortir>=$date and (idCat=$cat or idCat2=$cat) and id2Cat=id2_categorie order by ordateinSortir ASC LIMIT $page, $limit";
     $result2=mysql_query($requete, $link);
     while ($sortir=mysql_fetch_object($result2)) {


//transformation date
//-------------------

$nommois = array('', 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');
 

     if ($sortir->ordateinSortir==$sortir->ordateoutSortir) { 

        $affichagedate="";

        $month 	= substr($sortir->ordateinSortir,4,2);

        // decoupe du mois
        $decmonth = substr($sortir->ordateinSortir,4,1);
        $decmonth2 = substr($sortir->ordateinSortir,5,1);
         if (!$decmonth) { $month = "$decmonth2"; }

	$day 	= substr($sortir->ordateinSortir,6,2);
	$year	= substr($sortir->ordateinSortir,0,4);
        $nm = $nommois[$month];
        $affichagedate="Le ".$day." ".$nm." ".$year."";


     } else { 
        $affichagedate="";

        $month = substr($sortir->ordateinSortir,4,2);
        $decmonth = substr($sortir->ordateinSortir,4,1);
        $decmonth2 = substr($sortir->ordateinSortir,5,1);
         if (!$decmonth) { $month = "$decmonth2"; }

	$day 	= substr($sortir->ordateinSortir,6,2);
	$year	= substr($sortir->ordateinSortir,0,4);
        $nm = "$nommois[$month]";


	 $month = substr($sortir->ordateoutSortir,4,2);
         $decmonth = substr($sortir->ordateoutSortir,4,1);
         $decmonth2 = substr($sortir->ordateoutSortir,5,1);
           if (!$decmonth) { $month = "$decmonth2"; }

	 $day2	 = substr($sortir->ordateoutSortir,6,2);
	 $year2  = substr($sortir->ordateoutSortir,0,4);
         $nm2 = "$nommois[$month]";
        $affichagedate="Du ".$day." ".$nm." ".$year." au ".$day2." ".$nm2." ".$year2."";


     }

//-----------------------------------

	// decode texte
        $sortir->nom2Categorie = stripslashes($sortir->nom2Categorie);
        $sortir->titreSortir = stripslashes($sortir->titreSortir);
        $sortir->sstitreSortir = stripslashes($sortir->sstitreSortir);
        $sortir->texteSortir = stripslashes($sortir->texteSortir);
        $sortir->infoSortir = stripslashes($sortir->infoSortir);

	/* si categorie secondaire */
	if ($sortir->id2Cat!='1') {
	$listecat2= "<p align=\"right\"><b>Catégorie : \n";
	$listecat2 .= "<a href=\"indexdate.php?cat3=".$sortir->id2Cat."&date=$date\">\n";
	$listecat2 .= "".$sortir->nom2Categorie."</a></b>&nbsp;\n";
	$listesscat2= " - ".$sortir->nom2Categorie."\n";
	}


      $listesortir .= "<p><strong><font color=\"#FF0000\">".$sortir->titreSortir."</font><br>\n";
      $listesortir .= "$affichagedate".$listesscat2."<br>".$sortir->sstitreSortir."</strong><br>\n";

       if ($sortir->imageSortir=="") {
        $photo="";
       } else {
        $photo="<br><img src=\"images/".$sortir->imageSortir."\" align=\"".$style[$i++%2]."\">\n";
       }

     $listesortir .= "". $photo ."";
     $listesortir .= "".$sortir->texteSortir."<br> \n";
     $listesortir .= "<em>".$sortir->infoSortir."</em></p>\n";

     $listesortir .= "$listecat2";

	$listecat2= "";
	$listesscat2= "";

	/********************************************************/
	/* Zone d'admin *****************************************/
	if ($SESSION_STATUT=="artadmin" || $SESSION_STATUT=="auteurqal" ) {
	$listesortir .= "<p align=\"center\"><b><a href=\"../artzone/agendasaisie.php?id_manif=$sortir->id_sortir\" target=\"_blank\">Modifier</a>\n";
	$listesortir .= " - <a href=\"../artzone/agendasupp.php?id_manif=$sortir->id_sortir\" target=\"_blank\">Supprimer</a></b>&nbsp;\n";
	}
	/********************************************************/

     $listesortir .= "<hr color=\"#ff0000\" SIZE=\"1\">\n";
    }

//-----------------------------------------------------------------------
// Deuxieme partie du code de pagination
// (à modifier si vous avez d'autres données à faire circuler dans l'URL)
//-----------------------------------------------------------------------
if ($page != 0) { 
   $back_page = $page - $limit;
   $pagination .= "<a href=\"$PHP_SELF?cat=".$cat."&page=$back_page&limit=$limit\"><<</a>\n";
}

for ($i=1; $i <= $pages; $i++) {
   $ppage = $limit*($i - 1);
     if ($ppage == $page){
       //------
         if ($total == 1) {
           $pagination .= "";
         } else { 
         $pagination .= "<b>$i</b> \n";
         }
       //-----
     } else {
         $pagination .= "<a href=\"$PHP_SELF?cat=".$cat."&page=$ppage&limit=$limit\">$i</a> \n";
     }
}

if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { 
     $next_page = $page + $limit;
     $pagination .= "<a href=\"$PHP_SELF?cat=".$cat."&page=$next_page&limit=$limit\">>></a>\n";
}

if (! $pagination) {
         $finpag .= "<br>";
} else {
         $debutpag .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" class=\"entete2\"><tr class=\"entete2\"><td>";
         $debutpag .= "&nbsp;$LG_ALPAGE ";
         $finpag .= "</td></tr></table>";
}

/**********************************************/
/********* affichage par categorie2 ***********/
/**********************************************/

} elseif ($cat3) {

  if (!$nom3cat) {
     $requete="select * from ".$extension."sortircat2 where id2_categorie=$cat3";
     $result=mysql_query($requete, $link);
     $nom=mysql_fetch_object($result);
        $nom3cat = stripslashes($nom->nom2Categorie);
  }

  // metatags --------------------------------
  $nCat = htmlspecialchars($nom3cat);
  $metatitle="".$LG_METACAT." ".$nCat."";
  $metaDescription="".$nCat." - ".$LG_METADESCCAT."";
  //-------------------------------------------

//--------------------------------------------------
// entete de page

   $entete= "<font class=\"entete\"><a href=\"../welcome/index.php\" class=\"entete\">$LG_ACCUEIL</a>/<a href=\"index.php\" class=\"entete\">Tous les événements</a>/".$nom3cat."/le ".$affichage."</font>\n";

  //----------------------------------------
  $entetepage= "<p align=\"right\"><font class=\"entetepage\">$LG_RESULPERPG \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?cat3=".$cat3."&date=$date&page=".$page."&limit=5\" class=\"entetepage\">5</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?cat3=".$cat3."&date=$date&page=".$page."&limit=10\" class=\"entetepage\">10</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?cat3=".$cat3."&date=$date&page=".$page."&limit=20\" class=\"entetepage\">20</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?cat3=".$cat3."&date=$date&page=".$page."&limit=50\" class=\"entetepage\">50</a>&nbsp;&nbsp;</font>\n";
  //-----------------------------------------


//---------------------------------------------------

//pagination le limit défini le nombre d'enregistrement par page
//---------------------------------------------------------------

  if (!($limit)) {
   $limit = 10;
  } 
  if (!($page)) {
   $page = 0;
  }

  // comptage des enregistrements

  $requete="select id_sortir from ".$extension."sortir where ordateinSortir<=$date and ordateoutSortir>=$date and id2Cat=$cat3";
  $result=mysql_query($requete, $link);
  $rows=mysql_num_rows($result);


  if ($rows==0) {
    $listesortir="<p><strong><font color=\"#FF0000\" size=\"2\">Aucune manifestation n'est programmée pour cette période, dans cette catégorie</font></strong>\n";
  }

  $pages = intval($rows/$limit); 


  if ($rows%$limit) {
   $pages++;} 

  $current = ($page/$limit) + 1; 

  if (($pages < 1) || ($pages == 0)) {
   $total = 1;} 

  else {
   $total = $pages;} 

  $first = $page + 1; 

  if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {
   $last = $page + $limit;} 
 
  else{
   $last = $rows;
  } 

//---------------------------------------------------------------------------
mysql_free_result($result);
//---------------------------------------------------------------------------

     $style[0]="right";
     $style[1]="left";
     $i=1;

     $requete="select * from ".$extension."sortir, ".$extension."sortircat2, ".$extension."sortircat where ordateinSortir<=$date and ordateoutSortir>=$date and id2Cat=$cat3 and id2Cat=id2_categorie and idCat=id_categorie ORDER BY ordateinSortir ASC LIMIT $page, $limit";
     $result2=mysql_query($requete, $link);
     while ($sortir=mysql_fetch_object($result2)) {

//-------------------------------------------------------
//transformation date
//-------------------

$nommois = array('', 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');
 

     if ($sortir->ordateinSortir==$sortir->ordateoutSortir) { 

        $affichagedate="";

        $month 	= substr($sortir->ordateinSortir,4,2);

        // decoupe du mois
        $decmonth = substr($sortir->ordateinSortir,4,1);
        $decmonth2 = substr($sortir->ordateinSortir,5,1);
         if (!$decmonth) { $month = "$decmonth2"; }

	$day 	= substr($sortir->ordateinSortir,6,2);
	$year	= substr($sortir->ordateinSortir,0,4);
        $nm = $nommois[$month];
        $affichagedate="Le ".$day." ".$nm." ".$year."";


     } else { 
        $affichagedate="";

        $month = substr($sortir->ordateinSortir,4,2);
        $decmonth = substr($sortir->ordateinSortir,4,1);
        $decmonth2 = substr($sortir->ordateinSortir,5,1);
         if (!$decmonth) { $month = "$decmonth2"; }

	$day 	= substr($sortir->ordateinSortir,6,2);
	$year	= substr($sortir->ordateinSortir,0,4);
        $nm = "$nommois[$month]";


	 $month = substr($sortir->ordateoutSortir,4,2);
         $decmonth = substr($sortir->ordateoutSortir,4,1);
         $decmonth2 = substr($sortir->ordateoutSortir,5,1);
           if (!$decmonth) { $month = "$decmonth2"; }

	 $day2	 = substr($sortir->ordateoutSortir,6,2);
	 $year2  = substr($sortir->ordateoutSortir,0,4);
         $nm2 = "$nommois[$month]";
        $affichagedate="Du ".$day." ".$nm." ".$year." au ".$day2." ".$nm2." ".$year2."";


     }
//-------------------------------------------------------

//-----------------------------------

	// decode texte
        $sortir->nom2Categorie = stripslashes($sortir->nom2Categorie);
        $sortir->nomCategorie = stripslashes($sortir->nomCategorie);
        $sortir->titreSortir = stripslashes($sortir->titreSortir);
        $sortir->sstitreSortir = stripslashes($sortir->sstitreSortir);
        $sortir->texteSortir = stripslashes($sortir->texteSortir);
        $sortir->infoSortir = stripslashes($sortir->infoSortir);


      $listesortir .= "<p><strong><font color=\"#FF0000\">".$sortir->titreSortir."</font><br>\n";
      $listesortir .= "$affichagedate - ".$sortir->nom2Categorie."<br>".$sortir->sstitreSortir."</strong><br>\n";

       if ($sortir->imageSortir=="") {
        $photo="";
       } else {
        $photo="<br><img src=\"images/".$sortir->imageSortir."\" align=\"".$style[$i++%2]."\">\n";
       }

     $listesortir .= "". $photo ."";
     $listesortir .= "".$sortir->texteSortir."<br> \n";
     $listesortir .= "<em>".$sortir->infoSortir."</em></p>\n";

     $listesortir .= "<p align=\"right\"><b>Catégorie : \n";
     $listesortir .= "<a href=\"indexdate.php?cat=".$sortir->idCat."&date=$date\">\n";
     $listesortir .= "".$sortir->nomCategorie."</a></b>&nbsp;\n";

	/********************************************************/
	/* Zone d'admin *****************************************/
	if ($SESSION_STATUT=="artadmin" || $SESSION_STATUT=="auteurqal") {
	$listesortir .= "<p align=\"center\"><b><a href=\"../artzone/agendasaisie.php?id_manif=$sortir->id_sortir\" target=\"_blank\">Modifier</a>\n";
	$listesortir .= " - <a href=\"../artzone/agendasupp.php?id_manif=$sortir->id_sortir\" target=\"_blank\">Supprimer</a></b>&nbsp;\n";
	}
	/********************************************************/

     $listesortir .= "<hr color=\"#ff0000\" SIZE=\"1\">\n";
    }

//-----------------------------------------------------------------------
// Deuxieme partie du code de pagination
// (à modifier si vous avez d'autres données à faire circuler dans l'URL)
//-----------------------------------------------------------------------
if ($page != 0) { 
   $back_page = $page - $limit;
   $pagination .= "<a href=\"$PHP_SELF?cat=".$cat."&page=$back_page&limit=$limit\"><<</a>\n";
}

for ($i=1; $i <= $pages; $i++) {
   $ppage = $limit*($i - 1);
     if ($ppage == $page){
       //------
         if ($total == 1) {
           $pagination .= "";
         } else { 
         $pagination .= "<b>$i</b> \n";
         }
       //-----
     } else {
         $pagination .= "<a href=\"$PHP_SELF?cat=".$cat."&page=$ppage&limit=$limit\">$i</a> \n";
     }
}

if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { 
     $next_page = $page + $limit;
     $pagination .= "<a href=\"$PHP_SELF?cat=".$cat."&page=$next_page&limit=$limit\">>></a>\n";
}

if (! $pagination) {
         $finpag .= "<br>";
} else {
         $debutpag .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" class=\"entete2\"><tr class=\"entete2\"><td>";
         $debutpag .= "&nbsp;$LG_ALPAGE ";
         $finpag .= "</td></tr></table>";
}

/*********************************************/
/********* affichage de tous *****************/
/*********************************************/
} else {

//--------------------------------------------------
// entete de page


  $entete= "<a href=\"../welcome/index.php\">Accueil</a>/Tous les événements/le ".$affichage."\n";


  //----------------------------------------
  $entetepage= "<p align=\"right\"><font class=\"entetepage\">$LG_RESULPERPG \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?date=".$date."&page=".$page."&limit=5\" class=\"entetepage\">5</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?date=".$date."&page=".$page."&limit=10\" class=\"entetepage\">10</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?date=".$date."&page=".$page."&limit=20\" class=\"entetepage\">20</a> | \n";
  $entetepage .= "<a href=\"".$PHP_SELF."?date=".$date."&page=".$page."&limit=50\" class=\"entetepage\">50</a>&nbsp;&nbsp;</font>\n";
  //-----------------------------------------

//---------------------------------------------------

//pagination le limit défini le nombre d'enregistrement par page
//---------------------------------------------------------------

  if (!($limit)) {
   $limit = 10;
  } 
  if (!($page)) {
   $page = 0;
  }

  // comptage des enregistrements

  $requete="select id_sortir from ".$extension."sortir, ".$extension."sortircat where ordateinSortir<=$date and ordateoutSortir>=$date and id_categorie=idCat";
  $result=mysql_query($requete, $link);
  $rows=mysql_num_rows($result);


  if ($rows==0) {
    $listesortir="<p><strong><font color=\"#FF0000\" size=\"2\">Aucune manifestation n'est programmée pour cette période.</font></strong>\n";
  }

  $pages = intval($rows/$limit); 


  if ($rows%$limit) {
   $pages++;} 

  $current = ($page/$limit) + 1; 

  if (($pages < 1) || ($pages == 0)) {
   $total = 1;} 

  else {
   $total = $pages;} 

  $first = $page + 1; 

  if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {
   $last = $page + $limit;} 
 
  else{
   $last = $rows;
  } 

//---------------------------------------------------------------------------
mysql_free_result($result);
//---------------------------------------------------------------------------

     $style[0]="right";
     $style[1]="left";
     $i=1;

     $requete="select * from ".$extension."sortir, ".$extension."sortircat, ".$extension."sortircat2 where ordateinSortir<=$date and ordateoutSortir>=$date and id_categorie=idCat and id2Cat=id2_categorie  ORDER BY ordateinSortir ASC LIMIT $page, $limit";
     $result2=mysql_query($requete, $link);
     while ($sortir=mysql_fetch_object($result2)) {

//-------------------------------------------------------
//transformation date
//-------------------

$nommois = array('', 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');
 

     if ($sortir->ordateinSortir==$sortir->ordateoutSortir) { 

        $affichagedate="";

        $month 	= substr($sortir->ordateinSortir,4,2);

        // decoupe du mois
        $decmonth = substr($sortir->ordateinSortir,4,1);
        $decmonth2 = substr($sortir->ordateinSortir,5,1);
         if (!$decmonth) { $month = "$decmonth2"; }

	$day 	= substr($sortir->ordateinSortir,6,2);
	$year	= substr($sortir->ordateinSortir,0,4);
        $nm = $nommois[$month];
        $affichagedate="Le ".$day." ".$nm." ".$year."";


     } else { 
        $affichagedate="";

        $month = substr($sortir->ordateinSortir,4,2);
        $decmonth = substr($sortir->ordateinSortir,4,1);
        $decmonth2 = substr($sortir->ordateinSortir,5,1);
         if (!$decmonth) { $month = "$decmonth2"; }

	$day 	= substr($sortir->ordateinSortir,6,2);
	$year	= substr($sortir->ordateinSortir,0,4);
        $nm = "$nommois[$month]";


	 $month = substr($sortir->ordateoutSortir,4,2);
         $decmonth = substr($sortir->ordateoutSortir,4,1);
         $decmonth2 = substr($sortir->ordateoutSortir,5,1);
           if (!$decmonth) { $month = "$decmonth2"; }

	 $day2	 = substr($sortir->ordateoutSortir,6,2);
	 $year2  = substr($sortir->ordateoutSortir,0,4);
         $nm2 = "$nommois[$month]";
        $affichagedate="Du ".$day." ".$nm." ".$year." au ".$day2." ".$nm2." ".$year2."";


     }

//-----------------------------------

	// decode texte
        $sortir->nom2Categorie = stripslashes($sortir->nom2Categorie);
        $sortir->nomCategorie = stripslashes($sortir->nomCategorie);
        $sortir->titreSortir = stripslashes($sortir->titreSortir);
        $sortir->sstitreSortir = stripslashes($sortir->sstitreSortir);
        $sortir->texteSortir = stripslashes($sortir->texteSortir);
        $sortir->infoSortir = stripslashes($sortir->infoSortir);

	/* si categorie secondaire */
	if ($sortir->id2Cat!='1') {
	$listecat2= "<b>- <a href=\"indexdate.php?cat3=".$sortir->id2Cat."&date=$date\">\n";
	$listecat2 .= "".$sortir->nom2Categorie."</a></b>&nbsp;\n";
	$listesscat2= " - ".$sortir->nom2Categorie."</b>\n";
	}


      $listesortir .= "<p><strong><font color=\"#FF0000\">".$sortir->titreSortir."</font><br>\n";
      $listesortir .= "".$affichagedate."".$listesscat2."<br>".$sortir->sstitreSortir."</strong> <br>\n";

       if ($sortir->imageSortir=="") {
        $photo="";
       } else {
        $photo="<br><img src=\"images/".$sortir->imageSortir."\" align=\"".$style[$i++%2]."\">\n";
       }

     $listesortir .= "". $photo ."";
     $listesortir .= "".$sortir->texteSortir."<br> \n";
     $listesortir .= "<em>".$sortir->infoSortir."</em></p>\n";
     $listesortir .= "<p align=\"right\"><b>Catégorie(s) : <a href=\"indexdate.php?cat=".$sortir->idCat."&date=$date\">".$sortir->nomCategorie."</a></b>\n";

     $listesortir .= "$listecat2";

	$listecat2= "";
	$listesscat2= "";

	/********************************************************/
	/* Zone d'admin *****************************************/
	if ($SESSION_STATUT=="artadmin" || $SESSION_STATUT=="auteurqal" ) {
	$listesortir .= "<p align=\"center\"><b><a href=\"../artzone/agendasaisie.php?id_manif=$sortir->id_sortir\" target=\"_blank\">Modifier</a>\n";
	$listesortir .= " - <a href=\"../artzone/agendasupp.php?id_manif=$sortir->id_sortir\" target=\"_blank\">Supprimer</a></b>&nbsp;\n";
	}
	/********************************************************/

     $listesortir .= "<hr color=\"#ff0000\" SIZE=\"1\">\n";
    }

//-----------------------------------------------------------------------
// Deuxieme partie du code de pagination
// (à modifier si vous avez d'autres données à faire circuler dans l'URL)
//-----------------------------------------------------------------------
if ($page != 0) { 
   $back_page = $page - $limit;
   $pagination .= "<a href=\"$PHP_SELF?page=$back_page&limit=$limit\"><<</a>\n";
}

for ($i=1; $i <= $pages; $i++) {
   $ppage = $limit*($i - 1);
     if ($ppage == $page){
       //------
         if ($total == 1) {
           $pagination .= "";
         } else { 
         $pagination .= "<b>$i</b> \n";
         }
       //-----
     } else {
         $pagination .= "<a href=\"$PHP_SELF?page=$ppage&limit=$limit\">$i</a> \n";
     }
}

if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { 
     $next_page = $page + $limit;
     $pagination .= "<a href=\"$PHP_SELF?page=$next_page&limit=$limit\">>></a>\n";
}

if (! $pagination) {
         $finpag .= "<br>";
} else {
         $debutpag .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" class=\"entete2\"><tr class=\"entete2\"><td>";
         $debutpag .= "&nbsp;$LG_ALPAGE ";
         $finpag .= "</td></tr></table>";
}

}



//------------
//presentation
//------------



$milieu="$debutpag $pagination $finpag";
$milieu .="$entete2";
$milieu .="$listesortir";
$milieu .="$debutpag $pagination $finpag";

$css .="\n<LINK TITLE=\"style\" TYPE=\"text/CSS\" rel=\"stylesheet\" HREF=\"../templates/temp$SESSION_SKIN/agenda.css\">\n";


//le template
//------------

 $SESSION_SKIN=$_SESSION['SESSION_SKIN'];
 include("../templates/temp$SESSION_SKIN/temp.html");
 echo $arti;
mysql_close();
?>
