@@ -19,7 +19,7 @@ class UnitySQL
19
19
private const TABLE_GROUP_JOIN_REQUESTS = "groupJoinRequests " ;
20
20
21
21
22
- // FIXME this string should be changed to something more intuitive, requires production sql change
22
+ // FIXME this string should be changed to something more intuitive, requires production change
23
23
public const REQUEST_BECOME_PI = "admin " ;
24
24
25
25
private $ conn ;
@@ -38,8 +38,14 @@ public function getConn()
38
38
//
39
39
// requests table methods
40
40
//
41
- public function addRequest ($ requestor , $ firstname , $ lastname , $ email , $ org , $ dest = self ::REQUEST_BECOME_PI )
42
- {
41
+ public function addRequest (
42
+ $ requestor ,
43
+ $ firstname ,
44
+ $ lastname ,
45
+ $ email ,
46
+ $ org ,
47
+ $ dest = self ::REQUEST_BECOME_PI
48
+ ) {
43
49
if ($ this ->requestExists ($ requestor , $ dest )) {
44
50
return ;
45
51
}
@@ -156,8 +162,9 @@ public function deleteRequestsByUser($user)
156
162
157
163
public function addNotice ($ title , $ date , $ content , $ operator )
158
164
{
165
+ $ table = self ::TABLE_NOTICES ;
159
166
$ stmt = $ this ->conn ->prepare (
160
- "INSERT INTO " . self :: TABLE_NOTICES . " (date, title, message) VALUES (:date, :title, :message) "
167
+ "INSERT INTO $ table (date, title, message) VALUES (:date, :title, :message) "
161
168
);
162
169
$ stmt ->bindParam (":date " , $ date );
163
170
$ stmt ->bindParam (":title " , $ title );
@@ -175,8 +182,9 @@ public function addNotice($title, $date, $content, $operator)
175
182
176
183
public function editNotice ($ id , $ title , $ date , $ content )
177
184
{
185
+ $ table = self ::TABLE_NOTICES ;
178
186
$ stmt = $ this ->conn ->prepare (
179
- "UPDATE " . self :: TABLE_NOTICES . " SET date=:date, title=:title, message=:message WHERE id=:id "
187
+ "UPDATE $ table SET date=:date, title=:title, message=:message WHERE id=:id "
180
188
);
181
189
$ stmt ->bindParam (":date " , $ date );
182
190
$ stmt ->bindParam (":title " , $ title );
@@ -261,8 +269,9 @@ public function editPage($id, $content, $operator)
261
269
// audit log table methods
262
270
public function addLog ($ operator , $ operator_ip , $ action_type , $ recipient )
263
271
{
272
+ $ table = self ::TABLE_AUDIT_LOG ;
264
273
$ stmt = $ this ->conn ->prepare (
265
- "INSERT INTO " . self :: TABLE_AUDIT_LOG . " (operator, operator_ip, action_type, recipient)
274
+ "INSERT INTO $ table (operator, operator_ip, action_type, recipient)
266
275
VALUE (:operator, :operator_ip, :action_type, :recipient) "
267
276
);
268
277
$ stmt ->bindParam (":operator " , $ operator );
@@ -332,9 +341,8 @@ public function updateSiteVar($name, $value)
332
341
333
342
public function getRole ($ uid , $ group )
334
343
{
335
- $ stmt = $ this ->conn ->prepare (
336
- "SELECT * FROM " . self ::TABLE_GROUP_ROLE_ASSIGNMENTS . " WHERE user=:uid AND `group`=:group "
337
- );
344
+ $ table = self ::TABLE_GROUP_ROLE_ASSIGNMENTS ;
345
+ $ stmt = $ this ->conn ->prepare ("SELECT * FROM $ table WHERE user=:uid AND `group`=:group " );
338
346
$ stmt ->bindParam (":uid " , $ uid );
339
347
$ stmt ->bindParam (":group " , $ group );
340
348
@@ -372,9 +380,8 @@ public function getPriority($role)
372
380
373
381
public function roleAvailableInGroup ($ uid , $ group , $ role )
374
382
{
375
- $ stmt = $ this ->conn ->prepare (
376
- "SELECT * FROM " . self ::TABLE_GROUP_ROLE_ASSIGNMENTS . " WHERE user=:uid AND `group`=:group "
377
- );
383
+ $ table = self ::TABLE_GROUP_ROLE_ASSIGNMENTS ;
384
+ $ stmt = $ this ->conn ->prepare ("SELECT * FROM $ table WHERE user=:uid AND `group`=:group " );
378
385
$ stmt ->bindParam (":uid " , $ uid );
379
386
$ stmt ->bindParam (":group " , $ group );
380
387
0 commit comments