]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Standardized actions/*
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 14 Oct 2009 20:41:19 +0000 (20:41 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 14 Oct 2009 20:41:19 +0000 (20:41 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3542 36083f99-b078-4883-b0ff-0f9b5a30f544

27 files changed:
actions/email/save.php
actions/entities/delete.php
actions/friends/add.php
actions/friends/addcollection.php
actions/friends/deletecollection.php
actions/friends/editcollection.php
actions/friends/remove.php
actions/import/opendd.php
actions/login.php
actions/logout.php
actions/notifications/settings/usersettings/save.php
actions/plugins/settings/save.php
actions/plugins/usersettings/save.php
actions/register.php
actions/systemsettings/install.php
actions/user/default_access.php
actions/user/language.php
actions/user/name.php
actions/user/password.php
actions/user/passwordreset.php
actions/user/requestnewpassword.php
actions/user/spotlight.php
actions/useradd.php
actions/usersettings/save.php
actions/widgets/add.php
actions/widgets/reorder.php
actions/widgets/save.php

index 2d226552a8482f3fc98151e66883537836ca277e..046ac6a9dfad9c1c2228c26f2c38fdac6ac3e213 100644 (file)
@@ -1,53 +1,49 @@
 <?php
-       /**
       * Action for saving a new email address for a user and triggering a confirmation.
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Action for saving a new email address for a user and triggering a confirmation.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       global $CONFIG;
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
 
-       gatekeeper();
-       
-       $email = get_input('email');
-       $user_id = get_input('guid');
-       $user = "";
-       
-       if (!$user_id)
-               $user = $_SESSION['user'];
-       else
-               $user = get_entity($user_id);
-               
-       if ($user) 
-       {
-               if (strcmp($email,$user->email)!=0)
-               {
-       
-                       if (!get_user_by_email($email))
-                       {
-                       
-                               if ($user->email != $email) {
-                                       $user->email = $email;
-                                       if ($user->save())
-                                       {
-                                               request_user_validation($user->getGUID());
-                                               system_message(elgg_echo('email:save:success'));
-                                       }
-                                       else
-                                               register_error(elgg_echo('email:save:fail'));
+gatekeeper();
+
+$email = get_input('email');
+$user_id = get_input('guid');
+$user = "";
+
+if (!$user_id) {
+       $user = $_SESSION['user'];
+} else {
+       $user = get_entity($user_id);
+}
+
+if ($user) {
+       if (strcmp($email,$user->email)!=0) {
+               if (!get_user_by_email($email)) {
+                       if ($user->email != $email) {
+
+                               $user->email = $email;
+                               if ($user->save()) {
+                                       request_user_validation($user->getGUID());
+                                       system_message(elgg_echo('email:save:success'));
+                               } else {
+                                       register_error(elgg_echo('email:save:fail'));
                                }
                        }
-                       else
-                               register_error(elgg_echo('registration:dupeemail'));
+               } else {
+                       register_error(elgg_echo('registration:dupeemail'));
                }
        }
-       else
-               register_error(elgg_echo('email:save:fail'));
-       
-       //forward($_SERVER['HTTP_REFERER']);
-       //exit;
+} else {
+       register_error(elgg_echo('email:save:fail'));
+}
+
+//forward($_SERVER['HTTP_REFERER']);
+//exit;
 ?>
\ No newline at end of file
index fb9d98d1c52e0836b1fe0be761c62c94de8aaa3f..4f0e3b7baf4591f95b08edf7b59e6ce2792a6035 100644 (file)
@@ -1,30 +1,28 @@
 <?php
-       /**
       * Default entity delete action
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Default entity delete action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       
-       gatekeeper();
-       
-       $guid = get_input('guid');
-       
-       $entity = get_entity($guid);
-       
-       if (($entity) && ($entity->canEdit()))
-       {
-               if ($entity->delete())
-                       system_message(sprintf(elgg_echo('entity:delete:success'), $guid));
-               else
-                       register_error(sprintf(elgg_echo('entity:delete:fail'), $guid));
-       }
-       else
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+gatekeeper();
+
+$guid = get_input('guid');
+$entity = get_entity($guid);
+
+if (($entity) && ($entity->canEdit())) {
+       if ($entity->delete()) {
+               system_message(sprintf(elgg_echo('entity:delete:success'), $guid));
+       } else {
                register_error(sprintf(elgg_echo('entity:delete:fail'), $guid));
-               
-       forward($_SERVER['HTTP_REFERER']);
-?>
\ No newline at end of file
+       }
+} else {
+       register_error(sprintf(elgg_echo('entity:delete:fail'), $guid));
+}
+
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index 63f1e2d94a94e5831ee18557792d055af107275c..f58d49b8845342c2cce5506c4a78b0c4513bedb8 100644 (file)
@@ -1,40 +1,37 @@
 <?php
+/**
+ * Elgg add friend action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       /**
-        * Elgg add friend action
-        * 
-        * @package Elgg
-        * @subpackage Core
+// Ensure we are logged in
+gatekeeper();
+action_gatekeeper();
 
-        * @author Curverider Ltd
+// Get the GUID of the user to friend
+$friend_guid = get_input('friend');
+$friend = get_entity($friend_guid);
 
-        * @link http://elgg.org/
-        */
+$errors = false;
 
-       // Ensure we are logged in
-               gatekeeper();
-               action_gatekeeper();
-               
-       // Get the GUID of the user to friend
-               $friend_guid = get_input('friend');
-               $friend = get_entity($friend_guid);
+// Get the user
+try {
+       if (!$_SESSION['user']->addFriend($friend_guid)) {
+               $errors = true;
+       }
+} catch (Exception $e) {
+       register_error(sprintf(elgg_echo("friends:add:failure"),$friend->name));
+       $errors = true;
+}
+if (!$errors){
+       // add to river
+       add_to_river('friends/river/create','friend',$_SESSION['user']->guid,$friend_guid);
+       system_message(sprintf(elgg_echo("friends:add:successful"),$friend->name));
+}
 
-               $errors = false;
-               
-       // Get the user
-               try {
-                       if (!$_SESSION['user']->addFriend($friend_guid)) $errors = true;
-               } catch (Exception $e) {
-                       register_error(sprintf(elgg_echo("friends:add:failure"),$friend->name));
-                       $errors = true;
-               }
-               if (!$errors){
-                       // add to river
-               add_to_river('friends/river/create','friend',$_SESSION['user']->guid,$friend_guid);
-                       system_message(sprintf(elgg_echo("friends:add:successful"),$friend->name));
-               }
-               
-       // Forward to the user friends page
-               forward("pg/friends/" . $_SESSION['user']->username . "/");
-               
-?>
\ No newline at end of file
+// Forward to the user friends page
+forward("pg/friends/" . $_SESSION['user']->username . "/");
index 7dfba1ee7aae1bbf9c52098b046dfe536a861838..6a15805ecc45d1fb60cf96061274da494ea053bf 100644 (file)
@@ -1,50 +1,45 @@
 <?php
 
