Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit bd528a0

Browse files
Merge pull request #4 from BaranekD/apostrophes_bug
DB commands work with apostrophes in names
2 parents e4e7609 + 9537890 commit bd528a0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
5+
[Changed]
6+
- DB commands work for apostrophe in IdP/SP names
57

68
## [v1.3.0]
79
[Added]

lib/Auth/Process/DatabaseCommand.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function getLoginCountPerDeyPerService()
8484
$stmt->execute();
8585
$result = $stmt->get_result();
8686
while($row = $result->fetch_assoc()) {
87-
echo "[new Date(".$row["year"].",".($row["month"] - 1 )."),'".$row["idPName"]."', {v:".$row["count"]."}],";
87+
echo "[new Date(".$row["year"].",".($row["month"] - 1 )."),'".str_replace("'","\'",$row["idPName"])."', {v:".$row["count"]."}],";
8888
}
8989
$conn->close();
9090
}
@@ -100,7 +100,8 @@ public static function getAccessToServicesPerMonth()
100100
$stmt->execute();
101101
$result = $stmt->get_result();
102102
while($row = $result->fetch_assoc()) {
103-
echo "[new Date(".$row["year"].",".($row["month"] - 1 )."),'".$row["spName"]."', {v:".$row["count"]."}],"; }
103+
echo "[new Date(".$row["year"].",".($row["month"] - 1 )."),'".str_replace("'","\'",$row["spName"])."', {v:".$row["count"]."}],";
104+
}
104105
$conn->close();
105106
}
106107

@@ -158,7 +159,7 @@ public static function getAccessCountPerService()
158159
$stmt->execute();
159160
$result = $stmt->get_result();
160161
while($row = $result->fetch_assoc()) {
161-
echo "['".$row["spName"]."', ".$row["count"]."],";
162+
echo "['" . str_replace("'", "\'", $row["spName"]) . "', " . $row["count"] . "],";
162163
}
163164
$conn->close();
164165
}
@@ -174,7 +175,7 @@ public static function getLoginCountPerIdp()
174175
$stmt->execute();
175176
$result = $stmt->get_result();
176177
while($row = $result->fetch_assoc()) {
177-
echo "['".$row["idPName"]."', ".$row["count"]."],";
178+
echo "['" . str_replace("'", "\'", $row["idPName"]) . "', " . $row["count"] . "],";
178179
}
179180
$conn->close();
180181
}

0 commit comments

Comments
 (0)