Happy New Year!
[platal.git] / modules / profile / page.inc.php
index becd6d1..9501b58 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -129,7 +129,7 @@ class ProfileSettingPhones implements ProfileSetting
 
     public function save(ProfilePage &$page, $field, $value)
     {
-        Phone::deletePhones($page->pid(), Phone::LINK_PROFILE);
+        Phone::deletePhones($page->pid(), Phone::LINK_PROFILE, null, S::user()->isMe($page->owner) || S::admin());
         Phone::savePhones($value, $page->pid(), Phone::LINK_PROFILE);
     }
 
@@ -310,7 +310,8 @@ abstract class ProfilePage implements PlWizardPage
                                    VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, NOW())
                   ON DUPLICATE KEY UPDATE  uid = VALUES(uid), oldText = IF(VALUES(type) != type, VALUES(oldText), oldText),
                                            newText = VALUES(newText), type = VALUES(type), timestamp = NOW()',
-                             $this->pid(), $user->id(), $field, $values[0], $values[1], ($owner->id() == $user->id()) ? 'self' : 'third_party');
+                             $this->pid(), $user->id(), Profile::$descriptions[$field], $values[0], $values[1],
+                             ($owner->id() == $user->id()) ? 'self' : 'third_party');
             }
         }
         return true;