diff options
author | Nathan Kinkade <nath@nkinka.de> | 2013-05-24 12:12:57 +0000 |
---|---|---|
committer | Nathan Kinkade <nath@nkinka.de> | 2013-05-24 12:12:57 +0000 |
commit | 9569b43035de9645e82271896e302c8d082d960a (patch) | |
tree | 4dffbc9117e84d5fb9cf0a5806bf51ff2086ee95 /modules | |
parent | 3908e37d965fa76ea774e76ddf42365a872a5f27 (diff) | |
parent | b7177cfb2dcfb8b057a15757943c5e733d6c8917 (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 2 | ||||
-rw-r--r-- | modules/gallery/controllers/movies.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_task.php | 38 | ||||
-rw-r--r-- | modules/gallery/tests/File_Structure_Test.php | 5 | ||||
-rw-r--r-- | modules/gallery/tests/xss_data.txt | 3 | ||||
-rw-r--r-- | modules/gallery/views/error_admin.html.php | 2 | ||||
-rw-r--r-- | modules/gallery/views/form_uploadify.html.php | 2 | ||||
-rw-r--r-- | modules/server_add/js/server_add.js | 2 | ||||
-rw-r--r-- | modules/user/js/password_strength.js | 2 |
9 files changed, 41 insertions, 17 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index b155a88a..82850e85 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -498,7 +498,7 @@ class g2_import_Core { $album->description = self::_decode_html_special_chars(self::extract_description($g2_album)); $album->owner_id = self::map($g2_album->getOwnerId()); try { - $album->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); + $album->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_album->getId())); } catch (Exception $e) { // @todo log $album->view_count = 0; diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index ca332f67..56075710 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -67,7 +67,7 @@ class Movies_Controller extends Items_Controller { log::success("content", "Updated movie", "<a href=\"{$movie->url()}\">view</a>"); message::success( - t("Saved movie %movie_title", array("movie_title" => $movie->title))); + t("Saved movie %movie_title", array("movie_title" => html::purify($movie->title)))); if ($form->from_id->value == $movie->id) { // Use the new url; it might have changed. diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php index a79cb2d5..618cf8fd 100644 --- a/modules/gallery/helpers/gallery_task.php +++ b/modules/gallery/helpers/gallery_task.php @@ -398,42 +398,62 @@ class gallery_task_Core { switch ($state) { case self::FIX_STATE_START_MPTT: $task->set("ptr", $ptr = 1); - $task->set("stack", item::root()->id . ":L"); + $task->set("stack", item::root()->id . "L1"); $state = self::FIX_STATE_RUN_MPTT; break; case self::FIX_STATE_RUN_MPTT: $ptr = $task->get("ptr"); $stack = explode(" ", $task->get("stack")); - list ($id, $ptr_mode) = explode(":", array_pop($stack)); - if ($ptr_mode == "L") { - $stack[] = "$id:R"; + preg_match("/([0-9]+)([A-Z])([0-9]+)/", array_pop($stack), $matches); // e.g. "12345L10" + list ( , $id, $ptr_mode, $level) = $matches; // Skip the 0th entry of matches. + switch ($ptr_mode) { + case "L": + // Albums could be parent nodes. + $stack[] = "{$id}R{$level}"; db::build() ->update("items") ->set("left_ptr", $ptr++) ->where("id", "=", $id) ->execute(); + $level++; foreach (db::build() - ->select(array("id")) + ->select(array("id", "type")) ->from("items") ->where("parent_id", "=", $id) - ->order_by("left_ptr", "ASC") + ->order_by("left_ptr", "DESC") // DESC since array_pop effectively reverses them ->execute() as $child) { - array_push($stack, "{$child->id}:L"); + $stack[] = ($child->type == "album") ? "{$child->id}L{$level}" : "{$child->id}B{$level}"; } - } else if ($ptr_mode == "R") { + $completed++; + break; + case "B": + // Non-albums must be leaf nodes. db::build() ->update("items") + ->set("left_ptr", $ptr++) ->set("right_ptr", $ptr++) + ->set("level", $level) ->set("relative_path_cache", null) ->set("relative_url_cache", null) ->where("id", "=", $id) ->execute(); + $completed += 2; // we updated two pointers + break; + case "R": + db::build() + ->update("items") + ->set("right_ptr", $ptr++) + ->set("level", $level) + ->set("relative_path_cache", null) + ->set("relative_url_cache", null) + ->where("id", "=", $id) + ->execute(); + $completed++; } $task->set("ptr", $ptr); $task->set("stack", implode(" ", $stack)); - $completed++; if (empty($stack)) { $state = self::FIX_STATE_START_DUPE_SLUGS; diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php index ce75ea13..f46d9d64 100644 --- a/modules/gallery/tests/File_Structure_Test.php +++ b/modules/gallery/tests/File_Structure_Test.php @@ -175,6 +175,11 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { // Front controllers break; + case DOCROOT . "lib/uploadify/uploadify.php": + case DOCROOT . "lib/uploadify/uploadify.allglyphs.php": + // Uploadify wrappers - directly accessible + break; + case DOCROOT . "local.php": // Special case optional file, not part of the codebase break; diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 2152858a..8504de3a 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -177,11 +177,10 @@ modules/gallery/views/error_admin.html.php 284 DIRTY_ATTR $env modules/gallery/views/error_admin.html.php 285 DIRTY_JS $env_id modules/gallery/views/error_admin.html.php 285 DIRTY $var modules/gallery/views/error_admin.html.php 286 DIRTY_ATTR $env_id -modules/gallery/views/error_admin.html.php 292 DIRTY $key modules/gallery/views/error_admin.html.php 296 DIRTY Kohana_Exception::safe_dump($value,$key) modules/gallery/views/form_uploadify.html.php 16 DIRTY_JS url::site("uploader/status/_S/_E") modules/gallery/views/form_uploadify.html.php 24 DIRTY_JS $flash_minimum_version -modules/gallery/views/form_uploadify.html.php 28 DIRTY_JS url::file("lib/uploadify/uploadify.swf") +modules/gallery/views/form_uploadify.html.php 28 DIRTY_JS url::file("lib/uploadify/uploadify.php") modules/gallery/views/form_uploadify.html.php 29 DIRTY_JS url::site("uploader/add_photo/{$album->id}") modules/gallery/views/form_uploadify.html.php 31 DIRTY_JS implode(";",$extensions) modules/gallery/views/form_uploadify.html.php 33 DIRTY_JS url::file("lib/uploadify/cancel.png") diff --git a/modules/gallery/views/error_admin.html.php b/modules/gallery/views/error_admin.html.php index cd1bd569..036e2049 100644 --- a/modules/gallery/views/error_admin.html.php +++ b/modules/gallery/views/error_admin.html.php @@ -289,7 +289,7 @@ <tr> <td class="key"> <code> - <?= $key?> + <?= html::purify($key) ?> </code> </td> <td class="value"> diff --git a/modules/gallery/views/form_uploadify.html.php b/modules/gallery/views/form_uploadify.html.php index c13e3418..4963d185 100644 --- a/modules/gallery/views/form_uploadify.html.php +++ b/modules/gallery/views/form_uploadify.html.php @@ -25,7 +25,7 @@ $("#g-uploadify").uploadify({ width: 298, height: 32, - uploader: "<?= url::file("lib/uploadify/uploadify.swf") ?>", + uploader: "<?= url::file("lib/uploadify/uploadify.php") ?>", script: "<?= url::site("uploader/add_photo/{$album->id}") ?>", scriptData: <?= json_encode($script_data) ?>, fileExt: "<?= implode(";", $extensions) ?>", diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index a2499896..59901734 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -1,6 +1,6 @@ (function($) { $.widget("ui.gallery_server_add", { - _init: function() { + _create: function() { var self = this; $("#g-server-add-add-button", this.element).click(function(event) { event.preventDefault(); diff --git a/modules/user/js/password_strength.js b/modules/user/js/password_strength.js index c5fccc68..742db0ca 100644 --- a/modules/user/js/password_strength.js +++ b/modules/user/js/password_strength.js @@ -9,7 +9,7 @@ 'g-password-strength100'] }, - _init: function() { + _create: function() { var self = this; $(this.element).on("input keyup", function() { var strength = self.calculateStrength(this.value); |