summaryrefslogtreecommitdiff
path: root/modules/g2_import
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2013-02-14 14:28:46 +0000
committerNathan Kinkade <nath@nkinka.de>2013-02-14 14:28:46 +0000
commit711651f727e093cc7357a6bbff6bd992fd6dfd80 (patch)
tree2dadc1c06acf1ab3d42d3ed5415568535db54416 /modules/g2_import
parent0047af90bf4db08b22838e6ded22a7fa70cee98a (diff)
parente5ed05004f005bdccdbf68e199ae2324ad97e895 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/g2_import')
-rw-r--r--modules/g2_import/controllers/admin_g2_import.php2
-rw-r--r--modules/g2_import/controllers/g2.php39
-rw-r--r--modules/g2_import/helpers/g2_import.php2
-rw-r--r--modules/g2_import/helpers/g2_import_event.php2
-rw-r--r--modules/g2_import/helpers/g2_import_installer.php3
-rw-r--r--modules/g2_import/helpers/g2_import_task.php2
-rw-r--r--modules/g2_import/libraries/G2_Import_Exception.php2
-rw-r--r--modules/g2_import/models/g2_map.php2
-rw-r--r--modules/g2_import/module.info6
9 files changed, 39 insertions, 21 deletions
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php
index 2e435321..c4f03907 100644
--- a/modules/g2_import/controllers/admin_g2_import.php
+++ b/modules/g2_import/controllers/admin_g2_import.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 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
diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php
index 98eb57f1..c24d52e9 100644
--- a/modules/g2_import/controllers/g2.php
+++ b/modules/g2_import/controllers/g2.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 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
@@ -33,10 +33,30 @@ class G2_Controller extends Controller {
$input = Input::instance();
$path = $input->get("path");
$id = $input->get("g2_itemId");
+ $view = $input->get("g2_view");
- /* Tags are handled specially, since there's no mapping for them */
- if (($path && 0 === strpos($path, "tag/"))) {
- url::redirect("tag_name/" . substr($path, 4));
+ // Tags did not have mappings created, so we need to catch them first. However, if a g2_itemId was
+ // passed, we'll want to show lookup the mapping anyway
+ if (($path && 0 === strpos($path, "tag/")) || $view == "tags.VirtualAlbum") {
+ if (0 === strpos($path, "tag/")) {
+ $tag_name = substr($path, 4);
+ }
+ if ($view == "tags.VirtualAlbum") {
+ $tag_name = $input->get("g2_tagName");
+ }
+
+ if (!$id) {
+ url::redirect("tag_name/$tag_name", 301);
+ }
+
+ $tag = ORM::factory("tag")->where("name", "=", $tag_name)->find();
+ if ($tag->loaded()) {
+ item::set_display_context_callback("Tag_Controller::get_display_context", $tag->id);
+ // We want to show the item as part of the tag virtual album. Most of this code is below; we'll
+ // change $path and $view to let it fall through
+ $view = "";
+ $path = "";
+ }
}
if (($path && $path != 'index.php' && $path != 'main.php') || $id) {
@@ -45,11 +65,10 @@ class G2_Controller extends Controller {
// Gallery 2 don't specify g2_view if it's the default (core.ShowItem). And in some cases
// (bbcode, embedding) people are using the id style URLs although URL rewriting is enabled.
$where = array(array("g2_id", "=", $id));
- $view = $input->get("g2_view");
if ($view == "core.DownloadItem") {
$where[] = array("resource_type", "IN", array("file", "resize", "thumbnail", "full"));
} else if ($view) {
- $where[] = array("g2_url", "like", "%g2_view=$view%");
+ $where[] = array("g2_url", "LIKE", "%" . Database::escape_for_like("g2_view=$view") . "%");
} // else: Assuming that the first search hit is sufficiently good.
} else if ($path) {
$where = array(array("g2_url", "IN", array($path, str_replace(" ", "+", $path))));
@@ -80,18 +99,18 @@ class G2_Controller extends Controller {
// Redirect the user to the new url
switch ($resource_type) {
case "thumbnail":
- url::redirect($item->thumb_url(true));
+ url::redirect($item->thumb_url(true), 301);
case "resize":
- url::redirect($item->resize_url(true));
+ url::redirect($item->resize_url(true), 301);
case "file":
case "full":
- url::redirect($item->file_url(true));
+ url::redirect($item->file_url(true), 301);
case "item":
case "album":
- url::redirect($item->abs_url());
+ url::redirect($item->abs_url(), 301);
case "group":
case "user":
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 10af7d08..70aac747 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 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
diff --git a/modules/g2_import/helpers/g2_import_event.php b/modules/g2_import/helpers/g2_import_event.php
index 01f18739..b985281d 100644
--- a/modules/g2_import/helpers/g2_import_event.php
+++ b/modules/g2_import/helpers/g2_import_event.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 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
diff --git a/modules/g2_import/helpers/g2_import_installer.php b/modules/g2_import/helpers/g2_import_installer.php
index c16a9cc4..c7569819 100644
--- a/modules/g2_import/helpers/g2_import_installer.php
+++ b/modules/g2_import/helpers/g2_import_installer.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 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
@@ -31,7 +31,6 @@ class g2_import_installer {
KEY `g2_id` (`g2_id`))
DEFAULT CHARSET=utf8;");
- module::set_version("g2_import", 2);
mkdir(VARPATH . "modules/g2_import");
}
diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php
index 01d608af..07eacc40 100644
--- a/modules/g2_import/helpers/g2_import_task.php
+++ b/modules/g2_import/helpers/g2_import_task.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 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
diff --git a/modules/g2_import/libraries/G2_Import_Exception.php b/modules/g2_import/libraries/G2_Import_Exception.php
index a241a7bf..7732cfd4 100644
--- a/modules/g2_import/libraries/G2_Import_Exception.php
+++ b/modules/g2_import/libraries/G2_Import_Exception.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 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
diff --git a/modules/g2_import/models/g2_map.php b/modules/g2_import/models/g2_map.php
index 0cb27b1f..5fb566ce 100644
--- a/modules/g2_import/models/g2_map.php
+++ b/modules/g2_import/models/g2_map.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 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
diff --git a/modules/g2_import/module.info b/modules/g2_import/module.info
index 6b03d097..32af27d0 100644
--- a/modules/g2_import/module.info
+++ b/modules/g2_import/module.info
@@ -2,6 +2,6 @@ name = "Gallery 2 Import"
description = "Import your Gallery 2 content into Gallery 3"
version = 2
author_name = "Gallery Team"
-author_url = "http://codex.gallery2.org/Gallery:Team"
-info_url = "http://codex.gallery2.org/Gallery3:Modules:g2_import"
-discuss_url = "http://gallery.menalto.com/forum_module_g2_import"
+author_url = "http://codex.galleryproject.org/Gallery:Team"
+info_url = "http://codex.galleryproject.org/Gallery3:Modules:g2_import"
+discuss_url = "http://galleryproject.org/forum_module_g2_import"