From 88c3d54f0a6ceb0b539af4e922157b101b945542 Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 4 Mar 2010 16:36:48 +0000 Subject: Merged interface changes to profile in. git-svn-id: http://code.elgg.org/elgg/trunk@5284 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/actions/cropicon.php | 134 +++-- mod/profile/actions/deletedefaultprofileitem.php | 44 +- mod/profile/actions/edit.php | 179 ++++--- mod/profile/actions/editdefault.php | 66 ++- mod/profile/actions/iconupload.php | 151 +++--- mod/profile/actions/resetdefaultprofile.php | 43 +- mod/profile/defaultprofile.php | 96 ++-- mod/profile/edit.php | 82 +-- mod/profile/editicon.php | 73 +-- mod/profile/icon.php | 106 ++-- mod/profile/icondirect.php | 229 ++++---- mod/profile/index.php | 89 ++-- mod/profile/javascript.php | 35 +- mod/profile/languages/en.php | 185 +++---- mod/profile/profile_lib.php | 73 +++ mod/profile/start.php | 582 ++++++++++----------- mod/profile/views/default/profile/admin_menu.php | 42 ++ mod/profile/views/default/profile/css.php | 436 +++++++++++++-- mod/profile/views/default/profile/edit.php | 42 +- .../views/default/profile/editdefaultprofile.php | 56 +- mod/profile/views/default/profile/editicon.php | 107 ++-- mod/profile/views/default/profile/gallery.php | 47 -- mod/profile/views/default/profile/hoverover.php | 38 +- mod/profile/views/default/profile/icon.php | 89 ++-- mod/profile/views/default/profile/javascript.php | 22 +- mod/profile/views/default/profile/listing.php | 103 ++-- mod/profile/views/default/profile/menu/actions.php | 53 +- .../views/default/profile/menu/adminlinks.php | 62 +-- .../views/default/profile/menu/adminwrapper.php | 22 +- mod/profile/views/default/profile/menu/links.php | 58 +- .../views/default/profile/menu/linksownpage.php | 52 +- mod/profile/views/default/profile/metatags.php | 34 +- .../default/profile/profile_contents/activity.php | 26 + .../default/profile/profile_contents/details.php | 63 +++ .../default/profile/profile_contents/friends.php | 21 + .../default/profile/profile_contents/twitter.php | 24 + .../default/profile/profile_contents/widgets.php | 0 .../views/default/profile/profile_navigation.php | 57 ++ .../views/default/profile/profile_ownerblock.php | 124 +++++ mod/profile/views/default/profile/profilelinks.php | 50 -- mod/profile/views/default/profile/userdetails.php | 174 ------ .../river/user/default/profileiconupdate.php | 10 +- .../default/river/user/default/profileupdate.php | 2 +- 43 files changed, 2179 insertions(+), 1802 deletions(-) create mode 100644 mod/profile/profile_lib.php create mode 100755 mod/profile/views/default/profile/admin_menu.php delete mode 100644 mod/profile/views/default/profile/gallery.php create mode 100755 mod/profile/views/default/profile/profile_contents/activity.php create mode 100755 mod/profile/views/default/profile/profile_contents/details.php create mode 100755 mod/profile/views/default/profile/profile_contents/friends.php create mode 100755 mod/profile/views/default/profile/profile_contents/twitter.php create mode 100644 mod/profile/views/default/profile/profile_contents/widgets.php create mode 100755 mod/profile/views/default/profile/profile_navigation.php create mode 100755 mod/profile/views/default/profile/profile_ownerblock.php delete mode 100644 mod/profile/views/default/profile/profilelinks.php delete mode 100644 mod/profile/views/default/profile/userdetails.php diff --git a/mod/profile/actions/cropicon.php b/mod/profile/actions/cropicon.php index f86799ccf..70b8e9288 100644 --- a/mod/profile/actions/cropicon.php +++ b/mod/profile/actions/cropicon.php @@ -1,80 +1,74 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ - /** - * Elgg profile plugin upload new user icon action - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +gatekeeper(); - gatekeeper(); +$profile_username = get_input('username'); +$profile_owner = get_user_by_username($profile_username); - $x1 = (int) get_input('x_1',0); - $y1 = (int) get_input('y_1',0); - $x2 = (int) get_input('x_2',0); - $y2 = (int) get_input('y_2',0); +if (!$profile_owner || !($profile_owner instanceof ElggUser) || !$profile_owner->canEdit()) { + register_error(elgg_echo('profile:icon:fail')); + forward($_SERVER['HTTP_REFERER']); +} + +$x1 = (int) get_input('x_1',0); +$y1 = (int) get_input('y_1',0); +$x2 = (int) get_input('x_2',0); +$y2 = (int) get_input('y_2',0); + +$filehandler = new ElggFile(); +$filehandler->owner_guid = $profile_owner->getGUID(); +$filehandler->setFilename("profile/" . $profile_owner->username . "master" . ".jpg"); +$filename = $filehandler->getFilenameOnFilestore(); - // username is set in form which ensures the page owner is set - $user = page_owner_entity(); +$topbar = get_resized_image_from_existing_file($filename, 16, 16, true, $x1, $y1, $x2, $y2); +$tiny = get_resized_image_from_existing_file($filename, 25, 25, true, $x1, $y1, $x2, $y2); +$small = get_resized_image_from_existing_file($filename, 40, 40, true, $x1, $y1, $x2, $y2); +$medium = get_resized_image_from_existing_file($filename, 100, 100, true, $x1, $y1, $x2, $y2); - if (!$user || !$user->canEdit()) { - register_error(elgg_echo("profile:icon:noaccess")); - forward(); - } - +if ($small !== FALSE && $medium !== FALSE && $tiny !== FALSE) { $filehandler = new ElggFile(); - $filehandler->owner_guid = $user->getGUID(); - $filehandler->setFilename("profile/" . $user->username . "master" . ".jpg"); - $filename = $filehandler->getFilenameOnFilestore(); - - $topbar = get_resized_image_from_existing_file($filename,16,16, true, $x1, $y1, $x2, $y2); - $tiny = get_resized_image_from_existing_file($filename,25,25, true, $x1, $y1, $x2, $y2); - $small = get_resized_image_from_existing_file($filename,40,40, true, $x1, $y1, $x2, $y2); - $medium = get_resized_image_from_existing_file($filename,100,100, true, $x1, $y1, $x2, $y2); + $filehandler->owner_guid = $profile_owner->getGUID(); + $filehandler->setFilename("profile/" . $profile_owner->username . "medium.jpg"); + $filehandler->open("write"); + $filehandler->write($medium); + $filehandler->close(); + $filehandler->setFilename("profile/" . $profile_owner->username . "small.jpg"); + $filehandler->open("write"); + $filehandler->write($small); + $filehandler->close(); + $filehandler->setFilename("profile/" . $profile_owner->username . "tiny.jpg"); + $filehandler->open("write"); + $filehandler->write($tiny); + $filehandler->close(); + $filehandler->setFilename("profile/" . $profile_owner->username . "topbar.jpg"); + $filehandler->open("write"); + $filehandler->write($topbar); + $filehandler->close(); + + $profile_owner->x1 = $x1; + $profile_owner->x2 = $x2; + $profile_owner->y1 = $y1; + $profile_owner->y2 = $y2; - if ($small !== false - && $medium !== false - && $tiny !== false) { - - $filehandler = new ElggFile(); - $filehandler->owner_guid = $user->getGUID(); - $filehandler->setFilename("profile/" . $user->username . "medium.jpg"); - $filehandler->open("write"); - $filehandler->write($medium); - $filehandler->close(); - $filehandler->setFilename("profile/" . $user->username . "small.jpg"); - $filehandler->open("write"); - $filehandler->write($small); - $filehandler->close(); - $filehandler->setFilename("profile/" . $user->username . "tiny.jpg"); - $filehandler->open("write"); - $filehandler->write($tiny); - $filehandler->close(); - $filehandler->setFilename("profile/" . $user->username . "topbar.jpg"); - $filehandler->open("write"); - $filehandler->write($topbar); - $filehandler->close(); - - $user->x1 = $x1; - $user->x2 = $x2; - $user->y1 = $y1; - $user->y2 = $y2; - - $user->icontime = time(); - - system_message(elgg_echo("profile:icon:uploaded")); - - } else { - register_error(elgg_echo("profile:icon:notfound")); - } - - //forward the user back to the upload page to crop - - $url = $vars['url'] . "pg/profile/{$user->username}/editicon/"; + $profile_owner->icontime = time(); + + system_message(elgg_echo("profile:icon:uploaded")); +} else { + register_error(elgg_echo("profile:icon:notfound")); +} - if (isloggedin()) forward($url); +//forward the user back to the upload page to crop +$url = "{$vars['url']}pg/profile/{$profile_owner->username}/edit/icon"; -?> +if (isloggedin()) { + forward($url); +} diff --git a/mod/profile/actions/deletedefaultprofileitem.php b/mod/profile/actions/deletedefaultprofileitem.php index 309816035..b5b2eba84 100644 --- a/mod/profile/actions/deletedefaultprofileitem.php +++ b/mod/profile/actions/deletedefaultprofileitem.php @@ -1,25 +1,25 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - global $CONFIG; +/** + * Elgg profile plugin edit default profile action removal + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +global $CONFIG; + +admin_gatekeeper(); - admin_gatekeeper(); +$id = (int)get_input('id'); - $id = (int)get_input('id'); - - if ( ($id) && (set_plugin_setting("admin_defined_profile_$id", '', 'profile')) && - (set_plugin_setting("admin_defined_profile_type_$id", '', 'profile'))) - system_message(elgg_echo('profile:editdefault:delete:success')); - else - register_error(elgg_echo('profile:editdefault:delete:fail')); - - forward($_SERVER['HTTP_REFERER']); -?> +if ( ($id) && (set_plugin_setting("admin_defined_profile_$id", '', 'profile')) && + (set_plugin_setting("admin_defined_profile_type_$id", '', 'profile'))) { + system_message(elgg_echo('profile:editdefault:delete:success')); +} else { + register_error(elgg_echo('profile:editdefault:delete:fail')); +} + +forward($_SERVER['HTTP_REFERER']); \ No newline at end of file diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php index bc14cd6e6..4afe4cd47 100644 --- a/mod/profile/actions/edit.php +++ b/mod/profile/actions/edit.php @@ -1,95 +1,100 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // Load configuration - global $CONFIG; - - gatekeeper(); - - // Get profile fields - $input = array(); - $accesslevel = get_input('accesslevel'); - if (!is_array($accesslevel)) $accesslevel = array(); - - foreach($CONFIG->profile as $shortname => $valuetype) { - // the decoding is a stop gag to prevent && showing up in profile fields - // because it is escaped on both input (get_input()) and output (view:output/text). see #561 and #1405. - // must decode in utf8 or string corruption occurs. see #1567. - $value = html_entity_decode(get_input($shortname), ENT_COMPAT, 'UTF-8'); - - // limit to reasonable sizes. - if ($valuetype != 'longtext' && elgg_strlen($value) > 250) { - $error = sprintf(elgg_echo('profile:field_too_long'), elgg_echo("profile:{$shortname}")); - register_error($error); - forward($_SERVER['HTTP_REFERER']); - } - - if ($valuetype == 'tags') { - $value = string_to_tag_array($value); +/** + * Elgg profile plugin edit action + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +global $CONFIG; +gatekeeper(); + +$profile_username = get_input('username'); +$profile_owner = get_user_by_username($profile_username); + +if (!$profile_owner || !$profile_owner->canEdit()) { + system_message(elgg_echo("profile:noaccess")); + forward($_SERVER['HTTP_REFERER']); +} + +// grab the defined profile field names and their load the values from POST. +// each field can have its own access, so sort that too. +$input = array(); +$accesslevel = get_input('accesslevel'); + +if (!is_array($accesslevel)) { + $accesslevel = array(); +} + +foreach($CONFIG->profile as $shortname => $valuetype) { + // the decoding is a stop gag to prevent && showing up in profile fields + // because it is escaped on both input (get_input()) and output (view:output/text). see #561 and #1405. + // must decode in utf8 or string corruption occurs. see #1567. + $value = html_entity_decode(get_input($shortname), ENT_COMPAT, 'UTF-8'); + + // limit to reasonable sizes. + if ($valuetype != 'longtext' && elgg_strlen($value) > 250) { + $error = sprintf(elgg_echo('profile:field_too_long'), elgg_echo("profile:{$shortname}")); + register_error($error); + forward($_SERVER['HTTP_REFERER']); + } + + if ($valuetype == 'tags') { + $value = string_to_tag_array($value); + } + + $input[$shortname] = $value; +} + +// display name is handled separately +if ($name = strip_tags(get_input('name'))) { + if (elgg_strlen($name) > 50) { + register_error(elgg_echo('user:name:fail')); + } else { + $profile_owner->name = $name; + // @todo this is weird...giving two notifications? + if ($profile_owner->save()) { + system_message(elgg_echo('user:name:success')); + } else { + register_error(elgg_echo('user:name:fail')); + } + } +} + +// go through custom fields +if (sizeof($input) > 0) { + foreach($input as $shortname => $value) { + remove_metadata($profile_owner->guid, $shortname); + if (isset($accesslevel[$shortname])) { + $access_id = (int) $accesslevel[$shortname]; + } else { + // this should never be executed since the access level should always be set + $access_id = ACCESS_DEFAULT; + } + if (is_array($value)) { + $i = 0; + foreach($value as $interval) { + $i++; + $multiple = ($i > 1) ? TRUE : FALSE; + create_metadata($profile_owner->guid, $shortname, $interval, 'text', $profile_owner->guid, $access_id, $multiple); } - - $input[$shortname] = $value; + } else { + create_metadata($profile_owner->getGUID(), $shortname, $value, 'text', $profile_owner->getGUID(), $access_id); } + } - // Get the page owner to see if the currently logged in user canEdit() the page owner. - - $user = page_owner_entity(); - if (!$user) { - $user = $_SESSION['user']; + $profile_owner->save(); - // @todo this doesn't make sense...??? - set_page_owner($user->getGUID()); - } - if ($user->canEdit()) { - - // Save stuff - if (sizeof($input) > 0) - foreach($input as $shortname => $value) { - //$user->$shortname = $value; - remove_metadata($user->guid, $shortname); - if (isset($accesslevel[$shortname])) { - $access_id = (int) $accesslevel[$shortname]; - } else { - // this should never be executed since the access level should always be set - $access_id = ACCESS_PRIVATE; - } - if (is_array($value)) { - $i = 0; - foreach($value as $interval) { - $i++; - if ($i == 1) { $multiple = false; } else { $multiple = true; } - create_metadata($user->guid, $shortname, $interval, 'text', $user->guid, $access_id, $multiple); - } - } else { - create_metadata($user->guid, $shortname, $value, 'text', $user->guid, $access_id); - } - } - $user->save(); - - // Notify of profile update - trigger_elgg_event('profileupdate',$user->type,$user); - - //add to river - add_to_river('river/user/default/profileupdate','update',$_SESSION['user']->guid,$_SESSION['user']->guid,get_default_access($_SESSION['user'])); - - system_message(elgg_echo("profile:saved")); - - // Forward to the user's profile - forward($user->getUrl()); + // Notify of profile update + trigger_elgg_event('profileupdate',$user->type,$user); - } else { - // If we can't, display an error + //add to river + add_to_river('river/user/default/profileupdate','update',$_SESSION['user']->guid,$_SESSION['user']->guid,get_default_access($_SESSION['user'])); - system_message(elgg_echo("profile:noaccess")); - } + system_message(elgg_echo("profile:saved")); +} -?> +forward($profile_owner->getUrl()); \ No newline at end of file diff --git a/mod/profile/actions/editdefault.php b/mod/profile/actions/editdefault.php index cf662e9b2..7f5fe0004 100644 --- a/mod/profile/actions/editdefault.php +++ b/mod/profile/actions/editdefault.php @@ -1,39 +1,35 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // Load configuration - global $CONFIG; - - admin_gatekeeper(); - - $label = sanitise_string(get_input('label')); - $type = sanitise_string(get_input('type')); - - if (($label) && ($type)) - { - $n = 0; - while (get_plugin_setting("admin_defined_profile_$n", 'profile')) {$n++;} // find free space - - if ( (set_plugin_setting("admin_defined_profile_$n", $label, 'profile')) && - (set_plugin_setting("admin_defined_profile_type_$n", $type, 'profile'))) { - set_plugin_setting('user_defined_fields', TRUE, 'profile'); - system_message(elgg_echo('profile:editdefault:success')); - } else { - register_error(elgg_echo('profile:editdefault:fail')); - } - +/** + * Elgg profile plugin edit default profile action + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +global $CONFIG; +admin_gatekeeper(); + +$label = sanitise_string(get_input('label')); +$type = sanitise_string(get_input('type')); + +if (($label) && ($type)){ + // find next index for new field + $n = 0; + while (get_plugin_setting("admin_defined_profile_$n", 'profile')) { + $n++; } - else + + if ( (set_plugin_setting("admin_defined_profile_$n", $label, 'profile')) && + (set_plugin_setting("admin_defined_profile_type_$n", $type, 'profile'))) { + system_message(elgg_echo('profile:editdefault:success')); + } else { register_error(elgg_echo('profile:editdefault:fail')); + } +} else { + register_error(elgg_echo('profile:editdefault:fail')); +} - forward($_SERVER['HTTP_REFERER']); -?> +forward($_SERVER['HTTP_REFERER']); \ No newline at end of file diff --git a/mod/profile/actions/iconupload.php b/mod/profile/actions/iconupload.php index f1d290694..a0cb24c3d 100644 --- a/mod/profile/actions/iconupload.php +++ b/mod/profile/actions/iconupload.php @@ -1,91 +1,68 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ - /** - * Elgg profile plugin upload new user icon action - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +gatekeeper(); - gatekeeper(); - - $user = page_owner_entity(); - if (!$user) - $user = $_SESSION['user']; - - // If we were given a correct icon - if ( - (isloggedin()) && - ($user) && - ($user->canEdit()) - ) { - - - $topbar = get_resized_image_from_uploaded_file('profileicon',16,16, true); - $tiny = get_resized_image_from_uploaded_file('profileicon',25,25, true); - $small = get_resized_image_from_uploaded_file('profileicon',40,40, true); - $medium = get_resized_image_from_uploaded_file('profileicon',100,100, true); - $large = get_resized_image_from_uploaded_file('profileicon',200,200); - $master = get_resized_image_from_uploaded_file('profileicon',550,550); - - if ($small !== false - && $medium !== false - && $large !== false - && $tiny !== false) { - - $filehandler = new ElggFile(); - $filehandler->owner_guid = $user->getGUID(); - $filehandler->setFilename("profile/" . $user->username . "large.jpg"); - $filehandler->open("write"); - $filehandler->write($large); - $filehandler->close(); - $filehandler->setFilename("profile/" . $user->username . "medium.jpg"); - $filehandler->open("write"); - $filehandler->write($medium); - $filehandler->close(); - $filehandler->setFilename("profile/" . $user->username . "small.jpg"); - $filehandler->open("write"); - $filehandler->write($small); - $filehandler->close(); - $filehandler->setFilename("profile/" . $user->username . "tiny.jpg"); - $filehandler->open("write"); - $filehandler->write($tiny); - $filehandler->close(); - $filehandler->setFilename("profile/" . $user->username . "topbar.jpg"); - $filehandler->open("write"); - $filehandler->write($topbar); - $filehandler->close(); - $filehandler->setFilename("profile/" . $user->username . "master.jpg"); - $filehandler->open("write"); - $filehandler->write($master); - $filehandler->close(); - - $user->icontime = time(); - - system_message(elgg_echo("profile:icon:uploaded")); - - trigger_elgg_event('profileiconupdate',$user->type,$user); - - //add to river - add_to_river('river/user/default/profileiconupdate','update',$user->guid,$user->guid); - - } else { - system_message(elgg_echo("profile:icon:notfound")); - } - - } else { - - system_message(elgg_echo("profile:icon:notfound")); - - } - - //forward the user back to the upload page to crop - - $url = "pg/profile/{$user->username}/editicon/"; - - if (isloggedin()) forward($url); +$profile_username = get_input('username'); +$profile_owner = get_user_by_username($profile_username); -?> +if (!$profile_owner || !($profile_owner instanceof ElggUser) || !$profile_owner->canEdit()) { + register_error(elgg_echo('profile:icon:fail')); + forward($_SERVER['HTTP_REFERER']); +} + +$profile_owner_guid = $profile_owner->getGUID(); + +//@todo make this configurable? +$icon_sizes = array( + 'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE), + 'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE), + 'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE), + 'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE), + 'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE), + 'master' => array('w'=>1600, 'h'=>1600, 'square'=>FALSE) +); + +// get the images and save their file handlers into an array +// so we can do clean up if one fails. +$files = array(); +foreach ($icon_sizes as $name => $size_info) { + $resized = get_resized_image_from_uploaded_file('profileicon', $size_info['w'], $size_info['h'], $size_info['square']); + + if ($resized) { + //@todo Make these actual entities. See exts #348. + $file = new ElggFile(); + $file->owner_guid = $profile_owner_guid; + $file->setFilename("profile/{$profile_username}{$name}.jpg"); + $file->open('write'); + $file->write($resized); + $file->close(); + $files[] = $file; + } else { + // cleanup on fail + foreach ($files as $file) { + $file->delete(); + } + + system_message(elgg_echo('profile:icon:notfound')); + forward($_SERVER['HTTP_REFERER']); + } +} + +$profile_owner->icontime = time(); +if (trigger_elgg_event('profileiconupdate', $profile_owner->type, $profile_owner)) { + // pull this out into the river plugin. + //add_to_river('river/user/default/profileiconupdate','update',$user->guid,$user->guid); + system_message(elgg_echo("profile:icon:uploaded")); +} + +//forward the user back to the upload page to crop +forward($_SERVER['HTTP_REFERER']); diff --git a/mod/profile/actions/resetdefaultprofile.php b/mod/profile/actions/resetdefaultprofile.php index 2100c95c2..a6c90d4b7 100644 --- a/mod/profile/actions/resetdefaultprofile.php +++ b/mod/profile/actions/resetdefaultprofile.php @@ -1,30 +1,27 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +/** + * Elgg profile plugin edit default profile action + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ - // Load configuration - global $CONFIG; +global $CONFIG; +admin_gatekeeper(); - admin_gatekeeper(); +$n = 0; +while (get_plugin_setting("admin_defined_profile_$n", 'profile')) { + set_plugin_setting("admin_defined_profile_$n", '', 'profile'); + set_plugin_setting("admin_defined_profile_type_$n", '', 'profile'); - $n = 0; - while (get_plugin_setting("admin_defined_profile_$n", 'profile')) { - set_plugin_setting("admin_defined_profile_$n", '', 'profile'); - set_plugin_setting("admin_defined_profile_type_$n", '', 'profile'); + $n++; +} - $n++; - } +set_plugin_setting('user_defined_fields', FALSE, 'profile'); - set_plugin_setting('user_defined_fields', FALSE, 'profile'); +system_message(elgg_echo('profile:defaultprofile:reset')); - system_message(elgg_echo('profile:defaultprofile:reset')); - - forward($_SERVER['HTTP_REFERER']); -?> +forward($_SERVER['HTTP_REFERER']); \ No newline at end of file diff --git a/mod/profile/defaultprofile.php b/mod/profile/defaultprofile.php index 9272a7363..1e2884582 100644 --- a/mod/profile/defaultprofile.php +++ b/mod/profile/defaultprofile.php @@ -1,55 +1,49 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); +/** + * Elgg profile index + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ - admin_gatekeeper(); - set_context('admin'); - - $title = elgg_view_title(elgg_echo('profile:edit:default')); - $form = elgg_view('profile/editdefaultprofile'); - - - set_context('search'); - - - // List form elements - $n = 0; - $loaded_defaults = array(); - $listing .= "
"; - while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile')) - { - $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile'); - $listing .= elgg_view("profile/", array('value' => $translation)); - - $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; - - $listing .= "

