diff --git a/app/controllers/category.php b/app/controllers/category.php
index 7d53944..64fdea1 100755
--- a/app/controllers/category.php
+++ b/app/controllers/category.php
@@ -38,11 +38,6 @@ class category extends \miniMVC\Controller {
$id = (int) miniMVC\get_last_segment();
}
- if ($id === 0)
- {
- miniMVC\show_404();
- }
-
$data = array(
'category' => $this->data_model->get_category_by_id($id),
'sections' => $this->data_model->get_category_outline_data($id),
@@ -50,6 +45,12 @@ class category extends \miniMVC\Controller {
'category_id' => $id
);
+ if (empty($data['category']))
+ {
+ $this->page->render_message('error', "Category doesn't exist.");
+ return;
+ }
+
$this->render('category_detail', $data);
}
diff --git a/app/controllers/genre.php b/app/controllers/genre.php
index 7d0bc1a..38caa82 100755
--- a/app/controllers/genre.php
+++ b/app/controllers/genre.php
@@ -78,6 +78,14 @@ class genre extends \miniMVC\Controller {
$genre = $this->data_model->get_genre_by_id($id);
$categories = $this->data_model->get_categories($id);
+ if (empty($genre))
+ {
+
+ $this->page->render_message('error', "Genre doesn't exist.");
+ return;
+ return;
+ }
+
$data = array(
'genre' => $genre,
'categories' => $categories,
diff --git a/app/controllers/section.php b/app/controllers/section.php
index e6537ee..1b6d1c1 100755
--- a/app/controllers/section.php
+++ b/app/controllers/section.php
@@ -38,11 +38,6 @@ class section extends \miniMVC\Controller {
$id = (int) miniMVC\get_last_segment();
}
- if ($id === 0)
- {
- miniMVC\show_404();
- }
-
$data = array(
'section' => $this->data_model->get_section_by_id($id),
'sdata' => $this->data_model->get_data($id),
@@ -50,6 +45,12 @@ class section extends \miniMVC\Controller {
'section_id' => $id
);
+ if (empty($data['section']))
+ {
+ $this->page->render_message('error', "Section doesn't exist.");
+ return;
+ }
+
$this->render('section_detail', $data);
}
diff --git a/app/views/category_detail.php b/app/views/category_detail.php
index 3e6a40e..f3f8118 100755
--- a/app/views/category_detail.php
+++ b/app/views/category_detail.php
@@ -23,8 +23,8 @@
-
-
+
+
diff --git a/app/views/genre_detail.php b/app/views/genre_detail.php
index aa08922..5f1eff8 100755
--- a/app/views/genre_detail.php
+++ b/app/views/genre_detail.php
@@ -21,8 +21,8 @@
">= $cat ?>
-
-
+
+
diff --git a/app/views/genres.php b/app/views/genres.php
index 7bcb194..c0a93ce 100755
--- a/app/views/genres.php
+++ b/app/views/genres.php
@@ -22,8 +22,8 @@
= $name ?>
-
-
+
+
diff --git a/app/views/section_detail.php b/app/views/section_detail.php
index 197a6d8..727113e 100755
--- a/app/views/section_detail.php
+++ b/app/views/section_detail.php
@@ -13,7 +13,7 @@
-
+
@@ -30,8 +30,8 @@
= $k ?>
-
-
+
+
= $v ?>
diff --git a/app/views/theme_footer.php b/app/views/theme_footer.php
index 2ba76a2..783a3b5 100755
--- a/app/views/theme_footer.php
+++ b/app/views/theme_footer.php
@@ -1,7 +1,7 @@
-Queries:
+Queries:
= $q['sql'] ?>
-
\ No newline at end of file
+ */ ?>
\ No newline at end of file
diff --git a/assets/css/theme.css b/assets/css/theme.css
index c77bf2c..7a9f8cf 100755
--- a/assets/css/theme.css
+++ b/assets/css/theme.css
@@ -120,6 +120,10 @@ li li, li dt {
z-index:3;
}
+form dd input {
+ width:90%;
+}
+
li:hover > .modify, dt:hover > .modify, dd:hover > .modify {
display:inline-block;
vertical-align:top;
diff --git a/assets/js/meta.js b/assets/js/meta.js
index 2aeef71..617186f 100755
--- a/assets/js/meta.js
+++ b/assets/js/meta.js
@@ -51,7 +51,7 @@ $_.ext('center', function (sel){
var meta = {};
w.meta = meta;
-
+
/**
* Create the WYSIWYG editor box
*/
@@ -221,10 +221,10 @@ $_.ext('center', function (sel){
// Edit form submission
$_.event.live('#edit_form', 'submit', meta.update_item);
-
+
// WYSIWYG on section/data pages
- if (document.getElementById('textarea') != null)
+ if (document.getElementsByTagName('textarea') != null)
{
- meta.initTINY('textarea');
+ meta.initTINY('val');
}
}(window, $_));
\ No newline at end of file
diff --git a/index.php b/index.php
index fc1f9ba..0ca900d 100755
--- a/index.php
+++ b/index.php
@@ -37,6 +37,12 @@ define('MM_APP_PATH', __DIR__.'/app/');
// Autoload vendors
require(MM_BASE_PATH . '/vendor/autoload.php');
+// Setup error handling
+$whoops = new \Whoops\Run();
+$defaultHandler = new PrettyPageHandler();
+$whoops->pushHandler($defaultHandler);
+$whoops->register();
+
// Require the basic configuration file
require(MM_APP_PATH . 'config/config.php');
@@ -46,11 +52,6 @@ require(MM_SYS_PATH . 'common.php');
// Start the autoloader
spl_autoload_register('miniMVC\autoload');
-// Setup error handling
-$whoops = new \Whoops\Run();
-$defaultHandler = new PrettyPageHandler();
-$whoops->pushHandler($defaultHandler);
-
// And away we go!
init();
diff --git a/sys/common.php b/sys/common.php
index 2c58caa..631ae66 100755
--- a/sys/common.php
+++ b/sys/common.php
@@ -300,7 +300,8 @@ function route()
// 404 Condition
if (empty($route))
{
- show_404();
+ throw new \Exception("404: Page not found.");
+ //show_404();
return;
}
diff --git a/sys/core/Page.php b/sys/core/Page.php
index 8bea26d..b31d805 100755
--- a/sys/core/Page.php
+++ b/sys/core/Page.php
@@ -543,6 +543,23 @@ class Page {
// --------------------------------------------------------------------------
+ /**
+ * Render Message
+ *
+ * Render a full page message
+ * @param string $type
+ * @param string $message
+ */
+ public function render_message($type, $message)
+ {
+ $this->render('message', [
+ 'stat_class' => $type,
+ 'message' => $message
+ ]);
+ }
+
+ // --------------------------------------------------------------------------
+
/**
* Output String
*