Skip to content

Commit

Permalink
Standardized code in all of core, not including language files, tests…
Browse files Browse the repository at this point in the history
…, or core mods.

git-svn-id: http://code.elgg.org/elgg/trunk@7124 36083f99-b078-4883-b0ff-0f9b5a30f544
  • Loading branch information
brettp committed Oct 28, 2010
1 parent bd34844 commit 7ddd952
Show file tree
Hide file tree
Showing 170 changed files with 7,747 additions and 3,945 deletions.
31 changes: 29 additions & 2 deletions CHANGES.txt
Expand Up @@ -8,8 +8,35 @@ Version 1.8.0 (Jackie)
Generic API changes: Generic API changes:
* Added elgg_instanceof(). * Added elgg_instanceof().
* Added remove_subtype() and update_subtype(). * Added remove_subtype() and update_subtype().
* Added elgg_format_url() * Added elgg_format_url().

* ElggDiskFilestore supports non-user owners.

Deprecated APIs:
* ElggAccess::get_ignore_access() by ElggAccess::getIgnoreAccess().
* ElggAccess::set_ignore_access() by ElggAccess::setIgnoreAccess().
* ElggCache::set_variable() by ElggCache::setVariable().
* ElggCache::get_variable() by ElggCache::getVariable().
* ElggDiskFilestore::make_directory_root() by ElggDiskFilestore::makeDirectoryRoot().
* ElggDiskFilestore::make_file_matrix() and ElggDiskFilestore::user_file_matrix() by
ElggDiskFilestore::makeFileMatrix().
* ElggDiskFilestore::mb_string_split() removed.
* ElggEntity::initialise_attriutes() by ElggEntity::initializeAttributes(). Same for
all sub classes of ElggEntity.
* ElggFileCache::create_file() by ::createFile().
* ElggFileCache::sanitise_filename() by ::sanitizeFilename().
* ElggMemcache::make_memcache_key() by ::_makeMemcacheKey().
* ElggGroup::initialise_attributes() by ::initializeAttributes().
* ElggPlugin::initialise_attributes() by ::initializeAttributes().
* XMLRPCCall::parse() by XMLRPCCALL::_parse().
* __get_annotations_calculate_x() by get_annotations_calculate_x().
* __get_entities_from_annotations_calculate_x() by get_entities_from_annotations_calculate_x().
* __php_api_error_handler() by _php_api_error_handler().
* __php_api_exception_handler() by _php_api_exception_handler().
* __elgg_php_error_handler() by _elgg_php_error_handler().
* __elgg_php_exception_handler() by _elgg_php_exception_handler().
* __process_element() by _process_element().
* All __elgg_session_*() by _elgg_session_*().

UI/UX API changes: UI/UX API changes:
* Added elgg_push_breadcrumb(), elgg_pop_breadcrumb(), and elgg_get_breadcrumbs(). * Added elgg_push_breadcrumb(), elgg_pop_breadcrumb(), and elgg_get_breadcrumbs().
* Added navigation/breadcrumbs. * Added navigation/breadcrumbs.
Expand Down
2 changes: 1 addition & 1 deletion _css/css.php
Expand Up @@ -30,7 +30,7 @@
$viewinput['viewtype'] = $_GET['viewtype']; $viewinput['viewtype'] = $_GET['viewtype'];


header("Content-type: text/css", true); header("Content-type: text/css", true);
header('Expires: ' . date('r',time() + 86400000), true); header('Expires: ' . date('r', time() + 86400000), true);
header("Pragma: public", true); header("Pragma: public", true);
header("Cache-Control: public", true); header("Cache-Control: public", true);


Expand Down
2 changes: 1 addition & 1 deletion _css/js.php
Expand Up @@ -33,7 +33,7 @@
$viewinput['viewtype'] = $_GET['viewtype']; $viewinput['viewtype'] = $_GET['viewtype'];


header('Content-type: text/javascript'); header('Content-type: text/javascript');
header('Expires: ' . date('r',time() + 864000000)); header('Expires: ' . date('r', time() + 864000000));
header("Pragma: public"); header("Pragma: public");
header("Cache-Control: public"); header("Cache-Control: public");


