mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 07:57:02 +03:00
Some fixes for new owncloud functionality
+ Small other fixes
This commit is contained in:
parent
7d030583c5
commit
2dd9b076fe
14 changed files with 440 additions and 453 deletions
2
build/owncloud/rainloop-app/VERSION
Executable file → Normal file
2
build/owncloud/rainloop-app/VERSION
Executable file → Normal file
|
|
@ -1 +1 @@
|
||||||
2.0
|
0.0
|
||||||
|
|
@ -21,7 +21,8 @@ if (isset($_POST['appname'], $_POST['rainloop-url'], $_POST['rainloop-path']) &&
|
||||||
{
|
{
|
||||||
OCP\Config::setAppValue('rainloop', 'rainloop-url', $_POST['rainloop-url']);
|
OCP\Config::setAppValue('rainloop', 'rainloop-url', $_POST['rainloop-url']);
|
||||||
OCP\Config::setAppValue('rainloop', 'rainloop-path', $_POST['rainloop-path']);
|
OCP\Config::setAppValue('rainloop', 'rainloop-path', $_POST['rainloop-path']);
|
||||||
OCP\Config::setAppValue('rainloop', 'rainloop-autologin', $_POST['rainloop-autologin']);
|
OCP\Config::setAppValue('rainloop', 'rainloop-autologin', isset($_POST['rainloop-autologin']) ?
|
||||||
|
'1' === $_POST['rainloop-autologin'] : false);
|
||||||
|
|
||||||
$sUrl = OCP\Config::getAppValue('rainloop', 'rainloop-url', '');
|
$sUrl = OCP\Config::getAppValue('rainloop', 'rainloop-url', '');
|
||||||
$sPath = OCP\Config::getAppValue('rainloop', 'rainloop-path', '');
|
$sPath = OCP\Config::getAppValue('rainloop', 'rainloop-path', '');
|
||||||
|
|
|
||||||
1
build/owncloud/rainloop-app/ajax/personal.php
Executable file → Normal file
1
build/owncloud/rainloop-app/ajax/personal.php
Executable file → Normal file
|
|
@ -15,6 +15,7 @@ OCP\JSON::callCheck();
|
||||||
|
|
||||||
$sEmail = '';
|
$sEmail = '';
|
||||||
$sLogin = '';
|
$sLogin = '';
|
||||||
|
|
||||||
if (isset($_POST['appname'], $_POST['rainloop-password'], $_POST['rainloop-email']) && 'rainloop' === $_POST['appname'])
|
if (isset($_POST['appname'], $_POST['rainloop-password'], $_POST['rainloop-email']) && 'rainloop' === $_POST['appname'])
|
||||||
{
|
{
|
||||||
$sUser = OCP\User::getUser();
|
$sUser = OCP\User::getUser();
|
||||||
|
|
|
||||||
|
|
@ -14,20 +14,25 @@ OC::$CLASSPATH['OC_RainLoop_Helper'] = OC_App::getAppPath('rainloop') . '/lib/Ra
|
||||||
OCP\App::registerAdmin('rainloop', 'admin');
|
OCP\App::registerAdmin('rainloop', 'admin');
|
||||||
OCP\App::registerPersonal('rainloop', 'personal');
|
OCP\App::registerPersonal('rainloop', 'personal');
|
||||||
|
|
||||||
$bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
|
if (OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false))
|
||||||
if ('on' === $bAutologin)
|
|
||||||
{
|
{
|
||||||
OCP\Util::connectHook('OC_User', 'post_login', 'OC_RainLoop_Helper', 'login');
|
OCP\Util::connectHook('OC_User', 'post_login', 'OC_RainLoop_Helper', 'login');
|
||||||
OCP\Util::connectHook('OC_User', 'logout', 'OC_RainLoop_Helper', 'logout');
|
OCP\Util::connectHook('OC_User', 'logout', 'OC_RainLoop_Helper', 'logout');
|
||||||
OCP\Util::connectHook('OC_User', 'post_setPassword', 'OC_RainLoop_Helper', 'changePassword');
|
OCP\Util::connectHook('OC_User', 'post_setPassword', 'OC_RainLoop_Helper', 'changePassword');
|
||||||
}
|
}
|
||||||
|
|
||||||
OCP\Util::addScript('rainloop', 'rainloop');
|
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||||
|
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||||
|
|
||||||
OCP\App::addNavigationEntry(array(
|
if (('' !== $sUrl && '' !== $sPath) || OC_User::isAdminUser(OC_User::getUser()))
|
||||||
'id' => 'rainloop_index',
|
{
|
||||||
'order' => 10,
|
OCP\Util::addScript('rainloop', 'rainloop');
|
||||||
'href' => OCP\Util::linkTo('rainloop', 'index.php'),
|
|
||||||
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
OCP\App::addNavigationEntry(array(
|
||||||
'name' => 'Email'
|
'id' => 'rainloop_index',
|
||||||
));
|
'order' => 10,
|
||||||
|
'href' => OCP\Util::linkTo('rainloop', 'index.php'),
|
||||||
|
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
||||||
|
'name' => 'Email'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
|
||||||
2
build/owncloud/rainloop-app/appinfo/info.xml
Executable file → Normal file
2
build/owncloud/rainloop-app/appinfo/info.xml
Executable file → Normal file
|
|
@ -3,7 +3,7 @@
|
||||||
<id>rainloop</id>
|
<id>rainloop</id>
|
||||||
<name>RainLoop</name>
|
<name>RainLoop</name>
|
||||||
<description>RainLoop Webmail</description>
|
<description>RainLoop Webmail</description>
|
||||||
<version>2.0</version>
|
<version>0.0</version>
|
||||||
<licence>CC BY-NC-SA 3.0</licence>
|
<licence>CC BY-NC-SA 3.0</licence>
|
||||||
<author>RainLoop Team</author>
|
<author>RainLoop Team</author>
|
||||||
<require>6.0</require>
|
<require>6.0</require>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ $sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||||
$bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
|
$bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
|
||||||
|
|
||||||
|
|
||||||
if ('' === $sUrl || '' === $sPath)
|
if ('' === $sUrl || '' === $sPath)
|
||||||
{
|
{
|
||||||
$oTemplate = new OCP\Template('rainloop', 'index-empty', 'user');
|
$oTemplate = new OCP\Template('rainloop', 'index-empty', 'user');
|
||||||
|
|
@ -33,18 +32,16 @@ else
|
||||||
if ($bAutologin)
|
if ($bAutologin)
|
||||||
{
|
{
|
||||||
$sEmail = $sUser;
|
$sEmail = $sUser;
|
||||||
|
$sEncodedPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-autologin-password', '');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||||
|
$sEncodedPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
$sDecodedPassword = OC_RainLoop_Helper::decodePassword($sEncodedPassword, md5($sEmail));
|
||||||
|
$sSsoHash = OC_RainLoop_Helper::getSsoHash($sPath, $sEmail, $sDecodedPassword);
|
||||||
$sPassword = OC_RainLoop_Helper::decodePassword($sPassword, md5($sEmail));
|
|
||||||
$sSsoHash = OC_RainLoop_Helper::getSsoHash($sPath, $sEmail, $sPassword);
|
|
||||||
|
|
||||||
OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-ssohash', $sSsoHash);
|
|
||||||
|
|
||||||
$sUrl = OC_RainLoop_Helper::normalizeUrl($sUrl);
|
$sUrl = OC_RainLoop_Helper::normalizeUrl($sUrl);
|
||||||
$sResultUrl = empty($sSsoHash) ? $sUrl.'?sso' : $sUrl.'?sso&hash='.$sSsoHash;
|
$sResultUrl = empty($sSsoHash) ? $sUrl.'?sso' : $sUrl.'?sso&hash='.$sSsoHash;
|
||||||
|
|
|
||||||
|
|
@ -28,30 +28,6 @@ class OC_RainLoop_Helper
|
||||||
return $SsoHash;
|
return $SsoHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $sSsoHash
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public static function clearUserSsoHash($sSsoHash)
|
|
||||||
{
|
|
||||||
$result = false;
|
|
||||||
|
|
||||||
$sPath = rtrim(trim($sPath), '\\/').'/index.php';
|
|
||||||
if (file_exists($sPath))
|
|
||||||
{
|
|
||||||
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
|
||||||
include $sPath;
|
|
||||||
|
|
||||||
if (class_exists('\\RainLoop\\Api'))
|
|
||||||
{
|
|
||||||
$result = \RainLoop\Api::ClearUserSsoHash($sSsoHash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sUrl
|
* @param string $sUrl
|
||||||
*
|
*
|
||||||
|
|
@ -59,8 +35,8 @@ class OC_RainLoop_Helper
|
||||||
*/
|
*/
|
||||||
public static function normalizeUrl($sUrl)
|
public static function normalizeUrl($sUrl)
|
||||||
{
|
{
|
||||||
$sUrl = \rtrim(\trim($sUrl), '/\\');
|
$sUrl = rtrim(trim($sUrl), '/\\');
|
||||||
if ('.php' !== \strtolower(\substr($sUrl, -4)))
|
if ('.php' !== strtolower(substr($sUrl, -4)))
|
||||||
{
|
{
|
||||||
$sUrl .= '/';
|
$sUrl .= '/';
|
||||||
}
|
}
|
||||||
|
|
@ -92,54 +68,58 @@ class OC_RainLoop_Helper
|
||||||
return @base64_decode(trim($sPassword));
|
return @base64_decode(trim($sPassword));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function login($params)
|
/**
|
||||||
|
* @param array $aParams
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function login($aParams)
|
||||||
{
|
{
|
||||||
$sUser = $params['uid'];
|
if (isset($aParams['uid'], $aParams['password']))
|
||||||
$sEmail = $sUser;
|
|
||||||
$sPassword = $params['password'];
|
|
||||||
|
|
||||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
|
||||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
|
||||||
|
|
||||||
if ('' !== $sUrl && '' !== $sPath)
|
|
||||||
{
|
{
|
||||||
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
$sUser = $aParams['uid'];
|
||||||
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', $sPassword);
|
|
||||||
|
$sEmail = $sUser;
|
||||||
|
$sPassword = $aParams['password'];
|
||||||
|
|
||||||
|
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||||
|
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||||
|
|
||||||
|
if ('' !== $sUrl && '' !== $sPath)
|
||||||
|
{
|
||||||
|
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
||||||
|
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-autologin-password', $sPassword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function logout($params)
|
public static function logout()
|
||||||
{
|
{
|
||||||
$sUser = OCP\User::getUser();
|
return OCP\Config::setUserValue(
|
||||||
$sSsoHash = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-ssohash', '');
|
OCP\User::getUser(), 'rainloop', 'rainloop-autologin-password', '');
|
||||||
|
|
||||||
$a = OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', null);
|
|
||||||
$b = OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-ssohash', null);
|
|
||||||
|
|
||||||
if('' !== $sSsoHash) {
|
|
||||||
self::clearUserSsoHash($sSsoHash);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $a && $b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function changePassword($params)
|
public static function changePassword($aParams)
|
||||||
{
|
{
|
||||||
$sUser = $params['uid'];
|
if (isset($aParams['uid'], $aParams['password']))
|
||||||
$sEmail = $sUser;
|
|
||||||
$sPassword = $params['password'];
|
|
||||||
|
|
||||||
OCP\Util::writeLog('rainloop', 'rainloop|login: Setting new RainLoop password for '. $sEmail, OCP\Util::DEBUG);
|
|
||||||
|
|
||||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
|
||||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
|
||||||
|
|
||||||
if ('' !== $sUrl && '' !== $sPath)
|
|
||||||
{
|
{
|
||||||
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
$sUser = $aParams['uid'];
|
||||||
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', $sPassword);
|
|
||||||
|
$sEmail = $sUser;
|
||||||
|
$sPassword = $aParams['password'];
|
||||||
|
|
||||||
|
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||||
|
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||||
|
|
||||||
|
if ('' !== $sUrl && '' !== $sPath)
|
||||||
|
{
|
||||||
|
OCP\Util::writeLog('rainloop', 'rainloop|login: Setting new RainLoop password for '.$sEmail, OCP\Util::DEBUG);
|
||||||
|
|
||||||
|
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
||||||
|
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', $sPassword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ $sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||||
$bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
|
$bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
|
||||||
|
|
||||||
if ('on' === $bAutologin || '' === $sUrl || '' === $sPath)
|
if ($bAutologin || '' === $sUrl || '' === $sPath)
|
||||||
{
|
{
|
||||||
$oTemplate = new OCP\Template('rainloop', 'empty');
|
$oTemplate = new OCP\Template('rainloop', 'empty');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@
|
||||||
<input type="text" style="width:300px;" id="rainloop-path" name="rainloop-path" value="<?php echo $_['rainloop-path']; ?>" />
|
<input type="text" style="width:300px;" id="rainloop-path" name="rainloop-path" value="<?php echo $_['rainloop-path']; ?>" />
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<input type="checkbox" id="rainloop-autologin" name="rainloop-autologin" <?php if(true == $_['rainloop-autologin']): ?>checked="checked"<?php endif; ?> /><?php p($l->t('Automatically login with ownCloud user credentials')); ?>
|
<input type="checkbox" id="rainloop-autologin" id="rainloop-autologin" name="rainloop-autologin" value="1" <?php if ($_['rainloop-autologin']): ?>checked="checked"<?php endif; ?> />
|
||||||
|
<label for="rainloop-autologin">
|
||||||
|
<?php p($l->t('Automatically login with ownCloud user credentials')); ?>
|
||||||
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<input type="button" id="rainloop-save-button" name="rainloop-save-button" value="<?php p($l->t('Save')); ?>" />
|
<input type="button" id="rainloop-save-button" name="rainloop-save-button" value="<?php p($l->t('Save')); ?>" />
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ class PdoAddressBook
|
||||||
$aMatch = array();
|
$aMatch = array();
|
||||||
if (\preg_match('/\/([^\/?]+)$/', $sKey, $aMatch) && !empty($aMatch[1]))
|
if (\preg_match('/\/([^\/?]+)$/', $sKey, $aMatch) && !empty($aMatch[1]))
|
||||||
{
|
{
|
||||||
$sVcfFileName = $aMatch[1];
|
$sVcfFileName = \urldecode(\urldecode($aMatch[1]));
|
||||||
$sKeyID = \preg_replace('/\.vcf$/i', '', $sVcfFileName);
|
$sKeyID = \preg_replace('/\.vcf$/i', '', $sVcfFileName);
|
||||||
|
|
||||||
$mResult[$sKeyID] = array(
|
$mResult[$sKeyID] = array(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue