try { if ($filtered['ignore-add-submit'] and $filtered['ignore-username']) { // find user. $t->searchUsers = User::queryIDByUsername($filtered['ignore-username']); if (count($t->searchUsers) != 1) { throw new Exception('Could not find user'); } if (Ignore::isBlocked($user, $t->searchUsers[0])) { // User already blocked } else { $ignore = new Ignore(); $ignore->time = time(); $ignore->userId = $user->id; $ignore->targetId = $t->searchUsers[0]->id; $ignore->note = $filtered['ignore-note']; $id = $ignore->create(); if ($id) { $t->msg = 'User is now blocked'; } else { throw new Exception('Could not block user, please try again'); } } }
$filteredG = filter_input_array(INPUT_GET, $filters); $filtered = filter_input_array(INPUT_POST, $filters); $toG = count($filteredG['to']) ? $filteredG['to'] : array(); $toP = count($filtered['to']) ? $filtered['to'] : array(); $to = array_unique(array_merge($toG, $toP)); $subject = substr($filtered['subject'], 0, 255); $text = $filtered['text' ]; $msgId = $filteredG['msg-id'] ? $filteredG['msg-id'] : ($filtered['msg-id'] ? $filtered['msg-id'] : 0); $searchName = $filtered['search-name']; $blockedMe = Ignore::getUserIdsWhoBlockedUser($user); $t->targets = array(); $t->searchUsers = array(); $t->toArray = ''; $t->quote = ''; $t->alliance = isset($filtered['alliance']); $t->officers = isset($filtered['officers']); $t->msgId = $msgId; try { if (!strlen($subject)) { $subject = _('(No Subject)'); }