From faad932a90fc868a4d5d78a5ba66c241af89dd62 Mon Sep 17 00:00:00 2001 From: genuineparts Date: Wed, 18 Jun 2025 20:12:29 +0200 Subject: [PATCH] added chatinfo to NP --- modules/chat/chatfunctions.inc.php | 41 +++++++++++++++++----------- modules/nickpage/nickpage.output.php | 8 ++++-- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/modules/chat/chatfunctions.inc.php b/modules/chat/chatfunctions.inc.php index f86ff1b..78035aa 100644 --- a/modules/chat/chatfunctions.inc.php +++ b/modules/chat/chatfunctions.inc.php @@ -75,24 +75,33 @@ function get_user_list() { } function get_user_room($username) { - global $config; - $content = get_user_list(); - $content = trim($content); - $content = explode("\n", $content); + global $config, $ccache; + // Open URL to userlist + // erzeuge einen neuen cURL-Handle + $ch = curl_init(); + // setze die URL und andere Optionen + curl_setopt($ch, CURLOPT_URL, "https://chat.funch.at/info/".$username); + //curl_setopt($ch, CURLOPT_URL, "https://46.4.58.184/info"); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 30); + // führe die Aktion aus und gebe die Daten an den Browser weiter + $fh=curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); - foreach($content as $line) { - $data = explode("|", $line); - list($nick, $color) = explode(",", $data[1]); - list($room, $status,$type) = explode(",", $data[0]); - $list[$nick]['c']=$color; - $list[$nick]['r']=$room; - $list[$nick]['s']=$status; - $list[$nick]['g']=$type; - } - if(array_key_exists_chat($username,$list)){ - return $list[$username]; + if($httpCode >= 200 && $httpCode < 300){ + //$content = $ccache->get('roomdata'); + if($content = ""){ + return false; + } + $content = json_decode($fh,true); + // Return userlist + return $content; }else{ - return FALSE; + return false; } } diff --git a/modules/nickpage/nickpage.output.php b/modules/nickpage/nickpage.output.php index 66e37e6..c5e460f 100644 --- a/modules/nickpage/nickpage.output.php +++ b/modules/nickpage/nickpage.output.php @@ -136,8 +136,12 @@ class nickpage extends module{ $user['text']=$parser->parse($user['np_text']); $data=get_user_room($user['username']); if($data){ - $user['room']=$data['r']; - $user['roomlock']=''.$data['s'].''; + $user['room']=$data['room']; + $user['roomlock']='Offen'; + if($user['roomlocked']){ + $user['roomlock']='Abgeschlossen'; + } + } //$forum['buddylist']; if($session->userdata['uid']!=""){