Skip to content

Commit 8364550

Browse files
committed
Don't escape courses or instructors anymore
We use prepared statements now, they'll get escaped for us.
1 parent c025260 commit 8364550

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

tools/Parser.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,9 @@ function fileToTempTable(string $tableName, $file, $fields, $fileSize, string $p
253253

254254
// Process the class file
255255
function procClassArray(array $lineSplit): array {
256-
// Escape class title, description, and course number (since it needs to be trimmed)
257-
$lineSplit[6] = $this->dbConn->real_escape_string(trim($lineSplit[6]));
258-
$lineSplit[7] = $this->dbConn->real_escape_string($lineSplit[7]);
259-
$lineSplit[8] = $this->dbConn->real_escape_string(trim($lineSplit[8]));
260-
$lineSplit[23] = $this->dbConn->real_escape_string($lineSplit[23]);
256+
// Trim course number and topic
257+
$lineSplit[6] = trim($lineSplit[6]);
258+
$lineSplit[8] = trim($lineSplit[8]);
261259

262260
// Grab the integer credit count (they give it to us as a decimal)
263261
preg_match('/(\d)+\.\d\d/', $lineSplit[11], $match);
@@ -287,10 +285,6 @@ function procMeetArray(array $lineSplit) {
287285
}
288286

289287
function procInstrArray(array $lineSplit): array {
290-
// Escape the instructor names
291-
$lineSplit[6] = mysqli_real_escape_string($this->dbConn, $lineSplit[6]);
292-
$lineSplit[7] = mysqli_real_escape_string($this->dbConn, $lineSplit[7]);
293-
294288
// Section number needs to be padded to at lease 2 digits
295289
$lineSplit[4] = str_pad($lineSplit[4], 2, '0', STR_PAD_LEFT);
296290
return $lineSplit;

0 commit comments

Comments
 (0)