Fixes the username in user deregistration confirmation emails (will prevent admins...
[platal.git] / modules / profile / page.inc.php
index 96344b8..e259f1e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -172,7 +172,7 @@ abstract class ProfileGeoloc implements ProfileSetting
             } else if (@$address['parsevalid']) {
                 $address = array_merge($address, cut_address(@$address['text']));
                 $address['checked'] = true;
-                $mailer = new PlMailer('geoloc/mail_geoloc.tpl');
+                $mailer = new PlMailer('geoloc/geoloc.mail.tpl');
                 $mailer->assign('text', get_address_text($address));
                 $mailer->assign('geoloc', $geotxt);
                 $mailer->send();
@@ -201,6 +201,7 @@ abstract class ProfilePage implements PlWizardPage
     protected $settings = array();  // A set ProfileSetting objects
     protected $errors   = array();  // A set of boolean with the value check errors
     protected $changed  = array();  // A set of boolean indicating wether the value has been changed
+    protected $watched  = array();  // A set of boolean indicating the fields that are watched
 
     public $orig     = array();
     public $values   = array();
@@ -240,10 +241,14 @@ abstract class ProfilePage implements PlWizardPage
 
     protected function saveData()
     {
+        require_once 'notifs.inc.php';
         foreach ($this->settings as $field=>&$setting) {
             if (!is_null($setting) && $this->changed[$field]) {
                 $setting->save($this, $field, $this->values[$field]);
             }
+            if ($this->changed[$field] && @$this->watched[$field]) {
+                register_profile_update(S::i('uid'), $field);
+            }
         }
         $this->_saveData();
 
@@ -251,7 +256,6 @@ abstract class ProfilePage implements PlWizardPage
         XDB::execute('REPLACE INTO  user_changes
                                SET  user_id = {?}', S::v('uid'));
         if (!S::has('suid')) {
-            require_once 'notifs.inc.php';
             register_watch_op(S::i('uid'), WATCH_FICHE);
         }
         global $platal;