aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/session.php
diff options
context:
space:
mode:
authorHenry Sudhof <kellanved@phpbb.com>2009-04-22 12:54:33 +0000
committerHenry Sudhof <kellanved@phpbb.com>2009-04-22 12:54:33 +0000
commitd3f6ce4b4ba04c6041ab20e6860a9082bce50252 (patch)
treee0a644b668f07b3bb9d7d545e9263f902898d1c4 /phpBB/includes/session.php
parent214ea1c52d24dbff98af1d5b798349ce45816bad (diff)
downloadforums-d3f6ce4b4ba04c6041ab20e6860a9082bce50252.tar
forums-d3f6ce4b4ba04c6041ab20e6860a9082bce50252.tar.gz
forums-d3f6ce4b4ba04c6041ab20e6860a9082bce50252.tar.bz2
forums-d3f6ce4b4ba04c6041ab20e6860a9082bce50252.tar.xz
forums-d3f6ce4b4ba04c6041ab20e6860a9082bce50252.zip
#41575
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9477 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/session.php')
-rw-r--r--phpBB/includes/session.php47
1 files changed, 45 insertions, 2 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 6980277041..2de20bc364 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -396,6 +396,11 @@ class session
WHERE session_id = '" . $db->sql_escape($this->session_id) . "'";
$db->sql_query($sql);
}
+
+ if ($this->data['user_id'] != ANONYMOUS && $config['new_member_limit'] && $this->data['user_new'] && $config['new_member_limit'] <= $this->data['user_posts'])
+ {
+ $this->leave_newly_registered();
+ }
}
$this->data['is_registered'] = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false;
@@ -1392,8 +1397,8 @@ class session
$host = htmlspecialchars($this->host);
$ref = substr($this->referer, strpos($this->referer, '://') + 3);
-
- if (!(stripos($ref, $host) === 0))
+
+ if (!(stripos($ref, $host) === 0) && (!$config['force_server'] || !(stripos($ref, $config['server_name']) === 0)))
{
return false;
}
@@ -2253,6 +2258,44 @@ class user extends session
return $var;
}
}
+
+ /**
+ * Funtion to make the user leave the NEWLY_REGISTERED system group.
+ * @access public
+ */
+ function leave_newly_registered()
+ {
+ global $db;
+
+ $sql = 'SELECT group_id
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = 'NEWLY_REGISTERED'
+ AND group_type = " . GROUP_SPECIAL;
+ $result = $db->sql_query_limit($sql, 1, 0, 7200);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+ $group_id = (int) $row['group_id'];
+ $sql = 'DELETE FROM ' . USER_GROUP_TABLE . "
+ WHERE group_id = $group_id
+ AND user_id = {$this->data['user_id']}";
+ $db->sql_query($sql);
+
+ // Clear permissions cache of relevant users
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_permissions = '',
+ user_new = 0,
+ WHERE user_perm_from = 0
+ AND user_id = {$this->data['user_id']}";
+ $db->sql_query($sql);
+ $this->data['user_permissions'] = '';
+
+ if ($this->data['group_id'] == $group_id)
+ {
+ // BLAST! Somebody made the group default
+
+ }
+ }
+
}
?> \ No newline at end of file