1
0

Added a few code comments.

This commit is contained in:
rWatcher 2009-08-20 20:35:08 -04:00
parent af1e856d9e
commit 43b3142920
2 changed files with 17 additions and 3 deletions

View File

@ -19,6 +19,9 @@
*/ */
class itemchecksum_Controller extends Controller { class itemchecksum_Controller extends Controller {
public function albumcount($album_id) { public function albumcount($album_id) {
// Display the number of non-album items (photos and videos)
// in the specified album ($album_id).
$item = ORM::factory("item") $item = ORM::factory("item")
->viewable() ->viewable()
->where("parent_id", $album_id) ->where("parent_id", $album_id)
@ -29,6 +32,9 @@ class itemchecksum_Controller extends Controller {
} }
public function md5($album_id, $file_name) { public function md5($album_id, $file_name) {
// Locate an item with $file_name in the album $album_id
// and display it's md5 checksum.
$item = ORM::factory("item") $item = ORM::factory("item")
->where("parent_id", $album_id) ->where("parent_id", $album_id)
->where("name", $file_name) ->where("name", $file_name)
@ -36,6 +42,9 @@ class itemchecksum_Controller extends Controller {
if (count($item) > 0) { if (count($item) > 0) {
access::required("view_full", $item[0]); access::required("view_full", $item[0]);
// If the KeepOriginal module is active, check for/use the
// original image instead of the gallery edited version.
if (module::is_active("keeporiginal")) { if (module::is_active("keeporiginal")) {
$original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item[0]->file_path()); $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item[0]->file_path());
if ($item[0]->is_photo() && file_exists($original_image)) { if ($item[0]->is_photo() && file_exists($original_image)) {
@ -52,7 +61,9 @@ class itemchecksum_Controller extends Controller {
} }
public function sha1($album_id, $file_name) { public function sha1($album_id, $file_name) {
// Locate an item with $file_name in the album $album_id
// and display it's sha-1 checksum.
$item = ORM::factory("item") $item = ORM::factory("item")
->where("parent_id", $album_id) ->where("parent_id", $album_id)
->where("name", $file_name) ->where("name", $file_name)
@ -60,6 +71,9 @@ class itemchecksum_Controller extends Controller {
if (count($item) > 0) { if (count($item) > 0) {
access::required("view_full", $item[0]); access::required("view_full", $item[0]);
// If the KeepOriginal module is active, check for/use the
// original image instead of the gallery edited version.
if (module::is_active("keeporiginal")) { if (module::is_active("keeporiginal")) {
$original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item[0]->file_path()); $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item[0]->file_path());
if ($item[0]->is_photo() && file_exists($original_image)) { if ($item[0]->is_photo() && file_exists($original_image)) {

View File

@ -1,3 +1,3 @@
name = ItemChecksum name = "ItemChecksum"
description = Display's a photo or video's MD5 and SHA-1 checksum. description = "Display's a photo or video's MD5 and SHA-1 checksum."
version = 1 version = 1