diff options
Diffstat (limited to 'modules/gallery/controllers')
18 files changed, 207 insertions, 200 deletions
diff --git a/modules/gallery/controllers/admin_advanced_settings.php b/modules/gallery/controllers/admin_advanced_settings.php index 64007fdb..79bc1183 100644 --- a/modules/gallery/controllers/admin_advanced_settings.php +++ b/modules/gallery/controllers/admin_advanced_settings.php @@ -46,7 +46,7 @@ class Admin_Advanced_Settings_Controller extends Admin_Controller { module::set_var($module_name, $var_name, Input::instance()->post("value")); message::success( t("Saved value for %var (%module_name)", - array("var" => p::clean($var_name), "module_name" => $module_name))); + array("var" => $var_name, "module_name" => $module_name))); print json_encode(array("result" => "success")); } diff --git a/modules/gallery/controllers/admin_graphics.php b/modules/gallery/controllers/admin_graphics.php index 72f8d8e1..c59dd38e 100644 --- a/modules/gallery/controllers/admin_graphics.php +++ b/modules/gallery/controllers/admin_graphics.php @@ -21,41 +21,24 @@ class Admin_Graphics_Controller extends Admin_Controller { public function index() { $view = new Admin_View("admin.html"); $view->content = new View("admin_graphics.html"); - $view->content->available = ""; - - $tk = new ArrayObject(graphics::detect_toolkits(), ArrayObject::ARRAY_AS_PROPS); - $active = module::get_var("gallery", "graphics_toolkit", "none"); - foreach (array("gd", "imagemagick", "graphicsmagick", "none") as $id) { - if ($id == $active) { - $view->content->active = new View("admin_graphics_$id.html"); - $view->content->active->tk = $tk; - $view->content->active->is_active = true; - } else if ($id != "none") { - $v = new View("admin_graphics_$id.html"); - $v->tk = $tk; - $v->is_active = false; - $view->content->available .= $v; - } - } - + $view->content->tk = graphics::detect_toolkits(); + $view->content->active = module::get_var("gallery", "graphics_toolkit", "none"); print $view; } - public function choose($toolkit) { + public function choose($toolkit_id) { access::verify_csrf(); - if ($toolkit != module::get_var("gallery", "graphics_toolkit")) { - module::set_var("gallery", "graphics_toolkit", $toolkit); - - $toolkit_info = graphics::detect_toolkits(); - if ($toolkit == "graphicsmagick" || $toolkit == "imagemagick") { - module::set_var("gallery", "graphics_toolkit_path", $toolkit_info[$toolkit]); - } + if ($toolkit_id != module::get_var("gallery", "graphics_toolkit")) { + $tk = graphics::detect_toolkits(); + module::set_var("gallery", "graphics_toolkit", $toolkit_id); + module::set_var("gallery", "graphics_toolkit_path", $tk->$toolkit_id->dir); site_status::clear("missing_graphics_toolkit"); - message::success(t("Updated Graphics Toolkit")); - log::success("graphics", t("Changed graphics toolkit to: %toolkit", - array("toolkit" => $toolkit))); + + $msg = t("Changed graphics toolkit to: %toolkit", array("toolkit" => $tk->$toolkit_id->name)); + message::success($msg); + log::success("graphics", $msg); } url::redirect("admin/graphics"); diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index d1b805da..d91e5205 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -21,7 +21,10 @@ class Admin_Languages_Controller extends Admin_Controller { public function index($share_translations_form=null) { $v = new Admin_View("admin.html"); $v->content = new View("admin_languages.html"); - $v->content->settings_form = $this->_languages_form(); + $v->content->available_locales = locales::available(); + $v->content->installed_locales = locales::installed(); + $v->content->default_locale = module::get_var("gallery", "default_locale"); + if (empty($share_translations_form)) { $share_translations_form = $this->_share_translations_form(); } @@ -32,14 +35,21 @@ class Admin_Languages_Controller extends Admin_Controller { public function save() { access::verify_csrf(); - - $form = $this->_languages_form(); - if ($form->validate()) { - module::set_var("gallery", "default_locale", $form->choose_language->locale->value); - locale::update_installed($form->choose_language->installed_locales->value); - message::success(t("Settings saved")); - } - url::redirect("admin/languages"); + + locales::update_installed($this->input->post("installed_locales")); + + $installed_locales = array_keys(locales::installed()); + $new_default_locale = $this->input->post("default_locale"); + if (!in_array($new_default_locale, $installed_locales)) { + if (!empty($installed_locales)) { + $new_default_locale = $installed_locales[0]; + } else { + $new_default_locale = "en_US"; + } + } + module::set_var("gallery", "default_locale", $new_default_locale); + + print json_encode(array("result" => "success")); } public function share() { @@ -51,7 +61,7 @@ class Admin_Languages_Controller extends Admin_Controller { return $this->index($form); } - if ($form->sharing->share) { + if ($this->input->post("share")) { l10n_client::submit_translations(); message::success(t("Translations submitted")); } else { @@ -88,30 +98,6 @@ class Admin_Languages_Controller extends Admin_Controller { } } - private function _languages_form() { - $all_locales = locale::available(); - $installed_locales = locale::installed(); - $form = new Forge("admin/languages/save", "", "post", array("id" => "gLanguageSettingsForm")); - $group = $form->group("choose_language") - ->label(t("Language settings")); - $group->dropdown("locale") - ->options($installed_locales) - ->selected(module::get_var("gallery", "default_locale")) - ->label(t("Default language")) - ->rules('required'); - - $installation_options = array(); - foreach ($all_locales as $code => $display_name) { - $installation_options[$code] = array($display_name, isset($installed_locales->$code)); - } - $group->checklist("installed_locales") - ->label(t("Installed Languages")) - ->options($installation_options) - ->rules("required"); - $group->submit("save")->value(t("Save settings")); - return $form; - } - private function _outgoing_translations_count() { return ORM::factory("outgoing_translation")->count_all(); } @@ -125,7 +111,7 @@ class Admin_Languages_Controller extends Admin_Controller { $group->input("api_key") ->label(empty($api_key) ? t("This is a unique key that will allow you to send translations to the remote server. To get your API key go to %server-link.", - array("server-link" => html::anchor($server_link))) + array("server-link" => html::mark_clean(html::anchor($server_link)))) : t("API Key")) ->value($api_key) ->error_messages("invalid", t("The API key you provided is invalid.")); diff --git a/modules/gallery/controllers/admin_maintenance.php b/modules/gallery/controllers/admin_maintenance.php index 543961a1..66bcce55 100644 --- a/modules/gallery/controllers/admin_maintenance.php +++ b/modules/gallery/controllers/admin_maintenance.php @@ -34,7 +34,7 @@ class Admin_Maintenance_Controller extends Admin_Controller { "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', - array("url" => url::site("admin/maintenance")))); + array("url" => html::mark_clean(url::site("admin/maintenance"))))); } $view = new Admin_View("admin.html"); diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php index da001c55..24f91aba 100644 --- a/modules/gallery/controllers/admin_themes.php +++ b/modules/gallery/controllers/admin_themes.php @@ -38,7 +38,7 @@ class Admin_Themes_Controller extends Admin_Controller { $theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); $theme_info->description = t($theme_info->description); $theme_info->name = t($theme_info->name); - + $themes[$theme_name] = $theme_info; } return $themes; @@ -54,7 +54,7 @@ class Admin_Themes_Controller extends Admin_Controller { if ($type == "admin") { $view->url = url::site("admin?theme=$theme_name"); } else { - $view->url = url::site("albums/1?theme=$theme_name"); + $view->url = item::root()->url("theme=$theme_name"); } print $view; } diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index d141d157..08a60132 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -40,11 +40,13 @@ class Albums_Controller extends Items_Controller { if ($show) { $index = $album->get_position($show); - $page = ceil($index / $page_size); - if ($page == 1) { - url::redirect("albums/$album->id"); - } else { - url::redirect("albums/$album->id?page=$page"); + if ($index) { + $page = ceil($index / $page_size); + if ($page == 1) { + url::redirect($album->abs_url()); + } else { + url::redirect($album->abs_url("page=$page")); + } } } @@ -55,9 +57,9 @@ class Albums_Controller extends Items_Controller { // Make sure that the page references a valid offset if ($page < 1) { - url::redirect("albums/$album->id"); + url::redirect($album->abs_url()); } else if ($page > $max_pages) { - url::redirect("albums/$album->id?page=$max_pages"); + url::redirect($album->abs_url("page=$max_pages")); } $template = new Theme_View("page.html", "album"); @@ -107,22 +109,23 @@ class Albums_Controller extends Items_Controller { $this->input->post("name"), $this->input->post("title", $this->input->post("name")), $this->input->post("description"), - user::active()->id); + user::active()->id, + $this->input->post("slug")); log::success("content", "Created an album", - html::anchor("albums/$new_album->id", "view album")); - message::success( - t("Created album %album_title", array("album_title" => p::clean($new_album->title)))); + html::anchor("albums/$new_album->id", "view album")); + message::success(t("Created album %album_title", + array("album_title" => html::purify($new_album->title)))); print json_encode( array("result" => "success", - "location" => url::site("albums/$new_album->id"), - "resource" => url::site("albums/$new_album->id"))); + "location" => $new_album->url(), + "resource" => $new_album->url())); } else { print json_encode( array( "result" => "error", - "form" => $form->__toString() . html::script("modules/gallery/js/albums_form_add.js"))); + "form" => $form->__toString())); } } @@ -144,13 +147,13 @@ class Albums_Controller extends Items_Controller { user::active()->id); log::success("content", "Added a photo", html::anchor("photos/$photo->id", "view photo")); - message::success( - t("Added photo %photo_title", array("photo_title" => p::clean($photo->title)))); + message::success(t("Added photo %photo_title", + array("photo_title" => html::purify($photo->title)))); print json_encode( array("result" => "success", - "resource" => url::site("photos/$photo->id"), - "location" => url::site("photos/$photo->id"))); + "resource" => $photo->url(), + "location" => $photo->url())); } else { print json_encode( array("result" => "error", @@ -168,43 +171,50 @@ class Albums_Controller extends Items_Controller { $form = album::get_edit_form($album); if ($valid = $form->validate()) { - // Make sure that there's not a conflict if ($album->id != 1 && - Database::instance() - ->from("items") - ->where("parent_id", $album->parent_id) - ->where("id <>", $album->id) - ->where("name", $form->edit_album->dirname->value) - ->count_records()) { - $form->edit_album->dirname->add_error("conflict", 1); - $valid = false; + $form->edit_item->dirname->value != $album->name || + $form->edit_item->slug->value != $album->slug) { + // Make sure that there's not a conflict + if ($row = Database::instance() + ->select(array("name", "slug")) + ->from("items") + ->where("parent_id", $album->parent_id) + ->where("id <>", $album->id) + ->open_paren() + ->where("name", $form->edit_item->dirname->value) + ->orwhere("slug", $form->edit_item->slug->value) + ->close_paren() + ->get() + ->current()) { + if ($row->name == $form->edit_item->dirname->value) { + $form->edit_item->dirname->add_error("name_conflict", 1); + } + if ($row->slug == $form->edit_item->slug->value) { + $form->edit_item->slug->add_error("slug_conflict", 1); + } + $valid = false; + } } } - // @todo - // @todo we need to make sure that filename / dirname components can't contain a / - // @todo - if ($valid) { - $orig = clone $album; - $album->title = $form->edit_album->title->value; - $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->title = $form->edit_item->title->value; + $album->description = $form->edit_item->description->value; + $album->sort_column = $form->edit_item->sort_order->column->value; + $album->sort_order = $form->edit_item->sort_order->direction->value; if ($album->id != 1) { - $album->rename($form->edit_album->dirname->value); + $album->rename($form->edit_item->dirname->value); } + $album->slug = $form->edit_item->slug->value; $album->save(); - - module::event("item_updated", $orig, $album); + module::event("item_edit_form_completed", $album, $form); log::success("content", "Updated album", "<a href=\"albums/$album->id\">view</a>"); - message::success( - t("Saved album %album_title", array("album_title" => p::clean($album->title)))); + message::success(t("Saved album %album_title", + array("album_title" => html::purify($album->title)))); print json_encode( - array("result" => "success", - "location" => url::site("albums/$album->id"))); + array("result" => "success")); } else { print json_encode( array("result" => "error", @@ -222,8 +232,7 @@ class Albums_Controller extends Items_Controller { switch ($this->input->get("type")) { case "album": - print album::get_add_form($album) . - html::script("modules/gallery/js/albums_form_add.js"); + print album::get_add_form($album); break; case "photo": diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php index 925d052d..c1f42bfe 100644 --- a/modules/gallery/controllers/combined.php +++ b/modules/gallery/controllers/combined.php @@ -42,32 +42,34 @@ class Combined_Controller extends Controller { private function _emit($type, $key) { $input = Input::instance(); + // We don't need to save the session for this request + Session::abort_save(); + // Our data is immutable, so if they already have a copy then it needs no updating. if ($input->server("HTTP_IF_MODIFIED_SINCE")) { header('HTTP/1.0 304 Not Modified'); header("Expires: Tue, 19 Jan 2038 00:00:00 GMT"); header("Cache-Control: max-age=2678400"); header('Pragma: public'); - return; + Kohana::close_buffers(false); + return ""; } if (empty($key)) { Kohana::show_404(); } - // We don't need to save the session for this request - Session::abort_save(); - $cache = Cache::instance(); $use_gzip = function_exists("gzencode") && - (strpos($input->server("HTTP_ACCEPT_ENCODING"), "gzip") !== false); + stripos($input->server("HTTP_ACCEPT_ENCODING"), "gzip") !== false && + (int) ini_get("zlib.output_compression") === 0; + if ($use_gzip && $content = $cache->get("{$key}_gz")) { header("Content-Encoding: gzip"); } else { // Fall back to non-gzipped if we have to $content = $cache->get($key); } - if (empty($content)) { Kohana::show_404(); } diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index c5b34033..8cb90c50 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -63,21 +63,20 @@ class File_Proxy_Controller extends Controller { // We now have the relative path to the item. Search for it in the path cache $item = ORM::factory("item")->where("relative_path_cache", $path)->find(); if (!$item->loaded) { - // We didn't turn it up. This may mean that the path cache is out of date, so look it up - // the hard way. - // - // Find all items that match the level and name, then iterate over those to find a match. - // In most cases we'll get it in one. Note that for the level calculation, we just count the - // size of $paths. - $paths = explode("/", $path); - $count = count($paths); - foreach (ORM::factory("item") - ->where("name", $paths[$count - 1]) - ->where("level", $count + 1) - ->find_all() as $match) { - if ($match->relative_path() == $path) { - $item = $match; - break; + // We didn't turn it up. It's possible that the relative_path_cache is out of date here. + // There was fallback code, but bharat deleted it in 8f1bca74. If it turns out to be + // necessary, it's easily resurrected. + + // If we're looking for a .jpg then it's it's possible that we're requesting the thumbnail + // for a movie. In that case, the .flv or .mp4 file would have been converted to a .jpg. + // So try some alternate types: + if (preg_match('/.jpg$/', $path)) { + foreach (array("flv", "mp4") as $ext) { + $movie_path = preg_replace('/.jpg$/', ".$ext", $path); + $item = ORM::factory("item")->where("relative_path_cache", $movie_path)->find(); + if ($item->loaded) { + break; + } } } } @@ -116,8 +115,13 @@ class File_Proxy_Controller extends Controller { // We don't need to save the session for this request Session::abort_save(); - // Dump out the image - header("Content-Type: $item->mime_type"); + // Dump out the image. If the item is a movie, then its thumbnail will be a JPG. + if (in_array($item->mime_type, array("video/x-flv", "video/mp4"))) { + header("Content-type: image/jpeg"); + } else { + header("Content-Type: $item->mime_type"); + } + Kohana::close_buffers(false); $fd = fopen($file, "rb"); fpassthru($fd); diff --git a/modules/gallery/controllers/items.php b/modules/gallery/controllers/items.php index 13891726..7f60f2b7 100644 --- a/modules/gallery/controllers/items.php +++ b/modules/gallery/controllers/items.php @@ -25,6 +25,6 @@ class Items_Controller extends REST_Controller { // differently. We could also just delegate here, but it feels more appropriate // to have a single canonical resource mapping. access::required("view", $item); - return url::redirect($item->url(array(), true)); + return url::redirect($item->abs_url()); } } diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php index 831c79c1..6e19310b 100644 --- a/modules/gallery/controllers/l10n_client.php +++ b/modules/gallery/controllers/l10n_client.php @@ -90,10 +90,15 @@ class L10n_Client_Controller extends Controller { } $session = Session::instance(); - $session->set("l10n_mode", - !$session->get("l10n_mode", false)); + $l10n_mode = $session->get("l10n_mode", false); + $session->set("l10n_mode", !$l10n_mode); - url::redirect("albums/1"); + $redirect_url = "admin/languages"; + if (!$l10n_mode) { + $redirect_url .= "#l10n-client"; + } + + url::redirect($redirect_url); } private static function _l10n_client_search_form() { diff --git a/modules/gallery/controllers/move.php b/modules/gallery/controllers/move.php index 93ef05a6..87b73436 100644 --- a/modules/gallery/controllers/move.php +++ b/modules/gallery/controllers/move.php @@ -43,7 +43,7 @@ class Move_Controller extends Controller { print json_encode( array("result" => "success", - "location" => url::site("albums/{$target->id}"))); + "location" => $target->url())); } public function show_sub_tree($source_id, $target_id) { diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index 30a5d78c..04e15315 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -72,34 +72,45 @@ class Movies_Controller extends Items_Controller { $form = photo::get_edit_form($photo); if ($valid = $form->validate()) { - // Make sure that there's not a conflict - if (Database::instance() - ->from("items") - ->where("parent_id", $photo->parent_id) - ->where("id <>", $photo->id) - ->where("name", $form->edit_photo->filename->value) - ->count_records()) { - $form->edit_photo->filename->add_error("conflict", 1); - $valid = false; + if ($form->edit_item->filename->value != $photo->name || + $form->edit_item->slug->value != $photo->slug) { + // Make sure that there's not a name or slug conflict + if ($row = Database::instance() + ->select(array("name", "slug")) + ->from("items") + ->where("parent_id", $photo->parent_id) + ->where("id <>", $photo->id) + ->open_paren() + ->where("name", $form->edit_item->filename->value) + ->orwhere("slug", $form->edit_item->slug->value) + ->close_paren() + ->get() + ->current()) { + if ($row->name == $form->edit_item->filename->value) { + $form->edit_item->filename->add_error("name_conflict", 1); + } + if ($row->slug == $form->edit_item->slug->value) { + $form->edit_item->slug->add_error("slug_conflict", 1); + } + $valid = false; + } } } if ($valid) { - $orig = clone $photo; - $photo->title = $form->edit_photo->title->value; - $photo->description = $form->edit_photo->description->value; - $photo->rename($form->edit_photo->filename->value); + $photo->title = $form->edit_item->title->value; + $photo->description = $form->edit_item->description->value; + $photo->slug = $form->edit_item->slug->value; + $photo->rename($form->edit_item->filename->value); $photo->save(); + module::event("item_edit_form_completed", $photo, $form); - module::event("item_updated", $orig, $photo); - - log::success("content", "Updated photo", "<a href=\"photos/$photo->id\">view</a>"); + log::success("content", "Updated movie", "<a href=\"{$photo->url()}\">view</a>"); message::success( - t("Saved photo %photo_title", array("photo_title" => p::clean($photo->title)))); + t("Saved movie %movie_title", array("movie_title" => $photo->title))); print json_encode( - array("result" => "success", - "location" => url::site("photos/$photo->id"))); + array("result" => "success")); } else { print json_encode( array("result" => "error", diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php index 7b4d68f6..fbb1d07d 100644 --- a/modules/gallery/controllers/packager.php +++ b/modules/gallery/controllers/packager.php @@ -123,6 +123,10 @@ class Packager_Controller extends Controller { // Normalize dates $line = preg_replace("/,$root_created_timestamp,/", ",UNIX_TIMESTAMP(),", $line); $line = preg_replace("/,$root_updated_timestamp,/", ",UNIX_TIMESTAMP(),", $line); + + // Remove ENGINE= specifications + $line = preg_replace("/ENGINE=\S+ /", "", $line); + $buf .= $line; } $fd = fopen($sql_file, "wb"); diff --git a/modules/gallery/controllers/permissions.php b/modules/gallery/controllers/permissions.php index c776a0fd..5f4620b2 100644 --- a/modules/gallery/controllers/permissions.php +++ b/modules/gallery/controllers/permissions.php @@ -71,6 +71,13 @@ class Permissions_Controller extends Controller { access::reset($group, $perm->name, $item); break; } + + // If the active user just took away their own edit permissions, give it back. + if ($perm->name == "edit") { + if (!access::user_can(user::active(), "edit", $item)) { + access::allow($group, $perm->name, $item); + } + } } } diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index 6a62e859..79ad674a 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -62,37 +62,48 @@ class Photos_Controller extends Items_Controller { access::required("edit", $photo); $form = photo::get_edit_form($photo); + $valid = $form->validate(); if ($valid = $form->validate()) { - if ($form->edit_photo->filename->value != $photo->name) { - // Make sure that there's not a conflict - if (Database::instance() + if ($form->edit_item->filename->value != $photo->name || + $form->edit_item->slug->value != $photo->slug) { + // Make sure that there's not a name or slug conflict + if ($row = Database::instance() + ->select(array("name", "slug")) ->from("items") ->where("parent_id", $photo->parent_id) ->where("id <>", $photo->id) - ->where("name", $form->edit_photo->filename->value) - ->count_records()) { - $form->edit_photo->filename->add_error("conflict", 1); + ->open_paren() + ->where("name", $form->edit_item->filename->value) + ->orwhere("slug", $form->edit_item->slug->value) + ->close_paren() + ->get() + ->current()) { + if ($row->name == $form->edit_item->filename->value) { + $form->edit_item->filename->add_error("name_conflict", 1); + } + if ($row->slug == $form->edit_item->slug->value) { + $form->edit_item->slug->add_error("slug_conflict", 1); + } $valid = false; } } } if ($valid) { - $orig = clone $photo; - $photo->title = $form->edit_photo->title->value; - $photo->description = $form->edit_photo->description->value; - $photo->rename($form->edit_photo->filename->value); + $photo->title = $form->edit_item->title->value; + $photo->description = $form->edit_item->description->value; + $photo->slug = $form->edit_item->slug->value; + $photo->rename($form->edit_item->filename->value); $photo->save(); + module::event("item_edit_form_completed", $photo, $form); - module::event("item_updated", $orig, $photo); - - log::success("content", "Updated photo", "<a href=\"photos/$photo->id\">view</a>"); + log::success("content", "Updated photo", "<a href=\"{$photo->url()}\">view</a>"); message::success( - t("Saved photo %photo_title", array("photo_title" => p::clean($photo->title)))); + t("Saved photo %photo_title", + array("photo_title" => html::purify($photo->title)))); print json_encode( - array("result" => "success", - "location" => url::site("photos/$photo->id"))); + array("result" => "success")); } else { print json_encode( array("result" => "error", diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index de027c1b..2ac54754 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -18,20 +18,6 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Quick_Controller extends Controller { - public function pane($id) { - $item = model_cache::get("item", $id); - if (!access::can("view", $item) || !access::can("edit", $item)) { - return ""; - } - - $view = new View("quick_pane.html"); - $page_type = Input::instance()->get("page_type"); - $view->button_list = gallery_quick::get_quick_buttons($item, $page_type); - $view->item = $item; - $view->page_type = $page_type; - print $view; - } - public function rotate($id, $dir) { access::verify_csrf(); $item = model_cache::get("item", $id); @@ -89,7 +75,7 @@ class Quick_Controller extends Controller { access::required("view", $item->parent()); access::required("edit", $item->parent()); - $msg = t("Made <b>%title</b> this album's cover", array("title" => p::purify($item->title))); + $msg = t("Made <b>%title</b> this album's cover", array("title" => html::purify($item->title))); item::make_album_cover($item); message::success($msg); @@ -105,10 +91,10 @@ class Quick_Controller extends Controller { if ($item->is_album()) { print t( "Delete the album <b>%title</b>? All photos and movies in the album will also be deleted.", - array("title" => p::purify($item->title))); + array("title" => html::purify($item->title))); } else { print t("Are you sure you want to delete <b>%title</b>?", - array("title" => p::purify($item->title))); + array("title" => html::purify($item->title))); } $form = item::get_delete_form($item); @@ -122,9 +108,9 @@ class Quick_Controller extends Controller { access::required("edit", $item); if ($item->is_album()) { - $msg = t("Deleted album <b>%title</b>", array("title" => p::purify($item->title))); + $msg = t("Deleted album <b>%title</b>", array("title" => html::purify($item->title))); } else { - $msg = t("Deleted photo <b>%title</b>", array("title" => p::purify($item->title))); + $msg = t("Deleted photo <b>%title</b>", array("title" => html::purify($item->title))); } $parent = $item->parent(); @@ -135,7 +121,7 @@ class Quick_Controller extends Controller { print json_encode(array("result" => "success", "reload" => 1)); } else { print json_encode(array("result" => "success", - "location" => url::site("albums/$parent->id"))); + "location" => $parent->url())); } } diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index 75a7b810..156d18ac 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -1,4 +1,3 @@ - <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor @@ -72,7 +71,7 @@ class Simple_Uploader_Controller extends Controller { unlink($temp_filename); } header("HTTP/1.1 500 Internal Server Error"); - print "ERROR:" . $e->getMessage(); + print "ERROR: " . $e->getMessage(); return; } unlink($temp_filename); diff --git a/modules/gallery/controllers/after_install.php b/modules/gallery/controllers/welcome_message.php index f066afe4..8fd1e0a0 100644 --- a/modules/gallery/controllers/after_install.php +++ b/modules/gallery/controllers/welcome_message.php @@ -17,13 +17,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class After_Install_Controller extends Controller { +class Welcome_Message_Controller extends Controller { public function index() { if (!user::active()->admin) { - url::redirect("albums/1"); + url::redirect(item::root()->abs_url()); } - $v = new View("after_install.html"); + $v = new View("welcome_message.html"); $v->user = user::active(); print $v; } |