summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/item.php5
-rw-r--r--modules/gallery/helpers/item_rest.php2
-rw-r--r--modules/gallery/helpers/items_rest.php20
-rw-r--r--modules/gallery/helpers/module.php7
4 files changed, 12 insertions, 22 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php
index 43c93225..bbbe1058 100644
--- a/modules/gallery/helpers/item.php
+++ b/modules/gallery/helpers/item.php
@@ -209,17 +209,14 @@ class item_Core {
/**
* Return a query to get a random Item_Model, with optional filters
- *
- * @param array (optional) where tuple
*/
- static function random_query($where=null) {
+ static function random_query() {
// Pick a random number and find the item that's got nearest smaller number.
// This approach works best when the random numbers in the system are roughly evenly
// distributed so this is going to be more efficient with larger data sets.
return ORM::factory("item")
->viewable()
->where("rand_key", "<", ((float)mt_rand()) / (float)mt_getrandmax())
- ->merge_where($where)
->order_by("rand_key", "DESC");
}
} \ No newline at end of file
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php
index ec86ce93..f99afbc2 100644
--- a/modules/gallery/helpers/item_rest.php
+++ b/modules/gallery/helpers/item_rest.php
@@ -152,7 +152,7 @@ class item_rest_Core {
$item->type = "album";
$item->parent_id = $parent->id;
$item->name = $entity->name;
- $item->title = isset($entity->title) ? $entity->title : $name;
+ $item->title = isset($entity->title) ? $entity->title : $entity->name;
$item->description = isset($entity->description) ? $entity->description : null;
$item->slug = isset($entity->slug) ? $entity->slug : null;
$item->save();
diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php
index 32597a65..9cca9a54 100644
--- a/modules/gallery/helpers/items_rest.php
+++ b/modules/gallery/helpers/items_rest.php
@@ -21,14 +21,14 @@ class items_rest_Core {
/**
* To retrieve a collection of items, you can specify the following query parameters to specify
* the type of the collection. If both are specified, then the url parameter is used and the
- * ancestor_for is ignored. Specifying the "type" parameter with the urls parameter, will
+ * ancestors_for is ignored. Specifying the "type" parameter with the urls parameter, will
* filter the results based on the specified type. Using the type parameter with the
- * ancestor_for parameter makes no sense and will be ignored.
+ * ancestors_for parameter makes no sense and will be ignored.
*
* urls=url1,url2,url3
* return items that match the specified urls. Typically used to return the member detail
*
- * ancestor_for=url
+ * ancestors_for=url
* return the ancestors of the specified item
*
* type=<comma separate list of photo, movie or album>
@@ -45,21 +45,21 @@ class items_rest_Core {
if (access::can("view", $item)) {
if (isset($types)) {
if (in_array($item->type, $types)) {
- $items[] = items_rest::format_restful_item($item);
+ $items[] = items_rest::_format_restful_item($item);
}
} else {
- $items[] = items_rest::format_restful_item($item);
+ $items[] = items_rest::_format_restful_item($item);
}
}
}
- } else if (isset($request->params->ancestor_for)) {
- $item = rest::resolve($request->params->ancestor_for);
+ } else if (isset($request->params->ancestors_for)) {
+ $item = rest::resolve($request->params->ancestors_for);
if (!access::can("view", $item)) {
throw new Kohana_404_Exception();
}
- $items[] = items_rest::format_restful_item($item);
+ $items[] = items_rest::_format_restful_item($item);
while (($item = $item->parent()) != null) {
- array_unshift($items, items_rest::format_restful_item($item));
+ array_unshift($items, items_rest::_format_restful_item($item));
};
}
@@ -74,7 +74,7 @@ class items_rest_Core {
return $item;
}
- private static function format_restful_item($item) {
+ private static function _format_restful_item($item) {
$item_rest = array("url" => rest::url("item", $item),
"entity" => $item->as_restful_array(),
"relationships" => rest::relationships("item", $item));
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index 18d65ed5..5134c7b3 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -214,13 +214,6 @@ class module_Core {
throw new Exception("@todo UNKNOWN_MODULE");
}
}
-
- // Now the module is upgraded so deactivate it, but we can'it deactivae gallery or the
- // current identity provider.
- $identity_provider = module::get_var("gallery", "identity_provider", "user");
- if (!in_array($module_name, array("gallery", $identity_provider)) ) {
- self::deactivate($module_name);
- }
module::load_modules();
$version_after = module::get_version($module_name);