Completed
Branch master (a049c8)
by Christopher
12:07
created
api-classes/Database.php 2 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -148,6 +148,12 @@  discard block
 block discarded – undo
148 148
         return $statement->fetchAll(PDO::FETCH_CLASS, $returnClass);
149 149
     }
150 150
 
151
+    /**
152
+     * @param string $returnClass
153
+     * @param string $table
154
+     * @param string[] $columns
155
+     * @param string[] $where
156
+     */
151 157
     public function selectSingle($returnClass, $table, $columns, $where = null)
152 158
     {
153 159
         $statement = $this->selectStatement($table, $columns, $where);
@@ -215,6 +221,8 @@  discard block
 block discarded – undo
215 221
 
216 222
   /**
217 223
    * Use with caution: it is often better to archive items to prevent creating null references.
224
+   * @param string $table
225
+   * @param string[] $where
218 226
    */
219 227
   public function delete($table, $where)
220 228
   {
@@ -253,6 +261,9 @@  discard block
 block discarded – undo
253 261
         return $table;
254 262
     }
255 263
 
264
+    /**
265
+     * @param string $table
266
+     */
256 267
     private function tableExists($table)
257 268
     {
258 269
         // todo: implement table check
Please login to merge, or discard this patch.
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -31,37 +31,37 @@  discard block
 block discarded – undo
31 31
         $this->disconnect();
32 32
     }
33 33
 
34
-  /**
35
-   * Initiate connection to database if not already connected
36
-   * returns bool.
37
-   */
38
-  public function connect()
39
-  {
40
-      if (!self::$con) {
41
-          $this->db_connection = new PDO("mysql:host=$this->db_host;dbname=$this->db_name", $this->db_user, $this->db_pass);
42
-      // set the PDO error mode to exception
43
-      $this->db_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
44
-      } else {
45
-          return true;
46
-      }
47
-  }
48
-
49
-  /**
50
-   * Initiate connection to database if not already connected.
51
-   */
52
-  public function disconnect()
53
-  {
54
-      if (self::$con) {
55
-          $this->db_connection = null;
56
-          self::$con = false;
57
-
58
-          return true;
59
-      } else {
60
-          return false;
61
-      }
62
-  }
63
-
64
-  /* SAMPLE EXPECTED DATA
34
+    /**
35
+     * Initiate connection to database if not already connected
36
+     * returns bool.
37
+     */
38
+    public function connect()
39
+    {
40
+        if (!self::$con) {
41
+            $this->db_connection = new PDO("mysql:host=$this->db_host;dbname=$this->db_name", $this->db_user, $this->db_pass);
42
+        // set the PDO error mode to exception
43
+        $this->db_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
44
+        } else {
45
+            return true;
46
+        }
47
+    }
48
+
49
+    /**
50
+     * Initiate connection to database if not already connected.
51
+     */
52
+    public function disconnect()
53
+    {
54
+        if (self::$con) {
55
+            $this->db_connection = null;
56
+            self::$con = false;
57
+
58
+            return true;
59
+        } else {
60
+            return false;
61
+        }
62
+    }
63
+
64
+    /* SAMPLE EXPECTED DATA
65 65
 
66 66
   $columns = array(
67 67
     "col1",
@@ -81,65 +81,65 @@  discard block
 block discarded – undo
81 81
 
82 82
   **Does not acceot INNER JOIN at the moment**
83 83
   */
84
-  public function selectStatement($table, $columns, $where = null, $order = null)
85
-  {
86
-      $table = $this->addPrefix($table);
87
-
88
-      if (!$this->tableExists($table)) {
89
-          return false;
90
-      }
91
-
92
-      $sql = 'SELECT ';
93
-
94
-      $first = true;
95
-      foreach ($columns as $column) {
96
-          if ($first) {
97
-              $first = false;
98
-              $sql .= $column;
99
-          } else {
100
-              $sql .= ', ';
101
-              $sql .= $column;
102
-          }
103
-      }
104
-
105
-      $sql .= ' FROM ';
106
-      $sql .= $table;
107
-
108
-      if ($where) {
109
-          $sql .= ' WHERE ';
110
-
111
-          $first = true;
112
-          foreach ($where as $condition) {
113
-              if ($first) {
114
-                  $first = false;
115
-                  $sql .= $condition;
116
-              } else {
117
-                  $sql .= ' AND ';
118
-                  $sql .= $condition;
119
-              }
120
-          }
121
-      }
122
-
123
-      if ($order) {
124
-          $sql .= ' ORDER BY ';
125
-
126
-          $first = true;
127
-          foreach ($order as $condition) {
128
-              if ($first) {
129
-                  $first = false;
130
-                  $sql .= $condition;
131
-              } else {
132
-                  $sql .= ', ';
133
-                  $sql .= $condition;
134
-              }
135
-          }
136
-      }
137
-
138
-      $statement = $this->db_connection->prepare($sql);
139
-      $statement->execute();
140
-
141
-      return $statement;
142
-  }
84
+    public function selectStatement($table, $columns, $where = null, $order = null)
85
+    {
86
+        $table = $this->addPrefix($table);
87
+
88
+        if (!$this->tableExists($table)) {
89
+            return false;
90
+        }
91
+
92
+        $sql = 'SELECT ';
93
+
94
+        $first = true;
95
+        foreach ($columns as $column) {
96
+            if ($first) {
97
+                $first = false;
98
+                $sql .= $column;
99
+            } else {
100
+                $sql .= ', ';
101
+                $sql .= $column;
102
+            }
103
+        }
104
+
105
+        $sql .= ' FROM ';
106
+        $sql .= $table;
107
+
108
+        if ($where) {
109
+            $sql .= ' WHERE ';
110
+
111
+            $first = true;
112
+            foreach ($where as $condition) {
113
+                if ($first) {
114
+                    $first = false;
115
+                    $sql .= $condition;
116
+                } else {
117
+                    $sql .= ' AND ';
118
+                    $sql .= $condition;
119
+                }
120
+            }
121
+        }
122
+
123
+        if ($order) {
124
+            $sql .= ' ORDER BY ';
125
+
126
+            $first = true;
127
+            foreach ($order as $condition) {
128
+                if ($first) {
129
+                    $first = false;
130
+                    $sql .= $condition;
131
+                } else {
132
+                    $sql .= ', ';
133
+                    $sql .= $condition;
134
+                }
135
+            }
136
+        }
137
+
138
+        $statement = $this->db_connection->prepare($sql);
139
+        $statement->execute();
140
+
141
+        return $statement;
142
+    }
143 143
 
144 144
     public function select($returnClass, $table, $columns, $where = null, $order = null)
145 145
     {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         return $statement->fetchObject($returnClass);
156 156
     }
157 157
 
158
-  /* SAMPLE EXPECTED DATA
158
+    /* SAMPLE EXPECTED DATA
159 159
   $data = [
160 160
     ['field' => "name", 'type' => "string", 'value' => "bob"],
161 161
     ['field' => "age", 'type' => "int", 'value' => "57"],
@@ -166,72 +166,72 @@  discard block
 block discarded – undo
166 166
   TRANSITION TO MYSQLI OR OTHER ANOTHER DRIVER
167 167
   EASILY IN THE FUTURE
168 168
   */
169
-  public function insert($table, $data)
170
-  {
171
-      $table = $this->addPrefix($table);
172
-
173
-      if (!$this->tableExists($table)) {
174
-          return false;
175
-      }
176
-
177
-      $first = true;
178
-
179
-      foreach ($data as $item) {
180
-          if ($first) {
181
-              $first = false;
182
-              $fields .= $item['field'];
183
-              $valuesPlaceholder .= ':'.$item['field'];
184
-          } else {
185
-              $fields .= ', '.$item['field'];
186
-              $valuesPlaceholder .= ', :'.$item['field'];
187
-          }
188
-
189
-          if ($item['type'] == 's' || $item['type'] == 'string') {
190
-              $types .= 's';
191
-          } elseif ($item['type'] == 'i' || $item['type'] == 'int' || $item['type'] == 'integer') {
192
-              $types .= 'i';
193
-          } elseif ($item['type'] == 'bit' || $item['type'] == 'bool' || $item['type'] == 'boolean') {
194
-              $types .= 'i';
195
-          } elseif ($item['type'] == 'd' || $item['type'] == 'double') {
196
-              $types .= 'd';
197
-          } elseif ($item['type'] == 'b' || $item['type'] == 'blob') {
198
-              $types .= 'b';
199
-          } else {
200
-              return false;
201
-          }
202
-      }
203
-
204
-      $statement = $this->db_connection->prepare('INSERT INTO '.$table.' ('.$fields.') VALUES ('.$valuesPlaceholder.')');
205
-      foreach ($data as $item) {
206
-          $statement->bindParam(':'.$item['field'], $item['value']);
207
-      }
208
-
209
-      if ($statement->execute()) {
210
-          return true;
211
-      } else {
212
-          return false;
213
-      }
214
-  }
215
-
216
-  /**
217
-   * Use with caution: it is often better to archive items to prevent creating null references.
218
-   */
219
-  public function delete($table, $where)
220
-  {
221
-      $table = $this->addPrefix($table);
222
-
223
-      if (!$this->tableExists($table)) {
224
-          return false;
225
-      }
226
-
227
-      $sql = 'DELETE FROM ';
228
-      $sql .= $table;
229
-      $sql .= ' WHERE ';
230
-      foreach ($where as $condition) {
231
-          $sql .= $condition;
232
-      }
233
-
234
-      $statement = $this->db_connection->prepare($sql);
169
+    public function insert($table, $data)
170
+    {
171
+        $table = $this->addPrefix($table);
172
+
173
+        if (!$this->tableExists($table)) {
174
+            return false;
175
+        }
176
+
177
+        $first = true;
178
+
179
+        foreach ($data as $item) {
180
+            if ($first) {
181
+                $first = false;
182
+                $fields .= $item['field'];
183
+                $valuesPlaceholder .= ':'.$item['field'];
184
+            } else {
185
+                $fields .= ', '.$item['field'];
186
+                $valuesPlaceholder .= ', :'.$item['field'];
187
+            }
188
+
189
+            if ($item['type'] == 's' || $item['type'] == 'string') {
190
+                $types .= 's';
191
+            } elseif ($item['type'] == 'i' || $item['type'] == 'int' || $item['type'] == 'integer') {
192
+                $types .= 'i';
193
+            } elseif ($item['type'] == 'bit' || $item['type'] == 'bool' || $item['type'] == 'boolean') {
194
+                $types .= 'i';
195
+            } elseif ($item['type'] == 'd' || $item['type'] == 'double') {
196
+                $types .= 'd';
197
+            } elseif ($item['type'] == 'b' || $item['type'] == 'blob') {
198
+                $types .= 'b';
199
+            } else {
200
+                return false;
201
+            }
202
+        }
203
+
204
+        $statement = $this->db_connection->prepare('INSERT INTO '.$table.' ('.$fields.') VALUES ('.$valuesPlaceholder.')');
205
+        foreach ($data as $item) {
206
+            $statement->bindParam(':'.$item['field'], $item['value']);
207
+        }
208
+
209
+        if ($statement->execute()) {
210
+            return true;
211
+        } else {
212
+            return false;
213
+        }
214
+    }
215
+
216
+    /**
217
+     * Use with caution: it is often better to archive items to prevent creating null references.
218
+     */
219
+    public function delete($table, $where)
220
+    {
221
+        $table = $this->addPrefix($table);
222
+
223
+        if (!$this->tableExists($table)) {
224
+            return false;
225
+        }
226
+
227
+        $sql = 'DELETE FROM ';
228
+        $sql .= $table;
229
+        $sql .= ' WHERE ';
230
+        foreach ($where as $condition) {
231
+            $sql .= $condition;
232
+        }
233
+
234
+        $statement = $this->db_connection->prepare($sql);
235 235
 
236 236
     // todo: restructure where clause and bind parameters
237 237
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     } else {
241 241
         return false;
242 242
     }
243
-  }
243
+    }
244 244
 
