-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfunctions.php-func-nachricht.php
More file actions
117 lines (96 loc) · 4.03 KB
/
functions.php-func-nachricht.php
File metadata and controls
117 lines (96 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
function nachricht_betrete($u_id, $r_id, $u_name, $r_name)
{
// Eintrittsnachricht in Raum schreiben
// Aufruf mit Raum-Id, UserName, Raum-Name
// liefert $back zurück
global $conn, $farbe_chat_background2, $nachricht_b, $lustigefeatures, $u_farbe;
global $eintritt_individuell, $eintritt_useranzeige;
// Nachricht Standard
$text = $nachricht_b[0];
// Nachricht Lustiege ein/austrittsnachrichten
if ($lustigefeatures) {
reset($nachricht_b);
$anzahl = count($nachricht_b);
$text = $nachricht_b[mt_rand(1, $anzahl) - 1];
}
// Nachricht auswählen
if ($eintritt_individuell == "1") {
$query = "SELECT u_eintritt FROM user where u_id = $u_id";
$result = mysql_query($query, $conn);
$row = mysql_fetch_object($result);
if (strlen($row->u_eintritt) > 0) {
$text = $row->u_eintritt;
if ($eintritt_useranzeige == "1")
$text = htmlspecialchars($text) . " <b>($u_name)</b> ";
else $text = htmlspecialchars($text) . " <!-- <b>($u_name)</b> -->";
}
mysql_free_result($result);
}
$text = str_replace("%u_name%", $u_name, $text);
$text = str_replace("%r_name%", $r_name, $text);
$text = preg_replace("|%nick%|i", $u_name, $text);
$text = preg_replace("|%raum%|i", $r_name, $text);
if (strlen($text) == 0)
$text = $u_name;
// Nachricht im Chat ausgeben; falls Raum moderiert ist, nur HTML-Kommentar ausgeben
$back = 0;
if (raum_ist_moderiert($r_id)) {
$back = system_msg("", 0, $u_id, $u_farbe, "<B>>>></b> "
. $text);
} else {
// Spamschutz, verhindert die Eintrittsmeldung, wenn innerhalb von 60 Sek mehr als 15 Systemmiteilungen eingehen...
$sql = "SELECT count(c_id) as nummer FROM chat WHERE c_von_user = '' and c_typ='S' and c_raum = " . intval($r_id) . " and c_zeit > '"
. date("YmdHis", date("U") - 60) . "'";
$result = mysql_query($sql);
$num = mysql_fetch_array($result);
$num = $num['nummer'];
if ($num < 15)
$back = global_msg($u_id, $r_id, "<B>>>></b> " . $text);
}
return $back;
}
function nachricht_verlasse($r_id, $u_name, $r_name)
{
// Eintrittsnachricht in Raum schreiben
// Aufruf mit Raum-Id, UserName, Raum-Name
// liefert $back (ID des geschriebenen Datensatzes) zurück
global $chat, $nachricht_v, $lustigefeatures, $u_farbe, $u_id;
global $eintritt_individuell, $eintritt_useranzeige;
// Nachricht Standard
$text = $nachricht_v[0];
// Nachricht Lustiege ein/austrittsnachrichten
if ($lustigefeatures) {
reset($nachricht_v);
$anzahl = count($nachricht_v);
$text = $nachricht_v[mt_rand(1, $anzahl) - 1];
}
// Nachricht auswählen
if ($eintritt_individuell == "1") {
$query = "SELECT u_austritt FROM user where u_nick = '" . mysql_real_escape_string($u_name) . "'";
$result = mysql_query($query);
$row = mysql_fetch_object($result);
if (strlen($row->u_austritt) > 0) {
$text = $row->u_austritt;
if ($eintritt_useranzeige == "1")
$text = htmlspecialchars($text) . " <b>($u_name)</b> ";
else $text = htmlspecialchars($text) . " <!-- <b>($u_name)</b> -->";
}
mysql_free_result($result);
}
$text = str_replace("%u_name%", $u_name, $text);
$text = str_replace("%r_name%", $r_name, $text);
$text = preg_replace("|%nick%|i", $u_name, $text);
$text = preg_replace("|%raum%|i", $r_name, $text);
if (strlen($text) == 0)
$text = $u_name;
// Nachricht im Chat ausgeben; falls Raum moderiert ist, nur HTML-Kommentar ausgeben
if (raum_ist_moderiert($r_id)) {
$back = system_msg("", 0, $u_id, $u_farbe, "<b><<<</b> "
. $text);
} else {
$back = global_msg($u_id, $r_id, "<b><<<</b> " . $text);
}
return ($back);
}
?>