Fix phpCAS error on logout, and redirection loop

https://support.chamilo.org/issues/6825
https://support.chamilo.org/issues/6124