correction (non totalement testée) des valid_*
authorx2000habouzit <x2000habouzit>
Tue, 27 Jan 2004 09:08:55 +0000 (09:08 +0000)
committerx2000habouzit <x2000habouzit>
Tue, 27 Jan 2004 09:08:55 +0000 (09:08 +0000)
implémentation de la validation
si la page utilise popwin, c'est dit dans new_*_page (modif de l'API)

15 files changed:
htdocs/admin/valider.php [new file with mode: 0644]
htdocs/login.php
htdocs/preferences.php
include/auto.prepend.inc.php
include/valid_aliases.inc.php
include/valid_emploi.inc.php
include/valid_epouses.inc.php
include/valid_evts.inc.php
include/valid_ml.inc.php
include/valid_photos.inc.php
include/valid_sondages.inc.php
include/validations.inc.php
templates/admin/valider.tpl [new file with mode: 0644]
templates/login.head.tpl
templates/skin/common.header.tpl

diff --git a/htdocs/admin/valider.php b/htdocs/admin/valider.php
new file mode 100644 (file)
index 0000000..f54e838
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+require("auto.prepend.inc.php");
+require("validations.inc.php");
+new_admin_page('admin/valider.tpl',true);
+
+if(isset($_REQUEST["uid"]) and isset($_REQUEST["type"])
+        and isset($_REQUEST["stamp"])) {
+    $req = Validate::get_request($_REQUEST["uid"],$_REQUEST['type'],$_REQUEST["stamp"]);
+    if($req)
+        $page->assign('mail', $req->handle_formu());
+}
+
+$it = new ValidateIterator ();
+
+$valids = Array();
+while($valids[] = $it->next());
+array_pop($valids);
+
+$page->assign_by_ref('valids', $valids);
+
+$page->display();
+?>
index aa0327c..94915d3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 require("auto.prepend.inc.php");
-new_skinned_page('login.tpl', AUTH_COOKIE, 'login.head.tpl');
+new_skinned_page('login.tpl', AUTH_COOKIE, true, 'login.head.tpl');
 
 $param=mysql_query("SELECT date,naissance FROM auth_user_md5 WHERE user_id={$_SESSION['uid']};");
 list($date,$naissance) = mysql_fetch_row($param);
index 9706a5f..ce8d73e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 require("auto.prepend.inc.php");
-new_skinned_page('preferences.tpl', AUTH_COOKIE, 'preferences.head.tpl');
+new_skinned_page('preferences.tpl', AUTH_COOKIE, false, 'preferences.head.tpl');
 
 $has_cookie = (isset($_COOKIE['ORGaccess']) ? 'cookie' : '');
 $page->assign('has_cookie', $has_cookie);
index b779a10..c2e0852 100644 (file)
@@ -2,7 +2,7 @@
 ini_set('include_path', ".:..:/home/x2000habouzit/dev/public/include:/home/x2000habouzit/dev/diogenes/lib/:/home/x2000habouzit/dev/smarty/");
 require("xorg.common.inc.php");
 
