diff options
-rw-r--r-- | engine/lib/entities.php | 5 | ||||
-rw-r--r-- | engine/lib/output.php | 3 | ||||
-rw-r--r-- | engine/tests/regression/trac_bugs.php | 2 | ||||
-rw-r--r-- | js/lib/ui.widgets.js | 10 | ||||
-rw-r--r-- | mod/blog/actions/blog/auto_save_revision.php | 2 | ||||
-rw-r--r-- | mod/blog/actions/blog/save.php | 4 | ||||
-rw-r--r-- | mod/profile/start.php | 2 | ||||
-rw-r--r-- | views/default/object/widget/elements/controls.php | 2 | ||||
-rw-r--r-- | views/default/page/admin.php | 27 | ||||
-rw-r--r-- | views/default/page/default.php | 21 |
10 files changed, 45 insertions, 33 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index dbb5ee695..daced6740 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -669,7 +669,10 @@ function get_entity($guid) { static $newentity_cache; $new_entity = false; - if (!is_numeric($guid)) { + // We could also use: if (!(int) $guid) { return FALSE }, + // but that evaluates to a false positive for $guid = TRUE. + // This is a bit slower, but more thorough. + if (!is_numeric($guid) || $guid === 0 || $guid === '0') { return FALSE; } diff --git a/engine/lib/output.php b/engine/lib/output.php index 60bcc72cd..989eca60e 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -306,6 +306,9 @@ function elgg_get_friendly_title($title) { } //$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); + + // use A-Za-z0-9_ instead of \w because \w is locale sensitive + $title = preg_replace("/[^A-Za-z0-9_ ]/", "", $title); $title = preg_replace("/[^\w ]/", "", $title); $title = str_replace(" ", "-", $title); $title = str_replace("--", "-", $title); diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php index 2bfc37558..99cf81774 100644 --- a/engine/tests/regression/trac_bugs.php +++ b/engine/tests/regression/trac_bugs.php @@ -45,7 +45,7 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest { /** * #1558 */ - public function testElggObjectClearAnnotations() { + public function testElggObjectDeleteAnnotations() { $this->entity = new ElggObject(); $guid = $this->entity->save(); diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index 6435d2147..f12ae02c1 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -124,15 +124,9 @@ elgg.ui.widgets.remove = function(event) { $widget.remove(); - // elgg-widget-delete-button-<guid> - var id = $(this).attr('id'); - id = id.substr(id.indexOf('elgg-widget-delete-button-') + "elgg-widget-delete-button-".length); + // delete the widget through ajax + elgg.action($(this).attr('href')); - elgg.action('widgets/delete', { - data: { - widget_guid: id - } - }); event.preventDefault(); }; diff --git a/mod/blog/actions/blog/auto_save_revision.php b/mod/blog/actions/blog/auto_save_revision.php index 1acf3b31b..66b65c5fd 100644 --- a/mod/blog/actions/blog/auto_save_revision.php +++ b/mod/blog/actions/blog/auto_save_revision.php @@ -63,7 +63,7 @@ if ($title && $description) { if (!$auto_save) { $annotation_id = $blog->annotate('blog_auto_save', $description); } elseif ($auto_save instanceof ElggAnnotation && $auto_save->value != $description) { - $blog->clearAnnotations('blog_auto_save'); + $blog->deleteAnnotations('blog_auto_save'); $annotation_id = $blog->annotate('blog_auto_save', $description); } elseif ($auto_save instanceof ElggAnnotation && $auto_save->value == $description) { // this isn't an error because we have an up to date annotation. diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index 8be67ec6c..8ca8ce846 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -131,10 +131,10 @@ if (!$error) { elgg_clear_sticky_form('blog'); // remove autosave draft if exists - $blog->clearAnnotations('blog_auto_save'); + $blog->deleteAnnotations('blog_auto_save'); // no longer a brand new post. - $blog->clearMetadata('new_post'); + $blog->deleteMetadata('new_post'); // if this was an edit, create a revision annotation if (!$new_post && $revision_text) { diff --git a/mod/profile/start.php b/mod/profile/start.php index adee838fc..abe044632 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -73,7 +73,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/views/default/object/widget/elements/controls.php b/views/default/object/widget/elements/controls.php index 6d06d28bc..866dcc787 100644 --- a/views/default/object/widget/elements/controls.php +++ b/views/default/object/widget/elements/controls.php @@ -22,7 +22,7 @@ if ($widget->canEdit()) { $params = array( 'text' => elgg_view_icon('delete-alt'), 'title' => elgg_echo('widget:delete', array($widget->getTitle())), - 'href' => "action/widgets/delete?guid=$widget->guid", + 'href' => "action/widgets/delete?widget_guid=$widget->guid", 'is_action' => true, 'is_trusted' => true, 'class' => 'elgg-widget-delete-button', diff --git a/views/default/page/admin.php b/views/default/page/admin.php index cd03541d5..7045edd91 100644 --- a/views/default/page/admin.php +++ b/views/default/page/admin.php @@ -5,16 +5,11 @@ * @package Elgg * @subpackage Core * - * @uses $vars['title'] The page title - * @uses $vars['body'] The main content of the page + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages() */ -// Set the content type -header("Content-type: text/html; charset=UTF-8"); - -$messages = $vars['sysmessages']; - $notices_html = ''; $notices = elgg_get_admin_notices(); if ($notices) { @@ -25,6 +20,16 @@ if ($notices) { $notices_html = "<div class=\"elgg-admin-notices\">$notices_html</div>"; } +// render content before head so that JavaScript and CSS can be loaded. See #4032 +$messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); +$header = elgg_view('admin/header', $vars); +$body = $vars['body']; +$footer = elgg_view('admin/footer', $vars); + + +// Set the content type +header("Content-type: text/html; charset=UTF-8"); + ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> @@ -36,21 +41,21 @@ if ($notices) { <div class="elgg-inner"> <div class="elgg-page-header"> <div class="elgg-inner clearfix"> - <?php echo elgg_view('admin/header'); ?> + <?php echo $header; ?> </div> </div> <div class="elgg-page-messages"> - <?php echo elgg_view('page/elements/messages', array('object' => $messages)); ?> + <?php echo $messages; ?> <?php echo $notices_html; ?> </div> <div class="elgg-page-body"> <div class="elgg-inner"> - <?php echo $vars['body']; ?> + <?php echo $body; ?> </div> </div> <div class="elgg-page-footer"> <div class="elgg-inner"> - <?php echo elgg_view('admin/footer'); ?> + <?php echo $footer; ?> </div> </div> </div> diff --git a/views/default/page/default.php b/views/default/page/default.php index 0e27cda52..892069fad 100644 --- a/views/default/page/default.php +++ b/views/default/page/default.php @@ -6,8 +6,8 @@ * @package Elgg * @subpackage Core * - * @uses $vars['title'] The page title - * @uses $vars['body'] The main content of the page + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages() */ @@ -21,6 +21,13 @@ if (elgg_get_context() == 'admin') { return true; } +// render content before head so that JavaScript and CSS can be loaded. See #4032 +$topbar = elgg_view('page/elements/topbar', $vars); +$messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); +$header = elgg_view('page/elements/header', $vars); +$body = elgg_view('page/elements/body', $vars); +$footer = elgg_view('page/elements/footer', $vars); + // Set the content type header("Content-type: text/html; charset=UTF-8"); @@ -33,30 +40,30 @@ header("Content-type: text/html; charset=UTF-8"); <body> <div class="elgg-page elgg-page-default"> <div class="elgg-page-messages"> - <?php echo elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); ?> + <?php echo $messages; ?> </div> <?php if (elgg_is_logged_in()): ?> <div class="elgg-page-topbar"> <div class="elgg-inner"> - <?php echo elgg_view('page/elements/topbar', $vars); ?> + <?php echo $topbar; ?> </div> </div> <?php endif; ?> <div class="elgg-page-header"> <div class="elgg-inner"> - <?php echo elgg_view('page/elements/header', $vars); ?> + <?php echo $header; ?> </div> </div> <div class="elgg-page-body"> <div class="elgg-inner"> - <?php echo elgg_view('page/elements/body', $vars); ?> + <?php echo $body; ?> </div> </div> <div class="elgg-page-footer"> <div class="elgg-inner"> - <?php echo elgg_view('page/elements/footer', $vars); ?> + <?php echo $footer; ?> </div> </div> </div> |