@@ -59,7 +59,6 @@ public function removeRequest($requestor, string $dest): void
5959 );
6060 $ stmt ->bindParam (":uid " , $ requestor );
6161 $ stmt ->bindParam (":request_for " , $ dest );
62-
6362 $ stmt ->execute ();
6463 }
6564
@@ -69,7 +68,6 @@ public function removeRequests(string $dest): void
6968 "DELETE FROM " . self ::TABLE_REQS . " WHERE request_for=:request_for " ,
7069 );
7170 $ stmt ->bindParam (":request_for " , $ dest );
72-
7371 $ stmt ->execute ();
7472 }
7573
@@ -115,47 +113,36 @@ public function getRequests(string $dest): array
115113 "SELECT * FROM " . self ::TABLE_REQS . " WHERE request_for=:request_for " ,
116114 );
117115 $ stmt ->bindParam (":request_for " , $ dest );
118-
119116 $ stmt ->execute ();
120-
121117 return $ stmt ->fetchAll ();
122118 }
123119
124120 public function getRequestsByUser (string $ user ): array
125121 {
126122 $ stmt = $ this ->conn ->prepare ("SELECT * FROM " . self ::TABLE_REQS . " WHERE uid=:uid " );
127123 $ stmt ->bindParam (":uid " , $ user );
128-
129124 $ stmt ->execute ();
130-
131125 return $ stmt ->fetchAll ();
132126 }
133127
134128 public function deleteRequestsByUser (string $ user ): void
135129 {
136130 $ stmt = $ this ->conn ->prepare ("DELETE FROM " . self ::TABLE_REQS . " WHERE uid=:uid " );
137131 $ stmt ->bindParam (":uid " , $ user );
138-
139132 $ stmt ->execute ();
140133 }
141134
142- public function addNotice (
143- string $ title ,
144- string $ date ,
145- string $ content ,
146- UnityUser $ operator ,
147- ): void {
135+ public function addNotice (string $ title , string $ date , string $ content ): void
136+ {
148137 $ table = self ::TABLE_NOTICES ;
149138 $ stmt = $ this ->conn ->prepare (
150139 "INSERT INTO $ table (date, title, message) VALUES (:date, :title, :message) " ,
151140 );
152141 $ stmt ->bindParam (":date " , $ date );
153142 $ stmt ->bindParam (":title " , $ title );
154143 $ stmt ->bindParam (":message " , $ content );
155-
156144 $ stmt ->execute ();
157-
158- $ this ->addLog ($ operator ->uid , $ _SERVER ["REMOTE_ADDR " ], "added_cluster_notice " , $ operator );
145+ $ this ->addLog ("added_cluster_notice " , "" );
159146 }
160147
161148 public function editNotice (string $ id , string $ title , string $ date , string $ content ): void
@@ -168,25 +155,21 @@ public function editNotice(string $id, string $title, string $date, string $cont
168155 $ stmt ->bindParam (":title " , $ title );
169156 $ stmt ->bindParam (":message " , $ content );
170157 $ stmt ->bindParam (":id " , $ id );
171-
172158 $ stmt ->execute ();
173159 }
174160
175161 public function deleteNotice (string $ id ): void
176162 {
177163 $ stmt = $ this ->conn ->prepare ("DELETE FROM " . self ::TABLE_NOTICES . " WHERE id=:id " );
178164 $ stmt ->bindParam (":id " , $ id );
179-
180165 $ stmt ->execute ();
181166 }
182167
183168 public function getNotice (string $ id ): array
184169 {
185170 $ stmt = $ this ->conn ->prepare ("SELECT * FROM " . self ::TABLE_NOTICES . " WHERE id=:id " );
186171 $ stmt ->bindParam (":id " , $ id );
187-
188172 $ stmt ->execute ();
189-
190173 return $ stmt ->fetchAll ()[0 ];
191174 }
192175
@@ -196,57 +179,46 @@ public function getNotices(): array
196179 "SELECT * FROM " . self ::TABLE_NOTICES . " ORDER BY date DESC " ,
197180 );
198181 $ stmt ->execute ();
199-
200182 return $ stmt ->fetchAll ();
201183 }
202184
203185 public function getPages (): array
204186 {
205187 $ stmt = $ this ->conn ->prepare ("SELECT * FROM " . self ::TABLE_PAGES );
206188 $ stmt ->execute ();
207-
208189 return $ stmt ->fetchAll ();
209190 }
210191
211192 public function getPage (string $ id ): array
212193 {
213194 $ stmt = $ this ->conn ->prepare ("SELECT * FROM " . self ::TABLE_PAGES . " WHERE page=:id " );
214195 $ stmt ->bindParam (":id " , $ id );
215-
216196 $ stmt ->execute ();
217-
218197 return $ stmt ->fetchAll ()[0 ];
219198 }
220199
221- public function editPage (string $ id , string $ content, UnityUser $ operator ): void
200+ public function editPage (string $ id , string $ content ): void
222201 {
223202 $ stmt = $ this ->conn ->prepare (
224203 "UPDATE " . self ::TABLE_PAGES . " SET content=:content WHERE page=:id " ,
225204 );
226205 $ stmt ->bindParam (":id " , $ id );
227206 $ stmt ->bindParam (":content " , $ content );
228-
229207 $ stmt ->execute ();
230-
231- $ this ->addLog ($ operator ->uid , $ _SERVER ["REMOTE_ADDR " ], "edited_page " , $ operator );
208+ $ this ->addLog ("edited_page " , "" );
232209 }
233210
234- public function addLog (
235- string $ operator ,
236- string $ operator_ip ,
237- string $ action_type ,
238- string $ recipient ,
239- ): void {
211+ public function addLog (string $ action_type , string $ recipient ): void
212+ {
240213 $ table = self ::TABLE_AUDIT_LOG ;
241214 $ stmt = $ this ->conn ->prepare (
242215 "INSERT INTO $ table (operator, operator_ip, action_type, recipient)
243216 VALUE (:operator, :operator_ip, :action_type, :recipient) " ,
244217 );
245- $ stmt ->bindParam (":operator " , $ operator );
246- $ stmt ->bindParam (":operator_ip " , $ operator_ip );
218+ $ stmt ->bindValue (":operator " , $ _SESSION [ " OPERATOR " ] ?? "" );
219+ $ stmt ->bindValue (":operator_ip " , $ _SESSION [ " OPERATOR_IP " ] ?? "" );
247220 $ stmt ->bindParam (":action_type " , $ action_type );
248221 $ stmt ->bindParam (":recipient " , $ recipient );
249-
250222 $ stmt ->execute ();
251223 }
252224
@@ -256,7 +228,6 @@ public function addAccountDeletionRequest(string $uid): void
256228 "INSERT INTO " . self ::TABLE_ACCOUNT_DELETION_REQUESTS . " (uid) VALUE (:uid) " ,
257229 );
258230 $ stmt ->bindParam (":uid " , $ uid );
259-
260231 $ stmt ->execute ();
261232 }
262233
@@ -266,9 +237,7 @@ public function accDeletionRequestExists(string $uid): bool
266237 "SELECT * FROM " . self ::TABLE_ACCOUNT_DELETION_REQUESTS . " WHERE uid=:uid " ,
267238 );
268239 $ stmt ->bindParam (":uid " , $ uid );
269-
270240 $ stmt ->execute ();
271-
272241 return count ($ stmt ->fetchAll ()) > 0 ;
273242 }
274243
0 commit comments