* Author: Keith Fernie <http://friendika.me4.it/profile/keith>
*/
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Security;
function public_server_install()
{
Addon::unregisterHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login');
}
-function public_server_load_config(\Friendica\App $a)
+function public_server_load_config(App $a)
{
$a->loadConfigFile(__DIR__. '/config/public_server.ini.php');
}
$r = q("SELECT * FROM `user` WHERE `account_expires_on` < UTC_TIMESTAMP() + INTERVAL 5 DAY AND
`account_expires_on` > '%s' AND
`expire_notification_sent` <= '%s'",
- DBA::escape(NULL_DATE), DBA::escape(NULL_DATE));
+ DBA::NULL_DATETIME, DBA::NULL_DATETIME);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$nologin = Config::get('public_server', 'nologin', false);
if ($nologin) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` <= '%s' AND `register_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s'",
- DBA::escape(NULL_DATE), intval($nologin), DBA::escape(NULL_DATE));
+ DBA::NULL_DATETIME, intval($nologin), DBA::NULL_DATETIME);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
$flagusers = Config::get('public_server', 'flagusers', false);
if ($flagusers) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' AND `page-flags` = 0",
- intval($flagusers), DBA::escape(NULL_DATE));
+ intval($flagusers), DBA::NULL_DATETIME);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')];
$flagpostsexpire = Config::get('public_server', 'flagpostsexpire');
if ($flagposts && $flagpostsexpire) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' and `expire` = 0 AND `page-flags` = 0",
- intval($flagposts), DBA::escape(NULL_DATE));
+ intval($flagposts), DBA::NULL_DATETIME);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
DBA::update('user', ['expire' => $flagpostsexpire], ['uid' => $rr['uid']]);
}
$fields = ['account_expires_on' => DateTimeFormat::utc('now +' . $days . ' days')];
- $condition = ["`uid` = ? AND `account_expires_on` > ?", local_user(), NULL_DATE];
+ $condition = ["`uid` = ? AND `account_expires_on` > ?", local_user(), DBA::NULL_DATETIME];
DBA::update('user', $fields, $condition);
}