X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fcarnet.php;h=ba5e1df2c64dc991ef18ecc22668c031379299b5;hb=d30b83fa903a8a6f7b88df287884ed80cffff277;hp=2125cf92ec132cabaa6c9a85848daf9859465c75;hpb=20f36c54ce9f6327a93f37a8ce6b8f06defba13e;p=platal.git diff --git a/modules/carnet.php b/modules/carnet.php index 2125cf9..ba5e1df 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 QuickSearchSet(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; }