$translation: "; - $listing .= elgg_view("output/{$type}",array('value' => " [$type]")); - $listing .= "

"; - - $n++; - } - $listing .= "
"; - - $listing .= "
" . elgg_view('input/form', - array( - 'body' => elgg_view('input/submit', array('value' => elgg_echo('profile:resetdefault'))), - 'action' => $CONFIG->wwwroot . 'action/profile/editdefault/reset' - ) - ) . "
"; - - set_context('admin'); - +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +admin_gatekeeper(); +set_context('admin'); + +$title = elgg_view_title(elgg_echo('profile:edit:default')); +$form = elgg_view('profile/editdefaultprofile'); + +set_context('search'); + + +// List form elements +$n = 0; +$loaded_defaults = array(); +while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile')) +{ + $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile'); + $listing .= elgg_view("profile/", array('value' => $translation)); + + $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; + + $listing .= "

$translation: "; + $listing .= elgg_view("output/{$type}",array('value' => " [$type]")); + $listing .= "

"; - page_draw(elgg_echo('profile:edit:default'),elgg_view_layout("two_column_left_sidebar", '', $title . $form . $listing)); + $n++; +} + +$listing .= "
" . elgg_view('input/form', + array( + 'body' => elgg_view('input/submit', array('value' => elgg_echo('profile:resetdefault'))), + 'action' => $CONFIG->wwwroot . 'action/profile/editdefault/reset' + ) +) . "
"; + +set_context('admin'); -?> +page_draw(elgg_echo('profile:edit:default'),elgg_view_layout("one_column_with_sidebar", '', $title . $form . $listing)); \ No newline at end of file diff --git a/mod/profile/edit.php b/mod/profile/edit.php index a11faf4f6..313d144fe 100644 --- a/mod/profile/edit.php +++ b/mod/profile/edit.php @@ -1,44 +1,46 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // Get the Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // If we're not logged on, forward the user elsewhere - if (!isloggedin()) { - forward(); - } - - // Get owner of profile - set in page handler - $user = page_owner_entity(); - if (!$user) { - register_error(elgg_echo("profile:notfound")); - forward(); - } - - // check if logged in user can edit this profile - if (!$user->canEdit()) { - register_error(elgg_echo("profile:noaccess")); - forward(); - } - - // Get edit form - $area2 = elgg_view_title(elgg_echo('profile:edit')); - $area2 .= elgg_view("profile/edit",array('entity' => $user)); - - $area1 = ""; +/** + * Elgg profile editor + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +// Get the Elgg engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// If we're not logged on, forward the user elsewhere +if (!isloggedin()) { + forward(); +} + +// Get owner of profile - set in page handler +$user = page_owner_entity(); +if (!$user) { + register_error(elgg_echo("profile:notfound")); + forward(); +} + +// check if logged in user can edit this profile +if (!$user->canEdit()) { + register_error(elgg_echo("profile:noaccess")); + forward(); +} + +// Get edit form +$area2 = elgg_view_title(elgg_echo('profile:edit')); +$area2 .= elgg_view("profile/edit",array('entity' => $user)); + +$area1 = ""; - // get the required canvas area - $body = elgg_view_layout("two_column_left_sidebar", $area1, $area2); +set_context('profile_edit'); + +// get the required canvas area +$body = elgg_view_layout("one_column_with_sidebar", $area1, $area2); - // Draw the page - page_draw(elgg_echo("profile:edit"),$body); +// Draw the page +page_draw(elgg_echo("profile:edit"),$body); diff --git a/mod/profile/editicon.php b/mod/profile/editicon.php index 97df6d56e..1c5c20d30 100644 --- a/mod/profile/editicon.php +++ b/mod/profile/editicon.php @@ -1,42 +1,43 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ - /** - * Elgg upload new profile icon - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +// Load the Elgg framework +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - // Load the Elgg framework - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // Make sure we're logged in - if (!isloggedin()) { - forward(); - } +// Make sure we're logged in +if (!isloggedin()) { + forward(); +} - // Get owner of profile - set in page handler - $user = page_owner_entity(); - if (!$user) { - register_error(elgg_echo("profile:notfound")); - forward(); - } +// Get owner of profile - set in page handler +$user = page_owner_entity(); +if (!$user) { + register_error(elgg_echo("profile:notfound")); + forward(); +} - // check if logged in user can edit this profile icon - if (!$user->canEdit()) { - register_error(elgg_echo("profile:icon:noaccess")); - forward(); - } - - // set title - $area2 = elgg_view_title(elgg_echo('profile:createicon:header')); - $area2 .= elgg_view("profile/editicon", array('user' => $user)); - - // Get the form and correct canvas area - $body = elgg_view_layout("two_column_left_sidebar", '', $area2); +// check if logged in user can edit this profile icon +if (!$user->canEdit()) { + register_error(elgg_echo("profile:icon:noaccess")); + forward(); +} + +// set title +$area2 = elgg_view_title(elgg_echo('profile:createicon:header')); +$area2 .= elgg_view("profile/edit_icon", array('user' => $user)); + +set_context('profile_edit'); + +// Get the form and correct canvas area +$body = elgg_view_layout("one_column_with_sidebar", '', $area2); - // Draw the page - page_draw(elgg_echo("profile:editicon"), $body); +// Draw the page +page_draw(elgg_echo("profile:editicon"), $body); diff --git a/mod/profile/icon.php b/mod/profile/icon.php index 802cc3756..463eb3db5 100644 --- a/mod/profile/icon.php +++ b/mod/profile/icon.php @@ -1,58 +1,52 @@ +* @copyright Curverider Ltd 2008-2010 +* @link http://elgg.com/ +*/ - /** - * Elgg profile icon - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // Load the Elgg framework - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // Get the owning user - - $user = page_owner_entity(); // page_owner_entity(); - $username = $user->username; - - // Get the size - $size = strtolower(get_input('size')); - if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) - $size = "medium"; - - // Try and get the icon - - $filehandler = new ElggFile(); - $filehandler->owner_guid = $user->getGUID(); - $filehandler->setFilename("profile/" . $username . $size . ".jpg"); - - $success = false; - if ($filehandler->open("read")) { - if ($contents = $filehandler->read($filehandler->size())) { - $success = true; - } - } - - if (!$success) { - - global $CONFIG; - $path = elgg_view('icon/user/default/'.$size); - header("Location: {$path}"); - exit; - //$contents = @file_get_contents($CONFIG-pluginspath . "profile/graphics/default{$size}.jpg"); - - } - - header("Content-type: image/jpeg"); - header('Expires: ' . date('r',time() + 864000)); - header("Pragma: public"); - header("Cache-Control: public"); - header("Content-Length: " . strlen($contents)); - $splitString = str_split($contents, 1024); - foreach($splitString as $chunk) - echo $chunk; - -?> \ No newline at end of file +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + +// Get the owning user +$user = page_owner_entity(); +$username = $user->username; + +// Get the size +$size = strtolower(get_input('size')); +if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) + $size = "medium"; + +// Try and get the icon +$filehandler = new ElggFile(); +$filehandler->owner_guid = $user->getGUID(); +$filehandler->setFilename("profile/" . $username . $size . ".jpg"); + +$success = false; +if ($filehandler->open("read")) { + if ($contents = $filehandler->read($filehandler->size())) { + $success = true; + } +} + +if (!$success) { + global $CONFIG; + $path = elgg_view('icon/user/default/'.$size); + header("Location: {$path}"); + exit; +} + +header("Content-type: image/jpeg"); +header('Expires: ' . date('r',time() + 864000)); +header("Pragma: public"); +header("Cache-Control: public"); +header("Content-Length: " . strlen($contents)); + +$splitString = str_split($contents, 1024); + +foreach($splitString as $chunk) { + echo $chunk; +} \ No newline at end of file diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index ec4227217..a9aed2eea 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -1,136 +1,125 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ +*/ - /** - * Elgg profile icon - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php'); - // Get DB settings, connect - require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php'); - - /** - * UTF safe str_split. - * This is only used here since we don't have access to the file store code. - * TODO: This is a horrible hack, so clean this up! - */ - function __id_mb_str_split($string, $charset = 'UTF8') - { - if (is_callable('mb_substr')) - { - $length = mb_strlen($string); - $array = array(); - - while ($length) - { - $array[] = mb_substr($string, 0, 1, $charset); - $string = mb_substr($string, 1, $length, $charset); - - $length = mb_strlen($string); - } +/** + * UTF safe str_split. + * This is only used here since we don't have access to the file store code. + * TODO: This is a horrible hack, so clean this up! + */ +function __id_mb_str_split($string, $charset = 'UTF8'){ + if (is_callable('mb_substr')){ + $length = mb_strlen($string); + $array = array(); - return $array; - } - else - return str_split($string); - - return false; + while ($length){ + $array[] = mb_substr($string, 0, 1, $charset); + $string = mb_substr($string, 1, $length, $charset); + $length = mb_strlen($string); } - global $CONFIG; + return $array; + } else { + return str_split($string); + } - $contents = ''; + return FALSE; +} - if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass, true)) { - - - $username = $_GET['username']; - //$username = preg_replace('/[^A-Za-z0-9\_\-]/i','',$username); - $blacklist = '/[' . - '\x{0080}-\x{009f}' . # iso-8859-1 control chars - '\x{00a0}' . # non-breaking space - '\x{2000}-\x{200f}' . # various whitespace - '\x{2028}-\x{202f}' . # breaks and control chars - '\x{3000}' . # ideographic space - '\x{e000}-\x{f8ff}' . # private use - ']/u'; - if ( - preg_match($blacklist, $username) || - - (strpos($username, '/')!==false) || - (strpos($username, '\\')!==false) || - (strpos($username, '"')!==false) || - (strpos($username, '\'')!==false) || - (strpos($username, '*')!==false) || - (strpos($username, '&')!==false) || - (strpos($username, ' ')!==false) - ) exit; +global $CONFIG; +$contents = ''; + +if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass, true)) { + $username = $_GET['username']; + //$username = preg_replace('/[^A-Za-z0-9\_\-]/i','',$username); + $blacklist = '/[' . + '\x{0080}-\x{009f}' . # iso-8859-1 control chars + '\x{00a0}' . # non-breaking space + '\x{2000}-\x{200f}' . # various whitespace + '\x{2028}-\x{202f}' . # breaks and control chars + '\x{3000}' . # ideographic space + '\x{e000}-\x{f8ff}' . # private use + ']/u'; + if ( + preg_match($blacklist, $username) || + (strpos($username, '/')!==false) || + (strpos($username, '\\')!==false) || + (strpos($username, '"')!==false) || + (strpos($username, '\'')!==false) || + (strpos($username, '*')!==false) || + (strpos($username, '&')!==false) || + (strpos($username, ' ')!==false) + ) exit; - $userarray = __id_mb_str_split($username); + $userarray = __id_mb_str_split($username); - $matrix = ''; - $length = 5; - if (sizeof($userarray) < $length) $length = sizeof($userarray); - for ($n = 0; $n < $length; $n++) { - $matrix .= $userarray[$n] . "/"; - } + $matrix = ''; + $length = 5; + if (sizeof($userarray) < $length) $length = sizeof($userarray); + for ($n = 0; $n < $length; $n++) { + $matrix .= $userarray[$n] . "/"; + } - // Get the size - $size = strtolower($_GET['size']); - if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) - $size = "medium"; + // Get the size + $size = strtolower($_GET['size']); + if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) + $size = "medium"; - // Try and get the icon - if (@mysql_select_db($CONFIG->dbname,$mysql_dblink)) { - // get dataroot and simplecache_enabled in one select for efficiency - if ($result = mysql_query("select name, value from {$CONFIG->dbprefix}datalists where name in ('dataroot','simplecache_enabled')",$mysql_dblink)) { - $simplecache_enabled = true; - $row = mysql_fetch_object($result); - while ($row) { - if ($row->name == 'dataroot') { - $dataroot = $row->value; - } else if ($row->name == 'simplecache_enabled') { - $simplecache_enabled = $row->value; - } - $row = mysql_fetch_object($result); - } + // Try and get the icon + if (@mysql_select_db($CONFIG->dbname,$mysql_dblink)) { + // get dataroot and simplecache_enabled in one select for efficiency + if ($result = mysql_query("select name, value from {$CONFIG->dbprefix}datalists where name in ('dataroot','simplecache_enabled')",$mysql_dblink)) { + $simplecache_enabled = true; + $row = mysql_fetch_object($result); + while ($row) { + if ($row->name == 'dataroot') { + $dataroot = $row->value; + } else if ($row->name == 'simplecache_enabled') { + $simplecache_enabled = $row->value; } + $row = mysql_fetch_object($result); } } - //@todo forcing through the framework to ensure the matrix - // is created the same way. - //if ($simplecache_enabled) { - if (false) { - $filename = $dataroot . $matrix . "{$username}/profile/" . $username . $size . ".jpg"; - $contents = @file_get_contents($filename); - if (empty($contents)) { - global $viewinput; - $viewinput['view'] = 'icon/user/default/'.$size; - ob_start(); - include(dirname(dirname(dirname(__FILE__))).'/simplecache/view.php'); - $loc = ob_get_clean(); - header('Location: ' . $loc); - exit; - //$contents = @file_get_contents(dirname(__FILE__) . "/graphics/default{$size}.jpg"); - } else { - header("Content-type: image/jpeg"); - header('Expires: ' . date('r',time() + 864000)); - header("Pragma: public"); - header("Cache-Control: public"); - header("Content-Length: " . strlen($contents)); - $splitString = str_split($contents, 1024); - foreach($splitString as $chunk) - echo $chunk; - } - } else { - mysql_close($mysql_dblink); - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - set_input('username',$username); - set_input('size',$size); - require_once(dirname(__FILE__).'/icon.php'); + } +} + //@todo forcing through the framework to ensure the matrix + // is created the same way. + //if ($simplecache_enabled) { + if (false) { + $filename = $dataroot . $matrix . "{$username}/profile/" . $username . $size . ".jpg"; + $contents = @file_get_contents($filename); + if (empty($contents)) { + global $viewinput; + $viewinput['view'] = 'icon/user/default/'.$size; + ob_start(); + include(dirname(dirname(dirname(__FILE__))).'/simplecache/view.php'); + $loc = ob_get_clean(); + header('Location: ' . $loc); + exit; + //$contents = @file_get_contents(dirname(__FILE__) . "/graphics/default{$size}.jpg"); + } else { + header("Content-type: image/jpeg"); + header('Expires: ' . date('r',time() + 864000)); + header("Pragma: public"); + header("Cache-Control: public"); + header("Content-Length: " . strlen($contents)); + $splitString = str_split($contents, 1024); + foreach($splitString as $chunk) + echo $chunk; } -?> + } else { + mysql_close($mysql_dblink); + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + set_input('username',$username); + set_input('size',$size); + require_once(dirname(__FILE__).'/icon.php'); + } \ No newline at end of file diff --git a/mod/profile/index.php b/mod/profile/index.php index ae67dd566..8c8d72d24 100644 --- a/mod/profile/index.php +++ b/mod/profile/index.php @@ -1,41 +1,60 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ - /** - * Elgg profile index - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - // Get the Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); +$username = get_input('username'); +$option = get_input('option', 'activity'); +$body = ''; - // Get the username - $username = get_input('username'); - - $body = ""; - - // Try and get the user from the username and set the page body accordingly - if ($user = get_user_by_username($username)) { - - if ($user->isBanned() && !isadminloggedin()) { - forward(); exit; - } - $body = elgg_view_entity($user,true); - $title = $user->name; +// Try and get the user from the username and set the page body accordingly +if ($user = get_user_by_username($username)) { + if ($user->isBanned() && !isadminloggedin()) { + forward(); exit; + } + $body = elgg_view('profile/profile_navigation', array("option" => $option,"entity" => $user)); + switch($option){ + case 'activity': + $body .= elgg_view('profile/profile_contents/userdetails', array("entity" => $user)); + break; - $body = elgg_view_layout('widgets',$body); - - } else { - - $body = elgg_echo("profile:notfound"); - $title = elgg_echo("profile"); - - } + case 'widgets': + $body .= elgg_view_layout('widgets'); + break; - page_draw($title, $body); - -?> \ No newline at end of file + case 'friends': + $body .= elgg_view('profile/profile_contents/friends', array("entity" => $user)); + break; + case 'extend': + $body .= elgg_view('profile/profile_contents/extend', array("entity" => $user)); + break; + + case 'twitter': + $body .= elgg_view('profile/profile_contents/twitter', array("entity" => $user)); + break; + + case 'default': + $body .= elgg_view('profile/profile_contents/userdetails', array("entity" => $user)); + break; + } + //$body .= elgg_view_entity($user,true); + $title = $user->name; + //$body .= elgg_view_layout('widgets'); +} else { + $body = elgg_echo("profile:notfound"); + $title = elgg_echo("profile"); +} +if ($option == 'widgets') { + //page_draw_widgets($title, $body, $sidebar=""); +} else { + $body = elgg_view_layout("one_column", $body); + page_draw($title, $body); +} \ No newline at end of file diff --git a/mod/profile/javascript.php b/mod/profile/javascript.php index c2c9f8217..62a934c15 100644 --- a/mod/profile/javascript.php +++ b/mod/profile/javascript.php @@ -1,22 +1,19 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ - /** - * Elgg profile JS - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +// Get engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - // Get engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - header("Content-type: text/javascript"); - header('Expires: ' . date('r',time() + 864000)); - header("Pragma: public"); - header("Cache-Control: public"); - echo elgg_view('profile/javascript'); - -?> \ No newline at end of file +header("Content-type: text/javascript"); +header('Expires: ' . date('r',time() + 864000)); +header("Pragma: public"); +header("Cache-Control: public"); +echo elgg_view('profile/javascript'); \ No newline at end of file diff --git a/mod/profile/languages/en.php b/mod/profile/languages/en.php index 7a9ec3f9d..90f49ca0a 100644 --- a/mod/profile/languages/en.php +++ b/mod/profile/languages/en.php @@ -1,93 +1,94 @@ "Profile", - 'profile:edit:default' => 'Replace profile fields', - 'profile:preview' => 'Preview', - - /** - * Profile menu items and titles - */ - - 'profile:yours' => "Your profile", - 'profile:user' => "%s's profile", - - 'profile:edit' => "Edit profile", - 'profile:profilepictureinstructions' => "The profile picture is the image that's displayed on your profile page.
You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)", - 'profile:icon' => "Profile picture", - 'profile:createicon' => "Create your avatar", - 'profile:currentavatar' => "Current avatar", - 'profile:createicon:header' => "Profile picture", - 'profile:profilepicturecroppingtool' => "Profile picture cropping tool", - 'profile:createicon:instructions' => "Click and drag a square below to match how you want your picture cropped. A preview of your cropped picture will appear in the box on the right. When you are happy with the preview, click 'Create your avatar'. This cropped image will be used throughout the site as your avatar. ", - - 'profile:editdetails' => "Edit details", - 'profile:editicon' => "Edit profile icon", - - 'profile:aboutme' => "About me", - 'profile:description' => "About me", - 'profile:briefdescription' => "Brief description", - 'profile:location' => "Location", - 'profile:skills' => "Skills", - 'profile:interests' => "Interests", - 'profile:contactemail' => "Contact email", - 'profile:phone' => "Telephone", - 'profile:mobile' => "Mobile phone", - 'profile:website' => "Website", - - 'profile:banned' => 'This user account has been suspended.', - 'profile:deleteduser' => 'Deleted user', - - 'profile:river:update' => "%s updated their profile", - 'profile:river:iconupdate' => "%s updated their profile icon", - - 'profile:label' => "Profile label", - 'profile:type' => "Profile type", - - 'profile:editdefault:fail' => 'Default profile could not be saved', - 'profile:editdefault:success' => 'Item successfully added to default profile', - - - 'profile:editdefault:delete:fail' => 'Removed default profile item field failed', - 'profile:editdefault:delete:success' => 'Default profile item deleted!', - - 'profile:defaultprofile:reset' => 'Default system profile reset', - - 'profile:resetdefault' => 'Reset default profile', - 'profile:explainchangefields' => 'You can replace the existing profile fields with your own using the form below. First you give the new profile field a label, for example, \'Favourite team\'. Next you need to select the field type, for example, tags, url, text and so on. At any time you can revert back to the default profile set up.', - - - /** - * Profile status messages - */ - - 'profile:saved' => "Your profile was successfully saved.", - 'profile:icon:uploaded' => "Your profile picture was successfully uploaded.", - - /** - * Profile error messages - */ - - 'profile:noaccess' => "You do not have permission to edit this profile.", - 'profile:notfound' => "Sorry, we could not find the specified profile.", - 'profile:icon:notfound' => "Sorry, there was a problem uploading your profile picture.", - 'profile:icon:noaccess' => 'You cannot change this profile icon', - 'profile:field_too_long' => 'Cannot save your profile information because the "%s" section is too long.', - - ); - - add_translation("en",$english); \ No newline at end of file +/** + * Elgg profile plugin language pack + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +$english = array( + +/** + * Profile + */ + + 'profile' => "Profile", + 'profile:edit:default' => 'Replace profile fields', + 'profile:preview' => 'Preview', + +/** + * Profile menu items and titles + */ + + 'profile:yours' => "My profile", + 'profile:user' => "%s's profile", + + 'profile:edit' => "Edit profile", + 'profile:profilepictureinstructions' => "The profile picture is the image that's displayed on your profile page.
You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)", + 'profile:icon' => "Profile picture", + 'profile:createicon' => "Create your avatar", + 'profile:currentavatar' => "Current avatar", + 'profile:createicon:header' => "Profile picture", + 'profile:profilepicturecroppingtool' => "Profile picture cropping tool", + 'profile:createicon:instructions' => "Click and drag a square below to match how you want your picture cropped. A preview of your cropped picture will appear in the box on the right. When you are happy with the preview, click 'Create your avatar'. This cropped image will be used throughout the site as your avatar. ", + + 'profile:editdetails' => "Edit details", + 'profile:editicon' => "Edit profile icon", + + 'profile:aboutme' => "About me", + 'profile:description' => "About me", + 'profile:briefdescription' => "Brief description", + 'profile:location' => "Location", + 'profile:skills' => "Skills", + 'profile:interests' => "Interests", + 'profile:contactemail' => "Contact email", + 'profile:phone' => "Telephone", + 'profile:mobile' => "Mobile phone", + 'profile:website' => "Website", + + 'profile:banned' => 'This user account has been suspended.', + 'profile:deleteduser' => 'Deleted user', + + 'profile:river:update' => "%s updated their profile", + 'profile:river:iconupdate' => "%s updated their profile icon", + + 'profile:label' => "Profile label", + 'profile:type' => "Profile type", + 'profile:twitter' => "Twitter username", + 'twitter:visit' => "Visit this Twitter account", + 'profile:editdefault:fail' => 'Default profile could not be saved', + 'profile:editdefault:success' => 'Item successfully added to default profile', + + + 'profile:editdefault:delete:fail' => 'Removed default profile item field failed', + 'profile:editdefault:delete:success' => 'Default profile item deleted!', + + 'profile:defaultprofile:reset' => 'Default system profile reset', + + 'profile:resetdefault' => 'Reset default profile', + 'profile:explainchangefields' => 'You can replace the existing profile fields with your own using the form below. First you give the new profile field a label, for example, \'Favourite team\'. Next you need to select the field type, for example, tags, url, text and so on. At any time you can revert back to the default profile set up.', + + +/** + * Profile status messages + */ + + 'profile:saved' => "Your profile was successfully saved.", + 'profile:icon:uploaded' => "Your profile picture was successfully uploaded.", + +/** + * Profile error messages + */ + + 'profile:noaccess' => "You do not have permission to edit this profile.", + 'profile:notfound' => "Sorry, we could not find the specified profile.", + 'profile:icon:notfound' => "Sorry, there was a problem uploading your profile picture.", + 'profile:icon:noaccess' => 'You cannot change this profile icon', + 'profile:field_too_long' => 'Cannot save your profile information because the "%s" section is too long.', + +); + +add_translation('en', $english); \ No newline at end of file diff --git a/mod/profile/profile_lib.php b/mod/profile/profile_lib.php new file mode 100644 index 000000000..176c6e4de --- /dev/null +++ b/mod/profile/profile_lib.php @@ -0,0 +1,73 @@ + + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +/** + * Returns the html for a user profile. + * + * @param string $username The username of the profile to display + * @param string $section Which section is currently selected. + * + * return mixed FALSE or html for the profile. + */ +function profile_get_user_profile_html($user, $section = 'activity') { + $body = elgg_view('profile/profile_navigation', array('section' => $section, 'entity' => $user)); + $view_options = array('entity' => $user); + + switch($section){ + case 'widgets': + $body .= elgg_view_layout('widgets', $view_options); + break; + + case 'friends': + $body .= elgg_view('profile/profile_contents/friends', $view_options); + break; + + case 'twitter': + $body .= elgg_view('profile/profile_contents/twitter', $view_options); + break; + + case 'details': + $body .= elgg_view('profile/profile_contents/details', $view_options); + break; + + default: + case 'activity': + $body .= elgg_view('profile/profile_contents/activity', $view_options); + break; + } + + return $body; +} + +/** + * Dispatch the html for the edit section + * + * @param unknown_type $user + * @param unknown_type $page + * @return string + */ +function profile_get_user_edit_content($user, $page) { + $section = (isset($page[2])) ? $page[2] : 'details'; + + switch ($section) { + case 'icon': + $content = elgg_view_title(elgg_echo('profile:edit')); + $content .= elgg_view("profile/editicon", array('entity' => $user)); + break; + default: + case 'details': + $content = elgg_view_title(elgg_echo('profile:edit')); + $content .= elgg_view("profile/edit", array('entity' => $user)); + break; + } + + return $content; +} \ No newline at end of file diff --git a/mod/profile/start.php b/mod/profile/start.php index 168d0b013..2fef3f4d2 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -1,319 +1,307 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - /** - * Profile init function; sets up the profile functions - * - */ - function profile_init() { - - // Get config - global $CONFIG; - - // Register a URL handler for users - this means that profile_url() - // will dictate the URL for all ElggUser objects - register_entity_url_handler('profile_url','user','all'); - - // Metadata on users needs to be independent - register_metadata_as_independent('user'); - - elgg_view_register_simplecache('icon/user/default/tiny'); - elgg_view_register_simplecache('icon/user/default/topbar'); - elgg_view_register_simplecache('icon/user/default/small'); - elgg_view_register_simplecache('icon/user/default/medium'); - elgg_view_register_simplecache('icon/user/default/large'); - elgg_view_register_simplecache('icon/user/default/master'); - - // For now, we'll hard code the profile items as follows: - // TODO make this user configurable - - - - /*$CONFIG->profile = array( - - // Language short codes must be of the form "profile:key" - // where key is the array key below - 'description' => 'longtext', - 'briefdescription' => 'text', - 'location' => 'tags', - 'interests' => 'tags', - 'skills' => 'tags', - 'contactemail' => 'email', - 'phone' => 'text', - 'mobile' => 'text', - 'website' => 'url', - - );*/ - - // Register a page handler, so we can have nice URLs - register_page_handler('profile','profile_page_handler'); - register_page_handler('defaultprofile','profileedit_page_handler'); - register_page_handler('icon','profile_icon_handler'); - register_page_handler('iconjs','profile_iconjs_handler'); - - // Add Javascript reference to the page header - elgg_extend_view('metatags','profile/metatags'); - elgg_extend_view('css','profile/css'); - elgg_extend_view('js/initialise_elgg','profile/javascript'); - if (get_context() == "profile") { - elgg_extend_view('canvas_header/submenu','profile/submenu'); - } - - - - // Extend context menu with admin links - if (isadminloggedin()) - { - elgg_extend_view('profile/menu/links','profile/menu/adminwrapper',10000); - } - - // Now override icons - register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook'); - +/** + * Elgg profile plugin + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +/** + * Profile init function; sets up the profile functions + * + */ +function profile_init() { + global $CONFIG; + + require_once 'profile_lib.php'; + + // Register a URL handler for users - this means that profile_url() + // will dictate the URL for all ElggUser objects + register_entity_url_handler('profile_url', 'user', 'all'); + + // Set up the menu for logged-in users + if (isloggedin()) { + add_menu(elgg_echo('profile:yours'), $_SESSION['user']->getURL() . '/extend'); + } + + // Metadata on users needs to be independent + register_metadata_as_independent('user'); + + elgg_view_register_simplecache('icon/user/default/tiny'); + elgg_view_register_simplecache('icon/user/default/topbar'); + elgg_view_register_simplecache('icon/user/default/small'); + elgg_view_register_simplecache('icon/user/default/medium'); + elgg_view_register_simplecache('icon/user/default/large'); + elgg_view_register_simplecache('icon/user/default/master'); + + // Register a page handler, so we can have nice URLs + register_page_handler('profile', 'profile_page_handler'); + register_page_handler('defaultprofile', 'profileedit_page_handler'); + register_page_handler('icon', 'profile_icon_handler'); + register_page_handler('iconjs', 'profile_iconjs_handler'); + + // Add Javascript reference to the page header + elgg_extend_view('metatags', 'profile/metatags'); + elgg_extend_view('css', 'profile/css'); + elgg_extend_view('js/initialise_elgg', 'profile/javascript'); + + if (get_context() == 'profile') { + elgg_extend_view('canvas_header/submenu', 'profile/submenu'); + } + + // Extend context menu with admin links + if (isadminloggedin()){ + elgg_extend_view('profile/menu/links', 'profile/menu/adminwrapper', 10000); + } + + // Now override icons + register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook'); + +} + +/** + * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit + * add and delete fields. + * + * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all + * other plugins have initialised. + */ +function profile_fields_setup() { + global $CONFIG; + + $profile_defaults = array ( + 'description' => 'longtext', + 'briefdescription' => 'text', + 'location' => 'tags', + 'interests' => 'tags', + 'skills' => 'tags', + 'contactemail' => 'email', + 'phone' => 'text', + 'mobile' => 'text', + 'website' => 'url', + 'twitter' => 'text' + ); + + // TODO: Have an admin interface for this + $n = 0; + $loaded_defaults = array(); + while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile')){ + // Add a translation + add_translation(get_current_language(), array("profile:admin_defined_profile_$n" => $translation)); + + // Detect type + $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile'); + if (!$type) $type = 'text'; + + // Set array + $loaded_defaults["admin_defined_profile_$n"] = $type; + + $n++; + } + if (count($loaded_defaults)) { + $CONFIG->profile_using_custom = true; + $profile_defaults = $loaded_defaults; + } + + $CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults); + + // register any tag metadata names + foreach ($CONFIG->profile as $name => $type) { + if ($type == 'tags') { + elgg_register_tag_metadata_name($name); + // register a tag name translation + add_translation(get_current_language(), array("tag_names:$name" => elgg_echo("profile:$name"))); } - - /** - * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit - * add and delete fields. - * - * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all - * other plugins have initialised. - */ - function profile_fields_setup() - { - global $CONFIG; - - $profile_defaults = array ( - 'description' => 'longtext', - 'briefdescription' => 'text', - 'location' => 'tags', - 'interests' => 'tags', - 'skills' => 'tags', - 'contactemail' => 'email', - 'phone' => 'text', - 'mobile' => 'text', - 'website' => 'url', - ); - - // TODO: Have an admin interface for this - - $n = 0; - $loaded_defaults = array(); - while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile')) - { - // Add a translation - add_translation(get_current_language(), array("profile:admin_defined_profile_$n" => $translation)); - - // Detect type - $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile'); - if (!$type) $type = 'text'; - - // Set array - $loaded_defaults["admin_defined_profile_$n"] = $type; - - $n++; - } - if (count($loaded_defaults)) { - $CONFIG->profile_using_custom = true; - $profile_defaults = $loaded_defaults; - } - - $CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults); - - // register any tag metadata names - foreach ($CONFIG->profile as $name => $type) { - if ($type == 'tags') { - elgg_register_tag_metadata_name($name); - // register a tag name translation - add_translation(get_current_language(), array("tag_names:$name" => elgg_echo("profile:$name"))); - } - } + } +} + +/** + * Profile page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ +function profile_page_handler($page) { + global $CONFIG; + + $username = $action = NULL; + + // short circuit if invalid or banned username + if (isset($page[0])) { + $username = $page[0]; + $user = get_user_by_username($username); + + if (!$user || ($user->isBanned() && !isadminloggedin())) { + return elgg_echo('profile:notfound'); + } else { + set_input('username', $page[0]); } + } - /** - * Profile page handler - * - * @param array $page Array of page elements, forwarded by the page handling mechanism - */ - function profile_page_handler($page) { + if (isset($page[1])) { + $action = $page[1]; + } - global $CONFIG; - - // The username should be the file we're getting - if (isset($page[0])) { - set_input('username',$page[0]); + switch ($action) { + case 'edit': + if (!$user || !$user->canEdit()) { + register_error(elgg_echo("profile:noaccess")); + forward(); } - // Any sub pages? - if (isset($page[1])) { - switch ($page[1]) - { - case 'edit' : include($CONFIG->pluginspath . "profile/edit.php"); break; - case 'editicon' : include($CONFIG->pluginspath . "profile/editicon.php"); break; + $content = profile_get_user_edit_content($user, $page); + break; - } - } - else - { - // Include the standard profile index - include($CONFIG->pluginspath . "profile/index.php"); - } - } - - /** - * Profile edit page handler - * - * @param array $page Array of page elements, forwarded by the page handling mechanism - */ - function profileedit_page_handler($page) { - - global $CONFIG; - - // The username should be the file we're getting - if (isset($page[0])) { - switch ($page[0]) - { - default: include($CONFIG->pluginspath . "profile/defaultprofile.php"); - } - } - - } - - /** - * Pagesetup function - * - */ - function profile_pagesetup() - { - global $CONFIG; - if (get_context() == 'admin' && isadminloggedin()) { - - add_submenu_item(elgg_echo('profile:edit:default'), $CONFIG->wwwroot . 'pg/defaultprofile/edit/'); - } - - //add submenu options - if (get_context() == "profile") { - $page_owner = page_owner_entity(); - - add_submenu_item(elgg_echo('profile:editdetails'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/edit/"); - add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/editicon/"); - } - } - - /** - * Profile icon page handler - * - * @param array $page Array of page elements, forwarded by the page handling mechanism - */ - function profile_icon_handler($page) { - - global $CONFIG; - - // The username should be the file we're getting - if (isset($page[0])) { - set_input('username',$page[0]); - } + default: if (isset($page[1])) { - set_input('size',$page[1]); + $section = $page[1]; + } else { + $section = 'activity'; } - // Include the standard profile index - include($CONFIG->pluginspath . "profile/icon.php"); - + $content = profile_get_user_profile_html($user, $section); + break; + } + + $content = elgg_view_layout('one_column', $content); + + page_draw($title, $content); + return; +} + +/** + * Profile edit page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ +function profileedit_page_handler($page) { + global $CONFIG; + + // The username should be the file we're getting + if (isset($page[0])) { + switch ($page[0]) { + default: + include($CONFIG->pluginspath . "profile/defaultprofile.php"); + break; } - - /** - * Icon JS - */ - function profile_iconjs_handler($page) { - - global $CONFIG; - - include($CONFIG->pluginspath . "profile/javascript.php"); - + } +} + +/** + * Pagesetup function + * + */ +function profile_pagesetup() +{ + global $CONFIG; + if (get_context() == 'admin' && isadminloggedin()) { + add_submenu_item(elgg_echo('profile:edit:default'), $CONFIG->wwwroot . 'pg/defaultprofile/edit/'); + } + + //add submenu options + if (get_context() == "profile") { + $page_owner = page_owner_entity(); + add_submenu_item(elgg_echo('profile:editdetails'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/edit/details"); + add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/edit/icon"); + } +} + +/** + * Profile icon page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ +function profile_icon_handler($page) { + global $CONFIG; + + // The username should be the file we're getting + if (isset($page[0])) { + set_input('username',$page[0]); + } + if (isset($page[1])) { + set_input('size',$page[1]); + } + // Include the standard profile index + include($CONFIG->pluginspath . "profile/icon.php"); +} + +/** + * Icon JS + */ +function profile_iconjs_handler($page) { + global $CONFIG; + include($CONFIG->pluginspath . "profile/javascript.php"); +} + +/** + * Profile URL generator for $user->getUrl(); + * + * @param ElggUser $user + * @return string User URL + */ +function profile_url($user) { + global $CONFIG; + return $CONFIG->wwwroot . "pg/profile/" . $user->username; +} + +/** + * This hooks into the getIcon API and provides nice user icons for users where possible. + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + * @return unknown + */ +function profile_usericon_hook($hook, $entity_type, $returnvalue, $params){ + global $CONFIG; + if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggUser)){ + $entity = $params['entity']; + $type = $entity->type; + $subtype = get_subtype_from_id($entity->subtype); + $viewtype = $params['viewtype']; + $size = $params['size']; + $username = $entity->username; + + if ($icontime = $entity->icontime) { + $icontime = "{$icontime}"; + } else { + $icontime = "default"; } - /** - * Profile URL generator for $user->getUrl(); - * - * @param ElggUser $user - * @return string User URL - */ - function profile_url($user) { - global $CONFIG; - return $CONFIG->wwwroot . "pg/profile/" . $user->username; + if ($entity->isBanned()) { + return elgg_view('icon/user/default/'.$size); } - /** - * This hooks into the getIcon API and provides nice user icons for users where possible. - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - * @return unknown - */ - function profile_usericon_hook($hook, $entity_type, $returnvalue, $params) - { - global $CONFIG; - - if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggUser)) - { - - $entity = $params['entity']; - $type = $entity->type; - $subtype = get_subtype_from_id($entity->subtype); - $viewtype = $params['viewtype']; - $size = $params['size']; - $username = $entity->username; - - if ($icontime = $entity->icontime) { - $icontime = "{$icontime}"; - } else { - $icontime = "default"; - } - - if ($entity->isBanned()) { - return elgg_view('icon/user/default/'.$size); - } - - $filehandler = new ElggFile(); - $filehandler->owner_guid = $entity->getGUID(); - $filehandler->setFilename("profile/" . $username . $size . ".jpg"); - - if ($filehandler->exists()) { - //$url = $CONFIG->url . "pg/icon/$username/$size/$icontime.jpg"; - return $CONFIG->wwwroot . 'mod/profile/icondirect.php?lastcache='.$icontime.'&username='.$entity->username.'&size='.$size; - } - } + $filehandler = new ElggFile(); + $filehandler->owner_guid = $entity->getGUID(); + $filehandler->setFilename("profile/" . $username . $size . ".jpg"); + + if ($filehandler->exists()) { + //$url = $CONFIG->url . "pg/icon/$username/$size/$icontime.jpg"; + return $CONFIG->wwwroot . 'mod/profile/icondirect.php?lastcache='.$icontime.'&username='.$entity->username.'&size='.$size; } + } +} - // Make sure the profile initialisation function is called on initialisation - register_elgg_event_handler('init','system','profile_init',1); - register_elgg_event_handler('init','system','profile_fields_setup', 10000); // Ensure this runs after other plugins +// Make sure the profile initialisation function is called on initialisation +register_elgg_event_handler('init','system','profile_init',1); +register_elgg_event_handler('init','system','profile_fields_setup', 10000); // Ensure this runs after other plugins - register_elgg_event_handler('pagesetup','system','profile_pagesetup'); - register_elgg_event_handler('profileupdate','all','object_notifications'); +register_elgg_event_handler('pagesetup','system','profile_pagesetup'); +register_elgg_event_handler('profileupdate','all','object_notifications'); - // Register actions - global $CONFIG; - register_action("profile/edit",false,$CONFIG->pluginspath . "profile/actions/edit.php"); - register_action("profile/iconupload",false,$CONFIG->pluginspath . "profile/actions/iconupload.php"); - register_action("profile/cropicon",false,$CONFIG->pluginspath . "profile/actions/cropicon.php"); - register_action("profile/editdefault",false,$CONFIG->pluginspath . "profile/actions/editdefault.php", true); - register_action("profile/editdefault/delete",false,$CONFIG->pluginspath . "profile/actions/deletedefaultprofileitem.php", true); - register_action("profile/editdefault/reset",false,$CONFIG->pluginspath . "profile/actions/resetdefaultprofile.php", true); +// Register actions +global $CONFIG; +register_action("profile/edit",false,$CONFIG->pluginspath . "profile/actions/edit.php"); +register_action("profile/iconupload",false,$CONFIG->pluginspath . "profile/actions/iconupload.php"); +register_action("profile/cropicon",false,$CONFIG->pluginspath . "profile/actions/cropicon.php"); +register_action("profile/editdefault",false,$CONFIG->pluginspath . "profile/actions/editdefault.php", true); +register_action("profile/editdefault/delete",false,$CONFIG->pluginspath . "profile/actions/deletedefaultprofileitem.php", true); +register_action("profile/editdefault/reset",false,$CONFIG->pluginspath . "profile/actions/resetdefaultprofile.php", true); - // Define widgets for use in this context - use_widgets('profile'); -?> \ No newline at end of file +// Define widgets for use in this context +use_widgets('profile'); \ No newline at end of file diff --git a/mod/profile/views/default/profile/admin_menu.php b/mod/profile/views/default/profile/admin_menu.php new file mode 100755 index 000000000..c89505673 --- /dev/null +++ b/mod/profile/views/default/profile/admin_menu.php @@ -0,0 +1,42 @@ + + + diff --git a/mod/profile/views/default/profile/css.php b/mod/profile/views/default/profile/css.php index cf95d9bdb..b475b6bdd 100644 --- a/mod/profile/views/default/profile/css.php +++ b/mod/profile/views/default/profile/css.php @@ -1,25 +1,326 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - +/** + * Elgg Profile + * + * @package Profile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ ?> - -#profile_icon_wrapper { +/* *************************************** + main layout blocks +*************************************** */ +#profile_content { + float:right; + width:700px; + position: relative; +} +#profile_sidebar { + width:230px; float:left; } - +.elgg_horizontal_tabbed_nav.profile { + margin-top:0px; + margin-bottom:25px; + position:relative; +} +.elgg_horizontal_tabbed_nav.profile .profile_name { + display:block; + width:265px; + position:absolute; +} +.elgg_horizontal_tabbed_nav.profile .profile_name h2 { + margin:0; + padding:0; + border:none; +} +.elgg_horizontal_tabbed_nav.profile ul { + margin-left:260px; +} + +/* *************************************** + default avatar icons +*************************************** */ .usericon { position:relative; } +.usericon.tiny { + width:25px; + height:25px; +} +.usericon.small { + width:40px; + height:40px; +} + +/* *************************************** + ownerblock in sidebar +*************************************** */ +#profile_sidebar #owner_block { + background-color: #eeeeee; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + padding:15px; + min-height:270px; +} +#owner_block .owner_block_icon { + float:left; + padding:0; + margin:0; +} +#owner_block .owner_block_icon.large { + width:200px; + height:200px; + overflow: hidden; + float:none; +} +#owner_block .owner_block_contents { + margin-left: 50px; +} +#owner_block .owner_block_contents h3 { + margin-top:-4px; +} +#owner_block .owner_block_contents p.profile_info { + margin:0; + padding:0; + color: #666666; +} +#owner_block .owner_block_contents p.profile_info.briefdescription { + font-size: 90%; + line-height:1.2em; + font-style: italic; +} +#owner_block .owner_block_contents p.profile_info.location { + font-size: 90%; +} +#owner_block .profile_actions { + margin-top:10px; +} +#owner_block .profile_actions a.action_button { + margin-bottom:4px; + display: table; +} +/* ownerblock links to owners tools */ +.owner_block_links { + margin-top:5px; +} +.owner_block_links ul { + margin:0; + padding:0; + list-style: none; +} +.owner_block_links ul li.selected a { + background: #4690D6; + color:white; +} +.owner_block_links ul li a { + display:block; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + background-color:white; + margin:3px 0 5px 0; + padding:2px 4px 2px 8px; +} +.owner_block_links ul li a:hover { + background:#0054A7; + color:white; + text-decoration:none; +} + + +/* *************************************** + admin menu in sidebar +*************************************** */ +.owner_block_links .admin_menu_options { + display: none; +} +.owner_block_links ul.admin_menu { + background-color:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + cursor:pointer; +} +.owner_block_links ul.admin_menu li a { + background-color: red; + color:white; + margin-bottom:0; +} +.owner_block_links ul.admin_menu li ul.admin_menu_options li a { + color:red; + background-color:white; + display:block; + margin:0px; + padding:2px 4px 2px 13px; +} +.owner_block_links ul.admin_menu li ul.admin_menu_options li a:hover { + color:black; + background:none; + text-decoration: underline; +} + + +/* *************************************** + full profile info panel +*************************************** */ +#profile_content .odd { + background-color:#f4f4f4; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + margin:0 0 7px 0; + padding:2px 4px 2px 4px; +} +#profile_content .even { + background-color:#f4f4f4; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + margin:0 0 7px 0; + padding:2px 4px 2px 4px; +} +#profile_content .aboutme_title { + background-color:#f4f4f4; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + margin:0 0 0px 0; + padding:2px 4px 2px 4px; +} +#profile_content .aboutme_contents { + padding:2px 0 0 3px; +} + +/* *************************************** + friends panel within profile +*************************************** */ +#profile_content .entity_listing .entity_listing_info { + width:664px; +} + + +/* *************************************** + twitter panel within profile +*************************************** */ +ul#twitter_update_list li { + background-image: url(mod/elgg_layout/graphics/speech_bubble_tail.gif); + background-position:right bottom; + background-repeat: no-repeat; + list-style-image:none; + list-style-position:outside; + list-style-type:none; + margin:0 0 5px 0; + padding:0; + overflow-x: hidden; +} +ul#twitter_update_list li span { + color:#666666; + background:#ececec; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + padding:3px 5px 4px 5px; + display:block; +} +ul#twitter_update_list li a { + display:block; + margin:-2px 0 0 4px; +} +ul#twitter_update_list li span a { + display:inline !important; +} +p.visit_twitter a { + background:url(mod/elgg_layout/graphics/twitter16px.png) left no-repeat; + padding:0 0 0 20px; + margin:0; +} +.visit_twitter { + padding:5px 0; + margin:0 0 0 0; + border-top:1px solid #dedede; +} + + +/* *************************************** + edit profile page +*************************************** */ +form#edit_profile { + margin-top:10px; +} + + +/* *************************************** + user avatar upload & crop page +*************************************** */ +#avatar_upload { + height:145px; +} +#current_user_avatar { + float:left; + width:160px; + height:130px; + border-right:1px solid #cccccc; + margin:0 20px 0 0; +} +#avatar_croppingtool { + border-top: 1px solid #cccccc; + margin:20px 0 0 0; + padding:10px 0 0 0; +} +#avatar_croppingtool .current_user_avatar { + float: left; + margin-right: 20px; +} +#avatar_croppingtool .user_avatar_crop_preview { + float: left; + position: relative; + overflow: hidden; + width: 100px; + height: 100px; +} + + +/* *************************************** + banned user +*************************************** */ +/* banned user full profile panel */ +#profile_content .banned_user { + border:2px solid red; + padding:4px 8px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; +} +/* banned user in friends lists */ +.entity_listing_info p.entity_title.user.banned { + text-decoration: line-through; +} +.entity_listing_info p.entity_title.user.banned a { + color:red; +} + + +/* *************************************** + admin area - custom profile fields +*************************************** */ +.default_profile_reset { + border-top: 1px solid #dedede; + margin-top:30px; +} +.default_profile_reset input[type="submit"] { + background: #dedede; + border-color: #dedede; + color:#666666; + text-shadow: none; + float:right; +} +.default_profile_reset input[type="submit"]:hover { + background: red; + border-color: red; + color:white; +} + + +/* *************************************** + avatar drop-down menu +*************************************** */ .avatar_menu_button { width:15px; height:15px; @@ -44,53 +345,56 @@ width:15px; height:15px; } +/* user avatar submenu options */ .usericon div.sub_menu { display:none; position:absolute; - padding:2px; + padding:0; margin:0; border-top:solid 1px #E5E5E5; border-left:solid 1px #E5E5E5; border-right:solid 1px #999999; border-bottom:solid 1px #999999; - width:160px; + width:164px; background:#FFFFFF; text-align:left; + -webkit-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); /* safari v3+ */ + -moz-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); /* FF v3.5+ */ } div.usericon a.icon img { z-index:10; } - -.usericon div.sub_menu a {margin:0;padding:2px;} .usericon div.sub_menu a:link, .usericon div.sub_menu a:visited, -.usericon div.sub_menu a:hover{ display:block;} -.usericon div.sub_menu a:hover{ background:#cccccc; text-decoration:none;} - +.usericon div.sub_menu a:hover { + display:block; +} +.usericon div.sub_menu a:hover { + background:#cccccc; + text-decoration:none; +} .usericon div.sub_menu h3 { - font-size:1.2em; - padding-bottom:3px; + font-size:1.3em; + line-height: 1.1em; + padding:0; border-bottom:solid 1px #dddddd; color: #4690d6; margin:0 !important; } -.usericon div.sub_menu h3:hover { - +.usericon div.sub_menu h3 a { + padding:3px 3px 3px 6px !important; } - -.user_menu_addfriend, -.user_menu_removefriend, -.user_menu_profile, -.user_menu_friends, -.user_menu_friends_of, -.user_menu_blog, -.user_menu_file, -.user_menu_messages, -.user_menu_admin, -.user_menu_pages { - margin:0; - padding:0; +.usericon div.sub_menu p { + margin:0 !important; + padding:0 !important; + height:auto !important; + line-height:1.2em !important; + font-size:12px !important; } +.usericon div.sub_menu p a { + padding:3px 3px 3px 6px !important; +} +/* admin menu options in avatar submenu */ .user_menu_admin { border-top:solid 1px #dddddd; } @@ -101,24 +405,48 @@ div.usericon a.icon img { color:white !important; background:red !important; } +/* /////////////////////////////////////////////////////////////// >>>END verified */ + -.resetdefaultprofile { - padding:0 10px 0 10px; + +/* +#profile_status_wrapper { + background-color:#eeeeee; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + padding:2px 4px 2px 4px; + margin:0 0 7px 0; + line-height:1.2em; + min-height:16px; + + position: relative; } -.resetdefaultprofile input[type="submit"] { - background: #dedede; - border-color: #dedede; - color:#333333; +#profile_status_wrapper.inline { + margin-top:10px; } -.resetdefaultprofile input[type="submit"]:hover { - background: red; - border-color: red; - color:white; +.profile_status span { + display:block; + font-size:90%; + color:#666666; } +a.status_update { + float:right; +} +div.profile_status { + z-index: 2; + position: relative; +} +#profile_status_tail { + position: absolute; + width:17px; + height:12px; + left:-11px; + bottom:-5px; -/* Banned user */ -#profile_banned { - background-color:#FF8888; - border:3px solid #FF0000; - padding:2px; -} \ No newline at end of file + background-image: url(mod/thewire/graphics/speech_tail.png); + background-position: 0 0; + background-repeat: no-repeat; + background-color:transparent; + z-index: 1; +} +*/ \ No newline at end of file diff --git a/mod/profile/views/default/profile/edit.php b/mod/profile/views/default/profile/edit.php index 11e3c2997..06d7bcfe2 100644 --- a/mod/profile/views/default/profile/edit.php +++ b/mod/profile/views/default/profile/edit.php @@ -1,25 +1,28 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity - * @uses $vars['profile'] Profile items from $CONFIG->profile, defined in profile/start.php for now - */ - +/** + * Elgg profile edit form + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity + * @uses $vars['profile'] Profile items from $CONFIG->profile, defined in profile/start.php for now + */ ?> -
-
+ - + 'name', 'value' => page_owner_entity()->name)); + ?> +

