summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/controllers/quick.php17
-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
-rw-r--r--modules/gallery/js/quick.js4
-rw-r--r--modules/gallery/module.info2
-rw-r--r--modules/gallery/views/admin_advanced_settings.html.php2
-rw-r--r--modules/gallery/views/admin_block_log_entries.html.php2
-rw-r--r--modules/gallery/views/admin_maintenance.html.php4
-rw-r--r--modules/gallery/views/permissions_form.html.php2
-rw-r--r--modules/gallery/views/quick_pane.html.php5
15 files changed, 141 insertions, 19 deletions
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index d6f5213f..cff6686b 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -95,6 +95,23 @@ class Quick_Controller extends Controller {
print json_encode(array("result" => "success", "reload" => 1));
}
+ public function form_delete($id) {
+ $item = model_cache::get("item", $id);
+ access::required("view", $item);
+ access::required("edit", $item);
+
+ if ($item->is_album()) {
+ print t(
+ "Delete the album <b>%title</b>? All photos and movies in the album will also be deleted.",
+ array("title" => $item->title));
+ } else {
+ print t("Are you sure you want to delete <b>%title</b>?", array("title" => $item->title));
+ }
+
+ $form = item::get_delete_form($item);
+ print $form;
+ }
+
public function delete($id) {
access::verify_csrf();
$item = model_cache::get("item", $id);
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;
diff --git a/modules/gallery/js/quick.js b/modules/gallery/js/quick.js
index 8a87ed07..4ebdac47 100644
--- a/modules/gallery/js/quick.js
+++ b/modules/gallery/js/quick.js
@@ -39,10 +39,6 @@ var show_quick = function() {
);
$("#gQuickPane a:not(.options)").click(function(e) {
e.preventDefault();
- if ($(this).attr("id") == "gQuickDelete" &&
- !confirm($(this).attr("ref"))) {
- return;
- }
quick_do(cont, $(this), img);
});
$("#gQuickPane a.options").click(function(e) {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index ff7da82d..3a5dd593 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = Gallery 3
description = Gallery core application
-version = 1
+version = 2
diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php
index b4dedaef..b37c1c73 100644
--- a/modules/gallery/views/admin_advanced_settings.html.php
+++ b/modules/gallery/views/admin_advanced_settings.html.php
@@ -6,7 +6,7 @@
</p>
<ul id="gMessage">
<li class="gWarning">
- <b><?= t("Change these values at your own risk!") ?>
+ <b><?= t("Change these values at your own risk!") ?></b>
</li>
</ul>
diff --git a/modules/gallery/views/admin_block_log_entries.html.php b/modules/gallery/views/admin_block_log_entries.html.php
index 38070fe1..44c1657f 100644
--- a/modules/gallery/views/admin_block_log_entries.html.php
+++ b/modules/gallery/views/admin_block_log_entries.html.php
@@ -3,7 +3,7 @@
<? foreach ($entries as $entry): ?>
<li class="<?= log::severity_class($entry->severity) ?>" style="direction: ltr">
<a href="<?= url::site("user/$entry->user_id") ?>"><?= p::clean($entry->user->name) ?></a>
- <?= date("Y-M-d H:i:s", $entry->timestamp) ?>
+ <?= gallery::date_time($entry->timestamp) ?>
<?= $entry->message ?>
<?= $entry->html ?>
</li>
diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php
index 66c4eea0..c47f77f8 100644
--- a/modules/gallery/views/admin_maintenance.html.php
+++ b/modules/gallery/views/admin_maintenance.html.php
@@ -69,7 +69,7 @@
<? foreach ($running_tasks as $task): ?>
<tr class="<?= $task->state == "stalled" ? "gWarning" : "" ?>">
<td>
- <?= date("M j, Y H:i:s", $task->updated) ?>
+ <?= gallery::date_time($task->updated) ?>
</td>
<td>
<?= $task->name ?>
@@ -139,7 +139,7 @@
<? foreach ($finished_tasks as $task): ?>
<tr class="<?= $task->state == "success" ? "gSuccess" : "gError" ?>">
<td>
- <?= date("M j, Y H:i:s", $task->updated) ?>
+ <?= gallery::date_time($task->updated) ?>
</td>
<td>
<?= $task->name ?>
diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php
index adf2bd94..0f60070a 100644
--- a/modules/gallery/views/permissions_form.html.php
+++ b/modules/gallery/views/permissions_form.html.php
@@ -69,7 +69,7 @@
<? elseif ($intent === access::ALLOW): ?>
<td class="gAllowed">
<? if ($item->id == 1): ?>
- <img src="<?= url::file('themes/default/images/ico-success.png') ?>" title="allowed" alt="<?= t('allowed icon') ?>" />
+ <img src="<?= url::file('themes/default/images/ico-success.png') ?>" title="<?= t("allowed") ?>" alt="<?= t('allowed icon') ?>" />
<? else: ?>
<a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
title="<?= t('allowed, click to reset') ?>">
diff --git a/modules/gallery/views/quick_pane.html.php b/modules/gallery/views/quick_pane.html.php
index 95de972b..f50e1abe 100644
--- a/modules/gallery/views/quick_pane.html.php
+++ b/modules/gallery/views/quick_pane.html.php
@@ -67,15 +67,12 @@
<? if ($item->type == "photo"): ?>
<? $title = t("Delete this photo") ?>
-<? $message = t("Do you really want to delete this photo") ?>
<? elseif ($item->type == "movie"): ?>
<? $title = t("Delete this movie") ?>
-<? $message = t("Do you really want to delete this movie") ?>
<? elseif ($item->type == "album"): ?>
<? $title = t("Delete this album") ?>
-<? $message = t("Do you really want to delete this album") ?>
<? endif ?>
-<a class="gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/delete/$item->id?csrf=$csrf&page_type=$page_type") ?>" ref="<?= $message ?>" id="gQuickDelete" title="<?= $title ?>">
+<a class="gDialogLink gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/form_delete/$item->id?page_type=$page_type") ?>" id="gQuickDelete" title="<?= $title ?>">
<span class="ui-icon ui-icon-trash">
<?= $title ?>
</span>