added chatinfo to NP
This commit is contained in:
parent
16ef8fdf6c
commit
faad932a90
2 changed files with 31 additions and 18 deletions
|
@ -75,24 +75,33 @@ function get_user_list() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_user_room($username) {
|
function get_user_room($username) {
|
||||||
global $config;
|
global $config, $ccache;
|
||||||
$content = get_user_list();
|
// Open URL to userlist
|
||||||
$content = trim($content);
|
// erzeuge einen neuen cURL-Handle
|
||||||
$content = explode("\n", $content);
|
$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) {
|
if($httpCode >= 200 && $httpCode < 300){
|
||||||
$data = explode("|", $line);
|
//$content = $ccache->get('roomdata');
|
||||||
list($nick, $color) = explode(",", $data[1]);
|
if($content = ""){
|
||||||
list($room, $status,$type) = explode(",", $data[0]);
|
return false;
|
||||||
$list[$nick]['c']=$color;
|
|
||||||
$list[$nick]['r']=$room;
|
|
||||||
$list[$nick]['s']=$status;
|
|
||||||
$list[$nick]['g']=$type;
|
|
||||||
}
|
}
|
||||||
if(array_key_exists_chat($username,$list)){
|
$content = json_decode($fh,true);
|
||||||
return $list[$username];
|
// Return userlist
|
||||||
|
return $content;
|
||||||
}else{
|
}else{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,8 +136,12 @@ class nickpage extends module{
|
||||||
$user['text']=$parser->parse($user['np_text']);
|
$user['text']=$parser->parse($user['np_text']);
|
||||||
$data=get_user_room($user['username']);
|
$data=get_user_room($user['username']);
|
||||||
if($data){
|
if($data){
|
||||||
$user['room']=$data['r'];
|
$user['room']=$data['room'];
|
||||||
$user['roomlock']='<img src="'.$path.'/themes/funchat/images/'.$data['s'].'.png" alt="'.$data['s'].'" />';
|
$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'];
|
//$forum['buddylist'];
|
||||||
if($session->userdata['uid']!=""){
|
if($session->userdata['uid']!=""){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue