mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Back to old ownCloud package
Fix idn encoder Small fixes
This commit is contained in:
parent
9fed380992
commit
be45d989f8
44 changed files with 964 additions and 522 deletions
45
Gruntfile.js
45
Gruntfile.js
|
|
@ -379,17 +379,6 @@ module.exports = function (grunt) {
|
|||
cwd: '<%= cfg.releasesPath %>/<%= cfg.releaseFolder %>/src/',
|
||||
src: ['**/*']
|
||||
}]
|
||||
},
|
||||
own: {
|
||||
options: {
|
||||
archive: '<%= cfg.releasesPath %>/<%= cfg.releaseFolder %>/<%= cfg.releaseZipFile %>',
|
||||
mode: 'zip'
|
||||
},
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: '<%= cfg.releasesPath %>/<%= cfg.releaseFolder %>/owncloud/',
|
||||
src: ['**/*']
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -444,7 +433,7 @@ module.exports = function (grunt) {
|
|||
releasesPath = grunt.config('cfg.releasesPath'),
|
||||
devVersion = grunt.config('cfg.devVersion'),
|
||||
versionFull = version + '.' + release,
|
||||
dist = releasesPath + '/' + versionFull + '/src/'
|
||||
dist = releasesPath + '/webmail/' + versionFull + '/src/'
|
||||
;
|
||||
|
||||
grunt.file.mkdir(dist);
|
||||
|
|
@ -463,7 +452,7 @@ module.exports = function (grunt) {
|
|||
|
||||
grunt.file.delete(dist + 'rainloop/v/' + versionFull + '/static/css/less.css');
|
||||
|
||||
grunt.config.set('cfg.releaseFolder', versionFull);
|
||||
grunt.config.set('cfg.releaseFolder', 'webmail/' + versionFull);
|
||||
grunt.config.set('cfg.releaseSrcPath', dist);
|
||||
grunt.config.set('cfg.releaseZipFile', 'rainloop-' + versionFull + '.zip');
|
||||
});
|
||||
|
|
@ -472,36 +461,26 @@ module.exports = function (grunt) {
|
|||
|
||||
var
|
||||
content = '',
|
||||
version = grunt.config('pkg.version'),
|
||||
release = parseInt(grunt.config('pkg.release'), 10),
|
||||
version = grunt.config('pkg.ownCloudPackageVersion'),
|
||||
releasesPath = grunt.config('cfg.releasesPath'),
|
||||
devVersion = grunt.config('cfg.devVersion'),
|
||||
webmailPath = grunt.config('cfg.releaseSrcPath'),
|
||||
versionFull = version + '.' + release,
|
||||
dist = releasesPath + '/' + versionFull + '/owncloud/'
|
||||
versionFull = version,
|
||||
dist = releasesPath + '/owncloud/' + versionFull + '/src/'
|
||||
;
|
||||
|
||||
grunt.file.mkdir(dist);
|
||||
grunt.file.mkdir(dist + 'rainloop');
|
||||
|
||||
require('wrench').copyDirSyncRecursive('build/owncloud/rainloop-app',
|
||||
dist, {'forceDelete': true});
|
||||
dist + 'rainloop', {'forceDelete': true});
|
||||
|
||||
content = grunt.file.read(dist + 'appinfo/info.xml');
|
||||
content = grunt.file.read(dist + 'rainloop/appinfo/info.xml');
|
||||
|
||||
grunt.file.write(dist + 'appinfo/info.xml',
|
||||
grunt.file.write(dist + 'rainloop/appinfo/info.xml',
|
||||
content.replace('<version>0.0.0</version>', '<version>' + versionFull + '</version>'));
|
||||
|
||||
grunt.file.write(dist + 'appinfo/version', versionFull);
|
||||
grunt.file.write(dist + 'rainloop/appinfo/version', versionFull);
|
||||
|
||||
require('wrench').copyDirSyncRecursive(webmailPath,
|
||||
dist + 'app', {'forceDelete': true});
|
||||
|
||||
require('wrench').rmdirSyncRecursive(webmailPath);
|
||||
require('wrench').rmdirSyncRecursive(dist + 'app/data');
|
||||
|
||||
grunt.file.write(dist + 'app/OWNCLOUD', versionFull);
|
||||
|
||||
grunt.config.set('cfg.releaseFolder', versionFull);
|
||||
grunt.config.set('cfg.releaseFolder', 'owncloud/' + versionFull);
|
||||
grunt.config.set('cfg.releaseSrcPath', dist);
|
||||
grunt.config.set('cfg.releaseZipFile', 'rainloop-owncloud-app-' + versionFull + '.zip');
|
||||
});
|
||||
|
|
@ -538,7 +517,7 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask('fast', ['less', 'concat']);
|
||||
grunt.registerTask('default', ['less', 'concat', 'cssmin', 'jshint', 'rlmin']);
|
||||
grunt.registerTask('build', ['default', 'rainloop', 'compress:build', 'md5:build', 'release-inc', 'rainloop-clean']);
|
||||
grunt.registerTask('owncloud', ['default', 'rainloop', 'rainloop-owncloud', 'compress:own', 'md5:build', 'rainloop-clean']);
|
||||
grunt.registerTask('owncloud', ['rainloop-owncloud', 'compress:build', 'md5:build', 'rainloop-clean']);
|
||||
|
||||
// aliases
|
||||
grunt.registerTask('u', ['uglify']);
|
||||
|
|
|
|||
|
|
@ -1,19 +1,36 @@
|
|||
************************************************************************
|
||||
*
|
||||
* ownCloud - RainLoop mail plugin
|
||||
* ownCloud - RainLoop Webmail mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*
|
||||
************************************************************************
|
||||
|
||||
REQUIREMENTS:
|
||||
- Installed and configured RainLoop Webmail
|
||||
- ownCloud version 6 or higher
|
||||
- Both apps (RainLoop & ownCloud) running on the same domain
|
||||
|
||||
|
||||
INSTALL:
|
||||
- Unpack the RainLoop Webmail application package in the apps directory of your OwnCloud instance
|
||||
|
||||
|
||||
CONFIGURATION:
|
||||
|
||||
- RainLoop:
|
||||
1) Open ../_default_/configs/application.ini
|
||||
2) Find:
|
||||
|
||||
[labs]
|
||||
allow_external_sso = On
|
||||
external_sso_key = "super-secret-key"
|
||||
|
||||
- ownCloud:
|
||||
1) In the Apps > Enable 'RainLoop' plugin
|
||||
2) In the Settings > Personal > Type your mail server email(login) and password (for autologin)
|
||||
3) Enjoy!
|
||||
2) In the Settings > Admin > Enter "RainLoop Webmail URL" and "SSO key"
|
||||
3) In the Settings > Personal > Type your mail server email (login) and password
|
||||
|
||||
|
|
|
|||
1
build/owncloud/rainloop-app/VERSION
Normal file
1
build/owncloud/rainloop-app/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
1.3
|
||||
19
build/owncloud/rainloop-app/admin.php
Normal file
19
build/owncloud/rainloop-app/admin.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\User::checkAdminUser();
|
||||
|
||||
OCP\Util::addScript('rainloop', 'admin');
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'admin');
|
||||
$oTemplate->assign('rainloop-url', OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$oTemplate->assign('rainloop-sso-key', OCP\Config::getAppValue('rainloop', 'rainloop-sso-key', ''));
|
||||
return $oTemplate->fetchPage();
|
||||
33
build/owncloud/rainloop-app/ajax/admin.php
Normal file
33
build/owncloud/rainloop-app/ajax/admin.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\JSON::checkAdminUser();
|
||||
OCP\JSON::checkAppEnabled('rainloop');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$sUrl = '';
|
||||
$sSsoKey = '';
|
||||
if (isset($_POST['appname'], $_POST['rainloop-url'], $_POST['rainloop-sso-key']) && 'rainloop' === $_POST['appname'])
|
||||
{
|
||||
OCP\Config::setAppValue('rainloop', 'rainloop-url', $_POST['rainloop-url']);
|
||||
OCP\Config::setAppValue('rainloop', 'rainloop-sso-key', $_POST['rainloop-sso-key']);
|
||||
|
||||
$sUrl = OCP\Config::getAppValue('rainloop', 'rainloop-url', '');
|
||||
$sSsoKey = OCP\Config::getAppValue('rainloop', 'rainloop-sso-key', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
OC_JSON::error(array('Message' => 'Invalid Argument(s)', 'Url' => $sUrl, 'SsoKey' => $sSsoKey));
|
||||
return false;
|
||||
}
|
||||
|
||||
OCP\JSON::success(array('Message' => 'Saved successfully', 'Url' => $sUrl, 'SsoKey' => $sSsoKey));
|
||||
return true;
|
||||
|
|
@ -9,25 +9,15 @@
|
|||
* https://github.com/RainLoop/owncloud
|
||||
*/
|
||||
|
||||
OCP\App::registerAdmin('rainloop', 'admin');
|
||||
OCP\App::registerPersonal('rainloop', 'personal');
|
||||
|
||||
OCP\Util::addScript('rainloop', 'rainloop');
|
||||
|
||||
OCP\App::addNavigationEntry(array(
|
||||
'id' => 'rainloop_index',
|
||||
'order' => 20,
|
||||
'order' => 10,
|
||||
'href' => OCP\Util::linkTo('rainloop', 'index.php'),
|
||||
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
||||
'name' => 'RainLoop'
|
||||
));
|
||||
|
||||
if(OC_User::isAdminUser(OCP\User::getUser()))
|
||||
{
|
||||
OCP\App::addNavigationEntry(array(
|
||||
'id' => 'rainloop_index_admin',
|
||||
'order' => 21,
|
||||
'href' => OCP\Util::linkTo('rainloop', 'index-admin.php'),
|
||||
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
||||
'name' => 'RainLoop (Admin)'
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<id>rainloop</id>
|
||||
<name>RainLoop</name>
|
||||
<description>RainLoop Webmail</description>
|
||||
<version>0.0.0</version>
|
||||
<version>1.2</version>
|
||||
<licence>CC BY-NC-SA 3.0</licence>
|
||||
<author>RainLoop Team</author>
|
||||
<require>6.0</require>
|
||||
|
|
|
|||
|
|
@ -13,24 +13,29 @@ OCP\User::checkLoggedIn();
|
|||
OCP\App::checkAppEnabled('rainloop');
|
||||
OCP\App::setActiveNavigationEntry('rainloop_index');
|
||||
|
||||
$sUser = OCP\User::getUser();
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sSsoKey = trim(OCP\Config::getAppValue('rainloop', 'rainloop-sso-key', ''));
|
||||
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
$sLogin = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', '');
|
||||
$sPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
if ('' === $sUrl || '' === $sSsoKey)
|
||||
{
|
||||
$oTemplate = new OCP\Template('rainloop', 'index-empty', 'user');
|
||||
}
|
||||
else
|
||||
{
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
||||
include OC_App::getAppPath('rainloop').'/app/index.php';
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
$sLogin = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', '');
|
||||
$sPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
|
||||
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
|
||||
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
|
||||
$sPassword = OC_RainLoop_Helper::decodePassword($sPassword, md5($sEmail.$sLogin));
|
||||
$sSsoHash = OC_RainLoop_Helper::getSsoHash($sUrl, $sSsoKey, $sEmail, $sPassword, $sLogin);
|
||||
|
||||
$sPassword = OC_RainLoop_Helper::decodePassword($sPassword, md5($sEmail.$sLogin));
|
||||
$sSsoHash = \RainLoop\Api::GetUserSsoHash($sEmail, $sPassword, $sLogin);
|
||||
$sResultUrl = empty($sSsoHash) ? $sUrl.'?sso' : $sUrl.'?sso&hash='.$sSsoHash;
|
||||
|
||||
$sUrl = OCP\Util::linkTo('apps/rainloop/app', 'index.php');
|
||||
$sResultUrl = empty($sSsoHash) ? $sUrl.'?sso' : $sUrl.'?sso&hash='.$sSsoHash;
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'iframe', 'user');
|
||||
$oTemplate->assign('rainloop-url', $sResultUrl);
|
||||
$oTemplate = new OCP\Template('rainloop', 'index', 'user');
|
||||
$oTemplate->assign('rainloop-url', $sResultUrl);
|
||||
}
|
||||
|
||||
$oTemplate->printpage();
|
||||
|
|
|
|||
13
build/owncloud/rainloop-app/js/admin.js
Normal file
13
build/owncloud/rainloop-app/js/admin.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
RainLoopFormHelper('#mail-rainloop-admin-form', 'admin.php');
|
||||
});
|
||||
|
|
@ -2,6 +2,40 @@
|
|||
|
||||
class OC_RainLoop_Helper
|
||||
{
|
||||
public static function getSsoHash($sUrl, $sSsoKey, $sEmail, $sPassword, $sLogin = '')
|
||||
{
|
||||
if (!function_exists('curl_init'))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$oCurl = curl_init();
|
||||
curl_setopt_array($oCurl, array(
|
||||
CURLOPT_URL => $sUrl.'?ExternalSso',
|
||||
CURLOPT_HEADER => false,
|
||||
CURLOPT_FAILONERROR => true,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_USERAGENT => 'RainLoop SSO User Agent (ownCloud)',
|
||||
CURLOPT_POSTFIELDS => http_build_query(array(
|
||||
'SsoKey' => $sSsoKey,
|
||||
'Email' => $sEmail,
|
||||
'Password' => $sPassword,
|
||||
'Login' => $sLogin
|
||||
), '', '&'),
|
||||
CURLOPT_TIMEOUT => 5
|
||||
));
|
||||
|
||||
$mResult = curl_exec($oCurl);
|
||||
if (is_resource($oCurl))
|
||||
{
|
||||
curl_close($oCurl);
|
||||
}
|
||||
|
||||
return is_string($mResult) ? $mResult : '';
|
||||
}
|
||||
|
||||
public static function encodePassword($sPassword, $sSalt)
|
||||
{
|
||||
if (function_exists('mcrypt_encrypt') && function_exists('mcrypt_create_iv') && function_exists('mcrypt_get_iv_size') &&
|
||||
|
|
|
|||
|
|
@ -14,16 +14,26 @@ OCP\App::checkAppEnabled('rainloop');
|
|||
|
||||
OCP\Util::addScript('rainloop', 'personal');
|
||||
|
||||
$sUser = OCP\User::getUser();
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sSsoKey = trim(OCP\Config::getAppValue('rainloop', 'rainloop-sso-key', ''));
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'personal');
|
||||
if ('' === $sUrl || '' === $sSsoKey)
|
||||
{
|
||||
$oTemplate = new OCP\Template('rainloop', 'empty');
|
||||
}
|
||||
else
|
||||
{
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
$oTemplate = new OCP\Template('rainloop', 'personal');
|
||||
|
||||
$oTemplate->assign('rainloop-email', $sEmail);
|
||||
$oTemplate->assign('rainloop-login', OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', ''));
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
|
||||
$sPass = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
$oTemplate->assign('rainloop-password', 0 === strlen($sPass) && 0 === strlen($sEmail) ? '' : '******');
|
||||
$oTemplate->assign('rainloop-email', $sEmail);
|
||||
$oTemplate->assign('rainloop-login', OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', ''));
|
||||
|
||||
$sPass = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
$oTemplate->assign('rainloop-password', 0 === strlen($sPass) && 0 === strlen($sEmail) ? '' : '******');
|
||||
}
|
||||
|
||||
return $oTemplate->fetchPage();
|
||||
|
|
|
|||
23
build/owncloud/rainloop-app/templates/admin.php
Normal file
23
build/owncloud/rainloop-app/templates/admin.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<form id="mail-rainloop-admin-form" action="#" method="post">
|
||||
<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
|
||||
<input type="hidden" name="appname" value="rainloop">
|
||||
|
||||
<fieldset class="personalblock">
|
||||
<h2><?php p($l->t('RainLoop Webmail')); ?></h2>
|
||||
<br />
|
||||
<p>
|
||||
<?php p($l->t('RainLoop Webmail URL')); ?>:
|
||||
<br />
|
||||
<input type="text" style="width:300px;" id="rainloop-url" name="rainloop-url" value="<?php echo $_['rainloop-url']; ?>" placeholder="https://" />
|
||||
<br />
|
||||
<br />
|
||||
<?php p($l->t('SSO key')); ?>:
|
||||
<br />
|
||||
<input type="text" style="width:300px;" id="rainloop-url" name="rainloop-sso-key" value="<?php echo $_['rainloop-sso-key']; ?>" />
|
||||
<br />
|
||||
<br />
|
||||
<input type="button" id="rainloop-save-button" name="rainloop-save-button" value="<?php p($l->t('Save')); ?>" />
|
||||
<span class="rainloop-result-desc"></span>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
3
build/owncloud/rainloop-app/templates/index-empty.php
Normal file
3
build/owncloud/rainloop-app/templates/index-empty.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div style="margin: 20px">
|
||||
<?php p($l->t('RainLoop Webmail is not configured yet.')); ?>
|
||||
</div>
|
||||
3
build/owncloud/rainloop-app/templates/index.php
Normal file
3
build/owncloud/rainloop-app/templates/index.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div style="box-sizing: border-box; width: 100%; height: 100%; padding: 0px; margin: 0px; background-color: #383c43; position: relative; overflow: hidden;"
|
||||
><iframe style="border: none; width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px;" tabindex="-1" frameborder="0"
|
||||
src="<?php echo $_['rainloop-url']; ?>"></iframe></div>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<input type="hidden" name="appname" value="rainloop">
|
||||
|
||||
<fieldset class="personalblock">
|
||||
<h2><?php p($l->t('RainLoop Webmail (autologin)')); ?></h2>
|
||||
<h2><?php p($l->t('RainLoop Webmail')); ?></h2>
|
||||
<p>
|
||||
<input type="text" id="rainloop-email" name="rainloop-email"
|
||||
value="<?php echo $_['rainloop-email']; ?>" placeholder="<?php p($l->t('Email')); ?>" />
|
||||
|
|
|
|||
19
build/owncloud/rainloop-app_/INSTALL
Normal file
19
build/owncloud/rainloop-app_/INSTALL
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
************************************************************************
|
||||
*
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/
|
||||
*
|
||||
************************************************************************
|
||||
|
||||
INSTALL:
|
||||
- Unpack the RainLoop Webmail application package in the apps directory of your OwnCloud instance
|
||||
|
||||
CONFIGURATION:
|
||||
|
||||
1) In the Apps > Enable 'RainLoop' plugin
|
||||
2) In the Settings > Personal > Type your mail server email(login) and password (for autologin)
|
||||
3) Enjoy!
|
||||
46
build/owncloud/rainloop-app_/ajax/personal.php
Normal file
46
build/owncloud/rainloop-app_/ajax/personal.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('rainloop');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$sEmail = '';
|
||||
$sLogin = '';
|
||||
if (isset($_POST['appname'], $_POST['rainloop-password'], $_POST['rainloop-email']) && 'rainloop' === $_POST['appname'])
|
||||
{
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
$sPostEmail = $_POST['rainloop-email'];
|
||||
$sPostLogin = isset($_POST['rainloop-login']) ? $_POST['rainloop-login'] : '';
|
||||
|
||||
OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-email', $sPostEmail);
|
||||
OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-login', $sPostLogin);
|
||||
|
||||
$sPass = $_POST['rainloop-password'];
|
||||
if ('******' !== $sPass && '' !== $sPass)
|
||||
{
|
||||
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
|
||||
OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password',
|
||||
OC_RainLoop_Helper::encodePassword($sPass, md5($sPostEmail.$sPostLogin)));
|
||||
}
|
||||
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
$sLogin = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
OC_JSON::error(array('Message' => 'Invalid argument(s)', 'Email' => $sEmail, 'Login' => $sLogin));
|
||||
return false;
|
||||
}
|
||||
|
||||
OCP\JSON::success(array('Message' => 'Saved successfully', 'Email' => $sEmail, 'Login' => $sLogin));
|
||||
return true;
|
||||
33
build/owncloud/rainloop-app_/appinfo/app.php
Normal file
33
build/owncloud/rainloop-app_/appinfo/app.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/owncloud
|
||||
*/
|
||||
|
||||
OCP\App::registerPersonal('rainloop', 'personal');
|
||||
|
||||
OCP\Util::addScript('rainloop', 'rainloop');
|
||||
|
||||
OCP\App::addNavigationEntry(array(
|
||||
'id' => 'rainloop_index',
|
||||
'order' => 20,
|
||||
'href' => OCP\Util::linkTo('rainloop', 'index.php'),
|
||||
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
||||
'name' => 'RainLoop'
|
||||
));
|
||||
|
||||
if(OC_User::isAdminUser(OCP\User::getUser()))
|
||||
{
|
||||
OCP\App::addNavigationEntry(array(
|
||||
'id' => 'rainloop_index_admin',
|
||||
'order' => 21,
|
||||
'href' => OCP\Util::linkTo('rainloop', 'index-admin.php'),
|
||||
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
||||
'name' => 'RainLoop (Admin)'
|
||||
));
|
||||
}
|
||||
10
build/owncloud/rainloop-app_/appinfo/info.xml
Normal file
10
build/owncloud/rainloop-app_/appinfo/info.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>rainloop</id>
|
||||
<name>RainLoop</name>
|
||||
<description>RainLoop Webmail</description>
|
||||
<version>0.0.0</version>
|
||||
<licence>CC BY-NC-SA 3.0</licence>
|
||||
<author>RainLoop Team</author>
|
||||
<require>6.0</require>
|
||||
</info>
|
||||
BIN
build/owncloud/rainloop-app_/img/logo-64x64.png
Normal file
BIN
build/owncloud/rainloop-app_/img/logo-64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 832 B |
BIN
build/owncloud/rainloop-app_/img/mail.png
Normal file
BIN
build/owncloud/rainloop-app_/img/mail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
36
build/owncloud/rainloop-app_/index.php
Normal file
36
build/owncloud/rainloop-app_/index.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\User::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('rainloop');
|
||||
OCP\App::setActiveNavigationEntry('rainloop_index');
|
||||
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
$sLogin = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', '');
|
||||
$sPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
|
||||
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
||||
include OC_App::getAppPath('rainloop').'/app/index.php';
|
||||
|
||||
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
|
||||
|
||||
$sPassword = OC_RainLoop_Helper::decodePassword($sPassword, md5($sEmail.$sLogin));
|
||||
$sSsoHash = \RainLoop\Api::GetUserSsoHash($sEmail, $sPassword, $sLogin);
|
||||
|
||||
$sUrl = OCP\Util::linkTo('apps/rainloop/app', 'index.php');
|
||||
$sResultUrl = empty($sSsoHash) ? $sUrl.'?sso' : $sUrl.'?sso&hash='.$sSsoHash;
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'iframe', 'user');
|
||||
$oTemplate->assign('rainloop-url', $sResultUrl);
|
||||
|
||||
$oTemplate->printpage();
|
||||
13
build/owncloud/rainloop-app_/js/personal.js
Normal file
13
build/owncloud/rainloop-app_/js/personal.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
RainLoopFormHelper('#mail-rainloop-personal-form', 'personal.php');
|
||||
});
|
||||
76
build/owncloud/rainloop-app_/js/rainloop.js
Normal file
76
build/owncloud/rainloop-app_/js/rainloop.js
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
|
||||
function RainLoopFormHelper(sID, sAjaxFile, fCallback)
|
||||
{
|
||||
try
|
||||
{
|
||||
var
|
||||
oForm = $(sID),
|
||||
oSubmit = $('#rainloop-save-button', oForm),
|
||||
sSubmitValue = oSubmit.val(),
|
||||
oDesc = oForm.find('.rainloop-result-desc')
|
||||
;
|
||||
|
||||
oSubmit.click(function (oEvent) {
|
||||
|
||||
var oDefAjax = null;
|
||||
|
||||
oEvent.preventDefault();
|
||||
|
||||
oForm
|
||||
.addClass('rainloop-ajax')
|
||||
.removeClass('rainloop-error')
|
||||
.removeClass('rainloop-success')
|
||||
;
|
||||
|
||||
oDesc.text('');
|
||||
oSubmit.val('...');
|
||||
|
||||
oDefAjax = $.ajax({
|
||||
'type': 'POST',
|
||||
'async': true,
|
||||
'url': OC.filePath('rainloop', 'ajax', sAjaxFile),
|
||||
'data': oForm.serialize(),
|
||||
'dataType': 'json',
|
||||
'global': true
|
||||
});
|
||||
|
||||
oDefAjax.always(function (oData) {
|
||||
|
||||
var bResult = false;
|
||||
|
||||
oForm.removeClass('rainloop-ajax');
|
||||
oSubmit.val(sSubmitValue);
|
||||
|
||||
if (oData)
|
||||
{
|
||||
bResult = 'success' === oData['status'];
|
||||
if (oData['Message'])
|
||||
{
|
||||
oDesc.text(oData['Message']);
|
||||
}
|
||||
}
|
||||
|
||||
if (bResult)
|
||||
{
|
||||
oForm.addClass('rainloop-success');
|
||||
}
|
||||
else
|
||||
{
|
||||
oForm.addClass('rainloop-error');
|
||||
if ('' === oDesc.text())
|
||||
{
|
||||
oDesc.text('Error');
|
||||
}
|
||||
}
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback(bResult, oData);
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
catch(e) {}
|
||||
}
|
||||
28
build/owncloud/rainloop-app_/lib/RainLoopHelper.php
Normal file
28
build/owncloud/rainloop-app_/lib/RainLoopHelper.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
class OC_RainLoop_Helper
|
||||
{
|
||||
public static function encodePassword($sPassword, $sSalt)
|
||||
{
|
||||
if (function_exists('mcrypt_encrypt') && function_exists('mcrypt_create_iv') && function_exists('mcrypt_get_iv_size') &&
|
||||
defined('MCRYPT_RIJNDAEL_256') && defined('MCRYPT_MODE_ECB') && defined('MCRYPT_RAND'))
|
||||
{
|
||||
return @trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($sSalt), $sPassword,
|
||||
MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
|
||||
}
|
||||
|
||||
return @trim(base64_encode($sPassword));
|
||||
}
|
||||
|
||||
public static function decodePassword($sPassword, $sSalt)
|
||||
{
|
||||
if (function_exists('mcrypt_encrypt') && function_exists('mcrypt_create_iv') && function_exists('mcrypt_get_iv_size') &&
|
||||
defined('MCRYPT_RIJNDAEL_256') && defined('MCRYPT_MODE_ECB') && defined('MCRYPT_RAND'))
|
||||
{
|
||||
return @mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($sSalt), base64_decode(trim($sPassword)),
|
||||
MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND));
|
||||
}
|
||||
|
||||
return @base64_decode(trim($sPassword));
|
||||
}
|
||||
}
|
||||
29
build/owncloud/rainloop-app_/personal.php
Normal file
29
build/owncloud/rainloop-app_/personal.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\User::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('rainloop');
|
||||
|
||||
OCP\Util::addScript('rainloop', 'personal');
|
||||
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'personal');
|
||||
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
|
||||
$oTemplate->assign('rainloop-email', $sEmail);
|
||||
$oTemplate->assign('rainloop-login', OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', ''));
|
||||
|
||||
$sPass = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
$oTemplate->assign('rainloop-password', 0 === strlen($sPass) && 0 === strlen($sEmail) ? '' : '******');
|
||||
|
||||
return $oTemplate->fetchPage();
|
||||
1
build/owncloud/rainloop-app_/templates/empty.php
Normal file
1
build/owncloud/rainloop-app_/templates/empty.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
<!-- empty -->
|
||||
21
build/owncloud/rainloop-app_/templates/personal.php
Normal file
21
build/owncloud/rainloop-app_/templates/personal.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<form id="mail-rainloop-personal-form" action="#" method="post">
|
||||
<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
|
||||
<input type="hidden" name="appname" value="rainloop">
|
||||
|
||||
<fieldset class="personalblock">
|
||||
<h2><?php p($l->t('RainLoop Webmail (autologin)')); ?></h2>
|
||||
<p>
|
||||
<input type="text" id="rainloop-email" name="rainloop-email"
|
||||
value="<?php echo $_['rainloop-email']; ?>" placeholder="<?php p($l->t('Email')); ?>" />
|
||||
|
||||
<input type="text" id="rainloop-email" name="rainloop-login"
|
||||
value="<?php echo $_['rainloop-login']; ?>" placeholder="<?php p($l->t('Login (optional)')); ?>" />
|
||||
|
||||
<input type="password" id="rainloop-password" name="rainloop-password"
|
||||
value="<?php echo $_['rainloop-password']; ?>" placeholder="<?php p($l->t('Password')); ?>" />
|
||||
|
||||
<input type="button" id="rainloop-save-button" name="rainloop-save-button" value="<?php p($l->t('Save')); ?>" />
|
||||
<span class="rainloop-result-desc"></span>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "RainLoop",
|
||||
"title": "RainLoop Webmail",
|
||||
"version": "1.6.7",
|
||||
"release": "122",
|
||||
"release": "124",
|
||||
"description": "Simple, modern & fast web-based email client",
|
||||
"homepage": "http://rainloop.net",
|
||||
"main": "Gruntfile.js",
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
"plugins"
|
||||
],
|
||||
"readmeFilename": "README.md",
|
||||
"ownCloudPackageVersion": "1.3",
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1970,7 +1970,7 @@ class Utils
|
|||
static $oIdn = null;
|
||||
if (null === $oIdn)
|
||||
{
|
||||
include_once MAILSO_LIBRARY_ROOT_PATH.'Vendors/NET/IDNA2.php';
|
||||
include_once MAILSO_LIBRARY_ROOT_PATH.'Vendors/Net/IDNA2.php';
|
||||
$oIdn = new \Net_IDNA2();
|
||||
}
|
||||
|
||||
|
|
@ -1978,37 +1978,44 @@ class Utils
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $sDomain
|
||||
* @param string $sStr
|
||||
* @param bool $bLowerIfAscii = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function IdnToUtf8($sDomain, $bLowerIfAscii = false)
|
||||
public static function IdnToUtf8($sStr, $bLowerIfAscii = false)
|
||||
{
|
||||
if ($sDomain && \preg_match('/(^|\.)xn--/i', $sDomain))
|
||||
if (0 < \strlen($sStr) && \preg_match('/(^|\.)xn--/i', $sStr))
|
||||
{
|
||||
try
|
||||
{
|
||||
$sDomain = self::idn()->decode($sDomain);
|
||||
$sStr = self::idn()->decode($sStr);
|
||||
}
|
||||
catch (\Exception $oException) {}
|
||||
}
|
||||
|
||||
$sDomain = $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sDomain) : $sDomain;
|
||||
return $sDomain;
|
||||
return $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sStr) : $sStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDomain
|
||||
* @param string $sStr
|
||||
* @param bool $bLowerIfAscii = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function IdnToAscii($sDomain, $bLowerIfAscii = false)
|
||||
public static function IdnToAscii($sStr, $bLowerIfAscii = false)
|
||||
{
|
||||
$sDomain = $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sDomain) : $sDomain;
|
||||
$sStr = $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sStr) : $sStr;
|
||||
|
||||
if ($sDomain && \preg_match('/[^\x20-\x7E]/', $sDomain))
|
||||
$sUser = '';
|
||||
$sDomain = $sStr;
|
||||
if (false !== \strpos($sStr, '@'))
|
||||
{
|
||||
$sUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sStr);
|
||||
$sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sStr);
|
||||
}
|
||||
|
||||
if (0 < \strlen($sDomain) && \preg_match('/[^\x20-\x7E]/', $sDomain))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -2017,6 +2024,6 @@ class Utils
|
|||
catch (\Exception $oException) {}
|
||||
}
|
||||
|
||||
return $sDomain;
|
||||
return ('' === $sUser ? '' : $sUser.'@').$sDomain;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param string $sFrom
|
||||
* @param string $sSize = ''
|
||||
* @param string $sSizeIfSupported = ''
|
||||
*
|
||||
* @return \MailSo\Smtp\SmtpClient
|
||||
*
|
||||
|
|
|
|||
|
|
@ -986,7 +986,6 @@ class Actions
|
|||
$aResult = array(
|
||||
'Version' => APP_VERSION,
|
||||
'IndexFile' => APP_INDEX_FILE,
|
||||
'OwnCloud' => APP_OWNCLOUD,
|
||||
'Auth' => false,
|
||||
'AccountHash' => '',
|
||||
'AccountSignMe' => false,
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
define('APP_INDEX_FILE', 'index.php');
|
||||
define('APP_VERSION_ROOT_PATH', APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/');
|
||||
|
||||
define('APP_OWNCLOUD', @file_exists(APP_INDEX_ROOT_PATH.'OWNCLOUD'));
|
||||
|
||||
$sCustomDataPath = '';
|
||||
if (file_exists(APP_INDEX_ROOT_PATH.'include.php'))
|
||||
{
|
||||
|
|
@ -24,11 +22,6 @@
|
|||
$sCustomDataPath = function_exists('__get_custom_data_full_path') ? rtrim(trim(__get_custom_data_full_path()), '\\/') : '';
|
||||
}
|
||||
|
||||
if (APP_OWNCLOUD && 0 === strlen($sCustomDataPath))
|
||||
{
|
||||
$sCustomDataPath = APP_INDEX_ROOT_PATH.'../../../data/_rainloop-webmail-data_/';
|
||||
}
|
||||
|
||||
define('APP_DATA_FOLDER_PATH', 0 === strlen($sCustomDataPath) ? APP_INDEX_ROOT_PATH.'data/' : $sCustomDataPath.'/');
|
||||
unset($sCustomDataPath);
|
||||
|
||||
|
|
|
|||
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
10
rainloop/v/0.0.0/static/js/app.min.js
vendored
10
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue