Esempio n. 1
0
 /**
  * Login to roundcube host
  *
  * @param roundcube host to use $rcHost
  * @param port of the roundcube server $rcPort
  * @param context path of roundcube $maildir
  * @param login to be used $pLogin
  * @param password to be used $pPassword
  */
 public static function login($rcHost, $rcPort, $maildir, $pLogin, $pPassword)
 {
     // Create RC login object.
     $enableDebug = OCP\Config::getAppValue('roundcube', 'enableDebug', 'true');
     $rcl = new OC_RoundCube_Login($rcHost, $rcPort, $maildir, $enableDebug);
     // Try to login
     OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): Trying to log into roundcube webinterface under ' . $maildir . ' as user ' . $pLogin, OCP\Util::DEBUG);
     if ($rcl->isLoggedIn()) {
         $rcl->logout();
         $rcl = new OC_RoundCube_Login($rcHost, $rcPort, $maildir, $enableDebug);
     }
     if ($rcl->login($pLogin, $pPassword)) {
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): ' . $pLogin . ' successfully logged into roundcube ', OCP\Util::INFO);
     } else {
         // If the login fails, display an error message in the loggs
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->login(): ' . $pLogin . ': RoundCube can\'t login to roundcube due to a login error to roundcube', OCP\Util::ERROR);
     }
 }
 /**
  * Logs the current user out from roundcube
  *
  * @param
  *            roundcube server address $rcHost
  * @param
  *            roundcube server port $rcPort
  * @param
  *            path to roundcube installation, Note: The first parameter is the URL-path of the RC inst
  *            NOT the file-system path http://host.com/path/to/roundcube/ --> "/path/to/roundcube" $maildir
  * @param
  *            roundcube usernam $user
  */
 public static function logout($rcHost, $rcPort, $maildir, $user)
 {
     $enableDebug = OCP\Config::getAppValue('roundcube', 'enableDebug', 'false');
     $disableSSLverify = OCP\Config::getAppValue('roundcube', 'noSSLverify', 'false');
     $rcl = new OC_RoundCube_Login($rcHost, $rcPort, $maildir, $disableSSLverify, $enableDebug, false);
     if ($rcl->logout()) {
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->logout(): ' . $user . ' successfully logged off from roundcube ', OCP\Util::INFO);
     } else {
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->logout(): Failed to log-off ' . $user . ' from roundcube. If you are using roundcube 1.0.4. Please update to roundcube 1.0.5', OCP\Util::ERROR);
     }
     self::setSessionVariable(self::SESSION_ATTR_RCSESSID, '1');
     self::setSessionVariable(self::SESSION_ATTR_RCSESSAUTH, '1');
 }
	/**
	 * Logs the current user out from roundcube
	 * @param roundcube server address $rcHost
	 * @param roundcube server port $rcPort
	 * @param path to roundcube installation, Note: The first parameter is the URL-path of the RC inst
	 * NOT the file-system path http://host.com/path/to/roundcube/ --> "/path/to/roundcube" $maildir
	 * @param roundcube usernam $user
	 */
	public static function logout($rcHost, $rcPort, $maildir, $user) {
		$enableDebug = OCP\Config::getAppValue('roundcube', 'enableDebug', 'true');
		$rcl = new OC_RoundCube_Login($rcHost, $rcPort, $maildir, $enableDebug);
		if ($rcl -> logout()) {
			OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->logout(): '. $user.' successfully logged off from roundcube ', OCP\Util::INFO);
		} else {
			OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->logout(): Failed to log-off '.$user.' from roundcube ', OCP\Util::ERROR);
		}
	}