diff options
Diffstat (limited to 'pages')
-rw-r--r-- | pages/account/forgotten_password.php | 27 | ||||
-rw-r--r-- | pages/account/login.php | 28 | ||||
-rw-r--r-- | pages/account/register.php | 58 | ||||
-rw-r--r-- | pages/account/reset_password.php | 40 | ||||
-rw-r--r-- | pages/avatar/edit.php | 32 | ||||
-rw-r--r-- | pages/avatar/view.php | 54 | ||||
-rw-r--r-- | pages/entities/index.php | 56 | ||||
-rw-r--r-- | pages/friends/collections/add.php | 22 | ||||
-rw-r--r-- | pages/friends/collections/pickercallback.php | 59 | ||||
-rw-r--r-- | pages/friends/collections/view.php | 21 | ||||
-rw-r--r-- | pages/friends/index.php | 35 | ||||
-rw-r--r-- | pages/friends/of.php | 35 | ||||
-rw-r--r-- | pages/profile/edit.php | 32 | ||||
-rw-r--r-- | pages/river.php | 61 | ||||
-rw-r--r-- | pages/settings/account.php | 28 | ||||
-rw-r--r-- | pages/settings/statistics.php | 28 | ||||
-rw-r--r-- | pages/settings/tools.php | 29 |
17 files changed, 645 insertions, 0 deletions
diff --git a/pages/account/forgotten_password.php b/pages/account/forgotten_password.php new file mode 100644 index 000000000..f464f98c9 --- /dev/null +++ b/pages/account/forgotten_password.php @@ -0,0 +1,27 @@ +<?php +/** + * Assembles and outputs the forgotten password page. + * + * @package Elgg.Core + * @subpackage Registration + */ + +if (elgg_is_logged_in()) { + forward(); +} + +$title = elgg_echo("user:password:lost"); +$content = elgg_view_title($title); + +$content .= elgg_view_form('user/requestnewpassword', array( + 'class' => 'elgg-form-account', +)); + +if (elgg_get_config('walled_garden')) { + elgg_load_css('elgg.walled_garden'); + $body = elgg_view_layout('walled_garden', array('content' => $content)); + echo elgg_view_page($title, $body, 'walled_garden'); +} else { + $body = elgg_view_layout('one_column', array('content' => $content)); + echo elgg_view_page($title, $body); +} diff --git a/pages/account/login.php b/pages/account/login.php new file mode 100644 index 000000000..6aa3752d0 --- /dev/null +++ b/pages/account/login.php @@ -0,0 +1,28 @@ +<?php +/** + * Assembles and outputs a login page. + * + * This page serves as a fallback for non-JS users who click on the login + * drop down link. + * + * If the user is logged in, this page will forward to the front page. + * + * @package Elgg.Core + * @subpackage Accounts + */ + +if (elgg_is_logged_in()) { + forward(''); +} + +$title = elgg_echo('login'); +$content = elgg_view('core/account/login_box'); + +if (elgg_get_config('walled_garden')) { + elgg_load_css('elgg.walled_garden'); + $body = elgg_view_layout('walled_garden', array('content' => $content)); + echo elgg_view_page($title, $body, 'walled_garden'); +} else { + $body = elgg_view_layout('one_column', array('content' => $content)); + echo elgg_view_page($title, $body); +} diff --git a/pages/account/register.php b/pages/account/register.php new file mode 100644 index 000000000..2fe8b74c0 --- /dev/null +++ b/pages/account/register.php @@ -0,0 +1,58 @@ +<?php +/** + * Assembles and outputs the registration page. + * + * Since 1.8, registration can be disabled via administration. If this is + * the case, calls to this page will forward to the network front page. + * + * If the user is logged in, this page will forward to the network + * front page. + * + * @package Elgg.Core + * @subpackage Registration + */ + +// check new registration allowed +if (elgg_get_config('allow_registration') == false) { + register_error(elgg_echo('registerdisabled')); + forward(); +} + +$friend_guid = (int) get_input('friend_guid', 0); +$invitecode = get_input('invitecode'); + +// only logged out people need to register +if (elgg_is_logged_in()) { + forward(); +} + +$title = elgg_echo("register"); + +$content = elgg_view_title($title); + +// create the registration url - including switching to https if configured +$register_url = elgg_get_site_url() . 'action/register'; +if (elgg_get_config('https_login')) { + $register_url = str_replace("http:", "https:", $register_url); +} +$form_params = array( + 'action' => $register_url, + 'class' => 'elgg-form-account', +); + +$body_params = array( + 'friend_guid' => $friend_guid, + 'invitecode' => $invitecode +); +$content .= elgg_view_form('register', $form_params, $body_params); + +$content .= elgg_view('help/register'); + +if (elgg_get_config('walled_garden')) { + elgg_load_css('elgg.walled_garden'); + $body = elgg_view_layout('walled_garden', array('content' => $content)); + echo elgg_view_page($title, $body, 'walled_garden'); +} else { + $body = elgg_view_layout('one_column', array('content' => $content)); + echo elgg_view_page($title, $body); +} diff --git a/pages/account/reset_password.php b/pages/account/reset_password.php new file mode 100644 index 000000000..3ab8ccf3e --- /dev/null +++ b/pages/account/reset_password.php @@ -0,0 +1,40 @@ +<?php +/** + * Page for resetting a forgotten password + * + * @package Elgg.Core + * @subpackage Registration + */ + +if (elgg_is_logged_in()) { + forward(); +} + +$user_guid = get_input('u'); +$code = get_input('c'); + +$user = get_entity($user_guid); + +// don't check code here to avoid automated attacks +if (!$user instanceof ElggUser) { + register_error(elgg_echo('user:passwordreset:unknown_user')); + forward(); +} + +$params = array( + 'guid' => $user_guid, + 'code' => $code, +); +$form = elgg_view_form('user/passwordreset', array('class' => 'elgg-form-account'), $params); + +$title = elgg_echo('resetpassword'); +$content = elgg_view_title(elgg_echo('resetpassword')) . $form; + +if (elgg_get_config('walled_garden')) { + elgg_load_css('elgg.walled_garden'); + $body = elgg_view_layout('walled_garden', array('content' => $content)); + echo elgg_view_page($title, $body, 'walled_garden'); +} else { + $body = elgg_view_layout('one_column', array('content' => $content)); + echo elgg_view_page($title, $body); +} diff --git a/pages/avatar/edit.php b/pages/avatar/edit.php new file mode 100644 index 000000000..56aede887 --- /dev/null +++ b/pages/avatar/edit.php @@ -0,0 +1,32 @@ +<?php +/** + * Upload and crop an avatar page + */ + +// Only logged in users +gatekeeper(); + +elgg_set_context('profile_edit'); + +$title = elgg_echo('avatar:edit'); + +$entity = elgg_get_page_owner_entity(); +if (!elgg_instanceof($entity, 'user') || !$entity->canEdit()) { + register_error(elgg_echo('avatar:noaccess')); + forward(REFERER); +} + +$content = elgg_view('core/avatar/upload', array('entity' => $entity)); + +// only offer the crop view if an avatar has been uploaded +if (isset($entity->icontime)) { + $content .= elgg_view('core/avatar/crop', array('entity' => $entity)); +} + +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/avatar/view.php b/pages/avatar/view.php new file mode 100644 index 000000000..10d81fef1 --- /dev/null +++ b/pages/avatar/view.php @@ -0,0 +1,54 @@ +<?php +/** + * View an avatar + */ + +// page owner library sets this based on URL +$user = elgg_get_page_owner_entity(); + +// Get the size +$size = strtolower(get_input('size')); +if (!in_array($size, array('master', 'large', 'medium', 'small', 'tiny', 'topbar'))) { + $size = 'medium'; +} + +// If user doesn't exist, return default icon +if (!$user) { + $url = "_graphics/icons/default/{$size}.png"; + $url = elgg_normalize_url($url); + forward($url); +} + +$user_guid = $user->getGUID(); + +// Try and get the icon +$filehandler = new ElggFile(); +$filehandler->owner_guid = $user_guid; +$filehandler->setFilename("profile/{$user_guid}{$size}.jpg"); + +$success = false; + +try { + if ($filehandler->open("read")) { + if ($contents = $filehandler->read($filehandler->size())) { + $success = true; + } + } +} catch (InvalidParameterException $e) { + elgg_log("Unable to get avatar for user with GUID $user_guid", 'ERROR'); +} + + +if (!$success) { + $url = "_graphics/icons/default/{$size}.png"; + $url = elgg_normalize_url($url); + forward($url); +} + +header("Content-type: image/jpeg", true); +header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true); +header("Pragma: public", true); +header("Cache-Control: public", true); +header("Content-Length: " . strlen($contents)); + +echo $contents; diff --git a/pages/entities/index.php b/pages/entities/index.php new file mode 100644 index 000000000..e73d65db4 --- /dev/null +++ b/pages/entities/index.php @@ -0,0 +1,56 @@ +<?php +/** + * Generic entity viewer + * Given a GUID, this page will try and display any entity + * + * @package Elgg + * @subpackage Core + */ + + +// Get the GUID of the entity we want to view +$guid = (int) get_input('guid'); +$shell = get_input('shell'); +if ($shell == "no") { + $shell = false; +} else { + $shell = true; +} + +$context = get_input('context'); +if ($context) { + elgg_set_context($context); +} + +// Get the entity, if possible +if ($entity = get_entity($guid)) { + if ($entity->container_guid) { + elgg_set_page_owner_guid($entity->container_guid); + } else { + elgg_set_page_owner_guid($entity->owner_guid); + } + + // Set the body to be the full view of the entity, and the title to be its title + if ($entity instanceof ElggObject) { + $title = $entity->title; + } else if ($entity instanceof ElggEntity) { + $title = $entity->name; + } + $area1 = elgg_view_entity($entity, array('full_view' => true)); + if ($shell) { + $body = elgg_view_layout('one_column', array('content' => $area1)); + } else { + $body = $area1; + } +} else { + $body = elgg_echo('notfound'); +} + +// Display the page +if ($shell) { + echo elgg_view_page($title, $body); +} else { + header("Content-type: text/html; charset=UTF-8"); + echo $title; + echo $body; +}
\ No newline at end of file diff --git a/pages/friends/collections/add.php b/pages/friends/collections/add.php new file mode 100644 index 000000000..60f7586ba --- /dev/null +++ b/pages/friends/collections/add.php @@ -0,0 +1,22 @@ +<?php +/** + * Elgg add a collection of friends + * + * @package Elgg.Core + * @subpackage Social.Collections + */ + +// You need to be logged in for this one +gatekeeper(); + +$title = elgg_echo('friends:collections:add'); + +$content = elgg_view_title($title); + +$content .= elgg_view_form('friends/collections/add', array(), array( + 'friends' => get_user_friends(elgg_get_logged_in_user_guid(), "", 9999), +)); + +$body = elgg_view_layout('one_sidebar', array('content' => $content)); + +echo elgg_view_page(elgg_echo('friends:collections:add'), $body); diff --git a/pages/friends/collections/pickercallback.php b/pages/friends/collections/pickercallback.php new file mode 100644 index 000000000..c6ed61cf0 --- /dev/null +++ b/pages/friends/collections/pickercallback.php @@ -0,0 +1,59 @@ +<?php +/** + * Elgg friends picker callback + * + * @package Elgg.Core + * @subpackage Social.Collections + */ + +// Load Elgg engine +require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"); + +$site_url = elgg_get_site_url(); + +// Get callback type (list or picker) +$type = get_input('type', 'picker'); + +$collection = (int) get_input('collection', 0); +$members = get_members_of_access_collection($collection, true); +if (!$members) { + $members = array(); +} + +$friendspicker = (int) get_input('friendspicker', 0); + +// Get page owner (bomb out if there isn't one) +$pageowner = elgg_get_page_owner_entity(); +if (!$pageowner) { + forward(); + exit; +} + +// Depending on the view type, launch a different view +switch($type) { + case 'list': + $js_segment = elgg_view('core/friends/tablelistcountupdate', array( + 'friendspicker' => $friendspicker, + 'count' => sizeof($members), + )); + $content = elgg_view('core/friends/tablelist', array( + 'entities' => $members, + 'content' => $js_segment, + )); + break; + default: + $friends = $pageowner->getFriends('', 9999); + + $content = elgg_view('input/friendspicker', array( + 'entities' => $friends, + 'value' => $members, + 'callback' => true, + 'friendspicker' => $friendspicker, + 'collection_id' => $collection, + 'formtarget' => $site_url . 'action/friends/collections/edit', + )); + break; +} + +// Output the content +echo $content;
\ No newline at end of file diff --git a/pages/friends/collections/view.php b/pages/friends/collections/view.php new file mode 100644 index 000000000..0d72fe788 --- /dev/null +++ b/pages/friends/collections/view.php @@ -0,0 +1,21 @@ +<?php +/** + * Elgg collections of friends + * + * @package Elgg.Core + * @subpackage Social.Collections + */ + +$title = elgg_echo('friends:collections'); +elgg_register_title_button('collections', 'add'); + +$content = elgg_view_access_collections(elgg_get_logged_in_user_guid()); + +$body = elgg_view_layout('content', array( + 'filter' => false, + 'content' => $content, + 'title' => $title, + 'context' => 'collections', +)); + +echo elgg_view_page($title, $body); diff --git a/pages/friends/index.php b/pages/friends/index.php new file mode 100644 index 000000000..63518a413 --- /dev/null +++ b/pages/friends/index.php @@ -0,0 +1,35 @@ +<?php +/** + * Elgg friends page + * + * @package Elgg.Core + * @subpackage Social.Friends + */ + +$owner = elgg_get_page_owner_entity(); +if (!$owner) { + // unknown user so send away (@todo some sort of 404 error) + forward(); +} + +$title = elgg_echo("friends:owned", array($owner->name)); + +$options = array( + 'relationship' => 'friend', + 'relationship_guid' => $owner->getGUID(), + 'inverse_relationship' => FALSE, + 'type' => 'user', + 'full_view' => FALSE +); +$content = elgg_list_entities_from_relationship($options); +if (!$content) { + $content = elgg_echo('friends:none'); +} + +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/friends/of.php b/pages/friends/of.php new file mode 100644 index 000000000..aa9ee8bee --- /dev/null +++ b/pages/friends/of.php @@ -0,0 +1,35 @@ +<?php +/** + * Elgg friends of page + * + * @package Elgg.Core + * @subpackage Social.Friends + */ + +$owner = elgg_get_page_owner_entity(); +if (!$owner) { + // unknown user so send away (@todo some sort of 404 error) + forward(); +} + +$title = elgg_echo("friends:of:owned", array($owner->name)); + +$options = array( + 'relationship' => 'friend', + 'relationship_guid' => $owner->getGUID(), + 'inverse_relationship' => TRUE, + 'type' => 'user', + 'full_view' => FALSE +); +$content = elgg_list_entities_from_relationship($options); +if (!$content) { + $content = elgg_echo('friends:none'); +} + +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/profile/edit.php b/pages/profile/edit.php new file mode 100644 index 000000000..0ffb8783f --- /dev/null +++ b/pages/profile/edit.php @@ -0,0 +1,32 @@ +<?php +/** + * Edit profile page + */ + +gatekeeper(); + +$user = elgg_get_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(); +} + +elgg_set_context('profile_edit'); + +$title = elgg_echo('profile:edit'); + +$content = elgg_view_form('profile/edit', array(), array('entity' => $user)); + +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/river.php b/pages/river.php new file mode 100644 index 000000000..801d9f664 --- /dev/null +++ b/pages/river.php @@ -0,0 +1,61 @@ +<?php +/** + * Main activity stream list page + */ + +$options = array(); + +$page_type = preg_replace('[\W]', '', get_input('page_type', 'all')); +$type = preg_replace('[\W]', '', get_input('type', 'all')); +$subtype = preg_replace('[\W]', '', get_input('subtype', '')); +if ($subtype) { + $selector = "type=$type&subtype=$subtype"; +} else { + $selector = "type=$type"; +} + +if ($type != 'all') { + $options['type'] = $type; + if ($subtype) { + $options['subtype'] = $subtype; + } +} + +switch ($page_type) { + case 'mine': + $title = elgg_echo('river:mine'); + $page_filter = 'mine'; + $options['subject_guid'] = elgg_get_logged_in_user_guid(); + break; + case 'friends': + $title = elgg_echo('river:friends'); + $page_filter = 'friends'; + $options['relationship_guid'] = elgg_get_logged_in_user_guid(); + $options['relationship'] = 'friend'; + break; + default: + $title = elgg_echo('river:all'); + $page_filter = 'all'; + break; +} + +$activity = elgg_list_river($options); +if (!$activity) { + $activity = elgg_echo('river:none'); +} + +$content = elgg_view('core/river/filter', array('selector' => $selector)); + +$sidebar = elgg_view('core/river/sidebar'); + +$params = array( + 'title' => $title, + 'content' => $content . $activity, + 'sidebar' => $sidebar, + 'filter_context' => $page_filter, + 'class' => 'elgg-river-layout', +); + +$body = elgg_view_layout('content', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/settings/account.php b/pages/settings/account.php new file mode 100644 index 000000000..962e1fc37 --- /dev/null +++ b/pages/settings/account.php @@ -0,0 +1,28 @@ +<?php +/** + * Elgg user account settings. + * + * @package Elgg + * @subpackage Core + */ + +// Only logged in users +gatekeeper(); + +// Make sure we don't open a security hole ... +if ((!elgg_get_page_owner_entity()) || (!elgg_get_page_owner_entity()->canEdit())) { + register_error(elgg_echo('noaccess')); + forward('/'); +} + +$title = elgg_echo('usersettings:user'); + +$content = elgg_view('core/settings/account'); + +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/settings/statistics.php b/pages/settings/statistics.php new file mode 100644 index 000000000..9dcc9211d --- /dev/null +++ b/pages/settings/statistics.php @@ -0,0 +1,28 @@ +<?php +/** + * Elgg user statistics. + * + * @package Elgg + * @subpackage Core + */ + +// Only logged in users +gatekeeper(); + +// Make sure we don't open a security hole ... +if ((!elgg_get_page_owner_entity()) || (!elgg_get_page_owner_entity()->canEdit())) { + register_error(elgg_echo('noaccess')); + forward('/'); +} + +$title = elgg_echo("usersettings:statistics"); + +$content = elgg_view("core/settings/statistics"); + +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/settings/tools.php b/pages/settings/tools.php new file mode 100644 index 000000000..ed6b941c0 --- /dev/null +++ b/pages/settings/tools.php @@ -0,0 +1,29 @@ +<?php +/** + * Elgg user tools settings + * + * @package Elgg + * @subpackage Core + */ + +// Only logged in users +gatekeeper(); + +// Make sure we don't open a security hole ... +if ((!elgg_get_page_owner_entity()) || (!elgg_get_page_owner_entity()->canEdit())) { + register_error(elgg_echo('noaccess')); + forward('/'); +} + +$title = elgg_echo("usersettings:plugins"); + +$content = elgg_view("core/settings/tools", + array('installed_plugins' => elgg_get_plugins())); + +$params = array( + 'content' => $content, + 'title' => $title, +); +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); |