. * */ // set the passwort in session to fill the hidden login form with revertet and base64 encoded pass // the *yourkey* must the same string as in autologin.php to replace this after revert and decode OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('roundcube'); $table_exists = OC_RoundCube_DB_Util::tableExists(); $html_output = ""; if (!$table_exists) { OCP\Util::writeLog('roundcube', 'DB table entries not created ...', OCP\Util::INFO); $html_output = $html_output . $this -> inc("part.error.db"); } else { $ocUser = OCP\User::getUser(); $privKey = OC_RoundCube_App::getPrivateKey($ocUser,false); $mail_userdata_entries = OC_RoundCube_App::checkLoginData(OCP\User::getUser()); // TODO create dropdown list $mail_userdata = $mail_userdata_entries[0]; // // Nope. Already logged in at the start. Then starting to support // multiple accounts, a re-login with other credentials than the // default ID could be provided. // $mail_username = OC_RoundCube_App::decryptMyEntry($mail_userdata['mail_user'], $privKey); $mail_password = OC_RoundCube_App::decryptMyEntry($mail_userdata['mail_password'], $privKey); $disable_control_nav = OCP\Config::getAppValue('roundcube', 'removeControlNav', false); $enable_autologin = OCP\Config::getAppValue('roundcube', 'autoLogin', false); $rc_host = OCP\Config::getAppValue('roundcube', 'rcHost', OC_Request::serverHost()); $rc_port = OCP\Config::getAppValue('roundcube', 'rcPort', null); OCP\Util::writeLog('roundcube', 'Opening iframe for RC-host '.$rc_host.' with port '.$rc_port, OCP\Util::DEBUG); OCP\Util::writeLog('roundcube', 'Preparing pre-check before rendering mail view ', OCP\Util::INFO); if ($mail_userdata['id'] != '') { if ($mail_userdata['oc_user'] == OCP\User::getUser()) { OCP\Util::writeLog('roundcube', 'Used mail_username: '.$mail_username, OCP\Util::DEBUG); if (!$enable_autologin && ( $mail_username == '' || $mail_password == '')) { OCP\Util::writeLog('roundcube', 'No valid user login data found.',OCP\Util::ERROR); $html_output = $html_output . $this -> inc("part.error.no-settings"); } else { // with autologin oc user = rc user if($enable_autologin){ $mail_username = $ocUser; } else{ $emailUserCrypted = $_SESSION[OC_RoundCube_App::SESSION_ATTR_RCLOGIN]; $mail_username = OC_RoundCube_App::decryptMyEntry($emailUserCrypted,$privKey); } $maildir = OCP\Config::getAppValue('roundcube', 'maildir', ''); if ($maildir != '') { $mailAppReturn = OC_RoundCube_App::showMailFrame($rc_host, $rc_port, $maildir); if ($mailAppReturn -> isErrorOccurred()) { OCP\Util::writeLog('roundcube', 'Not rendering roundcube iframe view due to errors', OCP\Util::ERROR); OCP\Util::writeLog('roundcube', 'Got the following error code: '.$mailAppReturn -> getErrorCode(),OCP\Util::ERROR); switch ($mailAppReturn -> getErrorCode()) { case OC_Mail_Object::ERROR_CODE_NETWORK : $html_output = $this -> inc("part.error.error-settings"); $html_output = $html_output . $mailAppReturn -> getErrorDetails(); break; case OC_Mail_Object::ERROR_CODE_LOGIN : $html_output = $this -> inc("part.error.wrong-auth"); $html_output = $html_output . $mailAppReturn -> getErrorDetails(); break; case OC_Mail_Object::ERROR_CODE_RC_NOT_FOUND : $html_output = $this -> inc("part.error.error-settings"); $html_output = $html_output . $mailAppReturn -> getErrorDetails(); break; default : $html_output = $this -> inc("part.error.error-settings"); $html_output = $html_output . $mailAppReturn -> getErrorDetails(); break; } } else { OCP\Util::writeLog('roundcube', 'Rendering roundcube iframe view', OCP\Util::INFO); if (!$disable_control_nav) { $html_output = $html_output . "