245 245
     public function update()
246 246
     {
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
     public function count($table, $column, $where = null)
273 273
     {
274 274
         $columns = [
275
-      'COUNT('.$column.') AS count',
276
-     ];
275
+        'COUNT('.$column.') AS count',
276
+        ];
277 277
         $statement = $this->selectStatement($table, $columns, $where);
278 278
 
279 279
         return $statement->fetchObject()->count;
Please login to merge, or discard this patch.
generated-classes/TechWilk/Rota/User.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@
 block discarded – undo
196 196
     /**
197 197
      * Determine if the user is marked as available for an event.
198 198
      *
199
-     * @return bool if user is available
199
+     * @return null|boolean if user is available
200 200
      */
201 201
     public function isAvailableForEvent(Event $event)
202 202
     {
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -19,31 +19,31 @@  discard block
 block discarded – undo
19 19
 class User extends BaseUser
20 20
 {
21 21
     /**
22
-   * Set the value of [password] column.
23
-   *
24
-   * @param string $v new value
25
-   *
26
-   * @return $this|\User The current object (for fluent API support)
27
-   */
28
-  public function setPassword($v)
29
-  {
30
-      if ($v !== null) {
31
-          $v = (string) $v;
32
-      }
33
-
34
-      if (!password_verify($v, $this->password)) {
35
-          $bcrypt_options = [
22
+     * Set the value of [password] column.
23
+     *
24
+     * @param string $v new value
25
+     *
26
+     * @return $this|\User The current object (for fluent API support)
27
+     */
28
+    public function setPassword($v)
29
+    {
30
+        if ($v !== null) {
31
+            $v = (string) $v;
32
+        }
33
+
34
+        if (!password_verify($v, $this->password)) {
35
+            $bcrypt_options = [
36 36
         'cost' => 12,
37
-      ];
38
-          $this->password = password_hash($v, PASSWORD_BCRYPT, $bcrypt_options);
37
+        ];
38
+            $this->password = password_hash($v, PASSWORD_BCRYPT, $bcrypt_options);
39 39
 
40
-          $this->modifiedColumns[UserTableMap::COL_PASSWORD] = true;
41
-      }
40
+            $this->modifiedColumns[UserTableMap::COL_PASSWORD] = true;
41
+        }
42 42
 
43
-      return $this;
44
-  }
43
+        return $this;
44
+    }
45 45
 
46
- // setPassword()
46
+    // setPassword()
47 47
 
48 48
     /**
49 49
      * Check a plain text password against the value of [password] column.
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         return password_verify($v, $this->password);
64 64
     }
65 65
 
66
- // checkPassword()
66
+    // checkPassword()
67 67
 
68 68
     public function isAdmin()
69 69
     {
Please login to merge, or discard this patch.
src/classes/Authentication.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -119,6 +119,9 @@
 block discarded – undo
119 119
         return true;
120 120
     }
121 121
 
122
+    /**
123
+     * @param EmailAddress $username
124
+     */
122 125
     private function numberOfLoginAttemptsIsOk($username)
123 126
     {
124 127
         $numberOfAllowedAttempts = 8;
Please login to merge, or discard this patch.
public/api/v1/index.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     $location = $event->getLocation();
83 83
 
84 84
     $data = [
85
-          'data' => [
85
+            'data' => [
86 86
                     'id'            => $event->getId(),
87 87
                     'name'          => $event->name,
88 88
                     'date'          => $event->datetime,
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
                                                                 'related' => '/events/'.$event->getId().'/series/'.$series->getId(),
96 96
                                                     ],
97 97
                                                     'data' => [
98
-                                                      'type' => 'series',
99
-                                                      'id'   => $series->getId(),
98
+                                                        'type' => 'series',
99
+                                                        'id'   => $series->getId(),
100 100
                                                     ],
101 101
                                         ],
102 102
                                         'types' => [
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
                                                                 'related' => '/events/'.$event->getId().'/types/'.$type->getId(),
106 106
                                                     ],
107 107
                                                     'data' => [
108
-                                                      'type' => 'types',
109
-                                                      'id'   => $type->getId(),
108
+                                                        'type' => 'types',
109
+                                                        'id'   => $type->getId(),
110 110
                                                     ],
111 111
                                         ],
112 112
                                         'sub-types' => [
@@ -130,56 +130,56 @@  discard block
 block discarded – undo
130 130
                                                     ],
131 131
                                         ],
132 132
                     ],
133
-          ],
134
-          'included' => [
135
-                          [
133
+            ],
134
+            'included' => [
135
+                            [
136 136
                             'type'       => 'series',
137 137
                             'id'         => $series->getId(),
138 138
                             'attributes' => [
139
-                                          'name'        => $series->name,
140
-                                          'description' => $series->description,
139
+                                            'name'        => $series->name,
140
+                                            'description' => $series->description,
141 141
                             ],
142 142
                             'links' => [
143 143
                                         'self' => '/series/'.$series->getId(),
144 144
                             ],
145
-                          ],
146
-                          [
145
+                            ],
146
+                            [
147 147
                             'type'       => 'types',
148 148
                             'id'         => $type->getId(),
149 149
                             'attributes' => [
150
-                                      'name'        => $type->name,
151
-                                      'description' => $type->description,
150
+                                        'name'        => $type->name,
151
+                                        'description' => $type->description,
152 152
                             ],
153 153
                             'links' => [
154 154
                                         'self' => '/types/'.$type->getId(),
155 155
                             ],
156
-                          ],
157
-                          [
156
+                            ],
157
+                            [
158 158
                             'type'       => 'sub-types',
159 159
                             'id'         => $sub_type->getId(),
160 160
                             'attributes' => [
161
-                                      'name'        => $sub_type->name,
162
-                                      'description' => $sub_type->description,
161
+                                        'name'        => $sub_type->name,
162
+                                        'description' => $sub_type->description,
163 163
                             ],
164 164
                             'links' => [
165 165
                                         'self' => '/sub-types/'.$sub_type->getId(),
166 166
                             ],
167
-                          ],
168
-                          [
167
+                            ],
168
+                            [
169 169
                             'type'       => 'locations',
170 170
                             'id'         => $location->getId(),
171 171
                             'attributes' => [
172
-                                      'name' => $location->name,
172
+                                        'name' => $location->name,
173 173
                             ],
174 174
                             'links' => [
175 175
                                         'self' => '/locations/'.$location->getId(),
176 176
                             ],
177
-                          ],
178
-          ],
179
-          'meta' => [
177
+                            ],
178
+            ],
179
+            'meta' => [
180 180
                     'status' => '200',
181
-          ],
182
-  ];
181
+            ],
182
+    ];
183 183
 
