1
0

Minor clean up.

* Change $_POST to Input::instance()->post
* Explain what access::verify_csrf() does
* Avoid breakages on tag album pages (which don't have an item)
* Minor style fixes.

There's more that could be done here, but this is sufficient.
This commit is contained in:
Bharat Mediratta 2009-06-20 16:29:01 -07:00
parent 57e4d745be
commit bcf7aee864
6 changed files with 19 additions and 21 deletions

View File

@ -28,14 +28,14 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
}
public function saveprefs() {
// This probably does something important.
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Figure out which boxes where checked
$dlLinks_array = $_POST['DownloadLinkOptions'];
$dlLinks_array = Input::instance()->post("DownloadLinkOptions");
$tButton = false;
$fButton = false;
for ($i=0; $i<count($dlLinks_array); $i++) {
for ($i = 0; $i < count($dlLinks_array); $i++) {
if ($dlLinks_array[$i] == "tButton") {
$tButton = true;
}

View File

@ -18,11 +18,10 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class downloadfullsize_Controller extends Controller {
public function send($id) {
$item = ORM::factory("item", $id);
access::required("view_full", $item);
download::force($item->file_path());
return ;
}
}

View File

@ -20,13 +20,11 @@ class downloadfullsize_installer {
static function install() {
$version = module::get_version("downloadfullsize");
if ($version == 0) {
/* @todo Put database creation here */
module::set_version("downloadfullsize", 1);
}
}
static function uninstall() {
/* @todo Put database table drops here */
module::delete("downloadfullsize");
}
}

View File

@ -31,6 +31,7 @@ class downloadfullsize_menu_Core {
}
}
}
static function admin($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")

View File

@ -1,4 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.");/**
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
@ -18,19 +19,18 @@
*/
class downloadfullsize_theme {
static function sidebar_blocks($theme) {
if ($theme->item()->is_photo()) {
if (access::can("view_full", $theme->item)) {
if (module::get_var("downloadfullsize", "tButton")) {
$block = new Block();
$block->css_id = "gDownloadFullsize";
$block->title = t("Download");
$block->content = new View("downloadfullsize_block.html");
$item = $theme->item();
if ($item && $item->is_photo() && access::can("view_full", $item)) {
if (module::get_var("downloadfullsize", "tButton")) {
$block = new Block();
$block->css_id = "gDownloadFullsize";
$block->title = t("Download");
$block->content = new View("downloadfullsize_block.html");
$block->content->item = ORM::factory("item", 1);
$block->content->item = ORM::factory("item", 1);
return $block;
}
return $block;
}
}
}
}
}

View File

@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="gDownloadFullsizeBlock">
<a href="<?= url::site("downloadfullsize/send/$theme->item")
?>" title="<?= t("Download Photo") ?>"
<a href="<?= url::site("downloadfullsize/send/$theme->item") ?>"
title="<?= t("Download Photo") ?>"
class="gButtonLink ui-icon-left ui-state-default ui-corner-all"><?= t("Download Fullsize Image") ?></a>
</div>