From be1a87314916f11e074a0a63726320c84cedaf65 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 9 Apr 2011 16:07:40 +0000 Subject: Refs #3241 sorting upgrades so that upgrades from old upgrade system are ordered in datalist array git-svn-id: http://code.elgg.org/elgg/trunk@8966 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/upgrade.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/lib/upgrade.php b/engine/lib/upgrade.php index 755c100dd..85810956b 100644 --- a/engine/lib/upgrade.php +++ b/engine/lib/upgrade.php @@ -147,6 +147,8 @@ function elgg_get_upgrade_files($upgrade_path = null) { $upgrade_files[] = $upgrade_file; } + sort($upgrade_files); + return $upgrade_files; } -- cgit v1.2.3 From a6ab24b467633c72aac740a8aa1ded9d8d0cc0cd Mon Sep 17 00:00:00 2001 From: brettp Date: Sat, 9 Apr 2011 16:19:57 +0000 Subject: Removing odd ? after docblock in twitter_api. git-svn-id: http://code.elgg.org/elgg/trunk@8967 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/twitter_api/lib/twitter_api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/twitter_api/lib/twitter_api.php b/mod/twitter_api/lib/twitter_api.php index 167dbe0f5..0621c2b13 100644 --- a/mod/twitter_api/lib/twitter_api.php +++ b/mod/twitter_api/lib/twitter_api.php @@ -283,7 +283,7 @@ function twitter_api_revoke() { /** * Returns the url to authorize a user. * - * @param string $callback The callback URL? + * @param string $callback The callback URL */ function twitter_api_get_authorize_url($callback = NULL) { global $SESSION; @@ -341,4 +341,4 @@ function twitter_api_allow_new_users_with_twitter() { } return false; -} +} \ No newline at end of file -- cgit v1.2.3 From 0c4397913c7d313dbf10e9553f46e1d6715c6963 Mon Sep 17 00:00:00 2001 From: brettp Date: Sat, 9 Apr 2011 17:08:11 +0000 Subject: Fixes #2600. Applied Hellekin's patch. Props to him for understanding what was going on because whoa. git-svn-id: http://code.elgg.org/elgg/trunk@8968 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/api/entity_getter_functions.php | 54 +++++++++++++++------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index 1633cbe19..59aa7074a 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -1341,7 +1341,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1382,6 +1382,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } function testElggApiGettersEntityMetadataNVPValidNValidVEqualsTriple() { + if ($boasdf == true) { + $awoefhaow = true; + } $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); @@ -1406,11 +1409,13 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { // make some bad ones $invalid_md_name = 'test_metadata_name_' . rand(); + $invalid_md_name2 = 'test_metadata_name_' . rand(); + $invalid_md_name3 = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; - $e->$md_name2 = $invalid_md_value; - $e->$md_name3 = $invalid_md_value; + $e->$invalid_md_name = $md_value; + $e->$invalid_md_name2 = $md_value2; + $e->$invalid_md_name3 = $md_value3; $e->save(); $guids[] = $e->getGUID(); @@ -1483,10 +1488,11 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { // make some bad ones $invalid_md_name = 'test_metadata_name_' . rand(); + $invalid_md_name2 = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; - $e->$md_name2 = $invalid_md_value; + $e->$invalid_md_name = $md_value; + $e->$invalid_md_name2 = $md_value2; $e->save(); $guids[] = $e->getGUID(); @@ -1572,11 +1578,11 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; - $e->$md_name2 = $invalid_md_value; - $e->$md_name3 = $invalid_md_value; - $e->$md_name4 = $invalid_md_value; - $e->$md_name5 = $invalid_md_value; + $e->$invalid_md_name = $md_value; + $e->$md_name2 = $md_value2; + $e->$md_name3 = $md_value3; + $e->$md_name4 = $md_value4; + $e->$md_name5 = $md_value5; $e->save(); $guids[] = $e->getGUID(); @@ -1649,7 +1655,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1694,7 +1700,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1758,7 +1764,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1836,7 +1842,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1888,33 +1894,32 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); - $md_value = 2; $guids = array(); $valid_guids = array(); // our targets $valid = new ElggObject(); $valid->subtype = $subtype; - $valid->$md_name = $md_value; + $valid->$md_name = 1; $valid->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid->getGUID(); $valid2 = new ElggObject(); $valid2->subtype = $subtype; - $valid2->$md_name = 3; + $valid2->$md_name = 2; $valid2->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid2->getGUID(); $valid3 = new ElggObject(); $valid3->subtype = $subtype; - $valid3->$md_name = 1; + $valid3->$md_name = 3; $valid3->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid3->getGUID(); - $md_valid_values = array($md_value, $md_value2); + $md_valid_values = array(1, 2, 3); $options = array( 'type' => 'object', @@ -1947,33 +1952,32 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); - $md_value = 'b'; $guids = array(); $valid_guids = array(); // our targets $valid = new ElggObject(); $valid->subtype = $subtype; - $valid->$md_name = $md_value; + $valid->$md_name = 'a'; $valid->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid->getGUID(); $valid2 = new ElggObject(); $valid2->subtype = $subtype; - $valid2->$md_name = 'c'; + $valid2->$md_name = 'b'; $valid2->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid2->getGUID(); $valid3 = new ElggObject(); $valid3->subtype = $subtype; - $valid3->$md_name = 'a'; + $valid3->$md_name = 'c'; $valid3->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid3->getGUID(); - $md_valid_values = array($md_value, $md_value2); + $md_valid_values = array('a', 'b', 'c'); $options = array( 'type' => 'object', -- cgit v1.2.3 From 472b45795825eb65f68c8835e8f7daeb82598741 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 9 Apr 2011 17:14:14 +0000 Subject: Fixes #3224 Fixes #3241 stopping upgrade after plugin upgrade and restarting git-svn-id: http://code.elgg.org/elgg/trunk@8969 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/upgrades/2011010101.php | 18 ++++++++++++++++++ ...00-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php | 3 +++ 2 files changed, 21 insertions(+) diff --git a/engine/lib/upgrades/2011010101.php b/engine/lib/upgrades/2011010101.php index be1adac1a..9dbaff1e4 100644 --- a/engine/lib/upgrades/2011010101.php +++ b/engine/lib/upgrades/2011010101.php @@ -73,3 +73,21 @@ remove_metadata($site->guid, 'pluginorder'); remove_metadata($site->guid, 'enabled_plugins'); elgg_set_ignore_access($old_id); + +/** + * @hack + * + * We stop the upgrade at this point because plugins weren't given the chance to + * load due to the new plugin code introduced with Elgg 1.8. Instead, we manually + * set the version and start the upgrade process again. + * + * The variables from upgrade_code() are available because this script was included + */ +if ($upgrade_version > $version) { + datalist_set('version', $upgrade_version); +} + +$processed_upgrades = array_unique($processed_upgrades); +datalist_set('processed_upgrades', serialize($processed_upgrades)); + +forward('upgrade.php'); diff --git a/engine/lib/upgrades/2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php b/engine/lib/upgrades/2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php index 592adb403..7efa687ae 100644 --- a/engine/lib/upgrades/2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php +++ b/engine/lib/upgrades/2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php @@ -11,3 +11,6 @@ foreach ($admins as $admin) { // call the admin handler for the make_admin event elgg_add_admin_widgets('make_admin', 'user', $admin); } + +// as last upgrade for 1.8.0 (or nearly so) we add a reminder to update .htaccess +system_message("IMPORTANT: update your .htaccess file (or equivalent)"); -- cgit v1.2.3 From 30a1df9bcf1ac12a8aec0f307f53f8eb6d105809 Mon Sep 17 00:00:00 2001 From: brettp Date: Sat, 9 Apr 2011 17:34:16 +0000 Subject: Refs #2600. Removed the very special debug vars that I told myself "Make sure you remove those before you commit or you'll look like an idiot" when I added. *ahem* git-svn-id: http://code.elgg.org/elgg/trunk@8970 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/api/entity_getter_functions.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index 59aa7074a..aef7a991e 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -1382,9 +1382,6 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } function testElggApiGettersEntityMetadataNVPValidNValidVEqualsTriple() { - if ($boasdf == true) { - $awoefhaow = true; - } $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); -- cgit v1.2.3 From cab1ccee2adc382151ce89674498a93addb89b34 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 9 Apr 2011 19:14:38 +0000 Subject: Fixes #3193 moves default widgets upgrade to an action git-svn-id: http://code.elgg.org/elgg/trunk@8971 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/widgets/upgrade.php | 65 ++++++++++++++++++++++ ...svn-update_default_widgets-7daf5a459720d06d.php | 60 -------------------- engine/lib/widgets.php | 1 + languages/en.php | 1 + views/default/admin/appearance/default_widgets.php | 16 ++++++ 5 files changed, 83 insertions(+), 60 deletions(-) create mode 100644 actions/widgets/upgrade.php delete mode 100644 engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php diff --git a/actions/widgets/upgrade.php b/actions/widgets/upgrade.php new file mode 100644 index 000000000..0a5cf8d48 --- /dev/null +++ b/actions/widgets/upgrade.php @@ -0,0 +1,65 @@ + 'object', + 'subtype' => 'moddefaultwidgets', + 'limit' => 1, +)); + +if (!$object) { + forward(REFERER); +} + +$object = $object[0]; + +$site = elgg_get_site_entity(); + +$ia = elgg_set_ignore_access(true); +foreach (array('profile', 'dashboard') as $context) { + if (isset($object->$context)) { + elgg_push_context($context); + elgg_push_context('default_widgets'); + elgg_push_context('widgets'); + + // deserialize the widget information + list($left, $middle, $right) = split('%%', $object->$context); + $left_widgets = split('::', $left); + $middle_widgets = split('::', $middle); + $right_widgets = split('::', $right); + + // 1st column is right column in default theme + $widgets = array( + 1 => array_reverse($right_widgets), + 2 => array_reverse($middle_widgets), + 3 => array_reverse($left_widgets), + ); + + foreach ($widgets as $column => $column_widgets) { + foreach ($column_widgets as $handler) { + $guid = elgg_create_widget($site->getGUID(), $handler, $context); + if ($guid) { + $widget = get_entity($guid); + $widget->move($column, 0); + } + } + } + + elgg_pop_context(); + elgg_pop_context(); + elgg_pop_context(); + } +} +elgg_set_ignore_access($ia); + +$object->delete(); +system_message(elgg_echo('upgrade:core')); +forward(REFERER); diff --git a/engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php b/engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php deleted file mode 100644 index 6a5f2fa02..000000000 --- a/engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php +++ /dev/null @@ -1,60 +0,0 @@ - 'object', - 'subtype' => 'moddefaultwidgets', - 'limit' => 1, -)); - -if (!$object) { - // nothing to upgrade - return true; -} - -$object = $object[0]; - -$site = elgg_get_site_entity(); - -$ia = elgg_set_ignore_access(true); -foreach (array('profile', 'dashboard') as $context) { - if (isset($object->$context)) { - elgg_push_context($context); - elgg_push_context('default_widgets'); - elgg_push_context('widgets'); - - // deserialize the widget information - list($left, $middle, $right) = split('%%', $object->$context); - $left_widgets = split('::', $left); - $middle_widgets = split('::', $middle); - $right_widgets = split('::', $right); - - // 1st column is right column in default theme - $widgets = array( - 1 => array_reverse($right_widgets), - 2 => array_reverse($middle_widgets), - 3 => array_reverse($left_widgets), - ); - - foreach ($widgets as $column => $column_widgets) { - foreach ($column_widgets as $handler) { - $guid = elgg_create_widget($site->getGUID(), $handler, $context); - if ($guid) { - $widget = get_entity($guid); - $widget->move($column, 0); - } - } - } - - elgg_pop_context(); - elgg_pop_context(); - elgg_pop_context(); - } -} -elgg_set_ignore_access($ia); diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index b20f92f74..cc3cf20e4 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -272,6 +272,7 @@ function elgg_widgets_init() { elgg_register_action('widgets/add'); elgg_register_action('widgets/move'); elgg_register_action('widgets/delete'); + elgg_register_action('widgets/upgrade', '', 'admin'); run_function_once("elgg_widget_run_once"); } diff --git a/languages/en.php b/languages/en.php index 427452aa9..86fa9c7e7 100644 --- a/languages/en.php +++ b/languages/en.php @@ -795,6 +795,7 @@ $english = array( 'post' => 'Post', 'submit' => 'Submit', 'comment' => 'Comment', + 'upgrade' => 'Upgrade', 'site' => 'Site', 'activity' => 'Activity', diff --git a/views/default/admin/appearance/default_widgets.php b/views/default/admin/appearance/default_widgets.php index ce9f6a5c2..5ce0d0acf 100644 --- a/views/default/admin/appearance/default_widgets.php +++ b/views/default/admin/appearance/default_widgets.php @@ -6,6 +6,22 @@ * @subpackage Administration.DefaultWidgets */ +$object = elgg_get_entities(array( + 'type' => 'object', + 'subtype' => 'moddefaultwidgets', + 'limit' => 1, +)); + +if ($object) { + echo elgg_view('output/url', array( + 'text' => elgg_echo('upgrade'), + 'href' => 'action/widgets/upgrade', + 'is_action' => true, + 'class' => 'elgg_button elgg-button-submit', + 'title' => 'Upgrade your default widgets to work on Elgg 1.8', + )); +} + elgg_push_context('default_widgets'); $widget_context = get_input('widget_context'); $list = elgg_trigger_plugin_hook('get_list', 'default_widgets', null, array()); -- cgit v1.2.3 From 648d9e6aafc1c22fe65862ac714277ddac356097 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 9 Apr 2011 19:50:47 +0000 Subject: fixed delete icon in admin css git-svn-id: http://code.elgg.org/elgg/trunk@8972 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/css/admin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/views/default/css/admin.php b/views/default/css/admin.php index 949824831..d485108c4 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -871,9 +871,11 @@ a.elgg-longtext-control { display: inline-block; margin: 0 2px; } +.elgg-icon-delete:hover, .elgg-icon-delete-alt:hover { background-position: 0 -0px; } +.elgg-icon-delete, .elgg-icon-delete-alt { background-position: 0 -18px; } -- cgit v1.2.3 From 5ba7b5810e4075d96943348aa5bba0946ada4755 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 9 Apr 2011 19:56:01 +0000 Subject: registered bookmarks widget git-svn-id: http://code.elgg.org/elgg/trunk@8973 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/bookmarks/languages/en.php | 3 +-- mod/bookmarks/start.php | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php index e3f8cd64f..42865f8cf 100644 --- a/mod/bookmarks/languages/en.php +++ b/mod/bookmarks/languages/en.php @@ -52,8 +52,7 @@ $english = array( /** * Widget and bookmarklet */ - 'bookmarks:widget:description' => - "This widget displays your latest bookmarks.", + 'bookmarks:widget:description' => "Display your latest bookmarks.", 'bookmarks:bookmarklet:description' => "The bookmarks bookmarklet allows you to share any resource you find on the web with your friends, or just bookmark it for yourself. To use it, simply drag the following button to your browser's links bar:", diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 600293b5a..2dc86bc1a 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -35,7 +35,9 @@ function bookmarks_init() { elgg_extend_view('css/elgg', 'bookmarks/css'); elgg_extend_view('js/elgg', 'bookmarks/js'); - + + elgg_register_widget_type('bookmarks', elgg_echo('bookmarks'), elgg_echo('bookmarks:widget:description')); + if (elgg_is_logged_in()) { $user_guid = elgg_get_logged_in_user_guid(); $address = urlencode(current_page_url()); -- cgit v1.2.3 From 20c4b5112b823a0b65bf1bf1a5f0bc83e7321e59 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 9 Apr 2011 19:58:35 +0000 Subject: Reopens #3224 not as clever as I thought - user experiences error before seeing reminder git-svn-id: http://code.elgg.org/elgg/trunk@8974 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/engine/lib/upgrades/2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php b/engine/lib/upgrades/2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php index 7efa687ae..592adb403 100644 --- a/engine/lib/upgrades/2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php +++ b/engine/lib/upgrades/2011032200-1.8_svn-admins_like_widgets-7f19d2783c1680d3.php @@ -11,6 +11,3 @@ foreach ($admins as $admin) { // call the admin handler for the make_admin event elgg_add_admin_widgets('make_admin', 'user', $admin); } - -// as last upgrade for 1.8.0 (or nearly so) we add a reminder to update .htaccess -system_message("IMPORTANT: update your .htaccess file (or equivalent)"); -- cgit v1.2.3 From 05dafefe7accb7225e071c303e7ac5e778151f51 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Sun, 10 Apr 2011 01:19:08 +0000 Subject: Refs #3281: css/elements/core.php for the cross-browser/hacky/non-trivial things that themes should rarely, if ever, override. git-svn-id: http://code.elgg.org/elgg/trunk@8975 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/css/elements/buttons.php | 1 - views/default/css/elements/components.php | 17 ----- views/default/css/elements/core.php | 101 ++++++++++++++++++++++++++++++ views/default/css/elements/grid.php | 23 ------- views/default/css/elements/helpers.php | 8 --- views/default/css/elements/icons.php | 1 - views/default/css/elements/layout.php | 8 --- views/default/css/elements/navigation.php | 35 ----------- views/default/css/elgg.php | 2 + 9 files changed, 103 insertions(+), 93 deletions(-) create mode 100644 views/default/css/elements/core.php diff --git a/views/default/css/elements/buttons.php b/views/default/css/elements/buttons.php index 6a2342942..e9c99cf96 100644 --- a/views/default/css/elements/buttons.php +++ b/views/default/css/elements/buttons.php @@ -19,7 +19,6 @@ -moz-border-radius: 5px; border-radius: 5px; - display: inline-block; width: auto; padding: 2px 4px; cursor: pointer; diff --git a/views/default/css/elements/components.php b/views/default/css/elements/components.php index bb573f4ec..0fcbe3619 100644 --- a/views/default/css/elements/components.php +++ b/views/default/css/elements/components.php @@ -20,23 +20,6 @@ */ ?> -/* *************************************** - Body -*************************************** */ -.elgg-body { - width: auto; - word-wrap: break-word; - overflow: hidden; -} -.elgg-body:after { - display: block; - visibility: hidden; - height: 0 !important; - line-height: 0; - font-size: xx-large; - content: " x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x "; -} - /* *************************************** Image Block *************************************** */ diff --git a/views/default/css/elements/core.php b/views/default/css/elements/core.php new file mode 100644 index 000000000..e99a11e13 --- /dev/null +++ b/views/default/css/elements/core.php @@ -0,0 +1,101 @@ + + +/* Clearfix */ +.clearfix:after, +.elgg-grid:after, +.elgg-layout:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +/* Fluid width container that does not wrap floats */ +.elgg-body, +.elgg-col-last { + display: block; + width: auto; + word-wrap: break-word; + overflow: hidden; + + /* IE 6, 7 */ + zoom:1; + *overflow:visible; +} + + +.elgg-body:after, +.elgg-col-last:after { + display: block; + visibility: hidden; + height: 0 !important; + line-height: 0; + + /* Stretch to fill up available space */ + font-size: xx-large; + content: " x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x "; +} + +/* *************************************** + * MENUS + * + * To add separators to a menu: + * .elgg-menu-$menu > li:after {content: '|'; background: ...;} + *************************************** */ +/* Enabled nesting of dropdown/flyout menus */ +.elgg-menu > li { position: relative; } + +/* Separators should only come between list items */ +.elgg-menu > li:last-child:after { display: none } + +/* Maximize click target */ +.elgg-menu > li > a { display: block } + +/* Horizontal menus w/ separator support */ +.elgg-menu-hz > li, +.elgg-menu-hz > li:after, +.elgg-menu-hz > li > a, +.elgg-menu-hz > li > span { + vertical-align: middle; +} + +/* Allow inline image blocks in horizontal menus */ +.elgg-menu-hz .elgg-body:after { content: '.'; } + + +/* Inline block */ +.elgg-gallery > li, +.elgg-button, +.elgg-icon, +.elgg-menu-hz > li, +.elgg-menu-hz > li:after, +.elgg-menu-hz > li > a, +.elgg-menu-hz > li > span { + /* Google says do this, but why? */ + position: relative; + + /* FF2 */ + display: -moz-inline-box; + + display: inline-block; + + /* Inline-block: IE 6, 7 */ + zoom: 1; + *display: inline; +} \ No newline at end of file diff --git a/views/default/css/elements/grid.php b/views/default/css/elements/grid.php index 00cd448b9..fdbaf4aca 100644 --- a/views/default/css/elements/grid.php +++ b/views/default/css/elements/grid.php @@ -13,14 +13,6 @@ /* *************************************** GRID *************************************** */ -.elgg-grid:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} - .elgg-col { float: left; } @@ -60,18 +52,3 @@ .elgg-col-5of6 { width: 83.33%; } -.elgg-col-last { - width: auto; - float: none; - display: table-cell; -} -.elgg-col-last:after { - clear: both; - display: block; - visibility: hidden; - overflow: hidden; - height: 0 !important; - line-height: 0; - font-size: xx-large; - content: " x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x "; -} diff --git a/views/default/css/elements/helpers.php b/views/default/css/elements/helpers.php index 21e3dd984..e6f59260d 100644 --- a/views/default/css/elements/helpers.php +++ b/views/default/css/elements/helpers.php @@ -13,14 +13,6 @@ clear: both; } -.clearfix:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} - .hidden { display: none; } diff --git a/views/default/css/elements/icons.php b/views/default/css/elements/icons.php index 8bbc919b3..08948df50 100644 --- a/views/default/css/elements/icons.php +++ b/views/default/css/elements/icons.php @@ -16,7 +16,6 @@ background: transparent url(_graphics/elgg_sprites.png) no-repeat left; width: 16px; height: 16px; - display: inline-block; margin: 0 2px; } .elgg-icon-arrow-left { diff --git a/views/default/css/elements/layout.php b/views/default/css/elements/layout.php index d512c3602..d52938aee 100644 --- a/views/default/css/elements/layout.php +++ b/views/default/css/elements/layout.php @@ -72,14 +72,6 @@ .elgg-layout { min-height: 360px; } - -.elgg-layout:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} .elgg-layout-one-column { padding: 10px 0; } diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index b72124001..25b45bbee 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -86,41 +86,6 @@ background: white; } -/* *************************************** - * MENUS - * - * To add separators to a menu: - * .elgg-menu-$menu > li:after {content: '|'; background: ...;} - *************************************** */ -/* For dropdown/flyout menus */ -.elgg-menu > li { - position: relative; -} - -/* For separators */ -.elgg-menu > li:last-child:after { - display: none -} - -/* Maximize click target */ -.elgg-menu > li > a { - display: block -} - -/* Horizontal menus w/ separator support */ -.elgg-menu-hz > li, -.elgg-menu-hz > li:after, -.elgg-menu-hz > li > a, -.elgg-menu-hz > li > span { - display: inline-block; - vertical-align: middle; -} - -/* Allow inline image blocks in horizontal menus */ -.elgg-menu-hz .elgg-body:after { - content: '.'; -} - /* *************************************** BREADCRUMBS *************************************** */ diff --git a/views/default/css/elgg.php b/views/default/css/elgg.php index 977eb9f2f..c68ebe323 100644 --- a/views/default/css/elgg.php +++ b/views/default/css/elgg.php @@ -25,11 +25,13 @@ if ($old_css_view != elgg_get_config('viewpath')) { Base CSS * CSS reset + * core * helpers * grid *******************************************************************************/ echo elgg_view('css/elements/reset', $vars); +echo elgg_view('css/elements/core', $vars); echo elgg_view('css/elements/helpers', $vars); echo elgg_view('css/elements/grid', $vars); -- cgit v1.2.3 From ace72189a7f56fbba898ee1ccb52fd7eba80ae2e Mon Sep 17 00:00:00 2001 From: ewinslow Date: Sun, 10 Apr 2011 03:11:52 +0000 Subject: Refs #3182: Feeding language loading through /ajax/view to keep thing simpler for now. Reorganized boot process so that we can ajax load the languages asap git-svn-id: http://code.elgg.org/elgg/trunk@8976 36083f99-b078-4883-b0ff-0f9b5a30f544 --- js/lib/elgglib.js | 2 +- js/lib/languages.js | 8 ++------ views/default/js/elgg.php | 5 ----- views/default/js/initialize_elgg.php | 13 ++++++++++--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/js/lib/elgglib.js b/js/lib/elgglib.js index 5ba80fc06..f2545fb6c 100644 --- a/js/lib/elgglib.js +++ b/js/lib/elgglib.js @@ -379,4 +379,4 @@ elgg.getSelectorFromUrlFragment = function(url) { } } return ''; -} \ No newline at end of file +}; \ No newline at end of file diff --git a/js/lib/languages.js b/js/lib/languages.js index 0e3cf4472..28b82e2e9 100644 --- a/js/lib/languages.js +++ b/js/lib/languages.js @@ -25,12 +25,8 @@ elgg.add_translation = function(lang, translations) { */ elgg.reload_all_translations = function(language) { var lang = language || elgg.get_language(); - // This...................vvvvv is a double encoded question mark (? -> %2f -> %252f) - elgg.getJSON('js/languages%252f' + lang + '.js', { - data: { - 'viewtype': 'default', - 'lastcache': elgg.config.lastcache - }, + + elgg.getJSON('ajax/view/js/languages/' + lang, { success: function(json) { elgg.add_translation(lang, json); } diff --git a/views/default/js/elgg.php b/views/default/js/elgg.php index a434afc7d..76388f80c 100644 --- a/views/default/js/elgg.php +++ b/views/default/js/elgg.php @@ -57,11 +57,6 @@ elgg.release = ''; elgg.config.wwwroot = ''; elgg.security.interval = 5 * 60 * 1000; -//Mimic PHP engine boot process - -//Before the DOM is ready -- note that plugins aren't loaded yet -elgg.trigger_hook('boot', 'system'); - //After the DOM is ready $(function() { elgg.trigger_hook('init', 'system'); diff --git a/views/default/js/initialize_elgg.php b/views/default/js/initialize_elgg.php index 9032d8a63..cdadd4d32 100644 --- a/views/default/js/initialize_elgg.php +++ b/views/default/js/initialize_elgg.php @@ -1,6 +1,6 @@ @@ -8,11 +8,15 @@ * Don't want to cache these -- they could change for every request */ elgg.config.lastcache = ; +elgg.config.viewtype = ''; +elgg.config.simplecache_enabled = ; elgg.security.token.__elgg_ts = ; elgg.security.token.__elgg_token = ''; url? yes please! $page_owner = elgg_get_page_owner_entity(); if ($page_owner instanceof ElggEntity) { @@ -24,7 +28,7 @@ if ($page_owner instanceof ElggEntity) { $page_owner_json['subtype'] = $page_owner->getSubtype(); $page_owner_json['url'] = $page_owner->getURL(); - echo 'elgg.page_owner = '.json_encode($page_owner_json).';'; + echo 'elgg.page_owner = ' . json_encode($page_owner_json) . ';'; } $user = elgg_get_logged_in_user_entity(); @@ -38,6 +42,9 @@ if ($user instanceof ElggUser) { $user_json['subtype'] = $user->getSubtype(); $user_json['url'] = $user->getURL(); - echo 'elgg.session.user = new elgg.ElggUser('.json_encode($user_json).');'; + echo 'elgg.session.user = new elgg.ElggUser(' . json_encode($user_json) . ');'; } ?> + +//Before the DOM is ready, but elgg's js framework is fully initalized +elgg.trigger_hook('boot', 'system'); \ No newline at end of file -- cgit v1.2.3 From 21ccb999e304af2fa54b7fb6009199eec218d1d1 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Sun, 10 Apr 2011 03:37:47 +0000 Subject: Fixes #3182: No attempt to go through simplecache at all, but any language can be exported to js now without any extra effort on the part of language pack authors git-svn-id: http://code.elgg.org/elgg/trunk@8977 36083f99-b078-4883-b0ff-0f9b5a30f544 --- js/lib/languages.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/lib/languages.js b/js/lib/languages.js index 28b82e2e9..4cfe84968 100644 --- a/js/lib/languages.js +++ b/js/lib/languages.js @@ -26,7 +26,10 @@ elgg.add_translation = function(lang, translations) { elgg.reload_all_translations = function(language) { var lang = language || elgg.get_language(); - elgg.getJSON('ajax/view/js/languages/' + lang, { + elgg.getJSON('ajax/view/js/languages', { + data: { + language: lang + }, success: function(json) { elgg.add_translation(lang, json); } -- cgit v1.2.3 From 98f18b6fa309d6a68025699848a0dd5652ac75da Mon Sep 17 00:00:00 2001 From: ewinslow Date: Sun, 10 Apr 2011 03:48:40 +0000 Subject: Fixed #3313: Removed the superfluous html_head/extend view from core. Anyone following trunk should extend page/elements/head instead git-svn-id: http://code.elgg.org/elgg/trunk@8978 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/start.php | 2 +- views/default/page/elements/head.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mod/profile/start.php b/mod/profile/start.php index cc4c74fb2..d91b66371 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -29,7 +29,7 @@ function profile_init() { // Register a page handler, so we can have nice URLs elgg_register_page_handler('profile', 'profile_page_handler'); - elgg_extend_view('html_head/extend', 'profile/metatags'); + elgg_extend_view('page/elements/head', 'profile/metatags'); elgg_extend_view('css/elgg', 'profile/css'); elgg_extend_view('js/elgg', 'profile/js'); diff --git a/views/default/page/elements/head.php b/views/default/page/elements/head.php index 5f9bf4798..048edec40 100644 --- a/views/default/page/elements/head.php +++ b/views/default/page/elements/head.php @@ -70,7 +70,6 @@ echo $feedref; $metatags = elgg_view('metatags', $vars); if ($metatags) { - elgg_deprecated_notice("The metatags view has been deprecated for html_head/extend", 1.8); + elgg_deprecated_notice("The metatags view has been deprecated. Extend page/elements/head instead", 1.8); echo $metatags; -} -echo elgg_view('html_head/extend', $vars); +} \ No newline at end of file -- cgit v1.2.3 From b3807125e2c4d0c5bad39d5fab33228de7f5f65e Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 11 Apr 2011 11:43:03 +0000 Subject: Fixes #3322 file link removed from owner_block if disabled for a group git-svn-id: http://code.elgg.org/elgg/trunk@8979 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/file/start.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/file/start.php b/mod/file/start.php index 218edef51..d4f12e903 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -151,7 +151,7 @@ function file_owner_block_menu($hook, $type, $return, $params) { $item = new ElggMenuItem('file', elgg_echo('file'), $url); $return[] = $item; } else { - if ($params['entity']->files_enable != "no") { + if ($params['entity']->file_enable != "no") { $url = "file/group/{$params['entity']->guid}/owner"; $item = new ElggMenuItem('file', elgg_echo('file:group'), $url); $return[] = $item; -- cgit v1.2.3 From 7a1e89d93b5664bfa603fe92b7dcfd35f878fcdf Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 11 Apr 2011 11:51:27 +0000 Subject: Fixes #3325 added cursor: pointer to system messages in admin area git-svn-id: http://code.elgg.org/elgg/trunk@8980 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/css/admin.php | 1 + 1 file changed, 1 insertion(+) diff --git a/views/default/css/admin.php b/views/default/css/admin.php index d485108c4..b41649c06 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -223,6 +223,7 @@ table.mceLayout { padding: 10px; margin-bottom: 10px; border: 2px solid #ddd; + cursor: pointer; } /* *************************************** -- cgit v1.2.3 From 32cbcdfab7d677e54941ed2058cd34992d6529d2 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 11 Apr 2011 11:57:15 +0000 Subject: Fixes #3333 removed include of chrome css git-svn-id: http://code.elgg.org/elgg/trunk@8981 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/css/elgg.php | 1 - 1 file changed, 1 deletion(-) diff --git a/views/default/css/elgg.php b/views/default/css/elgg.php index c68ebe323..675af860d 100644 --- a/views/default/css/elgg.php +++ b/views/default/css/elgg.php @@ -51,7 +51,6 @@ Skin CSS *******************************************************************************/ echo elgg_view('css/elements/typography', $vars); -echo elgg_view('css/elements/chrome', $vars); echo elgg_view('css/elements/forms', $vars); echo elgg_view('css/elements/buttons', $vars); echo elgg_view('css/elements/icons', $vars); -- cgit v1.2.3 From 37881edcff91abd6426b72efaf07c73bd8f80bb1 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 11 Apr 2011 12:00:35 +0000 Subject: Fixes #3327 fixed typo git-svn-id: http://code.elgg.org/elgg/trunk@8982 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/lib/output.php b/engine/lib/output.php index 8c2a3d50d..3f35a1576 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -170,7 +170,7 @@ function elgg_format_attributes(array $attrs) { } // ignore $vars['entity'] => ElggEntity stuff - if (is_not_null($val) && (is_array($val) || !is_object($var))) { + if (is_not_null($val) && (is_array($val) || !is_object($val))) { // allow $vars['class'] => array('one', 'two'); // @todo what about $vars['style']? Needs to be semi-colon separated... -- cgit v1.2.3 From 833b994f3171ac511872b86fbd51e8314dbc023a Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 12 Apr 2011 20:27:01 +0000 Subject: Fixing JS problems when simple cache is disabled. git-svn-id: http://code.elgg.org/elgg/trunk@8983 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/js/initialize_elgg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/default/js/initialize_elgg.php b/views/default/js/initialize_elgg.php index cdadd4d32..09e0b27bc 100644 --- a/views/default/js/initialize_elgg.php +++ b/views/default/js/initialize_elgg.php @@ -9,7 +9,7 @@ */ elgg.config.lastcache = ; elgg.config.viewtype = ''; -elgg.config.simplecache_enabled = ; +elgg.config.simplecache_enabled = ; elgg.security.token.__elgg_ts = ; elgg.security.token.__elgg_token = ''; -- cgit v1.2.3 From bffcde9dfe570af9cd1c2315e31f13d6d0ebec8e Mon Sep 17 00:00:00 2001 From: cash Date: Tue, 12 Apr 2011 22:24:48 +0000 Subject: Fixes #3347 fixes comment typo for ege git-svn-id: http://code.elgg.org/elgg/trunk@8984 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 742630cc7..685c68a5b 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -740,7 +740,7 @@ function elgg_entity_exists($guid) { * type_subtype_pairs => NULL|ARR (array('type' => 'subtype')) * (type = '$type' AND subtype = '$subtype') pairs * - * entity_guids => NULL|ARR Array of entity guids + * guids => NULL|ARR Array of entity guids * * owner_guids => NULL|ARR Array of owner guids * -- cgit v1.2.3 From 388d8405bb10b3b2107629f8cd4133bff3a7693c Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 13 Apr 2011 14:39:21 +0000 Subject: Consolidated the css and js pagehandlers with elgg_cachable_view_pagehandler() and fixed for URLs with multiple dots after the last / (like /js/calendars/fullcalendar.min.123456789.js) git-svn-id: http://code.elgg.org/elgg/trunk@8985 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 76 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 23 deletions(-) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 1aef48ef4..063e25fc4 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1685,21 +1685,7 @@ function _elgg_shutdown_hook() { * @elgg_pagehandler js */ function elgg_js_page_handler($page) { - if (is_array($page) && sizeof($page)) { - $js = implode('/', $page); - $js = substr($js, 0, strpos($js, '.')); - $return = elgg_view('js/' . $js); - - header('Content-type: text/javascript'); - - // @todo should js be cached when simple cache turned off - //header('Expires: ' . date('r', time() + 864000)); - //header("Pragma: public"); - //header("Cache-Control: public"); - //header("Content-Length: " . strlen($return)); - - echo $return; - } + return elgg_cacheable_view_page_handler($page, 'js'); } /** @@ -1749,18 +1735,62 @@ function elgg_css_page_handler($page) { // default css $page[0] = 'elgg'; } + + return elgg_cacheable_view_page_handler($page, 'css'); +} + +/** + * Serves a JS or CSS view with headers for caching. + * + * //name/of/view.. + * + * @param array $page The page array + * @param string $type The type: js or css + * + * @return mixed + */ +function elgg_cacheable_view_page_handler($page, $type) { + + switch ($type) { + case 'js': + $content_type = 'text/javascript'; + break; + + case 'css': + $content_type = 'text/css'; + break; + + default: + return false; + break; + } + + if ($page) { + // the view file names can have multiple dots + // eg: views/default/js/calendars/jquery.fullcalendar.min.php + // translates to the url /js/calendars/jquery.fullcalendar.min..js + // and the view js/calendars/jquery.fullcalendar.min + // we ignore the last two dots for the ts and the ext. + $last_part = array_pop($page); + $last_part_bits = explode('.', $last_part); + $last_part_bits = array_slice($last_part_bits, 0, -2); + $page[] = implode('.', $last_part_bits); - $css = substr($page[0], 0, strpos($page[0], '.')); - $return = elgg_view("css/$css"); + $view = implode('/', $page); + $return = elgg_view("$type/$view"); + + header("Content-type: $content_type"); - header("Content-type: text/css", true); + // @todo should js be cached when simple cache turned off + //header('Expires: ' . date('r', time() + 864000)); + //header("Pragma: public"); + //header("Cache-Control: public"); + //header("Content-Length: " . strlen($return)); - // @todo should css be cached when simple cache is turned off - //header('Expires: ' . date('r', time() + 86400000), true); - //header("Pragma: public", true); - //header("Cache-Control: public", true); + echo $return; + } - echo $return; + return true; } /** -- cgit v1.2.3 From d87b6ffe7312888d109428e6a939f33394549677 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 13 Apr 2011 19:30:44 +0000 Subject: Fixes #3331. Changed cache schema to allow for JS/CSS views with slashes and dots. git-svn-id: http://code.elgg.org/elgg/trunk@8986 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/handlers/cache_handler.php | 15 +++++++++------ engine/lib/cache.php | 2 +- engine/lib/elgglib.php | 10 ++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/engine/handlers/cache_handler.php b/engine/handlers/cache_handler.php index 05c35171b..7d6f42dc3 100644 --- a/engine/handlers/cache_handler.php +++ b/engine/handlers/cache_handler.php @@ -3,7 +3,7 @@ * Cache handler. * * External access to cached CSS and JavaScript views. The cached file URLS - * should be of the form: cache//// where + * should be of the form: cache///.. where * type is either css or js, view is the name of the cached view, and * unique_id is an identifier that is updated every time the cache is flushed. * The simplest way to maintain a unique identifier is to use the lastcache @@ -50,13 +50,16 @@ if (!$request || !$simplecache_enabled) { echo 'Cache error: bad request'; exit; } -$request = explode('/', $request); +// testing showed regex to be marginally faster than array / string functions over 100000 reps +// it won't make a difference in real life and regex is easier to read. +// //.. +$regex = '|([^/]+)/([^/]+)/(.+)\.([^\.]+)\.([^.]+)$|'; +preg_match($regex, $request, $matches); -//cache//// -$type = $request[0]; -$view = $request[1]; -$viewtype = $request[2]; +$type = $matches[1]; +$viewtype = $matches[2]; +$view = $matches[3]; switch ($type) { case 'css': diff --git a/engine/lib/cache.php b/engine/lib/cache.php index d4888f9d9..8529ae7fa 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -166,7 +166,7 @@ function elgg_get_simplecache_url($type, $view) { if (elgg_is_simplecache_enabled()) { $viewtype = elgg_get_viewtype(); - $url = elgg_get_site_url() . "cache/$type/$view/$viewtype/$view.$lastcache.$type"; + $url = elgg_get_site_url() . "cache/$type/$viewtype/$view.$lastcache.$type"; } else { $url = elgg_get_site_url() . "$type/$view.$lastcache.$type"; } diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 063e25fc4..a800aca7a 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1771,12 +1771,10 @@ function elgg_cacheable_view_page_handler($page, $type) { // translates to the url /js/calendars/jquery.fullcalendar.min..js // and the view js/calendars/jquery.fullcalendar.min // we ignore the last two dots for the ts and the ext. - $last_part = array_pop($page); - $last_part_bits = explode('.', $last_part); - $last_part_bits = array_slice($last_part_bits, 0, -2); - $page[] = implode('.', $last_part_bits); - - $view = implode('/', $page); + $page = implode('/', $page); + $regex = '|(.+)\.([^\.]+)\.([^.]+)$|'; + preg_match($regex, $page, $matches); + $view = $matches[1]; $return = elgg_view("$type/$view"); header("Content-type: $content_type"); -- cgit v1.2.3 From 95a952861ec1d739dfde43ab6d08f466b2aacb0e Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 00:03:32 +0000 Subject: Checking that get_user_by_username() returned something in ElggUser constructor to prevent notice (hellekin) git-svn-id: http://code.elgg.org/elgg/trunk@8987 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggUser.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index 5c65a4d66..1af4cdc3a 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -59,9 +59,11 @@ class ElggUser extends ElggEntity // See if this is a username } else if (is_string($guid)) { - $guid = get_user_by_username($guid); - foreach ($guid->attributes as $key => $value) { - $this->attributes[$key] = $value; + $user = get_user_by_username($guid); + if ($user) { + foreach ($user->attributes as $key => $value) { + $this->attributes[$key] = $value; + } } // Is $guid is an ElggUser? Use a copy constructor -- cgit v1.2.3 From f8ef86cc4f16f5280ff3475715bc65d0e796cbeb Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 00:10:03 +0000 Subject: checking that PAM handlers have been registered for the policy being tested (hellekin) git-svn-id: http://code.elgg.org/elgg/trunk@8988 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPAM.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/classes/ElggPAM.php b/engine/classes/ElggPAM.php index 37436fba3..0681a909b 100644 --- a/engine/classes/ElggPAM.php +++ b/engine/classes/ElggPAM.php @@ -41,9 +41,14 @@ class ElggPAM { * @param array $credentials Credentials array dependant on policy type * @return bool */ - public function authenticate($credentials) { + public function authenticate($credentials = array()) { global $_PAM_HANDLERS; + if (!isset($_PAM_HANDLERS[$this->policy]) || + !is_array($_PAM_HANDLERS[$this->policy])) { + return false; + } + $authenticated = false; foreach ($_PAM_HANDLERS[$this->policy] as $k => $v) { -- cgit v1.2.3 From 57e0d0075d2490053ad7e879ebd6bf417c460c54 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 00:17:24 +0000 Subject: suppressing warnings in web services unit tests (hellekin) git-svn-id: http://code.elgg.org/elgg/trunk@8989 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/services/api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/tests/services/api.php b/engine/tests/services/api.php index 39951da1c..3d07c0bbb 100644 --- a/engine/tests/services/api.php +++ b/engine/tests/services/api.php @@ -19,7 +19,7 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest { // expose_function public function testExposeFunctionNoMethod() { try { - expose_function(); + @expose_function(); $this->assertTrue(FALSE); } catch (Exception $e) { $this->assertIsA($e, 'InvalidParameterException'); @@ -29,7 +29,7 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest { public function testExposeFunctionNoFunction() { try { - expose_function('test'); + @expose_function('test'); $this->assertTrue(FALSE); } catch (Exception $e) { $this->assertIsA($e, 'InvalidParameterException'); @@ -39,7 +39,7 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest { public function testExposeFunctionBadParameters() { try { - expose_function('test', 'test', 'BAD'); + @expose_function('test', 'test', 'BAD'); $this->assertTrue(FALSE); } catch (Exception $e) { $this->assertIsA($e, 'InvalidParameterException'); @@ -59,7 +59,7 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest { public function testExposeFunctionBadHttpMethod() { try { - expose_function('test', 'test', null, '', 'BAD'); + @expose_function('test', 'test', null, '', 'BAD'); $this->assertTrue(FALSE); } catch (Exception $e) { $this->assertIsA($e, 'InvalidParameterException'); -- cgit v1.2.3 From e9d468a10843ab5841ae7ad40eafba0ee0f1363e Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 00:25:29 +0000 Subject: making sure ElggEntity::getAnnotations() returns an array, check if temporary annotation exists before returning, and added a warning about annotating unsaved entities git-svn-id: http://code.elgg.org/elgg/trunk@8990 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggEntity.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index cfdaede71..31885ad25 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -717,6 +717,9 @@ abstract class ElggEntity extends ElggData implements * * @warning By default, annotations are private. * + * @warning Annotating an unsaved entity more than once with the same name + * will only save the last annotation. + * * @param string $name Annotation name * @param mixed $value Annotation value * @param int $access_id Access ID @@ -761,8 +764,10 @@ abstract class ElggEntity extends ElggData implements } return elgg_get_annotations($options); + } else if (isset($this->temp_annotations[$name])) { + return array($this->temp_annotations[$name]); } else { - return $this->temp_annotations[$name]; + return array(); } } -- cgit v1.2.3 From 75d7daa5c644090ba640565cb2b4e3d2412d64d5 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 00:35:04 +0000 Subject: fixed unit test broken by that last commit (we were returning a string from getAnnotations() when it is supposed to return an array) git-svn-id: http://code.elgg.org/elgg/trunk@8991 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/objects/entities.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php index ca3abb274..c04bc60ff 100644 --- a/engine/tests/objects/entities.php +++ b/engine/tests/objects/entities.php @@ -107,7 +107,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { // set and check temp annotation $this->assertTrue($this->entity->annotate('non_existent', 'testing')); - $this->assertIdentical($this->entity->getAnnotations('non_existent'), 'testing'); + $this->assertIdentical($this->entity->getAnnotations('non_existent'), array('testing')); $this->assertTrue(array_key_exists('non_existent', $this->entity->expose_annotations())); // save entity and check for annotation -- cgit v1.2.3 From 77f5fce955ecdd66782252c63c1b81e032bd0ee6 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 00:35:59 +0000 Subject: fixes warnings in ElggEntity::getMetadata() (hellekin) git-svn-id: http://code.elgg.org/elgg/trunk@8992 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggEntity.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 31885ad25..79b8c2a4e 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -246,18 +246,20 @@ abstract class ElggEntity extends ElggData implements * @return mixed The value, or NULL if not found. */ public function getMetaData($name) { - if ((int) ($this->guid) > 0) { - $md = elgg_get_metadata(array( - 'guid' => $this->getGUID(), - 'metadata_name' => $name, - 'limit' => 0, - )); - } else { + if ((int) ($this->guid) == 0) { if (isset($this->temp_metadata[$name])) { return $this->temp_metadata[$name]; + } else { + return null; } } + $md = elgg_get_metadata(array( + 'guid' => $this->getGUID(), + 'metadata_name' => $name, + 'limit' => 0, + )); + if ($md && !is_array($md)) { return $md->value; } elseif (count($md) == 1) { -- cgit v1.2.3 From e809367625ed4f9d05b5711791392c60d8fac69e Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 00:42:02 +0000 Subject: preventing warnings with the user password authorization pam (hellekin) git-svn-id: http://code.elgg.org/elgg/trunk@8993 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/sessions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php index 5d45cc73d..ae42956a9 100644 --- a/engine/lib/sessions.php +++ b/engine/lib/sessions.php @@ -155,9 +155,9 @@ function elgg_authenticate($username, $password) { * @return bool * @throws LoginException */ -function pam_auth_userpass($credentials = NULL) { +function pam_auth_userpass(array $credentials = array()) { - if (!is_array($credentials) || !isset($credentials['username']) || !isset($credentials['password'])) { + if (!isset($credentials['username']) || !isset($credentials['password'])) { return false; } -- cgit v1.2.3 From 3d49441f503b1a25f68f8d56fdfb5582bf96bf8b Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 01:26:40 +0000 Subject: handles empty array in get_metastring_id() (hellekin) git-svn-id: http://code.elgg.org/elgg/trunk@8994 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/metastrings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 47712d3fa..913d33a7d 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -75,7 +75,7 @@ function get_metastring_id($string, $case_sensitive = TRUE) { $ids[] = $metaString->id; } return $ids; - } else if ($metaStrings) { + } else if (isset($metaStrings[0])) { $row = $metaStrings[0]; } } -- cgit v1.2.3 From c38f617a9b4a8186574c64db6663b5582fd49acb Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 01:51:56 +0000 Subject: Fixes #3268 forwarding to referrer (fixed by ashwanthkumar) git-svn-id: http://code.elgg.org/elgg/trunk@8995 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/actions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 407b99f87..47e4dd4a4 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -113,7 +113,11 @@ function action($action, $forwarder = "") { register_error(elgg_echo('actionundefined', array($action))); } - forward($forwarder); + if (!empty($forwarder)) { + forward($forwarder); + } else { + forward(REFERER); + } } /** -- cgit v1.2.3 From 1437ba199925cec2ff0ceecb56f663e0f71f243a Mon Sep 17 00:00:00 2001 From: ewinslow Date: Thu, 14 Apr 2011 07:19:34 +0000 Subject: Fixes #3329: Added page/elements/foot and refactored page shells to use it git-svn-id: http://code.elgg.org/elgg/trunk@8996 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/page/admin.php | 11 +---------- views/default/page/default.php | 11 +---------- views/default/page/elements/foot.php | 11 +++++++++++ views/default/page/walled_garden.php | 2 +- 4 files changed, 14 insertions(+), 21 deletions(-) create mode 100644 views/default/page/elements/foot.php diff --git a/views/default/page/admin.php b/views/default/page/admin.php index d0e7915cc..2b2ec9e4a 100644 --- a/views/default/page/admin.php +++ b/views/default/page/admin.php @@ -55,16 +55,7 @@ if ($notices) { - - - + \ No newline at end of file diff --git a/views/default/page/default.php b/views/default/page/default.php index 77f79157b..9effce1ec 100644 --- a/views/default/page/default.php +++ b/views/default/page/default.php @@ -60,15 +60,6 @@ header("Content-type: text/html; charset=UTF-8"); - - - + \ No newline at end of file diff --git a/views/default/page/elements/foot.php b/views/default/page/elements/foot.php new file mode 100644 index 000000000..a56b373b4 --- /dev/null +++ b/views/default/page/elements/foot.php @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/views/default/page/walled_garden.php b/views/default/page/walled_garden.php index 662e90f45..95d17fcff 100644 --- a/views/default/page/walled_garden.php +++ b/views/default/page/walled_garden.php @@ -39,6 +39,6 @@ $title = $site->name;
- + \ No newline at end of file -- cgit v1.2.3 From 8cf8c5486e22b0d1c5ffb5caa60268016e42f27e Mon Sep 17 00:00:00 2001 From: ewinslow Date: Thu, 14 Apr 2011 07:26:01 +0000 Subject: Fixes #2972: Following elements have default clearfix: elgg-inner elgg-page-header elgg-page-footer elgg-foot elgg-head elgg-col elgg-image-block git-svn-id: http://code.elgg.org/elgg/trunk@8997 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/css/elements/core.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/views/default/css/elements/core.php b/views/default/css/elements/core.php index e99a11e13..c5d99512f 100644 --- a/views/default/css/elements/core.php +++ b/views/default/css/elements/core.php @@ -18,7 +18,14 @@ /* Clearfix */ .clearfix:after, .elgg-grid:after, -.elgg-layout:after { +.elgg-layout:after, +.elgg-inner:after, +.elgg-page-header:after, +.elgg-page-footer:after, +.elgg-head:after, +.elgg-foot:after, +.elgg-col:after, +.elgg-image-block:after { content: "."; display: block; height: 0; -- cgit v1.2.3 From 6f6f9abc3d45dc305ab8ea8dfd53f7f975982228 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 11:25:47 +0000 Subject: fixed filtering of external files array and suppressed warning in external files unit test git-svn-id: http://code.elgg.org/elgg/trunk@8998 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 2 +- engine/tests/api/helpers.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index a800aca7a..6c94133df 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -400,7 +400,7 @@ function elgg_get_loaded_external_files($type, $location) { if (isset($CONFIG->externals) && isset($CONFIG->externals[$type])) { $items = array_values($CONFIG->externals[$type]); - $callback = "return \$v->loaded == true && \$v->location == $location;"; + $callback = "return \$v->loaded == true && \$v->location == '$location';"; $items = array_filter($items, create_function('$v', $callback)); if ($items) { usort($items, create_function('$a,$b','return $a->priority >= $b->priority;')); diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index 1362b3c9d..461627547 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -109,7 +109,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $this->assertIdentical('http://test1.com', $CONFIG->externals['js']['key']->url); // send a bad url - $result = elgg_register_js(); + $result = @elgg_register_js('bad'); $this->assertFalse($result); } @@ -140,7 +140,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $result = elgg_unregister_js('id1'); $this->assertTrue($result); - $this->assertNULL($CONFIG->externals['js']['head']['id1']); + @$this->assertNULL($CONFIG->externals['js']['head']['id1']); $result = elgg_unregister_js('id1'); $this->assertFalse($result); -- cgit v1.2.3 From 842031dd358282f608c232094422cd281117c21f Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 14 Apr 2011 14:15:12 +0000 Subject: Refs #3023. Exposed item_class option in the menu item factory. Should we change 'class' to 'link_class' to avoid confusion? git-svn-id: http://code.elgg.org/elgg/trunk@8999 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggMenuItem.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 98a3d7d24..bf6cf2edc 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -127,6 +127,11 @@ class ElggMenuItem { $item->setLinkClass($options['class']); unset($options['class']); } + + if (isset($options['item_class'])) { + $item->setItemClass($options['item_class']); + unset($options['item_class']); + } foreach ($options as $key => $value) { $item->$key = $value; -- cgit v1.2.3 From e60d45a1e8025a10220a42285d3ff17335af5214 Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 14 Apr 2011 23:06:51 +0000 Subject: Refs #3195. Changed the way annotation calculations are performed. Seems to be working better, but will want to test more before closing. git-svn-id: http://code.elgg.org/elgg/trunk@9000 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/annotations.php | 41 +++++++++++++++++++++++++---------------- engine/lib/deprecated-1.8.php | 8 ++++---- engine/lib/metastrings.php | 12 +++++++++++- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 1178a079f..7a4e62921 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -386,21 +386,27 @@ function elgg_list_entities_from_annotations($options = array()) { } /** - * Get entities ordered by a mathematical calculation + * Get entities ordered by a mathematical calculation on annotation values + * + * @todo I think at some point this could run through elgg_get_annotations() and pass a the callback + * as entity_row_to_elggstar * * @param array $options An options array: - * 'calculation' => The calculation to use. Must be a valid MySQL function. - * Defaults to sum. Result selected as 'calculated'. - * 'order_by' => The order for the sorting. Defaults to 'calculated desc'. + * 'annotation_calculation' => The calculation to use. Must be a valid MySQL function. + * Defaults to sum. Result selected as 'annotation_calculation'. + * 'order_by' => The order for the sorting. Defaults to 'calculation desc'. + * 'annotation_names' => The names of annotations on the entity. + * 'annotation_values' => The values of annotations on the entity. + * + * 'metadata_names' => The name of metadata on the entity. + * 'metadata_values' => The value of metadata on the entitiy. * * @return mixed */ function elgg_get_entities_from_annotation_calculation($options) { - global $CONFIG; - $defaults = array( - 'calculation' => 'sum', - 'order_by' => 'calculated desc', + 'calculation' => 'sum', + 'order_by' => 'calculation desc' ); $options = array_merge($defaults, $options); @@ -408,17 +414,20 @@ function elgg_get_entities_from_annotation_calculation($options) { $function = sanitize_string(elgg_extract('calculation', $options, 'sum', false)); // you must cast this as an int or it sorts wrong. - $options['selects'][] = "$function(cast(msv.string as signed)) as calculated"; - $options['selects'][] = "msn.string as value"; - $options['order_by'] = 'calculated desc'; + $options['selects'][] = 'e.*'; + $options['selects'][] = "$function(cast(v.string as signed)) as calculation"; // need our own join to get the values. - $db_prefix = get_config('dbprefix'); - $options['joins'][] = "JOIN {$db_prefix}annotations calc_table on e.guid = calc_table.entity_guid"; - $options['joins'][] = "JOIN {$db_prefix}metastrings msv on calc_table.value_id = msv.id"; - $options['wheres'][] = "calc_table.name_id = n_table.name_id"; +// $options['joins'][] = "JOIN {$db_prefix}metastrings msv ON a.value_id = msv.id"; +// $options['joins'][] = "JOIN {$db_prefix}entities ae ON a.entity_guid = ae.guid"; + + $options['wheres'][] = get_access_sql_suffix('n_table'); +// $options['wheres'][] = "e.guid = a.entity_guid"; + $options['group_by'] = 'n_table.entity_guid'; + + $options['callback'] = 'entity_row_to_elggstar'; - return elgg_get_entities_from_annotations($options); + return elgg_get_annotations($options); } /** diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index 165546d31..27a973601 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -115,7 +115,7 @@ function get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = $options['limit'] = $limit; $options['offset'] = $offset; - $options['order_by'] = "calculated $orderdir"; + $options['order_by'] = "calculation $orderdir"; $options['count'] = $count; @@ -179,7 +179,7 @@ function get_entities_from_annotation_count($entity_type = "", $entity_subtype = $options['limit'] = $limit; $options['offset'] = $offset; - $options['order_by'] = "calculated $orderdir"; + $options['order_by'] = "calculation $orderdir"; $options['count'] = $count; @@ -241,7 +241,7 @@ function list_entities_from_annotation_count($entity_type = "", $entity_subtype $options['limit'] = $limit; - $options['order_by'] = "calculated $orderdir"; + $options['order_by'] = "calculation $orderdir"; return elgg_get_entities_from_annotation_calculation($options); } @@ -3492,7 +3492,7 @@ $asc = false, $fullview = true, $listtypetoggle = false, $pagination = true, $or $options['limit'] = $limit; - $options['order_by'] = "calculated $orderdir"; + $options['order_by'] = "calculation $orderdir"; return elgg_get_entities_from_annotation_calculation($options); } diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 913d33a7d..604c7f765 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -406,8 +406,18 @@ function elgg_get_metastring_based_objects($options) { } if ($options['metastring_calculation'] === ELGG_ENTITIES_NO_VALUE) { + // evalutate selects + if ($options['selects']) { + $selects = ''; + foreach ($options['selects'] as $select) { + $selects .= ", $select"; + } + } else { + $selects = ''; + } + $query = "SELECT DISTINCT n_table.*, n.string as name, - v.string as value FROM {$db_prefix}$type n_table"; + v.string as value{$selects} FROM {$db_prefix}$type n_table"; } else { $query = "SELECT {$options['metastring_calculation']}(v.string) as calculation FROM {$db_prefix}$type n_table"; } -- cgit v1.2.3 From 2b2afd98c05139c1a5c25f1752e2bb412e26e335 Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 14 Apr 2011 23:49:43 +0000 Subject: Fixed problem with list_entities_from_metadata() wrapper. git-svn-id: http://code.elgg.org/elgg/trunk@9001 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/deprecated-1.8.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index 27a973601..bb52881cd 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -1152,10 +1152,22 @@ function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type $offset = (int)get_input('offset'); $limit = (int)$limit; - $options = array('metadata_name' => $meta_name, 'metadata_value' => $meta_value, - 'types' => $entity_type, 'subtypes' => $entity_subtype, 'owner_guid' => $owner_guid, - 'limit' => $limit, 'offset' => $offset, 'count' => TRUE, - 'metadata_case_sensitive' => $case_sensitive); + $options = array( + 'metadata_name' => $meta_name, + 'metadata_value' => $meta_value, + 'types' => $entity_type, + 'subtypes' => $entity_subtype, + 'limit' => $limit, + 'offset' => $offset, + 'count' => TRUE, + 'metadata_case_sensitive' => $case_sensitive + ); + + // previous function allowed falsy $owner_guid for anything + if ($owner_guid) { + $options['owner_guid'] = $owner_guid; + } + $count = elgg_get_entities_from_metadata($options); $options['count'] = FALSE; -- cgit v1.2.3