Permalink
Browse files

Standardized code in all of core, not including language files, tests…

…, or core mods.

git-svn-id: http://code.elgg.org/elgg/trunk@7124 36083f99-b078-4883-b0ff-0f9b5a30f544
  • Loading branch information...
1 parent bd34844 commit 7ddd9521b3f3a397da3b0a6b56238d31414eb4be @brettp brettp committed Oct 28, 2010
Showing with 7,747 additions and 3,945 deletions.
  1. +29 −2 CHANGES.txt
  2. +1 −1 _css/css.php
  3. +1 −1 _css/js.php
  4. +1 −1 actions/admin/menu_items.php
  5. +2 −1 actions/admin/plugins/simple_update_states.php
  6. +9 −7 actions/comments/add.php
  7. +1 −1 actions/email/save.php
  8. +6 −6 actions/friends/add.php
  9. +5 −8 actions/friends/addcollection.php
  10. +2 −5 actions/friends/deletecollection.php
  11. +2 −3 actions/friends/editcollection.php
  12. +3 −3 actions/friends/remove.php
  13. +5 −3 actions/likes/add.php
  14. +2 −1 actions/likes/delete.php
  15. +14 −14 actions/login.php
  16. +1 −1 actions/register.php
  17. +1 −1 actions/user/language.php
  18. +2 −2 actions/user/password.php
  19. +4 −3 actions/user/spotlight.php
  20. +7 −3 actions/useradd.php
  21. +3 −3 actions/usersettings/save.php
  22. +3 −3 actions/widgets/add.php
  23. +2 −2 actions/widgets/reorder.php
  24. +4 −4 actions/widgets/save.php
  25. +2 −1 engine/classes/APIException.php
  26. +1 −1 engine/classes/CallException.php
  27. +1 −1 engine/classes/ClassException.php
  28. +1 −1 engine/classes/ClassNotFoundException.php
  29. +1 −1 engine/classes/ConfigurationException.php
  30. +1 −1 engine/classes/CronException.php
  31. +1 −1 engine/classes/DataFormatException.php
  32. +1 −1 engine/classes/DatabaseException.php
  33. +33 −5 engine/classes/ElggAccess.php
  34. +19 −10 engine/classes/ElggAnnotation.php
  35. +99 −19 engine/classes/ElggCache.php
  36. +93 −65 engine/classes/ElggDiskFilestore.php
  37. +258 −95 engine/classes/ElggEntity.php
  38. +102 −15 engine/classes/ElggExtender.php
  39. +101 −24 engine/classes/ElggFile.php
  40. +79 −31 engine/classes/ElggFileCache.php
  41. +39 −14 engine/classes/ElggFilestore.php
  42. +142 −47 engine/classes/ElggGroup.php
  43. +18 −12 engine/classes/ElggHMACCache.php
  44. +66 −7 engine/classes/ElggMemcache.php
  45. +22 −9 engine/classes/ElggMetadata.php
  46. +47 −35 engine/classes/ElggObject.php
  47. +25 −10 engine/classes/ElggPlugin.php
  48. +105 −12 engine/classes/ElggRelationship.php
  49. +70 −14 engine/classes/ElggSession.php
  50. +8 −2 engine/classes/ElggSharedMemoryCache.php
  51. +72 −43 engine/classes/ElggSite.php
  52. +37 −6 engine/classes/ElggStaticVariableCache.php
  53. +97 −46 engine/classes/ElggUser.php
  54. +32 −5 engine/classes/ElggWidget.php
  55. +16 −5 engine/classes/ErrorResult.php
  56. +2 −2 engine/classes/ExportException.php
  57. +5 −2 engine/classes/Exportable.php
  58. +30 −9 engine/classes/Friendable.php
  59. +28 −9 engine/classes/GenericResult.php
  60. +2 −2 engine/classes/IOException.php
  61. +2 −2 engine/classes/ImportException.php
  62. +5 −1 engine/classes/Importable.php
  63. +2 −2 engine/classes/InstallationException.php
  64. +2 −2 engine/classes/InvalidClassException.php
  65. +2 −2 engine/classes/InvalidParameterException.php
  66. +16 −3 engine/classes/Locatable.php
  67. +19 −3 engine/classes/Loggable.php
  68. +4 −4 engine/classes/NotImplementedException.php
  69. +18 −7 engine/classes/Notable.php
  70. +3 −0 engine/classes/NotificationException.php
  71. +42 −4 engine/classes/ODD.php
  72. +75 −1 engine/classes/ODDDocument.php
  73. +56 −7 engine/classes/ODDEntity.php
  74. +4 −3 engine/classes/PluginException.php
  75. +1 −1 engine/classes/RegistrationException.php
  76. +4 −3 engine/classes/SecurityException.php
  77. +16 −3 engine/classes/SuccessResult.php
  78. +28 −19 engine/classes/XMLRPCArrayParameter.php
  79. +14 −9 engine/classes/XMLRPCBase64Parameter.php
  80. +21 −10 engine/classes/XMLRPCBoolParameter.php
  81. +28 −25 engine/classes/XMLRPCCall.php
  82. +18 −11 engine/classes/XMLRPCDateParameter.php
  83. +21 −10 engine/classes/XMLRPCDoubleParameter.php
  84. +12 −9 engine/classes/XMLRPCErrorResponse.php
  85. +21 −10 engine/classes/XMLRPCIntParameter.php
  86. +9 −4 engine/classes/XMLRPCParameter.php
  87. +55 −12 engine/classes/XMLRPCResponse.php
  88. +21 −10 engine/classes/XMLRPCStringParameter.php
  89. +29 −22 engine/classes/XMLRPCStructParameter.php
  90. +11 −7 engine/classes/XMLRPCSuccessResponse.php
  91. +7 −6 engine/classes/XmlElement.php
  92. +2 −2 engine/handlers/xml-rpc_handler.php
  93. +147 −84 engine/lib/access.php
  94. +29 −14 engine/lib/actions.php
  95. +37 −15 engine/lib/admin.php
  96. +330 −185 engine/lib/annotations.php
  97. +232 −125 engine/lib/api.php
  98. +176 −112 engine/lib/calendar.php
  99. +22 −12 engine/lib/configuration.php
  100. +18 −5 engine/lib/cron.php
  101. +73 −35 engine/lib/database.php
  102. +376 −176 engine/lib/elgglib.php
  103. +419 −263 engine/lib/entities.php
  104. +40 −21 engine/lib/export.php
  105. +40 −19 engine/lib/extender.php
  106. +180 −79 engine/lib/filestore.php
  107. +176 −104 engine/lib/group.php
  108. +53 −20 engine/lib/input.php
  109. +8 −2 engine/lib/install.php
  110. +33 −13 engine/lib/languages.php
  111. +76 −51 engine/lib/location.php
  112. +3 −3 engine/lib/memcache.php
  113. +314 −153 engine/lib/metadata.php
  114. +20 −15 engine/lib/metastrings.php
  115. +100 −61 engine/lib/notification.php
  116. +63 −27 engine/lib/objects.php
  117. +13 −10 engine/lib/opendd.php
  118. +35 −16 engine/lib/output.php
  119. +15 −10 engine/lib/pagehandler.php
  120. +46 −5 engine/lib/pageowner.php
  121. +26 −22 engine/lib/pam.php
  122. +116 −65 engine/lib/plugins.php
  123. +243 −145 engine/lib/relationships.php
  124. +158 −109 engine/lib/river.php
  125. +101 −52 engine/lib/sessions.php
  126. +132 −72 engine/lib/sites.php
  127. +26 −11 engine/lib/statistics.php
  128. +58 −30 engine/lib/system_log.php
  129. +72 −42 engine/lib/tags.php
  130. +3 −4 engine/lib/upgrades/2008100701.php
  131. +7 −9 engine/lib/upgrades/2008101303.php
  132. +2 −3 engine/lib/upgrades/2009022701.php
  133. +3 −4 engine/lib/upgrades/2009041701.php
  134. +3 −4 engine/lib/upgrades/2009070101.php
  135. +96 −69 engine/lib/upgrades/2009102801.php
  136. +8 −4 engine/lib/upgrades/2010033101.php
  137. +8 −6 engine/lib/upgrades/2010060401.php
  138. +21 −17 engine/lib/upgrades/2010061501.php
  139. +2 −1 engine/lib/upgrades/2010062301.php
  140. +10 −1 engine/lib/upgrades/2010071001.php
  141. +3 −2 engine/lib/upgrades/2010071002.php
  142. +374 −177 engine/lib/users.php
  143. +40 −16 engine/lib/usersettings.php
  144. +13 −8 engine/lib/version.php
  145. +153 −87 engine/lib/views.php
  146. +104 −67 engine/lib/widgets.php
  147. +188 −165 engine/lib/xml-rpc.php
  148. +137 −132 engine/lib/xml.php
  149. +2 −1 engine/settings.example.php
  150. +4 −4 engine/start.php
  151. +15 −6 index.php
  152. +1 −1 install.php
  153. +121 −52 install/ElggInstaller.php
  154. +12 −4 install/ElggRewriteTester.php
  155. +3 −3 mod/profile/views/default/profile/profile_ownerblock.php
  156. +2 −1 pages/account/forgotten_password.php
  157. +5 −3 pages/account/register.php
  158. +1 −1 pages/dashboard/index.php
  159. +3 −2 pages/dashboard/latest.php
  160. +1 −1 pages/entities/index.php
  161. +1 −1 pages/friends/add.php
  162. +2 −1 pages/friends/edit.php
  163. +3 −1 pages/friends/index.php
  164. +3 −1 pages/friends/of.php
  165. +11 −15 pages/friends/pickercallback.php
  166. +2 −1 pages/settings/plugins.php
  167. +5 −5 services/api/rest_api.php
  168. +19 −15 services/export/handler.php
  169. +11 −6 simplecache/view.php
  170. +5 −5 upgrade.php
