pleins de petits bugfixes.
authorx2000habouzit <x2000habouzit>
Wed, 4 Feb 2004 23:22:03 +0000 (23:22 +0000)
committerx2000habouzit <x2000habouzit>
Wed, 4 Feb 2004 23:22:03 +0000 (23:22 +0000)
il reste des bugs sur les pages en 'x' uniquement, mais c'est pas certifié sans bug pour les autres ...

bonne nuit

etat_migration
htdocs/admin/postfix_blacklist.php
htdocs/admin/postfix_perm.php
htdocs/admin/postfix_retardes.php
htdocs/pattecassee.php
htdocs/rss.php
htdocs/stats/coupure.php
include/nonhtml.inc.php
templates/admin/postfix.common.tpl
templates/pattecassee.tpl
templates/stats/coupure.tpl

index 97810f1..e964ea8 100644 (file)
@@ -139,31 +139,28 @@ Etat  | Ancien nom                                                                  | Nouveau nom
 ------+-------------------------------------------+----------------
 @@@      | groupex/donne-chall.php                                       | -
 @@@      | groupex/export-econfiance.php                         | -
-x        | admin/graph_promo.php                                         | stats/graph_promo.php
-x        | admin/index.php                                                       | -
-x        | admin/postfix_blacklist.php                           | -
-x        | admin/postfix_perm.php                                        | -
-x        | admin/postfix_retardes.php                            | -
-x        | admin/stats_promo.php                                         | stats/stats_promo.php
-x        | coupure.php                                                           | stats/coupure.php
+x        | coupure.php                                                           | stats/coupure.php -> encore un pb (afficher deux coupures d'affilée)
 x        | domaineperso.php                                              | -
-x        | dons.php                                                              | -
 x        | epouse.php                                                            | -
 x        | groupex.php                                                           | groupex/index.php 
-x        | nbpromo2.php                                                          | stats/nb_by_promo.php
 x        | parselog.php                                                          | stats/...
-x        | pattecassee.php                                                       | -
-x        | rss.php                                                                       | -
+x        | pattecassee.php                                                       | - -> encore buggué
 x        | sendmail.php                                                          | -
 x        | trackers/index.php                                            | -
 x        | trackers/tracker_admin.php                            | -
 xx       | AccesPermanentOff.php                                         | cookie_off.php
 xx       | AccesPermanentOn.php                                          | cookie_on.php
-xx       | acces_wap.php                                                         | -
-xx       | admin/deces_promo.php                                         | -
 xx       | acces_redirect.php                                            | carva_redirect.php
 xx       | acces_smtp.php                                                        | -
+xx       | acces_wap.php                                                         | -
 xx       | admin/ax-xorg.php                                             | -
+xx       | admin/deces_promo.php                                         | -
+xx       | admin/graph_promo.php                                         | stats/graph_promo.php
+xx       | admin/index.php                                                       | -
+xx       | admin/postfix_blacklist.php                           | -
+xx       | admin/postfix_perm.php                                        | -
+xx       | admin/postfix_retardes.php                            | -
+xx       | admin/stats_promo.php                                         | stats/stats_promo.php
 xx       | admin/valider.php                                             | -
 xx       | alias.php                                                             | -
 xx       | antispam.php                                                          | -
@@ -186,6 +183,7 @@ xx    | docs/doc_patte_cassee.php                             | -
 xx       | docs/doc_smtp.php                                             | -
 xx       | docs/doc_ssl.php                                              | -
 xx       | docs/index.php                                                        | -
+xx       | dons.php                                                              | -
 xx       | ethique.php                                                           | docs/ethique.php
 xx       | exit.php                                                              | -
 xx       | faq.php                                                                       | docs/faq.php
@@ -193,7 +191,9 @@ xx    | getphoto.php                                                          | -
 xx       | index.php                                                             | -
 xx       | login.php                                                             | -
 xx       | motdepassemd5.php                                             | -
+xx       | nbpromo2.php                                                          | stats/nb_by_promo.php
 xx       | preferences.php                                                       | -
+xx       | rss.php                                                                       | -
 xx       | secu.php                                                              | docs/secu.php
 xx       | skins.php                                                             | -
 xx       | vcard.php                                                             | -
index 52f4429..cb8dfbc 100644 (file)
@@ -16,9 +16,9 @@ if(isset($_REQUEST['nomligne'])) {
 
 $blacklist = Array();
 $fd = fopen ("/etc/postfix/spamaccess", "r");
-while (!feof ($fd)) {
+while ($fd && !feof ($fd)) {
     $buffer = fgets($fd, 4096);
-    if ($buffer[0]!='#' && (strlen($buffer)>1) { # FIXME $string[i] is deprecated
+    if ($buffer[0]!='#' && (strlen($buffer)>1)) { # FIXME $string[i] is deprecated
         $blacklist[] = $buffer;
     }
 }
index 26a4cf2..0936d95 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-require("auto.append.inc.php");
+require("auto.prepend.inc.php");
 new_admin_page('admin/postfix.common.tpl');
 
 if(isset($_REQUEST['nomligne'])) {
@@ -16,9 +16,9 @@ if(isset($_REQUEST['nomligne'])) {
 
 $permis = Array();
 $fd = fopen ("/etc/postfix/spampermis", "r");
-while (!feof ($fd)) {
+while ($fd && !feof ($fd)) {
     $buffer = fgets($fd, 4096);
-    if ($buffer[0]!='#' && (strlen($buffer)>1) { # FIXME $string[i] is deprecated
+    if ($buffer[0]!='#' && (strlen($buffer)>1)) { # FIXME $string[i] is deprecated
         $permis[] = $buffer;
     }
 }
index e286b85..8eb7989 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-require("auto.append.inc.php");
+require("auto.prepend.inc.php");
 new_admin_page('admin/postfix.common.tpl');
 
 if (isset($_REQUEST["del"]) && !empty($_REQUEST["del"])) {
@@ -10,9 +10,9 @@ if (isset($_REQUEST["del"]) && !empty($_REQUEST["del"])) {
 $retard = Array();
 $fd = fopen ("/etc/postfix/spamdefer", "r");
 
-while (!feof ($fd)) {
+while ($fd && !feof ($fd)) {
     $buffer = fgets($fd, 4096);
-    if ($buffer[0]!='#' && (strlen($buffer)>1) { # FIXME $string[i] is deprecated
+    if ($buffer[0]!='#' && (strlen($buffer)>1)) { # FIXME $string[i] is deprecated
         $retard[] = $buffer;
     }
 }
index 3e2837e..f1281ca 100644 (file)
@@ -50,7 +50,7 @@ L'
        $mail->send();
         $page->assign('erreur', "Mail envoyé ! :o)");
     }
-} else if (array_key_exists('email', $_POST)) {
+} elseif (array_key_exists('email', $_POST)) {
     $email = valide_email($_POST['email']);
     $page->assign('email',$email);
     $sel = mysql_query("SELECT e1.uid, e1.panne != 0 AS panne, count(e2.uid) AS nb_mails, u.nom, u.prenom, u.promo"
@@ -61,8 +61,8 @@ L'
         ." GROUP BY e1.uid");
     if ($x = mysql_fetch_assoc($sel)) {
         // on écrit dans la base que l'adresse est cassée
-       if (!$x['panne'])
-           mysql_query("UPDATE emails SET panne='".date("Y-m-d")."' WHERE email =  '".$email."'");
+        if (!$x['panne'])
+            mysql_query("UPDATE emails SET panne='".date("Y-m-d")."' WHERE email =  '".$email."'");
         $page->assign_by_ref('x',$x);
     }
 }
index 95292e0..101707a 100644 (file)
@@ -9,7 +9,7 @@ if (isset($_REQUEST["promo"])) {
 }
 
 $requete.=" ORDER BY (e.promo_min != 0 AND e.promo_max != 0) DESC,  e.peremption";
-$page->msyql_assign($requete,'rss');
+mysql_assign($page,$requete,'rss');
 
 header("Content-Type: text/xml");
 $page->display('rss.tpl');
index fc68bf5..9f0e789 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 require("auto.prepend.inc.php");
-new_skinned_page('stats/coupure.tpl',
+new_skinned_page('stats/coupure.tpl',AUTH_PUBLIC);
 
 if (isset($_REQUEST['cp_id'])) 
     $res=mysql_query("select UNIX_TIMESTAMP(debut) AS debut, TIME_FORMAT(duree,'%kh%i') AS duree, resume, description, services from coupures where id='{$_REQUEST['cp_id']}'");
 else
     $res="";
 
-if(($res)&&($cp == mysql_fetch_assoc($res))) {
+if(($res)&&($cp = mysql_fetch_assoc($res))) {
     $page->assign_by_ref('cp',$cp);
 } else {
     $beginning_date = date("Ymd", time() - 3600*24*21) . "000000";
index c518cfc..ef8410c 100644 (file)
@@ -1,8 +1,25 @@
 <?php
 ini_set('include_path', ".:..:/home/x2000habouzit/dev/public/include:/home/x2000habouzit/dev/diogenes/lib/:/home/x2000habouzit/dev/smarty/");
-require("xorg.globals.inc.php");
+require("xorg.common.inc.php");
 require("Smarty.class.php");
 
+
+function mysql_assign(&$page,$sql_query,$var_name,$var_nb_name='') {
+    $sql = mysql_query($sql_query);
+    if(mysql_errno())
+        return(mysql_error($sql));
+
+    $array = Array();
+    while($array[] = mysql_fetch_assoc($sql));
+    array_pop($array);
+    mysql_free_result($sql);
+
+    $page->assign_by_ref($var_name,$array);
+    if(!empty($var_nb_name))
+        $page->assign($var_nb_name, count($array));
+    return 0;
+}
+
 $page = new Smarty();
 
 $page->template_dir = $globals->spoolroot . "/templates/";
index d0685eb..c9af14c 100644 (file)
@@ -1,4 +1,4 @@
-{* $Id: postfix.common.tpl,v 1.1 2004-02-04 19:47:47 x2000habouzit Exp $ *}
+{* $Id: postfix.common.tpl,v 1.2 2004-02-04 23:22:05 x2000habouzit Exp $ *}
 
 {dynamic}
 <p class="erreur">{$erreur}</p>
@@ -8,9 +8,9 @@
 </div>
 
 <a href="{""|url}">page d'admin</a> |
-<a href="{"postfix_blacklist.php"|url}">blacklist</a> |
-<a href="{"postfix_perm.php"|url}">permissions</a> | 
-<a href="{"postfix_retardes.php"|url}">mails retardés</a>
+<a href="{"admin/postfix_blacklist.php"|url}">blacklist</a> |
+<a href="{"admin/postfix_perm.php"|url}">permissions</a> | 
+<a href="{"admin/postfix_retardes.php"|url}">mails retardés</a>
 
 <p class="normal">
 {$expl}
index 5efe1b1..e903e76 100644 (file)
@@ -1,4 +1,4 @@
-{* $Id: pattecassee.tpl,v 1.1 2004-02-04 19:47:47 x2000habouzit Exp $ *}
+{* $Id: pattecassee.tpl,v 1.2 2004-02-04 23:22:05 x2000habouzit Exp $ *}
 
 {dynamic on="0$erreur"}
 <p class="erreur">{$erreur}</p>
@@ -27,7 +27,7 @@
     Nous t'invitons à prendre contact avec lui autrement que par email,
     l'idéal étant de l'informer si possible que sa patte Polytechnique.org est cassée...!
   </p>
-{else}
+{elseif $email}
 <p class="erreur">
   Désolé mais plus personne n'utilise l'adresse {$email} comme adresse de redirection.
   Nous ne pouvons donc malheureusement te fournir aucune information...
index 544193b..f7d655f 100644 (file)
@@ -1,16 +1,14 @@
-{* $Id: coupure.tpl,v 1.1 2004-02-04 19:47:48 x2000habouzit Exp $ *}
+{* $Id: coupure.tpl,v 1.2 2004-02-04 23:22:05 x2000habouzit Exp $ *}
 
 {dynamic}
-
 {if $cp}
-
 <table class="bicol" summary="Ruptures de service">
   <tr>
     <th colspan="2">détails de l'interruption de service<th>
   </tr>
   <tr>
     <td class="titre">début</td>
-    <td>{$cp.debut|date_forma:"%d/%m/%Y, %Hh%M"}</td>
+    <td>{$cp.debut|date_format:"%d/%m/%Y, %Hh%M"}</td>
   </tr>
   <tr>
     <td class="titre">durée</td>
@@ -75,7 +73,7 @@
   </tr>
 {/foreach}
 </table>
-
+{/if}
 {/dynamic}
 
 {* vim:set et sw=2 sts=2 sws=2: *}