summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-12-21 21:27:43 -0800
committerBharat Mediratta <bharat@menalto.com>2009-12-21 21:27:43 -0800
commit8b9a02084a8205fce67860c98ed4ab72b1156a0c (patch)
tree4827cdd337c1e353279ef463aea8104becb063b2 /modules/gallery
parent9285c8c66c530196399eb05bb5561c3fa5538335 (diff)
Updates for the latest version of Kohana 2.4:
1) Controller::$input is gone -- use Input::instance() now 2) Handle new 'database.<default>.connection.params' parameter 3) Handle new 'cache.<default>.prefix' parameter
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/config/cache.php3
-rw-r--r--modules/gallery/controllers/admin_dashboard.php2
-rw-r--r--modules/gallery/controllers/admin_identity.php4
-rw-r--r--modules/gallery/controllers/admin_languages.php7
-rw-r--r--modules/gallery/controllers/admin_modules.php2
-rw-r--r--modules/gallery/controllers/admin_sidebar.php2
-rw-r--r--modules/gallery/controllers/albums.php14
-rw-r--r--modules/gallery/controllers/file_proxy.php2
-rw-r--r--modules/gallery/controllers/logout.php2
-rw-r--r--modules/gallery/controllers/move.php2
-rw-r--r--modules/gallery/libraries/MY_Database.php14
11 files changed, 36 insertions, 18 deletions
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
*/