summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/controllers/albums.php11
-rw-r--r--core/controllers/maintenance.php10
-rw-r--r--core/libraries/Theme_View.php10
-rw-r--r--core/views/maintenance.html.php49
4 files changed, 60 insertions, 20 deletions
diff --git a/core/controllers/albums.php b/core/controllers/albums.php
index 9811ba13..bcfdd8c2 100644
--- a/core/controllers/albums.php
+++ b/core/controllers/albums.php
@@ -23,13 +23,12 @@ class Albums_Controller extends Items_Controller {
* @see REST_Controller::_show($resource)
*/
public function _show($album) {
- try {
- access::required("view", $album);
- } catch (Exception $e) {
+ if (!access::can("view", $album)) {
if ($album->id != 1) {
- throw $e;
+ access::forbidden();
} else {
- url::redirect("login/page");
+ print new Theme_View("login_page.html");
+ return;
}
}
@@ -163,7 +162,7 @@ class Albums_Controller extends Items_Controller {
$album->description = $form->edit_album->description->value;
$album->sort_column = $form->edit_album->sort_order->column->value;
$album->sort_order = $form->edit_album->sort_order->direction->value;
-
+
$album->save();
module::event("item_updated", $orig, $album);
diff --git a/core/controllers/maintenance.php b/core/controllers/maintenance.php
index 908e90b5..32295a45 100644
--- a/core/controllers/maintenance.php
+++ b/core/controllers/maintenance.php
@@ -19,12 +19,6 @@
*/
class Maintenance_Controller extends Controller {
function index() {
- $album = ORM::factory("item", 1);
- $v = new Theme_View("maintenance.html", "reset");
- $v->title = t("%title Unavailable", array("title" => $album->title));
- $v->content = t("%title is currently unavailable as it is undergoing maintenance",
- array("title" => $album->title));
-
- print $v;
- }
+ print new View("maintenance.html");
+ }
} \ No newline at end of file
diff --git a/core/libraries/Theme_View.php b/core/libraries/Theme_View.php
index ecae3946..797679fd 100644
--- a/core/libraries/Theme_View.php
+++ b/core/libraries/Theme_View.php
@@ -36,15 +36,13 @@ class Theme_View_Core extends View {
if (user::active()->admin) {
$this->theme_name = Input::instance()->get("theme", $this->theme_name);
}
- $this->set_global('theme', $this);
- $this->set_global('user', user::active());
+ $this->set_global("theme", $this);
+ $this->set_global("user", user::active());
$this->set_global("page_type", $page_type);
$maintenance_mode = Kohana::config("core.maintenance_mode", false, false);
- if (!empty($maintenance_mode)) {
- $album = ORM::factory("item", 1);
- message::warning(t("%title is currently unavailable as it is undergoing maintenance",
- array("title" => $album->title)));
+ if ($maintenance_mode) {
+ message::warning(t("This site is currently in maintenance mode"));
}
}
diff --git a/core/views/maintenance.html.php b/core/views/maintenance.html.php
new file mode 100644
index 00000000..d970233d
--- /dev/null
+++ b/core/views/maintenance.html.php
@@ -0,0 +1,49 @@
+<html>
+ <head>
+ <title>
+ <?= t("Gallery - Maintenance Mode") ?>
+ </title>
+ <style>
+ body {
+ background: #ccc;
+ }
+ form {
+ border: 1px solid #555;
+ background: #999;
+ width: 300px;
+ }
+ fieldset {
+ border: none;
+ }
+ fieldset legend {
+ font-size: 24px;
+ display: none !important;
+ padding-left: 0px;
+ }
+ ul {
+ list-style-type: none;
+ margin-top: 0px;
+ padding-left: 0px;
+ bullet-style: none;
+ }
+ ul li {
+ margin-left: 0px;
+ }
+ label {
+ width: 60px;
+ display: block;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>
+ <?= t("Gallery - Maintenance Mode") ?>
+ </h1>
+ <p>
+ <?= t("This site is currently only accessible by site administrators.") ?>
+ </p>
+ <?= user::get_login_form("login/auth_html") ?>
+ </body>
+</html>
+
+