summaryrefslogtreecommitdiff
path: root/html
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 08:53:24 +0200
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 08:53:24 +0200
commit8b1a9cca9ca949d431f6ef5cf2b1fba0f27b4209 (patch)
tree9d33cd2775cbe00acd715351cfce9442dcacdc1b /html
parentef9390aa604733f689f6c2c51b4c915744b8fb6c (diff)
downloadclassroom-8b1a9cca9ca949d431f6ef5cf2b1fba0f27b4209.tar.gz
classroom-8b1a9cca9ca949d431f6ef5cf2b1fba0f27b4209.tar.bz2
classroom-8b1a9cca9ca949d431f6ef5cf2b1fba0f27b4209.zip
media serve and validate models (abstruct/skeleton)
Diffstat (limited to 'html')
-rw-r--r--html/app/models/Validate_model.php27
-rw-r--r--html/app/models/cms/Media_model.php0
-rw-r--r--html/app/routes/frontend.php22
3 files changed, 39 insertions, 10 deletions
diff --git a/html/app/models/Validate_model.php b/html/app/models/Validate_model.php
new file mode 100644
index 0000000..ec60d72
--- /dev/null
+++ b/html/app/models/Validate_model.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace app\models;
+
+use \Registry;
+
+
+class Validate
+{
+ /** ticket
+ *
+ * validate that the user owns the `ticket`
+ *
+ */
+ public static function ticket($ticket)
+ {
+ }
+
+ /** access
+ *
+ * validate that the `ticket` is compatible with access_level
+ */
+ public static function access($ticket, $access_level)
+ {
+ }
+
+} \ No newline at end of file
diff --git a/html/app/models/cms/Media_model.php b/html/app/models/cms/Media_model.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/html/app/models/cms/Media_model.php
diff --git a/html/app/routes/frontend.php b/html/app/routes/frontend.php
index 1eea46c..8ba7b4f 100644
--- a/html/app/routes/frontend.php
+++ b/html/app/routes/frontend.php
@@ -19,23 +19,25 @@ Route::notFound( function() {
}); // 404
-// Resolve friendly urls
-// ---
-Route::add('/([0-9a-zA-Z-_]*)',
- function($a) { Resolve::url([$a]); }
+// Resolve urls
+// --- -- -- - - -
+Route::add('/course/([0-9a-zA-Z-_]*)',
+ function($label) { Course::show([$label]); }
);
-Route::add('/([0-9a-zA-Z-_]*)/([0-9a-zA-Z-_]*)',
- function($a, $b) { Resolve::url([$a, $b]); }
+
+Route::add('/lesson/([0-9a-f]*)/([0-9a-zA-Z-_]*)',
+ function($ticket, $lesson) { Lesson::show([$lesson, $ticket]); }
);
-Route::add('/([0-9a-zA-Z-_]*)/([0-9a-zA-Z-_]*)/([0-9a-zA-Z-_]*)',
- function($a, $b, $c) { Resolve::url([$a, $b, $c]); }
+
+Route::add('/media/([0-9a-f]*)/([0-9a-zA-Z-_]*)/([0-9]*)/',
+ function($ticket, $type, $id) { Media::serve([$type, $id, $ticket]); }
);
// 4-th level paths belong to products
// ---
-Route::add('/([0-9a-zA-Z-_]*)/([0-9a-zA-Z-_]*)/([0-9a-zA-Z-_]*)/([0-9a-zA-Z-_]*)',
- function($a, $b, $c, $d) { Product::fromUrl($d, [$a, $b, $c]); }
+Route::add('/about/([0-9a-zA-Z-_]*)/([0-9a-zA-Z-_]*)/([0-9a-zA-Z-_]*)',
+ function($a, $b, $c) { Page::show([$a, $b, $c]); }
);