From a6846beb2f74aa38215b09a6a6dc18b912446bba Mon Sep 17 00:00:00 2001
From: Richard Loxley
Date: Wed, 27 Jul 2011 16:30:28 +0100
Subject: Fixes Ticket #3709 "Embed plugin: uploading a file in Firefox tries
to save a JSON file in the user's browser"
---
engine/lib/actions.php | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
(limited to 'engine/lib')
diff --git a/engine/lib/actions.php b/engine/lib/actions.php
index 4ccffd267..99e22e104 100644
--- a/engine/lib/actions.php
+++ b/engine/lib/actions.php
@@ -446,7 +446,17 @@ function ajax_forward_hook($hook, $type, $reason, $params) {
$params['status'] = -1;
}
- header("Content-type: application/json");
+ // Check the requester can accept JSON responses, if not fall back to
+ // returning JSON in a plain-text response. Some libraries request
+ // JSON in an invisible iframe which they then read from the iframe,
+ // however some browsers will not accept the JSON MIME type.
+ if (stripos($_SERVER['HTTP_ACCEPT'], 'application/json') === FALSE) {
+ header("Content-type: text/plain");
+ }
+ else {
+ header("Content-type: application/json");
+ }
+
echo json_encode($params);
exit;
}
--
cgit v1.2.3
From 79bc4476464e53d38a36f59f9a438f7592215951 Mon Sep 17 00:00:00 2001
From: Brett Profitt
Date: Thu, 25 Aug 2011 15:48:11 -0700
Subject: Fixes #3535. elgg_view_form() automatically adds
elgg-form-action-name.
---
engine/lib/views.php | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
(limited to 'engine/lib')
diff --git a/engine/lib/views.php b/engine/lib/views.php
index fe3265347..68c1badbc 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -1224,6 +1224,9 @@ function elgg_view_river_item($item, array $vars = array()) {
* sets the action by default to "action/$action". Automatically wraps the forms/$action
* view with a
';
+$unit_tests .= '' . elgg_echo('diagnostics:unittester:warning') . '
';
+
+if (elgg_get_config('debug')) {
+ // create a button to run tests
+ $params = array(
+ 'text' => elgg_echo('diagnostics:test:executeall'),
+ 'href' => 'engine/tests/suite.php',
+ 'class' => 'elgg-button elgg-button-submit',
+ );
+ $unit_tests .= '' . elgg_view('output/url', $params) . '
';
+} else {
+ // no tests when not in debug mode
+ $unit_tests .= elgg_echo('diagnostics:unittester:debug');
+}
+
+// display admin body
+echo elgg_view_module('inline', $diagnostics_title, $diagnostics);
+echo elgg_view_module('inline', $unit_tests_title, $unit_tests);
diff --git a/mod/diagnostics/views/default/admin/utilities/diagnostics.php b/mod/diagnostics/views/default/admin/utilities/diagnostics.php
deleted file mode 100644
index 76f12b0ae..000000000
--- a/mod/diagnostics/views/default/admin/utilities/diagnostics.php
+++ /dev/null
@@ -1,30 +0,0 @@
-' . elgg_echo('diagnostics:unittester:description') . '';
-$unit_tests .= '' . elgg_echo('diagnostics:unittester:warning') . '
';
-
-if (elgg_get_config('debug')) {
- // create a button to run tests
- $params = array(
- 'text' => elgg_echo('diagnostics:test:executeall'),
- 'href' => 'engine/tests/suite.php',
- 'class' => 'elgg-button elgg-button-submit',
- );
- $unit_tests .= '' . elgg_view('output/url', $params) . '
';
-} else {
- // no tests when not in debug mode
- $unit_tests .= elgg_echo('diagnostics:unittester:debug');
-}
-
-// display admin body
-echo elgg_view_module('inline', $diagnostics_title, $diagnostics);
-echo elgg_view_module('inline', $unit_tests_title, $unit_tests);
diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php
index 90689a1b0..3b6ead272 100644
--- a/mod/logbrowser/languages/en.php
+++ b/mod/logbrowser/languages/en.php
@@ -6,7 +6,7 @@
*/
$english = array(
- 'admin:utilities:logbrowser' => 'Log browser',
+ 'admin:administer_utilities:logbrowser' => 'Log browser',
'logbrowser' => 'Log browser',
'logbrowser:browse' => 'Browse system log',
'logbrowser:search' => 'Refine results',
diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php
index 71b6115a5..3bffe800a 100644
--- a/mod/logbrowser/start.php
+++ b/mod/logbrowser/start.php
@@ -14,7 +14,7 @@ function logbrowser_init() {
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'logbrowser_user_hover_menu');
- elgg_register_admin_menu_item('administer', 'logbrowser', 'utilities');
+ elgg_register_admin_menu_item('administer', 'logbrowser', 'administer_utilities');
}
/**
diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
new file mode 100644
index 000000000..dadc6cda3
--- /dev/null
+++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php
@@ -0,0 +1,63 @@
+guid;
+ }
+} else {
+ $user_guid = get_input('user_guid',0);
+ if ($user_guid) {
+ $user = (int) $user_guid;
+ } else {
+ $user = "";
+ }
+}
+
+$timelower = get_input('timelower');
+if ($timelower) {
+ $timelower = strtotime($timelower);
+}
+
+$timeupper = get_input('timeupper');
+if ($timeupper) {
+ $timeupper = strtotime($timeupper);
+}
+
+$form = elgg_view('logbrowser/form', array(
+ 'user_guid' => $user,
+ 'timeupper' => $timeupper,
+ 'timelower' => $timelower,
+));
+
+// Get log entries
+$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
+$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
+
+$table = elgg_view('logbrowser/table', array('log_entries' => $log));
+
+$nav = elgg_view('navigation/pagination',array(
+ 'offset' => $offset,
+ 'count' => $count,
+ 'limit' => $limit,
+));
+
+// display admin body
+$body = <<<__HTML
+$form
+$nav
+$table
+$nav
+__HTML;
+
+echo $body;
diff --git a/mod/logbrowser/views/default/admin/utilities/logbrowser.php b/mod/logbrowser/views/default/admin/utilities/logbrowser.php
deleted file mode 100644
index dadc6cda3..000000000
--- a/mod/logbrowser/views/default/admin/utilities/logbrowser.php
+++ /dev/null
@@ -1,63 +0,0 @@
-guid;
- }
-} else {
- $user_guid = get_input('user_guid',0);
- if ($user_guid) {
- $user = (int) $user_guid;
- } else {
- $user = "";
- }
-}
-
-$timelower = get_input('timelower');
-if ($timelower) {
- $timelower = strtotime($timelower);
-}
-
-$timeupper = get_input('timeupper');
-if ($timeupper) {
- $timeupper = strtotime($timeupper);
-}
-
-$form = elgg_view('logbrowser/form', array(
- 'user_guid' => $user,
- 'timeupper' => $timeupper,
- 'timelower' => $timelower,
-));
-
-// Get log entries
-$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
-$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
-
-$table = elgg_view('logbrowser/table', array('log_entries' => $log));
-
-$nav = elgg_view('navigation/pagination',array(
- 'offset' => $offset,
- 'count' => $count,
- 'limit' => $limit,
-));
-
-// display admin body
-$body = <<<__HTML
-$form
-$nav
-$table
-$nav
-__HTML;
-
-echo $body;
diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php
index c047644e3..c2e197879 100644
--- a/mod/reportedcontent/languages/en.php
+++ b/mod/reportedcontent/languages/en.php
@@ -8,7 +8,7 @@
$english = array(
'item:object:reported_content' => 'Reported items',
- 'admin:utilities:reportedcontent' => 'Reported content',
+ 'admin:administer_utilities:reportedcontent' => 'Reported content',
'reportedcontent' => 'Reported content',
'reportedcontent:this' => 'Report this',
'reportedcontent:this:tooltip' => 'Report this page to an administrator',
diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php
index 87b4b3c7b..66a1248d9 100644
--- a/mod/reportedcontent/start.php
+++ b/mod/reportedcontent/start.php
@@ -39,7 +39,7 @@ function reportedcontent_init() {
// Add admin menu item
// @todo Might want to move this to a 'feedback' section. something other than utils
- elgg_register_admin_menu_item('administer', 'reportedcontent', 'utilities');
+ elgg_register_admin_menu_item('administer', 'reportedcontent', 'administer_utilities');
elgg_register_widget_type(
'reportedcontent',
diff --git a/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php
new file mode 100644
index 000000000..32f108312
--- /dev/null
+++ b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php
@@ -0,0 +1,13 @@
+ 'object', 'subtypes' => 'reported_content'));
+if (!$list) {
+ $list = '' . elgg_echo('reportedcontent:none') . '
';
+}
+
+echo $list;
\ No newline at end of file
diff --git a/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php b/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php
deleted file mode 100644
index 32f108312..000000000
--- a/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php
+++ /dev/null
@@ -1,13 +0,0 @@
- 'object', 'subtypes' => 'reported_content'));
-if (!$list) {
- $list = '' . elgg_echo('reportedcontent:none') . '
';
-}
-
-echo $list;
\ No newline at end of file
--
cgit v1.2.3
From 6fab3ed243d3e2688916dcb65141e37bef1cc4c3 Mon Sep 17 00:00:00 2001
From: cash
Date: Thu, 15 Sep 2011 21:21:14 -0400
Subject: Fixes #3178 updated elgg_view_icon() to take an optional class
---
engine/lib/views.php | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
(limited to 'engine/lib')
diff --git a/engine/lib/views.php b/engine/lib/views.php
index 0646851f0..2f1661e83 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -1308,15 +1308,16 @@ function elgg_view_list_item($item, array $vars = array()) {
* Shorthand for
*
* @param string $name The specific icon to display
- * @param bool $float Whether to float the icon
+ * @param string $class Additional class: float, float-alt, or custom class
*
* @return string The html for displaying an icon
*/
-function elgg_view_icon($name, $float = false) {
- if ($float) {
- $float = 'float';
+function elgg_view_icon($name, $class = '') {
+ // @todo deprecate boolean in Elgg 1.9
+ if (is_bool($class) && $class === true) {
+ $class = 'float';
}
- return "";
+ return "";
}
/**
--
cgit v1.2.3
From 6e8ab94aa23f13b62727d3af42fc012c8eefef9a Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Mon, 19 Sep 2011 15:29:44 -0400
Subject: don't generate false internalid deprecation notices:
http://trac.elgg.org/ticket/2921#comment:3
---
engine/lib/views.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
(limited to 'engine/lib')
diff --git a/engine/lib/views.php b/engine/lib/views.php
index 2f1661e83..f6e5aa6b8 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -411,19 +411,25 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie
}
// internalname => name (1.8)
- if (isset($vars['internalname']) && !isset($vars['name'])) {
+ if (isset($vars['internalname']) && !isset($vars['__ignoreInternalname']) && !isset($vars['name'])) {
elgg_deprecated_notice('You should pass $vars[\'name\'] now instead of $vars[\'internalname\']', 1.8, 2);
$vars['name'] = $vars['internalname'];
$test=false;
} elseif (isset($vars['name'])) {
+ if (!isset($vars['internalname'])) {
+ $vars['__ignoreInternalname'] = '';
+ }
$vars['internalname'] = $vars['name'];
}
// internalid => id (1.8)
- if (isset($vars['internalid']) && !isset($vars['name'])) {
+ if (isset($vars['internalid']) && !isset($vars['__ignoreInternalid']) && !isset($vars['name'])) {
elgg_deprecated_notice('You should pass $vars[\'id\'] now instead of $vars[\'internalid\']', 1.8, 2);
$vars['id'] = $vars['internalid'];
} elseif (isset($vars['id'])) {
+ if (!isset($vars['internalid'])) {
+ $vars['__ignoreInternalid'] = '';
+ }
$vars['internalid'] = $vars['id'];
}
--
cgit v1.2.3
From a6805f3f58caecdeb6e149a9da292937e21ea2e5 Mon Sep 17 00:00:00 2001
From: Cash Costello
Date: Thu, 22 Sep 2011 08:40:09 -0400
Subject: Fixes #3834 not loading version.php hundreds of times - thanks to
srokap
---
engine/lib/upgrade.php | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
(limited to 'engine/lib')
diff --git a/engine/lib/upgrade.php b/engine/lib/upgrade.php
index dc3911062..dc1213187 100644
--- a/engine/lib/upgrade.php
+++ b/engine/lib/upgrade.php
@@ -160,7 +160,7 @@ function elgg_get_upgrade_files($upgrade_path = null) {
}
/**
- * Get the current version information
+ * Get the current Elgg version information
*
* @param bool $humanreadable Whether to return a human readable version (default: false)
*
@@ -169,13 +169,18 @@ function elgg_get_upgrade_files($upgrade_path = null) {
function get_version($humanreadable = false) {
global $CONFIG;
+ static $version, $release;
+
if (isset($CONFIG->path)) {
- if (include($CONFIG->path . "version.php")) {
- return (!$humanreadable) ? $version : $release;
+ if (!isset($version) || !isset($release)) {
+ if (!include($CONFIG->path . "version.php")) {
+ return false;
+ }
}
+ return (!$humanreadable) ? $version : $release;
}
- return FALSE;
+ return false;
}
/**
--
cgit v1.2.3
From d9d3cc65e96c54332f22f90ac17b014dfe183ddf Mon Sep 17 00:00:00 2001
From: cash
Date: Sat, 24 Sep 2011 17:29:41 -0400
Subject: Fixes #3828 correct list classes
---
engine/lib/deprecated-1.8.php | 2 +-
engine/lib/river.php | 2 +-
engine/lib/views.php | 2 +-
mod/likes/views/default/likes/count.php | 9 +++++++--
mod/likes/views/default/likes/css.php | 2 +-
mod/likes/views/default/likes/js.php | 2 +-
mod/messageboard/views/default/messageboard/js.php | 2 +-
views/default/css/elements/components.php | 4 ++--
8 files changed, 15 insertions(+), 10 deletions(-)
(limited to 'engine/lib')
diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php
index f0f4bd9dc..beba7d2b7 100644
--- a/engine/lib/deprecated-1.8.php
+++ b/engine/lib/deprecated-1.8.php
@@ -2424,7 +2424,7 @@ $posted_max = 0, $pagination = true) {
'offset' => $offset,
'limit' => $limit,
'pagination' => $pagination,
- 'list-class' => 'elgg-river-list',
+ 'list-class' => 'elgg-list-river',
);
return elgg_view('page/components/list', $params);
diff --git a/engine/lib/river.php b/engine/lib/river.php
index 64ddcfdc1..a11e6145c 100644
--- a/engine/lib/river.php
+++ b/engine/lib/river.php
@@ -378,7 +378,7 @@ function elgg_list_river(array $options = array()) {
'offset' => (int) max(get_input('offset', 0), 0),
'limit' => (int) max(get_input('limit', 20), 0),
'pagination' => TRUE,
- 'list_class' => 'elgg-river',
+ 'list_class' => 'elgg-list-river elgg-river', // @todo remove elgg-river in Elgg 1.9
);
$options = array_merge($defaults, $options);
diff --git a/engine/lib/views.php b/engine/lib/views.php
index f6e5aa6b8..9a236508f 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -1044,7 +1044,7 @@ $list_type_toggle = true, $pagination = true) {
function elgg_view_annotation_list($annotations, array $vars = array()) {
$defaults = array(
'items' => $annotations,
- 'list_class' => 'elgg-annotation-list',
+ 'list_class' => 'elgg-list-annotation elgg-annotation-list', // @todo remove elgg-annotation-list in Elgg 1.9
'full_view' => true,
'offset_key' => 'annoff',
);
diff --git a/mod/likes/views/default/likes/count.php b/mod/likes/views/default/likes/count.php
index bdc50bcd1..071a069bd 100644
--- a/mod/likes/views/default/likes/count.php
+++ b/mod/likes/views/default/likes/count.php
@@ -24,8 +24,13 @@ if ($num_of_likes) {
'href' => "#likes-$guid"
);
$list = elgg_view('output/url', $params);
- $list .= "