summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/libraries')
-rw-r--r--modules/gallery/libraries/Admin_View.php2
-rw-r--r--modules/gallery/libraries/Menu.php4
-rw-r--r--modules/gallery/libraries/ORM_MPTT.php22
3 files changed, 16 insertions, 12 deletions
diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php
index 11f8ad14..bff13ace 100644
--- a/modules/gallery/libraries/Admin_View.php
+++ b/modules/gallery/libraries/Admin_View.php
@@ -46,7 +46,7 @@ class Admin_View_Core extends Gallery_View {
module::event("admin_menu", $menu, $this);
$settings_menu = $menu->get("settings_menu");
- sort($settings_menu->elements);
+ uasort($settings_menu->elements, array("Menu", "title_comparator"));
return $menu->render();
}
diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php
index 58852a72..78b60196 100644
--- a/modules/gallery/libraries/Menu.php
+++ b/modules/gallery/libraries/Menu.php
@@ -250,4 +250,8 @@ class Menu_Core extends Menu_Element {
$view->menu = $this;
return $view;
}
+
+ static function title_comparator($a, $b) {
+ return strnatcasecmp((string)$a->label, (string)$b->label);
+ }
}
diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php
index f20fafa0..4556273c 100644
--- a/modules/gallery/libraries/ORM_MPTT.php
+++ b/modules/gallery/libraries/ORM_MPTT.php
@@ -54,12 +54,12 @@ class ORM_MPTT_Core extends ORM {
// Make a hole in the parent for this new item
db::build()
->update($this->table_name)
- ->set("left_ptr", new Database_Expression("`left_ptr` + 2"))
+ ->set("left_ptr", db::expr("`left_ptr` + 2"))
->where("left_ptr", ">=", $parent->right_ptr)
->execute();
db::build()
->update($this->table_name)
- ->set("right_ptr", new Database_Expression("`right_ptr` + 2"))
+ ->set("right_ptr", db::expr("`right_ptr` + 2"))
->where("right_ptr", ">=", $parent->right_ptr)
->execute();
$parent->right_ptr += 2;
@@ -109,12 +109,12 @@ class ORM_MPTT_Core extends ORM {
try {
db::build()
->update($this->table_name)
- ->set("left_ptr", new Database_Expression("`left_ptr` - 2"))
+ ->set("left_ptr", db::expr("`left_ptr` - 2"))
->where("left_ptr", ">", $this->right_ptr)
->execute();
db::build()
->update($this->table_name)
- ->set("right_ptr", new Database_Expression("`right_ptr` - 2"))
+ ->set("right_ptr", db::expr("`right_ptr` - 2"))
->where("right_ptr", ">", $this->right_ptr)
->execute();
} catch (Exception $e) {
@@ -253,7 +253,7 @@ class ORM_MPTT_Core extends ORM {
// Update the levels for the to-be-moved items
db::build()
->update($this->table_name)
- ->set("level", new Database_Expression("`level` + $level_delta"))
+ ->set("level", db::expr("`level` + $level_delta"))
->where("left_ptr", ">=", $original_left_ptr)
->where("right_ptr", "<=", $original_right_ptr)
->execute();
@@ -262,12 +262,12 @@ class ORM_MPTT_Core extends ORM {
// Make a hole in the target for the move
db::build()
->update($this->table_name)
- ->set("left_ptr", new Database_Expression("`left_ptr` + $size_of_hole"))
+ ->set("left_ptr", db::expr("`left_ptr` + $size_of_hole"))
->where("left_ptr", ">=", $target_right_ptr)
->execute();
db::build()
->update($this->table_name)
- ->set("right_ptr", new Database_Expression("`right_ptr` + $size_of_hole"))
+ ->set("right_ptr", db::expr("`right_ptr` + $size_of_hole"))
->where("right_ptr", ">=", $target_right_ptr)
->execute();
@@ -290,8 +290,8 @@ class ORM_MPTT_Core extends ORM {
$new_offset = $target->right_ptr - $left_ptr;
db::build()
->update($this->table_name)
- ->set("left_ptr", new Database_Expression("`left_ptr` + $new_offset"))
- ->set("right_ptr", new Database_Expression("`right_ptr` + $new_offset"))
+ ->set("left_ptr", db::expr("`left_ptr` + $new_offset"))
+ ->set("right_ptr", db::expr("`right_ptr` + $new_offset"))
->where("left_ptr", ">=", $left_ptr)
->where("right_ptr", "<=", $right_ptr)
->execute();
@@ -299,12 +299,12 @@ class ORM_MPTT_Core extends ORM {
// Close the hole in the source's parent after the move
db::build()
->update($this->table_name)
- ->set("left_ptr", new Database_Expression("`left_ptr` - $size_of_hole"))
+ ->set("left_ptr", db::expr("`left_ptr` - $size_of_hole"))
->where("left_ptr", ">", $right_ptr)
->execute();
db::build()
->update($this->table_name)
- ->set("right_ptr", new Database_Expression("`right_ptr` - $size_of_hole"))
+ ->set("right_ptr", db::expr("`right_ptr` - $size_of_hole"))
->where("right_ptr", ">", $right_ptr)
->execute();
} catch (Exception $e) {