aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/annotations.php14
-rw-r--r--engine/lib/database.php1
-rw-r--r--engine/lib/filestore.php10
-rw-r--r--engine/lib/group.php16
-rw-r--r--engine/lib/metadata.php2
-rw-r--r--engine/lib/plugins.php11
-rw-r--r--engine/lib/relationships.php2
-rw-r--r--engine/lib/tags.php2
8 files changed, 25 insertions, 33 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 0bb29c408..c960da014 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -18,7 +18,8 @@ require_once('extender.php');
/**
* ElggAnnotation
*
- * An annotation is similar to metadata each entity can contain more than one of each annotation.
+ * An annotation is similar to metadata.
+ * Each entity can have more than one of each type of annotation.
*
* @package Elgg
* @subpackage Core
@@ -27,7 +28,7 @@ require_once('extender.php');
class ElggAnnotation extends ElggExtender {
/**
- * Construct a new site object, optionally from a given id value or db row.
+ * Construct a new annotation, optionally from a given id value or db object.
*
* @param mixed $id
*/
@@ -87,14 +88,14 @@ class ElggAnnotation extends ElggExtender {
$this->value_type, $this->owner_guid, $this->access_id);
if (!$this->id) {
- throw new IOException(sprintf(elgg_new('IOException:UnableToSaveNew'), get_class()));
+ throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
}
return $this->id;
}
}
/**
- * Delete a given site.
+ * Delete the annotation.
*/
function delete() {
return delete_annotation($this->id);
@@ -125,7 +126,7 @@ class ElggAnnotation extends ElggExtender {
* Convert a database row to a new ElggAnnotation
*
* @param stdClass $row
- * @return stdClass or ElggAnnotation
+ * @return ElggAnnotation
*/
function row_to_elggannotation($row) {
if (!($row instanceof stdClass)) {
@@ -139,6 +140,7 @@ function row_to_elggannotation($row) {
* Get a specific annotation.
*
* @param int $annotation_id
+ * @return ElggAnnotation
*/
function get_annotation($annotation_id) {
global $CONFIG;
@@ -158,6 +160,7 @@ function get_annotation($annotation_id) {
* @param string $value_type
* @param int $owner_guid
* @param int $access_id
+ * @return int|bool id on success or false on failure
*/
function create_annotation($entity_guid, $name, $value, $value_type, $owner_guid, $access_id = ACCESS_PRIVATE) {
global $CONFIG;
@@ -220,6 +223,7 @@ function create_annotation($entity_guid, $name, $value, $value_type, $owner_guid
* @param string $value_type
* @param int $owner_guid
* @param int $access_id
+ * @return bool
*/
function update_annotation($annotation_id, $name, $value, $value_type, $owner_guid, $access_id) {
global $CONFIG;
diff --git a/engine/lib/database.php b/engine/lib/database.php
index 58685bb82..c8945e2d1 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -280,6 +280,7 @@ function get_data($query, $callback = "") {
if (empty($resultarray)) {
elgg_log("DB query \"$query\" returned no results.");
+ // @todo consider changing this to return empty array #1242
return false;
}
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index 4e92fee21..0a30f5551 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -951,13 +951,7 @@ function get_image_resize_parameters($width, $height, $options) {
}
// check for upscaling
- // @todo This ignores squares, coordinates, and cropping. It's probably not the best idea.
- // Size checking should be done in action code, but for backward compatibility
- // this duplicates the previous behavior.
if (!$upscale && ($height < $new_height || $width < $new_width)) {
- // zero out offsets
- $widthoffset = $heightoffset = 0;
-
// determine if we can scale it down at all
// (ie, if only one dimension is too small)
// if not, just use original size.
@@ -968,10 +962,9 @@ function get_image_resize_parameters($width, $height, $options) {
} elseif ($width < $new_width) {
$ratio = $new_height / $height;
}
+
$selection_height = $height;
$selection_width = $width;
- $new_height = floor($height * $ratio);
- $new_width = floor($width * $ratio);
}
$params = array(
@@ -986,7 +979,6 @@ function get_image_resize_parameters($width, $height, $options) {
return $params;
}
-
// putting these here for now
function file_delete($guid) {
if ($file = get_entity($guid)) {
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 68829dafb..474baf609 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -460,15 +460,11 @@ function remove_object_from_group($group_guid, $object_guid) {
* @param unknown_type $offset Where to start, by default 0.
* @param unknown_type $count Whether to return the entities or a count of them.
*/
-function get_objects_in_group($group_guid, $subtype = "", $owner_guid = 0, $site_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false) {
- global $CONFIG;
-
- if ($subtype === false || $subtype === null || $subtype === 0) {
- return false;
+function get_objects_in_group($group_guid, $subtype = "", $owner_guid = 0, $site_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = FALSE) {
+ if ($subtype === FALSE || $subtype === null || $subtype === 0) {
+ return FALSE;
}
- $subtype = get_subtype_id('object', $subtype);
-
if ($order_by == "") {
$order_by = "e.time_created desc";
}
@@ -488,7 +484,11 @@ function get_objects_in_group($group_guid, $subtype = "", $owner_guid = 0, $site
$where = array();
$where[] = "e.type='object'";
- if ($subtype!=="") {
+
+ if (!empty($subtype)) {
+ if (!$subtype = get_subtype_id('object', $subtype)) {
+ return FALSE;
+ }
$where[] = "e.subtype=$subtype";
}
if ($owner_guid != "") {
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index a6843e598..a07b0958d 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -88,7 +88,7 @@ class ElggMetadata extends ElggExtender {
} else {
$this->id = create_metadata($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
if (!$this->id) {
- throw new IOException(sprintf(elgg_new('IOException:UnableToSaveNew'), get_class()));
+ throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
}
return $this->id;
}
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index b8cf5c2d2..66b22a0aa 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -131,10 +131,10 @@ function get_plugin_list() {
* @param array $pluginorder Optionally, a list of existing plugins and their orders
* @return array The new list of plugins and their orders
*/
-function regenerate_plugin_list($pluginorder = false) {
+function regenerate_plugin_list($pluginorder = FALSE) {
global $CONFIG;
- $CONFIG->pluginlistcache = null;
+ $CONFIG->pluginlistcache = NULL;
if ($site = get_entity($CONFIG->site_guid)) {
if (empty($pluginorder)) {
@@ -187,15 +187,10 @@ function regenerate_plugin_list($pluginorder = false) {
$site->pluginorder = $plugins;
- // Regenerate caches
- elgg_view_regenerate_simplecache();
- elgg_filepath_cache_reset();
-
return $plugins;
-
}
- return false;
+ return FALSE;
}
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index dd59b8d3f..bf55a8932 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -91,7 +91,7 @@ class ElggRelationship implements
$this->id = add_entity_relationship($this->guid_one, $this->relationship, $this->guid_two);
if (!$this->id) {
- throw new IOException(sprintf(elgg_new('IOException:UnableToSaveNew'), get_class()));
+ throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
}
return $this->id;
diff --git a/engine/lib/tags.php b/engine/lib/tags.php
index ce1fbbf93..1d2b552ad 100644
--- a/engine/lib/tags.php
+++ b/engine/lib/tags.php
@@ -229,7 +229,7 @@ function elgg_get_tags(array $options = array()) {
$query .= get_access_sql_suffix('e');
$threshold = sanitise_int($options['threshold']);
- $query .= " GROUP BY msv.string HAVING total > {$threshold} ";
+ $query .= " GROUP BY msv.string HAVING total >= {$threshold} ";
$query .= " ORDER BY total DESC ";
$limit = sanitise_int($options['limit']);