summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/MY_url.php6
-rw-r--r--modules/gallery/helpers/access.php46
-rw-r--r--modules/gallery/helpers/album.php10
-rw-r--r--modules/gallery/helpers/gallery_block.php8
-rw-r--r--modules/gallery/helpers/gallery_event.php12
-rw-r--r--modules/gallery/helpers/gallery_rss.php4
-rw-r--r--modules/gallery/helpers/graphics.php10
-rw-r--r--modules/gallery/helpers/l10n_client.php6
-rw-r--r--modules/gallery/helpers/l10n_scanner.php2
-rw-r--r--modules/gallery/helpers/module.php11
-rw-r--r--modules/gallery/helpers/movie.php10
-rw-r--r--modules/gallery/helpers/photo.php10
-rw-r--r--modules/gallery/helpers/site_status.php4
13 files changed, 71 insertions, 68 deletions
diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php
index e5eefad7..a2b2e461 100644
--- a/modules/gallery/helpers/MY_url.php
+++ b/modules/gallery/helpers/MY_url.php
@@ -50,12 +50,12 @@ class url extends url_Core {
// In most cases, we'll have an exact match in the relative_url_cache item field.
// but failing that, walk down the tree until we find it. The fallback code will fix caches
// as it goes, so it'll never be run frequently.
- $item = ORM::factory("item")->where("relative_url_cache", $current_uri)->find();
+ $item = ORM::factory("item")->where("relative_url_cache", "=", $current_uri)->find();
if (!$item->loaded()) {
$count = count(Router::$segments);
foreach (ORM::factory("item")
- ->where("slug", html_entity_decode(Router::$segments[$count - 1], ENT_QUOTES))
- ->where("level", $count + 1)
+ ->where("slug", "=", html_entity_decode(Router::$segments[$count - 1], ENT_QUOTES))
+ ->where("level", "=", $count + 1)
->find_all() as $match) {
if ($match->relative_url() == $current_uri) {
$item = $match;
diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php
index d0200a73..445f9b86 100644
--- a/modules/gallery/helpers/access.php
+++ b/modules/gallery/helpers/access.php
@@ -166,11 +166,11 @@ class access_Core {
// For view permissions, if any parent is self::DENY, then those parents lock this one.
// Return
$lock = ORM::factory("item")
- ->where("`left_ptr` <= $item->left_ptr")
- ->where("`right_ptr` >= $item->right_ptr")
- ->where("items.id <> $item->id")
+ ->where("left_ptr", "<=", $item->left_ptr)
+ ->where("right_ptr", ">=", $item->right_ptr)
+ ->where("items.id", "<>", $item->id)
->join("access_intents", "items.id", "access_intents.item_id")
- ->where("access_intents.view_$group->id", self::DENY)
+ ->where("access_intents.view_$group->id", "=", self::DENY)
->order_by("level", "DESC")
->limit(1)
->find();
@@ -304,7 +304,7 @@ class access_Core {
foreach (self::_get_all_groups() as $group) {
self::_drop_columns($name, $group);
}
- $permission = ORM::factory("permission")->where("name", $name)->find();
+ $permission = ORM::factory("permission")->where("name", "=", $name)->find();
if ($permission->loaded()) {
$permission->delete();
}
@@ -354,7 +354,7 @@ class access_Core {
$access_cache->item_id = $item->id;
if ($item->id != 1) {
$parent_access_cache =
- ORM::factory("access_cache")->where("item_id", $item->parent()->id)->find();
+ ORM::factory("access_cache")->where("item_id", "=", $item->parent()->id)->find();
foreach (self::_get_all_groups() as $group) {
foreach (ORM::factory("permission")->find_all() as $perm) {
$field = "{$perm->name}_{$group->id}";
@@ -377,8 +377,8 @@ class access_Core {
* @return void
*/
static function delete_item($item) {
- ORM::factory("access_intent")->where("item_id", $item->id)->find()->delete();
- ORM::factory("access_cache")->where("item_id", $item->id)->find()->delete();
+ ORM::factory("access_intent")->where("item_id", "=", $item->id)->find()->delete();
+ ORM::factory("access_cache")->where("item_id", "=", $item->id)->find()->delete();
}
/**
@@ -475,7 +475,7 @@ class access_Core {
* @return void
*/
private static function _update_access_view_cache($group, $item) {
- $access = ORM::factory("access_intent")->where("item_id", $item->id)->find();
+ $access = ORM::factory("access_intent")->where("item_id", "=", $item->id)->find();
$db = Database::instance();
$field = "view_{$group->id}";
@@ -490,10 +490,10 @@ class access_Core {
// item, then its safe to propagate from here.
if ($access->$field !== self::DENY) {
$tmp_item = ORM::factory("item")
- ->where("left_ptr <", $item->left_ptr)
- ->where("right_ptr >", $item->right_ptr)
+ ->where("left_ptr", "<", $item->left_ptr)
+ ->where("right_ptr", ">", $item->right_ptr)
->join("access_intents", "access_intents.item_id", "items.id")
- ->where("access_intents.$field", self::DENY)
+ ->where("access_intents.$field", "=", self::DENY)
->order_by("left_ptr", "DESC")
->limit(1)
->find();
@@ -512,10 +512,10 @@ class access_Core {
$query = ORM::factory("access_intent")
->select(array("access_intents.$field", "items.left_ptr", "items.right_ptr", "items.id"))
->join("items", "items.id", "access_intents.item_id")
- ->where("left_ptr >=", $item->left_ptr)
- ->where("right_ptr <=", $item->right_ptr)
- ->where("type", "album")
- ->where("access_intents.$field IS NOT", self::INHERIT)
+ ->where("left_ptr", ">=", $item->left_ptr)
+ ->where("right_ptr", "<=", $item->right_ptr)
+ ->where("type", "=", "album")
+ ->where("access_intents.$field", "IS NOT", self::INHERIT)
->order_by("level", "DESC")
->find_all();
foreach ($query as $row) {
@@ -549,7 +549,7 @@ class access_Core {
* @return void
*/
private static function _update_access_non_view_cache($group, $perm_name, $item) {
- $access = ORM::factory("access_intent")->where("item_id", $item->id)->find();
+ $access = ORM::factory("access_intent")->where("item_id", "=", $item->id)->find();
$db = Database::instance();
$field = "{$perm_name}_{$group->id}";
@@ -562,9 +562,9 @@ class access_Core {
if ($access->$field === self::INHERIT) {
$tmp_item = ORM::factory("item")
->join("access_intents", "items.id", "access_intents.item_id")
- ->where("left_ptr <", $item->left_ptr)
- ->where("right_ptr >", $item->right_ptr)
- ->where("$field IS NOT", self::UNKNOWN)
+ ->where("left_ptr", "<", $item->left_ptr)
+ ->where("right_ptr", ">", $item->right_ptr)
+ ->where($field, "IS NOT", self::UNKNOWN)
->order_by("left_ptr", "DESC")
->limit(1)
->find();
@@ -578,9 +578,9 @@ class access_Core {
$query = ORM::factory("access_intent")
->select(array("access_intents.$field", "items.left_ptr", "items.right_ptr"))
->join("items", "items.id", "access_intents.item_id")
- ->where("left_ptr >=", $item->left_ptr)
- ->where("right_ptr <=", $item->right_ptr)
- ->where("$field IS NOT", self::INHERIT)
+ ->where("left_ptr", ">=", $item->left_ptr)
+ ->where("right_ptr", "<=", $item->right_ptr)
+ ->where($field, "IS NOT", self::INHERIT)
->order_by("level", "ASC")
->find_all();
foreach ($query as $row) {
diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php
index 84a60f83..cd8777e2 100644
--- a/modules/gallery/helpers/album.php
+++ b/modules/gallery/helpers/album.php
@@ -68,11 +68,11 @@ class album_Core {
// Randomize the name or slug if there's a conflict
// @todo Improve this. Random numbers are not user friendly
while (ORM::factory("item")
- ->where("parent_id", $parent->id)
- ->open_paren()
- ->where("name", $album->name)
- ->orwhere("slug", $album->slug)
- ->close_paren()
+ ->where("parent_id", "=", $parent->id)
+ ->and_open()
+ ->where("name", "=", $album->name)
+ ->orwhere("slug", "=", $album->slug)
+ ->close()
->find()->id) {
$rand = rand();
$album->name = "{$name}-$rand";
diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php
index d09f1c80..40660874 100644
--- a/modules/gallery/helpers/gallery_block.php
+++ b/modules/gallery/helpers/gallery_block.php
@@ -45,8 +45,8 @@ class gallery_block_Core {
$block->css_id = "g-photo-stream";
$block->title = t("Photo stream");
$block->content = new View("admin_block_photo_stream.html");
- $block->content->photos =
- ORM::factory("item")->where("type", "photo")->order_by("created", "DESC")->find_all(10);
+ $block->content->photos = ORM::factory("item")
+ ->where("type", "=", "photo")->order_by("created", "DESC")->find_all(10);
break;
case "log_entries":
@@ -62,8 +62,8 @@ class gallery_block_Core {
$block->title = t("Gallery stats");
$block->content = new View("admin_block_stats.html");
$block->content->album_count =
- ORM::factory("item")->where("type", "album")->where("id <>", 1)->count_all();
- $block->content->photo_count = ORM::factory("item")->where("type", "photo")->count_all();
+ ORM::factory("item")->where("type", "=", "album")->where("id", "<>", 1)->count_all();
+ $block->content->photo_count = ORM::factory("item")->where("type", "=", "photo")->count_all();
break;
case "platform_info":
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 02bfdf28..fa4db317 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -33,15 +33,15 @@ class gallery_event_Core {
$db = Database::instance();
$db->from("tasks")
->set(array("owner_id" => $admin->id))
- ->where(array("owner_id" => $user->id))
+ ->where("owner_id", "=", $user->id)
->update();
$db->from("items")
->set(array("owner_id" => $admin->id))
- ->where(array("owner_id" => $user->id))
+ ->where("owner_id", "=", $user->id)
->update();
$db->from("logs")
->set(array("user_id" => $admin->id))
- ->where(array("user_id" => $user->id))
+ ->where("user_id", "=", $user->id)
->update();
}
@@ -50,15 +50,15 @@ class gallery_event_Core {
$db = Database::instance();
$db->from("tasks")
->set(array("owner_id" => $admin->id))
- ->where("1 = 1")
+ ->where("1", "=", "1") // @todo why do we need this?
->update();
$db->from("items")
->set(array("owner_id" => $admin->id))
- ->where("1 = 1")
+ ->where("1", "=", "1") // @todo why do we need this?
->update();
$db->from("logs")
->set(array("user_id" => $admin->id))
- ->where("1 = 1")
+ ->where("1", "=", "1") // @todo why do we need this?
->update();
}
diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php
index e195be8d..93ace10b 100644
--- a/modules/gallery/helpers/gallery_rss.php
+++ b/modules/gallery/helpers/gallery_rss.php
@@ -29,13 +29,13 @@ class gallery_rss_Core {
case "latest":
$feed->children = ORM::factory("item")
->viewable()
- ->where("type !=", "album")
+ ->where("type", "<>", "album")
->order_by("created", "DESC")
->find_all($limit, $offset);
$all_children = ORM::factory("item")
->viewable()
- ->where("type !=", "album")
+ ->where("type", "<>", "album")
->order_by("created", "DESC");
$feed->max_pages = ceil($all_children->find_all()->count() / $limit);
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index aef09003..e45a5125 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -61,9 +61,9 @@ class graphics_Core {
*/
static function remove_rule($module_name, $target, $operation) {
ORM::factory("graphics_rule")
- ->where("module_name", $module_name)
- ->where("target", $target)
- ->where("operation", $operation)
+ ->where("module_name", "=", $module_name)
+ ->where("target", "=", $target)
+ ->where("operation", "=", $operation)
->delete_all();
self::mark_dirty($target == "thumb", $target == "resize");
@@ -181,8 +181,8 @@ class graphics_Core {
if (empty(self::$_rules_cache[$target])) {
$rules = array();
foreach (ORM::factory("graphics_rule")
- ->where("target", $target)
- ->where("active", true)
+ ->where("target", "=", $target)
+ ->where("active", "=", true)
->order_by("priority", "asc")
->find_all() as $rule) {
$rules[] = (object)$rule->as_array();
diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php
index aaf6ff46..14ab5a85 100644
--- a/modules/gallery/helpers/l10n_client.php
+++ b/modules/gallery/helpers/l10n_client.php
@@ -134,12 +134,14 @@ class l10n_client_Core {
// incoming_translations.message to be NULL?
$locale = $message_data->locale;
$entry = ORM::factory("incoming_translation")
- ->where(array("key" => $key, "locale" => $locale))
+ ->where("key", "=", $key)
+ ->where("locale", "=", $locale)
->find();
if (!$entry->loaded()) {
// @todo Load a message key -> message (text) dict into memory outside of this loop
$root_entry = ORM::factory("incoming_translation")
- ->where(array("key" => $key, "locale" => "root"))
+ ->where("key", "=", $key)
+ ->where("locale", "=", "root")
->find();
$entry->key = $key;
$entry->message = $root_entry->message;
diff --git a/modules/gallery/helpers/l10n_scanner.php b/modules/gallery/helpers/l10n_scanner.php
index 6c09a686..a7ce2c59 100644
--- a/modules/gallery/helpers/l10n_scanner.php
+++ b/modules/gallery/helpers/l10n_scanner.php
@@ -31,7 +31,7 @@ class l10n_scanner_Core {
foreach (Database::instance()
->select("key")
->from("incoming_translations")
- ->where("locale", "root")
+ ->where("locale", "=", "root")
->get() as $row) {
$cache[$row->key] = true;
}
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index b7e13b9a..d89b8401 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -354,7 +354,8 @@ class module_Core {
$row = db::build()
->select("value")
->from("vars")
- ->where(array("module_name" => "gallery", "name" => "_cache"))
+ ->where("module_name", "=", "gallery")
+ ->where("name", "=", "_cache")
->execute()
->current();
if ($row) {
@@ -395,8 +396,8 @@ class module_Core {
*/
static function set_var($module_name, $name, $value) {
$var = ORM::factory("var")
- ->where("module_name", $module_name)
- ->where("name", $name)
+ ->where("module_name", "=", $module_name)
+ ->where("name", "=", $name)
->find();
if (!$var->loaded()) {
$var->module_name = $module_name;
@@ -432,8 +433,8 @@ class module_Core {
*/
static function clear_var($module_name, $name) {
$var = ORM::factory("var")
- ->where("module_name", $module_name)
- ->where("name", $name)
+ ->where("module_name", "=", $module_name)
+ ->where("name", "=", $name)
->find();
if ($var->loaded()) {
$var->delete();
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index ff86403a..82247eb0 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -90,11 +90,11 @@ class movie_Core {
// Randomize the name if there's a conflict
// @todo Improve this. Random numbers are not user friendly
while (ORM::factory("item")
- ->where("parent_id", $parent->id)
- ->open_paren()
- ->where("name", $movie->name)
- ->orwhere("slug", $movie->slug)
- ->close_paren()
+ ->where("parent_id", "=", $parent->id)
+ ->and_open()
+ ->where("name", "=", $movie->name)
+ ->orwhere("slug", "=", $movie->slug)
+ ->close()
->find()->id) {
$rand = rand();
$movie->name = "{$name}.$rand.{$pi['extension']}";
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php
index 21cb13a0..2a563043 100644
--- a/modules/gallery/helpers/photo.php
+++ b/modules/gallery/helpers/photo.php
@@ -89,11 +89,11 @@ class photo_Core {
// Randomize the name or slug if there's a conflict
// @todo Improve this. Random numbers are not user friendly
while (ORM::factory("item")
- ->where("parent_id", $parent->id)
- ->open_paren()
- ->where("name", $photo->name)
- ->orwhere("slug", $photo->slug)
- ->close_paren()
+ ->where("parent_id", "=", $parent->id)
+ ->and_open()
+ ->where("name", "=", $photo->name)
+ ->orwhere("slug", "=", $photo->slug)
+ ->close()
->find()->id) {
$rand = rand();
$photo->name = "{$name}.$rand.{$pi['extension']}";
diff --git a/modules/gallery/helpers/site_status.php b/modules/gallery/helpers/site_status.php
index d58b935d..04316fff 100644
--- a/modules/gallery/helpers/site_status.php
+++ b/modules/gallery/helpers/site_status.php
@@ -67,7 +67,7 @@ class site_status_Core {
*/
private static function _add($msg, $severity, $permanent_key) {
$message = ORM::factory("message")
- ->where("key", $permanent_key)
+ ->where("key", "=", $permanent_key)
->find();
if (!$message->loaded()) {
$message->key = $permanent_key;
@@ -82,7 +82,7 @@ class site_status_Core {
* @param string $permanent_key
*/
static function clear($permanent_key) {
- $message = ORM::factory("message")->where("key", $permanent_key)->find();
+ $message = ORM::factory("message")->where("key", "=", $permanent_key)->find();
if ($message->loaded()) {
$message->delete();
}