View
@@ -8,8 +8,35 @@ Version 1.8.0 (Jackie)
Generic API changes:
* Added elgg_instanceof().
* Added remove_subtype() and update_subtype().
- * Added elgg_format_url()
-
+ * Added elgg_format_url().
+ * ElggDiskFilestore supports non-user owners.
+
+ Deprecated APIs:
+ * ElggAccess::get_ignore_access() by ElggAccess::getIgnoreAccess().
+ * ElggAccess::set_ignore_access() by ElggAccess::setIgnoreAccess().
+ * ElggCache::set_variable() by ElggCache::setVariable().
+ * ElggCache::get_variable() by ElggCache::getVariable().
+ * ElggDiskFilestore::make_directory_root() by ElggDiskFilestore::makeDirectoryRoot().
+ * ElggDiskFilestore::make_file_matrix() and ElggDiskFilestore::user_file_matrix() by
+ ElggDiskFilestore::makeFileMatrix().
+ * ElggDiskFilestore::mb_string_split() removed.
+ * ElggEntity::initialise_attriutes() by ElggEntity::initializeAttributes(). Same for
+ all sub classes of ElggEntity.
+ * ElggFileCache::create_file() by ::createFile().
+ * ElggFileCache::sanitise_filename() by ::sanitizeFilename().
+ * ElggMemcache::make_memcache_key() by ::_makeMemcacheKey().
+ * ElggGroup::initialise_attributes() by ::initializeAttributes().
+ * ElggPlugin::initialise_attributes() by ::initializeAttributes().
+ * XMLRPCCall::parse() by XMLRPCCALL::_parse().
+ * __get_annotations_calculate_x() by get_annotations_calculate_x().
+ * __get_entities_from_annotations_calculate_x() by get_entities_from_annotations_calculate_x().
+ * __php_api_error_handler() by _php_api_error_handler().
+ * __php_api_exception_handler() by _php_api_exception_handler().
+ * __elgg_php_error_handler() by _elgg_php_error_handler().
+ * __elgg_php_exception_handler() by _elgg_php_exception_handler().
+ * __process_element() by _process_element().
+ * All __elgg_session_*() by _elgg_session_*().
+
UI/UX API changes:
* Added elgg_push_breadcrumb(), elgg_pop_breadcrumb(), and elgg_get_breadcrumbs().
* Added navigation/breadcrumbs.
View
@@ -30,7 +30,7 @@
$viewinput['viewtype'] = $_GET['viewtype'];
header("Content-type: text/css", true);
-header('Expires: ' . date('r',time() + 86400000), true);
+header('Expires: ' . date('r', time() + 86400000), true);
header("Pragma: public", true);
header("Cache-Control: public", true);
View
@@ -33,7 +33,7 @@
$viewinput['viewtype'] = $_GET['viewtype'];
header('Content-type: text/javascript');
-header('Expires: ' . date('r',time() + 864000000));
+header('Expires: ' . date('r', time() + 864000000));
header("Pragma: public");
header("Cache-Control: public");
@@ -29,7 +29,7 @@
// save the custom items
$custom_count = count($custom_item_names);
$custom_items = array();
-for ($i=0; $i<$custom_count; $i++) {
+for ($i = 0; $i < $custom_count; $i++) {
if (isset($custom_item_names[$i]) && isset($custom_item_names[$i])) {
$name = $custom_item_names[$i];
$url = $custom_item_urls[$i];
@@ -23,7 +23,8 @@
foreach ($installed_plugins as $plugin => $info) {
// this is only for simple plugins.
- if (!isset($info['manifest']['admin_interface']) || $info['manifest']['admin_interface'] != 'simple') {
+ $interface_type = elgg_get_array_value('admin_interface', $info['manifest'], NULL);
+ if (!$interface_type || $interface_type != 'simple') {
continue;
}
View
@@ -2,7 +2,8 @@
/**
* Elgg add comment action
*
- * @package Elgg
+ * @package Elgg.Core
+ * @subpackage Comments
*/
// Make sure we're logged in; forward to the front page if not
@@ -27,11 +28,11 @@
$user = get_loggedin_user();
-$annotation = create_annotation($entity->guid,
+$annotation = create_annotation($entity->guid,
'generic_comment',
- $comment_text,
- "",
- $user->guid,
+ $comment_text,
+ "",
+ $user->guid,
$entity->access_id);
// tell user annotation posted
@@ -42,7 +43,7 @@
// notify if poster wasn't owner
if ($entity->owner_guid != $user->guid) {
-
+
notify_user($entity->owner_guid,
$user->guid,
elgg_echo('generic_comment:email:subject'),
@@ -59,8 +60,9 @@
}
system_message(elgg_echo("generic_comment:posted"));
+
//add to river
-add_to_river('annotation/annotate','comment',$user->guid,$entity->guid, "", 0, $annotation);
+add_to_river('annotation/annotate', 'comment', $user->guid, $entity->guid, "", 0, $annotation);
// Forward to the page the action occurred on
forward($_SERVER['HTTP_REFERER']);
View
@@ -23,7 +23,7 @@
}
if ($user) {
- if (strcmp($email, $user->email)!=0) {
+ if (strcmp($email, $user->email) != 0) {
if (!get_user_by_email($email)) {
if ($user->email != $email) {
View
@@ -2,8 +2,8 @@
/**
* Elgg add friend action
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Friends.Management
*/
// Ensure we are logged in
@@ -21,13 +21,13 @@
$errors = true;
}
} catch (Exception $e) {
- register_error(sprintf(elgg_echo("friends:add:failure"),$friend->name));
+ register_error(sprintf(elgg_echo("friends:add:failure"), $friend->name));
$errors = true;
}
-if (!$errors){
+if (!$errors) {
// add to river
- add_to_river('friends/river/create','friend',get_loggedin_userid(),$friend_guid);
- system_message(sprintf(elgg_echo("friends:add:successful"),$friend->name));
+ add_to_river('friends/river/create', 'friend', get_loggedin_userid(), $friend_guid);
+ system_message(sprintf(elgg_echo("friends:add:successful"), $friend->name));
}
// Forward back to the page you friended the user on
@@ -1,12 +1,9 @@
<?php
-
/**
* Elgg collection add page
*
- * @package Elgg
- * @subpackage Core
-
-
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
*/
//must be logged in
@@ -16,15 +13,15 @@
$friends = get_input('friends_collection');
//first check to make sure that a collection name has been set and create the new colection
-if($collection_name){
+if ($collection_name) {
//create the collection
$create_collection = create_access_collection($collection_name, get_loggedin_userid());
//if the collection was created and the user passed some friends from the form, add them
- if($create_collection && (!empty($friends))){
+ if ($create_collection && (!empty($friends))) {
//add friends to the collection
- foreach($friends as $friend) {
+ foreach ($friends as $friend) {
add_user_to_access_collection($friend, $create_collection);
}
}
@@ -1,12 +1,9 @@
<?php
-
/**
* Elgg friends: delete collection action
*
- * @package Elgg
- * @subpackage Core
-
-
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
*/
// Make sure we're logged in (send us to the front page if not)
@@ -1,10 +1,9 @@
<?php
-
/**
* Elgg collection add page
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
*/
$collection_id = get_input('collection_id');
@@ -2,8 +2,8 @@
/**
* Elgg remove friend action
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Friends.Management
*/
// Ensure we are logged in
@@ -18,7 +18,7 @@
try{
if ($friend instanceof ElggUser) {
get_loggedin_user()->removeFriend($friend_guid);
- } else{
+ } else {
register_error(sprintf(elgg_echo("friends:remove:failure"), $friend->name));
$errors = true;
}
View
@@ -2,14 +2,15 @@
/**
* Elgg add like action
*
- * @package Elgg
+ * @package Elgg.Core
+ * @subpackage Likes
*/
gatekeeper();
$entity_guid = (int) get_input('guid');
//check to see if the user has already liked the item
-if (elgg_annotation_exists($entity_guid, 'likes')){
+if (elgg_annotation_exists($entity_guid, 'likes')) {
system_message(elgg_echo("likes:alreadyliked"));
forward($_SERVER['HTTP_REFERER']);
}
@@ -53,8 +54,9 @@
}
system_message(elgg_echo("likes:likes"));
+
//add to river
-add_to_river('annotation/annotatelike','likes',$user->guid,$entity->guid, "", 0, $annotation);
+add_to_river('annotation/annotatelike', 'likes', $user->guid, $entity->guid, "", 0, $annotation);
// Forward back to the page where the user 'liked' the object
forward($_SERVER['HTTP_REFERER']);
View
@@ -2,7 +2,8 @@
/**
* Elgg delete like action
*
- * @package Elgg
+ * @package Elgg.Core
+ * @subpackage Likes
*/
// Ensure we're logged in
View
@@ -45,20 +45,20 @@
}
} else {
register_error(elgg_echo('loginerror'));
-// // let a plugin hook say why login failed or react to it.
-// $params = array(
-// 'username' => $username,
-// 'password' => $password,
-// 'persistent' => $persistent,
-// 'user' => $user
-// );
-//
-// // Returning FALSE to this function will generate a standard
-// // "Could not log you in" message.
-// // Plugins should use this hook to provide details, and then return TRUE.
-// if (!trigger_plugin_hook('failed_login', 'user', $params, FALSE)) {
-// register_error(elgg_echo('loginerror'));
-// }
+ // // let a plugin hook say why login failed or react to it.
+ // $params = array(
+ // 'username' => $username,
+ // 'password' => $password,
+ // 'persistent' => $persistent,
+ // 'user' => $user
+ // );
+ //
+ // // Returning FALSE to this function will generate a standard
+ // // "Could not log you in" message.
+ // // Plugins should use this hook to provide details, and then return TRUE.
+ // if (!trigger_plugin_hook('failed_login', 'user', $params, FALSE)) {
+ // register_error(elgg_echo('loginerror'));
+ // }
}
forward(REFERRER);
View
@@ -14,7 +14,7 @@
$password2 = get_input('password2');
$email = get_input('email');
$name = get_input('name');
-$friend_guid = (int) get_input('friend_guid',0);
+$friend_guid = (int) get_input('friend_guid', 0);
$invitecode = get_input('invitecode');
if ($CONFIG->allow_registration) {
@@ -18,7 +18,7 @@
}
if (($user) && ($language)) {
- if (strcmp($language, $user->language)!=0) {
+ if (strcmp($language, $user->language) != 0) {
$user->language = $language;
if ($user->save()) {
system_message(elgg_echo('user:language:success'));
@@ -18,8 +18,8 @@
$user = get_entity($user_id);
}
-if (($user) && ($password!="")) {
- if (strlen($password)>=4) {
+if (($user) && ($password != "")) {
+ if (strlen($password) >= 4) {
if ($password == $password2) {
$user->salt = generate_random_cleartext_password(); // Reset the salt
$user->password = generate_user_password($user, $password);
@@ -2,13 +2,14 @@
/**
* Close or open spotlight.
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Spotlight
+ * @todo This is deprecated in 1.8
*/
gatekeeper();
-$closed = get_input('closed','true');
+$closed = get_input('closed', 'true');
if ($closed != 'true') {
$closed = false;
} else {
View
@@ -25,7 +25,7 @@
try {
$guid = register_user($username, $password, $name, $email, TRUE);
- if (((trim($password) != "") && (strcmp($password, $password2)==0)) && ($guid)) {
+ if (((trim($password) != "") && (strcmp($password, $password2) == 0)) && ($guid)) {
$new_user = get_entity($guid);
if (($guid) && ($admin)) {
$new_user->makeAdmin();
@@ -35,9 +35,13 @@
$new_user->created_by_guid = get_loggedin_userid();
set_user_validation_status($new_user->getGUID(), TRUE, 'admin_created');
- notify_user($new_user->guid, $CONFIG->site->guid, elgg_echo('useradd:subject'), sprintf(elgg_echo('useradd:body'), $name, $CONFIG->site->name, $CONFIG->site->url, $username, $password));
+ $subject = elgg_echo('useradd:subject');
+ $body = sprintf(elgg_echo('useradd:body'), $name,
+ $CONFIG->site->name, $CONFIG->site->url, $username, $password);
- system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename));
+ notify_user($new_user->guid, $CONFIG->site->guid, $subject, $body);
+
+ system_message(sprintf(elgg_echo("adduser:ok"), $CONFIG->sitename));
} else {
register_error(elgg_echo("adduser:bad"));
}
Oops, something went wrong.

0 comments on commit 7ddd952

Please sign in to comment.