added chatinfo to NP

This commit is contained in:
genuineparts 2025-06-18 20:12:29 +02:00
parent 16ef8fdf6c
commit faad932a90
2 changed files with 31 additions and 18 deletions

View file

@ -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;
}
}

View file

@ -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']='<img src="'.$path.'/themes/funchat/images/'.$data['s'].'.png" alt="'.$data['s'].'" />';
$user['room']=$data['room'];
$user['roomlock']='<img src="'.$path.'/themes/funchat/images/unlocked.png" alt="Offen" />';
if($user['roomlocked']){
$user['roomlock']='<img src="'.$path.'/themes/funchat/images/locked.png" alt="Abgeschlossen" />';
}
}
//$forum['buddylist'];
if($session->userdata['uid']!=""){