2025-06-02 10:01:12 +02:00
< ? php
2025-06-23 20:45:15 +02:00
global $session ;
If ( ! defined ( " INBCWE " )) {
2025-06-02 10:01:12 +02:00
die ( " Dieses Script kann nicht ausserhalb des Frameworks laufen! " );
}
$session -> page_begin ( 'Chat' , FALSE );
$this -> nav [ " right " ] = FALSE ;
class chat extends module {
function output (){
global $session , $config , $db , $tpl , $core , $plugin , $meta ;
if ( $session -> userdata [ 'uid' ] == 0 ){
$core -> message ( 'Sorry' , " Du must eingeloggt sein um zu chatten. " );
//}elseif($session->userdata['betatester']==false){
//$core->message('Sorry', 'You are currently not invited to this Betatest.');
} else {
$data = chat_online ();
if ( ! $data [ " chat_offline " ]) {
if ( $data [ " usercount " ] == 1 ) {
$befinden = " ist " ;
} else {
$befinden = " sind " ;
}
2025-06-25 22:17:29 +02:00
2025-06-15 22:25:18 +02:00
$rooms = array ( array ( 'room' => 'Lounge' , 'selected' => 'selected="selected"' ), array ( 'room' => 'Flirt' , 'selected' => '' ), array ( 'room' => 'Quiz' , 'selected' => '' ));
2025-06-02 10:01:12 +02:00
$this -> tpl -> assign ( 'options' , $rooms );
if ( $session -> userdata [ 'allow_grimdark' ] == 0 ){
$this -> tpl -> assign ( 'usercount' , $data [ 'usercount' ]);
} else {
$this -> tpl -> assign ( 'usercount' , $data [ 'usercount' ] + $data [ 'gdusercount' ]);
}
unset ( $data [ 'usercount' ]);
unset ( $data [ 'gdusercount' ]);
$this -> tpl -> assign ( 'user' , $data );
$this -> tpl -> assign ( 'befinden' , $befinden );
return $this -> tpl -> fetch ( 'chat.tpl' , 'chat_front' );
} else {
$core -> message ( 'Sorry' , 'Scheint so als hätte der Chat gerade Probleme. Wir kümmern uns sofort darum!' , FALSE , $config [ 'path' ] . '/index.php' );
}
}
}
function output_in (){
global $session , $config , $db , $tpl , $core , $plugin , $meta ;
if ( $session -> userdata [ 'uid' ] == 0 ){
$core -> message ( 'Sorry' , " Du must eingeloggt sein um zu chatten. " );
} else {
if ( isset ( $_POST [ 'room' ]) && $_POST [ 'room' ] != " " ){
$rctemplate = 1 ;
if ( $config [ 'switcharoo' ] == 1 ){
$result = $db -> query ( " SELECT `new_id` FROM ` " . $config [ " prefix " ] . " switch` WHERE `uid`=' " . $db -> escape ( $_POST [ 'nick' ]) . " ' " ) or die ( $db -> error ());
$row = $db -> fetch_array ( $result );
if ( $db -> num_rows ( $result ) > 0 ){
$_POST [ 'nick' ] = $row [ 'new_id' ];
}
}
$subs = array ( '1' => 'Enter' , '2' => 'Shift+Enter' );
$ch = curl_init ();
// setze die URL und andere Optionen
2025-07-01 20:37:31 +02:00
curl_setopt ( $ch , CURLOPT_URL , 'https://chat.funch.at/login?uid=' . $session -> userdata [ 'uid' ] . '&room=' . $_POST [ 'room' ] . '&ip=' . $_SERVER [ 'REMOTE_ADDR' ] . '&browser=' . urlencode ( $_SERVER [ 'HTTP_USER_AGENT' ]) . '&loginkey=' . $config [ 'LOGINKEY' ] . '&template=' . $rctemplate );
2025-06-02 10:01:12 +02:00
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 , 3 );
2025-06-19 21:07:36 +02:00
// führe die Aktion aus und gebe die Daten an den Browser weiterChanged VCall name back
2025-06-02 10:01:12 +02:00
$fh = curl_exec ( $ch );
//var_dump(curl_getinfo($ch));
// schließe den cURL-Handle und gebe die Systemresourcen frei
curl_close ( $ch );
if ( $fh ) {
$buffer = trim ( $fh );
}
if ( substr ( $buffer , 0 , 6 ) == " Error: " ) {
die ( " Fatal " . $buffer );
}
if ( substr ( $buffer , 0 , 8 ) == " blocked: " ) {
$time = explode ( " " , $buffer );
$timeout = date ( " d.m.Y, H:i:s " , $time [ 1 ] / 1000 );
$core -> message ( 'Oje...' , 'Du bist vorübergehend gebannt bis: ' . $timeout , FALSE , $config [ 'path' ] . '/index.php' );
} else {
$ooc = false ;
$cookie = trim ( $buffer );
$result = $db -> query ( " SELECT `name`,`color`,`submit`,`whisperwindow`,`notice` FROM `v_ptc_users` WHERE `uid`=' " . $session -> userdata [ 'uid' ] . " ' " ) or die ( $db -> error ());
while ( $row = $db -> fetch_array ( $result )){
$nick = $row [ 'name' ];
$col = $row [ 'color' ];
//$bg=$row['bgmusic'];
$nc = $row [ 'notice' ];
//$ooc=$row['ooc_shown'];
$sub = $row [ 'submit' ];
$whisper = $row [ 'whisperwindow' ];
}
$meta .= '<script> var yacsid="' . $cookie . '";var subm="' . $sub . '"; var col="' . $col . '"; var chid="' . $session -> userdata [ 'uid' ] . '"; var whwind=' . $whisper . '; var ncounter=' . $nc . '; var nickcheck = /(\b' . $nick . '\b)/gi;</script>' ;
if ( $whisper == 'true' ){
$whtext = 'Füsterfenster: An' ;
} else {
$whtext = 'Füsterfenster: Aus' ;
}
if ( $ooc == 'true' ){
$ooctext = 'OOC: Shown' ;
} else {
$ooctext = 'OOC: Hidden' ;
}
if ( $col == " " || $col == " 000000 " ){
$col == " FFFFFF " ;
}
if ( file_exists ( $config [ 'fullpath' ] . '/modules/rp/images/' . intval ( $_POST [ 'nick' ]) . '.small' )){
$simg = '<img src="//' . $config [ 'domain' ] . '/modules/rp/images/' . intval ( $_POST [ 'nick' ]) . '.small" style="border:none; margin: 2px; float:left;" alt="' . $nick . '" title="' . $nick . '" /><span style="color:#' . $col . ';">:</span>' ;
} else {
$simg = '<span style="color:#' . $col . ';">' . $nick . ':</span>' ;
}
2025-06-25 22:17:29 +02:00
$content = " " ;
2025-06-02 10:01:12 +02:00
$tpl -> assign ( 'cookie' , $cookie );
$tpl -> assign ( 'username' , $nick );
$tpl -> assign ( 'id' , $_POST [ 'nick' ]);
$this -> titleaddon = $nick . ' - ' ;
$tpl -> assign ( 'whtext' , $whtext );
$tpl -> assign ( 'ooctext' , $ooctext );
$tpl -> assign ( 'submit' , $subs [ $sub ]);
$tpl -> assign ( 'subm' , $sub );
$tpl -> assign ( 'col' , $col );
$tpl -> assign ( 'simg' , $simg );
$tpl -> assign ( 'port' , $config [ 'SOCK_PORT' ]);
//return $this->tpl->fetch('chatin.tpl','chat');
$meta .= $this -> inmeta2 ();
$ctpl = 'chat_full_ws.tpl' ;
$core -> make_page ( $content , TRUE , $config [ 'fullpath' ] . '/modules/chat/templates/default/' . $ctpl , $config [ 'fullpath' ] . '/modules/chat/templates/default/chat_header.tpl' , $config [ 'fullpath' ] . '/modules/chat/templates/default/chat_footer.tpl' );
}
} else {
$core -> message ( 'Error!' , 'something did not work!' , True , $config [ 'path' ] . '/chat.html' , 3 );
}
}
}
function output_online (){
2025-06-25 22:17:29 +02:00
global $core , $config ;
$data = chat_online ();
2025-06-02 10:01:12 +02:00
unset ( $data [ " usercount " ]);
unset ( $data [ " gdusercount " ]);
if ( ! $data [ " chat_offline " ]) {
$this -> tpl -> assign ( 'data' , $data );
return $this -> tpl -> fetch ( 'online.tpl' );
} else {
$core -> message ( 'Sorry' , 'Der Chat ist zurzeit offline.' , FALSE , $config [ 'path' ] . '/index.php' );
}
}
function output_editlog (){
2025-06-25 22:17:29 +02:00
global $session , $config , $db , $core , $meta ;
2025-06-02 10:01:12 +02:00
$meta .= '<script type="text/javascript"> var chid="' . $_GET [ 'id' ] . '"</script>' ;
$logs = $db -> query ( " SELECT c.*, u.`username` FROM ` " . $config [ " prefix " ] . " conversations` c LEFT JOIN ` " . $config [ " prefix " ] . " users` u ON u.`uid`=c.`owner` WHERE c.`owner`=' " . $session -> userdata [ 'uid' ] . " ' AND c.`id`=' " . intval ( $_GET [ 'id' ]) . " ' " );
if ( $db -> num_rows ( $logs ) <= 0 ){
$core -> message ( 'Sorry' , 'This won\'t work, Punk.' , FALSE , $config [ 'path' ] . '/index.php' );
}
while ( $rowl = $db -> fetch_array ( $logs )){
$rowl [ 'date' ] = date ( 'd.m.Y, H:i' , $rowl [ 'timestamp' ]);
$convos [] = $rowl ;
}
$shares = $db -> query ( " SELECT u.`uid`,u.`username` FROM ` " . $config [ " prefix " ] . " conversations` c LEFT JOIN ` " . $config [ " prefix " ] . " users` u ON u.`uid`=c.`uid` WHERE c.`owner`=' " . $session -> userdata [ 'uid' ] . " ' AND c.`room`=' " . $db -> escape ( $convos [ 0 ][ 'room' ]) . " ' AND c.`timestamp`=' " . $convos [ 0 ][ 'timestamp' ] . " ' AND c.`uid`<>c.`owner` " );
while ( $sh = $db -> fetch_array ( $shares )){
$share [] = $sh ;
}
if ( $convos [ 0 ][ 'shared' ] != '' ){
$this -> tpl -> assign ( 'checked' , 'checked="checked"' );
$this -> tpl -> assign ( 'pupl' , '<span id="sharetext">Use this link to share this log with everyone:<br /><input name="share" id="sharelink" size="60" value="//logs.coppertopia.net/user/' . $convos [ 0 ][ 'username' ] . '/key/' . $convos [ 0 ][ 'shared' ] . '" /></span>' );
}
$this -> tpl -> assign ( 'share' , $share );
$this -> tpl -> assign ( 'id' , intval ( $_GET [ 'id' ]));
return $this -> tpl -> fetch ( 'editlog.tpl' , 'editlog' );
}
function output_deletelog (){
global $session , $config , $db , $tpl , $core , $plugin , $meta ;
$shares = $db -> query ( " SELECT * FROM ` " . $config [ " prefix " ] . " conversations` WHERE `id`=' " . intval ( $_GET [ 'id' ]) . " ' " );
$rowl = $db -> fetch_array ( $shares );
if ( $rowl [ 'owner' ] == $session -> userdata [ 'uid' ]){
$did = $db -> query ( " SELECT `id` from ` " . $config [ " prefix " ] . " conversations` WHERE `room`= ' " . $db -> escape ( $rowl [ 'room' ]) . " ' AND `timestamp`=' " . $rowl [ 'timestamp' ] . " ' AND `owner`=' " . $session -> userdata [ 'uid' ] . " ' " );
while ( $delid = $db -> fetch_array ( $did )){
$ids [] = $delid [ 'id' ];
}
2025-06-25 22:17:29 +02:00
$sql = " DELETE FROM ` " . $config [ " prefix " ] . " conversations` WHERE `id` in(' " . join ( '\',\'' , $ids ) . " ') " ;
2025-06-02 10:01:12 +02:00
$db -> query ( $sql );
$db -> query ( " DELETE FROM ` " . $config [ " prefix " ] . " private_logs` WHERE `cid`=' " . $rowl [ 'id' ] . " ' " );
} else {
$sql = " DELETE FROM ` " . $config [ " prefix " ] . " conversations` WHERE `id`=' " . intval ( $_GET [ 'id' ]) . " ' AND `uid`=' " . $session -> userdata [ 'uid' ] . " ' " ;
$db -> query ( $sql );
}
$core -> message ( 'Deleted' , 'The log was deleted.' , TRUE , $config [ 'path' ] . '/private.html' );
}
function output_privatelogs (){
global $session , $config , $db , $tpl , $core , $plugin , $meta ;
$parser = $db -> query ( " SELECT * FROM `ptc_replacer` " );
$counter = 0 ;
while ( $rowp = $db -> fetch_array ( $parser )){
$rowp [ 'search' ] = str_replace ( '(?i)' , '' , $rowp [ 'search' ]);
$regparser_s [ $counter ] = " / " . $rowp [ 'search' ] . " /i " ;
$regparser_r [ $counter ] = $rowp [ 'replace' ];
$counter ++ ;
}
if ( ! isset ( $_GET [ 'user' ]) && ! isset ( $_GET [ 'key' ]) && ! isset ( $_GET [ 'id' ])){
$logs = $db -> query ( " SELECT u.`username`,c.* FROM ` " . $config [ " prefix " ] . " conversations` c LEFT JOIN ` " . $config [ " prefix " ] . " users` u ON c.`owner`=u.`uid` WHERE c.`uid`=' " . $session -> userdata [ 'uid' ] . " ' " );
while ( $rowl = $db -> fetch_array ( $logs )){
$rowl [ 'date' ] = date ( 'd.m.Y, H:i' , $rowl [ 'timestamp' ]);
if ( $rowl [ 'owner' ] == $session -> userdata [ 'uid' ]){
$rowl [ 'sname' ] = 'You' ;
} else {
$rowl [ 'sname' ] = $rowl [ 'username' ];
}
$convos [] = $rowl ;
}
$this -> tpl -> assign ( 'convos' , $convos );
return $this -> tpl -> fetch ( 'privatechatlogs.tpl' , 'privatechatlogs' );
}
if ( isset ( $_GET [ 'id' ])){
$sql = " SELECT o.`id` as `id`,o.`timestamp`,o.`room` FROM ` " . $config [ " prefix " ] . " conversations` c LEFT JOIN ` " . $config [ " prefix " ] . " conversations` o ON c.`room`=o.`room` AND c.`timestamp`=o.`timestamp` AND o.`uid`=c.`owner` WHERE c.`id`=' " . intval ( $_GET [ 'id' ]) . " ' AND c.`uid`=' " . $session -> userdata [ 'uid' ] . " ' " ;
$read = $db -> query ( $sql );
} elseif ( isset ( $_GET [ 'user' ]) && isset ( $_GET [ 'key' ])){
$sql = " SELECT c.`id` as `id`,c.`timestamp`,c.`room` FROM ` " . $config [ " prefix " ] . " users` u LEFT JOIN ` " . $config [ " prefix " ] . " conversations` c ON c.`uid`=u.`uid` AND c.`owner`=u.`uid` WHERE u.`username`=' " . $db -> escape ( $_GET [ 'user' ]) . " ' AND c.`shared`=' " . $db -> escape ( $_GET [ 'key' ]) . " ' " ;
$read = $db -> query ( $sql );
} else {
$core -> message ( 'Sorry' , 'I seem to be missing some vital information here.' , True , $config [ 'path' ] . '/index.php' );
}
if ( $db -> num_rows ( $read ) == 1 ){
$id = $db -> fetch_array ( $read );
$chid = $id [ 'id' ];
}
$log = $db -> query ( " SELECT * FROM ` " . $config [ " prefix " ] . " private_logs` WHERE `cid`=' " . $chid . " ' ORDER BY `timestamp` ASC " );
while ( $rowl = $db -> fetch_array ( $log )){
$rowl [ 'date' ] = date ( 'H:i:s' , $rowl [ 'timestamp' ]);
if ( file_exists ( $config [ 'fullpath' ] . '/modules/rp/images/' . $rowl [ 'uid' ] . '.small' ) && $rowl [ 'action' ] != 'txtNarr' ){
$rowl [ 'img' ] = '<img src="//' . $config [ 'domain' ] . '/modules/rp/images/' . $rowl [ 'uid' ] . '.small" style="border:none;"/>' ; // Eyecon
}
switch ( $rowl [ 'action' ]){
case 'txtMe' :
$rowl [ 'line' ] = '<span style="font-style: italic;">' . $rowl [ 'user' ] . ' ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtMes' :
$rowl [ 'line' ] = '<span style="font-style: italic;">' . $rowl [ 'user' ] . '\'s ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtOOC' :
$rowl [ 'line' ] = $rowl [ 'user' ] . ': ((' . $rowl [ 'text' ] . '))' ;
break ;
case 'txtScream' :
$rowl [ 'line' ] = '<span style="font-style: italic; font-weight: bold;">' . $rowl [ 'user' ] . ' shouts: ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtGroan' :
$rowl [ 'line' ] = '<span style="font-style: italic; font-weight: bold;">' . $rowl [ 'user' ] . ' groans: ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtNarr' :
$rowl [ 'line' ] = '<span style="font-style: italic; font-weight: bold;">Narrator: ' . $rowl [ 'text' ] . '</span>' ;
break ;
default :
$rowl [ 'line' ] = $rowl [ 'user' ] . ': ' . $rowl [ 'text' ];
break ;
}
$rowl [ 'line' ] = preg_replace ( $regparser_s , $regparser_r , $rowl [ 'line' ]);
$logs [] = $rowl ;
}
$this -> tpl -> assign ( 'logs' , $logs );
$this -> tpl -> assign ( 'room' , $id [ 'room' ]);
$this -> tpl -> assign ( 'date' , date ( 'd.m.Y, H:i' , $id [ 'timestamp' ]));
if ( $_GET [ 'out' ] == 'pdf' ){
require_once ( $config [ 'fullpath' ] . '/thirdparty/tcpdf/config/lang/eng.php' );
require_once ( $config [ 'fullpath' ] . '/thirdparty/tcpdf/mypdf.php' );
// create new PDF document
$pdf = new MYPDF ( PDF_PAGE_ORIENTATION , PDF_UNIT , PDF_PAGE_FORMAT , true , 'UTF-8' , false );
$pdf -> setFooterData ( $tc = array ( 255 , 255 , 255 ), $lc = array ( 255 , 255 , 255 ));
$pdf -> SetFooterMargin ( PDF_MARGIN_FOOTER );
$pdf -> SetAutoPageBreak ( TRUE , PDF_MARGIN_BOTTOM );
$pdf -> AddPage ();
$data = $this -> tpl -> fetch ( 'pdf_log.tpl' , 'log_pdf' . intval ( $_GET [ 'id' ]));
$pdf -> writeHTMLCell ( $w = 0 , $h = 0 , $x = '' , $y = '' , $data , $border = 0 , $ln = 1 , $fill = 0 , $reseth = true , $align = '' , $autopadding = true );
$pdf -> Output ( 'log-' . $id [ 'room' ] . '-' . date ( 'd.m.Y, H:i' , $id [ 'timestamp' ]) . '.pdf' , 'I' );
} else {
return $this -> tpl -> fetch ( 'log.tpl' , 'log' . intval ( $_GET [ 'id' ]));
}
}
function output_logs (){
global $session , $config , $db , $tpl , $core , $plugin , $meta ;
$specialdates = array ();
if ( $session -> userdata [ 'uid' ] == 0 ){
$core -> message ( 'Sorry' , " You have to be logged in to participate. " );
} else {
$date = '' ;
2025-06-25 22:17:29 +02:00
$logs = array ();
2025-06-02 10:01:12 +02:00
$cd = '' ;
if ( isset ( $_POST [ 'nicks' ]) && $_POST [ 'nicks' ] != " " ){
$chars = explode ( ', ' , $_POST [ 'nicks' ]);
array_pop ( $chars );
2025-06-25 22:17:29 +02:00
$char = '\'' . join ( '\',\'' , $chars ) . '\'' ;
2025-06-02 10:01:12 +02:00
$cd = ' AND `user` IN (' . $char . ')' ;
}
if ( isset ( $_POST [ 'date' ]) && $_POST [ 'date' ] != " " ){
$d = $_POST [ 'date' ];
$date = ' AND `timestamp` BETWEEN \'' . strtotime ( $_POST [ 'date' ]) . '\' AND \'' . strtotime ( $_POST [ 'date' ] . '+1 day' ) . '\'' ;
} else {
$d = date ( 'd.m.Y' );
$date = ' AND `timestamp` BETWEEN \'' . strtotime ( 'today' ) . '\' AND \'' . strtotime ( 'tomorrow' ) . '\'' ;
}
$regparser_s = array ();
$regparser_r = array ();
$parser = $db -> query ( " SELECT * FROM `ptc_replacer` " );
$counter = 0 ;
while ( $rowp = $db -> fetch_array ( $parser )){
$rowp [ 'search' ] = str_replace ( '(?i)' , '' , $rowp [ 'search' ]);
$regparser_s [ $counter ] = " / " . $rowp [ 'search' ] . " /i " ;
$regparser_r [ $counter ] = $rowp [ 'replace' ];
$counter ++ ;
}
if ( isset ( $_POST [ 'room' ]) && $_POST [ 'room' ] != " " ){
2025-06-29 15:55:21 +02:00
if ( $_POST [ 'room' ] != 'Chitchat' || $session -> userdata [ 'chatrights' ] >= 50 ){
2025-06-02 10:01:12 +02:00
$log = $db -> query ( " SELECT * FROM `ptc_chatlog` WHERE `room`=' " . $db -> escape ( $_POST [ 'room' ]) . " ' " . $date . $cd . " ORDER BY `timestamp` " );
while ( $rowl = $db -> fetch_array ( $log )){
$rowl [ 'date' ] = date ( 'H:i:s' , $rowl [ 'timestamp' ]);
if ( file_exists ( $config [ 'fullpath' ] . '/modules/rp/images/' . $rowl [ 'uid' ] . '.small' ) && $rowl [ 'action' ] != 'txtNarr' ){
$rowl [ 'img' ] = '<img src="//' . $config [ 'domain' ] . '/modules/rp/images/' . $rowl [ 'uid' ] . '.small" alt="" style="border:none;"/>' ; // Eyecon
}
switch ( $rowl [ 'action' ]){
case 'txtMe' :
$rowl [ 'line' ] = '<span style="font-style: italic;">' . $rowl [ 'user' ] . ' ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtMes' :
$rowl [ 'line' ] = '<span style="font-style: italic;">' . $rowl [ 'user' ] . '\'s ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtOOC' :
$rowl [ 'line' ] = $rowl [ 'user' ] . ': ((' . $rowl [ 'text' ] . '))' ;
break ;
case 'txtScream' :
$rowl [ 'line' ] = '<span style="font-style: italic; font-weight: bold;">' . $rowl [ 'user' ] . ' shouts: ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtYodel' :
$rowl [ 'line' ] = '<span style="font-style: italic; font-weight: bold;">' . $rowl [ 'user' ] . ' yodles: ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtGroan' :
$rowl [ 'line' ] = '<span style="font-style: italic; font-weight: bold;">' . $rowl [ 'user' ] . ' groans: ' . $rowl [ 'text' ] . '</span>' ;
break ;
case 'txtNarr' :
$rowl [ 'line' ] = '<span style="font-style: italic; font-weight: bold;">Narrator: ' . $rowl [ 'text' ] . '</span>' ;
break ;
default :
$rowl [ 'line' ] = $rowl [ 'user' ] . ': ' . $rowl [ 'text' ];
break ;
}
$rowl [ 'line' ] = preg_replace ( $regparser_s , $regparser_r , $rowl [ 'line' ]);
$logs [] = $rowl ;
}
} else {
$logs [] = " " ;
}
}
$rooms = '' ;
$result = $db -> query ( " SELECT `room` FROM `ptc_chatlog` GROUP BY `room` " );
while ( $row = $db -> fetch_array ( $result )){
2025-06-29 15:55:21 +02:00
if ( $session -> userdata [ 'chatrights' ] < 50 && $row [ 'room' ] == 'Chitchat' ){
2025-06-02 10:01:12 +02:00
continue ;
}
if ( $_POST [ 'room' ] == $row [ 'room' ]){
$rooms .= '<option selected="selected" value="' . $row [ 'room' ] . '">' . $row [ 'room' ] . '</option>' ;
} else {
$rooms .= '<option value="' . $row [ 'room' ] . '">' . $row [ 'room' ] . '</option>' ;
}
}
if ( isset ( $specialdates [ $_POST [ 'date' ]][ 1 ])){
$this -> tpl -> assign ( 'extrareason' , $specialdates [ $_POST [ 'date' ]][ 0 ]);
$this -> tpl -> assign ( 'divextra' , 'style="padding: 3px; background: ' . $specialdates [ $_POST [ 'date' ]][ 1 ] . ';"' );
}
$this -> tpl -> assign ( 'nicks' , $_POST [ 'nicks' ]);
$this -> tpl -> assign ( 'date' , $d );
$this -> tpl -> assign ( 'rooms' , $rooms );
$this -> tpl -> assign ( 'logs' , $logs );
return $this -> tpl -> fetch ( 'chatlogs.tpl' , 'chat_logs' );
}
}
function output_report (){
global $session , $config , $db , $tpl , $core , $plugin , $meta ;
if ( $session -> userdata [ 'uid' ] == 0 ){
$core -> message ( 'Sorry' , " You have to be logged in to participate. " );
} else {
2025-06-29 15:55:21 +02:00
if ( ! $session -> userdata [ 'chatrights' ] >= 50 ){
2025-06-02 10:01:12 +02:00
$core -> message ( 'Sorry' , " Can't touch this. " );
} else {
if ( $_GET [ 'uid' ] == '' ){
2025-06-03 08:40:33 +02:00
$nreport = $db -> query ( " SELECT r.*,u.username,u.fuid,s.fuid as `cpid`,s.username as `cname` FROM `ptc_reports` r LEFT JOIN ` " . $config [ " prefix " ] . " users` u ON u.`uid`=r.`rpid` LEFT JOIN ` " . $config [ " prefix " ] . " users` s ON s.`uid`=r.`uid` WHERE `seen`='0' ORDER BY `time` DESC " );
2025-06-02 10:01:12 +02:00
//echo "SELECT r.*,u.username,u.fuid,c.name,s.fuid as `cpid`,s.username as `cname` FROM `ptc_reports` r LEFT JOIN `" . $config["prefix"] . "users` u ON u.`uid`=r.`rpid` LEFT JOIN `" . $config["prefix"] . "users` s ON s.`uid`=r.`uid` LEFT JOIN `" . $config["prefix"] . "rp_chars` c ON c.`id`=r.`chid` WHERE `seen`='0' ORDER BY `time` DESC";
while ( $rown = $db -> fetch_array ( $nreport )){
$rown [ 'date' ] = date ( 'd.m.Y H:i:s' , $rown [ 'time' ]);
$nrep [] = $rown ;
}
2025-06-03 08:40:33 +02:00
$report = $db -> query ( " SELECT r.*,u.username,u.fuid,s.fuid as `cpid`,s.username as `cname` FROM `ptc_reports` r LEFT JOIN ` " . $config [ " prefix " ] . " users` u ON u.`uid`=r.`rpid` LEFT JOIN ` " . $config [ " prefix " ] . " users` s ON s.`uid`=r.`uid` WHERE `seen`='1' ORDER BY `time` DESC " );
2025-06-02 10:01:12 +02:00
while ( $rowp = $db -> fetch_array ( $report )){
$rowp [ 'date' ] = date ( 'd.m.Y H:i:s' , $rowp [ 'time' ]);
$rep [] = $rowp ;
}
$tpl -> assign ( 'nrep' , $nrep );
$tpl -> assign ( 'rep' , $rep );
$meta .= $this -> repmeta ();
2025-06-25 22:17:29 +02:00
$content = " " ;
2025-06-02 10:01:12 +02:00
$core -> make_page ( $content , TRUE , $config [ 'fullpath' ] . '/modules/chat/templates/default/reports.tpl' , $config [ 'fullpath' ] . '/modules/chat/templates/default/chat_header.tpl' , $config [ 'fullpath' ] . '/modules/chat/templates/default/chat_footer.tpl' );
} else {
//echo "SELECT r.*,u.username,u.fuid,c.name,r.fuid as `cpid`,s.username as `cname` FROM `ptc_reports` r LEFT JOIN `" . $config["prefix"] . "users` u ON u.`uid`=r.`rpid` LEFT JOIN `" . $config["prefix"] . "users` s ON s.`uid`=r.`uid` LEFT JOIN `" . $config["prefix"] . "rp_chars` c ON c.`id`=r.`chid` WHERE `seen`='0' AND r.`uid`='". intval($_GET['uid']) ."' ORDER BY `time` DESC";
2025-06-03 08:40:33 +02:00
$nreport = $db -> query ( " SELECT r.*,u.username,u.fuid,s.fuid as `cpid`,s.username as `cname` FROM `ptc_reports` r LEFT JOIN ` " . $config [ " prefix " ] . " users` u ON u.`uid`=r.`rpid` LEFT JOIN ` " . $config [ " prefix " ] . " users` s ON s.`uid`=r.`uid` WHERE `seen`='0' AND r.`uid`=' " . intval ( $_GET [ 'uid' ]) . " ' ORDER BY `time` DESC " );
2025-06-02 10:01:12 +02:00
while ( $rown = $db -> fetch_array ( $nreport )){
$rown [ 'date' ] = date ( 'd.m.Y H:i:s' , $rown [ 'time' ]);
$nrep [] = $rown ;
}
2025-06-03 08:40:33 +02:00
$report = $db -> query ( " SELECT r.*,u.username,u.fuid,s.fuid as `cpid`, s.username as `cname` FROM `ptc_reports` r LEFT JOIN ` " . $config [ " prefix " ] . " users` u ON u.`uid`=r.`rpid` LEFT JOIN ` " . $config [ " prefix " ] . " users` s ON s.`uid`=r.`uid` WHERE `seen`='1' AND r.`uid`=' " . intval ( $_GET [ 'uid' ]) . " ' ORDER BY `time` DESC " );
2025-06-02 10:01:12 +02:00
while ( $rowp = $db -> fetch_array ( $report )){
$rowp [ 'date' ] = date ( 'd.m.Y H:i:s' , $rowp [ 'time' ]);
$rep [] = $rowp ;
}
$tpl -> assign ( 'nrep' , $nrep );
$tpl -> assign ( 'rep' , $rep );
$meta .= $this -> repmeta ();
2025-06-25 22:17:29 +02:00
$content = " " ;
2025-06-02 10:01:12 +02:00
$core -> make_page ( $content , TRUE , $config [ 'fullpath' ] . '/modules/chat/templates/default/reports.tpl' , $config [ 'fullpath' ] . '/modules/chat/templates/default/chat_header.tpl' , $config [ 'fullpath' ] . '/modules/chat/templates/default/chat_footer.tpl' );
}
}
}
}
function repmeta (){
2025-06-25 22:17:29 +02:00
global $yacsid , $config , $meta ;
2025-06-02 10:01:12 +02:00
$meta .= " <script src= \" //ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=1213232 \" ></script>
2025-06-19 21:07:36 +02:00
< link type = \ " text/css \" href= \" /themes/funchat/base/jquery-ui-1.9.2.custom.css?ver=1238732 \" rel= \" Stylesheet \" />
2025-06-02 10:01:12 +02:00
< script src = \ " //ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js?ver=123324732 \" ></script>
< script >
$ ( function () {
$ ( \ " #accordion \" ).accordion( {
heightStyle : \ " content \"
});
}); </ script > " ;
$meta .= ' < script >
$ ( document ) . ready ( function ()
{
$ ( \ ' body\ ' ) . on ( \ ' click\ ' , \ ' a . delete\ ' , function () {
jQuery . ajax ({
url : " /ajax.php " ,
data : { task : " chat " , call : " repdelete " , id : $ ( this ) . attr ( \ ' id\ ' )},
});
var parent = $ ( this ) . closest ( \ ' div\ ' );
var head = parent . prev ( \ ' h3\ ' );
parent . add ( head ) . fadeOut ( \ ' slow\ ' , function (){ $ ( this ) . remove ();});
});
$ ( \ ' body\ ' ) . on ( \ ' click\ ' , \ ' a . seen\ ' , function () {
jQuery . ajax ({
url : " /ajax.php " ,
data : { task : " chat " , call : " repseen " , id : $ ( this ) . attr ( \ ' id\ ' )},
});
var parent = $ ( this ) . closest ( \ ' div\ ' );
var head = parent . prev ( \ ' h3\ ' );
head . css ( " background " , " #80CB80 " );
$ ( this ) . removeClass ( \ ' seen\ ' ) . addClass ( \ ' unseen\ ' );
2025-06-03 08:40:33 +02:00
$ ( this ) . html ( \ ' < img style = " border:none; " src = " /themes/austria/images/icons/tick.png " > \ ' );
2025-06-02 10:01:12 +02:00
});
$ ( \ ' body\ ' ) . on ( \ ' click\ ' , \ ' a . unseen\ ' , function () {
jQuery . ajax ({
url : " /ajax.php " ,
data : { task : " chat " , call : " repunseen " , id : $ ( this ) . attr ( \ ' id\ ' )},
});
var parent = $ ( this ) . closest ( \ ' div\ ' );
var head = parent . prev ( \ ' h3\ ' );
head . css ( " background " , " #810000 " );
$ ( this ) . removeClass ( \ ' unseen\ ' ) . addClass ( \ ' seen\ ' );
2025-06-03 08:40:33 +02:00
$ ( this ) . html ( \ ' < img style = " border:none; " src = " /themes/austria/images/icons/eye.png " > \ ' );
2025-06-02 10:01:12 +02:00
});
$ ( \ ' body\ ' ) . on ( \ ' click\ ' , \ ' a . user\ ' , function () {
window . open ( $ ( this ) . attr ( \ ' href\ ' ), \ ' _blank\ ' );
return false ;
});
});
</ script > ' ;
return $meta ;
}
function inmeta2 (){
global $yacsid , $config ;
$meta = ' < script type = " text/javascript " >
document . domain = " '. $config['domain'] .' " ;
function popup ( url , args ) {
ok = window . open ( url , \ ' \ ' , args )
if ( ok ) return false ;
else return true ;
}
</ script > ' ;
2025-06-19 21:07:36 +02:00
$meta .= '<script type="text/javascript" src="/modules/chat/js/chat_ws.js?id=432113132"></script>' ;
2025-06-02 10:01:12 +02:00
/* $meta .= ' < script type = " text/javascript " >
function play () {
notice ();
}
</ script > ' ; */
$meta .= " <script src= \" //ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=1213232 \" ></script>
< link rel = \ " stylesheet \" media= \" screen \" type= \" text/css \" href= \" /modules/chat/colorpicker/spectrum.css \" />
< script type = \ " text/javascript \" src= \" /modules/chat/colorpicker/spectrum.js \" ></script>
< script src = \ " /modules/chat/js/tab.min.js?id=892191 \" type= \" text/javascript \" ></script>
< script type = \ " text/javascript \" >
var ulist ;
var weat ;
var clist ;
var locat ;
var as = true ;
var doit = true ;
var not = true ;
var socket ;
var userlist ;
var roomlist ;
var watchroom = false ;
var fadedin = false ;
var weathervar = 'none' ;
var noticefiles = [ 'ding' , 'blip' , 'cb' , 'chime' , 'whistle' ];
var noticename = [ 'Ding' , 'Blip' , 'Cowbell' , 'Glocke' , 'Pfeife' ];
var messages = [];
var mess = 0 ;
var whisper = /.*> ( .* ) < \ / span > \sfl & uuml ; stert : \s ([ \s\S ] * ) < \ / span >/ ;
var whisperto = /.*> Du\sfl & uuml ; sterst\szu .*> ( .* ) < \ / span >: \s ([ \s\S ] * ) < \ / span >/ ;
function refresh_userlist () {
if ( watchroom != true ){
$ . ajax ({
url : \ " /ajax.php \" ,
data : { task : \ " chat \" ,call: \" userlist \" , dat: userlist},
type : \ " POST \" ,
timeout : 4000 ,
success : function ( data ) {
$ ( '.userlist' ) . html ( data );
}
});
}
}
function allrooms () {
$ . ajax ({
url : \ " /ajax.php \" ,
data : { task : \ " chat \" ,call: \" rooms \" , dat: roomlist},
timeout : 4000 ,
type : \ " POST \" ,
success : function ( data ) {
jQuery ( '.userlist' ) . html ( data );
}
});
}
$ ( window ) . on ( 'beforeunload' , function (){
socket . close ();
});
function connect (){
2025-06-02 22:38:25 +02:00
var host = 'wss://chat.funch.at/' + yacsid ;
2025-06-02 10:01:12 +02:00
try {
socket = new WebSocket ( host );
socket . onopen = function (){
console . log ( 'Open' );
}
socket . onmessage = function ( msg ){
if ( msg != '' && msg != String . fromCharCode ( 0 )){
var dat = JSON . parse ( msg . data );
switch ( dat . type ){
case 'message' :
message ( dat . msg );
break ;
case 'userlist' :
userlist = dat . msg ;
refresh_userlist ();
break ;
case 'roomlist' :
roomlist = dat . msg ;
break ;
case 'whisper' :
check_whisper ( dat . msg );
break ;
}
}
}
socket . onerror = function ( error ){
console . log ( 'CLOSE' );
$ ( '#chatlog' ) . append ( 'Error! Please check your browsers console for the error message.' );
window . onbeforeunload = null ;
if ( as != false ){
2025-06-26 14:52:34 +02:00
$ ( '#chatlog' ) . scrollTop ( $ ( '#chatlog' ) . prop ( 'scrollHeight' ));
2025-06-02 10:01:12 +02:00
}
}
socket . onclose = function (){
console . log ( 'CLOSE' );
2025-06-16 22:47:55 +02:00
$ ( '#chatlog' ) . append ( 'Disconnected!' );
2025-06-02 10:01:12 +02:00
window . onbeforeunload = null ;
if ( as != false ){
2025-06-26 14:52:34 +02:00
$ ( '#chatlog' ) . scrollTop ( $ ( '#chatlog' ) . prop ( 'scrollHeight' ));
2025-06-02 10:01:12 +02:00
}
}
} catch ( exception ){
$ ( '#chatlog' ) . append ( 'Disconnected with error: ' + exception + '!' );
window . onbeforeunload = null ;
if ( as != false ){
2025-06-26 14:52:34 +02:00
$ ( '#chatlog' ) . scrollTop ( $ ( '#chatlog' ) . prop ( 'scrollHeight' ));
2025-06-02 10:01:12 +02:00
}
console . log ( exception );
}
}
function noticeset ( user ) {
sendMsg ( '/not ' + user );
}
function room ( room ) {
sendMsg ( '/j ' + room );
}
function setlocation ( chid , loc ) {
jQuery . ajax ({
url : \ " ajax.php \" ,
data : { task : \ " chat \" ,call: \" setlocation \" , chid: chid, location: loc},
dataType : \ " jsonp \" ,
success : refresh ()
});
}
function setweather ( weather ) {
sendMsg ( '/ws ' + weather );
}
function fadein (){
if ( fadedin == false ){
fadein = true ;
$ ( '.bg' ) . fadeTo ( 10000 , 0.6 );
} else {
fadein = false ;
$ ( '.bg' ) . fadeTo ( 10000 , 0.1 );
}
}
function setlock () {
jQuery . ajax ({
url : \ " ajax.php \" ,
data : { task : \ " chat \" ,call: \" setlock \" },
dataType : \ " jsonp \"
});
}
function setgroup ( ngroup ) {
jQuery . get ( \ " ajax.php?task=chat&call=groupnotice&yacsid= \" +yacsid+ \" &ngroup= \" +ngroup+ \" &user= \" +chid, function(data)
{
if ( data )
{
userlist ();
}
});
}
function reportwindow ( name ){
2025-06-19 21:07:36 +02:00
$ ( '#repwindow' ) . html ( '<div id=\"' + name + '_report\" title=\"' + name + '\"><div id=\"' + name + '_report_text\" style=\"height:70%; width:95%; text-align:left; overflow-y:auto;\"><div id=\"' + name + '_report_input\"><textarea id=\"' + name + '_report_input_text\" autocomplete=\"off\" spellcheck=\"true\" style=\"width:95%; height:166px; padding:none;\"/></div></div>' );
2025-06-02 10:01:12 +02:00
var obj = $ ( '#' + name + '_report' );
obj . dialog ({ autoOpen : false , maxWidth : 600 , maxHeight : 530 , height : 300 , minHeight : 250 , title : 'Report ' + name });
$ ( '#' + name + '_report_input_text' ) . keydown ( function ( event ) {
if ( event . keyCode != null ) kCode = event . keyCode ;
else if ( event . which != null ) kCode = event . which ;
if ( kCode == 13 ) {
if ( $ ( '#' + name + '_report_input_text' ) . val () != \ " \" ) {
text = $ ( '#' + name + '_report_input_text' ) . val () . replace ( / \ +/ g , \ " + \" );
sendMsg ( '/rep ' + name + ' ' + text );
$ ( '#' + name + '_report_input_text' ) . val ( \ " \" );
obj . dialog ( 'close' );
}
event . preventDefault ();
}
});
obj . dialog ( 'open' );
}
function create_whisper ( name , inittext , youfirst ){
if ( youfirst == null ) youfirst = false ;
if ( inittext != \ " \" && inittext != undefined) {
if ( ! youfirst ){
2025-06-19 21:07:36 +02:00
$ ( '#whispers' ) . append ( '<div id=\"' + name + '_whisper\" title=\"' + name + '\"><div id=\"' + name + '_whisper_text\" style=\"height:70%; width:95%; text-align:left; overflow-y:auto;\"><span style=\"color: #000000;\">' + name + ': ' + inittext + '</span><br /></div><div id=\"' + name + '_whisper_input\"><textarea id=\"' + name + '_whisper_input_text\" autocomplete=\"off\" spellcheck=\"true\" style=\"width:95%; min-height:30px; height:30px; padding: 6px 15px; margin:none;\"/></div></div>' );
2025-06-02 10:01:12 +02:00
} else {
2025-06-19 21:07:36 +02:00
$ ( '#whispers' ) . append ( '<div id=\"' + name + '_whisper\" title=\"' + name + '\"><div id=\"' + name + '_whisper_text\" style=\"height:70%; width:95%; text-align:left; overflow-y:auto;\"><span style=\"color: #585858;\">Du: ' + inittext + '</span><br /></div><div id=\"' + name + '_whisper_input\"><textarea id=\"' + name + '_whisper_input_text\" autocomplete=\"off\" spellcheck=\"true\" style=\"width:95%; min-height:30px; height:30px; padding: 6px 15px; margin:none;\"/></div></div>' );
2025-06-02 10:01:12 +02:00
}
} else {
2025-06-19 21:07:36 +02:00
$ ( '#whispers' ) . append ( '<div id=\"' + name + '_whisper\" title=\"' + name + '\"><div id=\"' + name + '_whisper_text\" style=\"height:70%; width:95%; text-align:left; overflow-y:auto;\"></div><div id=\"' + name + '_whisper_input\"><textarea id=\"' + name + '_whisper_input_text\" autocomplete=\"off\" spellcheck=\"true\" style=\"width:95%; min-height:30px; height:30px; padding: 6px 15px; margin:none;\"/></div></div>' );
2025-06-02 10:01:12 +02:00
}
var obj = $ ( '#' + name + '_whisper' );
2025-06-19 21:07:36 +02:00
obj . dialog ({ autoOpen : false , maxWidth : 600 , maxHeight : 530 , width : 400 , height : 300 , minHeight : 250 });
2025-06-02 10:01:12 +02:00
$ ( '#' + name + '_whisper_input_text' ) . keydown ( function ( event ) {
if ( event . keyCode != null ) kCode = event . keyCode ;
else if ( event . which != null ) kCode = event . which ;
if ( kCode == 13 ) {
if ( $ ( '#' + name + '_whisper_input_text' ) . val () != \ " \" ) {
text = $ ( '#' + name + '_whisper_input_text' ) . val () . replace ( / \ +/ g , \ " + \" );
sendMsg ( '/' + name + ' ' + text );
$ ( '#' + name + '_whisper_input_text' ) . val ( \ " \" );
}
event . preventDefault ();
}
});
obj . dialog ( 'open' )
}
function refresh () {
refresh_userlist ();
}
function reset_roomlist () {
watchroom = false ;
refresh_userlist ();
start_timer ();
}
function start_timer () {
//clearInterval(clist);
//setTimeout(\"refresh_userlist()\",5000);
//clist = setInterval(\"crefresh()\", 20000);
//weat = setInterval(\"weather()\", 45000);
}
function set_notice (){
changenotice ( noticefiles [ ncounter ]);
$ ( '#notchan' ) . html ( noticename [ ncounter ]);
}
</ script >
2025-06-19 21:07:36 +02:00
< link type = \ " text/css \" href= \" " . $config [ " path " ] . " /themes/funchat/base/jquery-ui-1.9.2.custom.css?ver=1238732 \" rel= \" Stylesheet \" />
< link type = \ " text/css \" href= \" " . $config [ " path " ] . " /themes/funchat/jquery.rightClickMenu.css?ver=12328732 \" rel= \" Stylesheet \" />
2025-06-02 10:01:12 +02:00
< script src = \ " //ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js?ver=123324732 \" ></script>
< script type = \ " text/javascript \" src= \" /modules/chat/js/jquery.rightClickMenu-1.0.js?ver=17843 \" ></script>
< script type = \ " text/javascript \" >
var startcol ;
function send (){
var text = $ ( '#text' ) . val ();
text = $ . trim ( text );
mess = 0 ;
messages . unshift ( text );
if ( messages . length > 10 ){
messages . pop ();
}
if ( text == \ " \" ) {
message ( '<p class=\"warning\">Please enter a message</p>' );
return ;
} else {
text = text . replace ( / \ +/ g , \ " + \" );
}
try {
var obj = new Object ();
obj . type = \ " message \" ;
obj . message = text ;
var jsonString = JSON . stringify ( obj );
socket . send ( jsonString );
} catch ( exception ){
message ( '<p class=\"warning\">' );
}
$ ( '#text' ) . val ( \ " \" );
}
function typing (){
try {
var obj = new Object ();
obj . type = \ " typing \" ;
obj . message = \ " \" ;
var jsonString = JSON . stringify ( obj );
socket . send ( jsonString );
} catch ( exception ){
}
}
function sendMsg ( msg ){
var obj = new Object ();
obj . type = \ " message \" ;
obj . message = msg ;
var jsonString = JSON . stringify ( obj );
socket . send ( jsonString );
}
function prev () {
if ( mess >= messages . length ){
mess = 0 ;
$ ( '#text' ) . val ( \ " \" );
} else {
$ ( '#text' ) . val ( messages [ mess ]);
mess ++ ;
}
}
function next () {
if ( mess <= 0 ){
mess = 0 ;
$ ( '#text' ) . val ( \ " \" );
} else {
mess -- ;
$ ( '#text' ) . val ( messages [ mess ]);
}
}
function check_whisper ( msg ){
if ( whwind == true ){
if ( msg . search ( whisperto ) !=- 1 ){
var whispt = msg . match ( whisperto );
if ( $ ( '#' + whispt [ 1 ] + '_whisper' ) . length > 0 ){
$ ( '#' + whispt [ 1 ] + '_whisper_text' ) . append ( '<span style=\"color: #585858;\">Du: ' + whispt [ 2 ] + '</span><br />' );
$ ( '#' + whispt [ 1 ] + '_whisper' ) . dialog ( 'open' );
$ ( '#' + whispt [ 1 ] + '_whisper' ) . dialog ( 'moveToTop' );
2025-06-26 14:52:34 +02:00
$ ( '#' + whisp [ 1 ] + '_whisper_text' ) . scrollTop ( $ ( '#' + whisp [ 1 ] + '_whisper_text' ) . prop ( 'scrollHeight' ));
2025-06-02 10:01:12 +02:00
} else {
create_whisper ( whispt [ 1 ], whispt [ 2 ], true );
}
} else if ( msg . search ( whisper ) !=- 1 ){
var whisp = msg . match ( whisper );
notice ();
if ( $ ( '#' + whisp [ 1 ] + '_whisper' ) . length > 0 ){
$ ( '#' + whisp [ 1 ] + '_whisper_text' ) . append ( '<span style=\"color: #000000;\">' + whisp [ 1 ] + ': ' + whisp [ 2 ] + '</span><br />' );
$ ( '#' + whisp [ 1 ] + '_whisper' ) . dialog ( 'open' );
$ ( '#' + whisp [ 1 ] + '_whisper' ) . dialog ( 'moveToTop' );
2025-06-26 14:52:34 +02:00
$ ( '#' + whisp [ 1 ] + '_whisper_text' ) . scrollTop ( $ ( '#' + whisp [ 1 ] + '_whisper_text' ) . prop ( 'scrollHeight' ));
2025-06-02 10:01:12 +02:00
} else {
create_whisper ( whisp [ 1 ], whisp [ 2 ]);
}
}
} else {
message ( msg );
}
}
function message ( msg ){
if ( nickcheck . test ( msg )) {
msg = msg . replace ( nickcheck , '<b>$1</b>' );
}
$ ( '#chatlog' ) . append ( msg );
if ( as != false ){
2025-06-26 14:52:34 +02:00
$ ( '#chatlog' ) . scrollTop ( $ ( '#chatlog' ) . prop ( 'scrollHeight' ));
2025-06-02 10:01:12 +02:00
}
} //End message()
$ ( document ) . ready ( function ()
{
window . onbeforeunload = function ( e ) {
var e = e || window . event ;
// For IE and Firefox prior to version 4
if ( e && doit ) {
2025-06-08 21:24:12 +02:00
e . returnValue = 'Willst du das Fenster wirklich schließen?' ;
2025-06-02 10:01:12 +02:00
}
// For Safari
if ( doit ){
2025-06-08 21:24:12 +02:00
return 'Willst du das Fenster wirklich schließen?' ;
2025-06-02 10:01:12 +02:00
}
};
var tabcom = new TabCompleter ( $ ( \ " #text \" ).get(0));
$ ( '#text' ) . keydown ( function ( event ) {
if ( event . keyCode != null ) kCode = event . keyCode ;
else if ( event . which != null ) kCode = event . which ;
if ( kCode == 13 && ! event . shiftKey && subm == \ " 1 \" ) {
send ();
event . preventDefault ();
} else if ( kCode == 13 && event . shiftKey && subm == \ " 2 \" ) {
send ();
event . preventDefault ();
} else if ( kCode == 38 ) {
prev ();
} else if ( kCode == 9 ) {
tabcom . complete ();
return false ;
} else {
tabcom . reset ();
}
});
$ ( '#logout' ) . click ( function () {
window . onbeforeunload = null ;
sendMsg ( '/q' );
});
2025-06-08 21:24:12 +02:00
jQuery ( '.functions' ) . html ( '<h4>Chatfarbe</h4><input id=\"colorSelector\" type=\"text\" style=\"float:left;\" \>' );
2025-06-02 10:01:12 +02:00
$ ( '#colorSelector' ) . spectrum ({
showInput : true ,
preferredFormat : \ " hex \" ,
color : \ " # \" +col,
clickoutFiresChange : false ,
change : function ( color ) {
sendMsg ( '/col ' + color . toHex ());
$ ( '#text' ) . css ( 'color' , color . toHexString ());
}
});
$ ( 'body' ) . on ( 'click' , 'a.notice' , function () {
noticeset ( $ ( this ) . attr ( 'id' ));
});
$ ( 'body' ) . on ( 'click' , 'a.room' , function () {
room ( $ ( this ) . attr ( 'id' ));
});
2025-06-08 21:24:12 +02:00
function cwhisp ( name , inittext , youfirst ) {
var charimg = '' ;
$ . ajax ({
url : \ " ajax.php \" ,
data : { task : \ " chat \" ,call: \" getid \" , char: name},
success : function ( data ) {
create_whisper ( name , inittext , youfirst , data );
}
});
}
2025-06-02 10:01:12 +02:00
$ ( 'body' ) . on ( 'click' , 'span.user_whisper' , function () {
if ( whwind == true ){
if ( $ ( '#' + $ ( this ) . attr ( 'title' ) + '_whisper' ) . length > 0 ){
$ ( '#' + $ ( this ) . attr ( 'title' ) + '_whisper' ) . dialog ( 'open' );
$ ( '#' + $ ( this ) . attr ( 'title' ) + '_whisper' ) . dialog ( 'moveToTop' );
} else {
cwhisp ( $ ( this ) . attr ( 'title' ), \ " \" );
}
} else {
if ( $ ( '#text' ) . val () == \ " \" ) {
$ ( '#text' ) . focus ();
$ ( '#text' ) . val ( '/' + $ ( this ) . attr ( 'title' ) + ' ' );
}
}
});
$ ( 'body' ) . on ( 'click' , '#allrooms' , function () {
clearInterval ( weat );
clearInterval ( locat );
watchroom = true ;
allrooms ();
setTimeout ( \ " reset_roomlist() \" , 30000);
});
$ ( 'body' ) . on ( 'click' , '#userlist' , function () {
watchroom = false ;
refresh_userlist ();
});
$ ( 'body' ) . on ( 'click' , '#scrolling' , function () {
if ( as == true ){
$ ( '#scrolling' ) . html ( 'Scrolling: Aus' );
as = false ;
} else {
$ ( '#scrolling' ) . html ( 'Scrolling: An' );
as = true ;
}
});
$ ( 'body' ) . on ( 'click' , '#whwindow' , function () {
if ( whwind == true ){
$ ( '#whwindow' ) . html ( 'Flüsterfenster: Aus' );
whwind = false ;
} else {
$ ( '#whwindow' ) . html ( 'Flüsterfenster: An' );
whwind = true ;
}
$ . ajax ({
url : \ " ajax.php \" ,
data : { task : \ " chat \" , call: \" wh \" , value: whwind, char: chid},
dataType : \ " jsonp \"
});
});
$ ( 'body' ) . on ( 'click' , '#bgmusic' , function () {
if ( bgmusic == true ){
pause ();
$ ( '#bgmusic' ) . html ( 'BG Music: Off' );
bgmusic = false ;
} else {
$ ( '#bgmusic' ) . html ( 'BG Music: On' );
bgmusic = true ;
}
$ . ajax ({
url : \ " ajax.php \" ,
data : { task : \ " chat \" , call: \" bg_music \" , value: bgmusic, char: chid},
dataType : \ " jsonp \"
});
});
$ ( 'body' ) . on ( 'click' , '#ooc' , function () {
if ( ooc == true ){
$ ( '#ooc' ) . html ( 'OOC: Hidden' );
ooc = false ;
} else {
$ ( '#ooc' ) . html ( 'OOC: Shown' );
ooc = true ;
}
sendMsg ( '/toc' );
});
$ ( 'body' ) . on ( 'click' , '#notsw' , function () {
if ( not == true ){
$ ( '#notsw' ) . html ( 'Benachrichtigung: Aus' );
not = false ;
} else {
$ ( '#notsw' ) . html ( 'Benachrichtigung: An' );
not = true ;
}
});
$ ( 'body' ) . on ( 'click' , '#notchan' , function () {
if ( ncounter >= ( noticefiles . length - 1 )){
ncounter = 0 ;
} else {
ncounter = ncounter + 1 ;
}
changenotice ( noticefiles [ ncounter ]);
$ ( '#notchan' ) . html ( noticename [ ncounter ]);
$ . ajax ({
url : \ " /ajax.php \" ,
data : { task : \ " chat \" , call: \" noticech \" , value: ncounter, char: chid},
dataType : \ " jsonp \"
});
});
$ ( 'body' ) . on ( 'click' , '#submit' , function () {
if ( subm == \ " 1 \" ) {
subm = \ " 2 \" ;
$ ( '#submit' ) . html ( 'Shift + Enter' );
} else {
subm = \ " 1 \" ;
$ ( '#submit' ) . html ( 'Enter' );
}
$ . ajax ({
url : \ " /ajax.php \" ,
data : { task : \ " chat \" , call: \" subm \" , value: subm, char: chid},
dataType : \ " jsonp \"
});
});
$ ( 'body' ) . on ( 'click' , 'a.loc' , function () {
setlocation ( chid , $ ( this ) . attr ( 'id' ));
});
$ ( 'body' ) . on ( 'click' , 'a.setgroup' , function () {
setgroup ( $ ( this ) . attr ( 'id' ));
});
connect ();
start_timer ();
});
</ script > " ;
return $meta ;
}
function meta_editlog (){
2025-06-25 22:17:29 +02:00
global $config ;
$meta = " <script type= \" text/javascript \" src= \" " . $config [ " path " ] . " /js/jquery/jquery.min.js \" ></script>
2025-06-02 10:01:12 +02:00
< script type = \ " text/javascript \" src= \" " . $config [ " path " ] . " /js/jquery/jquery-ui.min.js \" ></script>
< link rel = \ " stylesheet \" media= \" screen \" type= \" text/css \" href= \" " . $config [ " path " ] . " /themes/austria/smoothness/jquery-ui-1.8.18.custom.css \" />
< script type = 'text/javascript' >
function adduser (){
if ( $ ( \ " #userlist \" ).val()== \" \" ) {
return false ;
}
var user = $ ( \ " #userlist \" ).val();
$ . ajax ({
url : \ " ajax.php \" ,
data : { task : \ " chat \" , call: \" adduser \" , user: user, cid: chid },
success : function ( data ) {
if ( data != \ " \" ) {
$ ( \ " #users \" ).append('<div id= \" id_'+data+' \" class= \" useritem \" ><a onclick= \" return deleteItem('+data+'); \" href= \" index.php?task=chat&sub=deluser&id='+data+' \" ><img style= \" border:none; float:right; \" src= \" /themes/ponytopia/images/icons/cross.png \" /></a>' + user + '</div>');
}
}
});
}
function deleteItem ( id ){
$ . ajax ({
url : \ " ajax.php \" ,
data : { task : \ " chat \" , call: \" deleteuser \" , id: id, cid: chid },
success : function ( data ) {
$ ( '#id_' + id ) . fadeOut ( 'slow' , function () {
$ ( '#id_' + id ) . remove ();
});
}
});
return false ;
}
function public ( id ){
$ . ajax ({
url : \ " ajax.php \" ,
data : { task : \ " chat \" , call: \" public \" , id: id },
success : function ( data ) {
if ( data != \ " \" ) {
$ ( \ " #publ \" ).append('<span id= \" sharetext \" >Use this link to share this log with everyone:<br /><input name= \" share \" id= \" sharelink \" size= \" 60 \" value= \" '+data+' \" /></span>');
} else {
$ ( '#sharetext' ) . fadeOut ( 'slow' , function () {
$ ( '#sharetext' ) . remove ();
});
}
}
});
return false ;
}
$ ( function () {
$ ( \ " #userlist \" )
// don't navigate away from the field on tab when selecting an item
. bind ( \ " keydown \" , function( event ) {
if ( event . keyCode === $ . ui . keyCode . TAB &&
$ ( this ) . data ( \ " autocomplete \" ).menu.active ) {
event . preventDefault ();
}
})
. autocomplete ({
source : function ( request , response ) {
$ . getJSON ( \ " ajax.php \" , {
task : \ " chat \" ,
call : \ " users \" ,
term : request . term
}, response );
},
search : function () {
// custom minLength
var term = this . value ;
if ( term . length < 2 ) {
return false ;
}
},
focus : function () {
// prevent value inserted on focus
return false ;
},
select : function ( event , ui ) {
this . value = ui . item . value ;
return false ;
}
});
});
</ script > " ;
return $meta ;
}
2025-06-25 22:17:29 +02:00
2025-06-02 10:01:12 +02:00
function footer_logs (){
2025-06-25 22:17:29 +02:00
global $config , $footer ;
$footer .= " <script type= \" text/javascript \" src= \" " . $config [ " path " ] . " /js/jquery/jquery.min.js \" ></script>
2025-06-02 10:01:12 +02:00
< script type = \ " text/javascript \" src= \" " . $config [ " path " ] . " /js/jquery/jquery-ui.min.js \" ></script>
< link rel = \ " stylesheet \" media= \" screen \" type= \" text/css \" href= \" " . $config [ " path " ] . " /themes/austria/smoothness/jquery-ui-1.8.18.custom.css \" /> " ;
return $footer ;
}
function footer (){
return " " ;
}
function meta_logs (){
global $yacsid ;
$meta = " <link rel= \" stylesheet \" media= \" screen \" type= \" text/css \" href= \" /modules/chat/datepicker/css/datepicker.css \" />
< link rel = \ " stylesheet \" media= \" screen \" type= \" text/css \" href= \" /modules/chat/datepicker/css/layout.css \" />
< script type = \ " text/javascript \" src= \" /modules/chat/datepicker/js/datepicker.js \" ></script>
< script type = 'text/javascript' >
$ ( document ) . ready ( function ()
{
$ ( '#inputdate' ) . DatePicker ({
format : 'd.m.Y' ,
date : $ ( '#inputdate' ) . val (),
current : $ ( '#inputdate' ) . val (),
starts : 1 ,
position : 'r' ,
onBeforeShow : function (){
$ ( '#inputdate' ) . DatePickerSetDate ( $ ( '#inputdate' ) . val (), true );
},
onChange : function ( formated , dates ){
$ ( '#inputdate' ) . val ( formated );
if ( $ ( '#closeOnSelect input' ) . attr ( 'checked' )) {
$ ( '#inputdate' ) . DatePickerHide ();
}
}
});
});
$ ( function () {
function split ( val ) {
return val . split ( / , \s */ );
}
function extractLast ( term ) {
return split ( term ) . pop ();
}
$ ( \ " #chars \" )
// don't navigate away from the field on tab when selecting an item
. bind ( \ " keydown \" , function( event ) {
if ( event . keyCode === $ . ui . keyCode . TAB &&
$ ( this ) . data ( \ " autocomplete \" ).menu.active ) {
event . preventDefault ();
}
})
. autocomplete ({
source : function ( request , response ) {
$ . getJSON ( \ " ajax.php \" , {
task : \ " chat \" ,
call : \ " chars \" ,
term : extractLast ( request . term )
}, response );
},
search : function () {
// custom minLength
var term = extractLast ( this . value );
if ( term . length < 2 ) {
return false ;
}
},
focus : function () {
// prevent value inserted on focus
return false ;
},
select : function ( event , ui ) {
var terms = split ( this . value );
// remove the current input
terms . pop ();
// add the selected item
terms . push ( ui . item . value );
// add placeholder to get the comma-and-space at the end
terms . push ( \ " \" );
this . value = terms . join ( \ " , \" );
return false ;
}
});
});
</ script > " ;
return $meta ;
}
}
2025-06-03 08:40:33 +02:00
?>