-function _new_page($type, $tpl_name, $tpl_head, $min_auth, $admin=false) {
+function _new_page($type, $tpl_name, $tpl_head, $min_auth, $popup=false, $admin=false) {
     global $page,$globals;
     require("xorg.page.inc.php");
     if(!empty($admin)) {
@@ -25,21 +25,23 @@ function _new_page($type, $tpl_name, $tpl_head, $min_auth, $admin=false) {
 
     $page->assign('xorg_head', $tpl_head);
     $page->assign('xorg_tpl', $tpl_name);
+    if($popup)
+        $page->assign('popup_enable', true);
 
     $page->compile_check=true;
     $page->caching=true;
 }
 
-function new_skinned_page($tpl_name, $min_auth, $tpl_head="") {
-    _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth);
+function new_skinned_page($tpl_name, $min_auth, $popup=false, $tpl_head="") {
+    _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth, $popup);
 }
 
-function new_popup_page($tpl_name, $min_auth, $tpl_head="") {
-    _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth);
+function new_popup_page($tpl_name, $min_auth, $popup=false, $tpl_head="") {
+    _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth, $popup);
 }
 
-function new_admin_page($tpl_name, $tpl_head="") {
-    _new_page(SKINNED, $tpl_name, $tpl_head, AUTH_MDP, true);
+function new_admin_page($tpl_name, $popup=false, $tpl_head="") {
+    _new_page(SKINNED, $tpl_name, $tpl_head, AUTH_MDP, $popup, true);
 }
 
 ?>
index d82a8c3..ab546e5 100644 (file)
@@ -25,30 +25,30 @@ class AliasReq extends Validate {
         return parent::get_unique_request($uid,'alias');
     }
 
-    function echo_formu() {
-        require_once("popwin.inc.php");
-?>
-        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
-        <input type="hidden" name="uid" value="<?php echo $this->uid ?>">
-        <input type="hidden" name="type" value="<?php echo $this->type ?>">
-        <input type="hidden" name="stamp" value="<?php echo $this->stamp ?>">
+    function formu() {
+        $old = $this->old ? "({$this->old})" : "";
+        $raison = nl2br(stripslashes(htmlentities($this->raison)));
+        return <<<________EOF
+        <form action="{$_SERVER['PHP_SELF']}" method="POST">
+        <input type="hidden" name="uid" value="{$this->uid}">
+        <input type="hidden" name="type" value="{$this->type}">
+        <input type="hidden" name="stamp" value="{$this->stamp}">
         <table class="bicol" align="center" cellpadding="4" summary="Demande d'alias">
         <tr>
             <td>Demandeur&nbsp;:
             </td>
-            <td><a href="javascript:x()" onclick="popWin('/x.php?x=<?php echo $this->username; ?>')"><?php
-                    echo $this->prenom." ".$this->nom;?></a>
-                <?php if(isset($this->old)) echo "({$this->old})";?>
+            <td><a href="javascript:x()" onclick="popWin('/x.php?x={$this->username}">
+                {$this->prenom} {$this->nom}</a> $old
             </td>
         </tr>
         <tr>
             <td>Nouvel&nbsp;alias&nbsp;:</td>
-            <td><?php echo $this->alias;?>@melix.net</td>
+            <td>{$this->alias}@melix.net</td>
         </tr>
         <tr>
             <td>Motif :</td>
             <td style="border: 1px dotted inherit">
-                <?php echo nl2br($this->raison);?>
+                $raison
             </td>
         </tr>
         <tr>
@@ -64,7 +64,7 @@ class AliasReq extends Validate {
         </tr>
         </table>
         </form>
-<?php
+________EOF;
     }
 
     function handle_formu () {
@@ -75,11 +75,11 @@ class AliasReq extends Validate {
                 || ($_REQUEST['submit']!="Accepter"    && $_REQUEST['submit']!="Refuser"))
             return false;
 
-        require_once("mailer.inc.php");
+        require_once("diogenes.mailer.inc.php");
         $mxnet = $this->alias."@melix.net";
         $mxorg = $this->alias."@melix.org";
 
-        $mymail = new mailer('Equipe Polytechnique.org <validation+melix@polytechnique.org>', 
+        $mymail = new DiogenesMailer('Equipe Polytechnique.org <validation+melix@polytechnique.org>', 
                 $this->username."@polytechnique.org",
                 "[Polytechnique.org/MELIX] Demande de l'alias $mxnet par ".$this->username,
                 false, "validation+melix@m4x.org");
@@ -108,9 +108,9 @@ class AliasReq extends Validate {
         $message = wordwrap($message,78);  
         $mymail->setBody($message);
         $mymail->send();
-        echo "<br />Mail envoyé";
         //Suppression de la demande
         $this->clean();
+        return "Mail envoyé";
     }
 
     function commit () {
index 30e20b8..fb86d5f 100644 (file)
@@ -18,59 +18,50 @@ class EmploiReq extends Validate {
         return false; // non unique
     }
 
-    function echo_formu() {
-?>
-<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
-    <input type="hidden" name="uid" value="<?php echo $this->uid; ?>" />
-    <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
-    <input type="hidden" name="stamp" value="<?php echo $this->stamp; ?>" />
-    <table class="bicol" align="center" cellpadding="4" summary="Annonce emploi">
-        <thead>
-            <tr>
-                <th colspan="2">
-                    Offre d'emploi
-                </th>
-            </tr>
-        </thead>
-        <tbody>
+    function formu() {
+        $ent = htmlentities($this->entreprise);
+        $mail = htmlentities($this->mail);
+        $titre = htmlentities($this->titre);
+        $texte = wordwrap($this->text, 80);
+        return <<<________EOF
+        <form action="{$_SERVER['PHP_SELF']}" method="POST">
+        <input type="hidden" name="uid" value="{$this->uid}" />
+        <input type="hidden" name="type" value="{$this->type}" />
+        <input type="hidden" name="stamp" value="{$this->stamp}" />
+        <table class="bicol" align="center" cellpadding="4" summary="Annonce emploi">
+          <thead>
+          <tr>
+            <th colspan="2">Offre d'emploi</th>
+          </tr>
+          </thead>
+          <tbody>
             <tr>
-                <td>
-                    Demandeur
-                </td>
-                <td>
-                    <?php echo htmlentities($this->entreprise).
-                    " (".htmlentities($this->mail).")";?>
-                </td>
+              <td>Demandeur</td>
+              <td>$ent ($mail)</td>
             </tr>
             <tr>
-                <td>
-                    Titre du post
-                </td>
-                <td>
-                    <?php echo htmlentities($this->titre);?>
-                </td>
+              <td>Titre du post</td>
+              <td>$titre</td>
             </tr>
             <tr>
-                <td colspan="2">
-                    <pre><?php echo $this->text;?></pre>
-                </td>
+              <td colspan="2"><pre>{$texte}</pre></td>
             </tr>
             <tr>
-                <td class="bouton" colspan="2">
-                    <input type="submit" name="submit" value="Accepter" />
-                    <input type="submit" name="submit" value="Refuser" />
-                </td>
+              <td class="bouton" colspan="2">
+                <input type="submit" name="submit" value="Accepter" />
+                <input type="submit" name="submit" value="Refuser" />
+              </td>
             </tr>
-        </tbody>
-    </table>
-</form>
-<?php
+          </tbody>
+        </table>
+        </form>
+________EOF;
     }
 
     function handle_formu() {
         if (isset($_POST['submit'])) {
-            require("mailer.inc.php");
-            $mymail = new mailer('Equipe Polytechnique.org '
+            require("diogenes.mailer.inc.php");
+            $mymail = new DiogenesMailer('Equipe Polytechnique.org '
                 .'<validation+recrutement@polytechnique.org>', 
                 $this->mail,
                 "[Polytechnique.org/EMPLOI] Annonce emploi : ".$this->entreprise,
@@ -120,6 +111,7 @@ class EmploiReq extends Validate {
             $mymail->setBody($message);
             $mymail->send();
             $this->clean();
+            return "Mail envoyé";
         }
     }
 
index 85a77e7..e154904 100644 (file)
@@ -38,45 +38,43 @@ class EpouseReq extends Validate {
         return parent::get_unique_request($uid,'epouse');
     }
 
-    function echo_formu() {
-        require_once("popwin.inc.php");
-?>
-        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
-        <input type="hidden" name="uid" value="<?php echo $this->uid ?>">
-        <input type="hidden" name="type" value="<?php echo $this->type ?>">
-        <input type="hidden" name="stamp" value="<?php echo $this->stamp ?>">
+    function formu() {
+        $old_line = $this->oldepouse ? "({$this->oldepouse} - {$this->oldalias})" : "";
+        $homonyme = "";
+        
+        if (!empty($this->homonyme)) $homonyme = <<<________EOF
+        <tr>
+            <td colspan="2">
+                <span class="erreur">Probleme d'homonymie !
+                <a href="javascript:x()"  onclick="popWin('/x.php?x={$this->homonyme}"> {$this->homonyme}</a>
+                </span>
+            </td>
+        </tr>
+________EOF;
+                
+        return <<<________EOF
+        <form action="{$_SERVER['PHP_SELF']}" method="POST">
+        <input type="hidden" name="uid" value="{$this->uid}">
+        <input type="hidden" name="type" value="{$this->type}">
+        <input type="hidden" name="stamp" value="{$this->stamp}">
         <table class="bicol" align="center" cellpadding="4" summary="Demande d'alias d'épouse">
         <tr>
             <td>Demandeur&nbsp;:</td>
-            <td><a href="javascript:x()" onclick="popWin('/x.php?x=<?php echo $this->username; ?>')">
-                <?php echo $this->prenom." ".$this->nom;?>
+            <td><a href="javascript:x()" onclick="popWin('/x.php?x={$this->username}')">
+                {$this->prenom} {$this->nom}
                 </a>
-                <?php if($this->oldepouse) echo "({$this->oldepouse} - {$this->oldalias})";?>
+                $oldline
             </td>
         </tr>
         <tr>
             <td>&Eacute;pouse&nbsp;:</td>
-            <td><?php echo $this->epouse;?></td>
+            <td>{$this->epouse}</td>
         </tr>
         <tr>
             <td>Nouvel&nbsp;alias&nbsp;:</td>
-            <td><?php echo $this->alias;?></td>
+            <td>{$this->alias}</td>
         </tr>
-<?php
-        if (!empty($this->homonyme)) {
-?>
-        <tr>
-            <td colspan="2">
-                <span class="erreur">Probleme d'homonymie !
-                <a href="javascript:x()"  onclick="popWin('/x.php?x=<?php echo $this->homonyme; ?>')">
-                    <?php echo $this->homonyme;?>
-                </a>
-                </span>
-            </td>
-        </tr>
-<?php
-        }
-?>
+        $homonyme
         <tr>
             <td align="center" valign="middle">
                 <input type="submit" name="submit" value="Accepter">
@@ -90,7 +88,7 @@ class EpouseReq extends Validate {
         </tr>
         </table>
         </form>
-<?php
+________EOF;
     }
 
     function handle_formu () {
@@ -133,16 +131,16 @@ class EpouseReq extends Validate {
             "L'équipe X.org";
 
         $message = wordwrap($message,78);  
-        require_once("mailer.inc.php");
-        $mymail = new mailer('Equipe Polytechnique.org <validation+epouse@polytechnique.org>',
+        require_once("diogenes.mailer.inc.php");
+        $mymail = new DiogenesMailer('Equipe Polytechnique.org <validation+epouse@polytechnique.org>',
                 $this->username."@polytechnique.org",
                 "[Polytechnique.org/EPOUSE] Changement de nom de mariage de ".$this->username,
                 false, "validation+epouse@m4x.org");
         $mymail->setBody($message);
         $mymail->send();
 
-        echo "<br />Mail envoyé";
         $this->clean();
+        return "Mail envoyé";
     }
 
     function commit () {
index e8d7d64..e935129 100644 (file)
@@ -35,88 +35,64 @@ class EvtReq extends Validate {
         return false;  //non unique
     }
 
-    function echo_formu() {
-        require("popwin.inc.php");
-?>
-<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" name="modif">
-  <input type="hidden" name="uid" value="<?php echo $this->uid; ?>" />
-  <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
-  <input type="hidden" name="stamp" value="<?php echo $this->stamp; ?>" />
-  <table class="bicol" width="98%">
-    <thead>
-      <tr>
-        <th colspan="2">
-          Événement
-        </th>
-      </tr>
-    </thead>
-    <tbody>
-      <tr>
-        <td>
-          Posté par <?php echo "<a href=\"javascript:x()\"  "
-          ."onclick=\"popWin('../x.php?x={$this->username}')\">"
-          ."{$this->prenom} {$this->nom} (X{$this->promo})</a> "
-          ."[<a href=\"mailto:{$this->username}@polytechnique.org\">lui "
-          ."écrire</a>]"; ?>
-        </td>
-      </tr>
-      <tr>
-        <td class="bicoltitre">
-          Titre
-        </td>
-        <td>
-          <?php echo $this->titre; ?>
-        </td>
-      </tr>
-      <tr>
-        <td class="bicoltitre">
-          Texte
-        </td>
-        <td>
-          <?php echo $this->texte; ?>
-        </td>
-      </tr>
-      <tr>
-        <td class="bicoltitre">
-          Péremption
-        </td>
-        <td>
-          <?php echo $this->peremption ?>
-        </td>
-      </tr>
-      <tr>
-        <td class="bicoltitre">
-          Promos
-        </td>
-        <td>
-          <?php echo $this->pmin; ?> - <?php echo $this->pmax; ?>
-        </td>
-      </tr>
-      <tr>
-        <td class="bicoltitre">
-          Commentaire
-        </td>
-        <td>
-          <?php echo $this->comment; ?>
-        </td>
-      </tr>
-      <tr>
-        <td class="bouton" colspan="2">
-          <input type="submit" name="action" value="Valider" />
-          <input type="submit" name="action" value="Invalider" />
-          <input type="submit" name="action" value="Supprimer" />
-        </td>
-      </tr>
-    </tbody>
-  </table>
-</form>
-<?php
+    function formu() {
+        return <<<________EOF
+        <form action="{$_SERVER['PHP_SELF']}" method="POST" name="modif">
+          <input type="hidden" name="uid" value="{$this->uid}" />
+          <input type="hidden" name="type" value="{$this->type}" />
+          <input type="hidden" name="stamp" value="{$this->stamp}" />
+          <table class="bicol" width="98%">
+            <thead>
+              <tr>
+                <th colspan="2">Événement</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr>
+                <td>
+                  Posté par <a href="javascript:x()"  onclick="popWin('../x.php?x={$this->username}">
+                    {$this->prenom} {$this->nom} (X{$this->promo})
+                  </a>
+                  [<a href="mailto:{$this->username}@polytechnique.org">lui écrire</a>]"
+                </td>
+              </tr>
+              <tr>
+                <th>Titre</th>
+                <td>{$this->titre}</td>
+              </tr>
+              <tr>
+                <th>Texte</th>
+                <td>{$this->texte}</td>
+              </tr>
+              <tr>
+                <th>Péremption</th>
+                <td>{$this->peremption}</td>
+              </tr>
+              <tr>
+                <th>Promos</th>
+                <td>{$this->pmin} - {$this->pmax}</td>
+              </tr>
+              <tr>
+                <th>Commentaire</th>
+                <td>{$this->comment}</td>
+              </tr>
+              <tr>
+                <td class="bouton" colspan="2">
+                  <input type="submit" name="action" value="Valider" />
+                  <input type="submit" name="action" value="Invalider" />
+                  <input type="submit" name="action" value="Supprimer" />
+                </td>
+              </tr>
+            </tbody>
+          </table>
+        </form>
+________EOF;
     }
 
     function handle_formu() {
         if (isset($_POST['action'])) {
-            require("mailer.inc.php");
-            $mymail = new mailer('Equipe Polytechnique.org '
+            require("diogenes.mailer.inc.php");
+            $mymail = new DiogenesMailer('Equipe Polytechnique.org '
                 .'<validation+recrutement@polytechnique.org>', 
                 $this->username."@polytechnique.org",
                 "[Polytechnique.org/EVENEMENTS] Proposition d'événement",
@@ -153,7 +129,7 @@ class EvtReq extends Validate {
                 "L'équipe X.org";
             $message = wordwrap($message,78);  
             $mymail->setBody($message);
-            if ($_POST['action']!="Supprimer") 
+            if ($_POST['action']!="Supprimer")
                 $mymail->send();
             $this->clean();
         }
index fd3c4e2..8e9204b 100644 (file)
@@ -37,24 +37,46 @@ class MListReq extends Validate {
         return false; // ben oui, c pas un objet unique !!!
     }
 
-    function echo_formu() {
-        require_once("popwin.inc.php");
-?>
-        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
-        <input type="hidden" name="uid" value="<?php echo $this->uid ?>">
-        <input type="hidden" name="type" value="<?php echo $this->type ?>">
-        <input type="hidden" name="stamp" value="<?php echo $this->stamp ?>">
+    function formu() {
+        $comment = nl2br($this->comment);
+
+        $pub = $this->publique ? "checked=\"checked\" " : "";
+        $lib = $this->libre    ? "checked=\"checked\" " : "";
+        $fre = $this->freeins  ? "checked=\"checked\" " : "";
+        $arc = $this->archive  ? "checked=\"checked\" " : "";
+        
+        $sql = mysql_query("SELECT username FROM auth_user_md5"
+            ." WHERE user_id IN ({$this->moderos})"
+            ." ORDER BY nom, prenom");
+        $tab = array();
+        while(list($username) = mysql_fetch_row($sql)) $tab[] = $username;
+        $modero = implode(', ', $tab);
+        mysql_free_result($sql);
+
+        $sql = mysql_query("SELECT username FROM auth_user_md5"
+            ." WHERE user_id IN ({$this->membres})"
+            ." ORDER BY nom, prenom");
+        $tab = array();
+        while(list($username) = mysql_fetch_row($sql)) $tab[] = $username;
+        $membres = implode(', ', $tab);
+        mysql_free_result($sql);
+
+        return <<<________EOF
+        <form action="{$_SERVER['PHP_SELF']}" method="POST">
+        <input type="hidden" name="uid" value="{$this->uid}">
+        <input type="hidden" name="type" value="{$this->type}">
+        <input type="hidden" name="stamp" value="{$this->stamp}">
         <table class="bicol" align="center">
         <tr>
             <td>Demandeur&nbsp;:</td>
-            <td><a href="javascript:x()" onclick="popWin('/x.php?x=<?php echo $this->username; ?>')">
-                <?php echo $this->prenom." ".$this->nom;?>
+            <td><a href="javascript:x()" onclick="popWin('/x.php?x={$this->username}')">
+                {$this->prenom} {$this->nom}
                 </a>
             </td>
         </tr>
         <tr>
             <td>Motif :</td>
-            <td><?php echo nl2br($this->comment);?>
+            <td>{$comment}
             </td>
         </tr>
         <tr>
@@ -62,61 +84,30 @@ class MListReq extends Validate {
                 Alias :
             </td>
             <td style="border-top:1px dotted inherit">
-                <input type="text" name="alias" value="<?php echo $this->alias ?>" />@polytechnique.org
+                <input type="text" name="alias" value="{$this->alias}" />@polytechnique.org
             </td>
         </tr>
         <tr>
             <td>Topic :</td>
-            <td><input type="text" name="topic" size="60" value="<?php echo $this->topic ?>" />
+            <td><input type="text" name="topic" size="60" value="{$this->topic}" />
             </td>
         </tr>
         <tr>
             <td>Propriétés :</td>
             <td>
-                <input type="checkbox" name="publique" <?php
-                    echo($this->publique?"checked=\"checked\"":"")
-                ?>/>Publique
-                <input type="checkbox" name="libre" <?php
-                    echo($this->libre?"checked=\"checked\"":"")
-                ?>/>Libre
-                <input type="checkbox" name="freeins" <?php
-                    echo($this->freeins?"checked=\"checked\"":"")
-                ?>/>Freeins
-                <input type="checkbox" name="archive" <?php
-                    echo($this->archive?"checked=\"checked\"":"")
-                ?>/>Archive
+                <input type="checkbox" name="publique" $pub/>Publique
+                <input type="checkbox" name="libre" $lib/>Libre
+                <input type="checkbox" name="freeins" $fre/>Freeins
+                <input type="checkbox" name="archive" $arc/>Archive
             </td>
         </tr>
         <tr>
-            <td style="border-top:1px dotted inherit">
-                Modéros :
-            </td>
-            <td style="border-top:1px dotted inherit">
-<?php
-                $sql = mysql_query("SELECT username FROM auth_user_md5"
-                    ." WHERE user_id IN ({$this->moderos})"
-                    ." ORDER BY nom, prenom");
-                $tab = array();
-                while(list($username) = mysql_fetch_row($sql))
-                    $tab[] = $username;
-                echo implode(', ', $tab);
-                mysql_free_result($sql);
-?>
-            </td>
+            <td style="border-top:1px dotted inherit">Modéros :</td>
+            <td style="border-top:1px dotted inherit">$moderos</td>
         </tr>
         <tr>
             <td>Membres :</td>
-            <td><?php
-                $sql = mysql_query("SELECT username FROM auth_user_md5"
-                    ." WHERE user_id IN ({$this->membres})"
-                    ." ORDER BY nom, prenom");
-                $tab = array();
-                while(list($username) = mysql_fetch_row($sql))
-                    $tab[] = $username;
-                echo implode(', ', $tab);
-                mysql_free_result($sql);
-                ?>
-            </td>
+            <td>$membres</td>
         </tr>
         <tr>
             <td align="center" valign="middle" style="border-top:1px dotted inherit">
@@ -131,7 +122,7 @@ class MListReq extends Validate {
         </tr>
         </table>
         </form>
-<?php
+________EOF;
     }
     
     function handle_formu () {
@@ -152,9 +143,9 @@ class MListReq extends Validate {
         $this->clean();
         $this->submit();
 
-        require_once("mailer.inc.php");
+        require_once("diogenes.mailer.inc.php");
         
-        $mymail = new mailer('Equipe Polytechnique.org <validation+listes@polytechnique.org>', 
+        $mymail = new DiogenesMailer('Equipe Polytechnique.org <validation+listes@polytechnique.org>', 
                 $this->username."@polytechnique.org",
                 "[Polytechnique.org/LISTES] Demande de la liste {$this->alias} par ".$this->username,
                 false, "validation+listes@m4x.org");
@@ -192,8 +183,7 @@ class MListReq extends Validate {
         $message = wordwrap($message,78);  
         $mymail->setBody($message);
         $mymail->send();
-        echo "<p class=\"normal\">Mail envoyé</p>";
-        return true;
+        return "Mail envoyé";
     }
 
     function commit () {
index 7e2a09c..e6af9a2 100644 (file)
@@ -54,26 +54,24 @@ class PhotoReq extends Validate {
     }
 
     function echo_formu() {
-        require_once("popwin.inc.php");
-?>
-        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
-        <input type="hidden" name="uid" value="<?php echo $this->uid ?>">
-        <input type="hidden" name="type" value="<?php echo $this->type ?>">
-        <input type="hidden" name="stamp" value="<?php echo $this->stamp ?>">
+        $url_app = isset($_COOKIE[session_name()]) ?  "" : "&amp;".SID;
+        return <<<________EOF
+        <form action="{$_SERVER['PHP_SELF']}" method="POST">
+        <input type="hidden" name="uid" value="{$this->uid}">
+        <input type="hidden" name="type" value="{$this->type}">
+        <input type="hidden" name="stamp" value="{$this->stamp}">
         <table class="bicol" align="center" summary="Demande d'alias">
         <tr>
             <td>Demandeur&nbsp;:</td>
-            <td><a href="javascript:x()" onclick="popWin('/x.php?x=<?php echo $this->username; ?>')">
-                <?php echo $this->prenom." ".$this->nom;?>
+            <td><a href="javascript:x()" onclick="popWin('/x.php?x={$this->username}')">
+                {$this->prenom} {$this->nom}
                 </a>
             </td>
         </tr>
         <tr>
             <td align="center" valign="middle" colspan="2">
-                <img src="<?php echo "../getphoto.php?x=".$this->uid.
-                    (isset($_COOKIE[session_name()]) ?  "" : "&amp;".SID);?>" width=110 alt=" [ PHOTO ] " />
-                <img src="<?php echo "../getphoto.php?x=".$this->uid."&amp;req=true".
-                    (isset($_COOKIE[session_name()]) ?  "" : "&amp;".SID);?>" width=110 alt=" [ PHOTO ] " />
+                <img src="../getphoto.php?x={$this->uid}$url_app" width=110 alt=" [ PHOTO ] " />
+                <img src="../getphoto.php?x={$this->uid}&amp;req=true$url_app" width=110 alt=" [ PHOTO ] " />
             </td>
         </tr>
         <tr>
@@ -89,7 +87,7 @@ class PhotoReq extends Validate {
         </tr>
         </table>
         </form>
-<?php
+________EOF;
     }
     
     function handle_formu () {
@@ -125,16 +123,16 @@ class PhotoReq extends Validate {
             "L'équipe X.org";
 
         $message = wordwrap($message,78);  
-        require_once("mailer.inc.php");
-        $mymail = new mailer('Equipe Polytechnique.org <validation+trombino@polytechnique.org>',
+        require_once("diogenes.mailer.inc.php");
+        $mymail = new DiogenesMailer('Equipe Polytechnique.org <validation+trombino@polytechnique.org>',
                 $this->username."@polytechnique.org",
                 "[Polytechnique.org/PHOTO] Changement de photo de ".$this->username,
                 false, "validation+trombino@m4x.org");
         $mymail->setBody($message);
         $mymail->send();
 
-        echo "<br />Mail envoyé";
         $this->clean();
+        return "Mail envoyé";
     }
     
     function commit () {
index 03dd978..04a0ab9 100644 (file)
@@ -28,38 +28,35 @@ class SondageReq extends Validate {
         return parent::get_request($uid,'sondage',$stamp);
     }
 
-    function echo_formu() {
-        require_once("popwin.inc.php");
-?>
-        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
-        <input type="hidden" name="uid" value="<?php echo $this->uid ?>">
-        <input type="hidden" name="type" value="<?php echo $this->type ?>">
-        <input type="hidden" name="stamp" value="<?php echo $this->stamp ?>">
+    function formu() {
+        global $baseurl; 
+        $url = "$baseurl/sondage/questionnaire.php?SID=".$this->sid;
+        return <<<________EOF
+        <form action="{$_SERVER['PHP_SELF']}" method="POST">
+        <input type="hidden" name="uid" value="{$this->uid}">
+        <input type="hidden" name="type" value="{$this->type}">
+        <input type="hidden" name="stamp" value="{$this->stamp}">
         <table class="bicol" align="center" cellpadding="4" summary="Sondage">
         <tr>
             <td>Demandeur&nbsp;:
             </td>
-            <td><a href="javascript:x()" onclick="popWin('/x.php?x=<?php echo $this->username; ?>')"><?php
-                    echo $this->prenom." ".$this->nom;?></a>
+            <td><a href="javascript:x()" onclick="popWin('/x.php?x={$this->username}')">
+                {$this->prenom} {$this->nom}</a>
                 <?php if(isset($this->old)) echo "({$this->old})";?>
             </td>
         </tr>
            <tr>
             <td>Titre du sondage&nbsp;:</td>
-            <td><?php echo $this->titre;?></td>
+            <td>{$this->titre}</td>
         </tr>
         <tr>
             <td>Prévisualisation du sondage&nbsp;:</td>
-            <td><a href = <?php 
-                global $baseurl; 
-                echo "\"$baseurl/sondage/questionnaire.php?SID=".$this->sid.'"';
-                echo ' target = "_blank">'.$this->titre;
-                ?>
-                </a></td>
+            <td><a href="$url" target="_blank">{$this->titre}</a>
+            </td>
         </tr>
         <tr>
             <td>Alias du sondage&nbsp;:</td>
-            <td><input type="text" name="alias" value="<?php echo $this->alias;?>">&nbsp;(ne doit
+            <td><input type="text" name="alias" value="{$this->alias}">&nbsp;(ne doit
             pas contenir le caractère ')</td>
         </tr>
         <tr>
@@ -75,7 +72,7 @@ class SondageReq extends Validate {
         </tr>
         </table>
         </form>
-<?php
+________EOF;
     }
 
     function handle_formu () {
@@ -113,12 +110,12 @@ class SondageReq extends Validate {
             $this->alias=$alias;
         }
 
-        require_once("mailer.inc.php");
+        require_once("diogenes.mailer.inc.php");
     
         $lien = "$baseurl/sondage/questionnaire.php?alias=".urlencode($this->alias);
            $titre = '"'.str_replace('&#039;',"'",$this->titre).'"';
 
-        $mymail = new mailer('Equipe Polytechnique.org <validation+sondage@polytechnique.org>', 
+        $mymail = new DiogenesMailer('Equipe Polytechnique.org <validation+sondage@polytechnique.org>', 
                 $this->username."@polytechnique.org",
                 "[Polytechnique.org/SONDAGE] Demande de validation du sondage $titre par ".$this->username,
                 false, "validation+sondage@m4x.org");
@@ -148,9 +145,9 @@ class SondageReq extends Validate {
         $message = wordwrap($message,78);  
         $mymail->setBody($message);
         $mymail->send();
-        echo "<br />Mail envoyé";
         //Suppression de la demande
         $this->clean();
+        return "Mail envoyé";
     }
 
     function commit () {
index 9d992f4..c4212f0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
- * $Id: validations.inc.php,v 1.1 2004-01-26 22:29:02 x2000habouzit Exp $
+ * $Id: validations.inc.php,v 1.2 2004-01-27 09:08:56 x2000habouzit Exp $
  *
  */
 
@@ -139,11 +139,11 @@ class Validate {
                 .($this->unique ? "" : " AND stamp='".$this->stamp."'"));
     }
     
-    /** doit afficher le fomulaire de validation de la donnée
+    /** doit retourner le fomulaire de validation de la donnée
      * XXX la fonction est "virtuelle" XXX
      * XXX doit définir les variables $uid et $stamp en hidden XXX
      */
-    function echo_formu() { }
+    function formu() { }
     /** fonction à réaliser en cas de valistion du formulaire
      * XXX la fonction est "virtuelle" XXX
      */
diff --git a/templates/admin/valider.tpl b/templates/admin/valider.tpl
new file mode 100644 (file)
index 0000000..3fdff44
--- /dev/null
@@ -0,0 +1,11 @@
+{* $Id: valider.tpl,v 1.1 2004-01-27 09:08:57 x2000habouzit Exp $ *}
+
+{dynamic}
+{$mail}
+{foreach item=valid from=$valids}
+<br />
+{$valid->formu()}
+{/foreach}
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index d6db692..5b86a94 100644 (file)
@@ -1,4 +1,4 @@
-{* $Id: login.head.tpl,v 1.2 2004-01-26 12:45:07 x2000habouzit Exp $ *}
+{* $Id: login.head.tpl,v 1.3 2004-01-27 09:08:56 x2000habouzit Exp $ *}
 
 {literal}
     <style type="text/css" media="screen">
@@ -10,6 +10,5 @@
       -->
     </style>
 {/literal}
-    <script language="javascript" src="{"javascript/popwin.js.php"|url}" type="text/javascript"></script>
 
 {* vim:set et sw=2 sts=2 sws=2: *}
index d5ed3a9..98220a4 100644 (file)
@@ -1,4 +1,4 @@
-{* $Id: common.header.tpl,v 1.2 2004-01-26 12:36:32 x2000habouzit Exp $ *}
+{* $Id: common.header.tpl,v 1.3 2004-01-27 09:08:57 x2000habouzit Exp $ *}
 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
     <meta name="description" content="Le Portail des Polytechniciens" />
@@ -20,5 +20,8 @@
       Anciens eleves Polytechnique, annuaire email, Alumni
     </title>
     <script language="JavaScript" type="text/javascript" src="javascript/getnow.js"></script>
+{if $popup_enable}
+    <script language="javascript" type="text/javascript" src="javascript/popwin.js.php"> </script>
+{/if}
 
 {* vim:set et sw=2 sts=2 sws=2: *}