38 parent::__construct(
$config, $reserved);
40 assert(
'is_array($config)');
42 if (array_key_exists(
'warndaysbefore',
$config)) {
43 $this->warndaysbefore =
$config[
'warndaysbefore'];
44 if (!is_string($this->warndaysbefore)) {
45 throw new Exception(
'Invalid value for number of days given to expirycheck::ExpiryDate filter.');
49 if (array_key_exists(
'netid_attr',
$config)) {
50 $this->netid_attr =
$config[
'netid_attr'];
51 if (!is_string($this->netid_attr)) {
52 throw new Exception(
'Invalid attribute name given as eduPersonPrincipalName to expirycheck::ExpiryDate filter.');
56 if (array_key_exists(
'expirydate_attr',
$config)) {
57 $this->expirydate_attr =
$config[
'expirydate_attr'];
58 if (!is_string($this->expirydate_attr)) {
59 throw new Exception(
'Invalid attribute name given as schacExpiryDate to expirycheck::ExpiryDate filter.');
63 if (array_key_exists(
'date_format',
$config)) {
64 $this->date_format =
$config[
'date_format'];
65 if (!is_string($this->date_format)) {
66 throw new Exception(
'Invalid date format given to expirycheck::ExpiryDate filter.');
82 if ($expireOnDate >= $now) {
83 $days = (int)((
$end - $now) / (24*60*60));
85 $state[
'daysleft'] = $days;
100 $end = $expireOnDate;
120 $expireOnDate = strtotime(
$state[
'Attributes'][$this->expirydate_attr][0]);
122 if (self::shWarning(
$state, $expireOnDate, $this->warndaysbefore)) {
123 assert(
'is_array($state)');
124 if (isset(
$state[
'isPassive']) &&
$state[
'isPassive'] === TRUE) {
130 ' is about to expire!');
133 $state[
'expireOnDate'] =
date($this->date_format, $expireOnDate);
140 if (!self::checkDate($expireOnDate)) {
142 ' has expired [' .
date($this->date_format, $expireOnDate) .
']. Access denied!');
146 $state[
'expireOnDate'] =
date($this->date_format, $expireOnDate);
shWarning(&$state, $expireOnDate, $warndaysbefore)
Show expirational warning if remaining days is equal or under defined $warndaysbefore.
if(!array_key_exists('StateId', $_REQUEST)) $id
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
process(&$state)
Apply filter.
Create styles array
The data for the language used.
__construct($config, $reserved)
Initialize this filter.
checkDate($expireOnDate)
Check if given date is older than today.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static saveState(&$state, $stage, $rawId=false)
Save the state.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.