184 184
     return $response->withJson($data, 200);
185 185
 });
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
     $series->createInDb($this->db);
200 200
 
201 201
     $data = [
202
-          'data' => [
202
+            'data' => [
203 203
                     'id'          => $series->getId(),
204 204
                     'name'        => $series->name,
205 205
                     'description' => $series->description,
206 206
                     ],
207
-          ];
207
+            ];
208 208
 
209 209
     return $response->withJson($data);
210 210
 });
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
     $series->getFromDbWithId($this->db, $id);
217 217
 
218 218
     $data = [
219
-          'data' => [
219
+            'data' => [
220 220
                     'id'          => $series->getId(),
221 221
                     'name'        => $series->name,
222 222
                     'description' => $series->description,
223 223
                     ],
224
-          ];
224
+            ];
225 225
 
226 226
     return $response->withJson($data);
227 227
 });
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
     $series->deleteFromDbWithId($this->db, $id);
234 234
 
235 235
     $data = [
236
-          'data' => [
236
+            'data' => [
237 237
                     'id'       => $series->getId(),
238 238
                     'archived' => true,
239 239
                     ],
240
-          ];
240
+            ];
241 241
 
242 242
     return $response->withJson($data);
243 243
 });
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
     $type->createInDb($this->db);
258 258
 
