diff options
Diffstat (limited to 'modules/g2_import')
-rw-r--r-- | modules/g2_import/controllers/g2.php | 54 | ||||
-rw-r--r-- | modules/g2_import/css/g2_import.css | 30 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 6 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import_theme.php | 28 | ||||
-rw-r--r-- | modules/g2_import/views/admin_g2_import.html.php | 95 |
5 files changed, 74 insertions, 139 deletions
diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index d260c9b4..0f51173a 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -34,38 +34,44 @@ class G2_Controller extends Controller { $path = $input->get("path"); $id = $input->get("g2_itemId"); - if ($id) { - // Requests by id are either core.DownloadItem or core.ShowItem requests. Later versions of - // 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) { - $where[] = array("g2_url", "like", "%g2_view=$view%"); - } // else: Assuming that the first search hit is sufficiently good. - } else if ($path) { - $where = array(array("g2_url", "=", $path)); - } else { - throw new Kohana_404_Exception(); - } + if ($path || $id) { + if ($id) { + // Requests by id are either core.DownloadItem or core.ShowItem requests. Later versions of + // 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) { + $where[] = array("g2_url", "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)))); + } else { + throw new Kohana_404_Exception(); + } - $g2_map = ORM::factory("g2_map") - ->merge_where($where) - ->find(); + $g2_map = ORM::factory("g2_map") + ->merge_where($where) + ->find(); - if (!$g2_map->loaded()) { - throw new Kohana_404_Exception(); - } + if (!$g2_map->loaded()) { + throw new Kohana_404_Exception(); + } - $item = ORM::factory("item", $g2_map->g3_id); - if (!$item->loaded()) { - throw new Kohana_404_Exception(); + $item = ORM::factory("item", $g2_map->g3_id); + if (!$item->loaded()) { + throw new Kohana_404_Exception(); + } + $resource_type = $g2_map->resource_type; + } else { + $item = item::root(); + $resource_type = "album"; } access::required("view", $item); // Redirect the user to the new url - switch ($g2_map->resource_type) { + switch ($resource_type) { case "thumbnail": url::redirect($item->thumb_url(true)); diff --git a/modules/g2_import/css/g2_import.css b/modules/g2_import/css/g2_import.css deleted file mode 100644 index d53564d7..00000000 --- a/modules/g2_import/css/g2_import.css +++ /dev/null @@ -1,30 +0,0 @@ -#g-admin-g2-import-notes { - padding-bottom: 20px; -} - -#g-admin-g2-import-details { - padding-top: 20px; -} - -#g-admin-g2-import-details .g-warning { - margin-top: 4px; -} - -#g-admin-g2-import-details .g-info { - padding: 2px; - border: 1px solid #999; - margin-bottom: 10px; -} - -#g-admin-g2-import-notes p, -#g-admin-g2-import-details .g-info p { - padding: 0; - margin: 0; -} - -#g-admin-g2-import-notes ul li, -#g-admin-g2-import .g-info ul li { - padding-left: 0; - margin-left: 20px; - list-style-type: disc; -} diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index c3737f8f..515eb73d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -452,9 +452,9 @@ class g2_import_Core { "title" => "title", "viewCount" => "view_count"); $direction_map = array( - 1 => "asc", - ORDER_ASCENDING => "asc", - ORDER_DESCENDING => "desc"); + 1 => "ASC", + ORDER_ASCENDING => "ASC", + ORDER_DESCENDING => "DESC"); // Only consider G2's first sort order $g2_order = explode("|", $g2_album->getOrderBy() . ""); $g2_order = $g2_order[0]; diff --git a/modules/g2_import/helpers/g2_import_theme.php b/modules/g2_import/helpers/g2_import_theme.php deleted file mode 100644 index 788253f9..00000000 --- a/modules/g2_import/helpers/g2_import_theme.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access."); -/** - * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2010 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 g2_import_theme_Core { - static function head($theme) { - $theme->css("g2_import.css"); - } - - static function admin_head($theme) { - $theme->css("g2_import.css"); - } -}
\ No newline at end of file diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 8ec4b5ce..564bea9f 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -6,29 +6,10 @@ </p> <div class="g-block-content"> - <div id="g-admin-g2-import-notes"> - <h2> <?= t("Notes") ?> </h2> - <p> - <?= t("The import process is a work in progress with some known issues:") ?> - </p> - <ul> - <li> - <?= t("Gallery 3 does not support per-user / per-item permissions. <b>Review permissions after your import is done.</b>") ?> - </li> - <li> - <?= t("The only supported file formats are JPG, PNG and GIF, FLV and MP4. Other formats will be skipped.") ?> - </li> - <li> - <?= t("Deactivating the <b>notification</b>, <b>search</b> and <b>exif</b> modules during your import will make it go faster.") ?> - </li> - <li> - <?= t("The eAccelerator PHP performance extension is known to cause issues. If you're using eAccelerator and having problems, please disable it while you do your import. One way to do that is to put <code>php_value eaccelerator.enable 0</code> in gallery3/.htaccess") ?> - </li> - </ul> - </div> - <?= $form ?> + </div> + <div class="g-block-content"> <? if (g2_import::is_initialized()): ?> <div id="g-admin-g2-import-details"> <h2> <?= t("Import") ?> </h2> @@ -53,59 +34,65 @@ "url" => html::mark_clean(url::site("admin/theme_options")))) ?> </li> <? endif ?> + + <li class="g-info"> + <?= t("Your Gallery 2 has the following importable data in it:") ?> + <p> + <?= t2("1 user", "%count users", $g2_stats["users"]) ?>, + <?= t2("1 group", "%count groups", $g2_stats["groups"]) ?>, + <?= t2("1 album", "%count albums", $g2_stats["albums"]) ?>, + <?= t2("1 photo", "%count photos", $g2_stats["photos"]) ?>, + <?= t2("1 movie", "%count movies", $g2_stats["movies"]) ?>, + <?= t2("1 comment", "%count comments", $g2_stats["comments"]) ?>, + <?= t2("1 tagged photo/movie/album", + "%count tagged photos/movies/albums", $g2_stats["tags"]) ?> + </p> + </li> </ul> - <div class="g-message-block g-info"> - <p> - <?= t("Your Gallery 2 has the following importable data in it") ?> - </p> - <ul> - <li> - <?= t2("1 user", "%count users", $g2_stats["users"]) ?> - </li> - <li> - <?= t2("1 group", "%count groups", $g2_stats["groups"]) ?> - </li> - <li> - <?= t2("1 album", "%count albums", $g2_stats["albums"]) ?> - </li> + <p> + <a class="g-button g-dialog-link ui-state-default ui-corner-all" + href="<?= url::site("admin/maintenance/start/g2_import_task::import?csrf=$csrf") ?>"> + <?= t("Begin import!") ?> + </a> + </p> + </div> + + <div class="g-block-content"> + <div id="g-admin-g2-import-notes"> + <h2> <?= t("Notes") ?> </h2> + <ul class="enumeration"> <li> - <?= t2("1 photo", "%count photos", $g2_stats["photos"]) ?> + <?= t("Gallery 3 does not support per-user / per-item permissions. <b>Review permissions after your import is done.</b>") ?> </li> <li> - <?= t2("1 movie", "%count movies", $g2_stats["movies"]) ?> + <?= t("The only supported file formats are JPG, PNG and GIF, FLV and MP4. Other formats will be skipped.") ?> </li> <li> - <?= t2("1 comment", "%count comments", $g2_stats["comments"]) ?> + <?= t("Deactivating the <b>notification</b>, <b>search</b> and <b>exif</b> modules during your import will make it go faster.") ?> </li> <li> - <?= t2("1 tagged photo/movie/album", - "%count tagged photos/movies/albums", $g2_stats["tags"]) ?> + <?= t("The eAccelerator and XCache PHP performance extensions are known to cause issues. If you're using either of those and are having problems, please disable them while you do your import. Add the following lines: <pre>%lines</pre> to gallery3/.htaccess and remove them when the import is done.", array("lines" => "\n\n php_value eaccelerator.enable 0\n php_value xcache.cacher off\n php_value xcache.optimizer off\n\n")) ?> </li> </ul> </div> - - <p> - <a class="g-button g-dialog-link ui-state-default ui-corner-all" - href="<?= url::site("admin/maintenance/start/g2_import_task::import?csrf=$csrf") ?>"> - <?= t("Begin import!") ?> - </a> - </p> </div> - <div> - <h2> <?= t("Migrating from Gallery 2") ?> </h2> - <p> - <?= t("Once your migration is complete, put this block at the top of your gallery2/.htaccess file and all Gallery 2 urls will be redirected to Gallery 3") ?> - </p> + <div class="g-block-content"> + <div> + <h2> <?= t("Migrating from Gallery 2") ?> </h2> + <p> + <?= t("Once your migration is complete, put this block at the top of your gallery2/.htaccess file and all Gallery 2 urls will be redirected to Gallery 3") ?> + </p> - <textarea rows="2"><IfModule mod_rewrite.c> + <textarea rows="4" cols="60"><IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase <?= html::clean(g2_import::$g2_base_url) ?> RewriteRule ^(.*)$ <?= url::site("g2/map?path=\$1") ?> [QSA,L,R=301] </IfModule></textarea> + </div> + <? endif ?> </div> - <? endif ?> </div> </div> |