-       /**
-        * Elgg collection add page
-        * 
-        * @package Elgg
-        * @subpackage Core
-
-        * @author Curverider Ltd
-
-        * @link http://elgg.org/
-        */
-        
-        //must be logged in
-        gatekeeper();
-        action_gatekeeper();
-        
-        $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){
-        
-        //create the collection
-        $create_collection = create_access_collection($collection_name, $_SESSION['user']->getGUID());
-        
-        //if the collection was created and the user passed some friends from the form, add them
-        if($create_collection && (!empty($friends))){
-            
-            //add friends to the collection
-            foreach($friends as $friend){
-                add_user_to_access_collection($friend, $create_collection);
-               }
-               
-        }
-        
-        // Success message
-               system_message(elgg_echo("friends:collectionadded"));
-               // Forward to the collections page
-               forward("pg/collections/" . $_SESSION['user']->username);
-        
-    } else {
-        
-        register_error(elgg_echo("friends:nocollectionname"));
-        // Forward to the add collection page
-               forward("pg/collections/add");
-               
-    }
-        
-?>
\ No newline at end of file
+/**
+ * Elgg collection add page
+ *
+ * @package Elgg
+ * @subpackage Core
+
+ * @author Curverider Ltd
+
+ * @link http://elgg.org/
+ */
+
+//must be logged in
+gatekeeper();
+action_gatekeeper();
+
+$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){
+
+       //create the collection
+       $create_collection = create_access_collection($collection_name, $_SESSION['user']->getGUID());
+
+       //if the collection was created and the user passed some friends from the form, add them
+       if($create_collection && (!empty($friends))){
+               //add friends to the collection
+               foreach($friends as $friend) {
+                       add_user_to_access_collection($friend, $create_collection);
+               }
+       }
+
+       // Success message
+       system_message(elgg_echo("friends:collectionadded"));
+       // Forward to the collections page
+       forward("pg/collections/" . $_SESSION['user']->username);
+
+} else {
+       register_error(elgg_echo("friends:nocollectionname"));
+
+       // Forward to the add collection page
+       forward("pg/collections/add");
+}
index bdfcc9b2cd6a73646a6af0ecff3db6061df037e5..1e18adcea234c45719368c94f16b0d3d6b5c2330 100644 (file)
@@ -1,52 +1,45 @@
 <?php
 
-       /**
-        * Elgg friends: delete collection action
-        * 
-        * @package Elgg
-        * @subpackage Core
-
-        * @author Curverider Ltd
-
-        * @link http://elgg.org/
-        */
-
-       // Make sure we're logged in (send us to the front page if not)
-               gatekeeper();
-               
-               // Get input data
-               $collection_id = (int) get_input('collection');
-               
-               // Check to see that the access collection exist and grab its owner
-               $get_collection = get_access_collection($collection_id);
-               
-               if($get_collection){
-               
-               if($get_collection->owner_guid == $_SESSION['user']->getGUID()){
-                   
-                   $delete_collection = delete_access_collection($collection_id);
-               
-                   // Success message
-                       if ($delete_collection) 
-                               system_message(elgg_echo("friends:collectiondeleted"));
-                       else
-                               register_error(elgg_echo("friends:collectiondeletefailed"));
-                       
-               } else {
-               
-               // Failure message
-                       register_error(elgg_echo("friends:collectiondeletefailed"));
-                       
-               }
-               
+/**
+ * Elgg friends: delete collection action
+ *
+ * @package Elgg
+ * @subpackage Core
+
+ * @author Curverider Ltd
+
+ * @link http://elgg.org/
+ */
+
+// Make sure we're logged in (send us to the front page if not)
+gatekeeper();
+
+// Get input data
+$collection_id = (int) get_input('collection');
+
+// Check to see that the access collection exist and grab its owner
+$get_collection = get_access_collection($collection_id);
+
+if($get_collection){
+
+       if($get_collection->owner_guid == $_SESSION['user']->getGUID()) {
+
+               $delete_collection = delete_access_collection($collection_id);
+
+               // Success message
+               if ($delete_collection) {
+                       system_message(elgg_echo("friends:collectiondeleted"));
                } else {
-               
-               // Failure message
-                   register_error(elgg_echo("friends:collectiondeletefailed"));
-                   
-           }
-           
-            // Forward to the collections page
-                forward("pg/collections/" . $_SESSION['user']->username);
-               
-?>
\ No newline at end of file
+                       register_error(elgg_echo("friends:collectiondeletefailed"));
+               }
+       } else {
+               // Failure message
+               register_error(elgg_echo("friends:collectiondeletefailed"));
+       }
+} else {
+       // Failure message
+       register_error(elgg_echo("friends:collectiondeletefailed"));
+}
+
+// Forward to the collections page
+forward("pg/collections/" . $_SESSION['user']->username);
index ede61b4b0e4a6831af887fffcfbf296003264f82..4d346e823ba218dcc110c53bd45d62f3e0a824e2 100644 (file)
@@ -1,20 +1,16 @@
 <?php
 
-       /**
-        * Elgg collection add page
-        * 
-        * @package Elgg
-        * @subpackage Core
+/**
+ * Elgg collection add page
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-        * @author Curverider Ltd
+$collection_id = get_input('collection_id');
+$friends = get_input('friend');
 
-        * @link http://elgg.org/
-        */
-        
-        $collection_id = get_input('collection_id');
-        $friends = get_input('friend');
-        
-        //chech the collection exists and the current user owners it
-        update_access_collection($collection_id, $friends);
-        
-?>
\ No newline at end of file
+//chech the collection exists and the current user owners it
+update_access_collection($collection_id, $friends);
\ No newline at end of file
index 20181bc84c58fe9add63774ed26bbcfa9d412639..83dd377e60c80b9cf1c3f1ad7003eca61eb50d2e 100644 (file)
@@ -1,42 +1,38 @@
 <?php
+/**
+ * Elgg remove friend action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       /**
-        * Elgg remove friend action
-        * 
-        * @package Elgg
-        * @subpackage Core
+// Ensure we are logged in
+gatekeeper();
+action_gatekeeper();
 
-        * @author Curverider Ltd
+// Get the GUID of the user to friend
+$friend_guid = get_input('friend');
+$friend = get_entity($friend_guid);
+$errors = false;
 
-        * @link http://elgg.org/
-        */
+// Get the user
+try{
+       if ($friend instanceof ElggUser) {
+               $_SESSION['user']->removeFriend($friend_guid);
+       } else{
+               register_error(sprintf(elgg_echo("friends:remove:failure"), $friend->name));
+               $errors = true;
+       }
+} catch (Exception $e) {
+       register_error(sprintf(elgg_echo("friends:remove:failure"), $friend->name));
+       $errors = true;
+}
 
-       // Ensure we are logged in
-               gatekeeper();
-               action_gatekeeper();
-               
-       // Get the GUID of the user to friend
-               $friend_guid = get_input('friend');
-               $friend = get_entity($friend_guid);
-               $errors = false;
+if (!$errors) {
+       system_message(sprintf(elgg_echo("friends:remove:successful"), $friend->name));
+}
 
-       // Get the user
-               try{
-                       if ($friend instanceof ElggUser)
-                               $_SESSION['user']->removeFriend($friend_guid);
-                       else
-                       {
-                               register_error(sprintf(elgg_echo("friends:remove:failure"),$friend->name));
-                               $errors = true;
-                       }
-               } catch (Exception $e) {
-                       register_error(sprintf(elgg_echo("friends:remove:failure"),$friend->name));
-                       $errors = true;
-               }
-               if (!$errors)
-                       system_message(sprintf(elgg_echo("friends:remove:successful"),$friend->name));                  
-               
-       // Forward to the user friends page
-               forward("pg/friends/" . $_SESSION['user']->username . "/");
-               
-?>
\ No newline at end of file
+// Forward to the user friends page
+forward("pg/friends/" . $_SESSION['user']->username . "/");
index 9f01c879d887144d675ef998fb5b22d5e1735561..b91a38dc4c8badcfa0bf95d6c597d716b3d81b0f 100644 (file)
@@ -1,30 +1,30 @@
 <?php
