<?php
class modsession extends modsession_parent
{
    /**
     * Removes MSIE(\s)?(\S)*(\s) from browser agent information
     *
     * @param string $sAgent browser user agent idenfitier
     *
     * @return string
     */
    public function processUserAgentInfo( $sAgent )
    {
        if ( $sAgent ) {
            $sAgent = getStr()->preg_replace( "/MSIE(\s)?(\S)*(\s)/", "", (string) $sAgent );
        }
        return $sAgent;
    }

    /**
     * Checking user agent
     *
     * @param string $sAgent         current user agent
     * @param string $sExistingAgent existing user agent
     *
     * @return bool
     */
    protected function _checkUserAgent( $sAgent, $sExistingAgent )
    {
        $blCheck = false;

        // processing
        $sAgent = $this->processUserAgentInfo( $sAgent );
        $sExistingAgent = $this->processUserAgentInfo( $sExistingAgent );

        if ( $sAgent && $sAgent !== $sExistingAgent ) {
            if ( $sExistingAgent ) {
                $this->_sErrorMsg = "Different browser ({$sExistingAgent}, {$sAgent}), creating new SID...<br>";
            }
            $blCheck = true;
        }

        return $blCheck;
    }
}