diff options
Diffstat (limited to 'modules')
19 files changed, 50 insertions, 32 deletions
diff --git a/modules/digibug/controllers/digibug.php b/modules/digibug/controllers/digibug.php index d070727d..a23d2863 100644 --- a/modules/digibug/controllers/digibug.php +++ b/modules/digibug/controllers/digibug.php @@ -59,7 +59,7 @@ class Digibug_Controller extends Controller { // If its a request for the full size then make sure we are coming from an // authorized address if ($type == "full") { - $remote_addr = ip2long($this->input->server("REMOTE_ADDR")); + $remote_addr = ip2long(Input::instance()->server("REMOTE_ADDR")); if ($remote_addr === false) { throw new Kohana_404_Exception(); } diff --git a/modules/gallery/config/cache.php b/modules/gallery/config/cache.php index cc3ac87d..d9a27c96 100644 --- a/modules/gallery/config/cache.php +++ b/modules/gallery/config/cache.php @@ -45,5 +45,6 @@ $config["default"] = array ( "driver" => "database", "params" => null, "lifetime" => 84600, - "requests" => 1000 + "requests" => 1000, + "prefix" => null, ); diff --git a/modules/gallery/controllers/admin_dashboard.php b/modules/gallery/controllers/admin_dashboard.php index 7e28f625..5f2cb41d 100644 --- a/modules/gallery/controllers/admin_dashboard.php +++ b/modules/gallery/controllers/admin_dashboard.php @@ -86,7 +86,7 @@ class Admin_Dashboard_Controller extends Admin_Controller { foreach (array("dashboard_sidebar", "dashboard_center") as $location) { $new_blocks = array(); - foreach ($this->input->get($location, array()) as $id) { + foreach (Input::instance()->get($location, array()) as $id) { $new_blocks[$id] = $active_set[$id]; } block_manager::set_active($location, $new_blocks); diff --git a/modules/gallery/controllers/admin_identity.php b/modules/gallery/controllers/admin_identity.php index acf71665..354e6c0c 100644 --- a/modules/gallery/controllers/admin_identity.php +++ b/modules/gallery/controllers/admin_identity.php @@ -30,7 +30,7 @@ class Admin_Identity_Controller extends Admin_Controller { access::verify_csrf(); $v = new View("admin_identity_confirm.html"); - $v->new_provider = $this->input->post("provider"); + $v->new_provider = Input::instance()->post("provider"); print $v; } @@ -40,7 +40,7 @@ class Admin_Identity_Controller extends Admin_Controller { $active_provider = module::get_var("gallery", "identity_provider", "user"); $providers = identity::providers(); - $new_provider = $this->input->post("provider"); + $new_provider = Input::instance()->post("provider"); if ($new_provider != $active_provider) { diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index 27537c7f..41523023 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -36,10 +36,11 @@ class Admin_Languages_Controller extends Admin_Controller { public function save() { access::verify_csrf(); - locales::update_installed($this->input->post("installed_locales")); + $input = Input::instance(); + locales::update_installed($input->post("installed_locales")); $installed_locales = array_keys(locales::installed()); - $new_default_locale = $this->input->post("default_locale"); + $new_default_locale = $input->post("default_locale"); if (!in_array($new_default_locale, $installed_locales)) { if (!empty($installed_locales)) { $new_default_locale = $installed_locales[0]; @@ -61,7 +62,7 @@ class Admin_Languages_Controller extends Admin_Controller { return $this->index($form); } - if ($this->input->post("share")) { + if (Input::instance()->post("share")) { l10n_client::submit_translations(); message::success(t("Translations submitted")); } else { diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php index af6dbbdc..549718e7 100644 --- a/modules/gallery/controllers/admin_modules.php +++ b/modules/gallery/controllers/admin_modules.php @@ -37,7 +37,7 @@ class Admin_Modules_Controller extends Admin_Controller { continue; } - $desired = $this->input->post($module_name) == 1; + $desired = Input::instance()->post($module_name) == 1; if ($info->active && !$desired && module::is_active($module_name)) { $changes->deactivate[] = $module_name; $deactivated_names[] = t($info->name); diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php index 77e83bc2..4c55bf89 100644 --- a/modules/gallery/controllers/admin_sidebar.php +++ b/modules/gallery/controllers/admin_sidebar.php @@ -34,7 +34,7 @@ class Admin_Sidebar_Controller extends Admin_Controller { $available_blocks = block_manager::get_available_site_blocks(); $active_blocks = array(); - foreach ($this->input->get("block", array()) as $block_id) { + foreach (Input::instance()->get("block", array()) as $block_id) { $active_blocks[md5($block_id)] = explode(":", (string) $block_id); } block_manager::set_active("site_sidebar", $active_blocks); diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 319f1416..2134a419 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -42,7 +42,8 @@ class Albums_Controller extends Items_Controller { } } - $show = $this->input->get("show"); + $input = Input::instance(); + $show = $input->get("show"); if ($show) { $child = ORM::factory("item", $show); @@ -57,7 +58,7 @@ class Albums_Controller extends Items_Controller { } } - $page = $this->input->get("page", "1"); + $page = $input->get("page", "1"); $children_count = $album->viewable()->children_count(); $offset = ($page - 1) * $page_size; $max_pages = max(ceil($children_count / $page_size), 1); @@ -94,15 +95,16 @@ class Albums_Controller extends Items_Controller { access::required("view", $album); access::required("add", $album); + $input = Input::instance(); $form = album::get_add_form($album); if ($form->validate()) { $new_album = album::create( $album, - $this->input->post("name"), - $this->input->post("title", $this->input->post("name")), - $this->input->post("description"), + $input->post("name"), + $input->post("title", $input->post("name")), + $input->post("description"), identity::active_user()->id, - $this->input->post("slug")); + $input->post("slug")); log::success("content", "Created an album", html::anchor("albums/$new_album->id", "view album")); diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 8c46de08..6a80ad85 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -29,7 +29,7 @@ class File_Proxy_Controller extends Controller { public function __call($function, $args) { // request_uri: http://example.com/gallery3/var/trunk/albums/foo/bar.jpg - $request_uri = $this->input->server("REQUEST_URI"); + $request_uri = Input::instance()->server("REQUEST_URI"); $request_uri = preg_replace("/\?.*/", "", $request_uri); // var_uri: http://example.com/gallery3/var/ diff --git a/modules/gallery/controllers/logout.php b/modules/gallery/controllers/logout.php index 2b93655d..fe9c48ba 100644 --- a/modules/gallery/controllers/logout.php +++ b/modules/gallery/controllers/logout.php @@ -20,7 +20,7 @@ class Logout_Controller extends Controller { public function index() { auth::logout(); - if ($continue_url = $this->input->get("continue")) { + if ($continue_url = Input::instance()->get("continue")) { $item = url::get_item_from_uri($continue_url); if (access::can("view", $item)) { // Don't use url::redirect() because it'll call url::site() and munge the continue url. diff --git a/modules/gallery/controllers/move.php b/modules/gallery/controllers/move.php index 863b13bb..14513fdc 100644 --- a/modules/gallery/controllers/move.php +++ b/modules/gallery/controllers/move.php @@ -32,7 +32,7 @@ class Move_Controller extends Controller { public function save($source_id) { access::verify_csrf(); $source = ORM::factory("item", $source_id); - $target = ORM::factory("item", $this->input->post("target_id")); + $target = ORM::factory("item", Input::instance()->post("target_id")); access::required("view", $source); access::required("edit", $source); diff --git a/modules/gallery/libraries/MY_Database.php b/modules/gallery/libraries/MY_Database.php index a8f4bc08..de3e5a84 100644 --- a/modules/gallery/libraries/MY_Database.php +++ b/modules/gallery/libraries/MY_Database.php @@ -21,6 +21,20 @@ abstract class Database extends Database_Core { protected $_table_names; /** + * Kohana 2.4 introduces a new connection parameter. If it's not specified, make sure that we + * define it here to avoid an error later on. + * + * @todo: add an upgrade path to modify var/database.php so that we can avoid doing this at + * runtime. + */ + protected function __construct(array $config) { + if (!isset($config["connection"]["params"])) { + $config["connection"]["params"] = null; + } + parent::__construct($config); + } + + /** * Parse the query string and convert any strings of the form `\([a-zA-Z0-9_]*?)\] * table prefix . $1 */ diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 08c80de3..03dea13d 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -48,7 +48,7 @@ class Organize_Controller extends Controller { access::required("view", $target_album); access::required("add", $target_album); - foreach ($this->input->post("source_ids") as $source_id) { + foreach (Input::instance()->post("source_ids") as $source_id) { $source = ORM::factory("item", $source_id); if (!$source->contains($target_album)) { access::required("edit", $source); @@ -69,7 +69,7 @@ class Organize_Controller extends Controller { access::required("view", $album); access::required("edit", $album); - $source_ids = $this->input->post("source_ids", array()); + $source_ids = Input::instance()->post("source_ids", array()); if ($album->sort_column != "weight") { $i = 0; diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php index a963a1dc..41c781d9 100644 --- a/modules/rss/controllers/rss.php +++ b/modules/rss/controllers/rss.php @@ -21,13 +21,13 @@ class Rss_Controller extends Controller { public static $page_size = 20; public function feed($module_id, $feed_id, $id=null) { - $page = (int) $this->input->get("page", 1); + $page = (int) Input::instance()->get("page", 1); if ($page < 1) { url::redirect(url::merge(array("page" => 1))); } // Configurable page size between 1 and 100, default 20 - $page_size = max(1, min(100, (int) $this->input->get("page_size", self::$page_size))); + $page_size = max(1, min(100, (int) Input::instance()->get("page_size", self::$page_size))); // Run the appropriate feed callback if (module::is_active($module_id)) { diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index 2f1aeb76..ea870847 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -20,8 +20,8 @@ class Search_Controller extends Controller { public function index() { $page_size = module::get_var("gallery", "page_size", 9); - $q = $this->input->get("q"); - $page = $this->input->get("page", 1); + $q = Input::instance()->get("q"); + $page = Input::instance()->get("page", 1); $offset = ($page - 1) * $page_size; // Make sure that the page references a valid offset diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index f32bb834..17c3f68b 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -58,7 +58,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { public function remove_path() { access::verify_csrf(); - $path = $this->input->get("path"); + $path = Input::instance()->get("path"); $paths = unserialize(module::get_var("server_add", "authorized_paths")); if (isset($paths[$path])) { unset($paths[$path]); @@ -71,7 +71,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { public function autocomplete() { $directories = array(); - $path_prefix = $this->input->get("q"); + $path_prefix = Input::instance()->get("q"); foreach (glob("{$path_prefix}*") as $file) { if (is_dir($file) && !is_link($file)) { $directories[] = $file; diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 70ad6ea2..77487673 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -34,7 +34,7 @@ class Server_Add_Controller extends Admin_Controller { } public function children() { - $path = $this->input->get("path"); + $path = Input::instance()->get("path"); $tree = new View("server_add_tree.html"); $tree->files = array(); diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index ed4a0366..a56d4d20 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -19,7 +19,7 @@ */ class Admin_Tags_Controller extends Admin_Controller { public function index() { - $filter = $this->input->get("filter"); + $filter = Input::instance()->get("filter"); $view = new Admin_View("admin.html"); $view->content = new View("admin_tags.html"); diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index a44f6aa3..992c7411 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -21,7 +21,7 @@ class Tags_Controller extends Controller { public function show($tag_id) { $tag = ORM::factory("tag", $tag_id); $page_size = module::get_var("gallery", "page_size", 9); - $page = (int) $this->input->get("page", "1"); + $page = (int) Input::instance()->get("page", "1"); $children_count = $tag->items_count(); $offset = ($page-1) * $page_size; $max_pages = max(ceil($children_count / $page_size), 1); @@ -79,8 +79,8 @@ class Tags_Controller extends Controller { public function autocomplete() { $tags = array(); - $tag_parts = preg_split("#,#", $this->input->get("q")); - $limit = $this->input->get("limit"); + $tag_parts = preg_split("#,#", Input::instance()->get("q")); + $limit = Input::instance()->get("limit"); $tag_part = end($tag_parts); $tag_list = ORM::factory("tag") ->where("name", "LIKE", "{$tag_part}%") |