mirror of
https://github.com/YunoHost-Apps/hubzilla_ynh.git
synced 2024-09-03 19:26:21 +02:00
42 lines
No EOL
871 B
PHP
42 lines
No EOL
871 B
PHP
<?php
|
|
|
|
namespace Zotlabs\Zot;
|
|
|
|
|
|
class Verify {
|
|
|
|
function create($type,$channel_id,$token,$meta) {
|
|
return q("insert into verify ( type, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )",
|
|
dbesc($type),
|
|
intval($channel_id),
|
|
dbesc($token),
|
|
dbesc($meta),
|
|
dbesc(datetime_convert())
|
|
);
|
|
}
|
|
|
|
function match($type,$channel_id,$token,$meta) {
|
|
$r = q("select id from verify where type = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1",
|
|
dbesc($type),
|
|
intval($channel_id),
|
|
dbesc($token),
|
|
dbesc($meta)
|
|
);
|
|
if($r) {
|
|
q("delete from verify where id = %d",
|
|
intval($r[0]['id'])
|
|
);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function purge($type,$interval) {
|
|
q("delete from verify where type = '%s' and created < %s - INTERVAL %s",
|
|
dbesc($type),
|
|
db_utcnow(),
|
|
db_quoteinterval($interval)
|
|
);
|
|
}
|
|
|
|
} |