aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-05 16:48:24 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-05 16:48:24 +0000
commit43e89eedf4faff3ee13973caebc2714736d5b362 (patch)
tree2c1bd0fc3c395b310d34b4dd83e1615bd23a4382
parentca03d831fc65cd4ca669de7785dd3fff30bd33f1 (diff)
downloadelgg-43e89eedf4faff3ee13973caebc2714736d5b362.tar.gz
elgg-43e89eedf4faff3ee13973caebc2714736d5b362.tar.bz2
using setPrivateSetting() and getPrivateSetting() instead of procedural functions
git-svn-id: http://code.elgg.org/elgg/trunk@8031 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/classes/ElggPlugin.php4
-rw-r--r--engine/classes/ElggWidget.php8
-rw-r--r--engine/lib/users.php22
3 files changed, 18 insertions, 16 deletions
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php
index 1b9be3ec1..731875755 100644
--- a/engine/classes/ElggPlugin.php
+++ b/engine/classes/ElggPlugin.php
@@ -765,7 +765,7 @@ class ElggPlugin extends ElggObject {
// No, so see if its in the private data store.
// get_private_setting() returns false if it doesn't exist
- $meta = get_private_setting($this->guid, $name);
+ $meta = $this->getPrivateSetting($name);
if ($meta === false) {
// Can't find it, so return null
@@ -794,7 +794,7 @@ class ElggPlugin extends ElggObject {
return true;
} else {
- return set_private_setting($this->guid, $name, $value);
+ return $this->setPrivateSetting($name, $value);
}
}
diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php
index 913dfc2ba..dae61de68 100644
--- a/engine/classes/ElggWidget.php
+++ b/engine/classes/ElggWidget.php
@@ -35,7 +35,7 @@ class ElggWidget extends ElggObject {
}
// No, so see if its in the private data store.
- $meta = get_private_setting($this->guid, $name);
+ $meta = $this->getPrivateSetting($name);
if ($meta) {
return $meta;
}
@@ -61,7 +61,7 @@ class ElggWidget extends ElggObject {
$this->attributes[$name] = $value;
} else {
- return set_private_setting($this->guid, $name, $value);
+ return $this->setPrivateSetting($name, $value);
}
return true;
@@ -75,7 +75,7 @@ class ElggWidget extends ElggObject {
* @since 1.8.0
*/
public function setContext($context) {
- return set_private_setting($this->guid, 'context', $context);
+ return $this->setPrivateSetting('context', $context);
}
/**
@@ -85,7 +85,7 @@ class ElggWidget extends ElggObject {
* @since 1.8.0
*/
public function getContext() {
- return get_private_setting($this->guid, 'context');
+ return $this->getPrivateSetting('context');
}
/**
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 84e5fcc7b..567f587ea 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -685,8 +685,8 @@ function send_new_password_request($user_guid) {
if ($user) {
// generate code
$code = generate_random_cleartext_password();
- //create_metadata($user_guid, 'conf_code', $code, '', 0, ACCESS_PRIVATE);
- set_private_setting($user_guid, 'passwd_conf_code', $code);
+ $user->setPrivateSetting('passwd_conf_code', $code);
+
// generate link
$link = $CONFIG->site->url . "pg/resetpassword?u=$user_guid&c=$code";
@@ -744,18 +744,20 @@ function execute_new_password_request($user_guid, $conf_code) {
$user_guid = (int)$user_guid;
$user = get_entity($user_guid);
- $saved_code = get_private_setting($user_guid, 'passwd_conf_code');
+ if ($user) {
+ $saved_code = $user->getPrivateSetting('passwd_conf_code');
- if ($user && $saved_code && $saved_code == $conf_code) {
- $password = generate_random_cleartext_password();
+ if ($saved_code && $saved_code == $conf_code) {
+ $password = generate_random_cleartext_password();
- if (force_user_password_reset($user_guid, $password)) {
- remove_private_setting($user_guid, 'passwd_conf_code');
+ if (force_user_password_reset($user_guid, $password)) {
+ remove_private_setting($user_guid, 'passwd_conf_code');
- $email = elgg_echo('email:resetpassword:body', array($user->name, $password));
+ $email = elgg_echo('email:resetpassword:body', array($user->name, $password));
- return notify_user($user->guid, $CONFIG->site->guid,
- elgg_echo('email:resetpassword:subject'), $email, NULL, 'email');
+ return notify_user($user->guid, $CONFIG->site->guid,
+ elgg_echo('email:resetpassword:subject'), $email, NULL, 'email');
+ }
}
}