259 259
     $data = [
260
-          'data' => [
260
+            'data' => [
261 261
                     'id'          => $type->getId(),
262 262
                     'name'        => $type->name,
263 263
                     'description' => $type->description,
264 264
                     ],
265
-          ];
265
+            ];
266 266
 
267 267
     return $response->withJson($data);
268 268
 });
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
     $type->getFromDbWithId($this->db, $id);
275 275
 
276 276
     $data = [
277
-          'data' => [
277
+            'data' => [
278 278
                     'id'          => $type->getId(),
279 279
                     'name'        => $type->name,
280 280
                     'description' => $type->description,
281 281
                     ],
282
-          ];
282
+            ];
283 283
 
284 284
     return $response->withJson($data);
285 285
 });
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
     $type->deleteFromDbWithId($this->db, $id);
292 292
 
293 293
     $data = [
294
-          'data' => [
294
+            'data' => [
295 295
                     'id'       => $type->getId(),
296 296
                     'archived' => true,
297 297
                     ],
298
-          ];
298
+            ];
299 299
 
300 300
     return $response->withJson($data);
301 301
 });
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
     $type->createInDb($this->db);
316 316
 
317 317
     $data = [
318
-          'data' => [
318
+            'data' => [
319 319
                     'id'          => $type->getId(),
320 320
                     'name'        => $type->name,
321 321
                     'description' => $type->description,
322 322
                     ],
323
-          ];
323
+            ];
324 324
 