Expand Down
2 changes: 1 addition & 1 deletion actions/admin/menu_items.php
Expand Up @@ -29,7 +29,7 @@
// save the custom items // save the custom items
$custom_count = count($custom_item_names); $custom_count = count($custom_item_names);
$custom_items = array(); $custom_items = array();
for ($i=0; $i<$custom_count; $i++) { for ($i = 0; $i < $custom_count; $i++) {
if (isset($custom_item_names[$i]) && isset($custom_item_names[$i])) { if (isset($custom_item_names[$i]) && isset($custom_item_names[$i])) {
$name = $custom_item_names[$i]; $name = $custom_item_names[$i];
$url = $custom_item_urls[$i]; $url = $custom_item_urls[$i];
Expand Down
3 changes: 2 additions & 1 deletion actions/admin/plugins/simple_update_states.php
Expand Up @@ -23,7 +23,8 @@


foreach ($installed_plugins as $plugin => $info) { foreach ($installed_plugins as $plugin => $info) {
// this is only for simple plugins. // this is only for simple plugins.
if (!isset($info['manifest']['admin_interface']) || $info['manifest']['admin_interface'] != 'simple') { $interface_type = elgg_get_array_value('admin_interface', $info['manifest'], NULL);
if (!$interface_type || $interface_type != 'simple') {
continue; continue;
} }


Expand Down
16 changes: 9 additions & 7 deletions actions/comments/add.php
Expand Up @@ -2,7 +2,8 @@
/** /**
* Elgg add comment action * Elgg add comment action
* *
* @package Elgg * @package Elgg.Core
* @subpackage Comments
*/ */


// Make sure we're logged in; forward to the front page if not // Make sure we're logged in; forward to the front page if not
Expand All @@ -27,11 +28,11 @@


$user = get_loggedin_user(); $user = get_loggedin_user();


$annotation = create_annotation($entity->guid, $annotation = create_annotation($entity->guid,
'generic_comment', 'generic_comment',
$comment_text, $comment_text,
"", "",
$user->guid, $user->guid,
$entity->access_id); $entity->access_id);


// tell user annotation posted // tell user annotation posted
Expand All @@ -42,7 +43,7 @@


// notify if poster wasn't owner // notify if poster wasn't owner
if ($entity->owner_guid != $user->guid) { if ($entity->owner_guid != $user->guid) {

notify_user($entity->owner_guid, notify_user($entity->owner_guid,
$user->guid, $user->guid,
elgg_echo('generic_comment:email:subject'), elgg_echo('generic_comment:email:subject'),
Expand All @@ -59,8 +60,9 @@
} }


system_message(elgg_echo("generic_comment:posted")); system_message(elgg_echo("generic_comment:posted"));

//add to river //add to river
add_to_river('annotation/annotate','comment',$user->guid,$entity->guid, "", 0, $annotation); add_to_river('annotation/annotate', 'comment', $user->guid, $entity->guid, "", 0, $annotation);


// Forward to the page the action occurred on // Forward to the page the action occurred on
forward($_SERVER['HTTP_REFERER']); forward($_SERVER['HTTP_REFERER']);
2 changes: 1 addition & 1 deletion actions/email/save.php
Expand Up @@ -23,7 +23,7 @@
} }


if ($user) { if ($user) {
if (strcmp($email, $user->email)!=0) { if (strcmp($email, $user->email) != 0) {
if (!get_user_by_email($email)) { if (!get_user_by_email($email)) {
if ($user->email != $email) { if ($user->email != $email) {


Expand Down
12 changes: 6 additions & 6 deletions actions/friends/add.php
Expand Up @@ -2,8 +2,8 @@
/** /**
* Elgg add friend action * Elgg add friend action
* *
* @package Elgg * @package Elgg.Core
* @subpackage Core * @subpackage Friends.Management
*/ */


// Ensure we are logged in // Ensure we are logged in
Expand All @@ -21,13 +21,13 @@
$errors = true; $errors = true;
} }
} catch (Exception $e) { } catch (Exception $e) {
register_error(sprintf(elgg_echo("friends:add:failure"),$friend->name)); register_error(sprintf(elgg_echo("friends:add:failure"), $friend->name));
$errors = true; $errors = true;
} }
if (!$errors){ if (!$errors) {
// add to river // add to river
add_to_river('friends/river/create','friend',get_loggedin_userid(),$friend_guid); add_to_river('friends/river/create', 'friend', get_loggedin_userid(), $friend_guid);
system_message(sprintf(elgg_echo("friends:add:successful"),$friend->name)); system_message(sprintf(elgg_echo("friends:add:successful"), $friend->name));
} }


// Forward back to the page you friended the user on // Forward back to the page you friended the user on
Expand Down
13 changes: 5 additions & 8 deletions actions/friends/addcollection.php
@@ -1,12 +1,9 @@
<?php <?php

/** /**
* Elgg collection add page * Elgg collection add page
* *
* @package Elgg * @package Elgg.Core
* @subpackage Core * @subpackage Friends.Collections
*/ */


//must be logged in //must be logged in
Expand All @@ -16,15 +13,15 @@
$friends = get_input('friends_collection'); $friends = get_input('friends_collection');


//first check to make sure that a collection name has been set and create the new colection //first check to make sure that a collection name has been set and create the new colection
if($collection_name){ if ($collection_name) {


//create the collection //create the collection
$create_collection = create_access_collection($collection_name, get_loggedin_userid()); $create_collection = create_access_collection($collection_name, get_loggedin_userid());


//if the collection was created and the user passed some friends from the form, add them //if the collection was created and the user passed some friends from the form, add them
if($create_collection && (!empty($friends))){ if ($create_collection && (!empty($friends))) {
//add friends to the collection //add friends to the collection
foreach($friends as $friend) { foreach ($friends as $friend) {
add_user_to_access_collection($friend, $create_collection); add_user_to_access_collection($friend, $create_collection);
} }
} }
Expand Down
7 changes: 2 additions & 5 deletions actions/friends/deletecollection.php
@@ -1,12 +1,9 @@
<?php <?php

/** /**
* Elgg friends: delete collection action * Elgg friends: delete collection action
* *
* @package Elgg * @package Elgg.Core
* @subpackage Core * @subpackage Friends.Collections
*/ */


// Make sure we're logged in (send us to the front page if not) // Make sure we're logged in (send us to the front page if not)
Expand Down
5 changes: 2 additions & 3 deletions actions/friends/editcollection.php
@@ -1,10 +1,9 @@
<?php <?php

/** /**
* Elgg collection add page * Elgg collection add page
* *
* @package Elgg * @package Elgg.Core
* @subpackage Core * @subpackage Friends.Collections
*/ */


$collection_id = get_input('collection_id'); $collection_id = get_input('collection_id');
Expand Down
6 changes: 3 additions & 3 deletions actions/friends/remove.php
Expand Up @@ -2,8 +2,8 @@
/** /**
* Elgg remove friend action * Elgg remove friend action
* *
* @package Elgg * @package Elgg.Core
* @subpackage Core * @subpackage Friends.Management
*/ */


// Ensure we are logged in // Ensure we are logged in
Expand All @@ -18,7 +18,7 @@
try{ try{
if ($friend instanceof ElggUser) { if ($friend instanceof ElggUser) {
get_loggedin_user()->removeFriend($friend_guid); get_loggedin_user()->removeFriend($friend_guid);
} else{ } else {
register_error(sprintf(elgg_echo("friends:remove:failure"), $friend->name)); register_error(sprintf(elgg_echo("friends:remove:failure"), $friend->name));
$errors = true; $errors = true;
} }
Expand Down
8 changes: 5 additions & 3 deletions actions/likes/add.php
Expand Up @@ -2,14 +2,15 @@
/** /**
* Elgg add like action * Elgg add like action
* *
* @package Elgg * @package Elgg.Core
* @subpackage Likes
*/ */


gatekeeper(); gatekeeper();
$entity_guid = (int) get_input('guid'); $entity_guid = (int) get_input('guid');


//check to see if the user has already liked the item //check to see if the user has already liked the item
if (elgg_annotation_exists($entity_guid, 'likes')){ if (elgg_annotation_exists($entity_guid, 'likes')) {
system_message(elgg_echo("likes:alreadyliked")); system_message(elgg_echo("likes:alreadyliked"));
forward($_SERVER['HTTP_REFERER']); forward($_SERVER['HTTP_REFERER']);
} }
Expand Down Expand Up @@ -53,8 +54,9 @@
} }


system_message(elgg_echo("likes:likes")); system_message(elgg_echo("likes:likes"));

//add to river //add to river
add_to_river('annotation/annotatelike','likes',$user->guid,$entity->guid, "", 0, $annotation); add_to_river('annotation/annotatelike', 'likes', $user->guid, $entity->guid, "", 0, $annotation);


// Forward back to the page where the user 'liked' the object // Forward back to the page where the user 'liked' the object
forward($_SERVER['HTTP_REFERER']); forward($_SERVER['HTTP_REFERER']);
3 changes: 2 additions & 1 deletion actions/likes/delete.php
Expand Up @@ -2,7 +2,8 @@
/** /**
* Elgg delete like action * Elgg delete like action
* *
* @package Elgg * @package Elgg.Core
* @subpackage Likes
*/ */


// Ensure we're logged in // Ensure we're logged in
Expand Down
28 changes: 14 additions & 14 deletions actions/login.php
Expand Up @@ -45,20 +45,20 @@
} }
} else { } else {
register_error(elgg_echo('loginerror')); register_error(elgg_echo('loginerror'));
// // let a plugin hook say why login failed or react to it. // // let a plugin hook say why login failed or react to it.
// $params = array( // $params = array(
// 'username' => $username, // 'username' => $username,
// 'password' => $password, // 'password' => $password,
// 'persistent' => $persistent, // 'persistent' => $persistent,
// 'user' => $user // 'user' => $user
// ); // );
// //
// // Returning FALSE to this function will generate a standard // // Returning FALSE to this function will generate a standard
// // "Could not log you in" message. // // "Could not log you in" message.
// // Plugins should use this hook to provide details, and then return TRUE. // // Plugins should use this hook to provide details, and then return TRUE.
// if (!trigger_plugin_hook('failed_login', 'user', $params, FALSE)) { // if (!trigger_plugin_hook('failed_login', 'user', $params, FALSE)) {
// register_error(elgg_echo('loginerror')); // register_error(elgg_echo('loginerror'));
// } // }
} }


forward(REFERRER); forward(REFERRER);
2 changes: 1 addition & 1 deletion actions/register.php
Expand Up @@ -14,7 +14,7 @@
$password2 = get_input('password2'); $password2 = get_input('password2');
$email = get_input('email'); $email = get_input('email');
$name = get_input('name'); $name = get_input('name');
$friend_guid = (int) get_input('friend_guid',0); $friend_guid = (int) get_input('friend_guid', 0);
$invitecode = get_input('invitecode'); $invitecode = get_input('invitecode');


if ($CONFIG->allow_registration) { if ($CONFIG->allow_registration) {
Expand Down
2 changes: 1 addition & 1 deletion actions/user/language.php
Expand Up @@ -18,7 +18,7 @@
} }


if (($user) && ($language)) { if (($user) && ($language)) {
if (strcmp($language, $user->language)!=0) { if (strcmp($language, $user->language) != 0) {
$user->language = $language; $user->language = $language;
if ($user->save()) { if ($user->save()) {
system_message(elgg_echo('user:language:success')); system_message(elgg_echo('user:language:success'));
Expand Down
4 changes: 2 additions & 2 deletions actions/user/password.php
Expand Up @@ -18,8 +18,8 @@
$user = get_entity($user_id); $user = get_entity($user_id);
} }


if (($user) && ($password!="")) { if (($user) && ($password != "")) {
if (strlen($password)>=4) { if (strlen($password) >= 4) {
if ($password == $password2) { if ($password == $password2) {
$user->salt = generate_random_cleartext_password(); // Reset the salt $user->salt = generate_random_cleartext_password(); // Reset the salt
$user->password = generate_user_password($user, $password); $user->password = generate_user_password($user, $password);
Expand Down
7 changes: 4 additions & 3 deletions actions/user/spotlight.php
Expand Up @@ -2,13 +2,14 @@
/** /**
* Close or open spotlight. * Close or open spotlight.
* *
* @package Elgg * @package Elgg.Core
* @subpackage Core * @subpackage Spotlight
* @todo This is deprecated in 1.8
*/ */


gatekeeper(); gatekeeper();


$closed = get_input('closed','true'); $closed = get_input('closed', 'true');
if ($closed != 'true') { if ($closed != 'true') {
$closed = false; $closed = false;
} else { } else {
Expand Down
10 changes: 7 additions & 3 deletions actions/useradd.php
Expand Up @@ -25,7 +25,7 @@
try { try {
$guid = register_user($username, $password, $name, $email, TRUE); $guid = register_user($username, $password, $name, $email, TRUE);


if (((trim($password) != "") && (strcmp($password, $password2)==0)) && ($guid)) { if (((trim($password) != "") && (strcmp($password, $password2) == 0)) && ($guid)) {
$new_user = get_entity($guid); $new_user = get_entity($guid);
if (($guid) && ($admin)) { if (($guid) && ($admin)) {
$new_user->makeAdmin(); $new_user->makeAdmin();
Expand All @@ -35,9 +35,13 @@
$new_user->created_by_guid = get_loggedin_userid(); $new_user->created_by_guid = get_loggedin_userid();
set_user_validation_status($new_user->getGUID(), TRUE, 'admin_created'); set_user_validation_status($new_user->getGUID(), TRUE, 'admin_created');


notify_user($new_user->guid, $CONFIG->site->guid, elgg_echo('useradd:subject'), sprintf(elgg_echo('useradd:body'), $name, $CONFIG->site->name, $CONFIG->site->url, $username, $password)); $subject = elgg_echo('useradd:subject');
$body = sprintf(elgg_echo('useradd:body'), $name,
$CONFIG->site->name, $CONFIG->site->url, $username, $password);


system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename)); notify_user($new_user->guid, $CONFIG->site->guid, $subject, $body);

system_message(sprintf(elgg_echo("adduser:ok"), $CONFIG->sitename));
} else { } else {
register_error(elgg_echo("adduser:bad")); register_error(elgg_echo("adduser:bad"));
} }
Expand Down

0 comments on commit 7ddd952

Please sign in to comment.