aboutsummaryrefslogtreecommitdiffstats
path: root/mod/zentity.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-08-24 01:14:42 -0700
committerfriendica <info@friendica.com>2012-08-24 01:14:42 -0700
commitb08d070e1531f5a824687a2d36accb288d2ee54a (patch)
tree72dd9a05983b2a2e8e55b79703ff508b7600b754 /mod/zentity.php
parent2456174cc905d2d0ae19d21c94fec2c5552322a8 (diff)
downloadvolse-hubzilla-b08d070e1531f5a824687a2d36accb288d2ee54a.tar.gz
volse-hubzilla-b08d070e1531f5a824687a2d36accb288d2ee54a.tar.bz2
volse-hubzilla-b08d070e1531f5a824687a2d36accb288d2ee54a.zip
basic identity creation
Diffstat (limited to 'mod/zentity.php')
-rw-r--r--mod/zentity.php54
1 files changed, 9 insertions, 45 deletions
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 @@
<?php
+require_once('include/identity.php');
function zentity_init(&$a) {
- $a->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'];