X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fevents.php;h=9f434cb0a97ae3c173988b9cfe8569eb9fff14dc;hb=023c46fb7f3015fc87744c5a8293342c2e569acd;hp=4888268d65118d4f54f2b62334c8bd48e2cf6260;hpb=12ddbc2037b16496dfb9d91c4f7091850146fcde;p=platal.git diff --git a/modules/events.php b/modules/events.php index 4888268..9f434cb 100644 --- a/modules/events.php +++ b/modules/events.php @@ -144,8 +144,9 @@ class EventsModule extends PLModule FROM announce_read AS ev INNER JOIN announces AS e ON e.id = ev.evt_id WHERE expiration < NOW()'); - XDB::execute('REPLACE INTO announce_read VALUES({?},{?})', - $eid, S::v('uid')); + XDB::execute('INSERT IGNORE INTO announce_read (evt_id, uid) + VALUES ({?}, {?})', + $eid, S::v('uid')); pl_redirect('events#'.$pound); } @@ -382,9 +383,10 @@ class EventsModule extends PLModule Post::v('promo_min'), Post::v('promo_max'), $flags, $eid); if ($upload->exists() && list($x, $y, $type) = $upload->imageInfo()) { - XDB::execute('REPLACE INTO announce_photos - SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}', - $eid, $type, $x, $y, $upload->getContents()); + XDB::execute('INSERT INTO announce_photos (eid, attachmime, attach, x, y) + VALUES ({?}, {?}, {?}, {?}, {?}) + ON DUPLICATE KEY UPDATE attachmime = VALUES(attachmime), attach = VALUES(attach), x = VALUES(x), y = VALUES(y)', + $eid, $type, $upload->getContents(), $x, $y); $upload->rm(); } }