aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/database.php4
-rw-r--r--engine/lib/elgglib.php26
-rw-r--r--engine/lib/input.php6
-rw-r--r--engine/lib/notification.php16
-rw-r--r--engine/lib/users.php1
-rw-r--r--engine/lib/views.php4
6 files changed, 40 insertions, 17 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index cc2b99f6a..7d90b30b8 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -253,6 +253,10 @@ function execute_query($query, $dblink) {
throw new DatabaseException(elgg_echo('DatabaseException:InvalidQuery'));
}
+ if (!is_resource($dblink)) {
+ throw new DatabaseException(elgg_echo('DatabaseException:InvalidDBLink'));
+ }
+
$dbcalls++;
$result = mysql_query($query, $dblink);
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 62cb2d5bb..3026a78e3 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1060,7 +1060,6 @@ function _elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
switch ($errno) {
case E_USER_ERROR:
- case E_RECOVERABLE_ERROR: // (e.g. type hint violation)
error_log("PHP ERROR: $error");
register_error("ERROR: $error");
@@ -1070,6 +1069,7 @@ function _elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
case E_WARNING :
case E_USER_WARNING :
+ case E_RECOVERABLE_ERROR: // (e.g. type hint violation)
error_log("PHP WARNING: $error");
break;
@@ -1265,7 +1265,7 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) {
$msg .= implode("<br /> -> ", $stack);
- elgg_dump($msg, elgg_is_admin_logged_in(), 'WARNING');
+ elgg_log($msg, 'WARNING');
return true;
}
@@ -1578,7 +1578,11 @@ function elgg_http_url_is_identical($url1, $url2, $ignore_params = array('offset
* @return void
* @since 1.8.0
*/
-function elgg_extract($key, array $array, $default = NULL, $strict = true) {
+function elgg_extract($key, array $array, $default = null, $strict = true) {
+ if (!is_array($array)) {
+ return $default;
+ }
+
if ($strict) {
return (isset($array[$key])) ? $array[$key] : $default;
} else {
@@ -2094,6 +2098,22 @@ function elgg_walled_garden() {
}
/**
+ * Remove public access for walled gardens
+ *
+ * @param string $hook
+ * @param string $type
+ * @param array $accesses
+ * @return array
+ * @access private
+ */
+function _elgg_walled_garden_remove_public_access($hook, $type, $accesses) {
+ if (isset($accesses[ACCESS_PUBLIC])) {
+ unset($accesses[ACCESS_PUBLIC]);
+ }
+ return $accesses;
+}
+
+/**
* Boots the engine
*
* 1. sets error handlers
diff --git a/engine/lib/input.php b/engine/lib/input.php
index dda8211b6..6d1646e1a 100644
--- a/engine/lib/input.php
+++ b/engine/lib/input.php
@@ -283,7 +283,7 @@ function input_livesearch_page_handler($page) {
WHERE e.guid = ue.guid
AND e.enabled = 'yes'
AND ue.banned = 'no'
- AND (ue.name LIKE '$q%' OR ue.username LIKE '$q%')
+ AND (ue.name LIKE '$q%' OR ue.name LIKE '% $q%' OR ue.username LIKE '$q%')
LIMIT $limit
";
@@ -333,7 +333,7 @@ function input_livesearch_page_handler($page) {
WHERE e.guid = ge.guid
AND e.enabled = 'yes'
$owner_where
- AND (ge.name LIKE '$q%' OR ge.description LIKE '%$q%')
+ AND (ge.name LIKE '$q%' OR ge.name LIKE '% $q%' OR ge.description LIKE '% $q%')
LIMIT $limit
";
if ($entities = get_data($query)) {
@@ -379,7 +379,7 @@ function input_livesearch_page_handler($page) {
AND e.guid = ue.guid
AND e.enabled = 'yes'
AND ue.banned = 'no'
- AND (ue.name LIKE '$q%' OR ue.username LIKE '$q%')
+ AND (ue.name LIKE '$q%' OR ue.name LIKE '% $q%' OR ue.username LIKE '$q%')
LIMIT $limit
";
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index 5a2f5f8ac..18faff27f 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -480,8 +480,8 @@ function object_notifications($event, $object_type, $object) {
}
if (isset($CONFIG->register_objects[$object_type][$object_subtype])) {
- $descr = $CONFIG->register_objects[$object_type][$object_subtype];
- $string = $descr . ": " . $object->getURL();
+ $subject = $CONFIG->register_objects[$object_type][$object_subtype];
+ $string = $subject . ": " . $object->getURL();
// Get users interested in content from this person and notify them
// (Person defined by container_guid so we can also subscribe to groups if we want)
@@ -500,16 +500,16 @@ function object_notifications($event, $object_type, $object) {
if ($user instanceof ElggUser && !$user->isBanned()) {
if (($user->guid != $SESSION['user']->guid) && has_access_to_entity($object, $user)
&& $object->access_id != ACCESS_PRIVATE) {
- $methodstring = elgg_trigger_plugin_hook('notify:entity:message', $object->getType(), array(
+ $body = elgg_trigger_plugin_hook('notify:entity:message', $object->getType(), array(
'entity' => $object,
'to_entity' => $user,
'method' => $method), $string);
- if (empty($methodstring) && $methodstring !== false) {
- $methodstring = $string;
+ if (empty($body) && $body !== false) {
+ $body = $string;
}
- if ($methodstring !== false) {
- notify_user($user->guid, $object->container_guid, $descr, $methodstring,
- NULL, array($method));
+ if ($body !== false) {
+ notify_user($user->guid, $object->container_guid, $subject, $body,
+ null, array($method));
}
}
}
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 241b524f9..527eff3cd 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -136,7 +136,6 @@ function ban_user($user_guid, $reason = "") {
global $CONFIG;
$user_guid = (int)$user_guid;
- $reason = sanitise_string($reason);
$user = get_entity($user_guid);
diff --git a/engine/lib/views.php b/engine/lib/views.php
index c98ad4e78..25acbf2b2 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -1224,12 +1224,12 @@ function elgg_view_image_block($image, $body, $vars = array()) {
* @param string $type The type of module (main, info, popup, aside, etc.)
* @param string $title A title to put in the header
* @param string $body Content of the module
- * @param string $vars Additional parameters for the module
+ * @param array $vars Additional parameters for the module
*
* @return string
* @since 1.8.0
*/
-function elgg_view_module($type, $title, $body, $vars = array()) {
+function elgg_view_module($type, $title, $body, array $vars = array()) {
$vars['class'] = elgg_extract('class', $vars, '') . " elgg-module-$type";
$vars['title'] = $title;