Newer
Older
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
<?php
class chat{
private $db;
private $id = 0;
private $error = 0;
private $meldung;
private $post = array();
function __construct(){
global $datenbank;
$this->db = $datenbank;
}
public function SettingSave($post){
$this->make_array($post);
$this->save();
meldung($this->error,$this->meldung);
}
private function save(){
if($this->db->update(PREFIX . CHATSE, $this->post, array("id" => 1)) == true){
$this->meldung = CHAT_SETTING_SAVE_TRUE;
}else{
$this->error = 1;
$this->meldung = CHAT_SESSTING_SAVE_FALSE;
}
}
private function make_array($post){
foreach($post AS $key => $value){
if($key != '' && $key != 'chat_save'){
$this->post[$key] = $this->db->escape($value);
}
}
}
public function Verlauf(){
$aus = '<ul class="list-group">';
foreach($this->db->get_results("SELECT * FROM ". PREFIX . CHAT ." ORDER BY id DESC LIMIT 100") AS $res){
$aus .= '
<li class="list-group-item">
<form method="post" action="">
<input type="hidden" name="id" value="'.$res->id.'">
<div class="row">
<div class="col-md-2">'.$res->absender.'</div>
<div class="col-md-9">'.$res->nachricht.'</div>
<div class="col-md-1"><input type="submit" name="chat_nachricht_loeschen" class="btn btn-danger" value="Löschen"></div>
</div>
</form>
</li>';
}
$aus .= '</ul>ul>';
return $aus;
}
public function DeleteMessage($id){
if(is_numeric($id['id'])){ $this->id = htmlspecialchars($id['id']);}
$this->delete();
meldung($this->error,$this->meldung);
}
private function delete(){
if($this->db->delete(PREFIX . CHAT,array("id" => $this->id)) == true){
$this->meldung = CHAT_DELETE_TRUE;
}else{
$this->error = 1;
$this->meldung = CHAT_DELETE_FALSE.$this->db->error();
}
}
}