account expiration structures

pull/1/head
Friendika 2011-09-18 19:53:45 -07:00
parent 8bf6a29d4e
commit 5b3f645939
6 changed files with 16 additions and 6 deletions

View File

@ -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' );

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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)) {

View File

@ -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` ");
}