summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/admin_theme_options.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-10 21:23:57 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-10 21:23:57 -0700
commit68fd196d66e2d21f571ff3b5a673f18cd129abf9 (patch)
tree754bf32ba32591e043b67ec08e1fa96a9ced9214 /modules/gallery/controllers/admin_theme_options.php
parentcf9e3db32e7c7f52e92fabc1afca63fdbf741b21 (diff)
Rename theme_details to theme_options everywhere.
Fixes ticket #317
Diffstat (limited to 'modules/gallery/controllers/admin_theme_options.php')
-rw-r--r--modules/gallery/controllers/admin_theme_options.php69
1 files changed, 69 insertions, 0 deletions
diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php
new file mode 100644
index 00000000..2716ed93
--- /dev/null
+++ b/modules/gallery/controllers/admin_theme_options.php
@@ -0,0 +1,69 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Admin_Theme_Options_Controller extends Admin_Controller {
+ public function index() {
+ $view = new Admin_View("admin.html");
+ $view->content = new View("admin_theme_options.html");
+ $view->content->form = theme::get_edit_form_admin();
+ print $view;
+ }
+
+ public function save() {
+ access::verify_csrf();
+
+ $form = theme::get_edit_form_admin();
+ if ($form->validate()) {
+ module::set_var("gallery", "page_size", $form->edit_theme->page_size->value);
+
+ $thumb_size = $form->edit_theme->thumb_size->value;
+ $thumb_dirty = false;
+ if (module::get_var("gallery", "thumb_size") != $thumb_size) {
+ graphics::remove_rule("gallery", "thumb", "resize");
+ graphics::add_rule(
+ "gallery", "thumb", "resize",
+ array("width" => $thumb_size, "height" => $thumb_size, "master" => Image::AUTO),
+ 100);
+ module::set_var("gallery", "thumb_size", $thumb_size);
+ }
+
+ $resize_size = $form->edit_theme->resize_size->value;
+ $resize_dirty = false;
+ if (module::get_var("gallery", "resize_size") != $resize_size) {
+ graphics::remove_rule("gallery", "resize", "resize");
+ graphics::add_rule(
+ "gallery", "resize", "resize",
+ array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO),
+ 100);
+ module::set_var("gallery", "resize_size", $resize_size);
+ }
+
+ module::set_var("gallery", "header_text", $form->edit_theme->header_text->value);
+ module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value);
+
+ message::success(t("Updated theme details"));
+ url::redirect("admin/theme_options");
+ } else {
+ $view = new Admin_View("admin.html");
+ $view->content = $form;
+ print $view;
+ }
+ }
+}
+