-       /**
       * Elgg OpenDD import action.
-        * 
-        * This action accepts data to import (in OpenDD format) and performs and import. It accepts 
       * data as $data.
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Elgg OpenDD import action.
+ *
+ * This action accepts data to import (in OpenDD format) and performs and import. It accepts
+ * data as $data.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       // Safety
-       admin_gatekeeper();
-       action_gatekeeper();
-       
-       // Get input
-       $data = get_input('data', '', false);
-       
-       // Import 
-       $return = import($data);
-       
-       if ($return)
-               system_message(elgg_echo('importsuccess'));
-       else
-               register_error(elgg_echo('importfail'));
-               
-       forward($_SERVER['HTTP_REFERER']);
-?>
\ No newline at end of file
+// Safety
+admin_gatekeeper();
+action_gatekeeper();
+
+// Get input
+$data = get_input('data', '', false);
+
+// Import
+$return = import($data);
+
+if ($return) {
+       system_message(elgg_echo('importsuccess'));
+} else {
+       register_error(elgg_echo('importfail'));
+}
+
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index f3a60af6df9f42fc13f73348d4970ee3f2734f9e..26a14404570da1b4db7f7b6ac94d431fc7d7d515 100644 (file)
@@ -1,82 +1,69 @@
 <?php
+/**
+ * Elgg login action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-    /**
-        * Elgg login action
-        * 
-        * @package Elgg
-        * @subpackage Core
+// Safety first
+action_gatekeeper();
 
-        * @author Curverider Ltd
+// Get username and password
 
-        * @link http://elgg.org/
-        */
-        
-       // Safety first
-               action_gatekeeper();
+$username = get_input('username');
+$password = get_input("password");
+$persistent = get_input("persistent", false);
 
-    // Get username and password
-    
-        $username = get_input('username');
-        $password = get_input("password");
-        $persistent = get_input("persistent", false);
-        
-    // If all is present and correct, try to log in  
-       $result = false;          
-        if (!empty($username) && !empty($password)) {
-               if ($user = authenticate($username,$password)) {
-                       $result = login($user, $persistent);
-               }
-        }
-        
-    // Set the system_message as appropriate
-        
-        if ($result) {
-            system_message(elgg_echo('loginok'));
-            if ($_SESSION['last_forward_from'])
-            {
-               $forward_url = $_SESSION['last_forward_from'];
-               $_SESSION['last_forward_from'] = "";
-               forward($forward_url);
-            }
-            else
-            {
-               if (
-                       (isadminloggedin()) &&
-                       (!datalist_get('first_admin_login'))
-               ) 
-               {
-                       system_message(elgg_echo('firstadminlogininstructions'));
-                       
-                       datalist_set('first_admin_login', time());
-                       
-                       forward('pg/admin/plugins');
-               } else if (get_input('returntoreferer')) {
-                       forward($_SERVER['HTTP_REFERER']);
-               } else
-                       forward("pg/dashboard/");
-            }
-        } else {
-               $error_msg = elgg_echo('loginerror');
-               // figure out why the login failed
-               if (!empty($username) && !empty($password)) {
-                       // See if it exists and is disabled
-                               $access_status = access_get_show_hidden_status();
-                               access_show_hidden_entities(true);
-                       if (($user = get_user_by_username($username)) && !$user->validated) {
-                               // give plugins a chance to respond
-                               if (!trigger_plugin_hook('unvalidated_login_attempt','user',array('entity'=>$user))) {
-                                       // if plugins have not registered an action, the default action is to
-                                       // trigger the validation event again and assume that the validation
-                                       // event will display an appropriate message
-                                               trigger_elgg_event('validate', 'user', $user);
-                               }
-                       } else {
-                                register_error(elgg_echo('loginerror'));
-                       }
-                       access_show_hidden_entities($access_status);
-               } else {
-               register_error(elgg_echo('loginerror'));
-               }
-        }
-      
-?>
\ No newline at end of file
+// If all is present and correct, try to log in
+$result = false;
+if (!empty($username) && !empty($password)) {
+       if ($user = authenticate($username,$password)) {
+               $result = login($user, $persistent);
+       }
+}
+
+// Set the system_message as appropriate
+if ($result) {
+       system_message(elgg_echo('loginok'));
+       if ($_SESSION['last_forward_from']) {
+               $forward_url = $_SESSION['last_forward_from'];
+               $_SESSION['last_forward_from'] = "";
+               forward($forward_url);
+       } else {
+               if ( (isadminloggedin()) && (!datalist_get('first_admin_login'))) {
+                       system_message(elgg_echo('firstadminlogininstructions'));
+                       datalist_set('first_admin_login', time());
+
+                       forward('pg/admin/plugins');
+               } else if (get_input('returntoreferer')) {
+                       forward($_SERVER['HTTP_REFERER']);
+               } else {
+                       forward("pg/dashboard/");
+               }
+       }
+} else {
+       $error_msg = elgg_echo('loginerror');
+       // figure out why the login failed
+       if (!empty($username) && !empty($password)) {
+               // See if it exists and is disabled
+               $access_status = access_get_show_hidden_status();
+               access_show_hidden_entities(true);
+               if (($user = get_user_by_username($username)) && !$user->validated) {
+                       // give plugins a chance to respond
+                       if (!trigger_plugin_hook('unvalidated_login_attempt','user',array('entity'=>$user))) {
+                               // if plugins have not registered an action, the default action is to
+                               // trigger the validation event again and assume that the validation
+                               // event will display an appropriate message
+                               trigger_elgg_event('validate', 'user', $user);
+                       }
+               } else {
+                       register_error(elgg_echo('loginerror'));
+               }
+               access_show_hidden_entities($access_status);
+       } else {
+               register_error(elgg_echo('loginerror'));
+       }
+}
\ No newline at end of file
index 67ca6ad655d6f6b7c832363b9463a734fb6898f1..de062edd4162a5f4fa3b9afe2ad3296415763d3e 100644 (file)
@@ -1,25 +1,19 @@
 <?php
+/**
+ * Elgg logout action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-    /**
-        * Elgg logout action
-        * 
-        * @package Elgg
-        * @subpackage Core
+// Log out
+$result = logout();
 
-        * @author Curverider Ltd
-
-        * @link http://elgg.org/
-        */
-           
-    // Log out
-        $result = logout();
-            
-    // Set the system_message as appropriate
-        
-        if ($result) {
-            system_message(elgg_echo('logoutok'));
-        } else {
-            register_error(elgg_echo('logouterror'));
-        }
-
-?>
\ No newline at end of file
+// Set the system_message as appropriate
+if ($result) {
+       system_message(elgg_echo('logoutok'));
+} else {
+       register_error(elgg_echo('logouterror'));
+}
\ No newline at end of file
index 41e9e2b179ce5b9e23e15529b7dcf3fa5c62a6c4..159dd501b3f17195fef65b859a19f3b72350f799 100644 (file)
@@ -1,35 +1,28 @@
 <?php
