X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fcarnet.php;h=9454062743ccdbaee8aea26492a98f1193ff7fe1;hb=723d4c6b7736df20e07d2c6e32e4c37c6c80ca05;hp=2125cf92ec132cabaa6c9a85848daf9859465c75;hpb=245923e335d0da5bec9495991a7846be9f0563ab;p=platal.git diff --git a/modules/carnet.php b/modules/carnet.php index 2125cf9..9454062 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -292,9 +292,10 @@ class CarnetModule extends PLModule case 'ajouter': if (($contact = User::get(Env::v('user')))) { - if (XDB::execute("REPLACE INTO contacts (uid, contact) - VALUES ({?}, {?})", - $uid, $contact->id())) { + XDB::execute('INSERT IGNORE INTO contacts (uid, contact) + VALUES ({?}, {?})', + $uid, $contact->id()); + if (XDB::affectedRows() > 0) { Platal::session()->updateNbNotifs(); $page->trigSuccess('Contact ajouté !'); } else { @@ -315,7 +316,7 @@ class CarnetModule extends PLModule } if ($search && trim(Env::v('quick'))) { $base = 'carnet/contacts/search'; - $view = new SearchSet(true, false, new UFC_Contact($user)); + $view = new SearchSet(true, new UFC_Contact($user)); } else { $base = 'carnet/contacts'; $view = new ProfileSet(new UFC_Contact($user)); @@ -382,7 +383,7 @@ class CarnetModule extends PLModule $user = Platal::session()->tokenAuth($alias, $hash); if (is_null($user)) { if (S::logged()) { - $user == S::user(); + $user = S::user(); } else { return PL_FORBIDDEN; } @@ -415,7 +416,7 @@ class CarnetModule extends PLModule $user = Platal::session()->tokenAuth($alias, $hash); if (is_null($user)) { if (S::logged()) { - $user == S::user(); + $user = S::user(); } else { return PL_FORBIDDEN; } @@ -445,7 +446,7 @@ class CarnetModule extends PLModule $user = Platal::session()->tokenAuth($alias, $hash); if (is_null($user)) { if (S::logged()) { - $user == S::user(); + $user = S::user(); } else { return PL_FORBIDDEN; }