aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-08-15 23:15:29 -0700
committerfriendica <info@friendica.com>2012-08-15 23:15:29 -0700
commit5b547ae991624924c0ef11dbe36ae57f5ec2182b (patch)
tree875bdc2b49a588f9076d83f21362de26540acbf6
parentf7c6a6ff9071c120f5bd6efe51cdb934e0c30cc7 (diff)
downloadvolse-hubzilla-5b547ae991624924c0ef11dbe36ae57f5ec2182b.tar.gz
volse-hubzilla-5b547ae991624924c0ef11dbe36ae57f5ec2182b.tar.bz2
volse-hubzilla-5b547ae991624924c0ef11dbe36ae57f5ec2182b.zip
registration dangling code fragment that should've been removed
-rw-r--r--include/account.php47
-rwxr-xr-xinclude/items.php16
-rw-r--r--mod/zregister.php22
3 files changed, 45 insertions, 40 deletions
diff --git a/include/account.php b/include/account.php
index 4191d8d0b..91891ab23 100644
--- a/include/account.php
+++ b/include/account.php
@@ -7,6 +7,36 @@ require_once('include/text.php');
require_once('include/language.php');
require_once('include/datetime.php');
+
+function check_account_email($email) {
+
+ $result = array('error' => false, 'message' => '');
+
+ // Caution: empty email isn't counted as an error in this function. Check emptiness separately.
+
+ if(! strlen($email))
+ return $result;
+
+ if((! valid_email($email)) || (! validate_email($email)))
+ $result['message'] .= t('Not a valid email address') . EOL;
+ elseif(! allowed_email($email))
+ $result['message'] = t('Your email domain is not among those allowed on this site');
+ else {
+ $r = q("select account_email from account where account_email = '%s' limit 1",
+ dbesc($email)
+ );
+ if(count($r)) {
+ $result['message'] .= t('Your email address is already registered at this site.');
+ }
+ }
+ if($result['message'])
+ $result['error'] = true;
+
+ return $result;
+}
+
+
+
function create_account($arr) {
// Required: { email, password }
@@ -40,24 +70,13 @@ function create_account($arr) {
return;
}
- if(! allowed_email($email))
- $result['message'] .= t('Your email domain is not among those allowed on this site.') . EOL;
-
- if((! valid_email($email)) || (! validate_email($email)))
- $result['message'] .= t('Not a valid email address.') . EOL;
-
- $r = q("select account_email, account_password from account where email = '%s' limit 1",
-
+ $email_result = check_account_email($email);
-
-
-
- if(strlen($result['message'])) {
+ if(! $email_result['error']) {
+ $result['message'] = $email_result['message'];
return $result;
}
-
-
$password_encoded = hash('whirlpool',$password);
$r = q("INSERT INTO account
diff --git a/include/items.php b/include/items.php
index 48f063ab7..bb053434d 100755
--- a/include/items.php
+++ b/include/items.php
@@ -428,30 +428,36 @@ function get_item_elements($j) {
$arr['obj_type'] = (($j->objtype) ? htmlentities($j->objtype, ENT_COMPAT,'UTF-8') : '');
$arr['tgt_type'] = (($j->tgttype) ? htmlentities($j->tgttype, ENT_COMPAT,'UTF-8') : '');
- $arr['obj'] = $j->obj;
- $arr['tgt'] = $j->tgt;
+ $arr['object'] = $j->object;
+ $arr['target'] = $j->target;
$arr['attach'] = $j->attach;
$arr['tags'] = $j->tags;
- $arr['privacy'] = $j->privacy;
+ $arr['private'] = $j->private;
$arr['flags'] = intval($j->flags);
- $arr['types'] = intval($j->types);
$arr['author'] = $j->author;
- $arr['new'] = 1;
+ // needed still: owner and contact, map flags
return $arr;
}
+function encode_item($item) {
+ return json_encode($item);
+
+}
+
+
+
function get_atom_elements($feed,$item) {
diff --git a/mod/zregister.php b/mod/zregister.php
index fbdc4e260..2cde25469 100644
--- a/mod/zregister.php
+++ b/mod/zregister.php
@@ -7,27 +7,7 @@ function zregister_init(&$a) {
$cmd = ((argc() > 1) ? argv(1) : '');
if($cmd === 'email_check.json') {
- $result = array('error' => false, 'message' => '');
- $email = $_REQUEST['email'];
- if(! strlen($email))
- json_return_and_die($result);
-
- if((! valid_email($email)) || (! validate_email($email)))
- $result['message'] .= t('Not a valid email address') . EOL;
- elseif(! allowed_email($email))
- $result['message'] = t('Your email domain is not among those allowed on this site');
- else {
- $r = q("select account_email from account where account_email = '%s' limit 1",
- dbesc($email)
- );
- if(count($r)) {
- $result['message'] .= t('Your email address is already registered at this site.');
- }
- }
- if($result['message'])
- $result['error'] = true;
-
-
+ $result = check_account_email($_REQUEST['email']);
json_return_and_die($result);
}