www/src/rootio/Bundle/vmailmeBundle/Lib/RoundcubeLogin.php
/**
     * Gets the current login status and the session cookie.
     *
     * It updates the private variables rcSessionID and rcLoginStatus by
     * sending a request to the main page and parsing the result for the login form.
     */
Gets the current login status and the session cookie.
It updates the private variables rcSessionID and rcLoginStatus by
sending a request to the main page and parsing the result for the login form.
Gets the current login status and the session cookie . It updates the private variables rcSessionID and rcLoginStatus by sending a request to the main page and parsing the result for the login form .
private function updateLoginStatus($forceUpdate = false) {
        if ($this->rcSessionID && $this->rcLoginStatus && !$forceUpdate)
            return;
        if ($this->cookies->has('roundcube_sessid'))
            $this->rcSessionID = $this->cookies->get('roundcube_sessid');
        if ($this->cookies->has('roundcube_sessauth'))
            $this->rcSessionAuth = $this->cookies->get('roundcube_sessauth');
        $response = $this->sendRequest($this->rcPath);
        if (preg_match('/"request_token":"([^"]+)",/mi',$response, $m))
            $this->lastToken = $m[1];
        if (preg_match('/<input.+name="_token".+value="([^"]+)"/mi', $response, $m))
            $this->lastToken = $m[1]; 
                if (preg_match('/<input.+name="_pass"/mi',$response)) {
            $this->addDebug("NOT LOGGED IN", "Detected that we're NOT logged in.");
            $this->rcLoginStatus = -1;
        }
        else if (preg_match('/<div.+id="message"/mi',$response)) {
            $this->addDebug("LOGGED IN", "Detected that we're logged in.");
            $this->rcLoginStatus = 1;
        }
        else if (preg_match('/<div.+id="messagetoolbar"/mi', $response)) {
            $this->addDebug("LOGGED IN", "Detected that we're logged in.");
            $this->rcLoginStatus = 1;
        }
        else {
            $this->addDebug("UNKNOWN LOGIN STATE", "Unable to determine the login status. Did you change the RC version?");
            throw new RoundcubeLoginException("Unable to determine the login status. Unable to continue due to technical problems.");
        }
        if (!$this->rcSessionID) {
            $this->addDebug("NO SESSION ID", "No session ID received. RC version changed?");
            throw new RoundcubeLoginException("No session ID received. Unable to continue due to technical problems.");
        }
    }
private function updateLoginStatus ( $ forceUpdate = false ) { if ( $ this -> rcSessionID && $ this -> rcLoginStatus && ! $ forceUpdate ) return ; if ( $ this -> cookies -> has ( 'roundcube_sessid' ) ) $ this -> rcSessionID = $ this -> cookies -> get ( 'roundcube_sessid' ) ; if ( $ this -> cookies -> has ( 'roundcube_sessauth' ) ) $ this -> rcSessionAuth = $ this -> cookies -> get ( 'roundcube_sessauth' ) ; $ response = $ this -> sendRequest ( $ this -> rcPath ) ; if ( preg_match ( '/"request_token":"([^"]+)",/mi' , $ response , $ m ) ) $ this -> lastToken = $ m [ 1 ] ; if ( preg_match ( '/<input.+name="_token".+value="([^"]+)"/mi' , $ response , $ m ) ) $ this -> lastToken = $ m [ 1 ] ; if ( preg_match ( '/<input.+name="_pass"/mi' , $ response ) ) { $ this -> addDebug ( " NOT LOGGED IN " , " Detected that we're NOT logged in. " ) ; $ this -> rcLoginStatus = - 1 ; } else if ( preg_match ( '/<div.+id="message"/mi' , $ response ) ) { $ this -> addDebug ( " LOGGED IN " , " Detected that we're logged in. " ) ; $ this -> rcLoginStatus = 1 ; } else if ( preg_match ( '/<div.+id="messagetoolbar"/mi' , $ response ) ) { $ this -> addDebug ( " LOGGED IN " , " Detected that we're logged in. " ) ; $ this -> rcLoginStatus = 1 ; } else { $ this -> addDebug ( " UNKNOWN LOGIN STATE " , " Unable to determine the login status. Did you change the RC version? " ) ; throw new RoundcubeLoginException ( " Unable to determine the login status. Unable to continue due to technical problems. " ) ; } if ( ! $ this -> rcSessionID ) { $ this -> addDebug ( " NO SESSION ID " , " No session ID received. RC version changed? " ) ; throw new RoundcubeLoginException ( " No session ID received. Unable to continue due to technical problems. " ) ; } }
Gets the current login status and the session cookie.
Gets the current login status and the session cookie .
// Get current session ID cookie // Send request and maybe receive new session ID // Request token (since Roundcube 0.5.1) // override previous token (if this one exists!) // Login form available?
 // If no session ID is available now, throw an exception