-       /**
       * Elgg notifications user preference save acion.
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Elgg notifications user preference save acion.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       // Method
-       $method = get_input('method');
-       gatekeeper();
-       
-       $result = false;
-       foreach ($method as $k => $v)
-       {
-               $result = set_user_notification_setting($_SESSION['user']->guid, $k, ($v == 'yes') ? true : false);
-               
-               if (!$result)
-               {
-                       register_error(elgg_echo('notifications:usersettings:save:fail'));
-                       //forward($_SERVER['HTTP_REFERER']);
-                       
-                       //exit;
-               }
-       }
-       
-       if ($result)
-               system_message(elgg_echo('notifications:usersettings:save:ok'));
-       else
+// Method
+$method = get_input('method');
+gatekeeper();
+
+$result = false;
+foreach ($method as $k => $v) {
+       $result = set_user_notification_setting($_SESSION['user']->guid, $k, ($v == 'yes') ? true : false);
+
+       if (!$result) {
                register_error(elgg_echo('notifications:usersettings:save:fail'));
-       
-       //forward($_SERVER['HTTP_REFERER']);
-?>
\ No newline at end of file
+       }
+}
+
+if ($result) {
+       system_message(elgg_echo('notifications:usersettings:save:ok'));
+} else {
+       register_error(elgg_echo('notifications:usersettings:save:fail'));
+}
\ No newline at end of file
index 25eba2d72fea177f69c7452a48d3f1d436721bdc..8abc3703b8b3bc0a35cff2a7f9d17b3a81447445 100644 (file)
@@ -1,40 +1,32 @@
 <?php
-       /**
       * Elgg plugin settings save action.
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Elgg plugin settings save action.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       $params = get_input('params');
-       $plugin = get_input('plugin');
+$params = get_input('params');
+$plugin = get_input('plugin');
 
-       gatekeeper();
-       action_gatekeeper();
-       
-       $result = false;
-       
-       foreach ($params as $k => $v)
-       {
-               // Save
-               $result = set_plugin_setting($k, $v, $plugin);
-               
-               // Error?
-               if (!$result)
-               {
-                       register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin));
-                       
-                       forward($_SERVER['HTTP_REFERER']);
-                       
-                       exit;
-               }
+gatekeeper();
+action_gatekeeper();
+
+$result = false;
+
+foreach ($params as $k => $v) {
+       // Save
+       $result = set_plugin_setting($k, $v, $plugin);
+
+       // Error?
+       if (!$result) {
+               register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin));
+               forward($_SERVER['HTTP_REFERER']);
+               exit;
        }
+}
 
-       // An event to tell any interested plugins of the change is settings
-       //trigger_elgg_event('plugin_settings_save', $plugin, find_plugin_settings($plugin)); // replaced by plugin:setting event
-       
-       system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin));
-       forward($_SERVER['HTTP_REFERER']);
-?>
\ No newline at end of file
+system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin));
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index 61e5c7afcfdb2912474d67be2d2c6d6c68f854a8..172e8ee049d739ee92faeee23c11d4fffe5641b2 100644 (file)
@@ -1,40 +1,32 @@
 <?php
-       /**
       * Elgg plugin user settings save action.
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Elgg plugin user settings save action.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       $params = get_input('params');
-       $plugin = get_input('plugin');
+$params = get_input('params');
+$plugin = get_input('plugin');
 
-       gatekeeper();
-       action_gatekeeper();
-       
-       $result = false;
-       
-       foreach ($params as $k => $v)
-       {
-               // Save
-               $result = set_plugin_usersetting($k, $v, $_SESSION['user']->guid, $plugin);
-               
-               // Error?
-               if (!$result)
-               {
-                       register_error(sprintf(elgg_echo('plugins:usersettings:save:fail'), $plugin));
-                       
-                       forward($_SERVER['HTTP_REFERER']);
-                       
-                       exit;
-               }
+gatekeeper();
+action_gatekeeper();
+
+$result = false;
+
+foreach ($params as $k => $v) {
+       // Save
+       $result = set_plugin_usersetting($k, $v, $_SESSION['user']->guid, $plugin);
+
+       // Error?
+       if (!$result) {
+               register_error(sprintf(elgg_echo('plugins:usersettings:save:fail'), $plugin));
+               forward($_SERVER['HTTP_REFERER']);
+               exit;
        }
+}
 
-       // An event to tell any interested plugins of the change is settings
-       //trigger_elgg_event('plugin_usersettings_save', $plugin, find_plugin_settings($plugin)); // replaced by plugin:usersetting event
-       
-       system_message(sprintf(elgg_echo('plugins:usersettings:save:ok'), $plugin));
-       forward($_SERVER['HTTP_REFERER']);
-?>
\ No newline at end of file
+system_message(sprintf(elgg_echo('plugins:usersettings:save:ok'), $plugin));
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index 5c69624b3c560eff36a1381ccae04a598206c649..5abd55a4b4c3bf3aaefffe2e6a5e7a6c93f0ff1c 100644 (file)
@@ -1,81 +1,74 @@
 <?php
+/**
+ * Elgg registration action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       /**
-        * Elgg registration action
-        * 
-        * @package Elgg
-        * @subpackage Core
+require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
+global $CONFIG;
 
-        * @author Curverider Ltd
+action_gatekeeper();
 
-        * @link http://elgg.org/
-        */
+// Get variables
+$username = get_input('username');
+$password = get_input('password');
+$password2 = get_input('password2');
+$email = get_input('email');
+$name = get_input('name');
+$friend_guid = (int) get_input('friend_guid',0);
+$invitecode = get_input('invitecode');
 
-       require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
-       global $CONFIG;
-       
-       action_gatekeeper();
+$admin = get_input('admin');
+if (is_array($admin)) {
+       $admin = $admin[0];
+}
 
-       // Get variables
-               $username = get_input('username');
-               $password = get_input('password');
-               $password2 = get_input('password2');
-               $email = get_input('email');
-               $name = get_input('name');
-               $friend_guid = (int) get_input('friend_guid',0);
-               $invitecode = get_input('invitecode');
-               
-               $admin = get_input('admin');
-               if (is_array($admin)) $admin = $admin[0];
-               
-               
-               if (!$CONFIG->disable_registration)
-               {
-       // For now, just try and register the user
-       
-                       try {
-                               if (
-                                       (
-                                               (trim($password)!="") &&
-                                               (strcmp($password, $password2)==0) 
-                                       ) &&
-                                       ($guid = register_user($username, $password, $name, $email, false, $friend_guid, $invitecode))
-                               ) {
-                                       
-                                       $new_user = get_entity($guid);
-                                       if (($guid) && ($admin))
-                                       {
-                                               admin_gatekeeper(); // Only admins can make someone an admin
-                                               $new_user->admin = 'yes';
-                                       }
-                                       
-                                       // Send user validation request on register only
-                                       global $registering_admin;
-                                       if (!$registering_admin)
-                                               request_user_validation($guid);
-                                       
-                                       if (!$new_user->admin)
-                                               $new_user->disable('new_user', false);  // Now disable if not an admin
-                                               // Don't do a recursive disable.  Any entities owned by the user at this point
-                                               // are products of plugins that
-                                       
-                                       system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename));
-                                       
-                                       forward(); // Forward on success, assume everything else is an error...
-                               } else {
-                                       register_error(elgg_echo("registerbad"));
-                               }
-                       } catch (RegistrationException $r) {
-                               register_error($r->getMessage());
+if (!$CONFIG->disable_registration) {
+// For now, just try and register the user
+       try {
+               $guid = register_user($username, $password, $name, $email, false, $friend_guid, $invitecode);
+               if (((trim($password) != "") && (strcmp($password, $password2) == 0)) && ($guid)) {
+                       $new_user = get_entity($guid);
+                       if (($guid) && ($admin)) {
+                               // Only admins can make someone an admin
+                               admin_gatekeeper();
+                               $new_user->admin = 'yes';
                        }
+
+                       // Send user validation request on register only
+                       global $registering_admin;
+                       if (!$registering_admin) {
+                               request_user_validation($guid);
+                       }
+
+                       if (!$new_user->admin) {
+                               // Now disable if not an admin
+                               // Don't do a recursive disable.  Any entities owned by the user at this point
+                               // are products of plugins that hook into create user and might need
+                               // access to the entities.
+                               $new_user->disable('new_user', false);
+                       }
+
+                       system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename));
+
+                       // Forward on success, assume everything else is an error...
+                       forward();
+               } else {
+                       register_error(elgg_echo("registerbad"));
                }
-               else
-                       register_error(elgg_echo('registerdisabled'));
-                       
-               $qs = explode('?',$_SERVER['HTTP_REFERER']);
-               $qs = $qs[0];
-               $qs .= "?u=" . urlencode($username) . "&e=" . urlencode($email) . "&n=" . urlencode($name) . "&friend_guid=" . $friend_guid;
-               
-               forward($qs);
+       } catch (RegistrationException $r) {
+               register_error($r->getMessage());
+       }
+} else {
+       register_error(elgg_echo('registerdisabled'));
+}
+
+$qs = explode('?',$_SERVER['HTTP_REFERER']);
+$qs = $qs[0];
+$qs .= "?u=" . urlencode($username) . "&e=" . urlencode($email) . "&n=" . urlencode($name) . "&friend_guid=" . $friend_guid;
 
