aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-09-18 19:53:45 -0700
committerFriendika <info@friendika.com>2011-09-18 19:53:45 -0700
commit5b3f6459392ba6f417cfc5cb0d38094c009c6913 (patch)
treed98c801e79dc3542cf89769d7b943f1b8292a38b
parent8bf6a29d4e05af5d461da3f01999785dc12ee7da (diff)
downloadvolse-hubzilla-5b3f6459392ba6f417cfc5cb0d38094c009c6913.tar.gz
volse-hubzilla-5b3f6459392ba6f417cfc5cb0d38094c009c6913.tar.bz2
volse-hubzilla-5b3f6459392ba6f417cfc5cb0d38094c009c6913.zip
account expiration structures
-rw-r--r--boot.php2
-rw-r--r--database.sql3
-rw-r--r--include/api.php2
-rw-r--r--include/auth.php4
-rw-r--r--mod/openid.php2
-rw-r--r--update.php9
6 files changed, 16 insertions, 6 deletions
diff --git a/boot.php b/boot.php
index 226bc3d01..c73ab3d6e 100644
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once("include/pgettext.php");
define ( 'FRIENDIKA_VERSION', '2.3.1108' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
-define ( 'DB_UPDATE_VERSION', 1088 );
+define ( 'DB_UPDATE_VERSION', 1089 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/database.sql b/database.sql
index 444b05faa..ba52d9f35 100644
--- a/database.sql
+++ b/database.sql
@@ -413,6 +413,9 @@ CREATE TABLE IF NOT EXISTS `user` (
`pwdreset` char(255) NOT NULL,
`maxreq` int(11) NOT NULL DEFAULT '10',
`expire` int(11) unsigned NOT NULL DEFAULT '0',
+ `account_expired` tinyint( 1 ) NOT NULL DEFAULT '0',
+ `account_expires_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
diff --git a/include/api.php b/include/api.php
index 5d008c290..74b4aaf6e 100644
--- a/include/api.php
+++ b/include/api.php
@@ -55,7 +55,7 @@
// process normal login request
$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
- AND `password` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
+ AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
dbesc(trim($user)),
dbesc(trim($user)),
dbesc($encrypted)
diff --git a/include/auth.php b/include/auth.php
index b7b96bdc0..1f16b3504 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -49,7 +49,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
}
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
- FROM `user` WHERE `uid` = %d LIMIT 1",
+ FROM `user` WHERE `uid` = %d AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
intval($_SESSION['uid'])
);
@@ -186,7 +186,7 @@ else {
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
- AND `password` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
+ AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
dbesc(trim($_POST['openid_url'])),
dbesc(trim($_POST['openid_url'])),
dbesc($encrypted)
diff --git a/mod/openid.php b/mod/openid.php
index 3c3293147..b8734f023 100644
--- a/mod/openid.php
+++ b/mod/openid.php
@@ -56,7 +56,7 @@ function openid_content(&$a) {
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
- FROM `user` WHERE `openid` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
+ FROM `user` WHERE `openid` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
dbesc($_SESSION['openid'])
);
if(! count($r)) {
diff --git a/update.php b/update.php
index 82ae05872..6101efea6 100644
--- a/update.php
+++ b/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1088 );
+define( 'UPDATE_VERSION' , 1089 );
/**
*
@@ -743,3 +743,10 @@ function update_1087() {
}
}
}
+
+function update_1088() {
+ q("ALTER TABLE `user` ADD `account_expired` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `expire` ,
+ ADD `account_expires_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expired` ,
+ ADD `expire_notification_sent` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expires_on` ");
+}
+