summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/inc/coursebackend.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/locationinfo/inc/coursebackend.inc.php')
-rw-r--r--modules-available/locationinfo/inc/coursebackend.inc.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend.inc.php b/modules-available/locationinfo/inc/coursebackend.inc.php
index a66d35a3..fc03671c 100644
--- a/modules-available/locationinfo/inc/coursebackend.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend.inc.php
@@ -149,13 +149,25 @@ abstract class CourseBackend
*/
protected abstract function fetchSchedulesInternal($roomId);
+ /**
+ * In case you want to sanitize or otherwise mangle a property for your backend,
+ * override this.
+ * @param string $prop
+ * @param $value
+ * @return mixed
+ */
+ public function mangleProperty($prop, $value)
+ {
+ return $value;
+ }
+
private static function fixTime(&$start, &$end)
{
- if (!preg_match('/^\d+-\d+-\d+T\d+:\d+:\d+$/', $start) || !preg_match('/^\d+-\d+-\d+T\d+:\d+:\d+$/', $end))
+ if (!preg_match('/^(\d{2}|\d{4})-?\d{2}-?\d{2}-?T\d{1,2}:?\d{2}:?(\d{2})?$/', $start))
return false;
$start = strtotime($start);
$end = strtotime($end);
- if ($start >= $end)
+ if ($start === false || $end === false || $start >= $end)
return false;
$start = date('Y-m-d\TH:i:s', $start);
$end = date('Y-m-d\TH:i:s', $end);