325 325
     return $response->withJson($data);
326 326
 });
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
     $type->getFromDbWithId($this->db, $id);
333 333
 
334 334
     $data = [
335
-          'data' => [
335
+            'data' => [
336 336
                     'id'          => $type->getId(),
337 337
                     'name'        => $type->name,
338 338
                     'description' => $type->description,
339 339
                     ],
340
-          ];
340
+            ];
341 341
 
342 342
     return $response->withJson($data);
343 343
 });
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
     $type->deleteFromDbWithId($this->db, $id);
350 350
 
351 351
     $data = [
352
-          'data' => [
352
+            'data' => [
353 353
                     'id'       => $type->getId(),
354 354
                     'archived' => true,
355 355
                     ],
356
-          ];
356
+            ];
357 357
 
358 358
     return $response->withJson($data);
359 359
 });
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
     $type->createInDb($this->db);
372 372
 
373 373
     $data = [
374
-          'data' => [
374
+            'data' => [
375 375
                     'id'   => $location->getId(),
376 376
                     'name' => $location->name,
377 377
                     ],
378
-          ];
378
+            ];
379 379
 
380 380
     return $response->withJson($data);
381 381
 });
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
     $location->getFromDbWithId($this->db, $id);
388 388
 
389 389
     $data = [
390
-          'data' => [
390
+            'data' => [
391 391
                     'id'   => $location->getId(),
392 392
                     'name' => $location->name,
393 393
                     ],
394
-          ];
394
+            ];
395 395
 