-?>
\ No newline at end of file
+forward($qs);
\ No newline at end of file
index 8b0a31cedf2dba43108676d96bca6e71c25d732d..819ef08eebed0907afee9b85f9c2df5f7868597a 100644 (file)
 <?php
+/**
+ * Elgg install site action
+ *
+ * Creates a nwe site and sets it as the default
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       /**
-        * Elgg install site action
-        * 
-        * Creates a nwe site and sets it as the default
-        * 
-        * @package Elgg
-        * @subpackage Core
-
-        * @author Curverider Ltd
-
-        * @link http://elgg.org/
-        */
-
-       elgg_set_viewtype('failsafe'); // Set failsafe again incase we get an exception thrown
-       
-       if (is_installed()) forward();
-
-       if (get_input('settings') == 'go') {
-               
-               if (!datalist_get('default_site')) {
-                       
-                       // Sanitise
-                       $path = sanitise_filepath(get_input('path'));
-                       $dataroot = sanitise_filepath(get_input('dataroot'));
-                       
-                       // Blank?
-                       if ($dataroot == "/")
-                               throw new InstallationException(elgg_echo('InstallationException:DatarootBlank'));
-                               
-                       // That it's valid
-                       if (stripos($dataroot, $path)!==false)
-                               throw new InstallationException(sprintf(elgg_echo('InstallationException:DatarootUnderPath'), $dataroot));
-                       
-                       // Check data root is writable
-                       if (!is_writable($dataroot))
-                               throw new InstallationException(sprintf(elgg_echo('InstallationException:DatarootNotWritable'), $dataroot));
-                       
-                       
-                       $site = new ElggSite();
-                       $site->name = get_input('sitename');
-                       $site->url = get_input('wwwroot');
-                       $site->description = get_input('sitedescription');
-                       $site->email = get_input('siteemail');
-                       $site->access_id = ACCESS_PUBLIC;
-                       $guid = $site->save();
-                       
-                       if (!$guid)
-                               throw new InstallationException(sprintf(elgg_echo('InstallationException:CantCreateSite'), get_input('sitename'), get_input('wwwroot')));
-                       
-                       datalist_set('installed',time());
-                       
-                       datalist_set('path', $path);
-                       datalist_set('dataroot', $dataroot);
-                       
-                       datalist_set('default_site',$site->getGUID());
-                       
-                       set_config('view', get_input('view'), $site->getGUID());
-                       set_config('language', get_input('language'), $site->getGUID());
-                       set_config('default_access', get_input('default_access'), $site->getGUID());
-                       
-                       $debug = get_input('debug');
-                       if ($debug)
-                               set_config('debug', 1, $site->getGUID());
-                       else
-                               unset_config('debug', $site->getGUID());
-                               
-                       $usage = get_input('usage');
-                       if (is_array($usage)) $usage = $usage[0];
-                       
-                       if ($usage)
-                               unset_config('ping_home', $site->getGUID());
-                       else
-                               set_config('ping_home', 'disabled', $site->getGUID());
-                               
-                       $api = get_input('api');
-                       if ($api)
-                               unset_config('disable_api', $site->getGUID());
-                       else
-                               set_config('disable_api', 'disabled', $site->getGUID());
-                               
-                       $https_login = get_input('https_login'); 
-                       if ($https_login)
-                               set_config('https_login', 1, $site->getGUID());
-                       else
-                               unset_config('https_login', $site->getGUID());
-                       
-                       // activate some plugins by default
-                       if (isset($CONFIG->default_plugins))
-                       {
-                               if (!is_array($CONFIG->default_plugins))
-                                       $plugins = explode(',', $CONFIG->default_plugins);
-                               else
-                                       $CONFIG->default_plugins = $CONFIG->default_plugins;
-                                       
-                               foreach ($plugins as $plugin)
-                                       enable_plugin(trim($plugin), $site->getGUID());
-                       }
-                       else
-                       {
-                               enable_plugin('profile', $site->getGUID());
-                               enable_plugin('river', $site->getGUID());
-                               enable_plugin('logbrowser', $site->getGUID());
-                               enable_plugin('diagnostics', $site->getGUID());
-                               enable_plugin('uservalidationbyemail', $site->getGUID());
-                               enable_plugin('htmlawed', $site->getGUID());
+elgg_set_viewtype('failsafe'); // Set failsafe again incase we get an exception thrown
+
+if (is_installed()) {
+       forward();
+}
+
+if (get_input('settings') == 'go') {
+       if (!datalist_get('default_site')) {
+               // Sanitise
+               $path = sanitise_filepath(get_input('path'));
+               $dataroot = sanitise_filepath(get_input('dataroot'));
+
+               // Blank?
+               if ($dataroot == "/") {
+                       throw new InstallationException(elgg_echo('InstallationException:DatarootBlank'));
+               }
+
+               // That it's valid
+               if (stripos($dataroot, $path)!==false) {
+                       throw new InstallationException(sprintf(elgg_echo('InstallationException:DatarootUnderPath'), $dataroot));
+               }
+
+               // Check data root is writable
+               if (!is_writable($dataroot)) {
+                       throw new InstallationException(sprintf(elgg_echo('InstallationException:DatarootNotWritable'), $dataroot));
+               }
+
+               $site = new ElggSite();
+               $site->name = get_input('sitename');
+               $site->url = get_input('wwwroot');
+               $site->description = get_input('sitedescription');
+               $site->email = get_input('siteemail');
+               $site->access_id = ACCESS_PUBLIC;
+               $guid = $site->save();
+
+               if (!$guid) {
+                       throw new InstallationException(sprintf(elgg_echo('InstallationException:CantCreateSite'), get_input('sitename'), get_input('wwwroot')));
+               }
+
+               datalist_set('installed',time());
+
+               datalist_set('path', $path);
+               datalist_set('dataroot', $dataroot);
+
+               datalist_set('default_site',$site->getGUID());
+
+               set_config('view', get_input('view'), $site->getGUID());
+               set_config('language', get_input('language'), $site->getGUID());
+               set_config('default_access', get_input('default_access'), $site->getGUID());
+
+               $debug = get_input('debug');
+               if ($debug) {
+                       set_config('debug', 1, $site->getGUID());
+               } else {
+                       unset_config('debug', $site->getGUID());
+               }
+
+               $usage = get_input('usage');
+               if (is_array($usage)) {
+                       $usage = $usage[0];
+               }
+
+               if ($usage) {
+                       unset_config('ping_home', $site->getGUID());
+               } else {
+                       set_config('ping_home', 'disabled', $site->getGUID());
+               }
+
+               $api = get_input('api');
+               if ($api) {
+                       unset_config('disable_api', $site->getGUID());
+               } else {
+                       set_config('disable_api', 'disabled', $site->getGUID());
+               }
+
+               $https_login = get_input('https_login');
+               if ($https_login) {
+                       set_config('https_login', 1, $site->getGUID());
+               } else {
+                       unset_config('https_login', $site->getGUID());
+               }
+
+               // activate some plugins by default
+               if (isset($CONFIG->default_plugins)) {
+                       if (!is_array($CONFIG->default_plugins)) {
+                               $plugins = explode(',', $CONFIG->default_plugins);
+                       } else {
+                               $CONFIG->default_plugins = $CONFIG->default_plugins;
                        }
-                               
-                       // Now ping home
-                       if ($usage)
-                       {
-                               ping_home($site);
+
+                       foreach ($plugins as $plugin){
+                               enable_plugin(trim($plugin), $site->getGUID());
                        }
-                               
-                       system_message(elgg_echo("installation:configuration:success"));
-                       
-                       header("Location: ../../account/register.php");
-                       exit;
-                       
+               } else {
+                       enable_plugin('profile', $site->getGUID());
+                       enable_plugin('river', $site->getGUID());
+                       enable_plugin('logbrowser', $site->getGUID());
+                       enable_plugin('diagnostics', $site->getGUID());
+                       enable_plugin('uservalidationbyemail', $site->getGUID());
+                       enable_plugin('htmlawed', $site->getGUID());
                }
-               
-       }
 
-?>
\ No newline at end of file
+               // Now ping home
+               if ($usage) {
+                       ping_home($site);
+               }
+
+               system_message(elgg_echo("installation:configuration:success"));
+
+               header("Location: ../../account/register.php");
+               exit;
+       }
+}
index b79200ad0ed5dca806fb571da072cdb5280f1e25..2e08631a1f7bb865556d633f320384599ca321e6 100644 (file)
@@ -1,44 +1,39 @@
 <?php
-       /**
       * Action for changing a user's default access level
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Action for changing a user's default access level
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       global $CONFIG;
-       
-       if ($CONFIG->allow_user_default_access) {
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
 
-               gatekeeper();
-               
-               $default_access = get_input('default_access');
-               $user_id = get_input('guid');
-               $user = "";
-               
-               if (!$user_id)
-                       $user = $_SESSION['user'];
-               else
-                       $user = get_entity($user_id);
-                       
-               if ($user)
-               {
-                       $current_default_access = $user->getPrivateSetting('elgg_default_access');
-                       if ($default_access != $current_default_access)
-                       {
-                               if ($user->setPrivateSetting('elgg_default_access',$default_access))
-                                       system_message(elgg_echo('user:default_access:success'));
-                               else
-                                       register_error(elgg_echo('user:default_access:fail'));
+if ($CONFIG->allow_user_default_access) {
+       gatekeeper();
+
+       $default_access = get_input('default_access');
+       $user_id = get_input('guid');
+       $user = "";
+
+       if (!$user_id) {
+               $user = $_SESSION['user'];
+       } else {
+               $user = get_entity($user_id);
+       }
+
+       if ($user) {
+               $current_default_access = $user->getPrivateSetting('elgg_default_access');
+               if ($default_access != $current_default_access) {
+                       if ($user->setPrivateSetting('elgg_default_access',$default_access)) {
+                               system_message(elgg_echo('user:default_access:success'));
+                       } else {
+                               register_error(elgg_echo('user:default_access:fail'));
                        }
                }
-               else
-                       register_error(elgg_echo('user:default_access:fail'));
+       } else {
+               register_error(elgg_echo('user:default_access:fail'));
        }
-       
-       //forward($_SERVER['HTTP_REFERER']);
-       //exit;
-?>
\ No newline at end of file
+}
\ No newline at end of file
index cec650d7d0d1ae457590b577c20bfc09198d4288..f0837e1e55404d498d024fa7dc32d4e87d8a6292 100644 (file)
@@ -1,41 +1,37 @@
 <?php
-       /**
       * Action for changing a user's personal language settings
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Action for changing a user's personal language settings
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       global $CONFIG;
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
 
-       gatekeeper();
-       
-       $language = get_input('language');
-       $user_id = get_input('guid');
-       $user = "";
-       
-       if (!$user_id)
-               $user = $_SESSION['user'];
-       else
-               $user = get_entity($user_id);
-               
-       if (($user) && ($language))
-       {
-               if (strcmp($language, $user->language)!=0)
-               {
-                       $user->language = $language;
-                       if ($user->save())
-                               system_message(elgg_echo('user:language:success'));
-                       else
-                               register_error(elgg_echo('user:language:fail'));
+gatekeeper();
+
+$language = get_input('language');
+$user_id = get_input('guid');
+$user = "";
+
+if (!$user_id) {
+       $user = $_SESSION['user'];
+} else {
+       $user = get_entity($user_id);
+}
+
+if (($user) && ($language)) {
+       if (strcmp($language, $user->language)!=0) {
+               $user->language = $language;
+               if ($user->save()) {
+                       system_message(elgg_echo('user:language:success'));
+               } else {
+                       register_error(elgg_echo('user:language:fail'));
                }
        }
-       else
-               register_error(elgg_echo('user:language:fail'));
-       
-       //forward($_SERVER['HTTP_REFERER']);
-       //exit;
-?>
\ No newline at end of file
+} else {
+       register_error(elgg_echo('user:language:fail'));
+}
index 1c102c25fd17d57b485be900294da7cbf241221d..19a3422e87c089eb2f42b0ac9c890044da3852c6 100644 (file)
@@ -1,41 +1,37 @@
 <?php
-       /**
       * Action for changing a user's name
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Action for changing a user's name
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       global $CONFIG;
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
 
-       gatekeeper();
-       
-       $name = get_input('name');
-       $user_id = get_input('guid');
-       $user = "";
-       
-       if (!$user_id)
-               $user = $_SESSION['user'];
-       else
-               $user = get_entity($user_id);
-               
-       if (($user) && ($name))
-       {
-               if (strcmp($name, $user->name)!=0)
-               {
-                       $user->name = $name;
-                       if ($user->save())
-                               system_message(elgg_echo('user:name:success'));
-                       else
-                               register_error(elgg_echo('user:name:fail'));
+gatekeeper();
+
+$name = get_input('name');
+$user_id = get_input('guid');
+$user = "";
+
+if (!$user_id) {
+       $user = $_SESSION['user'];
+} else {
+       $user = get_entity($user_id);
+}
+
+if (($user) && ($name)) {
+       if (strcmp($name, $user->name)!=0) {
+               $user->name = $name;
+               if ($user->save()) {
+                       system_message(elgg_echo('user:name:success'));
+               } else {
+                       register_error(elgg_echo('user:name:fail'));
                }
        }
-       else
-               register_error(elgg_echo('user:name:fail'));
-       
-       //forward($_SERVER['HTTP_REFERER']);
-       //exit;
-?>
\ No newline at end of file
+} else {
+       register_error(elgg_echo('user:name:fail'));
+}
\ No newline at end of file
index e8d67a87b07d8a4aa14d748d297424d9875d69a5..d2fcb95d8ca2cec87290ead445630bd4df868fd0 100644 (file)
@@ -1,48 +1,43 @@
 <?php
-       /**
       * Action for changing a user's password
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Action for changing a user's password
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       global $CONFIG;
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
 
-       gatekeeper();
-       
-       $password = get_input('password');
-       $password2 = get_input('password2');
-       $user_id = get_input('guid');
-       $user = "";
-       
-       if (!$user_id)
-               $user = $_SESSION['user'];
-       else
-               $user = get_entity($user_id);
-               
-       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);
-                               if ($user->save())
-                                       system_message(elgg_echo('user:password:success'));
-                               else
-                                       register_error(elgg_echo('user:password:fail'));
+gatekeeper();
+
+$password = get_input('password');
+$password2 = get_input('password2');
+$user_id = get_input('guid');
+$user = "";
+
+if (!$user_id) {
+       $user = $_SESSION['user'];
+} else {
+       $user = get_entity($user_id);
+}
+
+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);
+                       if ($user->save()) {
+                               system_message(elgg_echo('user:password:success'));
+                       } else {
+                               register_error(elgg_echo('user:password:fail'));
                        }
-                       else
-                               register_error(elgg_echo('user:password:fail:notsame'));
+               } else {
+                       register_error(elgg_echo('user:password:fail:notsame'));
                }
-               else
-                       register_error(elgg_echo('user:password:fail:tooshort'));
+       } else {
+               register_error(elgg_echo('user:password:fail:tooshort'));
        }
-       
-       //forward($_SERVER['HTTP_REFERER']);
-       //exit;
-?>
\ No newline at end of file
+}
\ No newline at end of file
index ea744b955fdd17c87f36bb76296c75efb6b65ed8..c6d8a70b1ac64568ae468342be823a8e34338e81 100644 (file)
@@ -1,25 +1,24 @@
 <?php
-       /**
       * Action to reset a password and send success email.
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Action to reset a password and send success email.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       global $CONFIG;
-       
-       $user_guid = get_input('u');
-       $code = get_input('c');
-       
-       if (execute_new_password_request($user_guid, $code))
-               system_message(elgg_echo('user:password:success'));
-       else
-               register_error(elgg_echo('user:password:fail'));
-               
-       forward();
-       exit;
-       
-?>
\ No newline at end of file
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
+
+$user_guid = get_input('u');
+$code = get_input('c');
+
+if (execute_new_password_request($user_guid, $code)) {
+       system_message(elgg_echo('user:password:success'));
+} else {
+       register_error(elgg_echo('user:password:fail'));
+}
+
+forward();
+exit;
index a54e71b7e47c0a0b1b89d74fee8104d6b471f30d..d951e2edea8e7009a327643e400a231b363b34c1 100644 (file)
@@ -1,41 +1,40 @@
 <?php
-       /**
       * Action to request a new password.
-        * 
       * @package Elgg
       * @subpackage Core
       * @author Curverider Ltd
       * @link http://elgg.org/
       */
+/**
+ * Action to request a new password.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       global $CONFIG;
-       
-       action_gatekeeper();
-       
-       $username = get_input('username');
-       
-       $access_status = access_get_show_hidden_status();
-       access_show_hidden_entities(true);
-       $user = get_user_by_username($username);
-       if ($user)
-       {
-               if ($user->validated) {
-                       if (send_new_password_request($user->guid))
-                               system_message(elgg_echo('user:password:resetreq:success'));
-                       else
-                               register_error(elgg_echo('user:password:resetreq:fail'));
-               } else if (!trigger_plugin_hook('unvalidated_requestnewpassword','user',array('entity'=>$user))) {
-               // if plugins have not registered an action, the default action is to
-               // trigger the validation event again and assume that the validation
-               // event will display an appropriate message
-                       trigger_elgg_event('validate', 'user', $user);
-        }
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
+
+action_gatekeeper();
+
+$username = get_input('username');
+
+$access_status = access_get_show_hidden_status();
+access_show_hidden_entities(true);
+$user = get_user_by_username($username);
+if ($user) {
+       if ($user->validated) {
+               if (send_new_password_request($user->guid)) {
+                       system_message(elgg_echo('user:password:resetreq:success'));
+               } else {
+                       register_error(elgg_echo('user:password:resetreq:fail'));
+               }
+       } else if (!trigger_plugin_hook('unvalidated_requestnewpassword','user',array('entity'=>$user))) {
+               // if plugins have not registered an action, the default action is to
+               // trigger the validation event again and assume that the validation
+               // event will display an appropriate message
+               trigger_elgg_event('validate', 'user', $user);
        }
-       else
-               register_error(sprintf(elgg_echo('user:username:notfound'), $username));
-               
-       access_show_hidden_entities($access_status);
-       forward();
-       exit;
-?>
\ No newline at end of file
+} else {
+       register_error(sprintf(elgg_echo('user:username:notfound'), $username));
+}
+
+access_show_hidden_entities($access_status);
+forward();
+exit;
\ No newline at end of file
index 8f50df2c82c08911fb36e1ceef52aeb0c5e41a89..ff111461ee6040d86cc2cdbc0bef8e1c852f9766 100644 (file)
@@ -1,15 +1,21 @@
 <?php
+/**
+ * Close or open spotlight.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-               gatekeeper();
-               
-               $closed = get_input('closed','true');
-               if ($closed != 'true') {
-                       $closed = false;
-               } else {
-                       $closed = true;
-               }
-               
-               $_SESSION['user']->spotlightclosed = $closed;
-               exit;
+gatekeeper();
 
-?>
\ No newline at end of file
+$closed = get_input('closed','true');
+if ($closed != 'true') {
+       $closed = false;
+} else {
+       $closed = true;
+}
+
+$_SESSION['user']->spotlightclosed = $closed;
+exit;
\ No newline at end of file
index 0149a9753c070556f6d3eed10d4e283f89882099..2a8f64fd525c9618f8aaf4e5a702877b54d91c3f 100644 (file)
@@ -1,57 +1,53 @@
 <?php
+/**
+ * Elgg add action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       /**
-        * Elgg add action
-        * 
-        * @package Elgg
-        * @subpackage Core
-        * @author Curverider Ltd
-        * @link http://elgg.org/
-        */
-
-       require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
-
-       admin_gatekeeper(); // Only admins can add a user
-       action_gatekeeper();
-       
-       // Get variables
-       global $CONFIG;
-       $username = get_input('username');
-       $password = get_input('password');
-       $password2 = get_input('password2');
-       $email = get_input('email');
-       $name = get_input('name');
-       
-       $admin = get_input('admin');
-       if (is_array($admin)) $admin = $admin[0];
-       
-       // For now, just try and register the user
-       try {
-               if (
-                       (
-                               (trim($password)!="") &&
-                               (strcmp($password, $password2)==0) 
-                       ) &&
-                       ($guid = register_user($username, $password, $name, $email, true))
-               ) {
-                       $new_user = get_entity($guid);
-                       if (($guid) && ($admin))
-                               $new_user->admin = 'yes';
-                       
-                       $new_user->admin_created = true;
-                       $new_user->created_by_guid = get_loggedin_userid();
-                       
-                       
-                       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));
-                       
-                       system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename));
-               } else {
-                       register_error(elgg_echo("adduser:bad"));
+require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
+
+admin_gatekeeper(); // Only admins can add a user
+action_gatekeeper();
+
+// Get variables
+global $CONFIG;
+$username = get_input('username');
+$password = get_input('password');
+$password2 = get_input('password2');
+$email = get_input('email');
+$name = get_input('name');
+
+$admin = get_input('admin');
+if (is_array($admin)) {
+       $admin = $admin[0];
+}
+
+// For now, just try and register the user
+try {
+       $guid = register_user($username, $password, $name, $email, true);
+
+       if (((trim($password) != "") && (strcmp($password, $password2)==0)) && ($guid)) {
+               $new_user = get_entity($guid);
+               if (($guid) && ($admin)) {
+                       $new_user->admin = 'yes';
                }
-       } catch (RegistrationException $r) {
-               register_error($r->getMessage());
+
+               $new_user->admin_created = true;
+               $new_user->created_by_guid = get_loggedin_userid();
+
+               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));
+
+               system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename));
+       } else {
+               register_error(elgg_echo("adduser:bad"));
        }
