*/ function Moderator ($db_handle){ #$anzahl = mysql_result(mysql_query('select count(*) as count from chat_messages'),0,'count'); #$zufall = srand(time()); #$zufall = Rand(0,($anzahl-1));#if($_SESSION['nick']=="Supermann")$zufall=14; $charset = mysql_query("SET character_set_results = NULL",$db_handle); $result = mysql_query("SELECT message AS Feld FROM chat_messages order by rand() limit 0,1",$db_handle); $mod_message = mysql_result($result,0,"Feld"); #$message = str_replace("'","\'",$message); mysql_free_result($result); global $nick; $result = mysql_query("SELECT Quassel FROM chat WHERE Nick='$nick'",$db_handle); $privat = mysql_result($result,0,"Quassel"); mysql_free_result($result); if (!$privat){ global $MODERATOR_NAME,$channickcolor; echo "wrt('".rawurlencode(''.$MODERATOR_NAME.': Hey '.$nick.'! '.$mod_message.'
')."');"; flush(); } } /** * Completes a line with a link to select a chatter * * @author Michael Oertel * @global $INSTALL_DIR,$FILE_EXTENSION,$channel,$privat,$no_gruentxt,$Nick,$pruef,$chanpruef,$scroll,$ENABLE_SESSION * @param string $line call by reference * @param string $from_chatter * @param integer $line_is_enabled * @param integer $usergroup 1=godfathers, ... */ function complete_line ($line,$from_chatter,$line_is_enabled,$usergroup, $chat_sponsor, $to = false, $wispered = 0){ global $channel,$is_vip,$is_moderator_for,$channickcolor,$db_handle,$MSG_REGISTER_MALE,$MSG_REGISTER_FEMALE; if($line_is_enabled){ $tmp_line = ''.$line.''; }else{ $tmp_line = $line; } ###das funktioniert so nicht mehr -> auskommentiert #if($is_vip||$is_moderator_for){ # $line = ''.$from_chatter.''.$tmp_line; # return ''; #} //sammle daten f�r die title-anweisung (tooltip) $query = "select cu.gender, date_format(cu.birthdate, '%e.%m.%Y') as birthdate, timestampdiff(YEAR, cu.birthdate, curdate()) as age, cu.city from chat_userpages cu join chat_data cd on cd.id = cu.id where cd.nick = '$from_chatter'"; $result = mysql_query($query,$db_handle); $r_array = mysql_fetch_array($result); //alter bestimmen $current_date = date("Y",time()); if($r_array['birthdate'] != "0000-00-00"){ #$test = mktime(0,0,0, #intval(substr($r_array['birthdate'],4,2)), #intval(substr($r_array['birthdate'],6,2)), #intval(date('Y'))); #if($test - time() > 0){ $show_age = $r_array['age']; #}else{ # $show_age = (date('Y') - substr($r_array['birthdate'],0,4)) ; #} } #geschlecht bestimmen if($r_array['gender']=='male'){ $gender = $MSG_REGISTER_MALE; }elseif($r_array['gender']=='female'){ $gender = $MSG_REGISTER_FEMALE; } $line = ''; //we have no patencolor # if($usergroup==1){ if(0==1){ //group of chat's godfathers global $PATEN_COLOR; $line .= ''; }else{ global $NICK_COLOR,$send_gender,$str; if($chat_sponsor){ //chat-sponsor gets special image $sternchen = 'Chatsponsor'; $sternchen = ''; }else{ $sternchen = ''; } if(strtolower($to) == strtolower($_SESSION['nick'])) //wenn die zeile f�r den chatter ist, pr�fe, ob notizen zum absender vorliegen { $sql = "SELECT count(*) as c FROM chat_notiz WHERE Nick = '".$_SESSION['nick']."' AND Chatter = '$from_chatter'"; $notiz = mysql_result(mysql_query($sql, $db_handle),0,'c'); if($notiz){//wenn notiz vorhanden, variable �berschreiben mit dem notiz-code und image $notiz = 'du hast eine Notiz f�r '.$from_chatter.' hinterlegt'; }else{ $notiz = ''; } } if($_SESSION['is_pate']){ $sql = "select count(*) as c from paten_notiz where chatter = '$from_chatter'"; $patennotiz = mysql_result(mysql_query($sql, $db_handle),0,'c'); if($patennotiz){//wenn notiz vorhanden, variable ?berschreiben mit dem notiz-code und image $notiz .= 'du hast eine Notiz f?r '.$from_chatter.' hinterlegt'; } } if($usergroup == 1){ global $PATEN_COLOR; $use_color = '#ff0000'; }else{ $use_color = $NICK_COLOR[$send_gender]; } if($send_gender == '' || $send_gender == '-1' || $send_gender == '0' || $send_gender == '1' || $send_gender == '2'){ $line .= ''.$from_chatter.''.$sternchen.''.$notiz.$tmp_line; }else{ $line .= ''.$from_chatter.''.$sternchen.''.$notiz.$tmp_line; } } return $line; } /** * filters every new text line * * it is determined, who can see the respective line in the chat * * @param string $line * @global $Nick,$privat,$no_gruentxt,$pruef,$channel,$chanpruef,$scroll,$is_vip,$is_moderator_for,$channel_is_moderated,$MODERATOR_MESSAGE,$vip,$READING_MSG,$WISPERS_TO,$SAYS_TO,$is_como,$EDIT,$INSTALL_DIR,$FILE_EXTENSION,$PATEN_COLOR,$VIP_COLOR,$MODERATOR_COLOR,$channickcolor,$pass_phrase,$salt_nick,$MAX_NICK_LENGTH * @author Michael Oertel */ function Filter ($line){ /** * informations about the text line * * $line is an array, which contains all information about the line * * * @var string $str */ global $MAX_NICK_LENGTH,$str,$send_gender; /** * The nick which receives the text line. * * @var string $to_chatter */ $to_chatter_default=$line['to_chatter']; $to_chatter = strtolower($to_chatter_default); /** * The nick which transmitted the text line. * * @var string $from_chatter */ $from_chatter_default = $line['from_chatter']; $from_chatter = strtolower($from_chatter_default); /** * if it was whispered $wispered = 1 * if the text line was spoken $wispered = 0 * pausenaufsichtnachrichten $wispered = 0 * * @var integer $wispered */ $wispered=$line['whisper']; /** * User groups * * If is set to '1', if the line comes from a godfather * * @var integer $pate */ $usergroup=$line['pate']; /** * moderator flag * * If is set, the line is enabled by the moderator * * @var integer $line_is_enabled */ $line_is_enabled=$line['moderator']; /** * gender * -1 means not registered * 0 means unknown * 1 menas male * 2 means female * not set is system * @var integer $send_gender */ $send_gender = $line['gender']; /** * sponsor * if 1, user is a chat-sponsor and get a special icon * */ $chat_sponsor = $line['sponsor']; /** * line itself * overloading original line * @var string $line */ $line = $line['line']; global $init,$chanchange,$is_moderator_for,$is_vip,$is_como,$vip,$moderator; if(strtolower($_SESSION['nick']) == $from_chatter && !$init && !$chanchange && !$line_is_enabled){ $line = ''; return ''; }elseif($line_is_enabled && ($is_vip||$is_moderator_for||$is_como)){ if(strtolower($_SESSION['nick'])==$from_chatter){ $line = ''; return ''; }elseif(($is_moderator_for && $from_chatter != $vip)&&($is_vip && $from_chatter != $moderator)){ $line = ''; return ''; } } global $INSTALL_DIR,$FILE_EXTENSION,$channel,$no_gruentxt,$pruef,$chanpruef,$scroll; global $channel_is_moderated; //keine moderierten channels, das kann ausgeschaltet sein if(0==1){ global $EDIT; if($is_moderator_for){ //the chatter is a moderator for the current channel //he has to moderate all the lines //no moderation for wispered lines between normal users if(($wispered==2)||($to_chatter != strtolower($nick) && $to_chatter != $vip && $wispered)){ $line = ''; return ''; } //append a link to edit and to enable the line by a moderator if($from_chatter && !$line_is_enabled && !($wispered && $to_chatter==strtolower($nick))){ global $ENABLE_SESSION; if($ENABLE_SESSION){ global $SESSION_NAME,$$SESSION_NAME; $line_tmp = ' '.$EDIT.''; $line .= $line_tmp; } $line = complete_line($line,$from_chatter_default,$line_is_enabled,$usergroup,$chat_sponsor, $to_chatter_default, $wispered); $line .= '
'; return $line; }elseif($is_como){ //the user is a comoderator, he has to get all the lines $line = complete_line($line,$from_chatter_default,0,$usergroup,$chat_sponsor, $to_chatter_default, $wispered); global $OPENED_TO_PUB; if($line_is_enabled){$line .= ' ('.$OPENED_TO_PUB. ')';} $line .= '
'; return $line; }elseif($line_is_enabled){ //the moderator and the vip can wisper enabled lines only if($wispered && strtolower($nick)!=$vip && strtolower($nick)!=$moderator){ $line = ''; return ''; } //the line is already moderated $line = complete_line($line,$from_chatter_default,0,$usergroup,$chat_sponsor, $to_chatter_default, $wispered); $line .= '
'; return $line; }elseif($_SESSION['nick'] && $from_chatter==strtolower($_SESSION['nick']) && !$wispered){ //a wispered line to an normal user will be not moderated //in case of a not wispered line the user gets a message like 'the line was send to the moderator' global $MODERATOR_MESSAGE; echo 'parent.output.document.write(\''; echo ''.$MODERATOR_MESSAGE.': '.$from_chatter.' '.$line.'<\/font>
'; echo '\');'; flush(); $line = ''; return ''; }elseif($wispered && $to_chatter != $vip && ($from_chatter == strtolower($_SESSION['nick']) || $to_chatter == strtolower($_SESSION['nick']))){ $line = complete_line($line,$from_chatter_default,0,$usergroup,$chat_sponsor, $to_chatter_default, $wispered); $line .= '
'; return $line; }else{ $line = ''; return ''; } }else{ //channel is not moderated if($from_chatter == strtolower($_SESSION['nick']) || $to_chatter == strtolower($_SESSION['nick'])){ //highlite the nickname global $SAYS_TO,$WISPERS_TO; $line=str_replace("$SAYS_TO ".$_SESSION['nick'].": ","$SAYS_TO ".$_SESSION['nick']."!: ",$line); $line=str_replace("$WISPERS_TO ".$_SESSION['nick'].": ","$WISPERS_TO ".$_SESSION['nick']."!: ",$line); $line = complete_line($line,$from_chatter_default,0,$usergroup,$chat_sponsor, $to_chatter_default, $wispered); $line .= '
'; return $line; }else{ //the line is not from or to me spoken global $privat,$WISPERS_TO; if($wispered || $privat){ //the line is wispered or it is a message //or the user don't want to see all the spoken lines //($privat=1 means the user has switched on his 'Twaddel-Filter') if(!$privat && !$no_gruentxt && $wispered==1){ global $WISPERS_TO; echo "wrt('".rawurlencode(''.$from_chatter_default.' '.$WISPERS_TO.' '.$to_chatter_default.'
')."');"; flush(); } $line=''; return ''; }else{ //the line is not wispered so the user can get it $line = complete_line($line,$from_chatter_default,0,$usergroup,$chat_sponsor, $to_chatter_default, $wispered); $line .= '
'; return $line; } } } } /** * shows the link to reload text * * @global $Nick,$channel,$pruef,$chanpruef,$UPDATE_TEXT,$INSTALL_DIR,$FILE_EXTENSION */ function Reload_text(){ global $nick,$channel,$pruef,$chanpruef,$UPDATE_TEXT,$INSTALL_DIR,$FILE_EXTENSION; echo 'parent.output.document.write(\''; echo "

"; echo "$UPDATE_TEXT<\/A>"; echo "<\/P>"; echo '\');'; } function getUserStatus ($nick,$channel,$db_handle){ //Set the VIP if exists for this channel $result=mysql_query("SELECT Nick,Moderator FROM vip WHERE Channel='$channel' LIMIT 1",$db_handle); if(mysql_num_rows($result)>0){ global $vip,$moderator; $vip = strtolower(mysql_result($result,0,"Nick")); $moderator = strtolower(mysql_result($result,0,"Moderator")); } mysql_free_result($result); if($ENABLE_SESSION){ //Check if the user the VIP $result=mysql_query("SELECT Nick FROM vip WHERE Nick='$nick' LIMIT 1",$db_handle); if(mysql_num_rows($result)>0){ global $is_vip; $is_vip=strtolower(mysql_result($result,0,"Nick")); } mysql_free_result($result); } //Check if the user a Co-Moderator $result=mysql_query("SELECT Nick FROM comoderators WHERE Nick='$nick' LIMIT 1",$db_handle); if(mysql_num_rows($result)>0){ global $is_como; $is_como=strtolower(mysql_result($result,0,"Nick")); } mysql_free_result($result); //Check if the user a Moderator $result=mysql_query("SELECT Nick FROM vip WHERE Moderator='$nick' LIMIT 1",$db_handle); if(mysql_num_rows($result)>0){ global $is_moderator_for; $is_moderator_for=strtolower(mysql_result($result,0,"Nick")); } mysql_free_result($result); } //function to write the javascript for the dhtml-menu. used for performance reasons function wrt_context(){ $context = file('jscript/context.js'); $search = array("'","\n","\r"); $replace = array("\'"," "," "); foreach($context as $v){ echo "wrt('".rawurlencode($v)."');\n"; } } if ($init==1 || $chanchange==1){ //Is this a password protected channel? include "login_inc.php"; $channel_login_form=channel_login($nick,$channel); getUserStatus($nick,$channel,$db_handle); $now = gmdate("D, d M Y H:i:s")." GMT"; Header("Date: $now"); Header("Expires: $now"); Header("Last-Modified: $now"); Header("Pragma: no-cache"); Header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate"); Header("Content-Type: text/html"); echo ''; # if($nick == 'Supermann'){ echo '';} echo '