diff --git a/CHANGELOG b/CHANGELOG index 8269d9b..9e930a3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ Make nicknames in the chatters list clickable to send PMs more easily Add better multi-byte character support - New dependency: mbstring extension Don't send messages to inbox when in incognito Remove up to two characters from the end of @mention to also match @mention, etc. +Make colour input use colorChooser, if supported Version 1.21 - Aug. 29, 2016 Don't display empty option for system messages in delete messages by name diff --git a/chat.php b/chat.php index cf8d306..f41b822 100644 --- a/chat.php +++ b/chat.php @@ -555,7 +555,7 @@ function send_setup($C){ foreach($C['colour_settings'] as $setting){ thr(); echo '
'.$I[$setting].''; - echo "'; + echo "'; echo '
'; } thr(); @@ -1805,10 +1805,10 @@ function send_profile($arg=''){ thr(); preg_match('/#([0-9a-f]{6})/i', $U['style'], $matches); echo "
$I[fontcolour] ($I[viewexample])"; - echo "
"; + echo ""; thr(); echo "
$I[bgcolour] ($I[viewexample])"; - echo "
"; + echo ""; thr(); if($U['status']>=3){ echo "
$I[fontface]"; @@ -2610,14 +2610,14 @@ function amend_profile(){ }elseif($U['refresh']>150){ $U['refresh']=150; } - if(preg_match('/^[a-f0-9]{6}$/i', $_REQUEST['colour'])){ - $U['colour']=$_REQUEST['colour']; + if(preg_match('/^#([a-f0-9]{6})$/i', $_REQUEST['colour'], $match)){ + $U['colour']=$match[1]; }else{ preg_match('/#([0-9a-f]{6})/i', $U['style'], $matches); $U['colour']=$matches[1]; } - if(preg_match('/^[a-f0-9]{6}$/i', $_REQUEST['bgcolour'])){ - $U['bgcolour']=$_REQUEST['bgcolour']; + if(preg_match('/^#([a-f0-9]{6})$/i', $_REQUEST['bgcolour'], $match)){ + $U['bgcolour']=$match[1]; } $fonttags=''; if($U['status']>=3 && isSet($_REQUEST['bold'])){ @@ -3220,6 +3220,13 @@ function save_setup($C){ foreach($C['number_settings'] as $setting){ settype($_REQUEST[$setting], 'int'); } + foreach($C['colour_settings'] as $setting){ + if(preg_match('/^#([a-f0-9]{6})$/i', $_REQUEST[$setting], $match)){ + $_REQUEST[$setting]=$match[1]; + }else{ + unset($_REQUEST[$setting]); + } + } settype($_REQUEST['guestaccess'], 'int'); if(!preg_match('/^[01234]$/', $_REQUEST['guestaccess'])){ unset($_REQUEST['guestaccess']); @@ -3237,12 +3244,6 @@ function save_setup($C){ $_REQUEST['rulestxt']=preg_replace("/(\r?\n|\r\n?)/", '
', $_REQUEST['rulestxt']); $_REQUEST['chatname']=htmlspecialchars($_REQUEST['chatname']); $_REQUEST['redirect']=htmlspecialchars($_REQUEST['redirect']); - if(!preg_match('/^[a-f0-9]{6}$/i', $_REQUEST['colbg'])){ - unset($_REQUEST['colbg']); - } - if(!preg_match('/^[a-f0-9]{6}$/i', $_REQUEST['coltxt'])){ - unset($_REQUEST['coltxt']); - } if($_REQUEST['memberexpire']<5){ $_REQUEST['memberexpire']=5; }