From 35a2d5a524cba1b86776fb276696699246033e91 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Tue, 12 Jul 2016 16:16:08 +0200 Subject: [PATCH] Third attempt to fix the same bug --- CHANGELOG | 3 +++ chat.php | 38 +++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f7d8f10..40ff06a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.20.3 - Jul. 12, 2016 +Third attempt to fix the same bug + Version 1.20.3 - Jul. 10, 2016 Yesterdays bugfix broke more than it fixed, refixed. diff --git a/chat.php b/chat.php index 88399de..ac14a16 100644 --- a/chat.php +++ b/chat.php @@ -837,14 +837,6 @@ function send_alogin(){ print_end(); } -function sort_names(&$names){ - $keys=[]; - foreach($names as $k => $v){ - $keys[]=(string) $k; - } - array_multisort(array_map('strtolower', $keys), SORT_ASC, SORT_STRING, $names); -} - function send_admin($arg=''){ global $A, $H, $I, $P, $U, $db; $ga=(int) get_setting('guestaccess'); @@ -951,7 +943,7 @@ function send_admin($arg=''){ sort_names($A); foreach($A as $member){ echo ""; + echo "value=\"$user[3]\" style=\"$user[1]\">$user[0]"; } } } @@ -2121,7 +2113,7 @@ function write_new_session(){ if($U['status']>=3 && !$U['incognito']){ add_system_message(sprintf(get_setting('msgenter'), style_this($U['nickname'], $U['style']))); } - $P[$U['nickname']]=[$U['nickname'], $U['style'], $U['status']]; + $P[$U['nickname']]=[$U['nickname'], $U['style'], $U['status'], $U['nickname']]; } } @@ -2357,7 +2349,7 @@ function parse_sessions(){ $stmt=$db->query('SELECT nickname, style, status, incognito FROM ' . PREFIX . 'sessions WHERE entry!=0 AND status>0 ORDER BY status DESC, lastpost DESC;'); while($temp=$stmt->fetch(PDO::FETCH_ASSOC)){ if(!$temp['incognito']){ - $P[$temp['nickname']]=[$temp['nickname'], $temp['style'], $temp['status']]; + $P[$temp['nickname']]=[$temp['nickname'], $temp['style'], $temp['status'], $temp['nickname']]; } if($temp['status']>=5){ ++$countmods; @@ -2389,7 +2381,7 @@ function read_members(){ global $A, $db; $result=$db->query('SELECT * FROM ' . PREFIX . 'members;'); while($temp=$result->fetch(PDO::FETCH_ASSOC)){ - $A[$temp['nickname']]=[$temp['nickname'], $temp['style'], $temp['status']]; + $A[$temp['nickname']]=[$temp['nickname'], $temp['style'], $temp['status'], $temp['nickname']]; } } @@ -2763,7 +2755,7 @@ function validate_input(){ $stmt=$db->prepare('SELECT nickname, style, status FROM ' . PREFIX . 'members WHERE eninbox!=0 AND eninbox<=? AND nickname NOT IN (SELECT nickname FROM ' . PREFIX . 'sessions WHERE incognito=0) AND nickname NOT IN (SELECT ign FROM ' . PREFIX . 'ignored WHERE ignby=?) AND nickname NOT IN (SELECT ignby FROM ' . PREFIX . 'ignored WHERE ign=?);'); $stmt->execute(array($U['status'], $U['nickname'], $U['nickname'])); while($tmp=$stmt->fetch(PDO::FETCH_ASSOC)){ - $P[$tmp['nickname']]=[$tmp['nickname'], $tmp['style'], $tmp['status']]; + $P[$tmp['nickname']]=[$tmp['nickname'], $tmp['style'], $tmp['status'], $tmp['nickname']]; $inboxes[$tmp['nickname']]=true; } if(isSet($P[$_REQUEST['sendto']])){ @@ -3119,6 +3111,14 @@ function prepare_message_print(&$message, $injectRedirect, $redirect, $removeEmb // this and that +function sort_names(&$names){ + $keys=[]; + foreach($names as $v){ + $keys[]=$v[3]; + } + array_multisort(array_map('strtolower', $keys), SORT_ASC, SORT_STRING, $names); +} + function send_headers(){ header('Content-Type: text/html; charset=UTF-8'); header('Pragma: no-cache'); @@ -3748,7 +3748,7 @@ function load_lang(){ function load_config(){ date_default_timezone_set('UTC'); - define('VERSION', '1.20.3'); // Script version + define('VERSION', '1.20.4'); // Script version define('DBVERSION', 23); // Database version define('MSGENCRYPTED', false); // Store messages encrypted in the database to prevent other database users from reading them - true/false - visit the setup page after editing! define('ENCRYPTKEY', 'MY_KEY'); // Encryption key for messages