aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/edit.php7
-rw-r--r--lib/album.php7
-rw-r--r--lib/migrate.php2
-rw-r--r--lib/tidypics.php123
-rw-r--r--pages/edit_multiple.php9
-rw-r--r--pages/lists/mostrecentimages.php8
-rw-r--r--pages/ownedalbums.php16
-rw-r--r--pages/world.php7
-rw-r--r--start.php16
-rw-r--r--upgrades/2010073101.php7
-rw-r--r--views/default/river/object/album/create.php7
-rw-r--r--views/default/tidypics/albums.php7
-rw-r--r--views/default/tidypics/forms/ajax_upload.php2
-rw-r--r--views/default/tidypics/forms/setupFlickr.php6
-rw-r--r--views/rss/object/album.php6
15 files changed, 94 insertions, 136 deletions
diff --git a/actions/edit.php b/actions/edit.php
index cca66941a..df65448c8 100644
--- a/actions/edit.php
+++ b/actions/edit.php
@@ -36,7 +36,12 @@ if ($subtype == 'album' && $entity->access_id != $access) {
$entity->access_id = $access;
//get images from album and update access on image entities
- $images = get_entities("object","image", $guid, '', 999, '', false);
+ $images = elgg_get_entities(array(
+ "type" => "object",
+ "subtype" => "image",
+ "container_guid" => $guid,
+ "limit" => ELGG_ENTITIES_NO_VALUE,
+ ));
foreach ($images as $im) {
$im->access_id = $access;
$im->save();
diff --git a/lib/album.php b/lib/album.php
index 0d5140875..e178acd5d 100644
--- a/lib/album.php
+++ b/lib/album.php
@@ -209,7 +209,12 @@ class TidypicsAlbum extends ElggObject {
protected function deleteImages() {
// get all the images from this album as long as less than 999 images
- $images = get_entities("object", "image", $this->guid, '', 999);
+ $images = elgg_get_entities(array(
+ "type=" => "object",
+ "subtype" => "image",
+ "container_guid" => $this->guid,
+ "limit" => ELGG_ENTITIES_NO_VALUE,
+ ));
if ($images) {
foreach ($images as $image) {
if ($image) {
diff --git a/lib/migrate.php b/lib/migrate.php
index f8e68a1be..8c62126f0 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -4,6 +4,8 @@
*
* Supports moving photos from the files plugin to Tidypics. All of a users
* photos end up in a single album.
+ *
+ * Not supported
*/
// need access to ElggDiskFilestore::make_file_matrix(), which is protected.
diff --git a/lib/tidypics.php b/lib/tidypics.php
index 67d69e0da..581503a51 100644
--- a/lib/tidypics.php
+++ b/lib/tidypics.php
@@ -34,7 +34,14 @@
function tp_get_latest_photos($num_images, $owner_guid = 0, $context = 'front') {
$prev_context = get_context();
set_context($context);
- $image_html = tp_list_entities('object', 'image', $owner_guid, null, $num_images, false, false, false);
+ $image_html = elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'owner_guid' => $owner_guid,
+ 'limit' => $num_images,
+ 'full_view' => false,
+ 'pagination' => false,
+ ));
set_context($prev_context);
return $image_html;
}
@@ -59,120 +66,6 @@ function tp_get_img_dir() {
* that could/should exist in the core
*/
-/**
- *
- */
-function tp_get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupper = 0) {
- global $CONFIG;
-
- if ($subtype === false || $subtype === null || $subtype === 0)
- return false;
-
- if ($order_by == "") $order_by = "time_created desc";
- $order_by = sanitise_string($order_by);
- $limit = (int)$limit;
- $offset = (int)$offset;
- $site_guid = (int) $site_guid;
- $timelower = (int) $timelower;
- $timeupper = (int) $timeupper;
- if ($site_guid == 0)
- $site_guid = $CONFIG->site_guid;
-
- $where = array();
-
- if (is_array($subtype)) {
- $tempwhere = "";
- if (sizeof($subtype))
- foreach($subtype as $typekey => $subtypearray) {
- foreach($subtypearray as $subtypeval) {
- $typekey = sanitise_string($typekey);
- if (!empty($subtypeval)) {
- if (!$subtypeval = (int) get_subtype_id($typekey, $subtypeval))
- return false;
- } else {
- // @todo: Setting subtype to 0 when $subtype = '' returns entities with
- // no subtype. This is different to the non-array behavior
- // but may be required in some cases.
- $subtypeval = 0;
- }
- if (!empty($tempwhere)) $tempwhere .= " or ";
- $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
- }
- }
- if (!empty($tempwhere)) $where[] = "({$tempwhere})";
-
- } else {
-
- $type = sanitise_string($type);
- if ($subtype !== "" AND !$subtype = get_subtype_id($type, $subtype))
- return false;
-
- if ($type != "")
- $where[] = "type='$type'";
- if ($subtype!=="")
- $where[] = "subtype=$subtype";
- }
-
- if ($owner_guid != "") {
- if (!is_array($owner_guid)) {
- $owner_array = array($owner_guid);
- $owner_guid = (int) $owner_guid;
- $where[] = "owner_guid = '$owner_guid'";
- } else if (sizeof($owner_guid) > 0) {
- $owner_array = array_map('sanitise_int', $owner_guid);
- // Cast every element to the owner_guid array to int
- $owner_guid = array_map("sanitise_int", $owner_guid);
- $owner_guid = implode(",",$owner_guid);
- $where[] = "owner_guid in ({$owner_guid})";
- }
- }
- if ($site_guid > 0)
- $where[] = "site_guid = {$site_guid}";
-
- if (!is_null($container_guid)) {
- if (is_array($container_guid)) {
- foreach($container_guid as $key => $val) $container_guid[$key] = (int) $val;
- $where[] = "container_guid in (" . implode(",",$container_guid) . ")";
- } else {
- $container_guid = (int) $container_guid;
- $where[] = "container_guid = {$container_guid}";
- }
- }
- if ($timelower)
- $where[] = "time_created >= {$timelower}";
- if ($timeupper)
- $where[] = "time_created <= {$timeupper}";
-
- if (!$count) {
- $query = "SELECT * from {$CONFIG->dbprefix}entities where ";
- } else {
- $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where ";
- }
- foreach ($where as $w)
- $query .= " $w and ";
- $query .= get_access_sql_suffix(); // Add access controls
-
- if (!$count) {
- $query .= " order by $order_by";
- if ($limit) $query .= " limit $offset, $limit"; // Add order and limit
- $dt = get_data($query, "entity_row_to_elggstar");
- return $dt;
- } else {
- $total = get_data_row($query);
- return $total->total;
- }
-}
-
-function tp_list_entities($type= "", $subtype = "", $owner_guid = 0, $container_guid = null, $limit = 10, $fullview = true, $viewtypetoggle = false, $pagination = true) {
-
- $offset = (int) get_input('offset');
- $count = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset, true, 0, $container_guid);
-
- $entities = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset, false, 0, $container_guid);
-
- return tp_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
-}
-
function tp_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtypetoggle = false, $pagination = true) {
$context = get_context();
diff --git a/pages/edit_multiple.php b/pages/edit_multiple.php
index 938ac203c..7c7b989cf 100644
--- a/pages/edit_multiple.php
+++ b/pages/edit_multiple.php
@@ -15,7 +15,14 @@ set_page_owner(get_loggedin_userid());
$batch = get_input('batch');
if ($batch) {
- $images = get_entities_from_metadata('batch', $batch, 'object', 'image', get_loggedin_userid(), 100);
+ $images = elgg_get_entities_from_metadata(array(
+ 'metadata_name' => 'batch',
+ 'metadata_value' => $batch,
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'owner_guid' => get_loggedin_userid(),
+ 'limit' => ELGG_ENTITIES_NO_VALUE,
+ ));
} else {
// parse out photo guids
$file_string = get_input('files');
diff --git a/pages/lists/mostrecentimages.php b/pages/lists/mostrecentimages.php
index 722f1fc32..0a2595c85 100644
--- a/pages/lists/mostrecentimages.php
+++ b/pages/lists/mostrecentimages.php
@@ -44,7 +44,13 @@ if ($slideshow_link) {
$max = 12;
// grab the html to display the images
-$images = tp_list_entities("object", "image", $user_id, null, $max, false, false, true);
+$images = elgg_list_entities(array(
+ "type" => "object",
+ "subtype" => "image",
+ "owner_guid" => $user_id,
+ "limit" => $max,
+ "full_view" => false,
+));
// this view takes care of the title on the main column and the content wrapper
diff --git a/pages/ownedalbums.php b/pages/ownedalbums.php
index 67583c65c..9483512c6 100644
--- a/pages/ownedalbums.php
+++ b/pages/ownedalbums.php
@@ -41,9 +41,21 @@ $area2 = elgg_view_title($title);
set_context('search');
set_input('search_viewtype', 'gallery');
if ($owner instanceof ElggGroup) {
- $content .= tp_list_entities("object", "album", 0, $owner->guid, 12, false);
+ $content .= elgg_list_entities(array(
+ "type" => "object",
+ "subtype" => "album",
+ "container_guid" => $owner->guid,
+ "limit" => 12,
+ "full_view" => false,
+));
} else {
- $content .= tp_list_entities("object", "album", $owner->guid, $owner->guid, 12, false);
+ $content .= elgg_list_entities(array(
+ "type" => "object",
+ "subtype" => "album",
+ "container_guid" => $owner->guid,
+ "limit" => 12,
+ "full_view" => false,
+));
}
$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
diff --git a/pages/world.php b/pages/world.php
index fe97a882d..25a69da52 100644
--- a/pages/world.php
+++ b/pages/world.php
@@ -18,7 +18,12 @@ $area2 = elgg_view_title($title);
set_context('search');
set_input('search_viewtype', 'gallery');
-$content .= tp_list_entities('object','album', 0, null, $num_albums, false);
+$content .= elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'album',
+ 'limit' => $num_albums,
+ 'pagination' => false,
+));
set_context('photos');
$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
diff --git a/start.php b/start.php
index 1401c2c2c..d7110dfd0 100644
--- a/start.php
+++ b/start.php
@@ -25,17 +25,17 @@ function tidypics_init() {
}
// Extend CSS
- extend_view('css', 'tidypics/css');
+ elgg_extend_view('css', 'tidypics/css');
// Extend hover-over and profile menu
- extend_view('profile/menu/links','tidypics/hover_menu');
+ elgg_extend_view('profile/menu/links','tidypics/hover_menu');
//group view ** psuedo widget view for group pages**
- extend_view('groups/right_column','tidypics/groupprofile_albums');
+ elgg_extend_view('groups/right_column','tidypics/groupprofile_albums');
// rss extensions
- extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
- extend_view('extensions/channel', 'extensions/tidypics/channel');
+ elgg_extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
+ elgg_extend_view('extensions/channel', 'extensions/tidypics/channel');
// Register a page handler, so we can have nice URLs
register_page_handler('photos','tidypics_page_handler');
@@ -69,8 +69,8 @@ function tidypics_init() {
// slideshow plugin hook
register_plugin_hook('tp_slideshow', 'album', 'tidypics_slideshow');
- // ajax handler for uploads when use_only_cookies is set
- register_plugin_hook('forward', 'system', 'tidypics_ajax_session_handler');
+ // ajax handler for uploads when use_only_cookies is set
+ register_plugin_hook('forward', 'system', 'tidypics_ajax_session_handler');
}
/**
@@ -456,7 +456,7 @@ function tidypics_slideshow($hook, $entity_type, $returnvalue, $params) {
$slideshow_link = "javascript:PicLensLite.start({maxScale:0,feedUrl:location.href+'?view=rss'})";
// add the slideshow javascript to the header
- extend_view('metatags', 'tidypics/js/slideshow');
+ elgg_extend_view('metatags', 'tidypics/js/slideshow');
return $slideshow_link;
}
diff --git a/upgrades/2010073101.php b/upgrades/2010073101.php
index 20fd33144..587490500 100644
--- a/upgrades/2010073101.php
+++ b/upgrades/2010073101.php
@@ -11,7 +11,12 @@ while ($guid_obj = mysql_fetch_object($album_guids)) {
$DB_QUERY_CACHE = $DB_PROFILE = $ENTITY_CACHE = array();
$album = get_entity($guid_obj->guid);
- $images = get_entities("object", "image", $album->guid, '', 9999);
+ $images = elgg_get_entities(array(
+ "type" => "object",
+ "subtype" => "image",
+ "container_guid" => $album->guid,
+ "limit" => ELGG_ENTITIES_NO_VALUE,
+ ));
$image_list = array();
foreach ($images as $image) {
$image_list[] = $image->guid;
diff --git a/views/default/river/object/album/create.php b/views/default/river/object/album/create.php
index 47d20f3ae..4d797d842 100644
--- a/views/default/river/object/album/create.php
+++ b/views/default/river/object/album/create.php
@@ -28,7 +28,12 @@ if ($album_river_view == "cover") {
$string .= "<div class=\"river_content\">";
- $images = get_entities("object", "image", $album->guid, 'time_created desc', 7);
+ $images = elgg_get_entities(array(
+ "type" => "object",
+ "subtype" => "image",
+ "container_guid" => $album->guid,
+ "limit" => 7,
+ ));
if (count($images)) {
foreach($images as $image) {
diff --git a/views/default/tidypics/albums.php b/views/default/tidypics/albums.php
index 7e0cd2d6c..61daadba7 100644
--- a/views/default/tidypics/albums.php
+++ b/views/default/tidypics/albums.php
@@ -7,7 +7,12 @@ if (!$number) {
}
$owner = page_owner_entity();
-$owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false);
+$owner_albums = elgg_get_entities(array(
+ "type" => "object",
+ "subtype" => "album",
+ "container_guid" => page_owner(),
+ "limit" => $number,
+));
echo '<div id="tidypics_album_widget_container">';
diff --git a/views/default/tidypics/forms/ajax_upload.php b/views/default/tidypics/forms/ajax_upload.php
index c81c9173d..4a7a05c0c 100644
--- a/views/default/tidypics/forms/ajax_upload.php
+++ b/views/default/tidypics/forms/ajax_upload.php
@@ -1,6 +1,6 @@
<?php
-extend_view('metatags', 'tidypics/js/uploader');
+elgg_extend_view('metatags', 'tidypics/js/uploader');
$album = $vars['album'];
diff --git a/views/default/tidypics/forms/setupFlickr.php b/views/default/tidypics/forms/setupFlickr.php
index 54f0a37d1..6c461176d 100644
--- a/views/default/tidypics/forms/setupFlickr.php
+++ b/views/default/tidypics/forms/setupFlickr.php
@@ -11,7 +11,11 @@ $form_body = "<p>". elgg_echo( 'flickr:intro' ) . "</p><p>";
$form_body .= elgg_echo( 'flickr:usernamesetup') . " <input style='width: 20%;' type='text' name='flickr_username' value='$flickr_username->value' ' class='input-text' /> <br />";
$form_body .= "<input type='hidden' name='return_url' value='$_SERVER[REQUEST_URI]' />";
-$albums = get_entities( "object", "album", $user->guid );
+$albums = elgg_get_entities(array(
+ "type=" => "object",
+ "subtype" => "album",
+ "owner_guid" => $user->guid,
+));
$options = array( 0 => elgg_echo( 'flickr:selectalbum' ));
foreach( $albums as $album ) {
$title = $album->title;
diff --git a/views/rss/object/album.php b/views/rss/object/album.php
index 8a8f97cc2..a37fdd041 100644
--- a/views/rss/object/album.php
+++ b/views/rss/object/album.php
@@ -43,7 +43,11 @@ if (get_context() == "search" && get_input('search_viewtype') == "gallery") {
}
- $images = get_entities("object", "image", 0, "", 0, 0, false, 0, $album->guid);
+ $images = elgg_get_entities(array(
+ "type" => "object",
+ "subtype" => "image",
+ "container_guid" => $album->guid,
+ ));
foreach ($images as $image) {