diff options
Diffstat (limited to 'html/app')
| -rw-r--r-- | html/app/models/Jorge.php | 33 | ||||
| -rw-r--r-- | html/app/models/cms/Media_model.php | 36 | ||||
| -rw-r--r-- | html/app/models/user/Validate_model.php (renamed from html/app/models/Validate_model.php) | 0 | ||||
| -rw-r--r-- | html/app/views/error/404.php | 38 | ||||
| -rw-r--r-- | html/app/views/error/general.php | 38 |
5 files changed, 130 insertions, 15 deletions
diff --git a/html/app/models/Jorge.php b/html/app/models/Jorge.php index 011b8c0..5d79007 100644 --- a/html/app/models/Jorge.php +++ b/html/app/models/Jorge.php @@ -43,21 +43,23 @@ class Jorge // define relations $this->tables['relate'] = [ - 'products' => [ - 'brands' => 'products.BrandID = brands.ID', - 'products_to_product_categories' => 'products.ID = products_to_product_categories.SimpleProductID', - 'products_to_images' => 'products.ID = products_to_images.SimpleProductID', - 'prices' => 'products.SKU = prices.SKU' + 'lesson' => [ + 'course' => 'course.id = lesson.course_id', + 'lesson_media' => 'lesson_media.lesson_id = lesson.id', + 'lesson_privilege' => 'lesson_privilege.lesson_id = lesson.id' ], - 'products_to_product_categories' => [ - 'product_categories' => 'product_categories.ID = products_to_product_categories.ProductCategoryID' + 'page' => [ + 'page_media' => 'page_media.page_id = page.id' ], - 'products_to_images' => [ - 'products' => 'products_to_images.SimpleProductID = products.ID', - 'assets' => 'products_to_images.ImageID = assets.ID' - ] + 'user' => [ + 'user_privilege' => 'user_privilege.user_id = user.id' + ], + + 'privilege' => [ + 'user_privilege' => 'user_privilege.privilege_id = privilege.id' + ], ]; @@ -113,7 +115,7 @@ class Jorge private function extractTableFields() { // words used by SQL that can not be field names - $nonFields = ['PRIMARY', 'KEY', '(', ')']; // reduced list (used on CREATE) + $nonFields = ['PRIMARY', 'KEY', '(', ')', 'CONSTRAINT', 'UNIQUE']; // reduced list (used on CREATE) foreach( $this->tables['create'] as $table => $sqlCreate ) { @@ -130,10 +132,11 @@ class Jorge // remove 1st+last parentesis $mainDefinitions = substr($match[0][0], 1, -1); - // replace comma (,) on decimal definitions - // example: 'decimal(18, 2)' turns to 'decimal(18: 2)' + // replace comma (,) on sub-parenthesis + // ex: 'decimal(18, 2)' turns to 'decimal(18: 2)' + // or: 'PRIMARY KEY (id1, id2)' turns to 'PRIMARY KEY (id1: id2)' $sentences = preg_replace( - '/\\(([0-9]*)[ ,]([0-9 ]*)\\)/', + '/\\(([0-9a-zA-Z_`]*)[ ,]([0-9a-zA-Z_` ]*)\\)/', '($1:$2)', $mainDefinitions, -1 diff --git a/html/app/models/cms/Media_model.php b/html/app/models/cms/Media_model.php index e69de29..6a4a681 100644 --- a/html/app/models/cms/Media_model.php +++ b/html/app/models/cms/Media_model.php @@ -0,0 +1,36 @@ +<?php + +namespace app\models\cms; + +use \Registry; + + +class Media_model +{ + public static function serve($type, $id, $ticket) + { + + // get media data + // [ type =>, rights =>, path => ] + + // validate ticket + // ValidateAccess::for($ticket) + + // serve + // header("Content-type: type"); + // passthru('cat $media_path'); + + + return Registry::use('database')->query( + "SELECT * FROM pages + WHERE FullFriendlyUrl = :url AND IsActive = 1", + [ ':url' => $url ] + )->getFirst(); + } + +} + + + +// check: +// https://stackoverflow.com/questions/1353850/serve-image-with-php-script-vs-direct-loading-an-image
\ No newline at end of file diff --git a/html/app/models/Validate_model.php b/html/app/models/user/Validate_model.php index ec60d72..ec60d72 100644 --- a/html/app/models/Validate_model.php +++ b/html/app/models/user/Validate_model.php diff --git a/html/app/views/error/404.php b/html/app/views/error/404.php new file mode 100644 index 0000000..a7ea624 --- /dev/null +++ b/html/app/views/error/404.php @@ -0,0 +1,38 @@ +<html> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title>404: Not Found</title> + <style> + html,body{ padding:0; margin:0; + font-size:1.25em; color: #037 /*#a05*/; font-family: 'Roboto Slab', Consolas, Monaco, "Ubuntu Mono", fixed; + line-height:1.2em; background: ##f3f4f5; + } + h3 { font-size: 5.2em; font-style: normal; color: #05a /*#a05*/; + margin: 0; padding: 0; + opacity: 0.27; + } + .container { display: flex; height: 100vh; align-items:center; } + .content { position: relative; + max-width:520px; width: 100%; margin: auto auto; padding: 1.5em; + /* text-align: center; justify-center: center; */ + font-size: .75em; opacity: .33; font-style: italic; + } + @media screen and ( max-width: 720px) { + html, body { font-size: 1.24em; } + h3 { font-size: 4em; } + } + </style> + </head> + <body> + <div class='container'> + <div class='content'> + <h3>4O4</h3> + NOT FOUND<br /> + — + <br /> + <span><?= $message ?? "and I still haven't found what I'm looking for." ?></span> + </div> + </div> + </body> +</html> diff --git a/html/app/views/error/general.php b/html/app/views/error/general.php new file mode 100644 index 0000000..1c3c6ae --- /dev/null +++ b/html/app/views/error/general.php @@ -0,0 +1,38 @@ +<html> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title>404: Not Found</title> + <style> + html,body{ padding:0; margin:0; + font-size:1.25em; color: #037 /*#a05*/; font-family: 'Roboto Slab', Consolas, Monaco, "Ubuntu Mono", fixed; + line-height:1.2em; background: ##f3f4f5; + } + h3 { font-size: 5.2em; font-style: normal; color: #05a /*#a05*/; + margin: 0; padding: 0; + opacity: 0.27; + } + .container { display: flex; height: 100vh; align-items:center; } + .content { position: relative; + max-width:720px; width: 100%; margin: auto auto; padding: 1.5em; + /* text-align: center; justify-center: center; */ + font-size: .75em; opacity: .33; font-style: italic; + } + @media screen and ( max-width: 720px) { + html, body { font-size: 1.24em; } + h3 { font-size: 4em; } + } + </style> + </head> + <body> + <div class='container'> + <div class='content'> + <h3>Error</h3> + Oops!<br /> + — + <br /> + <span><?= $message ?? "" ?></span> + </div> + </div> + </body> +</html> |
