]> git.mxchange.org Git - friendica.git/blobdiff - mod/register.php
fixing stuff that broke with the last big code push
[friendica.git] / mod / register.php
index 4e2c0bfb9ebb31cd918abcb40aba0543140f0860..2e5d02273a002ee10b4a239a52b0fd980eb22094 100644 (file)
@@ -22,10 +22,10 @@ function register_post(&$a) {
        default:
        case REGISTER_CLOSED:
                if((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {
-                       $_SESSION['sysmsg'] .= "Permission denied." . EOL;
+                       notice( "Permission denied." . EOL );
                        return;
                }
-               $blocked = 0;
+               $blocked = 1;
                $verified = 0;
                break;
        }
@@ -36,7 +36,7 @@ function register_post(&$a) {
                $email =notags(trim($_POST['email']));
 
        if((! x($username)) || (! x($email))) {
-               $_SESSION['sysmsg'] .= "Please enter the required information.". EOL;
+               notice( "Please enter the required information.". EOL );
                return;
        }
 
@@ -53,9 +53,9 @@ function register_post(&$a) {
                dbesc($email)
                );
        if($r !== false && count($r))
-               $err .= " This email address is already registered." . EOL;
+               $err .= " This email address is already registered.";
        if(strlen($err)) {
-               $_SESSION['sysmsg'] .= $err;
+               notice( $err . EOL );
                return;
        }
 
@@ -101,7 +101,7 @@ function register_post(&$a) {
                        $newuid = intval($r[0]['uid']);
        }
        else {
-               $_SESSION['sysmsg'] .= "An error occurred during registration. Please try again." . EOL;
+               notice( "An error occurred during registration. Please try again." . EOL );
                return;
        }               
 
@@ -114,21 +114,29 @@ function register_post(&$a) {
                        dbesc($username),
                        dbesc($a->get_baseurl() . '/images/default-profile.jpg'),
                        dbesc($a->get_baseurl() . '/images/default-profile-sm.jpg')
-                       );
+
+               );
                if($r === false) {
-                       $_SESSION['sysmsg'] .= "An error occurred creating your default profile. Please try again." . EOL ;
+                       notice( "An error occurred creating your default profile. Please try again." . EOL );
                        // Start fresh next time.
                        $r = q("DELETE FROM `user` WHERE `uid` = %d",
                                intval($newuid));
                        return;
                }
-               $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `photo`, `thumb`, `blocked` )
-                       VALUES ( %d, '%s', 1, '%s', '%s', '%s', 0 ) ",
+               $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `photo`, `thumb`, `blocked`, `url`,
+                       `request`, `notify`, `poll`, `confirm` )
+                       VALUES ( %d, '%s', 1, '%s', '%s', '%s', 0, '%s', '%s', '%s', '%s', '%s' ) ",
                        intval($newuid),
                        datetime_convert(),
                        dbesc($username),
                        dbesc($a->get_baseurl() . '/images/default-profile.jpg'),
-                       dbesc($a->get_baseurl() . '/images/default-profile-sm.jpg') 
+                       dbesc($a->get_baseurl() . '/images/default-profile-sm.jpg'), 
+                       dbesc($a->get_baseurl() . '/profile/' . intval($newuid)),
+                       dbesc($a->get_baseurl() . '/dfrn_request/' . intval($newuid)),
+                       dbesc($a->get_baseurl() . '/dfrn_notify/' . intval($newuid)),
+                       dbesc($a->get_baseurl() . '/dfrn_poll/' . intval($newuid)),
+                       dbesc($a->get_baseurl() . '/dfrn_confirm/' . intval($newuid))
+
                );
 
 
@@ -149,11 +157,11 @@ function register_post(&$a) {
        }
 
        if($res) {
-               $_SESSION['sysmsg'] .= "Registration successful. Please check your email for further instructions." . EOL ;
+               notice( "Registration successful. Please check your email for further instructions." . EOL ) ;
                goaway($a->get_baseurl());
        }
        else {
-               $_SESSION['sysmsg'] .= "Failed to send email message. Here is the message that failed. $email_tpl " . EOL;
+               notice( "Failed to send email message. Here is the message that failed. $email_tpl " . EOL );
        }
        
        return;
@@ -167,6 +175,11 @@ function register_post(&$a) {
 if(! function_exists('register_content')) {
 function register_content(&$a) {
 
+       if($a->config['register_policy'] == REGISTER_CLOSED) {
+               notice("Permission denied." . EOL);
+               return;
+       }
+
        $o = file_get_contents("view/register.tpl");
        $o = replace_macros($o, array('$registertext' =>((x($a->config,'register_text'))? $a->config['register_text'] : "" )));
        return $o;