diff --git a/dicos/91_ninegate.xml b/dicos/91_ninegate.xml index 41bb8e51..e13c01f2 100644 --- a/dicos/91_ninegate.xml +++ b/dicos/91_ninegate.xml @@ -13,7 +13,6 @@ - diff --git a/src/ninegate-1.0/src/Cadoles/CASBundle/Controller/SecurityController.php b/src/ninegate-1.0/src/Cadoles/CASBundle/Controller/SecurityController.php index 778949cf..aa2aa621 100644 --- a/src/ninegate-1.0/src/Cadoles/CASBundle/Controller/SecurityController.php +++ b/src/ninegate-1.0/src/Cadoles/CASBundle/Controller/SecurityController.php @@ -30,7 +30,7 @@ class SecurityController extends Controller // Init Client CAS \phpCAS::setDebug("/var/log/phpcas/phpCAS-ninegate.log"); - @\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false); + @\phpCAS::proxy(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false); \phpCAS::setNoCasServerValidation(); @@ -195,7 +195,7 @@ class SecurityController extends Controller public function logoutAction() { // Init Client CAS \phpCAS::setDebug(false); - @\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), true); + @\phpCAS::proxy(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), true); \phpCAS::setNoCasServerValidation(); @@ -209,7 +209,7 @@ class SecurityController extends Controller // Init Client CAS \phpCAS::setDebug("/var/log/phpcas/phpCAS-ninegate.log"); - @\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false); + @\phpCAS::proxy(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false); \phpCAS::setNoCasServerValidation(); @@ -295,4 +295,29 @@ class SecurityController extends Controller } } + + function imapunreadAction() { + if($this->getParameter("active_imapunread")) { + $ip=$this->getParameter("imapundread_ip"); + + // Init Client CAS + \phpCAS::setDebug("/var/log/phpcas/phpCAS-ninegate.log"); + @\phpCAS::proxy(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false); + \phpCAS::setNoCasServerValidation(); + \phpCAS::forceAuthentication(); + + + $pt= \phpCAS::retrievePT('imap://'.$ip,$t,$f); + $a = \phpCAS::serviceMail("{".$ip.":993/imap/ssl/novalidate-cert}","imap://".$ip,0, $errc,$err,$pt); + $unseen = imap_status($a, "{".$ip.":993/imap/ssl/novalidate-cert}INBOX", SA_UNSEEN); + + $count=$unseen->unseen; + $response = new Response(json_encode($count)); + } + else + $response = new Response(json_encode("")); + + $response->headers->set('Content-Type', 'application/json'); + return $response; + } } diff --git a/src/ninegate-1.0/src/Cadoles/CASBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/CASBundle/Resources/config/routing.yml index f97aa770..eeb99047 100644 --- a/src/ninegate-1.0/src/Cadoles/CASBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/CASBundle/Resources/config/routing.yml @@ -10,3 +10,7 @@ cas_sp.test: path: /test defaults: { _controller: CadolesCASBundle:Security:test } +cas_sp.imapunread: + path: /imapunread + defaults: { _controller: CadolesCASBundle:Security:imapunread } + diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Include/menu.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Include/menu.html.twig index f72a59bc..a668fcd7 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Include/menu.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Include/menu.html.twig @@ -6,9 +6,9 @@ {% set permannu = app.session.get('permannu') %} {% if fgheader %} -