+} catch (RegistrationException $r) {
+       register_error($r->getMessage());
+}
 
-       forward($_SERVER['HTTP_REFERER']);
-       exit;
-?>
\ No newline at end of file
+forward($_SERVER['HTTP_REFERER']);
+exit;
\ No newline at end of file
index 8c920def15c4e4c0fad4a000832b2e0f6366271c..cf551cc7c1226264d700d78e8f8fbc2af341162b 100644 (file)
@@ -1,22 +1,18 @@
 <?php
-       /**
-        * Aggregate action for saving settings
-        * 
-        * @package Elgg
-        * @subpackage Core
+/**
+ * Aggregate action for saving settings
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @link http://elgg.org/
+ */
 
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
 
-        * @link http://elgg.org/
-        */
+gatekeeper();
+action_gatekeeper();
 
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       global $CONFIG;
+trigger_plugin_hook('usersettings:save','user');
 
-       gatekeeper();
-       action_gatekeeper();
-       
-       trigger_plugin_hook('usersettings:save','user');
-       
-       forward($_SERVER['HTTP_REFERER']);
-       
-?>
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index 14653eb18913fca8ade25ea66d9ce01122fdd83a..66d1331953d662d3df2b10bde59f7b07efd3ff39 100644 (file)
@@ -1,43 +1,32 @@
 <?php
