aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/access.php10
-rw-r--r--engine/lib/elgglib.php2
-rw-r--r--engine/lib/entities.php13
-rw-r--r--engine/lib/filestore.php8
-rw-r--r--engine/lib/input.php72
-rw-r--r--engine/lib/plugins.php6
-rw-r--r--engine/lib/users.php12
7 files changed, 95 insertions, 28 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index ae64f832a..002413baa 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -981,17 +981,17 @@ function access_init() {
*/
function elgg_override_permissions($hook, $type, $value, $params) {
$user = elgg_extract('user', $params);
- if (!$user) {
- $user = elgg_get_logged_in_user_entity();
+ if ($user) {
+ $user_guid = $user->getGUID();
+ } else {
+ $user_guid = elgg_get_logged_in_user_guid();
}
- // don't do this so ignore access still works.
+ // don't do this so ignore access still works with no one logged in
// if (!$user instanceof ElggUser) {
// return false;
// }
- $user_guid = $user->guid;
-
// check for admin
if ($user_guid && elgg_is_admin_user($user_guid)) {
return true;
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 1469067ca..66268cc96 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -2042,9 +2042,11 @@ function elgg_init() {
elgg_register_page_handler('ajax', 'elgg_ajax_page_handler');
elgg_register_js('elgg.autocomplete', 'js/lib/autocomplete.js');
+ elgg_register_js('jquery.ui.autocomplete.html', 'vendors/jquery/jquery.ui.autocomplete.html.js');
elgg_register_js('elgg.userpicker', 'js/lib/userpicker.js');
elgg_register_js('elgg.friendspicker', 'js/lib/friends_picker.js');
elgg_register_js('jquery.easing', 'vendors/jquery/jquery.easing.1.3.packed.js');
+ elgg_register_js('elgg.avatar_cropper', 'js/lib/avatar_cropper.js');
elgg_register_js('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect-0.9.8/scripts/jquery.imgareaselect.min.js');
elgg_register_css('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect-0.9.8/css/imgareaselect-deprecated.css');
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index f1352ba8d..fcd4544bf 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -530,12 +530,12 @@ $container_guid = 0) {
$container_guid = $owner_guid;
}
- $user = elgg_get_logged_in_user_entity();
- if (!can_write_to_container($user->guid, $owner_guid, $type, $subtype)) {
+ $user_guid = elgg_get_logged_in_user_guid();
+ if (!can_write_to_container($user_guid, $owner_guid, $type, $subtype)) {
return false;
}
if ($owner_guid != $container_guid) {
- if (!can_write_to_container($user->guid, $container_guid, $type, $subtype)) {
+ if (!can_write_to_container($user_guid, $container_guid, $type, $subtype)) {
return false;
}
}
@@ -1837,7 +1837,12 @@ function can_edit_entity_metadata($entity_guid, $user_guid = 0, $metadata = null
$return = can_edit_entity($entity_guid, $user_guid);
}
- $user = get_entity($user_guid);
+ if ($user_guid) {
+ $user = get_entity($user_guid);
+ } else {
+ $user = elgg_get_logged_in_user_entity();
+ }
+
$params = array('entity' => $entity, 'user' => $user, 'metadata' => $metadata);
$return = elgg_trigger_plugin_hook('permissions_check:metadata', $entity->type, $params, $return);
return $return;
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index 70b8bfb4c..a13d8aa27 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -474,7 +474,7 @@ function filestore_run_once() {
/**
* Initialise the file modules.
- * Listens to system boot and registers any appropriate file types and classes
+ * Listens to system init and configures the default filestore
*
* @return void
* @access private
@@ -483,8 +483,10 @@ function filestore_init() {
global $CONFIG;
// Now register a default filestore
- set_default_filestore(new ElggDiskFilestore($CONFIG->dataroot));
-
+ if (isset($CONFIG->dataroot)) {
+ set_default_filestore(new ElggDiskFilestore($CONFIG->dataroot));
+ }
+
// Now run this stuff, but only once
run_function_once("filestore_run_once");
}
diff --git a/engine/lib/input.php b/engine/lib/input.php
index 5c1a6299c..4900817a5 100644
--- a/engine/lib/input.php
+++ b/engine/lib/input.php
@@ -289,13 +289,35 @@ function input_livesearch_page_handler($page) {
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
+ $entity = get_entity($entity->guid);
+ if (!$entity) {
+ continue;
+ }
+
+ if (in_array('groups', $match_on)) {
+ $value = $entity->guid;
+ } else {
+ $value = $entity->username;
+ }
+
+ $output = elgg_view_list_item($entity, array(
+ 'hover' => false,
+ 'class' => 'elgg-autocomplete-item',
+ ));
+
+ $icon = elgg_view_entity_icon($entity, 'tiny', array(
+ 'hover' => false,
+ ));
+
$result = array(
'type' => 'user',
'name' => $entity->name,
'desc' => $entity->username,
- 'icon' => '<img class="elgg-livesearch-icon" src="' .
- get_entity($entity->guid)->getIconURL('tiny') . '" />',
- 'guid' => $entity->guid
+ 'guid' => $entity->guid,
+ 'label' => $output,
+ 'value' => $value,
+ 'icon' => $icon,
+ 'url' => $entity->getURL(),
);
$results[$entity->name . rand(1, 100)] = $result;
}
@@ -316,13 +338,29 @@ function input_livesearch_page_handler($page) {
";
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
+ $entity = get_entity($entity->guid);
+ if (!$entity) {
+ continue;
+ }
+
+ $output = elgg_view_list_item($entity, array(
+ 'hover' => false,
+ 'class' => 'elgg-autocomplete-item',
+ ));
+
+ $icon = elgg_view_entity_icon($entity, 'tiny', array(
+ 'hover' => false,
+ ));
+
$result = array(
'type' => 'group',
'name' => $entity->name,
'desc' => strip_tags($entity->description),
- 'icon' => '<img class="elgg-livesearch-icon" src="'
- . get_entity($entity->guid)->getIconURL('tiny') . '" />',
- 'guid' => $entity->guid
+ 'guid' => $entity->guid,
+ 'label' => $output,
+ 'value' => $entity->guid,
+ 'icon' => $icon,
+ 'url' => $entity->getURL(),
);
$results[$entity->name . rand(1, 100)] = $result;
@@ -347,13 +385,29 @@ function input_livesearch_page_handler($page) {
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
+ $entity = get_entity($entity->guid);
+ if (!$entity) {
+ continue;
+ }
+
+ $output = elgg_view_list_item($entity, array(
+ 'hover' => false,
+ 'class' => 'elgg-autocomplete-item',
+ ));
+
+ $icon = elgg_view_entity_icon($entity, 'tiny', array(
+ 'hover' => false,
+ ));
+
$result = array(
'type' => 'user',
'name' => $entity->name,
'desc' => $entity->username,
- 'icon' => '<img class="elgg-livesearch-icon" src="'
- . get_entity($entity->guid)->getIconURL('tiny') . '" />',
- 'guid' => $entity->guid
+ 'guid' => $entity->guid,
+ 'label' => $output,
+ 'value' => $entity->username,
+ 'icon' => $icon,
+ 'url' => $entity->getURL(),
);
$results[$entity->name . rand(1, 100)] = $result;
}
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index a9e8b21bc..86070a2aa 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -577,7 +577,7 @@ function elgg_get_plugins_provides($type = null, $name = null) {
foreach ($plugin_provides as $provided) {
$provides[$provided['type']][$provided['name']] = array(
'version' => $provided['version'],
- 'provided_by' => $plugin_id
+ 'provided_by' => $plugin->getID()
);
}
}
@@ -1080,8 +1080,8 @@ function plugins_test($hook, $type, $value, $params) {
}
/**
- * Initialise the file modules.
- * Listens to system boot and registers any appropriate file types and classes
+ * Initialize the plugin system
+ * Listens to system init and registers actions
*
* @return void
* @access private
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 55ebddd3a..843b897e9 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -742,7 +742,9 @@ function execute_new_password_request($user_guid, $conf_code) {
if (force_user_password_reset($user_guid, $password)) {
remove_private_setting($user_guid, 'passwd_conf_code');
-
+ // clean the logins failures
+ reset_login_failure_count($user_guid);
+
$email = elgg_echo('email:resetpassword:body', array($user->name, $password));
return notify_user($user->guid, $CONFIG->site->guid,
@@ -1139,10 +1141,13 @@ function elgg_user_account_page_handler($page_elements, $handler) {
* dropdown login link.
*
* @return void
- * @todo finish
* @access private
*/
function elgg_user_login_page_handler() {
+ if (elgg_is_logged_in()) {
+ forward();
+ }
+
$login_box = elgg_view('core/account/login_box');
$content = elgg_view_layout('one_column', array('content' => $login_box));
echo elgg_view_page(elgg_echo('login'), $content);
@@ -1361,11 +1366,10 @@ function elgg_profile_fields_setup() {
'twitter' => 'text'
);
- $loaded_default = array();
+ $loaded_defaults = array();
if ($fieldlist = elgg_get_config('profile_custom_fields')) {
if (!empty($fieldlist)) {
$fieldlistarray = explode(',', $fieldlist);
- $loaded_defaults = array();
foreach ($fieldlistarray as $listitem) {
if ($translation = elgg_get_config("admin_defined_profile_{$listitem}")) {
$type = elgg_get_config("admin_defined_profile_type_{$listitem}");