396 396
     return $response->withJson($data);
397 397
 });
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
     $location->deleteFromDbWithId($this->db, $id);
404 404
 
405 405
     $data = [
406
-          'data' => [
406
+            'data' => [
407 407
                     'id'       => $location->getId(),
408 408
                     'archived' => true,
409 409
                     ],
410
-          ];
410
+            ];
411 411
 
412 412
     return $response->withJson($data);
413 413
 });
Please login to merge, or discard this patch.
public/old/swap.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 $swapId = filter_var($swapId, FILTER_SANITIZE_NUMBER_INT);
48 48
 
49 49
 switch ($action) {
50
-  case 'swap':
50
+    case 'swap':
51 51
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
52 52
         $eventPersonId = $_POST['eventPerson'];
53 53
         $newUserRoleId = $_POST['newUserRole'];
@@ -61,58 +61,58 @@  discard block
 block discarded – undo
61 61
         $err = 'Swap details incorrect, please try again.';
62 62
     }
63 63
     break;
64
-  case 'accept':
64
+    case 'accept':
65 65
     if (canAcceptSwap($swapId) || $verify == verificationCodeForSwap($swapId)) {
66 66
         switch (acceptSwap($swapId)) {
67 67
         case '1':
68 68
           $message = 'Swap Successful';
69
-          break;
69
+            break;
70 70
         case '2':
71 71
           $message = 'Swap already accepted.';
72
-          break;
72
+            break;
73 73
         case '3':
74 74
           $message = 'Swap already declined.';
75
-          break;
75
+            break;
76 76
         case '4':
77 77
           $message = 'Swap already reverted.';
78
-          break;
78
+            break;
79 79
         default:
80 80
           $err = 'Technical issue - please inform system administrator';
81
-          break;
82
-      }
81
+            break;
82
+        }
83 83
     } else {
84 84
         $err = 'Swap Already Actioned or Verification Code Invalid';
85 85
     }
