diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-28 19:17:36 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-28 19:17:36 +0000 |
commit | 7ddd9521b3f3a397da3b0a6b56238d31414eb4be (patch) | |
tree | 6eb6a9a51db5fa0f5d3cc2ec6de29b9e258b12a1 /actions | |
parent | bd3484417d170e62bc94e9db81d4ad37e8ddee6a (diff) | |
download | elgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.gz elgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.bz2 |
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
Diffstat (limited to 'actions')
-rw-r--r-- | actions/admin/menu_items.php | 2 | ||||
-rw-r--r-- | actions/admin/plugins/simple_update_states.php | 3 | ||||
-rw-r--r-- | actions/comments/add.php | 16 | ||||
-rw-r--r-- | actions/email/save.php | 2 | ||||
-rw-r--r-- | actions/friends/add.php | 12 | ||||
-rw-r--r-- | actions/friends/addcollection.php | 13 | ||||
-rw-r--r-- | actions/friends/deletecollection.php | 7 | ||||
-rw-r--r-- | actions/friends/editcollection.php | 5 | ||||
-rw-r--r-- | actions/friends/remove.php | 6 | ||||
-rw-r--r-- | actions/likes/add.php | 8 | ||||
-rw-r--r-- | actions/likes/delete.php | 3 | ||||
-rw-r--r-- | actions/login.php | 28 | ||||
-rw-r--r-- | actions/register.php | 2 | ||||
-rw-r--r-- | actions/user/language.php | 2 | ||||
-rw-r--r-- | actions/user/password.php | 4 | ||||
-rw-r--r-- | actions/user/spotlight.php | 7 | ||||
-rw-r--r-- | actions/useradd.php | 10 | ||||
-rw-r--r-- | actions/usersettings/save.php | 6 | ||||
-rw-r--r-- | actions/widgets/add.php | 6 | ||||
-rw-r--r-- | actions/widgets/reorder.php | 4 | ||||
-rw-r--r-- | actions/widgets/save.php | 8 |
21 files changed, 79 insertions, 75 deletions
diff --git a/actions/admin/menu_items.php b/actions/admin/menu_items.php index 7b27af3de..8b01ae8fe 100644 --- a/actions/admin/menu_items.php +++ b/actions/admin/menu_items.php @@ -29,7 +29,7 @@ foreach ($featured_urls as $url) { // 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]; diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php index d9d8fd3e8..a81cb6a7a 100644 --- a/actions/admin/plugins/simple_update_states.php +++ b/actions/admin/plugins/simple_update_states.php @@ -23,7 +23,8 @@ $success = TRUE; 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; } diff --git a/actions/comments/add.php b/actions/comments/add.php index 84467168a..2e28e7839 100644 --- a/actions/comments/add.php +++ b/actions/comments/add.php @@ -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 @@ if (!$entity) { $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 @@ if (!$annotation) { // 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 @@ if ($entity->owner_guid != $user->guid) { } 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']); diff --git a/actions/email/save.php b/actions/email/save.php index 885bf2b04..c84969945 100644 --- a/actions/email/save.php +++ b/actions/email/save.php @@ -23,7 +23,7 @@ if (!is_email_address($email)) { } if ($user) { - if (strcmp($email, $user->email)!=0) { + if (strcmp($email, $user->email) != 0) { if (!get_user_by_email($email)) { if ($user->email != $email) { diff --git a/actions/friends/add.php b/actions/friends/add.php index cb527f82b..d26539a54 100644 --- a/actions/friends/add.php +++ b/actions/friends/add.php @@ -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 @@ try { $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 diff --git a/actions/friends/addcollection.php b/actions/friends/addcollection.php index e81fa34af..8fdb2be87 100644 --- a/actions/friends/addcollection.php +++ b/actions/friends/addcollection.php @@ -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 @@ $collection_name = get_input('collection_name'); $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); } } diff --git a/actions/friends/deletecollection.php b/actions/friends/deletecollection.php index 37a0346ab..b57802ce7 100644 --- a/actions/friends/deletecollection.php +++ b/actions/friends/deletecollection.php @@ -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) diff --git a/actions/friends/editcollection.php b/actions/friends/editcollection.php index 9b0dd7d23..8fd1eae18 100644 --- a/actions/friends/editcollection.php +++ b/actions/friends/editcollection.php @@ -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'); diff --git a/actions/friends/remove.php b/actions/friends/remove.php index 3aa9e5981..f79fdf0ac 100644 --- a/actions/friends/remove.php +++ b/actions/friends/remove.php @@ -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 @@ $errors = false; 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; } diff --git a/actions/likes/add.php b/actions/likes/add.php index 0cec18dc5..b4b4a8462 100644 --- a/actions/likes/add.php +++ b/actions/likes/add.php @@ -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 @@ if ($entity->owner_guid != $user->guid) { } 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']); diff --git a/actions/likes/delete.php b/actions/likes/delete.php index 3e9ef32ad..3ca82308d 100644 --- a/actions/likes/delete.php +++ b/actions/likes/delete.php @@ -2,7 +2,8 @@ /** * Elgg delete like action * - * @package Elgg + * @package Elgg.Core + * @subpackage Likes */ // Ensure we're logged in diff --git a/actions/login.php b/actions/login.php index 0063a1f08..b7823514a 100644 --- a/actions/login.php +++ b/actions/login.php @@ -45,20 +45,20 @@ if ($result) { } } 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); diff --git a/actions/register.php b/actions/register.php index b9db150c1..fcb25de35 100644 --- a/actions/register.php +++ b/actions/register.php @@ -14,7 +14,7 @@ $password = get_input('password'); $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) { diff --git a/actions/user/language.php b/actions/user/language.php index 79a583e68..252263cd2 100644 --- a/actions/user/language.php +++ b/actions/user/language.php @@ -18,7 +18,7 @@ if (!$user_id) { } 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')); diff --git a/actions/user/password.php b/actions/user/password.php index 2af60dfb7..ceb9d4585 100644 --- a/actions/user/password.php +++ b/actions/user/password.php @@ -18,8 +18,8 @@ if (!$user_id) { $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); diff --git a/actions/user/spotlight.php b/actions/user/spotlight.php index f20d6bdd0..00525254b 100644 --- a/actions/user/spotlight.php +++ b/actions/user/spotlight.php @@ -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 { diff --git a/actions/useradd.php b/actions/useradd.php index c46b7fb96..8e287e1d8 100644 --- a/actions/useradd.php +++ b/actions/useradd.php @@ -25,7 +25,7 @@ if (is_array($admin)) { 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 @@ try { $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")); } diff --git a/actions/usersettings/save.php b/actions/usersettings/save.php index 83987486c..5e375941f 100644 --- a/actions/usersettings/save.php +++ b/actions/usersettings/save.php @@ -2,14 +2,14 @@ /** * Aggregate action for saving settings * - * @package Elgg - * @subpackage Core + * @package Elgg.Core + * @subpackage UserSettings */ global $CONFIG; gatekeeper(); -trigger_plugin_hook('usersettings:save','user'); +trigger_plugin_hook('usersettings:save', 'user'); forward($_SERVER['HTTP_REFERER']); diff --git a/actions/widgets/add.php b/actions/widgets/add.php index 42d884a02..b38e53f0d 100644 --- a/actions/widgets/add.php +++ b/actions/widgets/add.php @@ -2,8 +2,8 @@ /** * Elgg widget add action * - * @package Elgg - * @subpackage Core + * @package Elgg.Core + * @subpackage Widgets.Management */ $guid = get_input('user'); @@ -16,7 +16,7 @@ $result = false; if (!empty($guid)) { if ($user = get_entity($guid)) { if ($user->canEdit()) { - $result = add_widget($user->getGUID(),$handler,$context,0,$column); + $result = add_widget($user->getGUID(), $handler, $context, 0, $column); } } } diff --git a/actions/widgets/reorder.php b/actions/widgets/reorder.php index fbc8c5379..c7c525a81 100644 --- a/actions/widgets/reorder.php +++ b/actions/widgets/reorder.php @@ -2,8 +2,8 @@ /** * Elgg widget reorder action * - * @package Elgg - * @subpackage Core + * @package Elgg.Core + * @subpackage Widgets.Management */ $owner = get_input('owner'); diff --git a/actions/widgets/save.php b/actions/widgets/save.php index ca8a4dd9f..673767939 100644 --- a/actions/widgets/save.php +++ b/actions/widgets/save.php @@ -2,19 +2,19 @@ /** * Elgg widget save action * - * @package Elgg - * @subpackage Core + * @package Elgg.Core + * @subpackage Widgets.Management */ $guid = get_input('guid'); $params = $_REQUEST['params']; $pageurl = get_input('pageurl'); -$noforward = get_input('noforward',false); +$noforward = get_input('noforward', false); $result = false; if (!empty($guid)) { - $result = save_widget_info($guid,$params); + $result = save_widget_info($guid, $params); } if ($noforward) { |