Skip to content

Commit 0f0d71c

Browse files
Escape the order_by parameters so that we avoid invalid SQL being executed
1 parent 74633b6 commit 0f0d71c

14 files changed

+28
-28
lines changed

application/models/Admins_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function get(
205205
}
206206

207207
if ($order_by !== null) {
208-
$this->db->order_by($order_by);
208+
$this->db->order_by($this->db->escape($order_by));
209209
}
210210

211211
$admins = $this->db->get_where('users', ['id_roles' => $role_id], $limit, $offset)->result_array();
@@ -512,7 +512,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
512512
->group_end()
513513
->limit($limit)
514514
->offset($offset)
515-
->order_by($order_by)
515+
->order_by($this->db->escape($order_by))
516516
->get()
517517
->result_array();
518518

application/models/Appointments_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function get(
185185
}
186186

187187
if ($order_by) {
188-
$this->db->order_by($order_by);
188+
$this->db->order_by($this->db->escape($order_by));
189189
}
190190

191191
$appointments = $this->db
@@ -492,7 +492,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
492492
->group_end()
493493
->limit($limit)
494494
->offset($offset)
495-
->order_by($order_by)
495+
->order_by($this->db->escape($order_by))
496496
->get()
497497
->result_array();
498498

application/models/Blocked_periods_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
241241
->group_end()
242242
->limit($limit)
243243
->offset($offset)
244-
->order_by($order_by)
244+
->order_by($this->db->escape($order_by))
245245
->get()
246246
->result_array();
247247

@@ -273,7 +273,7 @@ public function get(
273273
}
274274

275275
if ($order_by !== null) {
276-
$this->db->order_by($order_by);
276+
$this->db->order_by($this->db->escape($order_by));
277277
}
278278

279279
$blocked_periods = $this->db->get('blocked_periods', $limit, $offset)->result_array();

application/models/Consents_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
206206
->group_end()
207207
->limit($limit)
208208
->offset($offset)
209-
->order_by($order_by)
209+
->order_by($this->db->escape($order_by))
210210
->get()
211211
->result_array();
212212

@@ -238,7 +238,7 @@ public function get(
238238
}
239239

240240
if ($order_by !== null) {
241-
$this->db->order_by($order_by);
241+
$this->db->order_by($this->db->escape($order_by));
242242
}
243243

244244
$consents = $this->db->get('consents', $limit, $offset)->result_array();

application/models/Customers_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function get(
167167
}
168168

169169
if ($order_by !== null) {
170-
$this->db->order_by($order_by);
170+
$this->db->order_by($this->db->escape($order_by));
171171
}
172172

173173
$customers = $this->db->get_where('users', ['id_roles' => $role_id], $limit, $offset)->result_array();
@@ -415,7 +415,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
415415
->group_end()
416416
->limit($limit)
417417
->offset($offset)
418-
->order_by($order_by)
418+
->order_by($this->db->escape($order_by))
419419
->get()
420420
->result_array();
421421

application/models/Providers_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function get(
219219
}
220220

221221
if ($order_by !== null) {
222-
$this->db->order_by($order_by);
222+
$this->db->order_by($this->db->escape($order_by));
223223
}
224224

225225
$providers = $this->db->get_where('users', ['id_roles' => $role_id], $limit, $offset)->result_array();
@@ -701,7 +701,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
701701
->group_end()
702702
->limit($limit)
703703
->offset($offset)
704-
->order_by($order_by)
704+
->order_by($this->db->escape($order_by))
705705
->get()
706706
->result_array();
707707

application/models/Roles_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
283283
->group_end()
284284
->limit($limit)
285285
->offset($offset)
286-
->order_by($order_by)
286+
->order_by($this->db->escape($order_by))
287287
->get()
288288
->result_array();
289289

@@ -315,7 +315,7 @@ public function get(
315315
}
316316

317317
if ($order_by !== null) {
318-
$this->db->order_by($order_by);
318+
$this->db->order_by($this->db->escape($order_by));
319319
}
320320

321321
$roles = $this->db->get('roles', $limit, $offset)->result_array();

application/models/Secretaries_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function get(
217217
}
218218

219219
if ($order_by !== null) {
220-
$this->db->order_by($order_by);
220+
$this->db->order_by($this->db->escape($order_by));
221221
}
222222

223223
$secretaries = $this->db->get_where('users', ['id_roles' => $role_id], $limit, $offset)->result_array();
@@ -538,7 +538,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
538538
->group_end()
539539
->limit($limit)
540540
->offset($offset)
541-
->order_by($order_by)
541+
->order_by($this->db->escape($order_by))
542542
->get()
543543
->result_array();
544544

application/models/Service_categories_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
235235
->group_end()
236236
->limit($limit)
237237
->offset($offset)
238-
->order_by($order_by)
238+
->order_by($this->db->escape($order_by))
239239
->get()
240240
->result_array();
241241

@@ -267,7 +267,7 @@ public function get(
267267
}
268268

269269
if ($order_by !== null) {
270-
$this->db->order_by($order_by);
270+
$this->db->order_by($this->db->escape($order_by));
271271
}
272272

273273
$service_categories = $this->db->get('service_categories', $limit, $offset)->result_array();

application/models/Services_model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function get(
318318
}
319319

320320
if ($order_by !== null) {
321-
$this->db->order_by($order_by);
321+
$this->db->order_by($this->db->escape($order_by));
322322
}
323323

324324
$services = $this->db->get('services', $limit, $offset)->result_array();
@@ -361,7 +361,7 @@ public function search(string $keyword, ?int $limit = null, ?int $offset = null,
361361
->group_end()
362362
->limit($limit)
363363
->offset($offset)
364-
->order_by($order_by)
364+
->order_by($this->db->escape($order_by))
365365
->get()
366366
->result_array();
367367

0 commit comments

Comments
 (0)