function friends_notices_set_read($options) { if (!isset($options['action'])) { throw new Exception('ännu mera tjockiskod, grattis! Ingen type sattes för vännernotisen som skulle uppdateras.'); } if (!isset($options['item_id']) || !is_numeric($options['item_id'])) { throw new Exception('Vännernotisen saknar helt klart ett item id f�r att kunna uppdateras...'); } if (isset($_SESSION['friends_actions'])) { foreach ($_SESSION['friends_actions'] as &$friend) { foreach ($friend['actions'] as &$action) { if (isset($action['item_id']) && is_numeric($action['item_id']) && $action['action'] == $options['action'] && $action['item_id'] == $options['item_id']) { friends_notices_remove(array('item_id' => $action['item_id'], 'action' => $action['action'])); // Note: Both &$friend and &$action are reference pointers! unset($action); if (empty($friend['actions'])) { unset($friend); } } } } } }
<?php require '../include/core/common.php'; if (login_checklogin() && is_numeric($_GET['friend_id'])) { $options['friend_id'] = $_GET['friend_id']; friends_notices_remove($options); echo 'lol'; unset($_SESSION['friends_actions'][$options['friend_id']]); }