Bye xorg.misc.inc.php
[platal.git] / include / validations / nomusage.inc.php
index 5c01b0c..788d7c6 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   *
@@ -49,7 +49,6 @@ class UsageReq extends Validate
         parent::__construct($_uid, true, 'usage');
         $this->nom_usage  = $_usage;
         $this->reason = $_reason;
-        require_once 'xorg.misc.inc.php';
         $this->alias   = make_username($this->prenom, $this->nom_usage);
         if (!$this->nom_usage) $this->alias = "";
 
@@ -92,6 +91,13 @@ class UsageReq extends Validate
             if ($this->nom_usage) {
                 $res .= "\n\n  Les alias {$this->alias}@{$globals->mail->domain} et @{$globals->mail->domain2} sont maintenant à ta disposition !";
             }
+            if ($globals->mailstorage->googleapps_domain) {
+                require_once 'googleapps.inc.php';
+                $account = new GoogleAppsAccount($this->uid, $this->forlife);
+                if ($account->active()) {
+                    $res .= "\n\n  Si tu utilises Google Apps, tu peux changer ton nom d'usage sur https://mail.google.com/a/polytechnique.org/#settings/accounts";
+                }
+            }
             return $res;
         } else {
             return "  La demande de changement de nom d'usage que tu avais faite a été refusée.";
@@ -103,6 +109,8 @@ class UsageReq extends Validate
 
     public function commit()
     {
+        require_once 'notifs.inc.php';
+        register_watch_op($this->uid, WATCH_FICHE, 'nom');
         require_once('user.func.inc.php');
         $this->bestalias = set_new_usage($this->uid, $this->nom_usage, $this->alias);
         return true;