ninegate/tmpl/ninegate-unread.php

36 lines
1.3 KiB
PHP

<?php
%if %%is_defined('adresse_imap') or %%is_defined('adresse_ip_mail')
require_once('/var/www/html/ninegate/vendor/jasig/phpcas/CAS.php');
require_once('configCAS/cas.inc.php');
// try to configure the phpCAS client
session_name("imapunread");
session_start();
if (__CAS_DEBUG){
phpCAS::setDebug("/var/log/phpcas/phpcas-imap.log");
}
$c= phpCAS::proxy(__CAS_VERSION, __CAS_SERVER, __CAS_PORT, __CAS_FOLDER, false);
phpCAS::setNoClearTicketsFromUrl();
phpCAS::setNoCasServerValidation();
phpCAS::forceAuthentication();
if (__CAS_LOGOUT){
if(method_exists('phpCAS','EoleLogoutRequests')) phpCAS::EoleLogoutRequests(false);
}
%if %%is_defined('adresse_imap')
$a = phpCAS::serviceMail("{%%adresse_imap:993/imap/ssl/novalidate-cert}","imap://%%adresse_imap",0, $errc,$err, phpCAS::retrievePT('imap://%%adresse_imap',$t,$f));
$unseen = imap_status($a, "{%%adresse_imap:993/imap/ssl/novalidate-cert}INBOX", SA_UNSEEN);
%else
$a = phpCAS::serviceMail("{%%adresse_ip_mail:993/imap/ssl/novalidate-cert}","imap://%%adresse_ip_mail",0, $errc,$err, phpCAS::retrievePT('imap://%%adresse_ip_mail',$t,$f));
$unseen = imap_status($a, "{%%adresse_ip_mail:993/imap/ssl/novalidate-cert}INBOX", SA_UNSEEN);
%end if
$count=$unseen->unseen;
echo $count;
%end if
?>