aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/account/forgotten_password.php27
-rw-r--r--pages/account/login.php28
-rw-r--r--pages/account/register.php58
-rw-r--r--pages/account/reset_password.php40
-rw-r--r--pages/admin.php21
-rw-r--r--pages/avatar/edit.php32
-rw-r--r--pages/avatar/view.php54
-rw-r--r--pages/download.php50
-rw-r--r--pages/edit.php54
-rw-r--r--pages/edit_multiple.php45
-rw-r--r--pages/entities/index.php56
-rw-r--r--pages/flickr/importPhotosets.php50
-rw-r--r--pages/flickr/setup.php17
-rw-r--r--pages/friends.php41
-rw-r--r--pages/friends/collections/add.php22
-rw-r--r--pages/friends/collections/pickercallback.php59
-rw-r--r--pages/friends/collections/view.php21
-rw-r--r--pages/friends/index.php35
-rw-r--r--pages/friends/of.php35
-rw-r--r--pages/lists/flickr.php60
-rw-r--r--pages/lists/highestrated.php65
-rw-r--r--pages/lists/highestvotecount.php50
-rw-r--r--pages/lists/mostcommentedimages.php42
-rw-r--r--pages/lists/mostcommentedimagesthismonth.php50
-rw-r--r--pages/lists/mostcommentedimagestoday.php50
-rw-r--r--pages/lists/mostrecentimages.php58
-rw-r--r--pages/lists/mostviewedimages.php87
-rw-r--r--pages/lists/mostviewedimageslastmonth.php50
-rw-r--r--pages/lists/mostviewedimagesthismonth.php50
-rw-r--r--pages/lists/mostviewedimagesthisyear.php50
-rw-r--r--pages/lists/mostviewedimagestoday.php50
-rw-r--r--pages/lists/recentlycommented.php69
-rw-r--r--pages/lists/recentlyviewed.php68
-rw-r--r--pages/lists/recentvotes.php52
-rw-r--r--pages/newalbum.php30
-rw-r--r--pages/ownedalbums.php55
-rw-r--r--pages/profile/edit.php32
-rw-r--r--pages/river.php61
-rw-r--r--pages/server_analysis.php138
-rw-r--r--pages/settings/account.php28
-rw-r--r--pages/settings/statistics.php28
-rw-r--r--pages/settings/tools.php29
-rw-r--r--pages/tagged.php48
-rw-r--r--pages/thumbnail.php78
-rw-r--r--pages/upload.php48
-rw-r--r--pages/viewalbum.php72
-rw-r--r--pages/viewimage.php62
-rw-r--r--pages/world.php28
48 files changed, 645 insertions, 1688 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/admin.php b/pages/admin.php
deleted file mode 100644
index 4013e55ac..000000000
--- a/pages/admin.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-/******************************************************************
- *
- * Tidypics Admin Settings
- *
- *******************************************************************/
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-global $CONFIG;
-
-admin_gatekeeper();
-set_context('admin');
-
-$tab = get_input('tab', 'settings');
-
-$body = elgg_view_title(elgg_echo('tidypics:administration'));
-
-$body .= elgg_view("tidypics/admin/tidypics", array('tab' => $tab));
-
-page_draw(elgg_echo('tidypics:administration'), elgg_view_layout("two_column_left_sidebar", '', $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/download.php b/pages/download.php
deleted file mode 100644
index 23c3e39f4..000000000
--- a/pages/download.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * Tidypics Download Photos
- *
- * do not call this directly - call through page handler
- */
-
-global $CONFIG;
-
-$file_guid = (int) get_input("file_guid");
-$file = get_entity($file_guid);
-
-$type = get_input("type");
-
-if ($file) {
- $filename = $file->originalfilename;
- $mime = $file->mimetype;
-
- header("Content-Type: $mime");
- if ($type == "inline") {
- header("Content-Disposition: inline; filename=\"$filename\"");
- } else {
- header("Content-Disposition: attachment; filename=\"$filename\"");
- }
-
- $readfile = new ElggFile($file_guid);
- $readfile->owner_guid = $file->owner_guid;
-
- $contents = $readfile->grabFile();
-
- if (empty($contents)) {
- echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
- } else {
-
- // expires every 60 days
- $expires = 60 * 60*60*24;
-
- header("Content-Length: " . strlen($contents));
- header("Cache-Control: public", true);
- header("Pragma: public", true);
- header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
-
- echo $contents;
- }
-
- exit;
-} else {
- register_error(elgg_echo("image:downloadfailed"));
-} \ No newline at end of file
diff --git a/pages/edit.php b/pages/edit.php
deleted file mode 100644
index 06d3dd9c4..000000000
--- a/pages/edit.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Tidypics Edit for Albums and Single Photos
- *
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// make sure the user is logged_in
-gatekeeper();
-
-set_context('photos');
-$guid = (int) get_input('guid');
-
-if (!$entity = get_entity($guid)) {
- forward();
-}
-
-if (!$entity->canEdit()) {
- forward();
-}
-
-$subtype = $entity->getSubtype();
-
-if ($subtype == 'album') {
- $title = elgg_echo('album:edit');
-
- if ($container = $entity->container_guid) {
- set_page_owner($container);
- }
-
-} else if ($subtype == 'image') {
- $title = elgg_echo('image:edit');
-
- if ($container = get_entity($entity->container_guid)->container_guid) {
- set_page_owner($container);
- }
-
-} else {
- forward();
-}
-
-$page_owner = page_owner_entity();
-if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
-}
-
-
-$area2 .= elgg_view_title($title);
-$area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype));
-$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
-
-page_draw($title, $body);
diff --git a/pages/edit_multiple.php b/pages/edit_multiple.php
deleted file mode 100644
index 938ac203c..000000000
--- a/pages/edit_multiple.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * Tidypics: Edit the properties of multiple images
- *
- * Called after upload only
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-gatekeeper();
-set_context('photos');
-
-set_page_owner(get_loggedin_userid());
-
-
-$batch = get_input('batch');
-if ($batch) {
- $images = get_entities_from_metadata('batch', $batch, 'object', 'image', get_loggedin_userid(), 100);
-} else {
- // parse out photo guids
- $file_string = get_input('files');
- $file_array_sent = explode('-', $file_string);
-
- $images = array();
- foreach ($file_array_sent as $file_guid) {
- if ($entity = get_entity($file_guid)) {
- if ($entity->canEdit()) {
- array_push($images, $entity);
- }
- }
- }
-}
-
-if (!$images) {
- forward($_SERVER['HTTP_REFERER']);
-}
-
-
-$title = elgg_echo('tidypics:editprops');
-
-$content .= elgg_view_title($title);
-$content .= elgg_view("tidypics/forms/edit_multi", array('images' => $images));
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $content);
-page_draw($title, $body);
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/flickr/importPhotosets.php b/pages/flickr/importPhotosets.php
deleted file mode 100644
index a807a0782..000000000
--- a/pages/flickr/importPhotosets.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
- /**
- * Import a set of photos from Flickr
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
- $body = elgg_view_title( elgg_echo( 'flickr:importmanager' ));
- $body .= "<h2>" . elgg_echo( 'flickr:desc' ) . "</h2>";
-
- $viewer = get_loggedin_user();
-
- require_once dirname(dirname(dirname(__FILE__))) . "/lib/phpFlickr/phpFlickr.php";
- require_once( dirname(dirname(dirname(__FILE__)))) . "/lib/flickr.php";
- $f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
-
- $viewer = get_loggedin_user();
- $flickr_username = get_metadata_byname( $viewer->guid, "flickr_username" );
- $flickr_id = get_metadata_byname( $viewer->guid, "flickr_id" );
- $album_id = get_metadata_byname( $viewer->guid, "flickr_album_id" );
-
- if( intval( $album_id->value ) <= 0 ) {
- register_error( sprintf( elgg_echo( 'flickr:errornoalbum' ), $album_id->value ));
- forward( "/mod/tidypics/pages/flickr/setup.php" );
- }
-
- $photosets = $f->photosets_getList( $flickr_id->value );
- foreach( $photosets["photoset"] as $photoset ) {
- $body .= "<div class='tidypics_album_images'>";
- $body .= "$photoset[title]<br />";
-
- $count = 0;
- $looper = 0;
- //create links to import photos 10 at a time
- while( $photoset["photos"] > $count ) {
- $looper++;
- $body .= " <a href='/mod/tidypics/actions/flickrImportPhotoset.php?set_id=$photoset[id]&page=$looper&album_id=$album_id->value'>$looper</a>";
- $count = $count + 10;
- }
- $body .= "<br />$photoset[photos] images";
- $body .= "</div>";
-// echo "<pre>"; var_dump( $photoset ); echo "</pre>"; die;
- }
-
-// $body .= elgg_view("tidypics/forms/setupFlickr", array(), false, true );
- flickr_menu();
- page_draw( elgg_echo( 'flickr:importmanager' ), elgg_view_layout("two_column_left_sidebar", '', $body));
-
-?> \ No newline at end of file
diff --git a/pages/flickr/setup.php b/pages/flickr/setup.php
deleted file mode 100644
index 1de8c29c2..000000000
--- a/pages/flickr/setup.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
- /**
- * Setup a users Flickr username
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- $viewer = get_loggedin_user();
-
- $body = elgg_view_title( elgg_echo( 'flickr:setup') );
- $body .= elgg_view("tidypics/forms/setupFlickr", array(), false, true );
-// echo "<pre>"; var_dump($body); echo "</pre>";
- page_draw( elgg_echo( 'flickr:setup'), elgg_view_layout("two_column_left_sidebar", '', $body));
-?> \ No newline at end of file
diff --git a/pages/friends.php b/pages/friends.php
deleted file mode 100644
index d5dfdba5c..000000000
--- a/pages/friends.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Tidypics Friends Albums Listing
- *
- * List all the albums of someone's friends
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-$username = get_input('username');
-
-// if no username, redirect to world photo albums
-if (!$username) {
- forward('pg/photos/world');
-}
-
-// setup title
-$user = get_user_by_username($username);
-if (!$user) {
- forward('pg/photos/world');
-}
-if ($user->guid == get_loggedin_userid()) {
- $title = elgg_echo('album:yours:friends');
-} else {
- $title = sprintf(elgg_echo('album:friends'), $user->name);
-}
-
-$area2 = elgg_view_title($title);
-
-$albums = get_user_friends_objects($user->guid, 'album', 12);
-
-// get html for viewing list of photo albums
-set_context('search');
-set_input('search_viewtype', 'gallery'); // need to force gallery view
-$content = tp_view_entity_list($albums, count($albums), 0, 12, false, false, true);
-
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($title, $body);
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/lists/flickr.php b/pages/lists/flickr.php
deleted file mode 100644
index b9886042b..000000000
--- a/pages/lists/flickr.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-require_once dirname(dirname(dirname(__FILE__))) . "/lib/phpFlickr/phpFlickr.php";
-$f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-$username = get_input('username');
-if( !empty( $username )) {
- $temp_user = get_user_by_username( $username );
-} else {
- $temp_user = get_loggedin_user();
-}
-$flickr_username = get_metadata_byname( $temp_user->guid, "flickr_username" );
-if( empty( $flickr_username )) {
- register_error( "No Flickr username set");
- echo "<pre>No flickr username set: $temp_user->guid"; die;
- forward( "/" );
- die;
-}
-$flickr_user = $f->people_findByUsername( $flickr_username->value );
-
-// Get the friendly URL of the user's photos
-$photos_url = $f->urls_getUserPhotos( $flickr_user["id"] );
-
-if( !empty( $flickr_user )) {
- $recent = $f->people_getPublicPhotos( $flickr_user['id'], NULL, NULL, 5 );
-} else {
- echo "user not found"; die;
-}
-//echo "<pre>"; var_dump( $recent ); echo "</pre>";
-
-//echo "<pre>"; var_dump( $user ); echo "</pre>";
-$body = elgg_view_title( "Flickr photos for $flickr_user[username]" );
-
-$count = 0;
-foreach ($recent['photos']['photo'] as $photo) {
-
- $photo_info = $f->photos_getInfo( $photo["id"], $photo["secret"] );
- $body .= "<div class='tidypics_album_images'>";
- $body .= "$photo_info[title]<br />Views: $photo_info[views]<br />";
- $body .= "<a href=$photos_url$photo[id]>";
- $body .= "<img border='0' alt='$photo[title]' ".
- "src=" . $f->buildPhotoURL($photo, "Square") . ">";
- $body .= "</a>";
-
- $tag_count = 0;
- $body .= "<br /><div style='font-size: 8px;'>Tags:<br />";
- foreach( $photo_info["tags"]["tag"] as $tag ) {
- if( $tag_count ) $body .= ", ";
- $body .= "$tag[_content]";
- $tag_count++;
- }
-
- $body .= "</div></div>";
- $count++;
-}
-page_draw( "Flickr photos for $flickr_user[username]", elgg_view_layout("two_column_left_sidebar", '', $body));
-
-?> \ No newline at end of file
diff --git a/pages/lists/highestrated.php b/pages/lists/highestrated.php
deleted file mode 100644
index e05e7a9ba..000000000
--- a/pages/lists/highestrated.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
- /**
- * Tidypics Friends Albums Listing
- *
- */
-
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- //if no friends were requested, see world pictures instead, or redirect to user's friends
-/* if (is_null(get_input('username')) || get_input('username')=='') {
- if (!isloggedin()) {
- forward('pg/photos/world');
- } else {
- forward('pg/photos/friends/' . $_SESSION['user']->username);
- }
- }*/
-
-// if (is_null(page_owner_entity()->name) || page_owner_entity()->name == '') {
-// $groupname = get_input('username');
-// } else {
-// $groupname = page_owner_entity()->name;
-// };
-//
- //there has to be a better way to do this
- if(!$groupname) {
- $page = get_input("page");
- list($pagename, $groupname) = split("/", $page);
- }
-
- list($group_holder, $album_id) = split(":", $groupname);
-// echo "<pre>page: $page\ngroup: $groupname\nalbum: $album_id"; die;
-
- $user = get_user_by_username($friendname);
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
- $sql = "SELECT ent.guid, count(1) as mycount, avg(ms2.string) as average
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image' AND ent.container_guid = $album_id
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'generic_rate'
- INNER JOIN " . $prefix . "metastrings ms2 ON ms2.id = ann1.value_id
- INNER JOIN " . $prefix . "users_entity u ON ann1.owner_guid = u.guid
- GROUP BY ent.guid HAVING mycount > 1
- ORDER BY average DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-
- $album = get_entity($album_id);
- $title = $album["title"] . ": " . elgg_echo("tidypics:highestrated");
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-
-?> \ No newline at end of file
diff --git a/pages/lists/highestvotecount.php b/pages/lists/highestvotecount.php
deleted file mode 100644
index 26b907144..000000000
--- a/pages/lists/highestvotecount.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
- $sql = "SELECT ent.guid, u.name as owner, count( 1 ) AS mycount, avg( ms2.string ) AS average
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'generic_rate'
- INNER JOIN " . $prefix . "metastrings ms2 ON ms2.id = ann1.value_id
- INNER JOIN " . $prefix . "users_entity u ON ent.owner_guid = u.guid
- GROUP BY ent.guid
- ORDER BY mycount DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $title = "Most voted images";
- $area2 = elgg_view_title($title);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- $full_entity = get_entity($entity->guid);
- $area2 .= " <div class='tidypics_album_images'>
- Owner: $entity->owner<br />
- Votes: $entity->mycount<br />
- Average: $entity->average
- </div>
- ";
- $area2 .= elgg_view_entity($full_entity);
-
- }
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
diff --git a/pages/lists/mostcommentedimages.php b/pages/lists/mostcommentedimages.php
deleted file mode 100644
index 0a4eb9622..000000000
--- a/pages/lists/mostcommentedimages.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
-global $CONFIG;
-$prefix = $CONFIG->dbprefix;
-$max = 24;
-
-//this works but is wildly inefficient
-//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
-$sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'generic_comment'
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
-$result = get_data($sql);
-
-$entities = array();
-foreach ($result as $entity) {
- $entities[] = get_entity($entity->guid);
-}
-
-tidypics_mostviewed_submenus();
-$title = elgg_echo("tidypics:mostcommented");
-$area2 = elgg_view_title($title);
-$area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-page_draw($title, $body); \ No newline at end of file
diff --git a/pages/lists/mostcommentedimagesthismonth.php b/pages/lists/mostcommentedimagesthismonth.php
deleted file mode 100644
index d95e2aff5..000000000
--- a/pages/lists/mostcommentedimagesthismonth.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
-
- //find timestamps for first and last days of this month
- $time_info = new stdClass();
- $time_info->start = mktime(0,0,0, date("m"), 1, date("Y"));
- $time_info->end = mktime();
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'generic_comment'
- WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-
- tidypics_mostviewed_submenus();
- $title = elgg_echo("tidypics:mostcommentedthismonth");
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
diff --git a/pages/lists/mostcommentedimagestoday.php b/pages/lists/mostcommentedimagestoday.php
deleted file mode 100644
index bd1a0cbec..000000000
--- a/pages/lists/mostcommentedimagestoday.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
-
- //find timestamps for today
- $time_info = new stdClass();
- $time_info->start = mktime(0,0,0, date("m"), date("d"), date("Y"));
- $time_info->end = mktime();
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'generic_comment'
- WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-
- tidypics_mostviewed_submenus();
- $title = elgg_echo("tidypics:mostcommentedtoday");
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
diff --git a/pages/lists/mostrecentimages.php b/pages/lists/mostrecentimages.php
deleted file mode 100644
index 722f1fc32..000000000
--- a/pages/lists/mostrecentimages.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * Most recently uploaded images - individual or world
- *
- */
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
-// start with assumption this is for all site photos
-$title = elgg_echo('tidypics:mostrecent');
-$user_id = 0;
-
-// is this all site or an individuals images
-$username = get_input('username');
-if ($username) {
- $user = get_user_by_username($username);
- if ($user) {
- $user_id = $user->guid;
-
- if ($user_id == get_loggedin_userid()) {
- $title = elgg_echo('tidypics:yourmostrecent');
- } else {
- $title = sprintf(elgg_echo("tidypics:friendmostrecent"), $user->name);
- }
- }
-} else {
- // world view - set page owner to logged in user
- if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
- }
-}
-
-// allow other plugins to override the slideshow
-$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
-if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
-}
-
-// how many do we display
-$max = 12;
-
-// grab the html to display the images
-$images = tp_list_entities("object", "image", $user_id, null, $max, false, false, true);
-
-
-// this view takes care of the title on the main column and the content wrapper
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,));
-if (empty($area2)) {
- $area2 = $images;
-}
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($title, $body);
diff --git a/pages/lists/mostviewedimages.php b/pages/lists/mostviewedimages.php
deleted file mode 100644
index eb87bc17c..000000000
--- a/pages/lists/mostviewedimages.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-/**
- * Most viewed images - either for a user or all site
- *
- */
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
-global $CONFIG;
-$prefix = $CONFIG->dbprefix;
-$max = 24;
-
-$owner_guid = page_owner();
-
-//$start = microtime(true);
-$photos = tp_get_entities_from_annotations_calculate_x(
- 'count',
- 'object',
- 'image',
- 'tp_view',
- '',
- '',
- $owner_guid,
- $max);
-//error_log("elgg query is " . (float)(microtime(true) - $start));
-
-//this works but is wildly inefficient
-//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-/*
- $start = microtime(true);
- $sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'tp_view'
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-*/
-//error_log("custom query is " . (float)(microtime(true) - $start));
-
-// allow other plugins to override the slideshow
-$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
-if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
-}
-
-if ($owner_guid) {
- if ($owner_guid == get_loggedin_userid()) {
- $title = elgg_echo("tidypics:yourmostviewed");
- } else {
- $title = sprintf(elgg_echo("tidypics:friendmostviewed"), page_owner_entity()->name);
- }
-} else {
- // world view - set page owner to logged in user
- if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
- }
-
- $title = elgg_echo("tidypics:mostviewed");
-}
-$area2 = elgg_view_title($title);
-
-// grab the html to display the images
-$content = tp_view_entity_list($photos, $max, 0, $max, false);
-
-// this view takes care of the title on the main column and the content wrapper
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-if (empty($area2)) {
- $area2 = $content;
-}
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-page_draw($title, $body);
diff --git a/pages/lists/mostviewedimageslastmonth.php b/pages/lists/mostviewedimageslastmonth.php
deleted file mode 100644
index 1ed9161f7..000000000
--- a/pages/lists/mostviewedimageslastmonth.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
-
- //find timestamps for first and last days of last month
- $time_info = new stdClass();
- $time_info->start = strtotime("-1 months", mktime(0,0,0, date("m"), 1, date("Y")));
- $time_info->end = mktime(0,0,0,date("m"), 0, date("Y"));
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'tp_view'
- WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-
- tidypics_mostviewed_submenus();
- $title = elgg_echo("tidypics:mostviewedlastmonth");
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
diff --git a/pages/lists/mostviewedimagesthismonth.php b/pages/lists/mostviewedimagesthismonth.php
deleted file mode 100644
index bfe08e1da..000000000
--- a/pages/lists/mostviewedimagesthismonth.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
-
- //find timestamps for first and last days of this month
- $time_info = new stdClass();
- $time_info->start = mktime(0,0,0, date("m"), 1, date("Y"));
- $time_info->end = mktime();
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'tp_view'
- WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-
- tidypics_mostviewed_submenus();
- $title = elgg_echo("tidypics:mostviewedthismonth");
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
diff --git a/pages/lists/mostviewedimagesthisyear.php b/pages/lists/mostviewedimagesthisyear.php
deleted file mode 100644
index fe1a63d38..000000000
--- a/pages/lists/mostviewedimagesthisyear.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
-
- //find timestamps for first day of the year and current date
- $time_info = new stdClass();
- $time_info->start = mktime(0,0,0, 1, 1, date("Y"));
- $time_info->end = mktime();
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'tp_view'
- WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-
- tidypics_mostviewed_submenus();
- $title = elgg_echo("tidypics:mostviewedthisyear");
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
diff --git a/pages/lists/mostviewedimagestoday.php b/pages/lists/mostviewedimagestoday.php
deleted file mode 100644
index f8e844753..000000000
--- a/pages/lists/mostviewedimagestoday.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
-
- //find timestamps for today
- $time_info = new stdClass();
- $time_info->start = mktime(0,0,0, date("m"), date("d"), date("Y"));
- $time_info->end = mktime();
-
- //this works but is wildly inefficient
- //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
- $sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'tp_view'
- WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- }
-
- tidypics_mostviewed_submenus();
- $title = elgg_echo("tidypics:mostviewedtoday");
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity_list($entities, $max, 0, $max, false);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
diff --git a/pages/lists/recentlycommented.php b/pages/lists/recentlycommented.php
deleted file mode 100644
index f070e8563..000000000
--- a/pages/lists/recentlycommented.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/**
- * Images recently commented on - world view only
- *
- */
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
-// world view - set page owner to logged in user
-if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
-}
-
-// allow other plugins to override the slideshow
-$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
-if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
-}
-
-
-global $CONFIG;
-$prefix = $CONFIG->dbprefix;
-$max_limit = 200; //get extra because you'll have multiple views per image in the result set
-$max = 16; //controls how many actually show on screen
-
-//this works but is wildly inefficient
-//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
-$sql = "SELECT distinct (ent.guid), ann1.time_created
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'generic_comment'
- ORDER BY ann1.time_created DESC
- LIMIT $max_limit";
-
-$result = get_data($sql);
-
-$entities = array();
-foreach ($result as $entity) {
- if (!$entities[$entity->guid]) {
- $entities[$entity->guid] = get_entity($entity->guid);
- }
- if (count($entities) >= $max) {
- break;
- }
-}
-
-$user = get_loggedin_user();
-$title = elgg_echo("tidypics:recentlycommented");
-$area2 = elgg_view_title($title);
-
-// grab the html to display the images
-$images = tp_view_entity_list($entities, $max, 0, $max, false);
-
-// this view takes care of the title on the main column and the content wrapper
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,));
-if (empty($area2)) {
- $area2 = $images;
-}
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-page_draw($title, $body);
diff --git a/pages/lists/recentlyviewed.php b/pages/lists/recentlyviewed.php
deleted file mode 100644
index 419576d8e..000000000
--- a/pages/lists/recentlyviewed.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * Most recently viewed images - world view only right now
- *
- */
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
-// world view - set page owner to logged in user
-if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
-}
-
-// allow other plugins to override the slideshow
-$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null);
-if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
-}
-
-
-global $CONFIG;
-$prefix = $CONFIG->dbprefix;
-$max_limit = 200; //get extra because you'll have multiple views per image in the result set
-$max = 16; //controls how many actually show on screen
-
-//this works but is wildly inefficient
-//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
-$sql = "SELECT distinct ent.guid, ann1.time_created
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'tp_view'
- ORDER BY ann1.id DESC
- LIMIT $max_limit";
-
-$result = get_data($sql);
-
-$entities = array();
-foreach ($result as $entity) {
- if (!$entities[$entity->guid]) {
- $entities[$entity->guid] = get_entity($entity->guid);
- }
- if (count($entities) >= $max) {
- break;
- }
-}
-
-$title = elgg_echo("tidypics:recentlyviewed");
-$area2 = elgg_view_title($title);
-
-// grab the html to display the images
-$images = tp_view_entity_list($entities, $max, 0, $max, false);
-
-// this view takes care of the title on the main column and the content wrapper
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,));
-if (empty($area2)) {
- $area2 = $images;
-}
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-page_draw($title, $body);
diff --git a/pages/lists/recentvotes.php b/pages/lists/recentvotes.php
deleted file mode 100644
index 3d8eac97e..000000000
--- a/pages/lists/recentvotes.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
- /**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
- // Load Elgg engine
- include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-
- global $CONFIG;
- $prefix = $CONFIG->dbprefix;
- $max = 24;
-
- $sql = "SELECT ent.guid, u2.name AS owner, u.name AS voter, ms2.string as vote
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'generic_rate'
- INNER JOIN " . $prefix . "metastrings ms2 ON ms2.id = ann1.value_id
- INNER JOIN " . $prefix . "users_entity u ON ann1.owner_guid = u.guid
- INNER JOIN " . $prefix . "users_entity u2 ON ent.owner_guid = u2.guid
- ORDER BY ann1.time_created DESC
- LIMIT $max";
-
- $result = get_data($sql);
-
- $title = "Recently rated images";
- $area2 = elgg_view_title($title);
-
- $entities = array();
- foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
- $full_entity = get_entity($entity->guid);
- $area2 .= " <div class='tidypics_album_images'>
- Owner: $entity->owner<br />
- Voter: $entity->voter<br />
- Rating: $entity->vote
- </div>
- ";
- $area2 .= elgg_view_entity($full_entity);
-
- }
-
-
-// $area2 .= elgg_view_entity_list($entities, $max, 0, $max);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
- page_draw($title, $body);
-?> \ No newline at end of file
diff --git a/pages/newalbum.php b/pages/newalbum.php
deleted file mode 100644
index 535116237..000000000
--- a/pages/newalbum.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * Tidypics Create New Album Page
- *
- */
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// must be logged in to create a new album
-gatekeeper();
-
-// Get the current page's owner
-$page_owner = page_owner_entity();
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = get_loggedin_user();
- set_page_owner($page_owner->guid);
-}
-
-if ($page_owner instanceof ElggGroup) {
- add_submenu_item(sprintf(elgg_echo('album:group'), $page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
-}
-
-$area2 = elgg_view_title(elgg_echo('album:add'));
-$area2 .= elgg_view("tidypics/forms/edit");
-
-// Display page
-page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", '', $area2));
diff --git a/pages/ownedalbums.php b/pages/ownedalbums.php
deleted file mode 100644
index 67583c65c..000000000
--- a/pages/ownedalbums.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/**
- * tidypics photo gallery album listing page for a person/group
- *
- * Shows all the albums that belong to that person or group
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// if this page belongs to a closed group, prevent anyone outside group from seeing
-if (is_callable('group_gatekeeper')) {
- group_gatekeeper();
-}
-
-//get the owner of the current page
-$owner = page_owner_entity();
-
-
-//if page owner cannot be found, forward to world album list
-if (is_null($owner->username) || empty($owner->username)) {
- forward('pg/photos/world');
-}
-
-
-// setup group menu for album index
-if ($owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
- if (can_write_to_container(0, $owner->guid)) {
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
- 'tidypics');
- }
-}
-
-//set the title
-$title = sprintf(elgg_echo('album:user'), $owner->name);
-$area2 = elgg_view_title($title);
-
-// Get objects
-set_context('search');
-set_input('search_viewtype', 'gallery');
-if ($owner instanceof ElggGroup) {
- $content .= tp_list_entities("object", "album", 0, $owner->guid, 12, false);
-} else {
- $content .= tp_list_entities("object", "album", $owner->guid, $owner->guid, 12, false);
-}
-
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
-set_context('photos');
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-// Finally draw the page
-page_draw($title, $body); \ No newline at end of file
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/server_analysis.php b/pages/server_analysis.php
deleted file mode 100644
index db3aed5f6..000000000
--- a/pages/server_analysis.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-
-/********************************************************************
- *
- * Tidypics System Analysis Script
- *
- * Helps admins configure their server
- *
- ********************************************************************/
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-global $CONFIG;
-
-admin_gatekeeper();
-
-set_context('admin');
-
-$title = 'TidyPics Server Analysis';
-
-
-function tp_readable_size($bytes) {
- if (strpos($bytes, 'M')) {
- return $bytes . 'B';
- }
-
- $size = $bytes / 1024;
- if ($size < 1024) {
- $size = number_format($size, 2);
- $size .= ' KB';
- } else {
- $size = $size / 1024;
- if ($size < 1024) {
- $size = number_format($size, 2);
- $size .= ' MB';
- } else {
- $size = $size / 1024;
- $size = number_format($size, 2);
- $size .= ' GB';
- }
- }
- return $size;
-}
-
-$disablefunc = explode(',', ini_get('disable_functions'));
-$exec_avail = "Disabled";
-if (is_callable('exec') && !in_array('exec',$disablefunc)) {
- $exec_avail = "Enabled";
-}
-
-ob_start();
-
-echo elgg_view_title($title);
-?>
-<div class="contentWrapper">
- <table width="100%">
- <tr>
- <td>PHP version</td>
- <td><?php echo phpversion(); ?></td>
- <td></td>
- </tr>
- <tr>
- <td>GD</td>
- <td><?php echo (extension_loaded('gd')) ? 'Enabled' : 'Disabled'; ?></td>
- <td>Elgg requires the GD extension to be loaded</td>
- </tr>
- <tr>
- <td>IMagick PHP extension</td>
- <td><?php echo (extension_loaded('imagick')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>exec()</td>
- <td><?php echo $exec_avail; ?></td>
- <td>Required for ImageMagick command line</td>
- </tr>
- <tr>
- <td>Memory Available to PHP</td>
- <td><?php echo tp_readable_size(ini_get('memory_limit')); ?></td>
- <td>Change memory_limit to increase</td>
- </tr>
- <tr>
- <td>Memory Used to Load This Page</td>
- <td><?php if (function_exists('memory_get_peak_usage')) echo tp_readable_size(memory_get_peak_usage()); ?></td>
- <td>This is approximately the minimum per page</td>
- </tr>
- <tr>
- <td>Max File Upload Size</td>
- <td><?php echo tp_readable_size(ini_get('upload_max_filesize')); ?></td>
- <td>Max size of an uploaded image</td>
- </tr>
- <tr>
- <td>Max Post Size</td>
- <td><?php echo tp_readable_size(ini_get('post_max_size')); ?></td>
- <td>Max post size = sum of images + html form</td>
- </tr>
- <tr>
- <td>Max Input Time</td>
- <td><?php echo ini_get('max_input_time'); ?> s</td>
- <td>Time script waits for upload to finish</td>
- </tr>
- <tr>
- <td>Max Execution Time</td>
- <td><?php echo ini_get('max_execution_time'); ?> s</td>
- <td>Max time a script will run</td>
- </tr>
- <tr>
- <td>GD imagejpeg</td>
- <td><?php echo (is_callable('imagejpeg')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>GD imagepng</td>
- <td><?php echo (is_callable('imagepng')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>GD imagegif</td>
- <td><?php echo (is_callable('imagegif')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>EXIF</td>
- <td><?php echo (is_callable('exif_read_data')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- </table>
- <div style="margin-top:20px;">
- <a href="<?php echo $CONFIG->url . "mod/tidypics/docs/configure_server.txt"; ?>">Server configuration doc</a>
- </div>
-</div>
-<?php
-
-$content = ob_get_clean();
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $content);
-
-echo page_draw($title, $body); \ No newline at end of file
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);
diff --git a/pages/tagged.php b/pages/tagged.php
deleted file mode 100644
index 34ea8a709..000000000
--- a/pages/tagged.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Tidypics Tagged Listing
- *
- * List all photos tagged with a user
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-
-// Get user guid
-$guid = get_input('guid');
-
-$user = get_entity($guid);
-
-if ($user) {
- $title = sprintf(elgg_echo('tidypics:usertag'), $user->name);
-} else {
- $title = "User does not exist";
-}
-
-
-// create main column
-$body = elgg_view_title($title);
-
-set_context('search');
-set_input('search_viewtype', 'gallery'); // need to force gallery view
-$body .= list_entities_from_relationship('phototag', $guid, false, 'object', 'image', 0, 10, false);
-
-// Set up submenus
-if (isloggedin()) {
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
- 'tidypics-b' );
-}
-add_submenu_item( elgg_echo('album:all'),
- $CONFIG->wwwroot . "pg/photos/world/",
- 'tidypics-z');
-add_submenu_item( elgg_echo('tidypics:mostrecent'),
- $CONFIG->wwwroot . 'pg/photos/mostrecent',
- 'tidypics-z');
-
-
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $body);
-
-
-page_draw($title, $body);
diff --git a/pages/thumbnail.php b/pages/thumbnail.php
deleted file mode 100644
index 9daa2f9c0..000000000
--- a/pages/thumbnail.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/**
- * Tidypics Thumbnail
- *
- */
-
-// Get file GUID
-$file_guid = (int) get_input('file_guid');
-
-// Get file thumbnail size
-$size = get_input('size');
-// only 3 possibilities
-if ($size != 'small' && $size != 'thumb') {
- $size = 'large';
-}
-
-$error_image = '';
-switch ($size) {
- case 'thumb':
- $error_image = "image_error_thumb.png";
- break;
- case 'small':
- $error_image = "image_error_small.png";
- break;
- case 'large':
- $error_image = "image_error_large.png";
- break;
-}
-
-// Get file entity
-$file = get_entity($file_guid);
-if (!$file) {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-if ($file->getSubtype() != "image") {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// Get filename
-if ($size == "thumb") {
- $thumbfile = $file->thumbnail;
-} else if ($size == "small") {
- $thumbfile = $file->smallthumb;
-} else {
- $thumbfile = $file->largethumb;
-}
-
-if (!$thumbfile) {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// create Elgg File object
-$readfile = new ElggFile();
-$readfile->owner_guid = $file->owner_guid;
-$readfile->setFilename($thumbfile);
-$contents = $readfile->grabFile();
-
-// send error image if file could not be read
-if (!$contents) {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// expires every 14 days
-$expires = 14 * 60*60*24;
-
-// overwrite header caused by php session code so images can be cached
-$mime = $file->getMimeType();
-header("Content-Type: $mime");
-header("Content-Length: " . strlen($contents));
-header("Cache-Control: public", true);
-header("Pragma: public", true);
-header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
-// Return the thumbnail and exit
-echo $contents;
-exit;
diff --git a/pages/upload.php b/pages/upload.php
deleted file mode 100644
index b6a828cf9..000000000
--- a/pages/upload.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Tidypics Upload Images Page
- *
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// must be logged in to upload images
-gatekeeper();
-
-$album_guid = (int) get_input('album_guid');
-if (!$album_guid) {
- forward();
-}
-
-$uploader = get_input('uploader', 'ajax');
-
-$album = get_entity($album_guid);
-
-//if album does not exist or user does not have access
-if (!$album || !$album->canEdit()) {
- // throw warning and forward to previous page
- forward($_SERVER['HTTP_REFERER']);
-}
-
-// set page owner based on container (user or group)
-set_page_owner($album->container_guid);
-
-$page_owner = page_owner_entity();
-if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
-}
-
-set_context('photos');
-$title = elgg_echo('album:addpix') . ': ' . $album->title;
-$area2 .= elgg_view_title($title);
-
-if ($uploader == 'basic') {
- $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album));
-} else {
- $area2 .= elgg_view("tidypics/forms/ajax_upload", array('album' => $album));
-}
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($title, $body);
diff --git a/pages/viewalbum.php b/pages/viewalbum.php
deleted file mode 100644
index fe3c5bc62..000000000
--- a/pages/viewalbum.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/**
- * Tidypics Album View Page
- *
- * This displays a listing of all the photos that belong to an album
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// if this page belongs to a closed group, prevent anyone outside group from seeing
-if (is_callable('group_gatekeeper')) {
- group_gatekeeper();
-}
-
-// get the album entity
-$album_guid = (int) get_input('guid');
-$album = get_entity($album_guid);
-
-// panic if we can't get it
-if (!$album) {
- forward();
-}
-
-// container should always be set, but just in case
-if ($album->container_guid) {
- set_page_owner($album->container_guid);
-} else {
- set_page_owner($album->owner_guid);
-}
-
-$owner = page_owner_entity();
-
-// setup group menu
-if ($owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
-}
-
-// allow other plugins to override the slideshow
-$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array('album' => $album), null);
-if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
-}
-
-if (can_write_to_container(0, $album->container_guid)) {
- if ($owner instanceof ElggGroup) {
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
- 'photos');
- }
- add_submenu_item( elgg_echo('album:addpix'),
- $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
- 'photos');
- add_submenu_item( elgg_echo('album:edit'),
- $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
- 'photos');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('album:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
- 'photos',
- true);
-}
-
-// create body
-$area2 = elgg_view_entity($album, true);
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($album->title, $body);
diff --git a/pages/viewimage.php b/pages/viewimage.php
deleted file mode 100644
index 890f7e8c4..000000000
--- a/pages/viewimage.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * Tidypics image view
- *
- * Display a view of a single image
- */
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// if this page belongs to a closed group, prevent anyone outside group from seeing
-if (is_callable('group_gatekeeper')) {
- group_gatekeeper();
-}
-
-// get the album entity
-$photo_guid = (int) get_input('guid');
-$photo = get_entity($photo_guid);
-
-// panic if we can't get it
-if (!$photo) {
- forward();
-}
-
-// set page owner based on owner of photo album
-set_page_owner($photo->owner_guid);
-$album = get_entity($photo->container_guid);
-if ($album) {
- $owner_guid = $album->container_guid;
- if ($owner_guid) {
- set_page_owner($owner_guid);
- }
-}
-
-
-$page_owner = page_owner_entity();
-if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
-}
-
-if (can_write_to_container(0, $album->container_guid)) {
- add_submenu_item( elgg_echo('image:edit'),
- $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid,
- 'photos');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('image:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $photo_guid . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
- 'photos',
- true);
-}
-
-
-$title = $photo->title;
-$area2 = elgg_view_title($title);
-$area2 .= elgg_view_entity($photo, true);
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($title, $body);
diff --git a/pages/world.php b/pages/world.php
deleted file mode 100644
index fe97a882d..000000000
--- a/pages/world.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * Tidypics View All Albums on Site
- *
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// set page owner to logged in user
-if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
-}
-
-$num_albums = 16;
-
-$title = elgg_echo('album:all');
-$area2 = elgg_view_title($title);
-
-set_context('search');
-set_input('search_viewtype', 'gallery');
-$content .= tp_list_entities('object','album', 0, null, $num_albums, false);
-set_context('photos');
-
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($title, $body);