From: x2000habouzit Date: Thu, 4 Nov 2004 20:19:35 +0000 (+0000) Subject: plug registrations of watched evs in the site X-Git-Tag: xorg/old~1058 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e39e63d39adae61852cc6ea866d6f058b0baf1a9;p=platal.git plug registrations of watched evs in the site --- diff --git a/htdocs/admin/deces_promo.php b/htdocs/admin/deces_promo.php index 8cd49fc..113d751 100644 --- a/htdocs/admin/deces_promo.php +++ b/htdocs/admin/deces_promo.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: deces_promo.php,v 1.5 2004-10-31 16:39:04 x2000chevalier Exp $ + $Id: deces_promo.php,v 1.6 2004-11-04 20:19:36 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -33,9 +33,14 @@ if(isset($_REQUEST['add10'])) $promo += 10; $page->assign('promo',$promo); if (isset($_REQUEST["valider"]) && $_REQUEST["valider"] == "Valider") { - $res = $globals->db->query("SELECT matricule FROM auth_user_md5 WHERE promo = $promo"); - while (list($mat) = mysql_fetch_row($res)) { - $globals->db->query("UPDATE auth_user_md5 SET deces='".$_REQUEST[$mat]."' WHERE matricule = '".$mat."'"); + $res = $globals->db->query("SELECT user_id,matricule,deces FROM auth_user_md5 WHERE promo = $promo"); + while (list($uid,$mat,$deces) = mysql_fetch_row($res)) { + if($_REQUEST[$mat] == $deces) continue; + $globals->db->query("UPDATE auth_user_md5 SET deces='".$_REQUEST[$mat]."' WHERE matricule = '".$mat."'"); + if($deces=='0000-00-00' or empty($deces)) { + require_once('notifs.inc.php'); + register_watch_op($uid,'death'); + } } } diff --git a/htdocs/inscription/step4.php b/htdocs/inscription/step4.php index 879465e..015698e 100644 --- a/htdocs/inscription/step4.php +++ b/htdocs/inscription/step4.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: step4.php,v 1.7 2004-11-03 15:55:23 x2000habouzit Exp $ + $Id: step4.php,v 1.8 2004-11-04 20:19:36 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -121,6 +121,8 @@ if (!empty($_REQUEST['ref'])) { // insérer l'inscription dans la table des inscriptions confirmé $globals->db->query("INSERT INTO ins_confirmees SET id=$uid"); + require_once('notifs.inc.php'); + register_watch_op($uid,'ins'); // insérer une ligne dans user_changes pour que les coordonnées complè // soient envoyées a l' diff --git a/htdocs/profil.php b/htdocs/profil.php index bf8d5b6..c160bd4 100644 --- a/htdocs/profil.php +++ b/htdocs/profil.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: profil.php,v 1.10 2004-09-04 21:04:25 x2000habouzit Exp $ + $Id: profil.php,v 1.11 2004-11-04 20:19:35 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -97,14 +97,14 @@ if (isset($_REQUEST['modifier']) || isset($_REQUEST['suivant'])) { if ($web_public) $bits_reply .= 'web_public,'; if ($libre_public) $bits_reply .= 'libre_public,'; if (!empty($bits_reply)) $bits_reply = substr($bits_reply, 0, -1); - $sql = "UPDATE auth_user_md5 set bits = '$bits_reply'"; - // si on est en suid on ne met pas à jour la date - if(isset($_SESSION['suid'])) { - $sql = $sql." WHERE user_id={$_SESSION['uid']}"; - } else { + $sql = "UPDATE auth_user_md5 set bits = '$bits_reply' WHERE user_id={$_SESSION['uid']}"; + $globals->db->query($sql); + + if(empty($_SESSION['suid'])) { $sql = $sql.",date='$date' WHERE user_id={$_SESSION['uid']}"; + require_once('notifs.inc.php'); + register_watch_op($this->uid,'fiche'); } - $globals->db->query($sql); // mise a jour des champs relatifs au tab ouvert require_once("profil/update_{$opened_tab}.inc.php"); diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 8cd93b8..5f11e0e 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -18,11 +18,21 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: notifs.inc.php,v 1.1 2004-11-04 19:57:43 x2000habouzit Exp $ + $Id: notifs.inc.php,v 1.2 2004-11-04 20:19:36 x2000habouzit Exp $ ***************************************************************************/ require_once('diogenes.flagset.inc.php'); - + +function register_watch_op($uid, $type) { + global $globals; + if(in_array($type, Array('fiche','death','photo','ins'))) { + $globals->db->query("REPLACE INTO watch_ops (user_id,op) VALUES('$uid','$type')"); + } + if($type == 'fiche') { + $globals->db->query("UPDATE auth_user_md5 SET DATE=NOW() WHERE user_id='$uid'"); + } +} + class Notifs { var $uid; var $flags; diff --git a/include/valid_photos.inc.php b/include/valid_photos.inc.php index d20f97d..d062e82 100644 --- a/include/valid_photos.inc.php +++ b/include/valid_photos.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: valid_photos.inc.php,v 1.13 2004-11-02 08:10:55 x2000habouzit Exp $ + $Id: valid_photos.inc.php,v 1.14 2004-11-04 20:19:36 x2000habouzit Exp $ ***************************************************************************/ @@ -107,7 +107,8 @@ class PhotoReq extends Validate { $globals->db->query("REPLACE INTO photo set uid='".$this->uid."', attachmime = '".$this->mimetype."', attach='" .addslashes($this->data)."', x='".$this->x."', y='".$this->y."'"); - $globals->db->query("UPDATE auth_user_md5 SET date=NOW() WHERE user_id='{$this->uid}'"); + require('notifs.inc.php'); + register_watch_op($this->uid,'fiche'); } } diff --git a/scripts/migration/0.9.2/notifs.sql b/scripts/migration/0.9.2/notifs.sql index 6f3e5d8..8a0e731 100644 --- a/scripts/migration/0.9.2/notifs.sql +++ b/scripts/migration/0.9.2/notifs.sql @@ -9,6 +9,6 @@ create table watch ( create table watch_ops ( user_id smallint not null, - op enum('fiche','death','photo','ins') not null, + op enum('fiche','death','ins') not null, primary key (user_id,op) ); diff --git a/templates/admin/deces_promo.tpl b/templates/admin/deces_promo.tpl index 8230bed..04e1cb9 100644 --- a/templates/admin/deces_promo.tpl +++ b/templates/admin/deces_promo.tpl @@ -17,51 +17,51 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: deces_promo.tpl,v 1.5 2004-08-31 11:25:39 x2000habouzit Exp $ + $Id: deces_promo.tpl,v 1.6 2004-11-04 20:19:37 x2000habouzit Exp $ ***************************************************************************} -
- - - - - - - - -
- Promotion : {dynamic} - -{/dynamic} - -
+ + + + + + + + + + +
+ Promotion : + + +
-
- - - - - -{dynamic} -{foreach item=x from=$decedes} - - - - -{/foreach} -{/dynamic} - - - -
NomDate de décès
{$x.nom} {$x.prenom} - -
- - -
+ + + + + + + {foreach item=x from=$decedes} + + + + + {/foreach} + + + +
NomDate de décès
{$x.nom} {$x.prenom} + +
+ + +
- + +{/dynamic} + {* vim:set et sw=2 sts=2 sws=2: *}