aboutsummaryrefslogtreecommitdiff
path: root/mod/profile
diff options
context:
space:
mode:
Diffstat (limited to 'mod/profile')
-rw-r--r--mod/profile/actions/cropicon.php80
-rw-r--r--mod/profile/actions/deletedefaultprofileitem.php25
-rw-r--r--mod/profile/actions/edit.php95
-rw-r--r--mod/profile/actions/editdefault.php39
-rw-r--r--mod/profile/actions/iconupload.php91
-rw-r--r--mod/profile/actions/resetdefaultprofile.php30
-rw-r--r--mod/profile/defaultprofile.php55
-rw-r--r--mod/profile/edit.php44
-rw-r--r--mod/profile/editicon.php42
-rw-r--r--mod/profile/graphics/defaultlarge.gifbin0 -> 2924 bytes
-rw-r--r--mod/profile/graphics/defaultmaster.gifbin0 -> 43 bytes
-rw-r--r--mod/profile/graphics/defaultmedium.gifbin0 -> 2855 bytes
-rw-r--r--mod/profile/graphics/defaultsmall.gifbin0 -> 1027 bytes
-rw-r--r--mod/profile/graphics/defaulttiny.gifbin0 -> 745 bytes
-rw-r--r--mod/profile/graphics/defaulttopbar.gifbin0 -> 599 bytes
-rw-r--r--mod/profile/icon.php58
-rw-r--r--mod/profile/icondirect.php136
-rw-r--r--mod/profile/index.php41
-rw-r--r--mod/profile/javascript.php22
-rw-r--r--mod/profile/languages/en.php93
-rw-r--r--mod/profile/manifest.xml10
-rw-r--r--mod/profile/start.php319
-rw-r--r--mod/profile/views/default/icon/user/default/large.php3
-rw-r--r--mod/profile/views/default/icon/user/default/master.php3
-rw-r--r--mod/profile/views/default/icon/user/default/medium.php3
-rw-r--r--mod/profile/views/default/icon/user/default/small.php3
-rw-r--r--mod/profile/views/default/icon/user/default/tiny.php3
-rw-r--r--mod/profile/views/default/icon/user/default/topbar.php3
-rw-r--r--mod/profile/views/default/js/jquery.imgareaselect-0.8.js635
-rw-r--r--mod/profile/views/default/js/jquery.imgareaselect-0.8.min.js1
-rw-r--r--mod/profile/views/default/profile/css.php124
-rw-r--r--mod/profile/views/default/profile/edit.php67
-rw-r--r--mod/profile/views/default/profile/editdefaultprofile.php35
-rw-r--r--mod/profile/views/default/profile/editicon.php149
-rw-r--r--mod/profile/views/default/profile/gallery.php47
-rw-r--r--mod/profile/views/default/profile/hoverover.php26
-rw-r--r--mod/profile/views/default/profile/icon.php92
-rw-r--r--mod/profile/views/default/profile/javascript.php138
-rw-r--r--mod/profile/views/default/profile/listing.php57
-rw-r--r--mod/profile/views/default/profile/menu/actions.php29
-rw-r--r--mod/profile/views/default/profile/menu/adminlinks.php40
-rw-r--r--mod/profile/views/default/profile/menu/adminwrapper.php11
-rw-r--r--mod/profile/views/default/profile/menu/links.php36
-rw-r--r--mod/profile/views/default/profile/menu/linksownpage.php33
-rw-r--r--mod/profile/views/default/profile/metatags.php21
-rw-r--r--mod/profile/views/default/profile/profilelinks.php50
-rw-r--r--mod/profile/views/default/profile/submenu.php22
-rw-r--r--mod/profile/views/default/profile/userdetails.php174
-rw-r--r--mod/profile/views/default/river/user/default/profileiconupdate.php12
-rw-r--r--mod/profile/views/default/river/user/default/profileupdate.php10
50 files changed, 3007 insertions, 0 deletions
diff --git a/mod/profile/actions/cropicon.php b/mod/profile/actions/cropicon.php
new file mode 100644
index 000000000..f86799ccf
--- /dev/null
+++ b/mod/profile/actions/cropicon.php
@@ -0,0 +1,80 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ gatekeeper();
+
+ $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);
+
+ // username is set in form which ensures the page owner is set
+ $user = page_owner_entity();
+
+ if (!$user || !$user->canEdit()) {
+ register_error(elgg_echo("profile:icon:noaccess"));
+ forward();
+ }
+
+ $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);
+
+ 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/";
+
+ if (isloggedin()) forward($url);
+
+?>
diff --git a/mod/profile/actions/deletedefaultprofileitem.php b/mod/profile/actions/deletedefaultprofileitem.php
new file mode 100644
index 000000000..309816035
--- /dev/null
+++ b/mod/profile/actions/deletedefaultprofileitem.php
@@ -0,0 +1,25 @@
+<?php
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ global $CONFIG;
+
+ admin_gatekeeper();
+
+ $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']);
+?>
diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php
new file mode 100644
index 000000000..bc14cd6e6
--- /dev/null
+++ b/mod/profile/actions/edit.php
@@ -0,0 +1,95 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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 &amp;&amp; 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;
+ }
+
+ // 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'];
+
+ // @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());
+
+ } else {
+ // If we can't, display an error
+
+ system_message(elgg_echo("profile:noaccess"));
+ }
+
+?>
diff --git a/mod/profile/actions/editdefault.php b/mod/profile/actions/editdefault.php
new file mode 100644
index 000000000..cf662e9b2
--- /dev/null
+++ b/mod/profile/actions/editdefault.php
@@ -0,0 +1,39 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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'));
+ }
+
+ }
+ else
+ register_error(elgg_echo('profile:editdefault:fail'));
+
+ forward($_SERVER['HTTP_REFERER']);
+?>
diff --git a/mod/profile/actions/iconupload.php b/mod/profile/actions/iconupload.php
new file mode 100644
index 000000000..f1d290694
--- /dev/null
+++ b/mod/profile/actions/iconupload.php
@@ -0,0 +1,91 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ 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);
+
+?>
diff --git a/mod/profile/actions/resetdefaultprofile.php b/mod/profile/actions/resetdefaultprofile.php
new file mode 100644
index 000000000..2100c95c2
--- /dev/null
+++ b/mod/profile/actions/resetdefaultprofile.php
@@ -0,0 +1,30 @@
+<?php
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ // Load configuration
+ global $CONFIG;
+
+ 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++;
+ }
+
+ set_plugin_setting('user_defined_fields', FALSE, 'profile');
+
+ system_message(elgg_echo('profile:defaultprofile:reset'));
+
+ forward($_SERVER['HTTP_REFERER']);
+?>
diff --git a/mod/profile/defaultprofile.php b/mod/profile/defaultprofile.php
new file mode 100644
index 000000000..9272a7363
--- /dev/null
+++ b/mod/profile/defaultprofile.php
@@ -0,0 +1,55 @@
+<?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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ 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();
+ $listing .= "<div class=\"contentWrapper\">";
+ 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 .= "<p class=\"{$even_odd}\"><b>$translation: </b>";
+ $listing .= elgg_view("output/{$type}",array('value' => " [$type]"));
+ $listing .= "</p>";
+
+ $n++;
+ }
+ $listing .= "</div>";
+
+ $listing .= "<div class=\"contentWrapper resetdefaultprofile\">" . elgg_view('input/form',
+ array(
+ 'body' => elgg_view('input/submit', array('value' => elgg_echo('profile:resetdefault'))),
+ 'action' => $CONFIG->wwwroot . 'action/profile/editdefault/reset'
+ )
+ ) . "</div>";
+
+ set_context('admin');
+
+
+ page_draw(elgg_echo('profile:edit:default'),elgg_view_layout("two_column_left_sidebar", '', $title . $form . $listing));
+
+?>
diff --git a/mod/profile/edit.php b/mod/profile/edit.php
new file mode 100644
index 000000000..a11faf4f6
--- /dev/null
+++ b/mod/profile/edit.php
@@ -0,0 +1,44 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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);
+
+ // Draw the page
+ page_draw(elgg_echo("profile:edit"),$body);
diff --git a/mod/profile/editicon.php b/mod/profile/editicon.php
new file mode 100644
index 000000000..97df6d56e
--- /dev/null
+++ b/mod/profile/editicon.php
@@ -0,0 +1,42 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ // Load the Elgg framework
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // 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();
+ }
+
+ // 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);
+
+ // Draw the page
+ page_draw(elgg_echo("profile:editicon"), $body);
diff --git a/mod/profile/graphics/defaultlarge.gif b/mod/profile/graphics/defaultlarge.gif
new file mode 100644
index 000000000..6ea3bd4cd
--- /dev/null
+++ b/mod/profile/graphics/defaultlarge.gif
Binary files differ
diff --git a/mod/profile/graphics/defaultmaster.gif b/mod/profile/graphics/defaultmaster.gif
new file mode 100644
index 000000000..5bfd67a2d
--- /dev/null
+++ b/mod/profile/graphics/defaultmaster.gif
Binary files differ
diff --git a/mod/profile/graphics/defaultmedium.gif b/mod/profile/graphics/defaultmedium.gif
new file mode 100644
index 000000000..c6b2e6a6d
--- /dev/null
+++ b/mod/profile/graphics/defaultmedium.gif
Binary files differ
diff --git a/mod/profile/graphics/defaultsmall.gif b/mod/profile/graphics/defaultsmall.gif
new file mode 100644
index 000000000..661d72f04
--- /dev/null
+++ b/mod/profile/graphics/defaultsmall.gif
Binary files differ
diff --git a/mod/profile/graphics/defaulttiny.gif b/mod/profile/graphics/defaulttiny.gif
new file mode 100644
index 000000000..1775346bc
--- /dev/null
+++ b/mod/profile/graphics/defaulttiny.gif
Binary files differ
diff --git a/mod/profile/graphics/defaulttopbar.gif b/mod/profile/graphics/defaulttopbar.gif
new file mode 100644
index 000000000..c3616aeb5
--- /dev/null
+++ b/mod/profile/graphics/defaulttopbar.gif
Binary files differ
diff --git a/mod/profile/icon.php b/mod/profile/icon.php
new file mode 100644
index 000000000..802cc3756
--- /dev/null
+++ b/mod/profile/icon.php
@@ -0,0 +1,58 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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
diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php
new file mode 100644
index 000000000..ec4227217
--- /dev/null
+++ b/mod/profile/icondirect.php
@@ -0,0 +1,136 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ // 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);
+ }
+
+ return $array;
+ }
+ else
+ return str_split($string);
+
+ return false;
+ }
+
+ 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);
+
+ $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";
+
+ // 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');
+ }
+?>
diff --git a/mod/profile/index.php b/mod/profile/index.php
new file mode 100644
index 000000000..ae67dd566
--- /dev/null
+++ b/mod/profile/index.php
@@ -0,0 +1,41 @@
+<?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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ // Get the Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // 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;
+
+ $body = elgg_view_layout('widgets',$body);
+
+ } else {
+
+ $body = elgg_echo("profile:notfound");
+ $title = elgg_echo("profile");
+
+ }
+
+ page_draw($title, $body);
+
+?> \ No newline at end of file
diff --git a/mod/profile/javascript.php b/mod/profile/javascript.php
new file mode 100644
index 000000000..c2c9f8217
--- /dev/null
+++ b/mod/profile/javascript.php
@@ -0,0 +1,22 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ // 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
diff --git a/mod/profile/languages/en.php b/mod/profile/languages/en.php
new file mode 100644
index 000000000..7a9ec3f9d
--- /dev/null
+++ b/mod/profile/languages/en.php
@@ -0,0 +1,93 @@
+<?php
+ /**
+ * 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' => "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. <br /> 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
diff --git a/mod/profile/manifest.xml b/mod/profile/manifest.xml
new file mode 100644
index 000000000..2f53eae0d
--- /dev/null
+++ b/mod/profile/manifest.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+ <field key="author" value="Curverider ltd" />
+ <field key="version" value="1.7" />
+ <field key="description" value="Elgg profile plugin." />
+ <field key="website" value="http://www.elgg.org/" />
+ <field key="copyright" value="(C) Curverider 2008-2010" />
+ <field key="licence" value="GNU Public License version 2" />
+ <field key="elgg_version" value="2010030101" />
+</plugin_manifest>
diff --git a/mod/profile/start.php b/mod/profile/start.php
new file mode 100644
index 000000000..168d0b013
--- /dev/null
+++ b/mod/profile/start.php
@@ -0,0 +1,319 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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');
+
+ }
+
+ /**
+ * 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;
+
+ // The username should be the file we're getting
+ if (isset($page[0])) {
+ set_input('username',$page[0]);
+ }
+ // 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;
+
+ }
+ }
+ 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]);
+ }
+ 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";
+ }
+
+ 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.'&amp;username='.$entity->username.'&amp;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
+
+ 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);
+
+
+ // Define widgets for use in this context
+ use_widgets('profile');
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/icon/user/default/large.php b/mod/profile/views/default/icon/user/default/large.php
new file mode 100644
index 000000000..3ce382532
--- /dev/null
+++ b/mod/profile/views/default/icon/user/default/large.php
@@ -0,0 +1,3 @@
+<?php
+ echo $vars['url'] . "mod/profile/graphics/defaultlarge.gif";
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/icon/user/default/master.php b/mod/profile/views/default/icon/user/default/master.php
new file mode 100644
index 000000000..7c5ea847c
--- /dev/null
+++ b/mod/profile/views/default/icon/user/default/master.php
@@ -0,0 +1,3 @@
+<?php
+ echo $vars['url'] . "mod/profile/graphics/defaultmaster.gif";
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/icon/user/default/medium.php b/mod/profile/views/default/icon/user/default/medium.php
new file mode 100644
index 000000000..d5f6db343
--- /dev/null
+++ b/mod/profile/views/default/icon/user/default/medium.php
@@ -0,0 +1,3 @@
+<?php
+ echo $vars['url'] . "mod/profile/graphics/defaultmedium.gif";
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/icon/user/default/small.php b/mod/profile/views/default/icon/user/default/small.php
new file mode 100644
index 000000000..55f113c41
--- /dev/null
+++ b/mod/profile/views/default/icon/user/default/small.php
@@ -0,0 +1,3 @@
+<?php
+ echo $vars['url'] . "mod/profile/graphics/defaultsmall.gif";
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/icon/user/default/tiny.php b/mod/profile/views/default/icon/user/default/tiny.php
new file mode 100644
index 000000000..e47cdd3da
--- /dev/null
+++ b/mod/profile/views/default/icon/user/default/tiny.php
@@ -0,0 +1,3 @@
+<?php
+ echo $vars['url'] . "mod/profile/graphics/defaulttiny.gif";
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/icon/user/default/topbar.php b/mod/profile/views/default/icon/user/default/topbar.php
new file mode 100644
index 000000000..ad11588fa
--- /dev/null
+++ b/mod/profile/views/default/icon/user/default/topbar.php
@@ -0,0 +1,3 @@
+<?php
+ echo $vars['url'] . "mod/profile/graphics/defaulttopbar.gif";
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/js/jquery.imgareaselect-0.8.js b/mod/profile/views/default/js/jquery.imgareaselect-0.8.js
new file mode 100644
index 000000000..456114755
--- /dev/null
+++ b/mod/profile/views/default/js/jquery.imgareaselect-0.8.js
@@ -0,0 +1,635 @@
+/*
+ * imgAreaSelect jQuery plugin
+ * version 0.8
+ *
+ * Copyright (c) 2008-2009 Michal Wojciechowski (odyniec.net)
+ *
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://odyniec.net/projects/imgareaselect/
+ *
+ */
+
+(function($) {
+
+$.imgAreaSelect = { onKeyPress: null };
+
+$.imgAreaSelect.init = function (img, options) {
+ var $img = $(img), imgLoaded, $box = $('<div />'), $area = $('<div />'),
+ $border1 = $('<div />'), $border2 = $('<div />'), $areaOpera,
+ $outLeft = $('<div />'), $outTop = $('<div />'),
+ $outRight = $('<div />'), $outBottom = $('<div />'),
+ $handles = $([]), handleWidth, handles = [ ], left, top, M = Math,
+ imgOfs, imgWidth, imgHeight, $parent, parOfs,
+ zIndex = 0, position = 'absolute', $p, startX, startY,
+ scaleX = 1, scaleY = 1, resizeMargin = 10, resize = [ ], V = 0, H = 1,
+ d, aspectRatio, x1, x2, y1, y2, x, y, adjusted, shown, i,
+ selection = { x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0 };
+
+ var $o = $outLeft.add($outTop).add($outRight).add($outBottom);
+
+ function viewX(x)
+ {
+ return x + imgOfs.left - parOfs.left;
+ }
+
+ function viewY(y)
+ {
+ return y + imgOfs.top - parOfs.top;
+ }
+
+ function selX(x)
+ {
+ return x - imgOfs.left + parOfs.left;
+ }
+
+ function selY(y)
+ {
+ return y - imgOfs.top + parOfs.top;
+ }
+
+ function evX(event)
+ {
+ return event.pageX - parOfs.left;
+ }
+
+ function evY(event)
+ {
+ return event.pageY - parOfs.top;
+ }
+
+ function trueSelection()
+ {
+ return { x1: M.round(selection.x1 * scaleX),
+ y1: M.round(selection.y1 * scaleY),
+ x2: M.round(selection.x2 * scaleX),
+ y2: M.round(selection.y2 * scaleY),
+ width: M.round(selection.x2 * scaleX) - M.round(selection.x1 * scaleX),
+ height: M.round(selection.y2 * scaleY) - M.round(selection.y1 * scaleY) };
+ }
+
+ function getZIndex()
+ {
+ $p = $img;
+
+ while ($p.length && !$p.is('body')) {
+ if (!isNaN($p.css('z-index')) && $p.css('z-index') > zIndex)
+ zIndex = $p.css('z-index');
+ if ($p.css('position') == 'fixed')
+ position = 'fixed';
+
+ $p = $p.parent();
+ }
+
+ if (!isNaN(options.zIndex))
+ zIndex = options.zIndex;
+ }
+
+ function adjust()
+ {
+ imgOfs = { left: M.round($img.offset().left), top: M.round($img.offset().top) };
+ imgWidth = $img.width();
+ imgHeight = $img.height();
+
+ if ($().jquery == '1.3.2' && $.browser.safari && position == 'fixed') {
+ imgOfs.top += M.max(document.documentElement.scrollTop, $('body').scrollTop());
+ imgOfs.left += M.max(document.documentElement.scrollLeft, $('body').scrollLeft());
+ }
+
+ parOfs = $.inArray($parent.css('position'), ['absolute', 'relative']) != -1 ?
+ { left: M.round($parent.offset().left) - $parent.scrollLeft(),
+ top: M.round($parent.offset().top) - $parent.scrollTop() } :
+ position == 'fixed' ?
+ { left: $(document).scrollLeft(), top: $(document).scrollTop() } :
+ { left: 0, top: 0 };
+
+ left = viewX(0);
+ top = viewY(0);
+ }
+
+ function update(resetKeyPress)
+ {
+ if (!shown) return;
+
+ $box.css({
+ left: viewX(selection.x1) + 'px', top: viewY(selection.y1) + 'px',
+ width: selection.width + 'px', height: selection.height + 'px'
+ });
+ $area.add($border1).add($border2).css({
+ left: '0px', top: '0px',
+ width: M.max(selection.width - options.borderWidth * 2, 0) + 'px',
+ height: M.max(selection.height - options.borderWidth * 2, 0) + 'px'
+ });
+ $border1.css({ borderStyle: 'solid', borderColor: options.borderColor1 });
+ $border2.css({ borderStyle: 'dashed', borderColor: options.borderColor2 });
+ $border1.add($border2).css({ opacity: options.borderOpacity });
+ $outLeft.css({ left: left + 'px', top: top + 'px',
+ width: selection.x1 + 'px', height: imgHeight + 'px' });
+ $outTop.css({ left: left + selection.x1 + 'px', top: top + 'px',
+ width: selection.width + 'px', height: selection.y1 + 'px' });
+ $outRight.css({ left: left + selection.x2 + 'px', top: top + 'px',
+ width: imgWidth - selection.x2 + 'px', height: imgHeight + 'px' });
+ $outBottom.css({ left: left + selection.x1 + 'px', top: top + selection.y2 + 'px',
+ width: selection.width + 'px', height: imgHeight - selection.y2 + 'px' });
+
+ if (handles.length) {
+ handles[1].css({ left: selection.width - handleWidth + 'px' });
+ handles[2].css({ left: selection.width - handleWidth + 'px',
+ top: selection.height - handleWidth + 'px' });
+ handles[3].css({ top: selection.height - handleWidth + 'px' });
+
+ if (handles.length == 8) {
+ handles[4].css({ left: (selection.width - handleWidth) / 2 + 'px' });
+ handles[5].css({ left: selection.width - handleWidth + 'px',
+ top: (selection.height - handleWidth) / 2 + 'px' });
+ handles[6].css({ left: (selection.width - handleWidth) / 2 + 'px',
+ top: selection.height - handleWidth + 'px' });
+ handles[7].css({ top: (selection.height - handleWidth) / 2 + 'px' });
+ }
+ }
+
+ if (resetKeyPress !== false) {
+ if ($.imgAreaSelect.keyPress != docKeyPress)
+ $(document).unbind($.imgAreaSelect.keyPress,
+ $.imgAreaSelect.onKeyPress);
+
+ if (options.keys)
+ $(document).bind($.imgAreaSelect.keyPress,
+ $.imgAreaSelect.onKeyPress = docKeyPress);
+ }
+
+ if ($.browser.msie && options.borderWidth == 1 && options.borderOpacity < 1) {
+ $border1.add($border2).css('margin', '0');
+ setTimeout(function () { $border1.add($border2).css('margin', 'auto'); }, 0);
+ }
+ }
+
+ function areaMouseMove(event)
+ {
+ if (!adjusted) {
+ adjust();
+ adjusted = true;
+
+ $box.one('mouseout', function () { adjusted = false; });
+ }
+
+ x = selX(evX(event)) - selection.x1;
+ y = selY(evY(event)) - selection.y1;
+
+ resize = [ ];
+
+ if (options.resizable) {
+ if (y <= resizeMargin)
+ resize[V] = 'n';
+ else if (y >= selection.height - resizeMargin)
+ resize[V] = 's';
+ if (x <= resizeMargin)
+ resize[H] = 'w';
+ else if (x >= selection.width - resizeMargin)
+ resize[H] = 'e';
+ }
+
+ $box.css('cursor', resize.length ? resize.join('') + '-resize' :
+ options.movable ? 'move' : '');
+ if ($areaOpera)
+ $areaOpera.toggle();
+ }
+
+ function docMouseUp(event)
+ {
+ resize = [ ];
+
+ $('body').css('cursor', '');
+
+ if (options.autoHide || selection.width * selection.height == 0)
+ $box.add($o).hide();
+
+ options.onSelectEnd(img, trueSelection());
+
+ $(document).unbind('mousemove', selectingMouseMove);
+ $box.mousemove(areaMouseMove);
+ }
+
+ function areaMouseDown(event)
+ {
+ if (event.which != 1) return false;
+
+ adjust();
+
+ if (options.resizable && resize.length > 0) {
+ $('body').css('cursor', resize.join('') + '-resize');
+
+ x1 = viewX(selection[resize[H] == 'w' ? 'x2' : 'x1']);
+ y1 = viewY(selection[resize[V] == 'n' ? 'y2' : 'y1']);
+
+ $(document).mousemove(selectingMouseMove)
+ .one('mouseup', docMouseUp);
+ $box.unbind('mousemove', areaMouseMove);
+ }
+ else if (options.movable) {
+ startX = left + selection.x1 - evX(event);
+ startY = top + selection.y1 - evY(event);
+
+ $box.unbind('mousemove', areaMouseMove);
+
+ $(document).mousemove(movingMouseMove)
+ .one('mouseup', function () {
+ options.onSelectEnd(img, trueSelection());
+
+ $(document).unbind('mousemove', movingMouseMove);
+ $box.mousemove(areaMouseMove);
+ });
+ }
+ else
+ $img.mousedown(event);
+
+ return false;
+ }
+
+ function aspectRatioXY()
+ {
+ x2 = M.max(left, M.min(left + imgWidth,
+ x1 + M.abs(y2 - y1) * aspectRatio * (x2 < x1 ? -1 : 1)));
+ y2 = M.round(M.max(top, M.min(top + imgHeight,
+ y1 + M.abs(x2 - x1) / aspectRatio * (y2 < y1 ? -1 : 1))));
+ x2 = M.round(x2);
+ }
+
+ function aspectRatioYX()
+ {
+ y2 = M.max(top, M.min(top + imgHeight,
+ y1 + M.abs(x2 - x1) / aspectRatio * (y2 < y1 ? -1 : 1)));
+ x2 = M.round(M.max(left, M.min(left + imgWidth,
+ x1 + M.abs(y2 - y1) * aspectRatio * (x2 < x1 ? -1 : 1))));
+ y2 = M.round(y2);
+ }
+
+ function doResize()
+ {
+ if (options.minWidth && M.abs(x2 - x1) < options.minWidth) {
+ x2 = x1 - options.minWidth * (x2 < x1 ? 1 : -1);
+
+ if (x2 < left)
+ x1 = left + options.minWidth;
+ else if (x2 > left + imgWidth)
+ x1 = left + imgWidth - options.minWidth;
+ }
+
+ if (options.minHeight && M.abs(y2 - y1) < options.minHeight) {
+ y2 = y1 - options.minHeight * (y2 < y1 ? 1 : -1);
+
+ if (y2 < top)
+ y1 = top + options.minHeight;
+ else if (y2 > top + imgHeight)
+ y1 = top + imgHeight - options.minHeight;
+ }
+
+ x2 = M.max(left, M.min(x2, left + imgWidth));
+ y2 = M.max(top, M.min(y2, top + imgHeight));
+
+ if (aspectRatio)
+ if (M.abs(x2 - x1) / aspectRatio > M.abs(y2 - y1))
+ aspectRatioYX();
+ else
+ aspectRatioXY();
+
+ if (options.maxWidth && M.abs(x2 - x1) > options.maxWidth) {
+ x2 = x1 - options.maxWidth * (x2 < x1 ? 1 : -1);
+ if (aspectRatio) aspectRatioYX();
+ }
+
+ if (options.maxHeight && M.abs(y2 - y1) > options.maxHeight) {
+ y2 = y1 - options.maxHeight * (y2 < y1 ? 1 : -1);
+ if (aspectRatio) aspectRatioXY();
+ }
+
+ selection = { x1: selX(M.min(x1, x2)), x2: selX(M.max(x1, x2)),
+ y1: selY(M.min(y1, y2)), y2: selY(M.max(y1, y2)),
+ width: M.abs(x2 - x1), height: M.abs(y2 - y1) };
+
+ update();
+
+ options.onSelectChange(img, trueSelection());
+ }
+
+ function selectingMouseMove(event)
+ {
+ x2 = !resize.length || resize[H] || aspectRatio ? evX(event) : viewX(selection.x2);
+ y2 = !resize.length || resize[V] || aspectRatio ? evY(event) : viewY(selection.y2);
+
+ doResize();
+
+ return false;
+ }
+
+ function doMove(newX1, newY1)
+ {
+ x2 = (x1 = newX1) + selection.width;
+ y2 = (y1 = newY1) + selection.height;
+
+ selection = $.extend(selection, { x1: selX(x1), y1: selY(y1),
+ x2: selX(x2), y2: selY(y2) });
+
+ update();
+
+ options.onSelectChange(img, trueSelection());
+ }
+
+ function movingMouseMove(event)
+ {
+ x1 = M.max(left, M.min(startX + evX(event), left + imgWidth - selection.width));
+ y1 = M.max(top, M.min(startY + evY(event), top + imgHeight - selection.height));
+
+ doMove(x1, y1);
+
+ event.preventDefault();
+ return false;
+ }
+
+ function startSelection(event)
+ {
+ adjust();
+
+ x2 = x1;
+ y2 = y1;
+ doResize();
+
+ resize = [ ];
+
+ $box.add($o.is(':visible') ? null : $o).show();
+ shown = true;
+
+ $(document).unbind('mouseup', cancelSelection)
+ .mousemove(selectingMouseMove).one('mouseup', docMouseUp);
+ $box.unbind('mousemove', areaMouseMove);
+
+ options.onSelectStart(img, trueSelection());
+ }
+
+ function cancelSelection()
+ {
+ $(document).unbind('mousemove', startSelection);
+ $box.add($o).hide();
+
+ selection = { x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0 };
+
+ options.onSelectChange(img, selection);
+ options.onSelectEnd(img, selection);
+ }
+
+ function imgMouseDown(event)
+ {
+ if (event.which != 1) return false;
+
+ adjust();
+ startX = x1 = evX(event);
+ startY = y1 = evY(event);
+
+ $(document).one('mousemove', startSelection)
+ .one('mouseup', cancelSelection);
+
+ return false;
+ }
+
+ function parentScroll()
+ {
+ adjust();
+ update(false);
+ x1 = viewX(selection.x1); y1 = viewY(selection.y1);
+ x2 = viewX(selection.x2); y2 = viewY(selection.y2);
+ }
+
+ function imgLoad()
+ {
+ imgLoaded = true;
+
+ if (options.show) {
+ shown = true;
+ adjust();
+ update();
+ $box.add($o).show();
+ }
+
+ $box.add($o).css({ visibility: '' });
+ }
+
+ var docKeyPress = function(event) {
+ var k = options.keys, d, t, key = event.keyCode || event.which;
+
+ d = !isNaN(k.alt) && (event.altKey || event.originalEvent.altKey) ? k.alt :
+ !isNaN(k.ctrl) && event.ctrlKey ? k.ctrl :
+ !isNaN(k.shift) && event.shiftKey ? k.shift :
+ !isNaN(k.arrows) ? k.arrows : 10;
+
+ if (k.arrows == 'resize' || (k.shift == 'resize' && event.shiftKey) ||
+ (k.ctrl == 'resize' && event.ctrlKey) ||
+ (k.alt == 'resize' && (event.altKey || event.originalEvent.altKey)))
+ {
+ switch (key) {
+ case 37:
+ d = -d;
+ case 39:
+ t = M.max(x1, x2);
+ x1 = M.min(x1, x2);
+ x2 = M.max(t + d, x1);
+ if (aspectRatio) aspectRatioYX();
+ break;
+ case 38:
+ d = -d;
+ case 40:
+ t = M.max(y1, y2);
+ y1 = M.min(y1, y2);
+ y2 = M.max(t + d, y1);
+ if (aspectRatio) aspectRatioXY();
+ break;
+ default:
+ return;
+ }
+
+ doResize();
+ }
+ else {
+ x1 = M.min(x1, x2);
+ y1 = M.min(y1, y2);
+
+ switch (key) {
+ case 37:
+ doMove(M.max(x1 - d, left), y1);
+ break;
+ case 38:
+ doMove(x1, M.max(y1 - d, top));
+ break;
+ case 39:
+ doMove(x1 + M.min(d, imgWidth - selX(x2)), y1);
+ break;
+ case 40:
+ doMove(x1, y1 + M.min(d, imgHeight - selY(y2)));
+ break;
+ default:
+ return;
+ }
+ }
+
+ return false;
+ };
+
+ this.setOptions = function(newOptions)
+ {
+ if (newOptions.parent)
+ ($parent = $(newOptions.parent)).append($box.add($o));
+
+ adjust();
+ getZIndex();
+
+ if (newOptions.x1 != null) {
+ selection = { x1: newOptions.x1, y1: newOptions.y1,
+ x2: newOptions.x2, y2: newOptions.y2 };
+ newOptions.show = !newOptions.hide;
+
+ x1 = viewX(selection.x1); y1 = viewY(selection.y1);
+ x2 = viewX(selection.x2); y2 = viewY(selection.y2);
+ selection.width = x2 - x1;
+ selection.height = y2 - y1;
+ }
+
+ if (newOptions.handles != null) {
+ $handles.remove();
+ $handles = $(handles = [ ]);
+
+ i = newOptions.handles ? newOptions.handles == 'corners' ? 4 : 8 : 0;
+
+ while (i--)
+ $handles = $handles.add(handles[i] = $('<div />'));
+
+ handleWidth = 4 + options.borderWidth;
+
+ $handles.css({ position: 'absolute', borderWidth: options.borderWidth + 'px',
+ borderStyle: 'solid', borderColor: options.borderColor1,
+ opacity: options.borderOpacity, backgroundColor: options.borderColor2,
+ width: handleWidth + 'px', height: handleWidth + 'px',
+ fontSize: '0px', zIndex: zIndex > 0 ? zIndex + 1 : '1' })
+ .addClass(options.classPrefix + '-handle');
+
+ handleWidth += options.borderWidth * 2;
+ }
+
+ update();
+
+ options = $.extend(options, newOptions);
+
+ if (options.imageWidth || options.imageHeight) {
+ scaleX = (parseInt(options.imageWidth) || imgWidth) / imgWidth;
+ scaleY = (parseInt(options.imageHeight) || imgHeight) / imgHeight;
+ }
+
+ if (newOptions.keys)
+ options.keys = $.extend({ shift: 1, ctrl: 'resize' },
+ newOptions.keys === true ? { } : newOptions.keys);
+
+ $o.addClass(options.classPrefix + '-outer');
+ $area.addClass(options.classPrefix + '-selection');
+ $border1.addClass(options.classPrefix + '-border1');
+ $border2.addClass(options.classPrefix + '-border2');
+
+ $box.add($area).add($border1).add($border2).css({ borderWidth: options.borderWidth + 'px' });
+ $area.css({ backgroundColor: options.selectionColor, opacity: options.selectionOpacity });
+ $border1.css({ borderStyle: 'solid', borderColor: options.borderColor1 });
+ $border2.css({ borderStyle: 'dashed', borderColor: options.borderColor2 });
+ $border1.add($border2).css({ opacity: options.borderOpacity });
+ $o.css({ opacity: options.outerOpacity, backgroundColor: options.outerColor });
+
+ $box.append($area.add($border1).add($border2).add($handles).add($areaOpera));
+
+ if (newOptions.hide)
+ $box.add($o).hide();
+ else if (newOptions.show && imgLoaded) {
+ shown = true;
+ update();
+ $box.add($o).show();
+ }
+
+ aspectRatio = options.aspectRatio && (d = options.aspectRatio.split(/:/)) ?
+ d[0] / d[1] : null;
+
+ if (aspectRatio)
+ if (options.minWidth)
+ options.minHeight = parseInt(options.minWidth / aspectRatio);
+ else if (options.minHeight)
+ options.minWidth = parseInt(options.minHeight * aspectRatio);
+
+ if (options.disable || options.enable === false) {
+ $box.unbind('mousemove', areaMouseMove).unbind('mousedown', areaMouseDown);
+ $img.add($o).unbind('mousedown', imgMouseDown);
+ $(window).unbind('resize', parentScroll);
+ $img.add($img.parents()).unbind('scroll', parentScroll);
+ }
+ else if (options.enable || options.disable === false) {
+ if (options.resizable || options.movable)
+ $box.mousemove(areaMouseMove).mousedown(areaMouseDown);
+
+ if (!options.persistent)
+ $img.add($o).mousedown(imgMouseDown);
+ $(window).resize(parentScroll);
+ $img.add($img.parents()).scroll(parentScroll);
+ }
+
+ options.enable = options.disable = undefined;
+ };
+
+ if ($.browser.msie)
+ $img.attr('unselectable', 'on');
+
+ $.imgAreaSelect.keyPress = $.browser.msie ||
+ $.browser.safari ? 'keydown' : 'keypress';
+
+ if ($.browser.opera)
+ ($areaOpera = $('<div style="width: 100%; height: 100%; position: absolute;" />'))
+ .css({ zIndex: zIndex > 0 ? zIndex + 2 : '2' });
+
+ this.setOptions(options = $.extend({
+ borderColor1: '#000',
+ borderColor2: '#fff',
+ borderWidth: 1,
+ borderOpacity: .5,
+ classPrefix: 'imgareaselect',
+ movable: true,
+ resizable: true,
+ selectionColor: '#fff',
+ selectionOpacity: 0,
+ outerColor: '#000',
+ outerOpacity: .4,
+ parent: 'body',
+ onSelectStart: function () {},
+ onSelectChange: function () {},
+ onSelectEnd: function () {}
+ }, options));
+
+ $box.add($o).css({ visibility: 'hidden', position: position,
+ overflow: 'hidden', zIndex: zIndex > 0 ? zIndex : '0' });
+ $area.css({ borderStyle: 'solid' });
+ $box.css({ position: position, zIndex: zIndex > 0 ? zIndex + 2 : '2' });
+ $area.add($border1).add($border2).css({ position: 'absolute' });
+
+ img.complete || img.readyState == 'complete' || !$img.is('img') ?
+ imgLoad() : $img.one('load', imgLoad);
+};
+
+$.fn.imgAreaSelect = function (options) {
+ options = options || {};
+
+ this.each(function () {
+ if ($(this).data('imgAreaSelect'))
+ $(this).data('imgAreaSelect').setOptions(options);
+ else {
+ if (options.enable === undefined && options.disable === undefined)
+ options.enable = true;
+
+ $(this).data('imgAreaSelect', new $.imgAreaSelect.init(this, options));
+ }
+ });
+
+ return this;
+};
+
+})(jQuery);
diff --git a/mod/profile/views/default/js/jquery.imgareaselect-0.8.min.js b/mod/profile/views/default/js/jquery.imgareaselect-0.8.min.js
new file mode 100644
index 000000000..d9605de1d
--- /dev/null
+++ b/mod/profile/views/default/js/jquery.imgareaselect-0.8.min.js
@@ -0,0 +1 @@
+(function($){$.imgAreaSelect={onKeyPress:null};$.imgAreaSelect.init=function(img,options){var $img=$(img),imgLoaded,$box=$('<div />'),$area=$('<div />'),$border1=$('<div />'),$border2=$('<div />'),$areaOpera,$outLeft=$('<div />'),$outTop=$('<div />'),$outRight=$('<div />'),$outBottom=$('<div />'),$handles=$([]),handleWidth,handles=[],left,top,M=Math,imgOfs,imgWidth,imgHeight,$parent,parOfs,zIndex=0,position='absolute',$p,startX,startY,scaleX=1,scaleY=1,resizeMargin=10,resize=[],V=0,H=1,d,aspectRatio,x1,x2,y1,y2,x,y,adjusted,shown,i,selection={x1:0,y1:0,x2:0,y2:0,width:0,height:0};var $o=$outLeft.add($outTop).add($outRight).add($outBottom);function viewX(x){return x+imgOfs.left-parOfs.left}function viewY(y){return y+imgOfs.top-parOfs.top}function selX(x){return x-imgOfs.left+parOfs.left}function selY(y){return y-imgOfs.top+parOfs.top}function evX(event){return event.pageX-parOfs.left}function evY(event){return event.pageY-parOfs.top}function trueSelection(){return{x1:M.round(selection.x1*scaleX),y1:M.round(selection.y1*scaleY),x2:M.round(selection.x2*scaleX),y2:M.round(selection.y2*scaleY),width:M.round(selection.x2*scaleX)-M.round(selection.x1*scaleX),height:M.round(selection.y2*scaleY)-M.round(selection.y1*scaleY)}}function getZIndex(){$p=$img;while($p.length&&!$p.is('body')){if(!isNaN($p.css('z-index'))&&$p.css('z-index')>zIndex)zIndex=$p.css('z-index');if($p.css('position')=='fixed')position='fixed';$p=$p.parent()}if(!isNaN(options.zIndex))zIndex=options.zIndex}function adjust(){imgOfs={left:M.round($img.offset().left),top:M.round($img.offset().top)};imgWidth=$img.width();imgHeight=$img.height();if($().jquery=='1.3.2'&&$.browser.safari&&position=='fixed'){imgOfs.top+=M.max(document.documentElement.scrollTop,$('body').scrollTop());imgOfs.left+=M.max(document.documentElement.scrollLeft,$('body').scrollLeft())}parOfs=$.inArray($parent.css('position'),['absolute','relative'])!=-1?{left:M.round($parent.offset().left)-$parent.scrollLeft(),top:M.round($parent.offset().top)-$parent.scrollTop()}:position=='fixed'?{left:$(document).scrollLeft(),top:$(document).scrollTop()}:{left:0,top:0};left=viewX(0);top=viewY(0)}function update(resetKeyPress){if(!shown)return;$box.css({left:viewX(selection.x1)+'px',top:viewY(selection.y1)+'px',width:selection.width+'px',height:selection.height+'px'});$area.add($border1).add($border2).css({left:'0px',top:'0px',width:M.max(selection.width-options.borderWidth*2,0)+'px',height:M.max(selection.height-options.borderWidth*2,0)+'px'});$border1.css({borderStyle:'solid',borderColor:options.borderColor1});$border2.css({borderStyle:'dashed',borderColor:options.borderColor2});$border1.add($border2).css({opacity:options.borderOpacity});$outLeft.css({left:left+'px',top:top+'px',width:selection.x1+'px',height:imgHeight+'px'});$outTop.css({left:left+selection.x1+'px',top:top+'px',width:selection.width+'px',height:selection.y1+'px'});$outRight.css({left:left+selection.x2+'px',top:top+'px',width:imgWidth-selection.x2+'px',height:imgHeight+'px'});$outBottom.css({left:left+selection.x1+'px',top:top+selection.y2+'px',width:selection.width+'px',height:imgHeight-selection.y2+'px'});if(handles.length){handles[1].css({left:selection.width-handleWidth+'px'});handles[2].css({left:selection.width-handleWidth+'px',top:selection.height-handleWidth+'px'});handles[3].css({top:selection.height-handleWidth+'px'});if(handles.length==8){handles[4].css({left:(selection.width-handleWidth)/2+'px'});handles[5].css({left:selection.width-handleWidth+'px',top:(selection.height-handleWidth)/2+'px'});handles[6].css({left:(selection.width-handleWidth)/2+'px',top:selection.height-handleWidth+'px'});handles[7].css({top:(selection.height-handleWidth)/2+'px'})}}if(resetKeyPress!==false){if($.imgAreaSelect.keyPress!=docKeyPress)$(document).unbind($.imgAreaSelect.keyPress,$.imgAreaSelect.onKeyPress);if(options.keys)$(document).bind($.imgAreaSelect.keyPress,$.imgAreaSelect.onKeyPress=docKeyPress)}if($.browser.msie&&options.borderWidth==1&&options.borderOpacity<1){$border1.add($border2).css('margin','0');setTimeout(function(){$border1.add($border2).css('margin','auto')},0)}}function areaMouseMove(event){if(!adjusted){adjust();adjusted=true;$box.one('mouseout',function(){adjusted=false})}x=selX(evX(event))-selection.x1;y=selY(evY(event))-selection.y1;resize=[];if(options.resizable){if(y<=resizeMargin)resize[V]='n';else if(y>=selection.height-resizeMargin)resize[V]='s';if(x<=resizeMargin)resize[H]='w';else if(x>=selection.width-resizeMargin)resize[H]='e'}$box.css('cursor',resize.length?resize.join('')+'-resize':options.movable?'move':'');if($areaOpera)$areaOpera.toggle()}function docMouseUp(event){resize=[];$('body').css('cursor','');if(options.autoHide||selection.width*selection.height==0)$box.add($o).hide();options.onSelectEnd(img,trueSelection());$(document).unbind('mousemove',selectingMouseMove);$box.mousemove(areaMouseMove)}function areaMouseDown(event){if(event.which!=1)return false;adjust();if(options.resizable&&resize.length>0){$('body').css('cursor',resize.join('')+'-resize');x1=viewX(selection[resize[H]=='w'?'x2':'x1']);y1=viewY(selection[resize[V]=='n'?'y2':'y1']);$(document).mousemove(selectingMouseMove).one('mouseup',docMouseUp);$box.unbind('mousemove',areaMouseMove)}else if(options.movable){startX=left+selection.x1-evX(event);startY=top+selection.y1-evY(event);$box.unbind('mousemove',areaMouseMove);$(document).mousemove(movingMouseMove).one('mouseup',function(){options.onSelectEnd(img,trueSelection());$(document).unbind('mousemove',movingMouseMove);$box.mousemove(areaMouseMove)})}else $img.mousedown(event);return false}function aspectRatioXY(){x2=M.max(left,M.min(left+imgWidth,x1+M.abs(y2-y1)*aspectRatio*(x2<x1?-1:1)));y2=M.round(M.max(top,M.min(top+imgHeight,y1+M.abs(x2-x1)/aspectRatio*(y2<y1?-1:1))));x2=M.round(x2)}function aspectRatioYX(){y2=M.max(top,M.min(top+imgHeight,y1+M.abs(x2-x1)/aspectRatio*(y2<y1?-1:1)));x2=M.round(M.max(left,M.min(left+imgWidth,x1+M.abs(y2-y1)*aspectRatio*(x2<x1?-1:1))));y2=M.round(y2)}function doResize(){if(options.minWidth&&M.abs(x2-x1)<options.minWidth){x2=x1-options.minWidth*(x2<x1?1:-1);if(x2<left)x1=left+options.minWidth;else if(x2>left+imgWidth)x1=left+imgWidth-options.minWidth}if(options.minHeight&&M.abs(y2-y1)<options.minHeight){y2=y1-options.minHeight*(y2<y1?1:-1);if(y2<top)y1=top+options.minHeight;else if(y2>top+imgHeight)y1=top+imgHeight-options.minHeight}x2=M.max(left,M.min(x2,left+imgWidth));y2=M.max(top,M.min(y2,top+imgHeight));if(aspectRatio)if(M.abs(x2-x1)/aspectRatio>M.abs(y2-y1))aspectRatioYX();else aspectRatioXY();if(options.maxWidth&&M.abs(x2-x1)>options.maxWidth){x2=x1-options.maxWidth*(x2<x1?1:-1);if(aspectRatio)aspectRatioYX()}if(options.maxHeight&&M.abs(y2-y1)>options.maxHeight){y2=y1-options.maxHeight*(y2<y1?1:-1);if(aspectRatio)aspectRatioXY()}selection={x1:selX(M.min(x1,x2)),x2:selX(M.max(x1,x2)),y1:selY(M.min(y1,y2)),y2:selY(M.max(y1,y2)),width:M.abs(x2-x1),height:M.abs(y2-y1)};update();options.onSelectChange(img,trueSelection())}function selectingMouseMove(event){x2=!resize.length||resize[H]||aspectRatio?evX(event):viewX(selection.x2);y2=!resize.length||resize[V]||aspectRatio?evY(event):viewY(selection.y2);doResize();return false}function doMove(newX1,newY1){x2=(x1=newX1)+selection.width;y2=(y1=newY1)+selection.height;selection=$.extend(selection,{x1:selX(x1),y1:selY(y1),x2:selX(x2),y2:selY(y2)});update();options.onSelectChange(img,trueSelection())}function movingMouseMove(event){x1=M.max(left,M.min(startX+evX(event),left+imgWidth-selection.width));y1=M.max(top,M.min(startY+evY(event),top+imgHeight-selection.height));doMove(x1,y1);event.preventDefault();return false}function startSelection(event){adjust();x2=x1;y2=y1;doResize();resize=[];$box.add($o.is(':visible')?null:$o).show();shown=true;$(document).unbind('mouseup',cancelSelection).mousemove(selectingMouseMove).one('mouseup',docMouseUp);$box.unbind('mousemove',areaMouseMove);options.onSelectStart(img,trueSelection())}function cancelSelection(){$(document).unbind('mousemove',startSelection);$box.add($o).hide();selection={x1:0,y1:0,x2:0,y2:0,width:0,height:0};options.onSelectChange(img,selection);options.onSelectEnd(img,selection)}function imgMouseDown(event){if(event.which!=1)return false;adjust();startX=x1=evX(event);startY=y1=evY(event);$(document).one('mousemove',startSelection).one('mouseup',cancelSelection);return false}function parentScroll(){adjust();update(false);x1=viewX(selection.x1);y1=viewY(selection.y1);x2=viewX(selection.x2);y2=viewY(selection.y2)}function imgLoad(){imgLoaded=true;if(options.show){shown=true;adjust();update();$box.add($o).show()}$box.add($o).css({visibility:''})}var docKeyPress=function(event){var k=options.keys,d,t,key=event.keyCode||event.which;d=!isNaN(k.alt)&&(event.altKey||event.originalEvent.altKey)?k.alt:!isNaN(k.ctrl)&&event.ctrlKey?k.ctrl:!isNaN(k.shift)&&event.shiftKey?k.shift:!isNaN(k.arrows)?k.arrows:10;if(k.arrows=='resize'||(k.shift=='resize'&&event.shiftKey)||(k.ctrl=='resize'&&event.ctrlKey)||(k.alt=='resize'&&(event.altKey||event.originalEvent.altKey))){switch(key){case 37:d=-d;case 39:t=M.max(x1,x2);x1=M.min(x1,x2);x2=M.max(t+d,x1);if(aspectRatio)aspectRatioYX();break;case 38:d=-d;case 40:t=M.max(y1,y2);y1=M.min(y1,y2);y2=M.max(t+d,y1);if(aspectRatio)aspectRatioXY();break;default:return}doResize()}else{x1=M.min(x1,x2);y1=M.min(y1,y2);switch(key){case 37:doMove(M.max(x1-d,left),y1);break;case 38:doMove(x1,M.max(y1-d,top));break;case 39:doMove(x1+M.min(d,imgWidth-selX(x2)),y1);break;case 40:doMove(x1,y1+M.min(d,imgHeight-selY(y2)));break;default:return}}return false};this.setOptions=function(newOptions){if(newOptions.parent)($parent=$(newOptions.parent)).append($box.add($o));adjust();getZIndex();if(newOptions.x1!=null){selection={x1:newOptions.x1,y1:newOptions.y1,x2:newOptions.x2,y2:newOptions.y2};newOptions.show=!newOptions.hide;x1=viewX(selection.x1);y1=viewY(selection.y1);x2=viewX(selection.x2);y2=viewY(selection.y2);selection.width=x2-x1;selection.height=y2-y1}if(newOptions.handles!=null){$handles.remove();$handles=$(handles=[]);i=newOptions.handles?newOptions.handles=='corners'?4:8:0;while(i--)$handles=$handles.add(handles[i]=$('<div />'));handleWidth=4+options.borderWidth;$handles.css({position:'absolute',borderWidth:options.borderWidth+'px',borderStyle:'solid',borderColor:options.borderColor1,opacity:options.borderOpacity,backgroundColor:options.borderColor2,width:handleWidth+'px',height:handleWidth+'px',fontSize:'0px',zIndex:zIndex>0?zIndex+1:'1'}).addClass(options.classPrefix+'-handle');handleWidth+=options.borderWidth*2}update();options=$.extend(options,newOptions);if(options.imageWidth||options.imageHeight){scaleX=(parseInt(options.imageWidth)||imgWidth)/imgWidth;scaleY=(parseInt(options.imageHeight)||imgHeight)/imgHeight}if(newOptions.keys)options.keys=$.extend({shift:1,ctrl:'resize'},newOptions.keys===true?{}:newOptions.keys);$o.addClass(options.classPrefix+'-outer');$area.addClass(options.classPrefix+'-selection');$border1.addClass(options.classPrefix+'-border1');$border2.addClass(options.classPrefix+'-border2');$box.add($area).add($border1).add($border2).css({borderWidth:options.borderWidth+'px'});$area.css({backgroundColor:options.selectionColor,opacity:options.selectionOpacity});$border1.css({borderStyle:'solid',borderColor:options.borderColor1});$border2.css({borderStyle:'dashed',borderColor:options.borderColor2});$border1.add($border2).css({opacity:options.borderOpacity});$o.css({opacity:options.outerOpacity,backgroundColor:options.outerColor});$box.append($area.add($border1).add($border2).add($handles).add($areaOpera));if(newOptions.hide)$box.add($o).hide();else if(newOptions.show&&imgLoaded){shown=true;update();$box.add($o).show()}aspectRatio=options.aspectRatio&&(d=options.aspectRatio.split(/:/))?d[0]/d[1]:null;if(aspectRatio)if(options.minWidth)options.minHeight=parseInt(options.minWidth/aspectRatio);else if(options.minHeight)options.minWidth=parseInt(options.minHeight*aspectRatio);if(options.disable||options.enable===false){$box.unbind('mousemove',areaMouseMove).unbind('mousedown',areaMouseDown);$img.add($o).unbind('mousedown',imgMouseDown);$(window).unbind('resize',parentScroll);$img.add($img.parents()).unbind('scroll',parentScroll)}else if(options.enable||options.disable===false){if(options.resizable||options.movable)$box.mousemove(areaMouseMove).mousedown(areaMouseDown);if(!options.persistent)$img.add($o).mousedown(imgMouseDown);$(window).resize(parentScroll);$img.add($img.parents()).scroll(parentScroll)}options.enable=options.disable=undefined};if($.browser.msie)$img.attr('unselectable','on');$.imgAreaSelect.keyPress=$.browser.msie||$.browser.safari?'keydown':'keypress';if($.browser.opera)($areaOpera=$('<div style="width: 100%; height: 100%; position: absolute;" />')).css({zIndex:zIndex>0?zIndex+2:'2'});this.setOptions(options=$.extend({borderColor1:'#000',borderColor2:'#fff',borderWidth:1,borderOpacity:.5,classPrefix:'imgareaselect',movable:true,resizable:true,selectionColor:'#fff',selectionOpacity:0,outerColor:'#000',outerOpacity:.4,parent:'body',onSelectStart:function(){},onSelectChange:function(){},onSelectEnd:function(){}},options));$box.add($o).css({visibility:'hidden',position:position,overflow:'hidden',zIndex:zIndex>0?zIndex:'0'});$area.css({borderStyle:'solid'});$box.css({position:position,zIndex:zIndex>0?zIndex+2:'2'});$area.add($border1).add($border2).css({position:'absolute'});img.complete||img.readyState=='complete'||!$img.is('img')?imgLoad():$img.one('load',imgLoad)};$.fn.imgAreaSelect=function(options){options=options||{};this.each(function(){if($(this).data('imgAreaSelect'))$(this).data('imgAreaSelect').setOptions(options);else{if(options.enable===undefined&&options.disable===undefined)options.enable=true;$(this).data('imgAreaSelect',new $.imgAreaSelect.init(this,options))}});return this}})(jQuery); \ No newline at end of file
diff --git a/mod/profile/views/default/profile/css.php b/mod/profile/views/default/profile/css.php
new file mode 100644
index 000000000..cf95d9bdb
--- /dev/null
+++ b/mod/profile/views/default/profile/css.php
@@ -0,0 +1,124 @@
+<?php
+
+ /**
+ * Elgg Profile
+ *
+ * @package Profile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+?>
+
+#profile_icon_wrapper {
+ float:left;
+}
+
+.usericon {
+ position:relative;
+}
+
+.avatar_menu_button {
+ width:15px;
+ height:15px;
+ position:absolute;
+ cursor:pointer;
+ display:none;
+ right:0;
+ bottom:0;
+}
+.avatar_menu_arrow {
+ background: url(<?php echo $vars['url']; ?>_graphics/avatar_menu_arrows.gif) no-repeat left top;
+ width:15px;
+ height:15px;
+}
+.avatar_menu_arrow_on {
+ background: url(<?php echo $vars['url']; ?>_graphics/avatar_menu_arrows.gif) no-repeat left -16px;
+ width:15px;
+ height:15px;
+}
+.avatar_menu_arrow_hover {
+ background: url(<?php echo $vars['url']; ?>_graphics/avatar_menu_arrows.gif) no-repeat left -32px;
+ width:15px;
+ height:15px;
+}
+.usericon div.sub_menu {
+ display:none;
+ position:absolute;
+ padding:2px;
+ margin:0;
+ border-top:solid 1px #E5E5E5;
+ border-left:solid 1px #E5E5E5;
+ border-right:solid 1px #999999;
+ border-bottom:solid 1px #999999;
+ width:160px;
+ background:#FFFFFF;
+ text-align:left;
+}
+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 h3 {
+ font-size:1.2em;
+ padding-bottom:3px;
+ border-bottom:solid 1px #dddddd;
+ color: #4690d6;
+ margin:0 !important;
+}
+.usericon div.sub_menu h3:hover {
+
+}
+
+.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;
+}
+.user_menu_admin {
+ border-top:solid 1px #dddddd;
+}
+.user_menu_admin a {
+ color:red;
+}
+.user_menu_admin a:hover {
+ color:white !important;
+ background:red !important;
+}
+
+.resetdefaultprofile {
+ padding:0 10px 0 10px;
+}
+.resetdefaultprofile input[type="submit"] {
+ background: #dedede;
+ border-color: #dedede;
+ color:#333333;
+}
+.resetdefaultprofile input[type="submit"]:hover {
+ background: red;
+ border-color: red;
+ color:white;
+}
+
+/* Banned user */
+#profile_banned {
+ background-color:#FF8888;
+ border:3px solid #FF0000;
+ padding:2px;
+} \ No newline at end of file
diff --git a/mod/profile/views/default/profile/edit.php b/mod/profile/views/default/profile/edit.php
new file mode 100644
index 000000000..11e3c2997
--- /dev/null
+++ b/mod/profile/views/default/profile/edit.php
@@ -0,0 +1,67 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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
+ */
+
+?>
+<div class="contentWrapper">
+<form action="<?php echo $vars['url']; ?>action/profile/edit" method="post">
+<?php echo elgg_view('input/securitytoken') ?>
+<?php
+
+ //var_export($vars['profile']);
+ if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0)
+ foreach($vars['config']->profile as $shortname => $valtype) {
+ if ($metadata = get_metadata_byname($vars['entity']->guid, $shortname)) {
+ if (is_array($metadata)) {
+ $value = '';
+ foreach($metadata as $md) {
+ if (!empty($value)) $value .= ', ';
+ $value .= $md->value;
+ $access_id = $md->access_id;
+ }
+ } else {
+ $value = $metadata->value;
+ $access_id = $metadata->access_id;
+ }
+ } else {
+ $value = '';
+ $access_id = ACCESS_DEFAULT;
+ }
+
+?>
+
+ <p>
+ <label>
+ <?php echo elgg_echo("profile:{$shortname}") ?><br />
+ <?php echo elgg_view("input/{$valtype}",array(
+ 'internalname' => $shortname,
+ 'value' => $value,
+ )); ?>
+ </label>
+ <?php echo elgg_view('input/access',array('internalname' => 'accesslevel['.$shortname.']', 'value' => $access_id)); ?>
+ </p>
+
+<?php
+
+ }
+
+?>
+
+ <p>
+ <input type="hidden" name="username" value="<?php echo page_owner_entity()->username; ?>" />
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" />
+ </p>
+
+</form>
+</div> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/editdefaultprofile.php b/mod/profile/views/default/profile/editdefaultprofile.php
new file mode 100644
index 000000000..73f0a8783
--- /dev/null
+++ b/mod/profile/views/default/profile/editdefaultprofile.php
@@ -0,0 +1,35 @@
+<?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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ $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')
+ )));
+
+ $submit_control = elgg_view('input/submit', array('internalname' => elgg_echo('save'), 'value' => elgg_echo('save')));
+
+ $formbody = <<< END
+ <p>$label_text: $label_control
+ $type_text: $type_control
+ $submit_control</p>
+END;
+ echo "<div class=\"contentWrapper\">";
+ echo "<p>" . elgg_echo('profile:explainchangefields') . "</p>";
+ echo elgg_view('input/form', array('body' => $formbody, 'action' => $vars['url'] . 'action/profile/editdefault'));
+ echo "</div>";
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/editicon.php b/mod/profile/views/default/profile/editicon.php
new file mode 100644
index 000000000..7731d9899
--- /dev/null
+++ b/mod/profile/views/default/profile/editicon.php
@@ -0,0 +1,149 @@
+<?php
+
+ /**
+ * 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'];
+
+?>
+<!-- grab the required js for icon cropping -->
+<div class="contentWrapper">
+<script type="text/javascript" src="<?php echo $vars['url']; ?>mod/profile/views/default/js/jquery.imgareaselect-0.8.min.js"></script>
+
+<p><?php echo elgg_echo('profile:profilepictureinstructions'); ?></p>
+
+<div id="current_user_avatar">
+
+ <label><?php echo elgg_echo('profile:currentavatar'); ?></label>
+ <?php
+
+ $user_avatar = $currentuser->getIcon('medium');
+ echo "<img src=\"{$user_avatar}\" alt=\"avatar\" />";
+
+ ?>
+
+</div>
+
+<div id="profile_picture_form">
+ <form action="<?php echo $vars['url']; ?>action/profile/iconupload" method="post" enctype="multipart/form-data">
+ <?php echo elgg_view('input/securitytoken'); ?>
+ <input type="hidden" name="username" value="<?php echo $currentuser->username; ?>" />
+ <p><label><?php echo elgg_echo("profile:editicon"); ?></label><br />
+
+ <?php
+
+ echo elgg_view("input/file",array('internalname' => 'profileicon'));
+ ?>
+ <br /><input type="submit" class="submit_button" value="<?php echo elgg_echo("upload"); ?>" />
+ </p>
+ </form>
+</div>
+
+<div id="profile_picture_croppingtool">
+<label><?php echo elgg_echo('profile:profilepicturecroppingtool'); ?></label><br />
+<p>
+<?php
+
+ echo elgg_echo("profile:createicon:instructions");
+
+ //display the current user photo
+
+ $user_master_image = $currentuser->getIcon('master');
+
+?>
+</p>
+<script type="text/javascript">
+
+ //function to display a preview of the users cropped section
+ function preview(img, selection) {
+ // catch for the first click on the image
+ if (selection.width == 0 || selection.height == 0) {
+ return;
+ }
+
+ var origWidth = $("#user_avatar").width(); //get the width of the users master photo
+ var origHeight = $("#user_avatar").height(); //get the height of the users master photo
+ var scaleX = 100 / selection.width;
+ var scaleY = 100 / selection.height;
+ $('#user_avatar_preview > img').css({
+ width: Math.round(scaleX * origWidth) + 'px',
+ height: Math.round(scaleY * origHeight) + 'px',
+ marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px',
+ marginTop: '-' + Math.round(scaleY * selection.y1) + 'px'
+ });
+ }
+
+ //variables for the newly cropped avatar
+ //var $x1, $y1, $x2, $y2, $w, $h;
+
+ function selectChange(img, selection){
+
+ //populate the form with the correct coordinates once a user has cropped their image
+ $('#x_1').val(selection.x1);
+ $('#x_2').val(selection.x2);
+ $('#y_1').val(selection.y1);
+ $('#y_2').val(selection.y2);
+
+ }
+
+ $(document).ready(function () {
+
+ //get the coordinates from the form
+ /*
+ var x_1 = $('#x_1').val();
+ var x_2 = $('#x_2').val();
+ var y_1 = $('#y_1').val();
+ var y_2 = $('#y_2').val();
+ var w = x_2 - x_1;
+ var h = y_2 - y_1;
+ selection = { x1: x_1, y1: y_1, x2: x_2, y2: y_2, width: w, height: h };
+ */
+
+ $('<div id="user_avatar_preview"><img src="<?php echo $user_master_image; ?>" /></div>')
+ .insertAfter($('#user_avatar'));
+
+ $('<div id="user_avatar_preview_title"><label><?php echo elgg_echo('profile:preview'); ?></label></div>').insertBefore($('#user_avatar_preview'));
+ });
+
+ $(window).load(function () {
+
+ //this produces the coordinates
+ $('#user_avatar').imgAreaSelect({ selectionOpacity: 0, onSelectEnd: selectChange });
+ //show the preview
+ $('#user_avatar').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview });
+
+ });
+
+</script>
+
+<p>
+<img id="user_avatar" src="<?php echo $user_master_image; ?>" alt="<?php echo elgg_echo("profile:icon"); ?>" />
+</p>
+
+<div class="clearfloat"></div>
+
+<form action="<?php echo $vars['url']; ?>action/profile/cropicon" method="post" />
+ <?php echo elgg_view('input/securitytoken'); ?>
+ <input type="hidden" name="username" value="<?php echo $vars['user']->username; ?>" />
+ <input type="hidden" name="x_1" value="<?php echo $vars['user']->x1; ?>" id="x_1" />
+ <input type="hidden" name="x_2" value="<?php echo $vars['user']->x2; ?>" id="x_2" />
+ <input type="hidden" name="y_1" value="<?php echo $vars['user']->y1; ?>" id="y_1" />
+ <input type="hidden" name="y_2" value="<?php echo $vars['user']->y2; ?>" id="y_2" />
+ <input type="submit" name="submit" value="<?php echo elgg_echo("profile:createicon"); ?>" />
+</form>
+
+</div>
+<div class="clearfloat"></div>
+
+</div>
diff --git a/mod/profile/views/default/profile/gallery.php b/mod/profile/views/default/profile/gallery.php
new file mode 100644
index 000000000..ffbabfc7d
--- /dev/null
+++ b/mod/profile/views/default/profile/gallery.php
@@ -0,0 +1,47 @@
+<?php
+
+ /**
+ * Elgg user display (gallery)
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @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 .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
+ else
+ $info .= "<p><b><strike>" . $vars['entity']->name . "</b></strike><br />".elgg_echo('profile:banned')."</p>";
+
+ // 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
new file mode 100644
index 000000000..678fbbada
--- /dev/null
+++ b/mod/profile/views/default/profile/hoverover.php
@@ -0,0 +1,26 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed.
+ */
+
+?>
+
+ <p class="user_menu_name">
+ <b><?php echo $vars['entity']->name; ?></b>
+ </p>
+
+<?php
+
+ echo elgg_view("profile/hoverover/actions",$vars);
+ echo elgg_view("profile/hoverover/links",$vars);
+
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/icon.php b/mod/profile/views/default/profile/icon.php
new file mode 100644
index 000000000..3fd6ab87b
--- /dev/null
+++ b/mod/profile/views/default/profile/icon.php
@@ -0,0 +1,92 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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'];
+
+ 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";
+
+ // Get any align and js
+ 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) {
+
+?>
+<div class="usericon">
+<div class="avatar_menu_button"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" border="0" width="15px" height="15px" /></div>
+
+ <div class="sub_menu">
+ <h3><a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo $vars['entity']->name; ?></a></h3>
+ <?php
+ if (isloggedin()) {
+ $actions = elgg_view('profile/menu/actions',$vars);
+ if (!empty($actions)) {
+
+ echo "<div class=\"item_line\">{$actions}</div>";
+
+ }
+ if ($vars['entity']->getGUID() == $vars['user']->getGUID()) {
+ echo elgg_view('profile/menu/linksownpage',$vars);
+ } else {
+ echo elgg_view('profile/menu/links',$vars);
+ }
+ } else {
+ echo elgg_view('profile/menu/links',$vars);
+ }
+ ?>
+ </div>
+ <?php
+ if ((isadminloggedin()) || (!$vars['entity']->isBanned())) {
+ ?><a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><?php
+ }
+
+ }
+
+ ?><img src="<?php echo $vars['entity']->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> alt="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" <?php echo $vars['js']; ?> /><?php
+
+ if (!$override) {
+
+ ?></a>
+</div>
+
+<?php
+
+ }
+ }
+
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/javascript.php b/mod/profile/views/default/profile/javascript.php
new file mode 100644
index 000000000..f2ad4b74b
--- /dev/null
+++ b/mod/profile/views/default/profile/javascript.php
@@ -0,0 +1,138 @@
+<?php
+
+ /**
+ * Elgg profile image Javascript
+ *
+ * @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
+ */
+
+// header("Content-type: text/javascript");
+// header("Pragma: public");
+// header("Cache-Control: public");
+
+?>
+
+var submenuLayer = 1000;
+
+function setup_avatar_menu() {
+
+ // avatar image menu link
+ $("div.usericon img").mouseover(function() {
+ // find nested avatar_menu_button and show
+ $(this.parentNode.parentNode).children(".avatar_menu_button").show();
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow");
+ //$(this.parentNode.parentNode).css("z-index", submenuLayer);
+ })
+ .mouseout(function() {
+ if($(this).parent().parent().find("div.sub_menu").css('display')!="block") {
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_on");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_hover");
+ $(this.parentNode.parentNode).children(".avatar_menu_button").hide();
+ }
+ else {
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_on");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_hover");
+ $(this.parentNode.parentNode).children(".avatar_menu_button").show();
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow");
+ }
+ });
+
+
+ // avatar contextual menu
+ $(".avatar_menu_button img").click(function(e) {
+
+ var submenu = $(this).parent().parent().find("div.sub_menu");
+
+ // close submenu if arrow is clicked & menu already open
+ if(submenu.css('display') == "block") {
+ //submenu.hide();
+ }
+ else {
+ // get avatar dimensions
+ var avatar = $(this).parent().parent().parent().find("div.usericon");
+ //alert( "avatarWidth: " + avatar.width() + ", avatarHeight: " + avatar.height() );
+
+ // move submenu position so it aligns with arrow graphic
+ if (e.pageX < 840) { // popup menu to left of arrow if we're at edge of page
+ submenu.css("top",(avatar.height()) + "px")
+ .css("left",(avatar.width()-15) + "px")
+ .fadeIn('normal');
+ }
+ else {
+ submenu.css("top",(avatar.height()) + "px")
+ .css("left",(avatar.width()-166) + "px")
+ .fadeIn('normal');
+ }
+
+ // force z-index - workaround for IE z-index bug
+ avatar.css("z-index", submenuLayer);
+ avatar.find("a.icon img").css("z-index", submenuLayer);
+ submenu.css("z-index", submenuLayer+1);
+
+ submenuLayer++;
+
+ // change arrow to 'on' state
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_hover");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow_on");
+ }
+
+ // hide any other open submenus and reset arrows
+ $("div.sub_menu:visible").not(submenu).hide();
+ $(".avatar_menu_button").removeClass("avatar_menu_arrow");
+ $(".avatar_menu_button").removeClass("avatar_menu_arrow_on");
+ $(".avatar_menu_button").removeClass("avatar_menu_arrow_hover");
+ $(".avatar_menu_button").hide();
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow_on");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").show();
+ //alert("submenuLayer = " +submenu.css("z-index"));
+ })
+ // hover arrow each time mouseover enters arrow graphic (eg. when menu is already shown)
+ .mouseover(function() {
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_on");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow_hover");
+ })
+ // if menu not shown revert arrow, else show 'menu open' arrow
+ .mouseout(function() {
+ if($(this).parent().parent().find("div.sub_menu").css('display')!="block"){
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_hover");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow");
+ }
+ else {
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow_hover");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").removeClass("avatar_menu_arrow");
+ $(this.parentNode.parentNode).children("div.avatar_menu_button").addClass("avatar_menu_arrow_on");
+ }
+ });
+
+ // hide avatar menu if click occurs outside of menu
+ // and hide arrow button
+ $(document).click(function(event) {
+ var target = $(event.target);
+ if (target.parents(".usericon").length == 0) {
+ $(".usericon div.sub_menu").fadeOut();
+ $(".avatar_menu_button").removeClass("avatar_menu_arrow");
+ $(".avatar_menu_button").removeClass("avatar_menu_arrow_on");
+ $(".avatar_menu_button").removeClass("avatar_menu_arrow_hover");
+ $(".avatar_menu_button").hide();
+ }
+ });
+
+
+}
+
+$(document).ready(function() {
+
+ setup_avatar_menu();
+
+});
diff --git a/mod/profile/views/default/profile/listing.php b/mod/profile/views/default/profile/listing.php
new file mode 100644
index 000000000..cb65c93a6
--- /dev/null
+++ b/mod/profile/views/default/profile/listing.php
@@ -0,0 +1,57 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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 .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
+ //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 .= "<p class=\"owner_timestamp\">" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
+ }
+ }
+ else
+ {
+ $info .= "<p><b><strike>";
+ if (isadminloggedin())
+ $info .= "<a href=\"" . $vars['entity']->getUrl() . "\">";
+ $info .= $vars['entity']->name;
+ if (isadminloggedin())
+ $info .= "</a>";
+ $info .= "</strike></b></p>";
+
+ //$info .= "<p class=\"owner_timestamp\">" . elgg_echo('profile:banned') . "</p>";
+
+ }
+
+ 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
new file mode 100644
index 000000000..7ca1d84d5
--- /dev/null
+++ b/mod/profile/views/default/profile/menu/actions.php
@@ -0,0 +1,29 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @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 "<p class=\"user_menu_removefriend\"><a href=\"{$vars['url']}action/friends/remove?friend={$vars['entity']->getGUID()}&__elgg_token=$token&__elgg_ts=$ts\">" . elgg_echo("friend:remove") . "</a></p>";
+ } else {
+ echo "<p class=\"user_menu_addfriend\"><a href=\"{$vars['url']}action/friends/add?friend={$vars['entity']->getGUID()}&__elgg_token=$token&__elgg_ts=$ts\">" . elgg_echo("friend:add") . "</a></p>";
+ }
+ }
+ }
+
+?> \ 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
new file mode 100644
index 000000000..7d0c24cb4
--- /dev/null
+++ b/mod/profile/views/default/profile/menu/adminlinks.php
@@ -0,0 +1,40 @@
+<?php
+ /**
+ * Profile admin context 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 (isadminloggedin()){
+ if ($_SESSION['id']!=$vars['entity']->guid){
+
+ $ts = time();
+ $token = generate_action_token($ts);
+
+?>
+ <a href="<?php echo $vars['url']; ?>pg/settings/user/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo('profile:editdetails'); ?></a>
+ <?php
+ if (!$vars['entity']->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"));
+ }
+ }
+ }
+?> \ 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
new file mode 100644
index 000000000..2acbb35e8
--- /dev/null
+++ b/mod/profile/views/default/profile/menu/adminwrapper.php
@@ -0,0 +1,11 @@
+<?php
+
+ $adminlinks = elgg_view('profile/menu/adminlinks',$vars);
+
+ if (!empty($adminlinks)) {
+
+ echo "<p class=\"user_menu_admin\">{$adminlinks}</p>";
+
+ }
+
+?> \ 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
new file mode 100644
index 000000000..8aa5e1a1a
--- /dev/null
+++ b/mod/profile/views/default/profile/menu/links.php
@@ -0,0 +1,36 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed.
+ */
+
+?>
+
+ <p class="user_menu_profile">
+ <a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo elgg_echo("profile"); ?></a>
+ </p>
+ <?php
+ if ($vars['entity']->canEdit())
+ {
+ ?>
+ <p class="user_menu_profile">
+ <a href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/editicon/"><?php echo elgg_echo("profile:editicon"); ?></a>
+ </p>
+ <?php
+ }
+
+ ?>
+ <p class="user_menu_friends">
+ <a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends"); ?></a>
+ </p>
+ <p class="user_menu_friends_of">
+ <a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends:of"); ?></a>
+ </p> \ 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
new file mode 100644
index 000000000..08aece082
--- /dev/null
+++ b/mod/profile/views/default/profile/menu/linksownpage.php
@@ -0,0 +1,33 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed.
+ */
+
+?>
+ <?php
+ if ($vars['entity']->canEdit())
+ {
+ ?>
+ <p class="user_menu_profile">
+ <a href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/editicon/"><?php echo elgg_echo("profile:editicon"); ?></a>
+ </p>
+ <?php
+ }
+
+ ?>
+ <p class="user_menu_friends">
+ <a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends"); ?></a>
+ </p>
+ <p class="user_menu_friends_of">
+ <a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends:of"); ?></a>
+ </p>
+ \ No newline at end of file
diff --git a/mod/profile/views/default/profile/metatags.php b/mod/profile/views/default/profile/metatags.php
new file mode 100644
index 000000000..a6981c4c9
--- /dev/null
+++ b/mod/profile/views/default/profile/metatags.php
@@ -0,0 +1,21 @@
+<?php
+
+ /**
+ * 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 <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ */
+
+ /*
+ * <script type="text/javascript" src="<?php echo $vars['url']; ?>pg/iconjs/profile.js" ></script>
+ */
+
+?>
+
+ <?php if ($owner = page_owner_entity()) { ?><link rel="meta" type="application/rdf+xml" title="FOAF" href="<?php echo full_url(); ?>?view=foaf" /><?php } ?>
+
diff --git a/mod/profile/views/default/profile/profilelinks.php b/mod/profile/views/default/profile/profilelinks.php
new file mode 100644
index 000000000..6f35620c6
--- /dev/null
+++ b/mod/profile/views/default/profile/profilelinks.php
@@ -0,0 +1,50 @@
+<?php
+
+ /**
+ * Elgg profile links
+ * We need to make sure that the correct links display depending on whether you are looking at your own
+ * profile or someone else's
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed.
+ */
+
+?>
+
+<?php
+
+ $banned = false;
+ $owner = page_owner_entity();
+ if ($owner) $banned = $owner->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 "<div id=\"profile_menu_wrapper\">"; //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 "</div>"; //close wrapper div
+
+ } else {
+
+ echo "<div id=\"profile_menu_wrapper\">"; //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 "</div>"; //close wrapper div
+
+ }
+ }
+ else
+ { // Some nice spacing
+ echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
+ echo "</div>"; //close wrapper div
+ }
+?> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/submenu.php b/mod/profile/views/default/profile/submenu.php
new file mode 100644
index 000000000..906200a00
--- /dev/null
+++ b/mod/profile/views/default/profile/submenu.php
@@ -0,0 +1,22 @@
+<?php
+
+ /**
+ * Elgg profile submenu links
+ * These sit in the submenu when the profile editing is on view
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @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.org/
+ *
+ */
+
+?>
+
+<ul>
+ <li><a href="<?php echo $CONFIG->wwwroot . "mod/profile/edit.php"; ?>"><?php echo elgg_echo('profile:details'); ?></a></li>
+ <li><a href="<?php echo $CONFIG->wwwroot."mod/profile/editicon.php"; ?>"><?php echo elgg_echo('profile:editicon'); ?></a></li>
+ <li><a href="<?php echo $CONFIG->wwwroot."pg/profile/" . $_SESSION['user']->username; ?>"><?php echo elgg_echo('profile:back'); ?></a></li>
+</ul> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/userdetails.php b/mod/profile/views/default/profile/userdetails.php
new file mode 100644
index 000000000..eb22a704a
--- /dev/null
+++ b/mod/profile/views/default/profile/userdetails.php
@@ -0,0 +1,174 @@
+<?php
+
+ /**
+ * Elgg user display (details)
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @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 "<div id=\"profile_info\">";
+
+?>
+
+<table cellspacing="0">
+<tr>
+<td>
+
+<?php
+
+ // wrap the icon and links in a div
+ echo "<div id=\"profile_info_column_left\">";
+
+ echo "<div id=\"profile_icon_wrapper\">";
+ // get the user's main profile picture
+ echo elgg_view(
+ "profile/icon", array(
+ 'entity' => $vars['entity'],
+ //'align' => "left",
+ 'size' => $iconsize,
+ 'override' => true,
+ )
+ );
+
+
+ echo "</div>";
+ echo "<div class=\"clearfloat\"></div>";
+ // display relevant links
+ echo elgg_view("profile/profilelinks", array("entity" => $vars['entity']));
+
+ // close profile_info_column_left
+ echo "</div>";
+
+?>
+</td>
+<td>
+
+ <div id="profile_info_column_middle" >
+ <?php
+
+ if ($vars['entity']->canEdit()) {
+
+ ?>
+ <p class="profile_info_edit_buttons">
+ <a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/"><?php echo elgg_echo("profile:edit"); ?></a>
+ </p>
+ <?php
+
+ }
+
+ ?>
+
+
+
+ <?php
+
+ // Simple XFN
+ $rel = "";
+ if (page_owner() == $vars['entity']->guid)
+ $rel = 'me';
+ else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
+ $rel = 'friend';
+
+ // display the users name
+ echo "<h2><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></h2>";
+
+ //insert a view that can be extended
+ echo elgg_view("profile/status", array("entity" => $vars['entity']));
+
+ if ($vars['full'] == true) {
+
+ ?>
+ <?php
+ $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';
+
+ ?>
+ <p class="<?php echo $even_odd; ?>">
+ <b><?php
+
+ echo elgg_echo("profile:{$shortname}");
+
+ ?>: </b>
+ <?php
+ $options = array(
+ 'value' => $vars['entity']->$shortname
+ );
+
+ if ($valtype == 'tags') {
+ $options['tag_names'] = $shortname;
+ }
+
+ echo elgg_view("output/{$valtype}", $options);
+
+ ?>
+
+ </p>
+
+ <?php
+ }
+ }
+ }
+ }
+
+ ?>
+ </div><!-- /#profile_info_column_middle -->
+
+</td>
+</tr>
+<?php if (!get_plugin_setting('user_defined_fields', 'profile')) {?>
+<tr>
+<td colspan="2">
+ <div id="profile_info_column_right">
+ <p class="profile_aboutme_title"><b><?php echo elgg_echo("profile:aboutme"); ?></b></p>
+
+ <?php if ($vars['entity']->isBanned()) { ?>
+ <div id="profile_banned">
+ <?php
+ echo elgg_echo('profile:banned');
+ ?>
+ </div><!-- /#profile_info_column_right -->
+
+ <?php } else { ?>
+
+ <?php
+ echo elgg_view('output/longtext', array('value' => $vars['entity']->description));
+ //echo autop(filter_tags($vars['entity']->description));
+ ?>
+
+ <?php } ?>
+
+ </div><!-- /#profile_info_column_right -->
+
+</td>
+
+
+
+</tr>
+<?php } ?>
+
+</table>
+
+
+
+</div><!-- /#profile_info -->
diff --git a/mod/profile/views/default/river/user/default/profileiconupdate.php b/mod/profile/views/default/river/user/default/profileiconupdate.php
new file mode 100644
index 000000000..2aa0933b6
--- /dev/null
+++ b/mod/profile/views/default/river/user/default/profileiconupdate.php
@@ -0,0 +1,12 @@
+<?php
+
+ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("profile:river:iconupdate"),$url);
+ $string .= "<div class=\"river_content_display\">";
+ $string .= elgg_view("profile/icon",array('entity' => $performed_by, 'size' => 'small', 'override' => 'true'));
+ $string .= "</div>";
+?>
+
+<?php 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
new file mode 100644
index 000000000..9b87d829f
--- /dev/null
+++ b/mod/profile/views/default/river/user/default/profileupdate.php
@@ -0,0 +1,10 @@
+<?php
+
+ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("profile:river:update"),$url);
+
+?>
+
+<?php echo $string; ?> \ No newline at end of file