summaryrefslogtreecommitdiff
path: root/core/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'core/controllers')
-rw-r--r--core/controllers/albums.php2
-rw-r--r--core/controllers/photos.php2
-rw-r--r--core/controllers/welcome.php26
3 files changed, 14 insertions, 16 deletions
diff --git a/core/controllers/albums.php b/core/controllers/albums.php
index bba7fd6e..1977003b 100644
--- a/core/controllers/albums.php
+++ b/core/controllers/albums.php
@@ -23,7 +23,7 @@ class Albums_Controller extends Items_Controller {
* @see Rest_Controller::_show($resource)
*/
public function _show($item) {
- if (!access::can("view", $item->id)) {
+ if (!access::can("view", $item)) {
return Kohana::show_404();
}
diff --git a/core/controllers/photos.php b/core/controllers/photos.php
index 8b3e81fc..c72fae12 100644
--- a/core/controllers/photos.php
+++ b/core/controllers/photos.php
@@ -23,7 +23,7 @@ class Photos_Controller extends Items_Controller {
* @see Rest_Controller::_show($resource)
*/
public function _show($item) {
- if (!access::can("view", $item->id)) {
+ if (!access::can("view", $item)) {
return Kohana::show_404();
}
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index 2839b2f1..dacaa87f 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -22,13 +22,11 @@ class Welcome_Controller extends Template_Controller {
function index() {
Session::instance();
-
$this->template->syscheck = new View("welcome_syscheck.html");
$this->template->syscheck->errors = $this->_get_config_errors();
$this->template->syscheck->modules = array();
$old_handler = set_error_handler(array("Welcome_Controller", "_error_handler"));
-
try {
$this->template->syscheck->modules = $this->_read_modules();
$this->template->album_count = ORM::factory("item")->where("type", "album")->count_all();
@@ -101,20 +99,18 @@ class Welcome_Controller extends Template_Controller {
try {
call_user_func(array("{$module->name}_installer", "uninstall"));
} catch (Exception $e) {
- $clean = false;
}
}
}
} catch (Exception $e) { }
- set_error_handler($old_handler);
- if (!$clean) {
- // Since we're in a state of flux, it's possible that other stuff went wrong with the
- // uninstall, so back off and nuke things from orbit.
- $db = Database::instance();
- foreach ($db->list_tables() as $table) {
- $db->query("DROP TABLE `$table`");
- }
+
+ // Since we're in a state of flux, it's possible that other stuff went wrong with the
+ // uninstall, so back off and nuke it from orbit. It's the only way to be sure.
+ $db = Database::instance();
+ foreach ($db->list_tables() as $table) {
+ $db->query("DROP TABLE `$table`");
}
+ set_error_handler($old_handler);
}
call_user_func(array("{$module_name}_installer", "uninstall"));
url::redirect("welcome");
@@ -488,18 +484,20 @@ class Welcome_Controller extends Template_Controller {
}
public function add_perm($group_id, $perm, $item_id) {
- access::allow($group_id, $perm, $item_id);
+ access::allow(ORM::factory("group", $group_id), $perm, ORM::factory("item", $item_id));
url::redirect("welcome");
}
public function deny_perm($group_id, $perm, $item_id) {
- access::deny($group_id, $perm, $item_id);
+ access::deny(ORM::factory("group", $group_id), $perm, ORM::factory("item", $item_id));
url::redirect("welcome");
}
public function reset_all_perms($group_id, $item_id) {
+ $group = ORM::factory("group", $group_id);
+ $item = ORM::factory("item", $item_id);
foreach (ORM::factory("permission")->find_all() as $perm) {
- access::reset($group_id, $perm->name, $item_id);
+ access::reset($group, $perm->name, $item);
}
url::redirect("welcome");
}