+ +profile) && sizeof($vars['config']->profile) > 0) foreach($vars['config']->profile as $shortname => $valtype) { if ($metadata = get_metadata_byname($vars['entity']->guid, $shortname)) { @@ -63,5 +66,4 @@ " />

-
-
\ No newline at end of file + \ No newline at end of file diff --git a/mod/profile/views/default/profile/editdefaultprofile.php b/mod/profile/views/default/profile/editdefaultprofile.php index 73f0a8783..42680f4df 100644 --- a/mod/profile/views/default/profile/editdefaultprofile.php +++ b/mod/profile/views/default/profile/editdefaultprofile.php @@ -1,35 +1,33 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +/** + * Elgg profile index + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ - $label_text = elgg_echo('profile:label'); - $type_text = elgg_echo('profile:type'); +$label_text = elgg_echo('profile:label'); +$type_text = elgg_echo('profile:type'); - $label_control = elgg_view('input/text', array('internalname' => 'label')); - $type_control = elgg_view('input/pulldown', array('internalname' => 'type', 'options_values' => array( - 'text' => elgg_echo('text'), - 'longtext' => elgg_echo('longtext'), - 'tags' => elgg_echo('tags'), - 'url' => elgg_echo('url'), - 'email' => elgg_echo('email') - ))); +$label_control = elgg_view('input/text', array('internalname' => 'label')); +$type_control = elgg_view('input/pulldown', array('internalname' => 'type', 'options_values' => array( + 'text' => elgg_echo('text'), + 'longtext' => elgg_echo('longtext'), + 'tags' => elgg_echo('tags'), + 'url' => elgg_echo('url'), + 'email' => elgg_echo('email') +))); - $submit_control = elgg_view('input/submit', array('internalname' => elgg_echo('save'), 'value' => elgg_echo('save'))); +$submit_control = elgg_view('input/submit', array('internalname' => elgg_echo('save'), 'value' => elgg_echo('Add'))); - $formbody = <<< END -

$label_text: $label_control - $type_text: $type_control - $submit_control

+$formbody = <<< END +

$label_text: $label_control + $type_text: $type_control + $submit_control

END; - echo "
"; - echo "

" . elgg_echo('profile:explainchangefields') . "

"; - echo elgg_view('input/form', array('body' => $formbody, 'action' => $vars['url'] . 'action/profile/editdefault')); - echo "
"; -?> \ No newline at end of file + +echo "

" . elgg_echo('profile:explainchangefields') . "

"; +echo elgg_view('input/form', array('body' => $formbody, 'action' => $vars['url'] . 'action/profile/editdefault')); diff --git a/mod/profile/views/default/profile/editicon.php b/mod/profile/views/default/profile/editicon.php index 7731d9899..20e16b978 100644 --- a/mod/profile/views/default/profile/editicon.php +++ b/mod/profile/views/default/profile/editicon.php @@ -1,24 +1,21 @@ profile, defined in profile/start.php for now - */ - - // user is passed to view and set by caller (normally the page editicon) - $currentuser = $vars['user']; - +/** + * Elgg profile icon edit form + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity + * @uses $vars['profile'] Profile items from $CONFIG->profile, defined in profile/start.php for now + */ + +// user is passed to view and set by caller (normally the page editicon) +$currentuser = $vars['user']; ?> -

@@ -29,13 +26,13 @@ getIcon('medium'); - echo "\"avatar\""; + echo "avatar"; ?>
-
+
@@ -50,21 +47,16 @@
-
+

getIcon('master'); - ?>

-

-<?php echo elgg_echo(" /> -

- -
+
+ <?php echo elgg_echo(" /> +
@@ -144,6 +116,3 @@
-
- -
diff --git a/mod/profile/views/default/profile/gallery.php b/mod/profile/views/default/profile/gallery.php deleted file mode 100644 index ffbabfc7d..000000000 --- a/mod/profile/views/default/profile/gallery.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity - */ - - //grab the users status message with metadata 'state' set to current if it exists -/* if($get_status = get_entities_from_metadata("state", "current", "object", "status", $vars['entity']->guid)){ - - foreach($get_status as $s) { - $info = elgg_view("status/friends_view", array('entity' => $s)); - } - - } */ - - $icon = elgg_view( - "profile/icon", array( - 'entity' => $vars['entity'], - 'size' => 'medium', - ) - ); - - $banned = $vars['entity']->isBanned(); - - $rel = ""; - if (page_owner() == $vars['entity']->guid) - $rel = 'me'; - else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid)) - $rel = 'friend'; - - if (!$banned) - $info .= "

getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "

"; - else - $info .= "

" . $vars['entity']->name . "
".elgg_echo('profile:banned')."

"; - - // echo elgg_view_listing($icon, $info); - echo elgg_view('search/gallery_listing',array('icon' => $icon, 'info' => $info)); - -?> \ No newline at end of file diff --git a/mod/profile/views/default/profile/hoverover.php b/mod/profile/views/default/profile/hoverover.php index 678fbbada..571585311 100644 --- a/mod/profile/views/default/profile/hoverover.php +++ b/mod/profile/views/default/profile/hoverover.php @@ -1,26 +1,20 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - */ - +/** + * Elgg profile icon hover over + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + */ ?> - -

- name; ?> -

- +

+ name; ?> +

\ No newline at end of file diff --git a/mod/profile/views/default/profile/icon.php b/mod/profile/views/default/profile/icon.php index 3fd6ab87b..59b16cdac 100644 --- a/mod/profile/views/default/profile/icon.php +++ b/mod/profile/views/default/profile/icon.php @@ -1,53 +1,54 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - * @uses $vars['size'] The size - small, medium or large. If none specified, medium is assumed. - */ +/** + * Elgg profile icon + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + * @uses $vars['size'] The size - small, medium or large. If none specified, medium is assumed. + */ - // Get entity - if (empty($vars['entity'])) - $vars['entity'] = $vars['user']; +// Get entity +if (empty($vars['entity'])) { + $vars['entity'] = $vars['user']; +} - if ($vars['entity'] instanceof ElggUser) { - - $name = htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); - $username = $vars['entity']->username; - - if ($icontime = $vars['entity']->icontime) { - $icontime = "{$icontime}"; - } else { - $icontime = "default"; - } - +if ($vars['entity'] instanceof ElggUser) { + $name = htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); + $username = $vars['entity']->username; + + if ($icontime = $vars['entity']->icontime) { + $icontime = "{$icontime}"; + } else { + $icontime = "default"; + } + // Get size - if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar'))) - $vars['size'] = "medium"; - + if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar'))) { + $vars['size'] = 'medium'; + } + // Get any align and js - if (!empty($vars['align'])) { - $align = " align=\"{$vars['align']}\" "; - } else { - $align = ""; - } + if (!empty($vars['align'])) { + $align = " align=\"{$vars['align']}\" "; + } else { + $align = ''; + } // Override - if (isset($vars['override']) && $vars['override'] == true) { - $override = true; - } else $override = false; - - if (!$override) { - + if (isset($vars['override']) && $vars['override'] == true) { + $override = true; + } else $override = false; + + if (!$override) { + ?> -
+
@@ -87,6 +88,4 @@ \ No newline at end of file +} \ No newline at end of file diff --git a/mod/profile/views/default/profile/javascript.php b/mod/profile/views/default/profile/javascript.php index f2ad4b74b..a408d1c84 100644 --- a/mod/profile/views/default/profile/javascript.php +++ b/mod/profile/views/default/profile/javascript.php @@ -1,16 +1,16 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity - */ - - $icon = elgg_view( - "profile/icon", array( - 'entity' => $vars['entity'], - 'size' => 'small', - ) - ); - - $banned = $vars['entity']->isBanned(); - - // Simple XFN - $rel = ""; - if (page_owner() == $vars['entity']->guid) - $rel = 'me'; - else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid)) - $rel = 'friend'; - - if (!$banned) { - $info .= "

getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "

"; - //create a view that a status plugin could extend - in the default case, this is the wire - $info .= elgg_view("profile/status", array("entity" => $vars['entity'])); - - $location = $vars['entity']->location; - if (!empty($location)) { - $info .= "

" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "

"; - } - } - else - { - $info .= "

"; - if (isadminloggedin()) - $info .= "getUrl() . "\">"; - $info .= $vars['entity']->name; - if (isadminloggedin()) - $info .= ""; - $info .= "

"; - - //$info .= "

" . elgg_echo('profile:banned') . "

"; - - } - - echo elgg_view_listing($icon, $info); - -?> \ No newline at end of file +/** + * Elgg user display (small) + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity + */ + +$icon = elgg_view( + "profile/icon", array( + 'entity' => $vars['entity'], + 'size' => 'tiny', + ) +); + +$banned = $vars['entity']->isBanned(); + +// Simple XFN +$rel = ""; +if (page_owner() == $vars['entity']->guid) + $rel = 'me'; +else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid)) + $rel = 'friend'; + +if (!$banned) { + $info .= "

getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "

"; + //create a view that a status plugin could extend - in the default case, this is the wire + $info .= elgg_view("profile/status", array("entity" => $vars['entity'])); + $location = $vars['entity']->location; + if (!empty($location)) { + $info .= "

" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "

"; + } +}else{ + $info .= "

"; + if (isadminloggedin()) + $info .= "getUrl() . "\">"; + $info .= $vars['entity']->name; + if (isadminloggedin()) + $info .= ""; + $info .= "

"; +} + +echo elgg_view_listing($icon, $info); \ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/actions.php b/mod/profile/views/default/profile/menu/actions.php index 7ca1d84d5..4ce7c89b6 100644 --- a/mod/profile/views/default/profile/menu/actions.php +++ b/mod/profile/views/default/profile/menu/actions.php @@ -1,29 +1,32 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + */ - /** - * Elgg profile icon hover over: actions - * - * @package ElggProfile - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - */ - - if (isloggedin()) { - if ($_SESSION['user']->getGUID() != $vars['entity']->getGUID()) { - - $ts = time(); - $token = generate_action_token($ts); - - if ($vars['entity']->isFriend()) { - echo "

getGUID()}&__elgg_token=$token&__elgg_ts=$ts\">" . elgg_echo("friend:remove") . "

"; - } else { - echo "

getGUID()}&__elgg_token=$token&__elgg_ts=$ts\">" . elgg_echo("friend:add") . "

"; - } +if (isloggedin()) { + if ($_SESSION['user']->getGUID() != $vars['entity']->getGUID()) { + $ts = time(); + $token = generate_action_token($ts); + if ($vars['entity']->isFriend()) { + echo elgg_view('output/confirm_link', array( + 'href' => "{$vars['url']}action/friends/remove?friend={$vars['entity']->getGUID()}", + 'text' => elgg_echo('friend:remove'), + 'class' => 'user_menu_removefriend' + )); + } else { + echo elgg_view('output/confirm_link', array( + 'href' => "{$vars['url']}action/friends/add?friend={$vars['entity']->getGUID()}", + 'text' => elgg_echo('friend:add'), + 'class' => 'user_menu_removefriend' + )); } } - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/adminlinks.php b/mod/profile/views/default/profile/menu/adminlinks.php index 7d0c24cb4..a88f96816 100644 --- a/mod/profile/views/default/profile/menu/adminlinks.php +++ b/mod/profile/views/default/profile/menu/adminlinks.php @@ -1,40 +1,32 @@ guid){ - - $ts = time(); - $token = generate_action_token($ts); - +if (isadminloggedin()){ + if ($_SESSION['id']!=$vars['entity']->guid){ ?> - - isBanned()) { - echo elgg_view('output/confirmlink', array('text' => elgg_echo("ban"), 'href' => "{$vars['url']}action/admin/user/ban?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts")); - } else { - echo elgg_view('output/confirmlink', array('text' => elgg_echo("unban"), 'href' => "{$vars['url']}action/admin/user/unban?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts")); - } - - echo elgg_view('output/confirmlink', array('text' => elgg_echo("delete"), 'href' => "{$vars['url']}action/admin/user/delete?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts")); - - echo elgg_view('output/confirmlink', array('text' => elgg_echo("resetpassword"), 'href' => "{$vars['url']}action/admin/user/resetpassword?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts")); - - if (!$vars['entity']->admin) { - echo elgg_view('output/confirmlink', array('text' => elgg_echo("makeadmin"), 'href' => "{$vars['url']}action/admin/user/makeadmin?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts")); - } else { - echo elgg_view('output/confirmlink', array('text' => elgg_echo("removeadmin"), 'href' => "{$vars['url']}action/admin/user/removeadmin?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts")); - } + +isBanned()) { + echo elgg_view('output/confirmlink', array('text' => elgg_echo("ban"), 'href' => "{$vars['url']}action/admin/user/ban?guid={$vars['entity']->guid}")); + } else { + echo elgg_view('output/confirmlink', array('text' => elgg_echo("unban"), 'href' => "{$vars['url']}action/admin/user/unban?guid={$vars['entity']->guid}")); + } + echo elgg_view('output/confirmlink', array('text' => elgg_echo("delete"), 'href' => "{$vars['url']}action/admin/user/delete?guid={$vars['entity']->guid}")); + echo elgg_view('output/confirmlink', array('text' => elgg_echo("resetpassword"), 'href' => "{$vars['url']}action/admin/user/resetpassword?guid={$vars['entity']->guid}")); + if (!$vars['entity']->admin) { + echo elgg_view('output/confirmlink', array('text' => elgg_echo("makeadmin"), 'href' => "{$vars['url']}action/admin/user/makeadmin?guid={$vars['entity']->guid}")); + } else { + echo elgg_view('output/confirmlink', array('text' => elgg_echo("removeadmin"), 'href' => "{$vars['url']}action/admin/user/removeadmin?guid={$vars['entity']->guid}")); } } -?> \ No newline at end of file + } \ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/adminwrapper.php b/mod/profile/views/default/profile/menu/adminwrapper.php index 2acbb35e8..b60eec462 100644 --- a/mod/profile/views/default/profile/menu/adminwrapper.php +++ b/mod/profile/views/default/profile/menu/adminwrapper.php @@ -1,11 +1,17 @@ {$adminlinks}

"; - - } - -?> \ No newline at end of file +if (!empty($adminlinks)) { + echo "

{$adminlinks}

"; +} \ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/links.php b/mod/profile/views/default/profile/menu/links.php index 8aa5e1a1a..ce82df10a 100644 --- a/mod/profile/views/default/profile/menu/links.php +++ b/mod/profile/views/default/profile/menu/links.php @@ -1,36 +1,32 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - */ - +/** + * Elgg profile icon hover over: passive links + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + */ ?> -

- -

- canEdit()) - { - ?> +

+ +

+canEdit()){ +?>

- +

- -

- -

-

- -

\ No newline at end of file + +

+ +

+

+ +

diff --git a/mod/profile/views/default/profile/menu/linksownpage.php b/mod/profile/views/default/profile/menu/linksownpage.php index 08aece082..58eb3e1a0 100644 --- a/mod/profile/views/default/profile/menu/linksownpage.php +++ b/mod/profile/views/default/profile/menu/linksownpage.php @@ -1,33 +1,29 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - */ - +/** + * Elgg profile icon / profile links: passive links when looking at your own icon / profile + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + */ +?> +canEdit()){ ?> - canEdit()) - { - ?>

- +

- +

+ +

+

+ +

- ?> -

- -

-

- -

- \ No newline at end of file diff --git a/mod/profile/views/default/profile/metatags.php b/mod/profile/views/default/profile/metatags.php index a6981c4c9..0039281f0 100644 --- a/mod/profile/views/default/profile/metatags.php +++ b/mod/profile/views/default/profile/metatags.php @@ -1,21 +1,15 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - */ - - /* - * - */ - -?> - - - +/** + * Adds metatags to load Javascript required for the profile + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + */ + +if ($owner = page_owner_entity()) { ?> + + \ No newline at end of file diff --git a/mod/profile/views/default/profile/profile_contents/activity.php b/mod/profile/views/default/profile/profile_contents/activity.php new file mode 100755 index 000000000..62fc747e3 --- /dev/null +++ b/mod/profile/views/default/profile/profile_contents/activity.php @@ -0,0 +1,26 @@ + +
+ $vars['entity'])); + } + if(is_plugin_enabled('riverdashboard')) { + // users last 10 activites + echo elgg_view('profile/profile_contents/profile_activity', array('entity' => $vars['entity'])); + } else { + echo "Riverdashboard not loaded"; + } + ?> +
+ +
+ true)); +?> +
diff --git a/mod/profile/views/default/profile/profile_contents/details.php b/mod/profile/views/default/profile/profile_contents/details.php new file mode 100755 index 000000000..c61379974 --- /dev/null +++ b/mod/profile/views/default/profile/profile_contents/details.php @@ -0,0 +1,63 @@ + +
+guid) + $rel = 'me'; + else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid)) + $rel = 'friend'; + + if ($vars['full'] == true) { + $even_odd = null; + if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0) + foreach($vars['config']->profile as $shortname => $valtype) { + if ($shortname != "description") { + $value = $vars['entity']->$shortname; + if (!empty($value)) { + //This function controls the alternating class + $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; +?> +

+ : + $vars['entity']->$shortname)); + ?> +

+ + +isBanned()) { + echo "
"; + echo elgg_echo('profile:banned'); + echo "
"; + }else{ + if($vars['entity']->description){ + echo "

" . elgg_echo("profile:aboutme") . "

"; + echo "
" .elgg_view('output/longtext', array('value' => $vars['entity']->description))."
"; + } + ?> + + "; + // profile sidebar + echo "
"; + echo elgg_view('profile/profile_ownerblock'); + echo "
"; +?> diff --git a/mod/profile/views/default/profile/profile_contents/friends.php b/mod/profile/views/default/profile/profile_contents/friends.php new file mode 100755 index 000000000..4fa290a7f --- /dev/null +++ b/mod/profile/views/default/profile/profile_contents/friends.php @@ -0,0 +1,21 @@ +getGUID(),false,'user','',0,10,false); +if(!$friends) + $friends = "

This user has not made any friends yet.

"; + +?> +
+ +
+ +
+ true)); +?> +
\ No newline at end of file diff --git a/mod/profile/views/default/profile/profile_contents/twitter.php b/mod/profile/views/default/profile/profile_contents/twitter.php new file mode 100755 index 000000000..75b6d0467 --- /dev/null +++ b/mod/profile/views/default/profile/profile_contents/twitter.php @@ -0,0 +1,24 @@ +twitter; + +// if the twitter username is empty, then do not show +if($twitter_username){ +?> +
+
    +

    + + +
    +
    + true)); +?> +
    + \ No newline at end of file diff --git a/mod/profile/views/default/profile/profile_contents/widgets.php b/mod/profile/views/default/profile/profile_contents/widgets.php new file mode 100644 index 000000000..e69de29bb diff --git a/mod/profile/views/default/profile/profile_navigation.php b/mod/profile/views/default/profile/profile_navigation.php new file mode 100755 index 000000000..0ab00746c --- /dev/null +++ b/mod/profile/views/default/profile/profile_navigation.php @@ -0,0 +1,57 @@ +getURL()}/"; + +//select section +switch($section){ + case 'friends': + $friends = 'class="selected"'; + break; + + case 'widgets': + $widgets = 'class="selected"'; + break; + + case 'details': + $details = 'class="selected"'; + break; + + case 'twitter': + $twitter = 'class="selected"'; + break; + + case 'activity': + default: + $activity = 'class="selected"'; + break; +} +?> +
    +

    name; ?>

    + +
    diff --git a/mod/profile/views/default/profile/profile_ownerblock.php b/mod/profile/views/default/profile/profile_ownerblock.php new file mode 100755 index 000000000..c5cb90189 --- /dev/null +++ b/mod/profile/views/default/profile/profile_ownerblock.php @@ -0,0 +1,124 @@ +container_guid); + else + $user = get_entity($vars['entity']->guid); +}else{ + $user = page_owner_entity(); +} +$more_info = ''; +//set some variables +$location = elgg_view("output/tags",array('value' => $user->location)); +if($vars['smallicon'] != true){ + $icon = elgg_view("profile/icon",array('entity' => $user, 'size' => 'large', 'override' => 'true')); + $icon_class = "large"; +}else{ + $icon = elgg_view("profile/icon",array('entity' => $user, 'size' => 'small')); + $more_info = "
    "; + $more_info .= "

    {$user->name}

    "; + $more_info .= "

    {$user->briefdescription}

    "; + $more_info .= "

    {$location}

    "; + $more_info .= "
    "; +} +$profile_actions = ""; +if(get_loggedin_user()->getGuid() == page_owner()){ + $profile_actions = ""; +}else{ + $profile_actions = "
    "; + if (isloggedin()) { + if ($_SESSION['user']->getGUID() != $user->getGUID()) { + $ts = time(); + $token = generate_action_token($ts); + + if ($user->isFriend()) { + $profile_actions .= "getGUID()}&__elgg_token=$token&__elgg_ts=$ts\" class='action_button'>" . elgg_echo('friend:remove') . ""; + } else { + $profile_actions .= "getGUID()}&__elgg_token=$token&__elgg_ts=$ts\" class='action_button'>" . elgg_echo('friend:add') . ""; + } + } + } + if(is_plugin_enabled('messages')){ + $profile_actions .= "guid}\" class='action_button'>". elgg_echo('messages:send') .""; + } + $profile_actions .= "
    "; +} + +$username = $user->username; +$email = $user->email; +$phone = $user->phone; + +//get correct links +$url = $vars['url']; + +//if admin display admin links +if(isadminloggedin()){ + $admin_links = elgg_view('profile/admin_menu'); +}else{ + $admin_links = ''; +} + + +//check tools are enabled +if(is_plugin_enabled('file')){ + $file_link = "
  • Files
  • "; +}else{ + $file_link = ""; +} +if(is_plugin_enabled('blog')){ + $blog_link = "
  • Blog
  • "; +}else{ + $blog_link = ""; +} +if(is_plugin_enabled('video')){ + $video_link = "
  • Videos
  • "; +}else{ + $video_link = ""; +} +if(is_plugin_enabled('pages')){ + $pages_link = "
  • Pages
  • "; +}else{ + $pages_link = ""; +} +if(is_plugin_enabled('bookmarks')){ + $bookmark_link = "
  • Bookmarks
  • "; +}else{ + $bookmark_link = ""; +} + + + +//contruct the display +$display = << +
    + {$icon} +
    + {$more_info} + {$profile_actions} + + + {$admin_links} +
    + +EOT; + +echo $display; diff --git a/mod/profile/views/default/profile/profilelinks.php b/mod/profile/views/default/profile/profilelinks.php deleted file mode 100644 index 6f35620c6..000000000 --- a/mod/profile/views/default/profile/profilelinks.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - */ - -?> - -isBanned(); - - // Allow menus if not banned or admin logged in - if ((!$banned) || (isadminloggedin())) - { - //check to see if the user is looking at their own profile - if ($_SESSION['user']->guid == page_owner()){ - - echo "
    "; //start the wrapper div - echo elgg_view("profile/menu/actions",$vars);//grab action links such as make friend - echo elgg_view("profile/menu/linksownpage",$vars); // an different view for user's own profile - echo "
    "; //close wrapper div - - } else { - - echo "
    "; //start the wrapper div - echo elgg_view("profile/menu/actions",$vars); //grab action links such as make friend - echo elgg_view("profile/menu/links",$vars); //passive links to items such as user blog etc - echo "
    "; //close wrapper div - - } - } - else - { // Some nice spacing - echo "
    "; //start the wrapper div - echo "
    "; //close wrapper div - } -?> \ No newline at end of file diff --git a/mod/profile/views/default/profile/userdetails.php b/mod/profile/views/default/profile/userdetails.php deleted file mode 100644 index eb22a704a..000000000 --- a/mod/profile/views/default/profile/userdetails.php +++ /dev/null @@ -1,174 +0,0 @@ - - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity - */ - - if ($vars['full'] == true) { - $iconsize = "large"; - } else { - $iconsize = "medium"; - } - - // wrap all profile info - echo "
    "; - -?> - - - - - - - - - - - - - - - -
    - -"; - - echo "
    "; - // get the user's main profile picture - echo elgg_view( - "profile/icon", array( - 'entity' => $vars['entity'], - //'align' => "left", - 'size' => $iconsize, - 'override' => true, - ) - ); - - - echo "
    "; - echo "
    "; - // display relevant links - echo elgg_view("profile/profilelinks", array("entity" => $vars['entity'])); - - // close profile_info_column_left - echo ""; - -?> -
    - -
    - canEdit()) { - - ?> -

    - -

    - - - - - guid) - $rel = 'me'; - else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid)) - $rel = 'friend'; - - // display the users name - echo "

    getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "

    "; - - //insert a view that can be extended - echo elgg_view("profile/status", array("entity" => $vars['entity'])); - - if ($vars['full'] == true) { - - ?> - profile) && sizeof($vars['config']->profile) > 0) - foreach($vars['config']->profile as $shortname => $valtype) { - if ($shortname != "description") { - $value = $vars['entity']->$shortname; - if (!empty($value)) { - - //This function controls the alternating class - $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; - - ?> -

    - : - $vars['entity']->$shortname - ); - - if ($valtype == 'tags') { - $options['tag_names'] = $shortname; - } - - echo elgg_view("output/{$valtype}", $options); - - ?> - -

    - - -
    - -
    -
    -

    - - isBanned()) { ?> -
    - -
    - - - - $vars['entity']->description)); - //echo autop(filter_tags($vars['entity']->description)); - ?> - - - -
    - -
    - - - -
    diff --git a/mod/profile/views/default/river/user/default/profileiconupdate.php b/mod/profile/views/default/river/user/default/profileiconupdate.php index 2aa0933b6..ebe13e59a 100644 --- a/mod/profile/views/default/river/user/default/profileiconupdate.php +++ b/mod/profile/views/default/river/user/default/profileiconupdate.php @@ -3,10 +3,6 @@ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); $url = "getURL()}\">{$performed_by->name}"; - $string = sprintf(elgg_echo("profile:river:iconupdate"),$url); - $string .= "
    "; - $string .= elgg_view("profile/icon",array('entity' => $performed_by, 'size' => 'small', 'override' => 'true')); - $string .= "
    "; -?> - - \ No newline at end of file + $string = "
    " . sprintf(elgg_echo("profile:river:update"),$url) ."
    "; + + echo $string; \ No newline at end of file diff --git a/mod/profile/views/default/river/user/default/profileupdate.php b/mod/profile/views/default/river/user/default/profileupdate.php index 9b87d829f..06d2697b0 100644 --- a/mod/profile/views/default/river/user/default/profileupdate.php +++ b/mod/profile/views/default/river/user/default/profileupdate.php @@ -3,7 +3,7 @@ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); $url = "getURL()}\">{$performed_by->name}"; - $string = sprintf(elgg_echo("profile:river:update"),$url); + $string = "
    " . sprintf(elgg_echo("profile:river:update"),$url) ."
    "; ?> -- cgit v1.2.3