summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/gallery.php27
-rw-r--r--modules/gallery/helpers/gallery_block.php5
-rw-r--r--modules/gallery/helpers/gallery_installer.php6
-rw-r--r--modules/gallery/helpers/gallery_rss.php61
-rw-r--r--modules/gallery/helpers/graphics.php1
-rw-r--r--modules/gallery/helpers/item.php18
-rw-r--r--modules/gallery/helpers/movie.php4
7 files changed, 117 insertions, 5 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 1686571c..e22cc17f 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -49,4 +49,31 @@ class gallery_Core {
static function shutdown() {
module::event("gallery_shutdown");
}
+
+ /**
+ * Return a unix timestamp in a user specified format including date and time.
+ * @param $timestamp unix timestamp
+ * @return string
+ */
+ static function date_time($timestamp) {
+ return date(module::get_var("gallery", "date_time_format", "Y-M-d H:i:s"), $timestamp);
+ }
+
+ /**
+ * Return a unix timestamp in a user specified format that's just the date.
+ * @param $timestamp unix timestamp
+ * @return string
+ */
+ static function date($timestamp) {
+ return date(module::get_var("gallery", "date_format", "Y-M-d"), $timestamp);
+ }
+
+ /**
+ * Return a unix timestamp in a user specified format that's just the time.
+ * @param $timestamp unix timestamp
+ * @return string
+ */
+ static function time($timestamp) {
+ return date(module::get_var("gallery", "time_format", "H:i:s"), $timestamp);
+ }
} \ No newline at end of file
diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php
index abc8a195..c3837f54 100644
--- a/modules/gallery/helpers/gallery_block.php
+++ b/modules/gallery/helpers/gallery_block.php
@@ -56,7 +56,8 @@ class gallery_block_Core {
$block->css_id = "gStats";
$block->title = t("Gallery Stats");
$block->content = new View("admin_block_stats.html");
- $block->content->album_count = ORM::factory("item")->where("type", "album")->count_all();
+ $block->content->album_count =
+ ORM::factory("item")->where("type", "album")->where("id <>", 1)->count_all();
$block->content->photo_count = ORM::factory("item")->where("type", "photo")->count_all();
break;
@@ -92,7 +93,7 @@ class gallery_block_Core {
$form = new Forge("admin/dashboard/add_block", "", "post",
array("id" => "gAddDashboardBlockForm"));
$group = $form->group("add_block")->label(t("Add Block"));
- $group->dropdown("id")->label("Available Blocks")->options(block_manager::get_available());
+ $group->dropdown("id")->label(t("Available Blocks"))->options(block_manager::get_available());
$group->submit("center")->value(t("Add to center"));
$group->submit("sidebar")->value(t("Add to sidebar"));
return $form;
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 242bb486..b2be63be 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -254,6 +254,12 @@ class gallery_installer {
// @todo this string needs to be picked up by l10n_scanner
module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>");
+ } else if ($version == 1) {
+ module::set_var("gallery", "date_format", "Y-M-d");
+ module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
+ module::set_var("gallery", "time_format", "H:i:s");
+ module::set_var("gallery", "version", "3.0 pre beta 2 (git)");
+ module::set_version("gallery", 2);
}
}
diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php
new file mode 100644
index 00000000..6e722ff6
--- /dev/null
+++ b/modules/gallery/helpers/gallery_rss.php
@@ -0,0 +1,61 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+class gallery_rss_Core {
+ static function available_feeds($item) {
+ return array(array("description" => t("New photos or movies"),
+ "sidebar" => true,
+ "uri" => "updates"),
+ array("description" => t("Album feed"),
+ "sidebar" => false,
+ "uri" => "albums"));
+ }
+
+ static function updates($offset, $limit) {
+ $feed = new stdClass();
+ $feed->data["children"] = ORM::factory("item")
+ ->viewable()
+ ->where("type !=", "album")
+ ->orderby("created", "DESC")
+ ->find_all($limit, $offset);
+ $feed->max_pages = ceil($feed->data["children"]->count() / $limit);
+ $feed->data["title"] = t("Recent Updates");
+ $feed->data["link"] = url::abs_site("albums/1");
+ $feed->data["description"] = t("Recent Updates");
+
+ return $feed;
+ }
+
+ static function albums($offset, $limit, $id) {
+ $item = ORM::factory("item", $id);
+ access::required("view", $item);
+
+ $feed = new stdClass();
+ $feed->data["children"] = $item
+ ->viewable()
+ ->descendants($limit, $offset, "photo");
+ $feed->max_pages = ceil($item->viewable()->descendants_count("photo") / $limit);
+ $feed->data["title"] = $item->title;
+ $feed->data["link"] = url::abs_site("albums/{$item->id}");
+ $feed->data["description"] = $item->description;
+
+ return $feed;
+ }
+}
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 25eb0891..feebfb34 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -326,6 +326,7 @@ class graphics_Core {
if (!isset($gd["GD Version"])) {
$gd["GD Version"] = false;
}
+ putenv("PATH=" . getenv("PATH") . ":/usr/local/bin");
return array("gd" => $gd,
"imagemagick" => $exec ? dirname(exec("which convert")) : false,
"graphicsmagick" => $exec ? dirname(exec("which gm")) : false);
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php
index 09870b45..f40b5c97 100644
--- a/modules/gallery/helpers/item.php
+++ b/modules/gallery/helpers/item.php
@@ -119,4 +119,22 @@ class item_Core {
$title = preg_replace("/ +/", " ", $title);
return $title;
}
+
+ /**
+ * Display delete confirmation message and form
+ * @param object $item
+ * @return string form
+ */
+ static function get_delete_form($item) {
+ if (Input::instance()->get("page_type") == "album") {
+ $page_type = "album";
+ } else {
+ $page_type = "item";
+ }
+ $form = new Forge("quick/delete/$item->id?page_type=$page_type", "", "post", array("id" => "gConfirmDelete"));
+ $form->hidden("_method")->value("put");
+ $group = $form->group("confirm_delete")->label(t("Confirm Deletion"));
+ $group->submit("")->value(t("Delete"));
+ return $form;
+ }
} \ No newline at end of file
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 986d5f62..1d1d29d1 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -140,13 +140,11 @@ class movie_Core {
static function find_ffmpeg() {
if (!$ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) {
+ putenv("PATH=" . getenv("PATH") . ":/usr/local/bin");
if (function_exists("exec")) {
$ffmpeg_path = exec("which ffmpeg");
}
- if (empty($ffmpeg) && @file_exists("/usr/local/bin/ffmpeg")) {
- $ffmpeg_path = "/usr/local/bin/ffmpeg";
- }
module::set_var("gallery", "ffmpeg_path", $ffmpeg_path);
}
return $ffmpeg_path;