From b08d070e1531f5a824687a2d36accb288d2ee54a Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 24 Aug 2012 01:14:42 -0700 Subject: basic identity creation --- mod/zentity.php | 54 +++++++++--------------------------------------------- 1 file changed, 9 insertions(+), 45 deletions(-) (limited to 'mod/zentity.php') diff --git a/mod/zentity.php b/mod/zentity.php index 794ac0ecb..969d731dd 100644 --- a/mod/zentity.php +++ b/mod/zentity.php @@ -1,8 +1,8 @@ page['template'] = 'full'; $cmd = ((argc() > 1) ? argv(1) : ''); @@ -50,8 +50,6 @@ function zentity_init(&$a) { for($y = 0; $y < 100; $y ++) $test[] = 'id' . mt_rand(1000,9999); -//print_r($test); - json_return_and_die(check_webbie($test)); } @@ -61,57 +59,23 @@ function zentity_init(&$a) { function zentity_post(&$a) { - $verified = 0; - $blocked = 1; - - $arr = array('post' => $_POST); - call_hooks('zregister_post', $arr); + $arr = $_POST; - $max_dailies = intval(get_config('system','max_daily_registrations')); - if($max_dailies) { - $r = q("select count(*) as total from account where account_created > UTC_TIMESTAMP - INTERVAL 1 day"); - if($r && $r[0]['total'] >= $max_dailies) { - return; - } + if(($uid = intval(local_user())) == 0) { + notice( t('Permission denied.') . EOL ); + return; } - switch(get_config('system','register_policy')) { - - case REGISTER_OPEN: - $blocked = 0; - $verified = 0; - break; - - case REGISTER_APPROVE: - $blocked = 0; - $verified = 0; - break; + $result = create_identity($arr); - default: - case REGISTER_CLOSED: - // TODO check against service class and fix this line - if((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) { - notice( t('Permission denied.') . EOL ); - return; - } - $blocked = 1; - $verified = 0; - break; + if(! $result['success']) { + notice($result['message']); + return; } - require_once('include/account.php'); - $arr = $_POST; - $arr['blocked'] = $blocked; - $arr['verified'] = $verified; - $result = create_account($arr); - - if(! $result['success']) { - notice($result['message']); - return; - } $user = $result['user']; -- cgit v1.2.3