summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/exif/helpers/exif_task.php4
-rw-r--r--modules/gallery/helpers/gallery_task.php34
-rw-r--r--modules/gallery/helpers/l10n_client.php5
-rw-r--r--modules/gallery/models/item.php5
-rw-r--r--modules/search/helpers/search.php1
-rw-r--r--modules/search/helpers/search_task.php5
-rw-r--r--modules/server_add/controllers/server_add.php2
-rw-r--r--modules/slideshow/helpers/slideshow_theme.php2
-rw-r--r--modules/tag/helpers/tag.php19
-rw-r--r--modules/tag/helpers/tag_search.php24
10 files changed, 68 insertions, 33 deletions
diff --git a/modules/exif/helpers/exif_task.php b/modules/exif/helpers/exif_task.php
index f3e77975..c269b732 100644
--- a/modules/exif/helpers/exif_task.php
+++ b/modules/exif/helpers/exif_task.php
@@ -42,7 +42,6 @@ class exif_task_Core {
$completed = $task->get("completed", 0);
$start = microtime(true);
- $message = array();
foreach (ORM::factory("item")
->join("exif_records", "items.id", "exif_records.item_id", "left")
->where("type", "photo")
@@ -57,11 +56,8 @@ class exif_task_Core {
$completed++;
exif::extract($item);
- $message[] = t("Updated Exif meta data for '%title'",
- array("title" => p::purify($item->title)));
}
- $task->log($message);
list ($remaining, $total, $percent) = exif::stats();
$task->set("completed", $completed);
if ($remaining == 0 || !($remaining + $completed)) {
diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php
index 9ce2c4a0..9edc3acd 100644
--- a/modules/gallery/helpers/gallery_task.php
+++ b/modules/gallery/helpers/gallery_task.php
@@ -45,7 +45,7 @@ class gallery_task_Core {
* @param Task_Model the task
*/
static function rebuild_dirty_images($task) {
- $message = array();
+ $errors = array();
try {
$result = graphics::find_dirty_images_query();
$completed = $task->get("completed", 0);
@@ -63,11 +63,11 @@ class gallery_task_Core {
$success = graphics::generate($item);
if (!$success) {
$ignored[$item->id] = 1;
- $message[] = t("Unable to rebuild images for '%title'",
- array("title" => p::purify($item->title)));
+ $errors[] = t("Unable to rebuild images for '%title'",
+ array("title" => p::purify($item->title)));
} else {
- $message[] = t("Successfully rebuilt images for '%title'",
- array("title" => p::purify($item->title)));
+ $errors[] = t("Successfully rebuilt images for '%title'",
+ array("title" => p::purify($item->title)));
}
}
@@ -101,13 +101,15 @@ class gallery_task_Core {
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
- $message[] = $e->__toString();
+ $errors[] = $e->__toString();
+ }
+ if ($errors) {
+ $task->log($errors);
}
- $task->log($message);
}
static function update_l10n(&$task) {
- $message = array();
+ $errors = array();
try {
$start = microtime(true);
$dirs = $task->get("dirs");
@@ -139,8 +141,8 @@ class gallery_task_Core {
}
}
- $message[] = $task->status = t2("Finding files: found 1 file",
- "Finding files: found %count files", count($files));
+ $task->status = t2("Finding files: found 1 file",
+ "Finding files: found %count files", count($files));
if (!$dirs) {
$task->set("mode", "scan_files");
@@ -165,8 +167,8 @@ class gallery_task_Core {
}
$total_files = $task->get("total_files");
- $message[] = $task->status = t2("Scanning files: scanned 1 file",
- "Scanning files: scanned %count files", $total_files - count($files));
+ $task->status = t2("Scanning files: scanned 1 file",
+ "Scanning files: scanned %count files", $total_files - count($files));
$task->percent_complete = 10 + 80 * ($total_files - count($files)) / $total_files;
if (empty($files)) {
@@ -177,7 +179,7 @@ class gallery_task_Core {
break;
case "fetch_updates": // 90% - 100%
- $message = array_merge($message, l10n_client::fetch_updates());
+ l10n_client::fetch_updates();
$task->done = true;
$task->state = "success";
$task->status = t("Translations installed/updated");
@@ -191,8 +193,10 @@ class gallery_task_Core {
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
- $message[] = $e->__toString();
+ $errors[] = $e->__toString();
+ }
+ if ($errors) {
+ $task->log($errors);
}
- $task->log($message);
}
} \ No newline at end of file
diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php
index b576b4e1..3460cc65 100644
--- a/modules/gallery/helpers/l10n_client.php
+++ b/modules/gallery/helpers/l10n_client.php
@@ -113,10 +113,6 @@ class l10n_client_Core {
// [{key:<key_1>, translation: <JSON encoded translation>, rev:<rev>, locale:<locale>},
// {key:<key_2>, ...}
// ]
- $count = count($response);
- $message[] = t2("Installed 1 new / updated translation message",
- "Installed %count new / updated translation messages", $count);
-
foreach ($response as $message_data) {
// @todo Better input validation
if (empty($message_data->key) || empty($message_data->translation) ||
@@ -153,7 +149,6 @@ class l10n_client_Core {
$entry->translation = $translation;
$entry->save();
}
- return $message;
}
static function submit_translations() {
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index c7311081..58ac8f18 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -353,11 +353,12 @@ class Item_Model extends ORM_MPTT {
$this->created = $this->updated;
$r = ORM::factory("item")->select("MAX(weight) as max_weight")->find();
$this->weight = $r->max_weight + 1;
- $created = 1;
+ } else {
+ $send_event = 1;
}
}
parent::save();
- if (!isset($created)) {
+ if (isset($send_event)) {
module::event("item_updated", $this);
}
return $this;
diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php
index dd18babb..b08cf89d 100644
--- a/modules/search/helpers/search.php
+++ b/modules/search/helpers/search.php
@@ -79,7 +79,6 @@ class search_Core {
$record->data = join(" ", $data);
$record->dirty = 0;
$record->save();
- return t("Search index updated for '%title'", array("title" => p::purify($item->title)));
}
static function stats() {
diff --git a/modules/search/helpers/search_task.php b/modules/search/helpers/search_task.php
index df1dfe16..5643573a 100644
--- a/modules/search/helpers/search_task.php
+++ b/modules/search/helpers/search_task.php
@@ -52,7 +52,7 @@ class search_task_Core {
break;
}
- $message[] = search::update($item);
+ search::update($item);
$completed++;
}
@@ -69,13 +69,10 @@ class search_task_Core {
$task->status = t2("one record updated, index is %percent% up-to-date",
"%count records updated, index is %percent% up-to-date",
$completed, array("percent" => $percent));
- $message[] = $task->status;
} catch (Exception $e) {
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
- $message[] = $e->__toString();
}
- $task->log($message);
}
}
diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php
index 6056d7cd..0be0f698 100644
--- a/modules/server_add/controllers/server_add.php
+++ b/modules/server_add/controllers/server_add.php
@@ -251,7 +251,7 @@ class Server_Add_Controller extends Admin_Controller {
$task->state = "success";
$task->percent_complete = 100;
ORM::factory("server_add_file")->where("task_id", $task->id)->delete_all();
- message::info(t2("Successfully added one photo",
+ message::info(t2("Successfully added one photo / album",
"Successfully added %count photos and albums",
$task->get("completed_files")));
}
diff --git a/modules/slideshow/helpers/slideshow_theme.php b/modules/slideshow/helpers/slideshow_theme.php
index 125d175c..269a93ce 100644
--- a/modules/slideshow/helpers/slideshow_theme.php
+++ b/modules/slideshow/helpers/slideshow_theme.php
@@ -20,7 +20,7 @@
class slideshow_theme_Core {
static function head($theme) {
$proto = (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] === "off") ? "http" : "https";
- return "<script src=\"$proto://lite.piclens.com/current/piclens_optimized.js\"" .
+ return "<script src=\"$proto://lite.piclens.com/current/piclens_optimized.js\" " .
"type=\"text/javascript\"></script>";
}
}
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php
index 7c4b56ba..ab5ee303 100644
--- a/modules/tag/helpers/tag.php
+++ b/modules/tag/helpers/tag.php
@@ -79,6 +79,25 @@ class tag_Core {
}
}
+
+ /**
+ * Return all the tags for a given item.
+ * @return array
+ */
+ static function item_tags($item) {
+ access::required("view", $item);
+ $tags = array();
+ foreach (Database::instance()
+ ->select("name")
+ ->from("tags")
+ ->join("items_tags", "tags.id", "items_tags.tag_id", "left")
+ ->where("items_tags.item_id", $item->id)
+ ->get() as $row) {
+ $tags[] = $row->name;
+ }
+ return $tags;
+ }
+
static function get_add_form($item) {
$form = new Forge("tags", "", "post", array("id" => "gAddTagForm"));
$label = $item->is_album() ?
diff --git a/modules/tag/helpers/tag_search.php b/modules/tag/helpers/tag_search.php
new file mode 100644
index 00000000..034b7af5
--- /dev/null
+++ b/modules/tag/helpers/tag_search.php
@@ -0,0 +1,24 @@
+<?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 tag_search_Core {
+ static function item_index_data($item) {
+ return join(" ", tag::item_tags($item));
+ }
+}