From 29517805997f30e3dd7ff065013d59bc400a7fe1 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Mon, 25 Jul 2016 11:14:34 +0200 Subject: [PATCH] Allow ignoring incognito chatters --- CHANGELOG | 1 + chat.php | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9e8bfa5..fa27d68 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ Don't display empty option for system messages in delete messages by name Don't show a kick button on your own session in the list of active sessions +Allow ignoring incognito chatters Version 1.20.6 - Jul. 23, 2016 Simplify ignore logic + disallow ignoring chatters with higher status diff --git a/chat.php b/chat.php index 65cc6a8..bc33406 100644 --- a/chat.php +++ b/chat.php @@ -1043,7 +1043,7 @@ function send_sessions(){ $s=' (SM)'; }elseif($temp['status']==7){ $s=' (A)'; - }elseif($temp['status']==8){ + }else{ $s=' (SA)'; } echo ''.style_this($temp['nickname'].$s, $temp['style']).''; @@ -1729,14 +1729,10 @@ function send_profile($arg=''){ } echo "
$I[ignore]"; echo "
'; thr(); @@ -2602,7 +2598,7 @@ function amend_profile(){ } function save_profile(){ - global $I, $P, $U, $db; + global $I, $U, $db; amend_profile(); $stmt=$db->prepare('UPDATE ' . PREFIX . 'sessions SET refresh=?, style=?, boxwidth=?, boxheight=?, bgcolour=?, notesboxwidth=?, notesboxheight=?, timestamps=?, embed=?, incognito=?, nocache=?, tz=?, eninbox=? WHERE session=?;'); $stmt->execute(array($U['refresh'], $U['style'], $U['boxwidth'], $U['boxheight'], $U['bgcolour'], $U['notesboxwidth'], $U['notesboxheight'], $U['timestamps'], $U['embed'], $U['incognito'], $U['nocache'], $U['tz'], $U['eninbox'], $U['session'])); @@ -2615,7 +2611,9 @@ function save_profile(){ $stmt->execute(array($_REQUEST['unignore'], $U['nickname'])); } if(!empty($_REQUEST['ignore'])){ - if($_REQUEST['ignore']!==$U['nickname'] && isset($P[$_REQUEST['ignore']]) && $P[$_REQUEST['ignore']][2]<=$U['status']){ + $stmt=$db->prepare('SELECT * FROM ' . PREFIX . 'sessions WHERE nickname=? AND status<=? AND nickname NOT IN (SELECT ign FROM ' . PREFIX . 'ignored WHERE ignby=?);'); + $stmt->execute([$_REQUEST['ignore'], $U['status'], $U['nickname']]); + if($U['nickname']!==$_REQUEST['ignore'] && $stmt->fetch(PDO::FETCH_NUM)){ $stmt=$db->prepare('INSERT INTO ' . PREFIX . 'ignored (ign, ignby) VALUES (?, ?);'); $stmt->execute(array($_REQUEST['ignore'], $U['nickname'])); }