Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Get rid of unused _method param in the item edit form.
Fix viewable() to properly OR view restrictions together.
  • Loading branch information
bharat committed Dec 7, 2009
1 parent c22bf27 commit b9dadb7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions modules/gallery/helpers/item.php
Expand Up @@ -127,7 +127,6 @@ static function get_delete_form($item) {
$page_type = Input::instance()->get("page_type");
$form = new Forge(
"quick/delete/$item->id?page_type=$page_type", "", "post", array("id" => "g-confirm-delete"));
$form->hidden("_method")->value("put");
$group = $form->group("confirm_delete")->label(t("Confirm Deletion"));
$group->submit("")->value(t("Delete"));
return $form;
Expand Down Expand Up @@ -156,7 +155,7 @@ static function viewable($model) {
$view_restrictions = array();
if (!identity::active_user()->admin) {
foreach (identity::group_ids_for_active_user() as $id) {
$view_restrictions[] = "items.view_$id";
$view_restrictions["items.view_$id"] = access::ALLOW;
}
}
switch (count($view_restrictions)) {
Expand All @@ -168,10 +167,7 @@ static function viewable($model) {
break;

default:
$model
->and_open()
->or_where($view_restrictions, "=", access::ALLOW)
->close();
$model->and_open()->or_where($view_restrictions)->close();
break;
}

Expand Down

0 comments on commit b9dadb7

Please sign in to comment.