This repository was archived by the owner on Jul 17, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,9 @@ public function resetMessages(){
84
84
return $ this ->message_mapper ->resetMessages ();
85
85
}
86
86
87
- public function deleteMessage ($ name ){
87
+ public function deleteMessage ($ a , $ b ){
88
88
if (!$ this ->isRegistered ()) return ;
89
89
90
- return $ this ->message_mapper ->deleteMessage ($ name );
90
+ return $ this ->message_mapper ->deleteMessage ($ a , $ b );
91
91
}
92
92
}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public function __construct($channel = "general"){
10
10
$ this ->fichier_temp = __DIR__ . "/../.data/db/channels/ " . $ channel . "_temp.csv " ;
11
11
12
12
if (!file_exists ($ this ->fichier = __DIR__ . "/../.data/db/channels/ " . $ channel . ".csv " )){
13
- touch ( $ this ->fichier ) ;
13
+ $ this ->fichier = __DIR__ . " /../.data/db/channels/general.csv " ;
14
14
}
15
15
}
16
16
@@ -40,16 +40,15 @@ public function getMessages(){
40
40
endif ;
41
41
}
42
42
43
- public function deleteMessage ($ name ){
43
+ public function deleteMessage ($ name, $ time ){
44
44
$ table = fopen ($ this ->fichier ,"r " );
45
45
$ temp_table = fopen ($ this ->fichier_temp ,"w " );
46
46
47
47
while (($ data = fgetcsv ($ table ,1000 )) !== FALSE ){
48
- if ($ data [1 ] == $ name){ // this is if you need the first column in a row
48
+ if ($ data [1 ] == $ name && $ data [ 2 ] == $ time ){
49
49
continue ;
50
50
}
51
51
52
- var_dump ($ data );
53
52
fputcsv ($ temp_table ,$ data );
54
53
}
55
54
Original file line number Diff line number Diff line change 4
4
<p class =" author" ><?=$this->author;?> <!-- (?=$this->pseudo;?)--> </p >
5
5
<p class =" content" ><?=$this->message;?></p >
6
6
<p class =" time" ><?=ucfirst(strftime("%A %e %B %Y à %k:%M:%S",$this->date));?></p >
7
-
8
- <input type =" button" name =" <?=$this->message;?>" id =" clear" value =" ✕" onclick =" deleteMessage(this.name);" >
7
+ <?php if($_SESSION["username"] == "PERROT Corentin" || $_SESSION["username"] == "acs dds") : ?>
8
+ <input type =" button" name =" <?=$this->message;?>" date =" <?=$this->date;?>" id =" clear" value =" ✕" onclick =" deleteMessage(this.name,this.attributes[2].value);" >
9
+ <?php endif;?>
9
10
</div >
You can’t perform that action at this time.
0 commit comments