+/**
+ * Elgg widget add action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       /**
-        * Elgg widget add action
-        * 
-        * @package Elgg
-        * @subpackage Core
+$guid = get_input('user');
+$handler = get_input('handler');
+$context = get_input('context');
+$column = get_input('column');
 
-        * @author Curverider Ltd
+$result = false;
 
-        * @link http://elgg.org/
-        */
-
-               $guid = get_input('user');
-               $handler = get_input('handler');
-               $context = get_input('context');
-               $column = get_input('column');
-               
-               $result = false;
-               
-               if (!empty($guid)) {
-                       
-                       if ($user = get_entity($guid)) {
-                               
-                               if ($user->canEdit()) {
-                                       
-                                       $result = add_widget($user->getGUID(),$handler,$context,0,$column);
-                                       
-                               }
-                               
-                       }
-                       
-               }
-               
-               if ($result) {
-                       system_message(elgg_echo('widgets:save:success'));
-               } else {
-                       register_error(elgg_echo('widgets:save:failure'));
+if (!empty($guid)) {
+       if ($user = get_entity($guid)) {
+               if ($user->canEdit()) {
+                       $result = add_widget($user->getGUID(),$handler,$context,0,$column);
                }
-               
-               forward($_SERVER['HTTP_REFERER']);
+       }
+}
+
+if ($result) {
+       system_message(elgg_echo('widgets:save:success'));
+} else {
+       register_error(elgg_echo('widgets:save:failure'));
+}
 
-?>
\ No newline at end of file
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index 3e3a98ebb99ae1305a6760670b5c68a3968e707d..9398630ca782f326778fa6a8928d132168772857 100644 (file)
@@ -1,32 +1,26 @@
 <?php
+/**
+ * Elgg widget reorder action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       /**
-        * Elgg widget reorder action
-        * 
-        * @package Elgg
-        * @subpackage Core
+$owner = get_input('owner');
+$context = get_input('context');
 
-        * @author Curverider Ltd
+$maincontent = get_input('debugField1');
+$sidebar = get_input('debugField2');
+$rightbar = get_input('debugField3');
 
-        * @link http://elgg.org/
-        */
+$result = reorder_widgets_from_panel($maincontent, $sidebar, $rightbar, $context, $owner);
 
+if ($result) {
+       system_message(elgg_echo('widgets:panel:save:success'));
+} else {
+       register_error(elgg_echo('widgets:panel:save:failure'));
+}
 
-               $owner = get_input('owner');
-               $context = get_input('context');
-               
-               $maincontent = get_input('debugField1');
-               $sidebar = get_input('debugField2');
-               $rightbar = get_input('debugField3');
-               
-               $result = reorder_widgets_from_panel($maincontent, $sidebar, $rightbar, $context, $owner);
-               
-               if ($result) {
-                       system_message(elgg_echo('widgets:panel:save:success'));
-               } else {
-                       register_error(elgg_echo('widgets:panel:save:failure'));
-               }
-               
-               forward($_SERVER['HTTP_REFERER']);
-
-?>
\ No newline at end of file
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index 6fdf79c114def3037cdd2fca56d0c1e17d7233cc..60861acb82ab6a557c98517df09ecc9fbe138fea 100644 (file)
@@ -1,38 +1,32 @@
 <?php
+/**
+ * Elgg widget save action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
 
-       /**
-        * Elgg widget save action
-        * 
-        * @package Elgg
-        * @subpackage Core
+action_gatekeeper();
 
-        * @author Curverider Ltd
+$guid = get_input('guid');
+$params = $_REQUEST['params'];
+$pageurl = get_input('pageurl');
+$noforward = get_input('noforward',false);
 
-        * @link http://elgg.org/
-        */
+$result = false;
 
-               action_gatekeeper();
-               
-               $guid = get_input('guid');
-               $params = $_REQUEST['params'];
-               $pageurl = get_input('pageurl');
-               $noforward = get_input('noforward',false);
+if (!empty($guid)) {
+       $result = save_widget_info($guid,$params);
+}
 
-               $result = false;
-               
-               if (!empty($guid)) {
-                       
-                       $result = save_widget_info($guid,$params);
-                       
-               }
-               
-               if ($result) {
-                       system_message(elgg_echo('widgets:save:success'));
-               } else {
-                       register_error(elgg_echo('widgets:save:failure'));
-               }
-               
-               if (!$noforward)
-                       forward($_SERVER['HTTP_REFERER']);
+if ($result) {
+       system_message(elgg_echo('widgets:save:success'));
+} else {
+       register_error(elgg_echo('widgets:save:failure'));
+}
 
-?>
\ No newline at end of file
+if (!$noforward) {
+       forward($_SERVER['HTTP_REFERER']);
+}
\ No newline at end of file