From c5cc2821311012a8a4385a304a043c4b41f2afbb Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 31 Aug 2009 19:05:21 +0000 Subject: All line endings are now Unix-style. git-svn-id: https://code.elgg.org/elgg/trunk@3451 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/admin/plugins/disable.php | 4 +- actions/admin/plugins/disableall.php | 4 +- actions/admin/plugins/enable.php | 2 +- actions/admin/plugins/reorder.php | 98 +++++++-------- actions/admin/site/update_basic.php | 190 ++++++++++++++-------------- actions/admin/user/ban.php | 12 +- actions/comments/add.php | 110 ++++++++-------- actions/comments/delete.php | 64 +++++----- actions/email/save.php | 4 +- actions/friends/add.php | 72 +++++------ actions/friends/addcollection.php | 92 +++++++------- actions/friends/deletecollection.php | 92 +++++++------- actions/friends/editcollection.php | 34 ++--- actions/friends/remove.php | 64 +++++----- actions/login.php | 108 ++++++++-------- actions/logout.php | 44 +++---- actions/register.php | 62 +++++----- actions/systemsettings/install.php | 234 +++++++++++++++++------------------ actions/user/default_access.php | 8 +- actions/user/requestnewpassword.php | 20 +-- actions/user/spotlight.php | 28 ++--- actions/useradd.php | 8 +- actions/usersettings/save.php | 38 +++--- actions/widgets/add.php | 80 ++++++------ actions/widgets/reorder.php | 58 ++++----- actions/widgets/save.php | 68 +++++----- 26 files changed, 799 insertions(+), 799 deletions(-) (limited to 'actions') diff --git a/actions/admin/plugins/disable.php b/actions/admin/plugins/disable.php index 2241730ad..90825bc2f 100644 --- a/actions/admin/plugins/disable.php +++ b/actions/admin/plugins/disable.php @@ -29,9 +29,9 @@ else register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p)); } - + elgg_view_regenerate_simplecache(); - elgg_filepath_cache_reset(); + elgg_filepath_cache_reset(); forward($_SERVER['HTTP_REFERER']); exit; diff --git a/actions/admin/plugins/disableall.php b/actions/admin/plugins/disableall.php index 5d0be4ad6..672915bce 100644 --- a/actions/admin/plugins/disableall.php +++ b/actions/admin/plugins/disableall.php @@ -26,9 +26,9 @@ else register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p)); } - + elgg_view_regenerate_simplecache(); - elgg_filepath_cache_reset(); + elgg_filepath_cache_reset(); forward($_SERVER['HTTP_REFERER']); exit; diff --git a/actions/admin/plugins/enable.php b/actions/admin/plugins/enable.php index 26d7abaf4..890e6648e 100644 --- a/actions/admin/plugins/enable.php +++ b/actions/admin/plugins/enable.php @@ -29,7 +29,7 @@ else register_error(sprintf(elgg_echo('admin:plugins:enable:no'), $p)); } - + elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); diff --git a/actions/admin/plugins/reorder.php b/actions/admin/plugins/reorder.php index 50409df95..36ba1f66d 100644 --- a/actions/admin/plugins/reorder.php +++ b/actions/admin/plugins/reorder.php @@ -1,54 +1,54 @@ - \ No newline at end of file diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php index d56e1d296..31a6b401e 100644 --- a/actions/admin/site/update_basic.php +++ b/actions/admin/site/update_basic.php @@ -1,103 +1,103 @@ -description = get_input('sitedescription'); - $site->name = get_input('sitename'); - $site->email = get_input('siteemail'); - $site->url = get_input('wwwroot'); - - datalist_set('path',sanitise_filepath(get_input('path'))); - datalist_set('dataroot',sanitise_filepath(get_input('dataroot'))); - if (get_input('simplecache_enabled')) { - elgg_view_enable_simplecache(); - } else { - elgg_view_disable_simplecache(); + * @author Curverider Ltd + + * @link http://elgg.org/ + */ + + global $CONFIG; + + // block non-admin users + admin_gatekeeper(); + action_gatekeeper(); + + if (get_input('settings') == 'go') { + + if (datalist_get('default_site')) { + + $site = get_entity(datalist_get('default_site')); + if (!($site instanceof ElggSite)) + throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite')); + + $site->description = get_input('sitedescription'); + $site->name = get_input('sitename'); + $site->email = get_input('siteemail'); + $site->url = get_input('wwwroot'); + + datalist_set('path',sanitise_filepath(get_input('path'))); + datalist_set('dataroot',sanitise_filepath(get_input('dataroot'))); + if (get_input('simplecache_enabled')) { + elgg_view_enable_simplecache(); + } else { + elgg_view_disable_simplecache(); } if (get_input('viewpath_cache_enabled')) { elgg_enable_filepath_cache(); } else { elgg_disable_filepath_cache(); - } - - set_config('language', get_input('language'), $site->getGUID()); - - set_config('default_access', get_input('default_access'), $site->getGUID()); - - if (get_input('allow_user_default_access')) { - set_config('allow_user_default_access', 1, $site->getGUID()); - } else { - set_config('allow_user_default_access', 0, $site->getGUID()); - } - - set_config('view', get_input('view'), $site->getGUID()); - - $debug = get_input('debug'); - if ($debug) - set_config('debug', 1, $site->getGUID()); - else - unset_config('debug', $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()); - - $usage = get_input('usage'); - 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()); - - // Now ping home - //if ((!isset($usage)) || ($usage!='disabled')) - //{ - // ping_home($site); - //} - - if ($site->save()) - system_message(elgg_echo("admin:configuration:success")); - else - register_error(elgg_echo("admin:configuration:fail")); - - //header("Location: {$CONFIG->wwwroot}admin/site/"); - forward($_SERVER['HTTP_REFERER']); - exit; - - } - - } - + } + + set_config('language', get_input('language'), $site->getGUID()); + + set_config('default_access', get_input('default_access'), $site->getGUID()); + + if (get_input('allow_user_default_access')) { + set_config('allow_user_default_access', 1, $site->getGUID()); + } else { + set_config('allow_user_default_access', 0, $site->getGUID()); + } + + set_config('view', get_input('view'), $site->getGUID()); + + $debug = get_input('debug'); + if ($debug) + set_config('debug', 1, $site->getGUID()); + else + unset_config('debug', $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()); + + $usage = get_input('usage'); + 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()); + + // Now ping home + //if ((!isset($usage)) || ($usage!='disabled')) + //{ + // ping_home($site); + //} + + if ($site->save()) + system_message(elgg_echo("admin:configuration:success")); + else + register_error(elgg_echo("admin:configuration:fail")); + + //header("Location: {$CONFIG->wwwroot}admin/site/"); + forward($_SERVER['HTTP_REFERER']); + exit; + + } + + } + ?> \ No newline at end of file diff --git a/actions/admin/user/ban.php b/actions/admin/user/ban.php index 831513a29..1033ec00a 100644 --- a/actions/admin/user/ban.php +++ b/actions/admin/user/ban.php @@ -21,15 +21,15 @@ if ( ($obj instanceof ElggUser) && ($obj->canEdit())) { // Now actually disable it - if ($obj->ban('banned')) { - system_message(elgg_echo('admin:user:ban:yes')); + if ($obj->ban('banned')) { + system_message(elgg_echo('admin:user:ban:yes')); } else register_error(elgg_echo('admin:user:ban:no')); - } else { - $canedit = $obj->canEdit(); - $isinstance = ($obj instanceof ElggUser); - register_error(elgg_echo('admin:user:ban:no')); + } else { + $canedit = $obj->canEdit(); + $isinstance = ($obj instanceof ElggUser); + register_error(elgg_echo('admin:user:ban:no')); } forward('pg/admin/user/'); diff --git a/actions/comments/add.php b/actions/comments/add.php index b026c64f0..80478b9ad 100644 --- a/actions/comments/add.php +++ b/actions/comments/add.php @@ -1,58 +1,58 @@ - + /** + * Elgg add comment action + * + * @package Elgg + + * @author Curverider + + * @link http://elgg.org/ + */ + + // Make sure we're logged in; forward to the front page if not + gatekeeper(); + action_gatekeeper(); + + // Get input + $entity_guid = (int) get_input('entity_guid'); + $comment_text = get_input('generic_comment'); + + // Let's see if we can get an entity with the specified GUID + if ($entity = get_entity($entity_guid)) { + + // If posting the comment was successful, say so + if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) { + + if ($entity->owner_guid != $_SESSION['user']->getGUID()) + notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'), + sprintf( + elgg_echo('generic_comment:email:body'), + $entity->title, + $_SESSION['user']->name, + $comment_text, + $entity->getURL(), + $_SESSION['user']->name, + $_SESSION['user']->getURL() + ) + ); + + system_message(elgg_echo("generic_comment:posted")); + //add to river + add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid); + + + } else { + register_error(elgg_echo("generic_comment:failure")); + } + + } else { + + register_error(elgg_echo("generic_comment:notfound")); + + } + + // Forward to the + forward($entity->getURL()); - * @link http://elgg.org/ - */ - - // Make sure we're logged in; forward to the front page if not - gatekeeper(); - action_gatekeeper(); - - // Get input - $entity_guid = (int) get_input('entity_guid'); - $comment_text = get_input('generic_comment'); - - // Let's see if we can get an entity with the specified GUID - if ($entity = get_entity($entity_guid)) { - - // If posting the comment was successful, say so - if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) { - - if ($entity->owner_guid != $_SESSION['user']->getGUID()) - notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'), - sprintf( - elgg_echo('generic_comment:email:body'), - $entity->title, - $_SESSION['user']->name, - $comment_text, - $entity->getURL(), - $_SESSION['user']->name, - $_SESSION['user']->getURL() - ) - ); - - system_message(elgg_echo("generic_comment:posted")); - //add to river - add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid); - - - } else { - register_error(elgg_echo("generic_comment:failure")); - } - - } else { - - register_error(elgg_echo("generic_comment:notfound")); - - } - - // Forward to the - forward($entity->getURL()); - ?> \ No newline at end of file diff --git a/actions/comments/delete.php b/actions/comments/delete.php index 2d3b9b3fd..dc701973b 100644 --- a/actions/comments/delete.php +++ b/actions/comments/delete.php @@ -1,35 +1,35 @@ - + /** + * Elgg delete comment action + * + * @package Elgg + + * @author Curverider + + * @link http://elgg.org/ + */ + + // Ensure we're logged in + if (!isloggedin()) forward(); + + // Make sure we can get the comment in question + $annotation_id = (int) get_input('annotation_id'); + if ($comment = get_annotation($annotation_id)) { + + $entity = get_entity($comment->entity_guid); + + if ($comment->canEdit()) { + $comment->delete(); + system_message(elgg_echo("generic_comment:deleted")); + forward($entity->getURL()); + } + + } else { + $url = ""; + } + + register_error(elgg_echo("generic_comment:notdeleted")); + forward($entity->getURL()); - * @link http://elgg.org/ - */ - - // Ensure we're logged in - if (!isloggedin()) forward(); - - // Make sure we can get the comment in question - $annotation_id = (int) get_input('annotation_id'); - if ($comment = get_annotation($annotation_id)) { - - $entity = get_entity($comment->entity_guid); - - if ($comment->canEdit()) { - $comment->delete(); - system_message(elgg_echo("generic_comment:deleted")); - forward($entity->getURL()); - } - - } else { - $url = ""; - } - - register_error(elgg_echo("generic_comment:notdeleted")); - forward($entity->getURL()); - ?> \ No newline at end of file diff --git a/actions/email/save.php b/actions/email/save.php index 6c166242b..2d226552a 100644 --- a/actions/email/save.php +++ b/actions/email/save.php @@ -29,7 +29,7 @@ if (!get_user_by_email($email)) { - + if ($user->email != $email) { $user->email = $email; if ($user->save()) @@ -38,7 +38,7 @@ system_message(elgg_echo('email:save:success')); } else - register_error(elgg_echo('email:save:fail')); + register_error(elgg_echo('email:save:fail')); } } else diff --git a/actions/friends/add.php b/actions/friends/add.php index 004b0eaad..63f1e2d94 100644 --- a/actions/friends/add.php +++ b/actions/friends/add.php @@ -1,40 +1,40 @@ -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 . "/"); - + action_gatekeeper(); + + // Get the GUID of the user to friend + $friend_guid = get_input('friend'); + $friend = get_entity($friend_guid); + + $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 diff --git a/actions/friends/addcollection.php b/actions/friends/addcollection.php index bda98984b..7dfba1ee7 100644 --- a/actions/friends/addcollection.php +++ b/actions/friends/addcollection.php @@ -1,50 +1,50 @@ -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"); - - } - + 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 diff --git a/actions/friends/deletecollection.php b/actions/friends/deletecollection.php index 674e68751..bdfcc9b2c 100644 --- a/actions/friends/deletecollection.php +++ b/actions/friends/deletecollection.php @@ -1,52 +1,52 @@ -owner_guid == $_SESSION['user']->getGUID()){ - - $delete_collection = delete_access_collection($collection_id); - - // Success message + * @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")); - - } - - } else { - - // Failure message - register_error(elgg_echo("friends:collectiondeletefailed")); - - } - - // Forward to the collections page - forward("pg/collections/" . $_SESSION['user']->username); - + 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); + ?> \ No newline at end of file diff --git a/actions/friends/editcollection.php b/actions/friends/editcollection.php index a1a38845f..ede61b4b0 100644 --- a/actions/friends/editcollection.php +++ b/actions/friends/editcollection.php @@ -1,20 +1,20 @@ - \ No newline at end of file diff --git a/actions/friends/remove.php b/actions/friends/remove.php index d1911bb90..20181bc84 100644 --- a/actions/friends/remove.php +++ b/actions/friends/remove.php @@ -1,42 +1,42 @@ -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 . "/"); - + } + } 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 diff --git a/actions/login.php b/actions/login.php index 1d2b7bc07..f3a60af6d 100644 --- a/actions/login.php +++ b/actions/login.php @@ -1,37 +1,37 @@ -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')); - } - } - + } + } 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 diff --git a/actions/logout.php b/actions/logout.php index 078e5a7aa..67ca6ad65 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -1,25 +1,25 @@ - \ No newline at end of file diff --git a/actions/register.php b/actions/register.php index 75721822c..5c69624b3 100644 --- a/actions/register.php +++ b/actions/register.php @@ -1,39 +1,39 @@ -disable_registration) - { + { // For now, just try and register the user - try { + try { if ( ( (trim($password)!="") && @@ -49,21 +49,21 @@ $new_user->admin = 'yes'; } - // Send user validation request on register only - global $registering_admin; + // 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 + $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")); + forward(); // Forward on success, assume everything else is an error... + } else { + register_error(elgg_echo("registerbad")); } } catch (RegistrationException $r) { register_error($r->getMessage()); @@ -76,6 +76,6 @@ $qs = $qs[0]; $qs .= "?u=" . urlencode($username) . "&e=" . urlencode($email) . "&n=" . urlencode($name) . "&friend_guid=" . $friend_guid; - forward($qs); - + forward($qs); + ?> \ No newline at end of file diff --git a/actions/systemsettings/install.php b/actions/systemsettings/install.php index 1d9f63a9f..8b0a31ced 100644 --- a/actions/systemsettings/install.php +++ b/actions/systemsettings/install.php @@ -1,125 +1,125 @@ -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)) + * @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)) + 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()); + + 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()); - } - - // Now ping home - if ($usage) - { - ping_home($site); - } - - system_message(elgg_echo("installation:configuration:success")); - - header("Location: ../../account/register.php"); - exit; - - } - - } - + enable_plugin('htmlawed', $site->getGUID()); + } + + // Now ping home + if ($usage) + { + ping_home($site); + } + + system_message(elgg_echo("installation:configuration:success")); + + header("Location: ../../account/register.php"); + exit; + + } + + } + ?> \ No newline at end of file diff --git a/actions/user/default_access.php b/actions/user/default_access.php index 0f062ed19..b79200ad0 100644 --- a/actions/user/default_access.php +++ b/actions/user/default_access.php @@ -9,8 +9,8 @@ */ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - global $CONFIG; - + global $CONFIG; + if ($CONFIG->allow_user_default_access) { gatekeeper(); @@ -25,7 +25,7 @@ $user = get_entity($user_id); if ($user) - { + { $current_default_access = $user->getPrivateSetting('elgg_default_access'); if ($default_access != $current_default_access) { @@ -36,7 +36,7 @@ } } else - register_error(elgg_echo('user:default_access:fail')); + register_error(elgg_echo('user:default_access:fail')); } //forward($_SERVER['HTTP_REFERER']); diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php index 2dff5f34d..a54e71b7e 100644 --- a/actions/user/requestnewpassword.php +++ b/actions/user/requestnewpassword.php @@ -14,26 +14,26 @@ action_gatekeeper(); $username = get_input('username'); - - $access_status = access_get_show_hidden_status(); + + $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); + 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)); + register_error(sprintf(elgg_echo('user:username:notfound'), $username)); access_show_hidden_entities($access_status); forward(); diff --git a/actions/user/spotlight.php b/actions/user/spotlight.php index b43af2f16..8f50df2c8 100644 --- a/actions/user/spotlight.php +++ b/actions/user/spotlight.php @@ -1,15 +1,15 @@ -spotlightclosed = $closed; - exit; - +spotlightclosed = $closed; + exit; + ?> \ No newline at end of file diff --git a/actions/useradd.php b/actions/useradd.php index cf4f03ffe..0149a9753 100644 --- a/actions/useradd.php +++ b/actions/useradd.php @@ -14,7 +14,7 @@ admin_gatekeeper(); // Only admins can add a user action_gatekeeper(); - // Get variables + // Get variables global $CONFIG; $username = get_input('username'); $password = get_input('password'); @@ -40,9 +40,9 @@ $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)); + + + 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 { diff --git a/actions/usersettings/save.php b/actions/usersettings/save.php index b720c371a..8c920def1 100644 --- a/actions/usersettings/save.php +++ b/actions/usersettings/save.php @@ -1,22 +1,22 @@ - + action_gatekeeper(); + + trigger_plugin_hook('usersettings:save','user'); + + forward($_SERVER['HTTP_REFERER']); + +?> diff --git a/actions/widgets/add.php b/actions/widgets/add.php index 76aaa3b17..14653eb18 100644 --- a/actions/widgets/add.php +++ b/actions/widgets/add.php @@ -1,43 +1,43 @@ -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')); + } + + forward($_SERVER['HTTP_REFERER']); - * @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')); - } - - forward($_SERVER['HTTP_REFERER']); - ?> \ No newline at end of file diff --git a/actions/widgets/reorder.php b/actions/widgets/reorder.php index 6f3142e8d..3e3a98ebb 100644 --- a/actions/widgets/reorder.php +++ b/actions/widgets/reorder.php @@ -1,32 +1,32 @@ - \ No newline at end of file diff --git a/actions/widgets/save.php b/actions/widgets/save.php index c6e06a12f..6fdf79c11 100644 --- a/actions/widgets/save.php +++ b/actions/widgets/save.php @@ -1,38 +1,38 @@ - \ No newline at end of file -- cgit v1.2.3