86 86
     break;
87
-  case 'decline':
87
+    case 'decline':
88 88
     if (canDeclineSwap($swapId) || $verify == verificationCodeForSwap($swapId)) {
89 89
         switch (declineSwap($swapId)) {
90 90
         case '1':
91 91
           $message = 'Swap declined';
92
-          break;
92
+            break;
93 93
         case '2':
94 94
           $message = 'Swap already declined.';
95
-          break;
95
+            break;
96 96
         default:
97 97
           $err = 'Technical issue - please inform system administrator';
98
-          break;
98
+            break;
99 99
         }
100 100
     } else {
101 101
         $err = 'Swap Already Actioned or Verification Code Invalid';
102 102
     }
103 103
     break;
104 104
 
105
-  default:
105
+    default:
106 106
     // code...
107 107
     break;
108 108
 }
109 109
 
110 110
 if (!empty($eventId)) {
111 111
     // ensure user is logged in before allowing creation of swap
112
-  if (!(isset($_SESSION['is_logged_in']) || $_SESSION['db_is_logged_in'] == true)) {
113
-      $_SESSION['redirectUrl'] = siteSettings()->getSiteUrl().'/swap.php?event='.$eventId;
114
-      header('Location: login.php');
115
-  }
112
+    if (!(isset($_SESSION['is_logged_in']) || $_SESSION['db_is_logged_in'] == true)) {
113
+        $_SESSION['redirectUrl'] = siteSettings()->getSiteUrl().'/swap.php?event='.$eventId;
114
+        header('Location: login.php');
115
+    }
116 116
     $createSwap = true;
117 117
 
118 118
     $numberOfRoles = numberOfRolesOfUserAtEvent($sessionUserID, $eventId);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		<section class="content">
164 164
       
165 165
       <?php
166
-      if (isset($message)): ?>
166
+        if (isset($message)): ?>
167 167
       
168 168
         <p><?php echo $message ?></p>
169 169
 
@@ -224,19 +224,19 @@  discard block
 block discarded – undo
224 224
                 <label for="newUserRole">Swap To:</label>
225 225
                 <select name="newUserRole" class="form-control">
226 226
                   <?php
227
-                  if (roleCanSwapToOtherRoleInGroup($role->roleId)) {
228
-                      $whereAnd = 'r.groupId = '.groupIdWithRole($role->roleId).' AND r.allowRoleSwaps IS NOT FALSE';
229
-                  } else {
230
-                      $whereAnd = 'r.id = '.$role->roleId;
231
-                  }
232
-                  $sql = 'SELECT ur.id, u.firstName, u.lastName, r.name FROM cr_users u INNER JOIN cr_userRoles ur ON ur.userId = u.id INNER JOIN cr_roles r ON r.id = ur.roleId WHERE u.id <> '.$role->userId.' AND '.$whereAnd.' ORDER BY lastName, firstName, r.name';
233
-                  $result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
234
-
235
-                  while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
236
-                      ?>
227
+                    if (roleCanSwapToOtherRoleInGroup($role->roleId)) {
228
+                        $whereAnd = 'r.groupId = '.groupIdWithRole($role->roleId).' AND r.allowRoleSwaps IS NOT FALSE';
229
+                    } else {
230
+                        $whereAnd = 'r.id = '.$role->roleId;
231
+                    }
232
+                    $sql = 'SELECT ur.id, u.firstName, u.lastName, r.name FROM cr_users u INNER JOIN cr_userRoles ur ON ur.userId = u.id INNER JOIN cr_roles r ON r.id = ur.roleId WHERE u.id <> '.$role->userId.' AND '.$whereAnd.' ORDER BY lastName, firstName, r.name';
233
+                    $result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
234
+
235
+                    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
236
+                        ?>
237 237
                     <option value='<?php echo $row['id']; ?>'><?php echo $row['firstName'].' '.$row['lastName'].' ('.$row['name'].')'; ?></option>
238 238
                   <?php
239
-                  } ?>
239
+                    } ?>
240 240
                 </select>
