From ef23a0d09b76f7e78262d3428fd109cf82594537 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 10 Nov 2011 21:45:55 -0500 Subject: fixed WSOD when trying to edit a private page --- languages/en.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'languages') diff --git a/languages/en.php b/languages/en.php index 6aa292e5a..62effb334 100644 --- a/languages/en.php +++ b/languages/en.php @@ -237,6 +237,8 @@ $english = array( 'pageownerunavailable' => 'Warning: The page owner %d is not accessible!', 'viewfailure' => 'There was an internal failure in the view %s', 'changebookmark' => 'Please change your bookmark for this page', + 'noaccess' => 'This content has been removed, is invalid, or you do not have permission to view it.', + /** * API */ -- cgit v1.2.3 From ad161cd2bd5122c6a2adf65c5b8683d42f28b005 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 22:32:01 -0500 Subject: made status message a little more grammatical --- languages/en.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'languages') diff --git a/languages/en.php b/languages/en.php index 62effb334..5964580ad 100644 --- a/languages/en.php +++ b/languages/en.php @@ -1038,7 +1038,7 @@ Once you have logged in, we highly recommend that you change your password. 'email:settings' => "Email settings", 'email:address:label' => "Your email address", - 'email:save:success' => "New email address saved, verification requested.", + 'email:save:success' => "New email address saved. Verification is requested.", 'email:save:fail' => "Your new email address could not be saved.", 'friend:newfriend:subject' => "%s has made you a friend!", -- cgit v1.2.3 From 75c00c55dd9cc2de4d97f829d9b47c99eb4ba287 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 22:40:04 -0500 Subject: Fixes #3792 admin can edit settings again --- engine/lib/user_settings.php | 4 ++-- engine/lib/users.php | 5 +++++ languages/en.php | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'languages') diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index 1e2d6db10..c71670357 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -265,8 +265,8 @@ function elgg_set_user_default_access() { * @access private */ function usersettings_pagesetup() { - if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) { - $user = elgg_get_logged_in_user_entity(); + if (elgg_get_context() == "settings") { + $user = elgg_get_page_owner_entity(); $params = array( 'name' => '1_account', diff --git a/engine/lib/users.php b/engine/lib/users.php index 29fa4db2f..3a86c1faa 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1283,6 +1283,11 @@ function elgg_user_hover_menu($hook, $type, $return, $params) { $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url); $item->setSection('admin'); $return[] = $item; + + $url = "settings/user/$user->username"; + $item = new ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url); + $item->setSection('admin'); + $return[] = $item; } return $return; diff --git a/languages/en.php b/languages/en.php index 5964580ad..af97e112d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -481,6 +481,7 @@ $english = array( 'account' => "Account", 'settings' => "Settings", 'tools' => "Tools", + 'settings:edit' => 'Edit settings', 'register' => "Register", 'registerok' => "You have successfully registered for %s.", -- cgit v1.2.3 From 7cc4c3139d8d75335bd7e9b21d99257ff8d3cc72 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 19 Nov 2011 07:45:33 -0500 Subject: Fixes #641 users can submit email address to reset password --- actions/login.php | 1 - actions/user/requestnewpassword.php | 5 +++++ languages/en.php | 10 +++++----- views/default/forms/user/requestnewpassword.php | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) (limited to 'languages') diff --git a/actions/login.php b/actions/login.php index 5934d1423..c717faadd 100644 --- a/actions/login.php +++ b/actions/login.php @@ -28,7 +28,6 @@ if (empty($username) || empty($password)) { } // check if logging in with email address -// @todo Are usernames with @ not allowed? if (strpos($username, '@') !== FALSE && ($users = get_user_by_email($username))) { $username = $users[0]->username; } diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php index 5dfa24952..f1d4fa43c 100644 --- a/actions/user/requestnewpassword.php +++ b/actions/user/requestnewpassword.php @@ -8,6 +8,11 @@ $username = get_input('username'); +// allow email addresses +if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) { + $username = $users[0]->username; +} + $user = get_user_by_username($username); if ($user) { if (send_new_password_request($user->guid)) { diff --git a/languages/en.php b/languages/en.php index af97e112d..1576ed73d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -20,7 +20,7 @@ $english = array( 'login' => "Log in", 'loginok' => "You have been logged in.", 'loginerror' => "We couldn't log you in. Please check your credentials and try again.", - 'login:empty' => "Username and password are required.", + 'login:empty' => "Username/email and password are required.", 'login:baduser' => "Unable to load your user account.", 'auth:nopams' => "Internal error. No user authentication method installed.", @@ -222,8 +222,8 @@ $english = array( 'RegistrationException:EmptyPassword' => 'The password fields cannot be empty', 'RegistrationException:PasswordMismatch' => 'Passwords must match', 'LoginException:BannedUser' => 'You have been banned from this site and cannot log in', - 'LoginException:UsernameFailure' => 'We could not log you in. Please check your username and password.', - 'LoginException:PasswordFailure' => 'We could not log you in. Please check your username and password.', + 'LoginException:UsernameFailure' => 'We could not log you in. Please check your username/email and password.', + 'LoginException:PasswordFailure' => 'We could not log you in. Please check your username/email and password.', 'LoginException:AccountLocked' => 'Your account has been locked for too many log in failures.', 'LoginException:ChangePasswordFailure' => 'Failed current password check.', @@ -531,7 +531,7 @@ $english = array( 'user:password:resetreq:success' => 'Successfully requested a new password, email sent', 'user:password:resetreq:fail' => 'Could not request a new password.', - 'user:password:text' => 'To request a new password, enter your username below and click the Request button.', + 'user:password:text' => 'To request a new password, enter your username or email address below and click the Request button.', 'user:persistent' => 'Remember me', @@ -1064,7 +1064,7 @@ Your password has been reset to: %s", Somebody (from the IP address %s) has requested a new password for their account. -If you requested this click on the link below, otherwise ignore this email. +If you requested this, click on the link below. Otherwise ignore this email. %s ", diff --git a/views/default/forms/user/requestnewpassword.php b/views/default/forms/user/requestnewpassword.php index 8a5a18734..c90971eaf 100644 --- a/views/default/forms/user/requestnewpassword.php +++ b/views/default/forms/user/requestnewpassword.php @@ -11,7 +11,7 @@
-
+
'username', 'class' => 'elgg-autofocus', -- cgit v1.2.3 From 3d9b7cc539d390043f1c28d1776dc97e591f5d87 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 25 Nov 2011 13:49:17 -0500 Subject: added a better message for php libraries that don't exist on disk --- engine/lib/elgglib.php | 5 ++++- languages/en.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'languages') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 08b346960..57d602450 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -107,7 +107,10 @@ function elgg_load_library($name) { } if (!include_once($CONFIG->libraries[$name])) { - $error = elgg_echo('InvalidParameterException:LibraryNotRegistered', array($name)); + $error = elgg_echo('InvalidParameterException:LibraryNotFound', array( + $name, + $CONFIG->libraries[$name]) + ); throw new InvalidParameterException($error); } } diff --git a/languages/en.php b/languages/en.php index 1576ed73d..036ca8883 100644 --- a/languages/en.php +++ b/languages/en.php @@ -167,6 +167,7 @@ $english = array( 'InvalidParameterException:DoesNotBelongOrRefer' => "Does not belong to entity or refer to entity.", 'InvalidParameterException:MissingParameter' => "Missing parameter, you need to provide a GUID.", 'InvalidParameterException:LibraryNotRegistered' => '%s is not a registered library', + 'InvalidParameterException:LibraryNotFound' => 'Could not load the %s library from %s', 'APIException:ApiResultUnknown' => "API Result is of an unknown type, this should never happen.", 'ConfigurationException:NoSiteID' => "No site ID has been specified.", -- cgit v1.2.3 From d1eb0c95aff69a20aecf837c0cedcbfe481706cd Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 22:32:01 -0500 Subject: made status message a little more grammatical --- languages/en.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'languages') diff --git a/languages/en.php b/languages/en.php index 62effb334..5964580ad 100644 --- a/languages/en.php +++ b/languages/en.php @@ -1038,7 +1038,7 @@ Once you have logged in, we highly recommend that you change your password. 'email:settings' => "Email settings", 'email:address:label' => "Your email address", - 'email:save:success' => "New email address saved, verification requested.", + 'email:save:success' => "New email address saved. Verification is requested.", 'email:save:fail' => "Your new email address could not be saved.", 'friend:newfriend:subject' => "%s has made you a friend!", -- cgit v1.2.3 From 268b33d5338ec2e4da9a0a3c81a8917ce1bfda60 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 22:40:04 -0500 Subject: Fixes #3792 admin can edit settings again --- engine/lib/user_settings.php | 4 ++-- engine/lib/users.php | 5 +++++ languages/en.php | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'languages') diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index 1e2d6db10..c71670357 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -265,8 +265,8 @@ function elgg_set_user_default_access() { * @access private */ function usersettings_pagesetup() { - if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) { - $user = elgg_get_logged_in_user_entity(); + if (elgg_get_context() == "settings") { + $user = elgg_get_page_owner_entity(); $params = array( 'name' => '1_account', diff --git a/engine/lib/users.php b/engine/lib/users.php index 29fa4db2f..3a86c1faa 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1283,6 +1283,11 @@ function elgg_user_hover_menu($hook, $type, $return, $params) { $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url); $item->setSection('admin'); $return[] = $item; + + $url = "settings/user/$user->username"; + $item = new ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url); + $item->setSection('admin'); + $return[] = $item; } return $return; diff --git a/languages/en.php b/languages/en.php index 5964580ad..af97e112d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -481,6 +481,7 @@ $english = array( 'account' => "Account", 'settings' => "Settings", 'tools' => "Tools", + 'settings:edit' => 'Edit settings', 'register' => "Register", 'registerok' => "You have successfully registered for %s.", -- cgit v1.2.3 From 4f1c656f51bacaa5c9e3e0550cf0cfb3422f879f Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 19 Nov 2011 07:45:33 -0500 Subject: Fixes #641 users can submit email address to reset password --- actions/login.php | 1 - actions/user/requestnewpassword.php | 5 +++++ languages/en.php | 10 +++++----- views/default/forms/user/requestnewpassword.php | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) (limited to 'languages') diff --git a/actions/login.php b/actions/login.php index 5934d1423..c717faadd 100644 --- a/actions/login.php +++ b/actions/login.php @@ -28,7 +28,6 @@ if (empty($username) || empty($password)) { } // check if logging in with email address -// @todo Are usernames with @ not allowed? if (strpos($username, '@') !== FALSE && ($users = get_user_by_email($username))) { $username = $users[0]->username; } diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php index 5dfa24952..f1d4fa43c 100644 --- a/actions/user/requestnewpassword.php +++ b/actions/user/requestnewpassword.php @@ -8,6 +8,11 @@ $username = get_input('username'); +// allow email addresses +if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) { + $username = $users[0]->username; +} + $user = get_user_by_username($username); if ($user) { if (send_new_password_request($user->guid)) { diff --git a/languages/en.php b/languages/en.php index af97e112d..1576ed73d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -20,7 +20,7 @@ $english = array( 'login' => "Log in", 'loginok' => "You have been logged in.", 'loginerror' => "We couldn't log you in. Please check your credentials and try again.", - 'login:empty' => "Username and password are required.", + 'login:empty' => "Username/email and password are required.", 'login:baduser' => "Unable to load your user account.", 'auth:nopams' => "Internal error. No user authentication method installed.", @@ -222,8 +222,8 @@ $english = array( 'RegistrationException:EmptyPassword' => 'The password fields cannot be empty', 'RegistrationException:PasswordMismatch' => 'Passwords must match', 'LoginException:BannedUser' => 'You have been banned from this site and cannot log in', - 'LoginException:UsernameFailure' => 'We could not log you in. Please check your username and password.', - 'LoginException:PasswordFailure' => 'We could not log you in. Please check your username and password.', + 'LoginException:UsernameFailure' => 'We could not log you in. Please check your username/email and password.', + 'LoginException:PasswordFailure' => 'We could not log you in. Please check your username/email and password.', 'LoginException:AccountLocked' => 'Your account has been locked for too many log in failures.', 'LoginException:ChangePasswordFailure' => 'Failed current password check.', @@ -531,7 +531,7 @@ $english = array( 'user:password:resetreq:success' => 'Successfully requested a new password, email sent', 'user:password:resetreq:fail' => 'Could not request a new password.', - 'user:password:text' => 'To request a new password, enter your username below and click the Request button.', + 'user:password:text' => 'To request a new password, enter your username or email address below and click the Request button.', 'user:persistent' => 'Remember me', @@ -1064,7 +1064,7 @@ Your password has been reset to: %s", Somebody (from the IP address %s) has requested a new password for their account. -If you requested this click on the link below, otherwise ignore this email. +If you requested this, click on the link below. Otherwise ignore this email. %s ", diff --git a/views/default/forms/user/requestnewpassword.php b/views/default/forms/user/requestnewpassword.php index 8a5a18734..c90971eaf 100644 --- a/views/default/forms/user/requestnewpassword.php +++ b/views/default/forms/user/requestnewpassword.php @@ -11,7 +11,7 @@
-
+
'username', 'class' => 'elgg-autofocus', -- cgit v1.2.3 From a07b610b49a51ccf5885bf220700115d830c2707 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 25 Nov 2011 13:49:17 -0500 Subject: added a better message for php libraries that don't exist on disk --- engine/lib/elgglib.php | 5 ++++- languages/en.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'languages') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 08b346960..57d602450 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -107,7 +107,10 @@ function elgg_load_library($name) { } if (!include_once($CONFIG->libraries[$name])) { - $error = elgg_echo('InvalidParameterException:LibraryNotRegistered', array($name)); + $error = elgg_echo('InvalidParameterException:LibraryNotFound', array( + $name, + $CONFIG->libraries[$name]) + ); throw new InvalidParameterException($error); } } diff --git a/languages/en.php b/languages/en.php index 1576ed73d..036ca8883 100644 --- a/languages/en.php +++ b/languages/en.php @@ -167,6 +167,7 @@ $english = array( 'InvalidParameterException:DoesNotBelongOrRefer' => "Does not belong to entity or refer to entity.", 'InvalidParameterException:MissingParameter' => "Missing parameter, you need to provide a GUID.", 'InvalidParameterException:LibraryNotRegistered' => '%s is not a registered library', + 'InvalidParameterException:LibraryNotFound' => 'Could not load the %s library from %s', 'APIException:ApiResultUnknown' => "API Result is of an unknown type, this should never happen.", 'ConfigurationException:NoSiteID' => "No site ID has been specified.", -- cgit v1.2.3 From c2cddede38dbb29d53167e296981a678759e0648 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 5 Dec 2011 21:54:09 -0500 Subject: first version of a 404 page --- engine/lib/pagehandler.php | 31 +++++++++++++++++++++++++++++++ languages/en.php | 3 +++ views/default/errors/404.php | 8 ++++++++ views/default/errors/default.php | 8 ++++++++ views/default/page/error.php | 14 ++++++++++++++ views/default/page/layouts/error.php | 6 ++++++ 6 files changed, 70 insertions(+) create mode 100644 views/default/errors/404.php create mode 100644 views/default/errors/default.php create mode 100644 views/default/page/error.php create mode 100644 views/default/page/layouts/error.php (limited to 'languages') diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index aba921416..16be6e3b2 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -110,3 +110,34 @@ function elgg_unregister_page_handler($handler) { unset($CONFIG->pagehandler[$handler]); } + +/** + * Serve an error page + * + * @param string $hook The name of the hook + * @param string $type The type of the hook + * @param bool $result The current value of the hook + * @param array $params Parameters related to the hook + */ +function elgg_error_page_handler($hook, $type, $result, $params) { + if (elgg_view_exists("errors/$type")) { + $content = elgg_view("errors/$type", $params); + } else { + $content = elgg_view("errors/default", $params); + } + $body = elgg_view_layout('error', array('content' => $content)); + echo elgg_view_page($title, $body, 'error'); + exit; +} + +/** + * Initializes the page handler/routing system + * + * @return void + * @access private + */ +function page_handler_init() { + elgg_register_plugin_hook_handler('forward', '404', 'elgg_error_page_handler'); +} + +elgg_register_event_handler('init', 'system', 'page_handler_init'); diff --git a/languages/en.php b/languages/en.php index 036ca8883..eecb2f1aa 100644 --- a/languages/en.php +++ b/languages/en.php @@ -240,6 +240,9 @@ $english = array( 'changebookmark' => 'Please change your bookmark for this page', 'noaccess' => 'This content has been removed, is invalid, or you do not have permission to view it.', + 'error:default' => 'Oops...something went wrong.', + 'error:404' => 'Sorry. We could not find the page that you requested.', + /** * API */ diff --git a/views/default/errors/404.php b/views/default/errors/404.php new file mode 100644 index 000000000..8bc35acdd --- /dev/null +++ b/views/default/errors/404.php @@ -0,0 +1,8 @@ +$message"; diff --git a/views/default/errors/default.php b/views/default/errors/default.php new file mode 100644 index 000000000..a0582eba2 --- /dev/null +++ b/views/default/errors/default.php @@ -0,0 +1,8 @@ +$message"; diff --git a/views/default/page/error.php b/views/default/page/error.php new file mode 100644 index 000000000..b7ba3ae9b --- /dev/null +++ b/views/default/page/error.php @@ -0,0 +1,14 @@ + Date: Thu, 8 Dec 2011 20:09:36 -0500 Subject: Fixes #4185, #2111 adds control panel widget --- actions/admin/site/flush_cache.php | 10 ++++++++++ engine/lib/admin.php | 5 +++-- languages/en.php | 6 ++++++ views/default/widgets/control_panel/content.php | 24 ++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 actions/admin/site/flush_cache.php create mode 100644 views/default/widgets/control_panel/content.php (limited to 'languages') diff --git a/actions/admin/site/flush_cache.php b/actions/admin/site/flush_cache.php new file mode 100644 index 000000000..b81f5fc83 --- /dev/null +++ b/actions/admin/site/flush_cache.php @@ -0,0 +1,10 @@ + array of handlers in order, top to bottom $adminWidgets = array( - 1 => array('admin_welcome'), + 1 => array('control_panel', 'admin_welcome'), 2 => array('online_users', 'new_users', 'content_stats'), ); diff --git a/languages/en.php b/languages/en.php index 036ca8883..a2e6e152e 100644 --- a/languages/en.php +++ b/languages/en.php @@ -610,6 +610,12 @@ $english = array( // argh, this is ugly 'admin:widget:admin_welcome:outro' => '
Be sure to check out the resources available through the footer links and thank you for using Elgg!', + 'admin:widget:control_panel' => 'Control panel', + 'admin:widget:control_panel:help' => "Provides easy access to common controls", + + 'admin:cache:flush' => 'Flush the caches', + 'admin:cache:flushed' => "The site's caches have been flushed", + 'admin:footer:faq' => 'Administration FAQ', 'admin:footer:manual' => 'Administration Manual', 'admin:footer:community_forums' => 'Elgg Community Forums', diff --git a/views/default/widgets/control_panel/content.php b/views/default/widgets/control_panel/content.php new file mode 100644 index 000000000..d2db54bc6 --- /dev/null +++ b/views/default/widgets/control_panel/content.php @@ -0,0 +1,24 @@ + 'flush', + 'text' => elgg_echo('admin:cache:flush'), + 'href' => 'action/admin/site/flush_cache', + 'is_action' => true, + 'link_class' => 'elgg-button elgg-button-action', +)); + +elgg_register_menu_item('admin_control_panel', array( + 'name' => 'upgrade', + 'text' => elgg_echo('upgrade'), + 'href' => 'upgrade.php', + 'link_class' => 'elgg-button elgg-button-action', +)); + +echo elgg_view_menu('admin_control_panel', array( + 'class' => 'elgg-menu-hz', + 'item_class' => 'mrm', +)); -- cgit v1.2.3 From dfaa80f0a44afe6faed0212e61c3edef48afc64d Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 14 Dec 2011 20:02:25 -0500 Subject: Fixes #3341 removed xml-rpc code from Elgg - see xml-rpc plugin if you need an xml-rpc endpoint --- engine/classes/ElggSite.php | 2 - engine/classes/XMLRPCArrayParameter.php | 56 --------- engine/classes/XMLRPCBase64Parameter.php | 28 ----- engine/classes/XMLRPCBoolParameter.php | 30 ----- engine/classes/XMLRPCCall.php | 62 ---------- engine/classes/XMLRPCDateParameter.php | 33 ----- engine/classes/XMLRPCDoubleParameter.php | 29 ----- engine/classes/XMLRPCErrorResponse.php | 36 ------ engine/classes/XMLRPCIntParameter.php | 29 ----- engine/classes/XMLRPCParameter.php | 16 --- engine/classes/XMLRPCResponse.php | 71 ----------- engine/classes/XMLRPCStringParameter.php | 30 ----- engine/classes/XMLRPCStructParameter.php | 55 --------- engine/classes/XMLRPCSuccessResponse.php | 22 ---- engine/handlers/page_handler.php | 8 +- engine/handlers/xml-rpc_handler.php | 44 ------- engine/lib/xml-rpc.php | 203 ------------------------------- engine/start.php | 2 +- htaccess_dist | 3 - install/ElggInstaller.php | 2 +- languages/en.php | 9 -- views/xml/xml-rpc/output.php | 11 -- 22 files changed, 8 insertions(+), 773 deletions(-) delete mode 100644 engine/classes/XMLRPCArrayParameter.php delete mode 100644 engine/classes/XMLRPCBase64Parameter.php delete mode 100644 engine/classes/XMLRPCBoolParameter.php delete mode 100644 engine/classes/XMLRPCCall.php delete mode 100644 engine/classes/XMLRPCDateParameter.php delete mode 100644 engine/classes/XMLRPCDoubleParameter.php delete mode 100644 engine/classes/XMLRPCErrorResponse.php delete mode 100644 engine/classes/XMLRPCIntParameter.php delete mode 100644 engine/classes/XMLRPCParameter.php delete mode 100644 engine/classes/XMLRPCResponse.php delete mode 100644 engine/classes/XMLRPCStringParameter.php delete mode 100644 engine/classes/XMLRPCStructParameter.php delete mode 100644 engine/classes/XMLRPCSuccessResponse.php delete mode 100644 engine/handlers/xml-rpc_handler.php delete mode 100644 engine/lib/xml-rpc.php delete mode 100644 views/xml/xml-rpc/output.php (limited to 'languages') diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 5c44d4076..0d03cbd28 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -421,8 +421,6 @@ class ElggSite extends ElggEntity { 'action/security/refreshtoken', 'ajax/view/js/languages', 'upgrade\.php', - 'xml-rpc\.php', - 'mt/mt-xmlrpc\.cgi', 'css/.*', 'js/.*' ); diff --git a/engine/classes/XMLRPCArrayParameter.php b/engine/classes/XMLRPCArrayParameter.php deleted file mode 100644 index a8edccba7..000000000 --- a/engine/classes/XMLRPCArrayParameter.php +++ /dev/null @@ -1,56 +0,0 @@ -addField($v); - } - } - } - - /** - * Add a field to the container. - * - * @param XMLRPCParameter $value The value. - * - * @return void - */ - public function addField(XMLRPCParameter $value) { - if (!is_array($this->value)) { - $this->value = array(); - } - - $this->value[] = $value; - } - - /** - * Converts XML array to string - * - * @return string - */ - function __toString() { - $params = ""; - foreach ($this->value as $value) { - $params .= "$value"; - } - - return "$params"; - } -} diff --git a/engine/classes/XMLRPCBase64Parameter.php b/engine/classes/XMLRPCBase64Parameter.php deleted file mode 100644 index 7db0a761c..000000000 --- a/engine/classes/XMLRPCBase64Parameter.php +++ /dev/null @@ -1,28 +0,0 @@ -value = base64_encode($blob); - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - return "{$value}"; - } -} diff --git a/engine/classes/XMLRPCBoolParameter.php b/engine/classes/XMLRPCBoolParameter.php deleted file mode 100644 index 607841cb8..000000000 --- a/engine/classes/XMLRPCBoolParameter.php +++ /dev/null @@ -1,30 +0,0 @@ -value = (bool)$value; - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - $code = ($this->value) ? "1" : "0"; - return "{$code}"; - } -} diff --git a/engine/classes/XMLRPCCall.php b/engine/classes/XMLRPCCall.php deleted file mode 100644 index 8eeba0c29..000000000 --- a/engine/classes/XMLRPCCall.php +++ /dev/null @@ -1,62 +0,0 @@ -_parse($xml); - } - - /** - * Return the method name associated with the call. - * - * @return string - */ - public function getMethodName() { return $this->methodname; } - - /** - * Return the parameters. - * Returns a nested array of XmlElement. - * - * @see XmlElement - * @return array - */ - public function getParameters() { return $this->params; } - - /** - * Parse the xml into its components according to spec. - * This first version is a little primitive. - * - * @param string $xml XML - * - * @return void - */ - private function _parse($xml) { - $xml = xml_to_object($xml); - - // sanity check - if ((isset($xml->name)) && (strcasecmp($xml->name, "methodCall") != 0)) { - throw new CallException(elgg_echo('CallException:NotRPCCall')); - } - - // method name - $this->methodname = $xml->children[0]->content; - - // parameters - $this->params = $xml->children[1]->children; - } -} diff --git a/engine/classes/XMLRPCDateParameter.php b/engine/classes/XMLRPCDateParameter.php deleted file mode 100644 index 93bbbd8f5..000000000 --- a/engine/classes/XMLRPCDateParameter.php +++ /dev/null @@ -1,33 +0,0 @@ -value = $timestamp; - - if (!$timestamp) { - $this->value = time(); - } - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - $value = date('c', $this->value); - return "{$value}"; - } -} diff --git a/engine/classes/XMLRPCDoubleParameter.php b/engine/classes/XMLRPCDoubleParameter.php deleted file mode 100644 index b7834650e..000000000 --- a/engine/classes/XMLRPCDoubleParameter.php +++ /dev/null @@ -1,29 +0,0 @@ -value = (float)$value; - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - return "{$this->value}"; - } -} diff --git a/engine/classes/XMLRPCErrorResponse.php b/engine/classes/XMLRPCErrorResponse.php deleted file mode 100644 index 425c075cc..000000000 --- a/engine/classes/XMLRPCErrorResponse.php +++ /dev/null @@ -1,36 +0,0 @@ -addParameter( - new XMLRPCStructParameter( - array ( - 'faultCode' => new XMLRPCIntParameter($code), - 'faultString' => new XMLRPCStringParameter($message) - ) - ) - ); - } - - /** - * Output to XML. - * - * @return string - */ - public function __toString() { - return "{$this->parameters[0]}"; - } -} diff --git a/engine/classes/XMLRPCIntParameter.php b/engine/classes/XMLRPCIntParameter.php deleted file mode 100644 index 0fc146165..000000000 --- a/engine/classes/XMLRPCIntParameter.php +++ /dev/null @@ -1,29 +0,0 @@ -value = (int)$value; - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - return "{$this->value}"; - } -} diff --git a/engine/classes/XMLRPCParameter.php b/engine/classes/XMLRPCParameter.php deleted file mode 100644 index ffbad8082..000000000 --- a/engine/classes/XMLRPCParameter.php +++ /dev/null @@ -1,16 +0,0 @@ -parameters)) { - $this->parameters = array(); - } - - $this->parameters[] = $param; - } - - /** - * Add an integer - * - * @param int $value Value - * - * @return void - */ - public function addInt($value) { - $this->addParameter(new XMLRPCIntParameter($value)); - } - - /** - * Add a string - * - * @param string $value Value - * - * @return void - */ - public function addString($value) { - $this->addParameter(new XMLRPCStringParameter($value)); - } - - /** - * Add a double - * - * @param int $value Value - * - * @return void - */ - public function addDouble($value) { - $this->addParameter(new XMLRPCDoubleParameter($value)); - } - - /** - * Add a boolean - * - * @param bool $value Value - * - * @return void - */ - public function addBoolean($value) { - $this->addParameter(new XMLRPCBoolParameter($value)); - } -} diff --git a/engine/classes/XMLRPCStringParameter.php b/engine/classes/XMLRPCStringParameter.php deleted file mode 100644 index 35b28214b..000000000 --- a/engine/classes/XMLRPCStringParameter.php +++ /dev/null @@ -1,30 +0,0 @@ -value = $value; - } - - /** - * Convert to XML string - * - * @return string - */ - function __toString() { - $value = htmlentities($this->value); - return "{$value}"; - } -} diff --git a/engine/classes/XMLRPCStructParameter.php b/engine/classes/XMLRPCStructParameter.php deleted file mode 100644 index 694ddf5df..000000000 --- a/engine/classes/XMLRPCStructParameter.php +++ /dev/null @@ -1,55 +0,0 @@ - $v) { - $this->addField($k, $v); - } - } - } - - /** - * Add a field to the container. - * - * @param string $name The name of the field. - * @param XMLRPCParameter $value The value. - * - * @return void - */ - public function addField($name, XMLRPCParameter $value) { - if (!is_array($this->value)) { - $this->value = array(); - } - - $this->value[$name] = $value; - } - - /** - * Convert to string - * - * @return string - */ - function __toString() { - $params = ""; - foreach ($this->value as $k => $v) { - $params .= "$k$v"; - } - - return "$params"; - } -} diff --git a/engine/classes/XMLRPCSuccessResponse.php b/engine/classes/XMLRPCSuccessResponse.php deleted file mode 100644 index e02e82c5c..000000000 --- a/engine/classes/XMLRPCSuccessResponse.php +++ /dev/null @@ -1,22 +0,0 @@ -parameters as $param) { - $params .= "$param\n"; - } - - return "$params"; - } -} diff --git a/engine/handlers/page_handler.php b/engine/handlers/page_handler.php index 1ed295b7d..7eca37bb1 100644 --- a/engine/handlers/page_handler.php +++ b/engine/handlers/page_handler.php @@ -13,12 +13,16 @@ * * cache * * services * * export - * * mt - * * xml-rpc.php + * * js + * * css * * rewrite.php * * tag (deprecated, reserved for backwards compatibility) * * pg (deprecated, reserved for backwards compatibility) * + * These additionally are reserved for the xml-rpc plugin + * * mt + * * xml-rpc.php + * * {@link page_handler()} explodes the pages string by / and sends it to * the page handler function as registered by {@link elgg_register_page_handler()}. * If a valid page handler isn't found, plugins have a chance to provide a 404. diff --git a/engine/handlers/xml-rpc_handler.php b/engine/handlers/xml-rpc_handler.php deleted file mode 100644 index 2ee29e5b7..000000000 --- a/engine/handlers/xml-rpc_handler.php +++ /dev/null @@ -1,44 +0,0 @@ - $result))); diff --git a/engine/lib/xml-rpc.php b/engine/lib/xml-rpc.php deleted file mode 100644 index bfe1a8645..000000000 --- a/engine/lib/xml-rpc.php +++ /dev/null @@ -1,203 +0,0 @@ -name == 'param') { - $object = $object->children[0]->children[0]; - } - - switch ($object->name) { - case 'string': - return $object->content; - - case 'array': - foreach ($object->children[0]->children as $child) { - $value[] = xmlrpc_scalar_value($child); - } - return $value; - - case 'struct': - foreach ($object->children as $child) { - if (isset($child->children[1]->children[0])) { - $value[$child->children[0]->content] = xmlrpc_scalar_value($child->children[1]->children[0]); - } else { - $value[$child->children[0]->content] = $child->children[1]->content; - } - } - return $value; - - case 'boolean': - return (boolean) $object->content; - - case 'i4': - case 'int': - return (int) $object->content; - - case 'double': - return (double) $object->content; - - case 'dateTime.iso8601': - return (int) strtotime($object->content); - - case 'base64': - return base64_decode($object->content); - - case 'value': - return xmlrpc_scalar_value($object->children[0]); - - default: - // @todo unsupported, throw an error - return false; - } -} - -// Functions for adding handlers ////////////////////////////////////////////////////////// - -/** XML-RPC Handlers */ -global $XML_RPC_HANDLERS; -$XML_RPC_HANDLERS = array(); - -/** - * Register a method handler for a given XML-RPC method. - * - * @param string $method Method parameter. - * @param string $handler The handler function. This function accepts - * one XMLRPCCall object and must return a XMLRPCResponse object. - * - * @return bool - */ -function register_xmlrpc_handler($method, $handler) { - global $XML_RPC_HANDLERS; - - $XML_RPC_HANDLERS[$method] = $handler; -} - -/** - * Trigger a method call and pass the relevant parameters to the funciton. - * - * @param XMLRPCCall $parameters The call and parameters. - * - * @return XMLRPCCall - * @access private - */ -function trigger_xmlrpc_handler(XMLRPCCall $parameters) { - global $XML_RPC_HANDLERS; - - // Go through and see if we have a handler - if (isset($XML_RPC_HANDLERS[$parameters->getMethodName()])) { - $handler = $XML_RPC_HANDLERS[$parameters->getMethodName()]; - $result = $handler($parameters); - - if (!($result instanceof XMLRPCResponse)) { - $msg = elgg_echo('InvalidParameterException:UnexpectedReturnFormat', - array($parameters->getMethodName())); - throw new InvalidParameterException($msg); - } - - // Result in right format, return it. - return $result; - } - - // if no handler then throw exception - $msg = elgg_echo('NotImplementedException:XMLRPCMethodNotImplemented', - array($parameters->getMethodName())); - throw new NotImplementedException($msg); -} - -/** - * PHP Error handler function. - * This function acts as a wrapper to catch and report PHP error messages. - * - * @see http://uk3.php.net/set-error-handler - * - * @param int $errno Error number - * @param string $errmsg Human readable message - * @param string $filename Filename - * @param int $linenum Line number - * @param array $vars Vars - * - * @return void - * @access private - */ -function _php_xmlrpc_error_handler($errno, $errmsg, $filename, $linenum, $vars) { - $error = date("Y-m-d H:i:s (T)") . ": \"" . $errmsg . "\" in file " - . $filename . " (line " . $linenum . ")"; - - switch ($errno) { - case E_USER_ERROR: - error_log("ERROR: " . $error); - - // Since this is a fatal error, we want to stop any further execution but do so gracefully. - throw new Exception("ERROR: " . $error); - break; - - case E_WARNING : - case E_USER_WARNING : - error_log("WARNING: " . $error); - break; - - default: - error_log("DEBUG: " . $error); - } -} - -/** - * PHP Exception handler for XMLRPC. - * - * @param Exception $exception The exception - * - * @return void - * @access private - */ -function _php_xmlrpc_exception_handler($exception) { - - error_log("*** FATAL EXCEPTION (XML-RPC) *** : " . $exception); - - $code = $exception->getCode(); - - if ($code == 0) { - $code = -32400; - } - - $result = new XMLRPCErrorResponse($exception->getMessage(), $code); - - $vars = array('result' => $result); - - $content = elgg_view("xml-rpc/output", $vars); - - echo elgg_view_page($exception->getMessage(), $content); -} diff --git a/engine/start.php b/engine/start.php index 00bdc3197..454dc7377 100644 --- a/engine/start.php +++ b/engine/start.php @@ -100,7 +100,7 @@ $lib_files = array( 'opendd.php', 'pagehandler.php', 'pam.php', 'plugins.php', 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', - 'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php', + 'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', //backwards compatibility 'deprecated-1.7.php', 'deprecated-1.8.php', diff --git a/htaccess_dist b/htaccess_dist index 526299b94..88285f81b 100644 --- a/htaccess_dist +++ b/htaccess_dist @@ -115,9 +115,6 @@ RewriteRule ^services\/api\/([A-Za-z0-9\_\-]+)\/(.*)$ engine/handlers/service_ha RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/?$ engine/handlers/export_handler.php?view=$1&guid=$2 RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/([A-Za-z]+)\/([A-Za-z0-9\_]+)\/$ engine/handlers/export_handler.php?view=$1&guid=$2&type=$3&idname=$4 -RewriteRule xml-rpc.php engine/handlers/xml-rpc_handler.php -RewriteRule mt/mt-xmlrpc.cgi engine/handlers/xml-rpc_handler.php - # rule for rewrite module test during install - can be removed after installation RewriteRule ^rewrite.php$ install.php diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php index d556ba744..367d23b4d 100644 --- a/install/ElggInstaller.php +++ b/install/ElggInstaller.php @@ -790,7 +790,7 @@ class ElggInstaller { 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', 'upgrade.php', 'web_services.php', - 'widgets.php', 'xml.php', 'xml-rpc.php', 'deprecated-1.7.php', + 'widgets.php', 'xml.php', 'deprecated-1.7.php', 'deprecated-1.8.php', ); diff --git a/languages/en.php b/languages/en.php index 036ca8883..17587b178 100644 --- a/languages/en.php +++ b/languages/en.php @@ -208,10 +208,6 @@ $english = array( 'SecurityException:InvalidAPIKey' => "Invalid or missing API Key.", 'NotImplementedException:CallMethodNotImplemented' => "Call method '%s' is currently not supported.", - 'NotImplementedException:XMLRPCMethodNotImplemented' => "XML-RPC method call '%s' not implemented.", - 'InvalidParameterException:UnexpectedReturnFormat' => "Call to method '%s' returned an unexpected result.", - 'CallException:NotRPCCall' => "Call does not appear to be a valid XML-RPC call", - 'PluginException:NoPluginName' => "The plugin name could not be found", 'SecurityException:authenticationfailed' => "User could not be authenticated", @@ -1079,11 +1075,6 @@ If you requested this, click on the link below. Otherwise ignore this email. 'user:default_access:success' => "Your new default access level was saved.", 'user:default_access:failure' => "Your new default access level could not be saved.", -/** - * XML-RPC - */ - 'xmlrpc:noinputdata' => "Input data missing", - /** * Comments */ diff --git a/views/xml/xml-rpc/output.php b/views/xml/xml-rpc/output.php deleted file mode 100644 index 4276029d1..000000000 --- a/views/xml/xml-rpc/output.php +++ /dev/null @@ -1,11 +0,0 @@ -