diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/embed/views/default/navigation/menu/embed.php | 2 | ||||
-rw-r--r-- | mod/file/actions/file/upload.php | 8 | ||||
-rw-r--r-- | mod/file/start.php | 3 | ||||
-rw-r--r-- | mod/file/views/default/file/specialcontent/image/default.php | 10 | ||||
-rw-r--r-- | mod/groups/actions/discussion/reply/save.php | 6 | ||||
-rw-r--r-- | mod/groups/actions/discussion/save.php | 2 | ||||
-rw-r--r-- | mod/groups/icon.php | 10 | ||||
-rw-r--r-- | mod/groups/lib/discussion.php | 6 | ||||
-rw-r--r-- | mod/groups/views/default/groups/js.php | 3 | ||||
-rw-r--r-- | mod/messages/views/default/messages/js.php | 3 | ||||
-rw-r--r-- | mod/pages/lib/pages.php | 2 | ||||
-rw-r--r-- | mod/pages/pages/pages/owner.php | 1 | ||||
-rw-r--r-- | mod/profile/icondirect.php | 9 | ||||
-rw-r--r-- | mod/profile/views/default/profile/js.php | 5 | ||||
-rw-r--r-- | mod/search/pages/search/index.php | 6 | ||||
-rw-r--r-- | mod/thewire/classes/ElggWire.php | 2 |
16 files changed, 50 insertions, 28 deletions
diff --git a/mod/embed/views/default/navigation/menu/embed.php b/mod/embed/views/default/navigation/menu/embed.php index 1a6a18f05..bca673f59 100644 --- a/mod/embed/views/default/navigation/menu/embed.php +++ b/mod/embed/views/default/navigation/menu/embed.php @@ -10,7 +10,7 @@ foreach ($vars['menu']['default'] as $menu_item) { $tabs[] = array( 'title' => $menu_item->getText(), 'url' => 'embed/tab/' . $menu_item->getName(), - 'url_class' => 'embed-section', + 'link_class' => 'embed-section', 'selected' => $menu_item->getSelected(), ); } diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index 3edc87952..5242cbda2 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -109,7 +109,9 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { // if image, we need to create thumbnails (this should be moved into a function) if ($guid && $file->simpletype == "image") { - $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true); + $file->icontime = time(); + + $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 60, 60, true); if ($thumbnail) { $thumb = new ElggFile(); $thumb->setMimeType($_FILES['upload']['type']); @@ -123,7 +125,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { unset($thumbnail); } - $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true); + $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 153, 153, true); if ($thumbsmall) { $thumb->setFilename($prefix."smallthumb".$filestorename); $thumb->open("write"); @@ -133,7 +135,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { unset($thumbsmall); } - $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false); + $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 600, 600, false); if ($thumblarge) { $thumb->setFilename($prefix."largethumb".$filestorename); $thumb->open("write"); diff --git a/mod/file/start.php b/mod/file/start.php index e15a9ad61..36142533f 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -345,7 +345,8 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) { // thumbnails get first priority if ($file->thumbnail) { - return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size"; + $ts = (int)$file->icontime; + return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size&icontime=$ts"; } $mapping = array( diff --git a/mod/file/views/default/file/specialcontent/image/default.php b/mod/file/views/default/file/specialcontent/image/default.php index fbd994a0b..431ac9f4f 100644 --- a/mod/file/views/default/file/specialcontent/image/default.php +++ b/mod/file/views/default/file/specialcontent/image/default.php @@ -1,13 +1,17 @@ <?php /** * Display an image + * + * @uses $vars['entity'] */ -$image_url = elgg_get_site_url() . "mod/file/thumbnail.php?file_guid={$vars['entity']->getGUID()}&size=large"; +$file = $vars['entity']; + +$image_url = $file->getIconURL('large'); $image_url = elgg_format_url($image_url); -$download_url = elgg_get_site_url() . "mod/file/download.php?file_guid={$vars['entity']->getGUID()}"; +$download_url = elgg_get_site_url() . "file/download/{$file->getGUID()}"; -if ($vars['full_view'] && $smallthumb = $vars['entity']->smallthumb) { +if ($vars['full_view']) { echo <<<HTML <div class="file-photo"> <a href="$download_url"><img class="elgg-photo" src="$image_url" /></a> diff --git a/mod/groups/actions/discussion/reply/save.php b/mod/groups/actions/discussion/reply/save.php index a1ed036b6..f8be8aa2c 100644 --- a/mod/groups/actions/discussion/reply/save.php +++ b/mod/groups/actions/discussion/reply/save.php @@ -4,8 +4,6 @@ * */ -gatekeeper(); - // Get input $entity_guid = (int) get_input('entity_guid'); $text = get_input('group_topic_post'); @@ -23,10 +21,10 @@ if (!$topic) { forward(REFERER); } -$user = get_loggedin_user(); +$user = elgg_get_logged_in_user_entity(); $group = $topic->getContainerEntity(); -if (!$group->canWriteToContainer($user)) { +if (!$group->canWriteToContainer()) { register_error(elgg_echo('groups:notmember')); forward(REFERER); } diff --git a/mod/groups/actions/discussion/save.php b/mod/groups/actions/discussion/save.php index a51775cd6..de4afadfb 100644 --- a/mod/groups/actions/discussion/save.php +++ b/mod/groups/actions/discussion/save.php @@ -21,7 +21,7 @@ if (!$title || !$desc) { } $container = get_entity($container_guid); -if (!$container || !$container->canWriteToContainer()) { +if (!$container || !$container->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('discussion:error:permissions')); forward(REFERER); } diff --git a/mod/groups/icon.php b/mod/groups/icon.php index f4c0f8010..104da4b41 100644 --- a/mod/groups/icon.php +++ b/mod/groups/icon.php @@ -10,8 +10,15 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); $group_guid = get_input('group_guid'); $group = get_entity($group_guid); +// If is the same ETag, content didn't changed. +$etag = $group->icontime . $group_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_input('size')); -if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) +if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar'))) $size = "medium"; $success = false; @@ -37,4 +44,5 @@ header('Expires: ' . date('r',time() + 864000)); header("Pragma: public"); header("Cache-Control: public"); header("Content-Length: " . strlen($contents)); +header("ETag: $etag"); echo $contents; diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php index 2bda4678e..55642644d 100644 --- a/mod/groups/lib/discussion.php +++ b/mod/groups/lib/discussion.php @@ -92,8 +92,8 @@ function discussion_handle_edit_page($type, $guid) { forward(); } - // make sure user has permissions to write to container - if (!$group->canWriteToContainer()) { + // make sure user has permissions to add a topic to container + if (!$group->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('groups:permissions:error')); forward($group->getURL()); } @@ -173,7 +173,7 @@ function discussion_handle_view_page($guid) { 'show_add_form' => false, )); $content .= elgg_view('discussion/closed'); - } elseif ($group->canWriteToContainer() || elgg_is_admin_logged_in()) { + } elseif ($group->canWriteToContainer(0, 'object', 'groupforumtopic') || elgg_is_admin_logged_in()) { $content .= elgg_view('discussion/replies', array( 'entity' => $topic, 'show_add_form' => true, diff --git a/mod/groups/views/default/groups/js.php b/mod/groups/views/default/groups/js.php index ad742445b..1b4d33f32 100644 --- a/mod/groups/views/default/groups/js.php +++ b/mod/groups/views/default/groups/js.php @@ -1,5 +1,6 @@ -$(function() { +// this adds a class to support IE8 and older +elgg.register_hook_handler('init', 'system', function() { // jQuery uses 0-based indexing $('#groups-tools').children('li:even').addClass('odd'); }); diff --git a/mod/messages/views/default/messages/js.php b/mod/messages/views/default/messages/js.php index 39f93e645..60cf36b92 100644 --- a/mod/messages/views/default/messages/js.php +++ b/mod/messages/views/default/messages/js.php @@ -1,5 +1,6 @@ -$(function() { +// messages plugin toggle +elgg.register_hook_handler('init', 'system', function() { $("#messages-toggle").click(function() { $('input[type=checkbox]').click(); }); diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php index 0a6f3a620..5c5323d6f 100644 --- a/mod/pages/lib/pages.php +++ b/mod/pages/lib/pages.php @@ -78,6 +78,7 @@ function pages_register_navigation_tree($container) { 'type' => 'object', 'subtype' => 'page_top', 'container_guid' => $container->getGUID(), + 'limit' => 0, )); foreach ($top_pages as $page) { @@ -96,6 +97,7 @@ function pages_register_navigation_tree($container) { 'subtype' => 'page', 'metadata_name' => 'parent_guid', 'metadata_value' => $parent->getGUID(), + 'limit' => 0, )); foreach ($children as $child) { diff --git a/mod/pages/pages/pages/owner.php b/mod/pages/pages/pages/owner.php index 2ff45ae0c..b29332ee1 100644 --- a/mod/pages/pages/pages/owner.php +++ b/mod/pages/pages/pages/owner.php @@ -23,7 +23,6 @@ $content = elgg_list_entities(array( 'types' => 'object', 'subtypes' => 'page_top', 'container_guid' => elgg_get_page_owner_guid(), - 'limit' => $limit, 'full_view' => false, )); if (!$content) { diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index f7188455e..6c3148f2b 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -12,8 +12,16 @@ require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php'); global $CONFIG; $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"; @@ -48,6 +56,7 @@ if ($mysql_dblink) { header("Pragma: public"); header("Cache-Control: public"); header("Content-Length: " . strlen($contents)); + header("ETag: $etag"); // this chunking is done for supposedly better performance $split_string = str_split($contents, 1024); foreach ($split_string as $chunk) { 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/search/pages/search/index.php b/mod/search/pages/search/index.php index efa3ec037..91817096b 100644 --- a/mod/search/pages/search/index.php +++ b/mod/search/pages/search/index.php @@ -145,11 +145,7 @@ foreach ($custom_types as $type) { $data = htmlspecialchars(http_build_query(array( 'q' => $query, - 'entity_subtype' => $entity_subtype, - 'entity_type' => $entity_type, - 'owner_guid' => $owner_guid, 'search_type' => $type, - 'friends' => $friends ))); $url = elgg_get_site_url()."search?$data"; @@ -240,8 +236,6 @@ if ($search_type != 'entities' || $search_type == 'all') { $current_params = $params; $current_params['search_type'] = $type; - // custom search types have no subtype. - unset($current_params['subtype']); $results = elgg_trigger_plugin_hook('search', $type, $current_params, array()); diff --git a/mod/thewire/classes/ElggWire.php b/mod/thewire/classes/ElggWire.php index 5155a7f97..9c92dd8f2 100644 --- a/mod/thewire/classes/ElggWire.php +++ b/mod/thewire/classes/ElggWire.php @@ -2,7 +2,7 @@ /** * ElggWire Class * - * @property string $method The method used to create the wire post + * @property string $method The method used to create the wire post (site, sms, api) * @property bool $reply Whether this wire post was a reply to another post * @property int $wire_thread The identifier of the thread for this wire post */ |