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:
parent
57e4d745be
commit
bcf7aee864
@ -28,11 +28,11 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function saveprefs() {
|
public function saveprefs() {
|
||||||
// This probably does something important.
|
// Prevent Cross Site Request Forgery
|
||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
|
|
||||||
// Figure out which boxes where checked
|
// Figure out which boxes where checked
|
||||||
$dlLinks_array = $_POST['DownloadLinkOptions'];
|
$dlLinks_array = Input::instance()->post("DownloadLinkOptions");
|
||||||
$tButton = false;
|
$tButton = false;
|
||||||
$fButton = false;
|
$fButton = false;
|
||||||
for ($i = 0; $i < count($dlLinks_array); $i++) {
|
for ($i = 0; $i < count($dlLinks_array); $i++) {
|
||||||
|
@ -23,6 +23,5 @@ class downloadfullsize_Controller extends Controller {
|
|||||||
$item = ORM::factory("item", $id);
|
$item = ORM::factory("item", $id);
|
||||||
access::required("view_full", $item);
|
access::required("view_full", $item);
|
||||||
download::force($item->file_path());
|
download::force($item->file_path());
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,11 @@ class downloadfullsize_installer {
|
|||||||
static function install() {
|
static function install() {
|
||||||
$version = module::get_version("downloadfullsize");
|
$version = module::get_version("downloadfullsize");
|
||||||
if ($version == 0) {
|
if ($version == 0) {
|
||||||
/* @todo Put database creation here */
|
|
||||||
module::set_version("downloadfullsize", 1);
|
module::set_version("downloadfullsize", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function uninstall() {
|
static function uninstall() {
|
||||||
/* @todo Put database table drops here */
|
|
||||||
module::delete("downloadfullsize");
|
module::delete("downloadfullsize");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ class downloadfullsize_menu_Core {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function admin($menu, $theme) {
|
static function admin($menu, $theme) {
|
||||||
$menu->get("settings_menu")
|
$menu->get("settings_menu")
|
||||||
->append(Menu::factory("link")
|
->append(Menu::factory("link")
|
||||||
|
@ -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
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||||
*
|
*
|
||||||
@ -18,8 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
class downloadfullsize_theme {
|
class downloadfullsize_theme {
|
||||||
static function sidebar_blocks($theme) {
|
static function sidebar_blocks($theme) {
|
||||||
if ($theme->item()->is_photo()) {
|
$item = $theme->item();
|
||||||
if (access::can("view_full", $theme->item)) {
|
if ($item && $item->is_photo() && access::can("view_full", $item)) {
|
||||||
if (module::get_var("downloadfullsize", "tButton")) {
|
if (module::get_var("downloadfullsize", "tButton")) {
|
||||||
$block = new Block();
|
$block = new Block();
|
||||||
$block->css_id = "gDownloadFullsize";
|
$block->css_id = "gDownloadFullsize";
|
||||||
@ -33,4 +34,3 @@ class downloadfullsize_theme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
|
||||||
<div class="gDownloadFullsizeBlock">
|
<div class="gDownloadFullsizeBlock">
|
||||||
<a href="<?= url::site("downloadfullsize/send/$theme->item")
|
<a href="<?= url::site("downloadfullsize/send/$theme->item") ?>"
|
||||||
?>" title="<?= t("Download Photo") ?>"
|
title="<?= t("Download Photo") ?>"
|
||||||
class="gButtonLink ui-icon-left ui-state-default ui-corner-all"><?= t("Download Fullsize Image") ?></a>
|
class="gButtonLink ui-icon-left ui-state-default ui-corner-all"><?= t("Download Fullsize Image") ?></a>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user