Skip to content

Commit

Permalink
dirtyfix stuff for newer owncloud/nextcloud, prepare for improvements
Browse files Browse the repository at this point in the history
* workaround detection of the OC versions to do not break support for my OC installations
* property set L10n depending of the OC version detected so OC 9+ can maybe work
* for now this commit supresed the errors in newer versions
* closes #378 by modified proposed code with detection version
* pending the proposed code in #379 maybe this solved the #379 need test now
  • Loading branch information
systemas committed Jun 8, 2017
1 parent 808b29c commit 1ca97b4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
16 changes: 14 additions & 2 deletions roundcube/src/main/php/ajax/adminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
// CSRF checks
OCP\JSON::callCheck();

$l = new OC_L10N('roundcube');
// workaround to detect OC version and compatibility for OC and nextcloud
$ocVersion = @reset(OCP\Util::getVersion());


if ($ocVersion < 9) {
$l = new OC_L10N('roundcube');
} else {
$l = OC::$server->getL10N('roundcube')
}

$params = array('maildir', 'removeHeaderNav', 'removeControlNav', 'autoLogin', 'noSSLverify', 'enableDebug', 'rcHost', 'rcPort', 'rcInternalAddress', 'rcRefreshInterval');

Expand Down Expand Up @@ -56,7 +64,11 @@
} else if ($param == 'rcRefreshInterval') {
$refresh = trim($_POST[$param]);
if ($refresh == '') {
OC_Appconfig::deleteKey('roundcube', $param);
if ($ocVersion < 9) {
OC_Appconfig::deleteKey('roundcube', $param);
} else {
\OCP\Util::connectHook('OC_Appconfig', 'deleteKey', 'roundcube', $param);
}
} else if (!is_numeric($refresh)) {
OC_JSON::error(array(
"data" => array(
Expand Down
10 changes: 9 additions & 1 deletion roundcube/src/main/php/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
*
*/

$l = new OC_L10N('roundcube');
// workaround to detect OC version and compatibility for OC and nextcloud
$ocVersion = @reset(OCP\Util::getVersion());

if ($ocVersion < 9) {
$l = new OC_L10N('roundcube');
} else {
$l = OC::$server->getL10N('roundcube')
}

OC::$CLASSPATH['OC_Mail_NetworkingException'] = OC_App::getAppPath('roundcube') . '/lib/MailNetworkingException.class.php';
OC::$CLASSPATH['OC_Mail_LoginException'] = OC_App::getAppPath('roundcube') . '/lib/MailLoginException.class.php';
OC::$CLASSPATH['OC_Mail_RC_InstallNotFoundException'] = OC_App::getAppPath('roundcube') . '/lib/MailRoundCubeNotFoundException.class.php';
Expand Down
12 changes: 10 additions & 2 deletions roundcube/src/main/php/lib/RoundCubeApp.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class OC_RoundCube_App

private $path = '';

// workaround to detect OC version and compatibility for OC and nextcloud
private $ocVersion = @reset(OCP\Util::getVersion());


/**
* Write to the PHP session
*
Expand Down Expand Up @@ -548,8 +552,12 @@ public static function getRedirectPath($pRcHost, $pRcPort, $pRcPath)

public static function saveUserSettings($appName, $ocUser, $rcUser, $rcPassword)
{
$l = new OC_L10N('roundcube');

if ($ocVersion < 9) {
$l = new OC_L10N('roundcube');
} else {
$l = OC::$server->getL10N('roundcube')
}

if (isset($appName) && $appName == "roundcube") {
$result = self::cryptEmailIdentity($ocUser, $rcUser, $rcPassword, true);
OCP\Util::writeLog('roundcube', 'OC_RoundCube_App.class.php->saveUserSettings(): Starting saving new users data for ' . $ocUser . ' as roundcube user ' . $rcUser, OCP\Util::DEBUG);
Expand Down

1 comment on commit 1ca97b4

@mckaygerhard
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now with this commit lest see the jenkis test for..

Please sign in to comment.