]> git.mxchange.org Git - friendica.git/blobdiff - mod/register.php
diabook-themes: minor bugfixes
[friendica.git] / mod / register.php
index 89f561642af36a329c8908372fafafaec72d163c..b60707d457299f0a167a69564637c755c46a6718 100644 (file)
@@ -8,6 +8,8 @@ function register_post(&$a) {
        $verified = 0;
        $blocked  = 1;
 
+       $arr = array('post' => $_POST);
+       call_hooks('register_post', $arr);
 
        $max_dailies = intval(get_config('system','max_daily_registrations'));
        if($max_dailes) {
@@ -150,6 +152,16 @@ function register_post(&$a) {
        if(count($r))
                $err .= t('Nickname is already registered. Please choose another.') . EOL;
 
+       // Check deleted accounts that had this nickname. Doesn't matter to us,
+       // but could be a security issue for federated platforms.
+
+       $r = q("SELECT * FROM `userd`
+                       WHERE `username` = '%s' LIMIT 1",
+                       dbesc($nickname)
+       );
+       if(count($r))
+               $err .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
+
        if(strlen($err)) {
                notice( $err );
                return;
@@ -208,8 +220,8 @@ function register_post(&$a) {
        $spubkey = $spkey["key"];
 
        $r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`,
-               `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked` )
-               VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )",
+               `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone` )
+               VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC' )",
                dbesc(generate_user_guid()),
                dbesc($username),
                dbesc($new_password_encoded),
@@ -278,8 +290,8 @@ function register_post(&$a) {
                        return;
                }
                $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`,
-                       `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date` )
-                       VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
+                       `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` )
+                       VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ",
                        intval($newuid),
                        datetime_convert(),
                        dbesc($username),
@@ -302,17 +314,13 @@ function register_post(&$a) {
 
        }
 
-       $use_gravatar = ((get_config('system','no_gravatar')) ? false : true);
-
-       // if we have an openid photo use it. 
-       // otherwise unless it is disabled, use gravatar
-
-       if($use_gravatar || strlen($photo)) {
+       // if we have no OpenID photo try to look up an avatar
+       if(! strlen($photo))
+               $photo = avatar_img($email);
 
+       // unless there is no avatar-plugin loaded
+       if(strlen($photo)) {
                require_once('include/Photo.php');
-
-               if(($use_gravatar) && (! strlen($photo))) 
-                       $photo = gravatar_img($email);
                $photo_failure = false;
 
                $filename = basename($photo);
@@ -321,7 +329,7 @@ function register_post(&$a) {
                if($img->is_valid()) {
 
                        $img->scaleImageSquare(175);
-                                       
+
                        $hash = photo_new_resource();
 
                        $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
@@ -530,6 +538,11 @@ function register_content(&$a) {
        $license = '';
 
        $o = get_markup_template("register.tpl");
+
+       $arr = array('template' => $o);
+
+       call_hooks('register_form',$arr);
+
        $o = replace_macros($o, array(
                '$oidhtml' => $oidhtml,
                '$invitations' => get_config('system','invitation_only'),