diff options
Diffstat (limited to 'mod/profile')
| -rw-r--r-- | mod/profile/icondirect.php | 29 | ||||
| -rw-r--r-- | mod/profile/start.php | 4 | ||||
| -rw-r--r-- | mod/profile/views/default/profile/details.php | 18 | ||||
| -rw-r--r-- | mod/profile/views/default/profile/js.php | 5 | ||||
| -rw-r--r-- | mod/profile/views/default/profile/metatags.php | 4 | ||||
| -rw-r--r-- | mod/profile/views/default/profile/owner_block.php | 5 |
6 files changed, 49 insertions, 16 deletions
diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index f7188455e..5f1599e0d 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -11,9 +11,23 @@ require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php'); global $CONFIG; +// won't be able to serve anything if no joindate or guid +if (!isset($_GET['joindate']) || !isset($_GET['guid'])) { + header("HTTP/1.1 404 Not Found"); + exit; +} + $join_date = (int)$_GET['joindate']; +$last_cache = (int)$_GET['lastcache']; // icontime $guid = (int)$_GET['guid']; +// If is the same ETag, content didn't changed. +$etag = $last_cache . $guid; +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"$etag\"") { + header("HTTP/1.1 304 Not Modified"); + exit; +} + $size = strtolower($_GET['size']); if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar'))) { $size = "medium"; @@ -41,18 +55,15 @@ if ($mysql_dblink) { $user_path = date('Y/m/d/', $join_date) . $guid; $filename = "$data_root$user_path/profile/{$guid}{$size}.jpg"; - $contents = @file_get_contents($filename); - if (!empty($contents)) { + $filesize = @filesize($filename); + if ($filesize) { header("Content-type: image/jpeg"); - header('Expires: ' . date('r', strtotime("+6 months")), true); + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true); header("Pragma: public"); header("Cache-Control: public"); - header("Content-Length: " . strlen($contents)); - // this chunking is done for supposedly better performance - $split_string = str_split($contents, 1024); - foreach ($split_string as $chunk) { - echo $chunk; - } + header("Content-Length: $filesize"); + header("ETag: \"$etag\""); + readfile($filename); exit; } } diff --git a/mod/profile/start.php b/mod/profile/start.php index adee838fc..ab596f235 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -56,6 +56,8 @@ function profile_page_handler($page) { $username = $page[0]; $user = get_user_by_username($username); elgg_set_page_owner_guid($user->guid); + } elseif (elgg_is_logged_in()) { + forward(elgg_get_logged_in_user_entity()->getURL()); } // short circuit if invalid or banned username @@ -73,7 +75,7 @@ function profile_page_handler($page) { // use the core profile edit page $base_dir = elgg_get_root_path(); require "{$base_dir}pages/profile/edit.php"; - return; + return true; } // main profile page diff --git a/mod/profile/views/default/profile/details.php b/mod/profile/views/default/profile/details.php index 3af5cb756..da4e95690 100644 --- a/mod/profile/views/default/profile/details.php +++ b/mod/profile/views/default/profile/details.php @@ -21,14 +21,28 @@ if (is_array($profile_fields) && sizeof($profile_fields) > 0) { continue; } $value = $user->$shortname; + if (!empty($value)) { - //This function controls the alternating class + + // fix profile URLs populated by https://github.com/Elgg/Elgg/issues/5232 + // @todo Replace with upgrade script, only need to alter users with last_update after 1.8.13 + if ($valtype == 'url' && $value == 'http://') { + $user->$shortname = ''; + continue; + } + + // validate urls + if ($valtype == 'url' && !preg_match('~^https?\://~i', $value)) { + $value = "http://$value"; + } + + // this controls the alternating class $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; ?> <div class="<?php echo $even_odd; ?>"> <b><?php echo elgg_echo("profile:{$shortname}"); ?>: </b> <?php - echo elgg_view("output/{$valtype}", array('value' => $user->$shortname)); + echo elgg_view("output/{$valtype}", array('value' => $value)); ?> </div> <?php diff --git a/mod/profile/views/default/profile/js.php b/mod/profile/views/default/profile/js.php index 16dec59df..5a08a90bd 100644 --- a/mod/profile/views/default/profile/js.php +++ b/mod/profile/views/default/profile/js.php @@ -1,6 +1,9 @@ + +// force the first column to at least be as large as the profile box in cols 2 and 3 +// we also want to run before the widget init happens so priority is < 500 elgg.register_hook_handler('init', 'system', function() { // only do this on the profile page's widget canvas. if ($('.profile').length) { $('#elgg-widget-col-1').css('min-height', $('.profile').outerHeight(true) + 1); } -});
\ No newline at end of file +}, 400); diff --git a/mod/profile/views/default/profile/metatags.php b/mod/profile/views/default/profile/metatags.php index c6f674e6d..52048b8a7 100644 --- a/mod/profile/views/default/profile/metatags.php +++ b/mod/profile/views/default/profile/metatags.php @@ -10,7 +10,7 @@ $owner = elgg_get_page_owner_entity(); if (elgg_instanceof($owner, 'user')) { ?> - <link rel="meta" type="application/rdf+xml" title="FOAF" href="<?php echo full_url(); ?>?view=foaf" /> + <link rel="meta" type="application/rdf+xml" title="FOAF" href="<?php echo current_page_url(); ?>?view=foaf" /> <?php -}
\ No newline at end of file +} diff --git a/mod/profile/views/default/profile/owner_block.php b/mod/profile/views/default/profile/owner_block.php index 35199726a..63cb5391a 100644 --- a/mod/profile/views/default/profile/owner_block.php +++ b/mod/profile/views/default/profile/owner_block.php @@ -11,7 +11,10 @@ if (!$user) { return TRUE; } -$icon = elgg_view_entity_icon($user, 'large', array('use_hover' => 'true')); +$icon = elgg_view_entity_icon($user, 'large', array( + 'use_hover' => false, + 'use_link' => false, +)); // grab the actions and admin menu items from user hover $menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); |
