Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
upload.php
Go to the documentation of this file.
1 <?php
6 $guid = get_input('guid');
8 
9 if (!$owner || !($owner instanceof ElggUser) || !$owner->canEdit()) {
10  register_error(elgg_echo('avatar:upload:fail'));
12 }
13 
14 $error = elgg_get_friendly_upload_error($_FILES['avatar']['error']);
15 if ($error) {
18 }
19 
20 if (!$owner->saveIconFromUploadedFile('avatar')) {
21  register_error(elgg_echo('avatar:resize:fail'));
23 }
24 
25 if (elgg_trigger_event('profileiconupdate', $owner->type, $owner)) {
26  system_message(elgg_echo("avatar:upload:success"));
27 
28  $view = 'river/user/default/profileiconupdate';
29  elgg_delete_river(array('subject_guid' => $owner->guid, 'view' => $view));
31  'view' => $view,
32  'action_type' => 'update',
33  'subject_guid' => $owner->guid,
34  'object_guid' => $owner->guid,
35  ));
36 }
37 
$view
Definition: crop.php:34
if(!$owner||!($owner instanceof ElggUser)||!$owner->canEdit()) $error
Definition: upload.php:14
$owner
Definition: upload.php:7
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_get_friendly_upload_error($error_code)
Returns a human-readable message for PHP's upload error codes.
Definition: output.php:426
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
elgg_create_river_item(array $options=array())
Adds an item to the river.
Definition: river.php:37
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
const REFERER
Definition: elgglib.php:2029
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
elgg_delete_river(array $options=array())
Delete river items.
Definition: river.php:162
elgg_trigger_event($event, $object_type, $object=null)
Definition: elgglib.php:589
$guid
Avatar upload action.
Definition: upload.php:6
system_message($message)
Display a system message on next page load.
Definition: elgglib.php:438
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204