241 241
               </div>
242 242
             </div>
Please login to merge, or discard this patch.
public/old/subTypes.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@
 block discarded – undo
53 53
     }
54 54
 
55 55
     // After we have inserted the data, we want to head back to the main users page
56
-     header('Location: subTypes.php'); // Move to the home page of the admin section
57
-      exit;
56
+        header('Location: subTypes.php'); // Move to the home page of the admin section
57
+        exit;
58 58
 }
59 59
 include 'includes/header.php';
60 60
 ?>
Please login to merge, or discard this patch.
public/old/recordingUpload.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 
35 35
 // get token
36 36
 $response = $client->request(
37
-  'POST',
38
-  'v3/tokens.json',
39
-  ['form_params' => ['api_key' => siteConfig()['recording']['locomotivecms']['apiKey'],
40
-                       'email' => siteConfig()['recording']['locomotivecms']['email'], ]]
41
-  );
37
+    'POST',
38
+    'v3/tokens.json',
39
+    ['form_params' => ['api_key' => siteConfig()['recording']['locomotivecms']['apiKey'],
40
+                        'email' => siteConfig()['recording']['locomotivecms']['email'], ]]
41
+    );
42 42
 if ($response->getStatusCode() == 201) {
43 43
     $token = json_decode($response->getBody())->token;
44 44
 }
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 // test token
47 47
 if (isset($token)) {
48 48
     $response = $client->request(
49
-  'GET',
50
-  'v3/my_account.json',
51
-  ['query' => ['auth_token' => $token]]);
49
+    'GET',
50
+    'v3/my_account.json',
51
+    ['query' => ['auth_token' => $token]]);
52 52
     var_dump($response);
53 53
 } else {
54 54
     echo '<p>Unable to connect to main site</p>';
Please login to merge, or discard this patch.
public/old/notification.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@
 block discarded – undo
57 57
 if (!empty($notificationId)) {
58 58
     seenNotification($notificationId, $referer);
59 59
 
60
-  // redir if notification has URL
61
-  $redir = notificationLink($notificationId);
60
+    // redir if notification has URL
61
+    $redir = notificationLink($notificationId);
62 62
     if (!empty($redir)) {
63 63
         header('Location: '.$redir);
64 64
     }
65 65
 
66
-  // find notification
67
-  $notification = notificationWithId($notificationId);
66
+    // find notification
67
+    $notification = notificationWithId($notificationId);
68 68
 }
69 69
 
70 70
     // ------ Presentation --------
Please login to merge, or discard this patch.
public/old/fb-signup.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 }
28 28
 
29 29
 $fb = new Facebook\Facebook([
30
-  'app_id'                => $config['auth']['facebook']['appId'],
31
-  'app_secret'            => $config['auth']['facebook']['appSecret'],
32
-  'default_graph_version' => 'v2.2',
33
-  ]);
30
+    'app_id'                => $config['auth']['facebook']['appId'],
31
+    'app_secret'            => $config['auth']['facebook']['appSecret'],
32
+    'default_graph_version' => 'v2.2',
33
+    ]);
34 34
 
35 35
 $accessToken = $_SESSION['fb_access_token'];
36 36
 $_SESSION['foo'] = 'bar';
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 try {
41 41
     // Returns a `Facebook\FacebookResponse` object
42
-  $response = $fb->get('/me?fields=id,name,email', $accessToken);
42
+    $response = $fb->get('/me?fields=id,name,email', $accessToken);
43 43
 } catch (Facebook\Exceptions\FacebookResponseException $e) {
44 44
     echo 'Graph returned an error: '.$e->getMessage();
45 45
     exit;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 if (userExistsWithSocialIdForPlatform($user->getId(), 'facebook')) {
56 56
     // login
57
-  setSessionAndRedirect(getUsernameWithSocialId($user->getId()));
57
+    setSessionAndRedirect(getUsernameWithSocialId($user->getId()));
58 58
     exit;
59 59
 }
60 60
 
Please login to merge, or discard this patch.