Commit 307b9cc6 authored by mbriand's avatar mbriand

nan mais faut pas rester tout seul, ca se fait pas ! (+bonus reindent)

parent 1893297c
...@@ -29,7 +29,7 @@ require_once($topdir . "include/entities/cotisation.inc.php"); ...@@ -29,7 +29,7 @@ require_once($topdir . "include/entities/cotisation.inc.php");
$site = new site (); $site = new site ();
if (!$site->user->is_in_group ("gestion_ae")) if (!$site->user->is_in_group ("gestion_ae"))
$site->error_forbidden(); $site->error_forbidden("accueil");
if ( $_REQUEST["action"] == "pdf" ) if ( $_REQUEST["action"] == "pdf" )
{ {
...@@ -63,7 +63,7 @@ if ( $_REQUEST["action"] == "pdf" ) ...@@ -63,7 +63,7 @@ if ( $_REQUEST["action"] == "pdf" )
} }
$site->start_page ("none", "Cartes AE"); $site->start_page ("accueil", "Cartes AE");
$cts = new contents("Cartes AE"); $cts = new contents("Cartes AE");
......
...@@ -31,9 +31,9 @@ require_once($topdir."include/cts/board.inc.php"); ...@@ -31,9 +31,9 @@ require_once($topdir."include/cts/board.inc.php");
$site = new site (); $site = new site ();
if ( !$site->user->is_in_group("moderateur_site") ) if ( !$site->user->is_in_group("moderateur_site") )
$site->error_forbidden(); $site->error_forbidden("accueil");
$site->start_page("none","Tâches courantes Com` AE"); $site->start_page("accueil","Tâches courantes Com` AE");
$cts = new contents("Tâches courantes de la Com` AE"); $cts = new contents("Tâches courantes de la Com` AE");
......
...@@ -30,9 +30,9 @@ require_once($topdir."include/cts/board.inc.php"); ...@@ -30,9 +30,9 @@ require_once($topdir."include/cts/board.inc.php");
$site = new site (); $site = new site ();
if ( !$site->user->is_in_group("compta_admin") ) if ( !$site->user->is_in_group("compta_admin") )
$site->error_forbidden(); $site->error_forbidden("accueil");
$site->start_page("none","Tâches courantes des trésoriers AE"); $site->start_page("accueil","Tâches courantes des trésoriers AE");
$cts = new contents("Tâches courantes des trésoriers AE"); $cts = new contents("Tâches courantes des trésoriers AE");
......
...@@ -40,7 +40,7 @@ require_once($topdir. "include/entities/partenariat_utl.inc.php"); ...@@ -40,7 +40,7 @@ require_once($topdir. "include/entities/partenariat_utl.inc.php");
$site = new site (); $site = new site ();
if ( !$site->user->is_in_group("gestion_ae") ) if ( !$site->user->is_in_group("gestion_ae") )
$site->error_forbidden(); $site->error_forbidden("services");
if (date("m-d") < "02-15") if (date("m-d") < "02-15")
{ {
...@@ -71,7 +71,7 @@ $partenariats = array(1=> "Ce cotisant vient d'ouvrir un compte à la Société ...@@ -71,7 +71,7 @@ $partenariats = array(1=> "Ce cotisant vient d'ouvrir un compte à la Société
2=> "Ce cotisant est à la SMEREB", 2=> "Ce cotisant est à la SMEREB",
); );
$site->start_page ("none", "Gestion des cotisations"); $site->start_page ("services", "Gestion des cotisations");
function add_search_form() function add_search_form()
{ {
...@@ -231,7 +231,7 @@ elseif ( $_REQUEST["action"] == "savecotiz" ) ...@@ -231,7 +231,7 @@ elseif ( $_REQUEST["action"] == "savecotiz" )
if ( $user->id < 0 ) if ( $user->id < 0 )
{ {
$site->error_not_found(); $site->error_not_found("services");
exit(); exit();
} }
else else
...@@ -449,7 +449,7 @@ elseif ( $_REQUEST["action"] == "searchstudent" ) ...@@ -449,7 +449,7 @@ elseif ( $_REQUEST["action"] == "searchstudent" )
$user->load_by_id($res['id_utl']); $user->load_by_id($res['id_utl']);
if ( $user->id < 0 ) if ( $user->id < 0 )
{ {
$site->error_not_found(); $site->error_not_found("services");
exit(); exit();
} }
...@@ -595,7 +595,7 @@ elseif ( $_REQUEST["action"] == "newcotiz" ) ...@@ -595,7 +595,7 @@ elseif ( $_REQUEST["action"] == "newcotiz" )
$user->load_by_id($_REQUEST['id_utilisateur']); $user->load_by_id($_REQUEST['id_utilisateur']);
if ( $user->id < 0 ) if ( $user->id < 0 )
{ {
$site->error_not_found(); $site->error_not_found("services");
exit(); exit();
} }
......
This diff is collapsed.
...@@ -30,9 +30,9 @@ require_once($topdir."include/cts/board.inc.php"); ...@@ -30,9 +30,9 @@ require_once($topdir."include/cts/board.inc.php");
$site = new site (); $site = new site ();
if ( !$site->user->is_in_group("gestion_ae") ) if ( !$site->user->is_in_group("gestion_ae") )
$site->error_forbidden("none","group","gestion_ae"); $site->error_forbidden("accueil","group","gestion_ae");
$site->start_page("none","Tâches courantes AE"); $site->start_page("accueil","Tâches courantes AE");
$cts = new contents("Tâches courantes AE"); $cts = new contents("Tâches courantes AE");
......
...@@ -34,9 +34,9 @@ require_once($topdir."include/entities/files.inc.php"); ...@@ -34,9 +34,9 @@ require_once($topdir."include/entities/files.inc.php");
$site = new site (); $site = new site ();
if (!$site->user->is_in_group ("moderateur_site")) if (!$site->user->is_in_group ("moderateur_site"))
$site->error_forbidden(); $site->error_forbidden("accueil");
$site->start_page ("none", "Modération des affiches"); $site->start_page ("services", "Modération des affiches");
/*suppression via la sqltable */ /*suppression via la sqltable */
if ((isset($_REQUEST['id_affiche'])) if ((isset($_REQUEST['id_affiche']))
......
...@@ -36,7 +36,7 @@ require_once($topdir."include/entities/folder.inc.php"); ...@@ -36,7 +36,7 @@ require_once($topdir."include/entities/folder.inc.php");
$site = new site (); $site = new site ();
if ( !$site->user->is_in_group("moderateur_site") ) if ( !$site->user->is_in_group("moderateur_site") )
$site->error_forbidden(); $site->error_forbidden("fichiers");
if ( $_REQUEST["action"] == "foldermodere") if ( $_REQUEST["action"] == "foldermodere")
...@@ -80,7 +80,7 @@ elseif ( $_REQUEST["action"] == "filedelete") ...@@ -80,7 +80,7 @@ elseif ( $_REQUEST["action"] == "filedelete")
} }
} }
$site->start_page("none","Modération des fichiers"); $site->start_page("fichiers","Modération des fichiers");
$cts = new contents("Modération"); $cts = new contents("Modération");
$req = new requete($site->db,"SELECT d_folder.* " . $req = new requete($site->db,"SELECT d_folder.* " .
......
...@@ -33,7 +33,7 @@ require_once($topdir. "include/cts/planning.inc.php"); ...@@ -33,7 +33,7 @@ require_once($topdir. "include/cts/planning.inc.php");
$site = new site (); $site = new site ();
if ( !$site->user->is_in_group("gestion_ae") ) if ( !$site->user->is_in_group("gestion_ae") )
$site->error_forbidden(); $site->error_forbidden("accueil");
$emp = new emprunt ( $site->db, $site->dbrw ); $emp = new emprunt ( $site->db, $site->dbrw );
$asso = new asso($site->db); $asso = new asso($site->db);
......
...@@ -35,9 +35,9 @@ require_once($topdir . "include/entities/lieu.inc.php"); ...@@ -35,9 +35,9 @@ require_once($topdir . "include/entities/lieu.inc.php");
$site = new site (); $site = new site ();
if (!$site->user->is_in_group ("moderateur_site")) if (!$site->user->is_in_group ("moderateur_site"))
$site->error_forbidden(); $site->error_forbidden("accueil");
$site->start_page ("none", "Modération des nouvelles"); $site->start_page ("accueil", "Modération des nouvelles");
/*suppression via la sqltable */ /*suppression via la sqltable */
if ((isset($_REQUEST['id_nouvelle'])) if ((isset($_REQUEST['id_nouvelle']))
...@@ -49,7 +49,7 @@ if ((isset($_REQUEST['id_nouvelle'])) ...@@ -49,7 +49,7 @@ if ((isset($_REQUEST['id_nouvelle']))
$news->delete (); $news->delete ();
$site->add_contents (new contents("Suppression", $site->add_contents (new contents("Suppression",
"<p>Suppression eff&eacute;ctu&eacute;e avec succ&egrave;s</p>")); "<p>Suppression eff&eacute;ctu&eacute;e avec succ&egrave;s</p>"));
} }
/* moderation */ /* moderation */
...@@ -66,7 +66,7 @@ if ((isset($_REQUEST['id_nws'])) ...@@ -66,7 +66,7 @@ if ((isset($_REQUEST['id_nws']))
$news->load_by_id ($id); $news->load_by_id ($id);
$news->delete (); $news->delete ();
$site->add_contents (new contents("Suppression", $site->add_contents (new contents("Suppression",
"<p>Suppression eff&eacute;ctu&eacute;e avec succ&egrave;s</p>")); "<p>Suppression eff&eacute;ctu&eacute;e avec succ&egrave;s</p>"));
} }
/* accepte en moderation */ /* accepte en moderation */
if (isset($_REQUEST['accept'])) if (isset($_REQUEST['accept']))
...@@ -77,25 +77,25 @@ if ((isset($_REQUEST['id_nws'])) ...@@ -77,25 +77,25 @@ if ((isset($_REQUEST['id_nws']))
$news->load_by_id($id); $news->load_by_id($id);
$news->save_news( $news->save_news(
$_REQUEST['id_asso'], $_REQUEST['id_asso'],
$_REQUEST['nws_title'], $_REQUEST['nws_title'],
$_REQUEST['nws_sum'], $_REQUEST['nws_sum'],
$_REQUEST['nws_cts'], $_REQUEST['nws_cts'],
true,$site->user->id,$_REQUEST['type'],$lieu->id,$news->id_canal); true,$site->user->id,$_REQUEST['type'],$lieu->id,$news->id_canal);
$site->add_contents (new contents("Mod&eacute;ration", $site->add_contents (new contents("Mod&eacute;ration",
"<p>Mod&eacute;ration eff&eacute;ctu&eacute;e avec succ&egrave;s</p>")); "<p>Mod&eacute;ration eff&eacute;ctu&eacute;e avec succ&egrave;s</p>"));
if ( isset($_REQUEST["dfile"])) if ( isset($_REQUEST["dfile"]))
{ {
$fl = new dfile($site->db,$site->dbrw); $fl = new dfile($site->db,$site->dbrw);
foreach($_REQUEST["dfile"]as $id=>$chk) foreach($_REQUEST["dfile"]as $id=>$chk)
{ {
$fl->load_by_id($id); $fl->load_by_id($id);
$fl->set_modere(); $fl->set_modere();
} }
} }
} }
} }
...@@ -111,25 +111,25 @@ if (isset($_REQUEST['id_nouvelle']) && ...@@ -111,25 +111,25 @@ if (isset($_REQUEST['id_nouvelle']) &&
$news->load_by_id ($_REQUEST['id_nouvelle']); $news->load_by_id ($_REQUEST['id_nouvelle']);
$site->add_contents(new contents ("Aper&ccedil;u de la nouvelle :", $site->add_contents(new contents ("Aper&ccedil;u de la nouvelle :",
"<p>Dans le cadre ci-dessous, vous allez avoir un ". "<p>Dans le cadre ci-dessous, vous allez avoir un ".
"aper&ccedil;u de la nouvelle</p>")); "aper&ccedil;u de la nouvelle</p>"));
$site->add_contents ($news->get_contents ()); $site->add_contents ($news->get_contents ());
/* on affiche un formulaire d'edition */ /* on affiche un formulaire d'edition */
$form = new form ("edit_nws", $form = new form ("edit_nws",
"moderenews.php?id_nws=".$_REQUEST['id_nouvelle']. "moderenews.php?id_nws=".$_REQUEST['id_nouvelle'].
"&action=mod", "&action=mod",
true, true,
"post", "post",
"Edition de \"".$news->titre."\""); "Edition de \"".$news->titre."\"");
$form->add_select_field ("type", $form->add_select_field ("type",
"Type de nouvelle", array( 3 => "Appel/concours", "Type de nouvelle", array( 3 => "Appel/concours",
1 => "Évenement ponctuel", 1 => "Évenement ponctuel",
2 => "Séance hebdomadaire", 2 => "Séance hebdomadaire",
0 => "Info/résultat") 0 => "Info/résultat")
,$news->type); ,$news->type);
$form->add_entity_select("id_asso", "Association concern&eacute;e", $site->db, "asso",$news->id_asso,true); $form->add_entity_select("id_asso", "Association concern&eacute;e", $site->db, "asso",$news->id_asso,true);
$form->add_entity_select("id_lieu", "Lieu", $site->db, "lieu",$news->id_lieu,true); $form->add_entity_select("id_lieu", "Lieu", $site->db, "lieu",$news->id_lieu,true);
...@@ -143,21 +143,21 @@ if (isset($_REQUEST['id_nouvelle']) && ...@@ -143,21 +143,21 @@ if (isset($_REQUEST['id_nouvelle']) &&
/* contenu */ /* contenu */
$form->add_text_area ("nws_cts","Contenu :",$news->contenu,80,10,true); $form->add_text_area ("nws_cts","Contenu :",$news->contenu,80,10,true);
$matches=null; $matches=null;
preg_match_all("`\(\(dfile:\/\/([0-9]+)(\/thumb|\/preview)?\|(.*)\)\)`U",$news->contenu,$matches); preg_match_all("`\(\(dfile:\/\/([0-9]+)(\/thumb|\/preview)?\|(.*)\)\)`U",$news->contenu,$matches);
if ( count($matches[1]) ) if ( count($matches[1]) )
{ {
$fl = new dfile($site->db); $fl = new dfile($site->db);
foreach($matches[1] as $id) foreach($matches[1] as $id)
{ {
$fl->load_by_id($id); $fl->load_by_id($id);
if ( !$fl->modere ) if ( !$fl->modere )
{ {
$form->add_checkbox("dfile|".$fl->id,"Accepter de m&ecirc;me l'image contenue dans la nouvelle : ".$fl->get_html_link(),true); $form->add_checkbox("dfile|".$fl->id,"Accepter de m&ecirc;me l'image contenue dans la nouvelle : ".$fl->get_html_link(),true);
} }
} }
} }
$form->add_submit("accept", "Accepter"); $form->add_submit("accept", "Accepter");
$form->add_submit("delete", "Supprimer"); $form->add_submit("delete", "Supprimer");
...@@ -184,7 +184,7 @@ else ...@@ -184,7 +184,7 @@ else
`utilisateurs`.`nom_utl`) AS `nom_utilisateur` `utilisateurs`.`nom_utl`) AS `nom_utilisateur`
FROM `nvl_nouvelles` FROM `nvl_nouvelles`
LEFT JOIN `asso` ON LEFT JOIN `asso` ON
`asso`.`id_asso` = `asso`.`id_asso` =
`nvl_nouvelles`.`id_asso` `nvl_nouvelles`.`id_asso`
INNER JOIN `utilisateurs` ON INNER JOIN `utilisateurs` ON
...@@ -194,22 +194,22 @@ else ...@@ -194,22 +194,22 @@ else
WHERE `modere_nvl`='0' ORDER BY `date_nvl`"); WHERE `modere_nvl`='0' ORDER BY `date_nvl`");
$modhelp = new contents("Mod&eacute;ration des nouvelles", $modhelp = new contents("Mod&eacute;ration des nouvelles",
"<p>Sur cette page, vous pouvez mod&eacute;rer ". "<p>Sur cette page, vous pouvez mod&eacute;rer ".
"les nouvelles</p>"); "les nouvelles</p>");
$tabl = new sqltable ("moderenews_list", $tabl = new sqltable ("moderenews_list",
"Nouvelles en attente de mod&eacute;ration", "Nouvelles en attente de mod&eacute;ration",
$req, $req,
"moderenews.php", "moderenews.php",
"id_nouvelle", "id_nouvelle",
array ("titre_nvl" => "Titre", array ("titre_nvl" => "Titre",
"nom_utilisateur" => "Auteur", "nom_utilisateur" => "Auteur",
"date_nvl" => "Date"), "date_nvl" => "Date"),
array ("edit" => "moderer", array ("edit" => "moderer",
"delete" => "supprimer"), "delete" => "supprimer"),
array (), array (),
array ()); array ());
$modhelp->add ($tabl); $modhelp->add ($tabl);
$site->add_contents ($modhelp); $site->add_contents ($modhelp);
......
...@@ -36,7 +36,7 @@ require_once($topdir. "include/cts/planning.inc.php"); ...@@ -36,7 +36,7 @@ require_once($topdir. "include/cts/planning.inc.php");
$site = new site (); $site = new site ();
if ( !$site->user->is_in_group("gestion_ae") && !$site->user->is_in_group("bdf-bureau") ) if ( !$site->user->is_in_group("gestion_ae") && !$site->user->is_in_group("bdf-bureau") )
$site->error_forbidden(); $site->error_forbidden("services");
$sfilter=''; $sfilter='';
$filter=''; $filter='';
...@@ -124,7 +124,7 @@ elseif ( $_REQUEST["action"] == "info") ...@@ -124,7 +124,7 @@ elseif ( $_REQUEST["action"] == "info")
if (isset($_REQUEST["notes"])) if (isset($_REQUEST["notes"]))
$resa->set_notes($_REQUEST["notes"]); $resa->set_notes($_REQUEST["notes"]);
$site->start_page("none","Moderation des reservations de salle"); $site->start_page("services","Moderation des reservations de salle");
$cts = new contents("Reservation n°".$resa->id); $cts = new contents("Reservation n°".$resa->id);
...@@ -174,7 +174,7 @@ elseif ( $_REQUEST["action"] == "info") ...@@ -174,7 +174,7 @@ elseif ( $_REQUEST["action"] == "info")
exit(); exit();
} }
$site->start_page("none","Moderation des reservations de salle"); $site->start_page("services","Moderation des reservations de salle");
if($site->user->is_in_group("gestion_ae")) if($site->user->is_in_group("gestion_ae"))
......
...@@ -29,7 +29,7 @@ require_once($topdir . "include/entities/tag.inc.php"); ...@@ -29,7 +29,7 @@ require_once($topdir . "include/entities/tag.inc.php");
$site = new site (); $site = new site ();
if (!$site->user->is_in_group ("moderateur_site")) if (!$site->user->is_in_group ("moderateur_site"))
$site->error_forbidden("none","group",8); $site->error_forbidden("accueil","group",8);
if ( $_REQUEST["action"] == "modere" ) if ( $_REQUEST["action"] == "modere" )
{ {
...@@ -50,7 +50,7 @@ elseif ( $_REQUEST["action"] == "delete" ) ...@@ -50,7 +50,7 @@ elseif ( $_REQUEST["action"] == "delete" )
} }
} }
$site->start_page ("none", "Modération des tags"); $site->start_page ("accueil", "Modération des tags");
$cts = new contents("Modération des tags"); $cts = new contents("Modération des tags");
...@@ -58,14 +58,14 @@ $req = new requete($site->db,"SELECT * FROM tag WHERE modere_tag='0' ORDER BY no ...@@ -58,14 +58,14 @@ $req = new requete($site->db,"SELECT * FROM tag WHERE modere_tag='0' ORDER BY no
$tbl = new sqltable ("moderetag_list", $tbl = new sqltable ("moderetag_list",
"", "",
$req, $req,
"moderetag.php", "moderetag.php",
"id_tag", "id_tag",
array ("nom_tag" => "Tag"), array ("nom_tag" => "Tag"),
array (), array (),
array ("modere"=>"Accepter","delete" => "Refuser"), array ("modere"=>"Accepter","delete" => "Refuser"),
array ()); array ());
$cts->add ($tbl); $cts->add ($tbl);
$site->add_contents ($cts); $site->add_contents ($cts);
......
...@@ -33,10 +33,10 @@ $partenaires=array(1=>"Société Générale", 2=>"SMEREB"); ...@@ -33,10 +33,10 @@ $partenaires=array(1=>"Société Générale", 2=>"SMEREB");
$site = new site (); $site = new site ();
if ( !$site->user->is_in_group("gestion_ae") ) if ( !$site->user->is_in_group("gestion_ae") )
$site->error_forbidden("none","group","gestion_ae"); $site->error_forbidden("services","group","gestion_ae");
$site->add_js("js/sqltable2.js"); $site->add_js("js/sqltable2.js");
$site->start_page("utl_partenariats","Partenariats en attente"); $site->start_page("services","Partenariats en attente");
$partenariat = new Partenariat($site->db, $site->dbrw); $partenariat = new Partenariat($site->db, $site->dbrw);
if ($_REQUEST['action'] == "add") if ($_REQUEST['action'] == "add")
......
...@@ -31,7 +31,7 @@ require_once($topdir."include/entities/files.inc.php"); ...@@ -31,7 +31,7 @@ require_once($topdir."include/entities/files.inc.php");
$site = new site (); $site = new site ();
if (!$site->user->is_in_group ("gestion_ae")) if (!$site->user->is_in_group ("gestion_ae"))
$site->error_forbidden(); $site->error_forbidden("accueil");
if ($_REQUEST['action'] == "pdf") if ($_REQUEST['action'] == "pdf")
{ {
...@@ -58,7 +58,7 @@ if ($_REQUEST['action'] == "pdf") ...@@ -58,7 +58,7 @@ if ($_REQUEST['action'] == "pdf")
exit(); exit();
} }
$site->start_page("none", "Génération d'un planning de la semaine"); $site->start_page("accueil", "Génération d'un planning de la semaine");
/* Deuxième formulaire : on choisit les évènements /* Deuxième formulaire : on choisit les évènements
*/ */
......
...@@ -37,10 +37,10 @@ require_once($topdir. "include/cts/sqltable.inc.php"); ...@@ -37,10 +37,10 @@ require_once($topdir. "include/cts/sqltable.inc.php");
$site = new site (); $site = new site ();
if (!$site->user->is_in_group ("moderateur_site")) if (!$site->user->is_in_group ("moderateur_site"))
$site->error_forbidden(); $site->error_forbidden("accueil");
/* else */ /* else */
$site->start_page ("none", "Gestion du site"); $site->start_page ("accueil", "Gestion du site");
/* objets graphiques de base */ /* objets graphiques de base */
......
...@@ -28,107 +28,107 @@ require_once($topdir. "include/entities/sondage.inc.php"); ...@@ -28,107 +28,107 @@ require_once($topdir. "include/entities/sondage.inc.php");
$site = new site (); $site = new site ();
if (!$site->user->is_in_group ("moderateur_site")) if (!$site->user->is_in_group ("moderateur_site"))
$site->error_forbidden(); $site->error_forbidden("accueil");
$site->start_page ("none", "Sondages"); $site->start_page ("accueil", "Sondages");
if (isset($_REQUEST["addsdn"]) && $_REQUEST["question"] && $_REQUEST["end_date"]) if (isset($_REQUEST["addsdn"]) && $_REQUEST["question"] && $_REQUEST["end_date"])
{ {
$cts = new contents("Sondage ajouté avec succès"); $cts = new contents("Sondage ajouté avec succès");
$nb=0; $nb=0;
foreach ( $_REQUEST["reponses"] as $rep ) foreach ( $_REQUEST["reponses"] as $rep )
if ( $rep ) $nb++; if ( $rep ) $nb++;
if ( $nb > 1 ) if ( $nb > 1 )
{ {
$sdn = new sondage($site->db,$site->dbrw); $sdn = new sondage($site->db,$site->dbrw);
$sdn->new_sondage($_REQUEST["question"], $_REQUEST["end_date"]); $sdn->new_sondage($_REQUEST["question"], $_REQUEST["end_date"]);
foreach ( $_REQUEST["reponses"] as $rep ) foreach ( $_REQUEST["reponses"] as $rep )
{ {
if ( $rep ) if ( $rep )
$sdn->add_reponse($rep); $sdn->add_reponse($rep);
} }
$cts->add_paragraph("<img src=\"".$topdir."images/actions/done.png\">&nbsp;Le sondage \"".$sdn->question."\" a bien été ajouté."); $cts->add_paragraph("<img src=\"".$topdir."images/actions/done.png\">&nbsp;Le sondage \"".$sdn->question."\" a bien été ajouté.");
$site->add_contents($cts,true); $site->add_contents($cts,true);
unset($_REQUEST["question"]); unset($_REQUEST["question"]);
unset($_REQUEST["reponses"]); unset($_REQUEST["reponses"]);
unset($_REQUEST["end_date"]); unset($_REQUEST["end_date"]);
} }
} }
if (isset($_REQUEST["editsdn"]) && $_REQUEST["question"] && $_REQUEST["reponses"] && $_REQUEST["end_date"]) if (isset($_REQUEST["editsdn"]) && $_REQUEST["question"] && $_REQUEST["reponses"] && $_REQUEST["end_date"])
{ {
$nb=0; $nb=0;
foreach ( $_REQUEST["reponses"] as $rep ) foreach ( $_REQUEST["reponses"] as $rep )
if ( $rep ) $nb++; if ( $rep ) $nb++;
if ( $nb > 1 ) if ( $nb > 1 )
{ {
$sdn = new sondage($site->db,$site->dbrw); $sdn = new sondage($site->db,$site->dbrw);
$sdn->load_lastest(); $sdn->load_lastest();
$sdn->update_sondage($_REQUEST["question"], $_REQUEST["total_reponses"] , $_REQUEST["date_sondage"], $_REQUEST["end_date"]); $sdn->update_sondage($_REQUEST["question"], $_REQUEST["total_reponses"] , $_REQUEST["date_sondage"], $_REQUEST["end_date"]);
foreach ( $_REQUEST["reponses"] as $num=>$rep) foreach ( $_REQUEST["reponses"] as $num=>$rep)
{ {
if ( $rep ) if ( $rep )
$sdn->update_reponse($rep,$num); $sdn->update_reponse($rep,$num);
else else
$sdn->remove_reponse($num); $sdn->remove_reponse($num);
} }