]> git.mxchange.org Git - friendica.git/blobdiff - include/auth.php
invoke notifier
[friendica.git] / include / auth.php
index fd80a63e221a553e6b484ec19c84e99e61297af3..768af626fb5863a697e358cda29a793d82cf76e1 100644 (file)
@@ -25,7 +25,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
 
                nuke_session();
                info( t('Logged out.') . EOL);
-               goaway($a->get_baseurl());
+               goaway(z_root());
        }
 
        if(x($_SESSION,'visitor_id') && (! x($_SESSION,'uid'))) {
@@ -45,7 +45,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
                // extra paranoia - if the IP changed, log them out
                if($check && ($_SESSION['addr'] != $_SERVER['REMOTE_ADDR'])) {
                        nuke_session();
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
 
                $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
@@ -54,7 +54,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
 
                if(! count($r)) {
                        nuke_session();
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
 
                // initialise user environment
@@ -63,6 +63,12 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
                $_SESSION['theme'] = $a->user['theme'];
                $_SESSION['page_flags'] = $a->user['page-flags'];
 
+               $member_since = strtotime($a->user['register_date']);
+               if(time() < ($member_since + ( 60 * 60 * 24 * 14)))
+                       $_SESSION['new_member'] = true;
+               else
+                       $_SESSION['new_member'] = false;
+
                if(strlen($a->user['timezone'])) {
                        date_default_timezone_set($a->user['timezone']);
                        $a->timezone = $a->user['timezone'];
@@ -112,7 +118,7 @@ else {
                        if(($noid) || (strpos($temp_string,'@')) || (! validate_url($temp_string))) {
                                $a = get_app();
                                notice( t('Login failed.') . EOL);
-                               goaway($a->get_baseurl());
+                               goaway(z_root());
                                // NOTREACHED
                        }
 
@@ -137,7 +143,7 @@ else {
                                if($a->config['register_policy'] == REGISTER_CLOSED) {
                                        $a = get_app();
                                        notice( t('Login failed.') . EOL);
-                                       goaway($a->get_baseurl());
+                                       goaway(z_root());
                                        // NOTREACHED
                                }
                                // new account
@@ -190,7 +196,7 @@ else {
                if((! $record) || (! count($record))) {
                        logger('authenticate: failed login attempt: ' . trim($_POST['openid_url'])); 
                        notice( t('Login failed.') . EOL );
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
 
                $_SESSION['uid'] = $record['uid'];
@@ -211,6 +217,13 @@ else {
                else
                        info( t("Welcome back ") . $a->user['username'] . EOL);
 
+
+               $member_since = strtotime($a->user['register_date']);
+               if(time() < ($member_since + ( 60 * 60 * 24 * 14)))
+                       $_SESSION['new_member'] = true;
+               else
+                       $_SESSION['new_member'] = false;
+
                if(strlen($a->user['timezone'])) {
                        date_default_timezone_set($a->user['timezone']);
                        $a->timezone = $a->user['timezone'];