mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 15:07:02 +03:00
Suggestion Provider
OwnCloud Suggestion Driver
This commit is contained in:
parent
d30292d500
commit
000711086a
15 changed files with 194 additions and 190 deletions
|
|
@ -13,20 +13,7 @@ OCP\User::checkAdminUser();
|
|||
|
||||
OCP\Util::addScript('rainloop', 'admin');
|
||||
|
||||
$bInstalledLocaly = file_exists(__DIR__.'/app/index.php');
|
||||
if ($bInstalledLocaly)
|
||||
{
|
||||
$oTemplate = new OCP\Template('rainloop', 'admin-local');
|
||||
$oTemplate->assign('rainloop-admin-panel-link',
|
||||
OC_RainLoop_Helper::getAppUrl().'?admin');
|
||||
}
|
||||
else
|
||||
{
|
||||
$oTemplate = new OCP\Template('rainloop', 'admin');
|
||||
$oTemplate->assign('rainloop-admin-panel-link', '');
|
||||
$oTemplate->assign('rainloop-url', OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$oTemplate->assign('rainloop-path', OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
}
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'admin-local');
|
||||
$oTemplate->assign('rainloop-admin-panel-link', OC_RainLoop_Helper::getAppUrl().'?admin');
|
||||
$oTemplate->assign('rainloop-autologin', OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false));
|
||||
return $oTemplate->fetchPage();
|
||||
|
|
|
|||
|
|
@ -17,32 +17,20 @@ $sUrl = '';
|
|||
$sPath = '';
|
||||
$bAutologin = false;
|
||||
|
||||
$bInstalledLocaly = file_exists(__DIR__.'/../app/index.php');
|
||||
|
||||
if (isset($_POST['appname']) && 'rainloop' === $_POST['appname'] &&
|
||||
($bInstalledLocaly ? true : isset($_POST['rainloop-url'], $_POST['rainloop-path'])))
|
||||
if (isset($_POST['appname']) && 'rainloop' === $_POST['appname'])
|
||||
{
|
||||
OCP\Config::setAppValue('rainloop', 'rainloop-autologin', isset($_POST['rainloop-autologin']) ?
|
||||
'1' === $_POST['rainloop-autologin'] : false);
|
||||
|
||||
if (!$bInstalledLocaly)
|
||||
{
|
||||
OCP\Config::setAppValue('rainloop', 'rainloop-url', $_POST['rainloop-url']);
|
||||
OCP\Config::setAppValue('rainloop', 'rainloop-path', $_POST['rainloop-path']);
|
||||
|
||||
$sUrl = OCP\Config::getAppValue('rainloop', 'rainloop-url', '');
|
||||
$sPath = OCP\Config::getAppValue('rainloop', 'rainloop-path', '');
|
||||
}
|
||||
|
||||
$bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
sleep(1);
|
||||
OC_JSON::error(array('Message' => 'Invalid Argument(s)', 'Url' => $sUrl, 'Path' => $sPath));
|
||||
OC_JSON::error(array('Message' => 'Invalid Argument(s)'));
|
||||
return false;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
OCP\JSON::success(array('Message' => 'Saved successfully', 'Url' => $sUrl, 'Path' => $sPath));
|
||||
OCP\JSON::success(array('Message' => 'Saved successfully'));
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ if (@file_exists(__DIR__.'/app/index.php'))
|
|||
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
if ($bAutologin)
|
||||
if (OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false))
|
||||
{
|
||||
$sEmail = $sUser;
|
||||
$sEncodedPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-autologin-password', '');
|
||||
|
|
|
|||
|
|
@ -21,18 +21,13 @@ if (OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false))
|
|||
OCP\Util::connectHook('OC_User', 'post_setPassword', 'OC_RainLoop_Helper', 'changePassword');
|
||||
}
|
||||
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
OCP\Util::addScript('rainloop', 'rainloop');
|
||||
|
||||
if (('' !== $sUrl && '' !== $sPath) || OC_User::isAdminUser(OC_User::getUser()))
|
||||
{
|
||||
OCP\Util::addScript('rainloop', 'rainloop');
|
||||
OCP\App::addNavigationEntry(array(
|
||||
'id' => 'rainloop_index',
|
||||
'order' => 10,
|
||||
'href' => OCP\Util::linkToRoute('rainloop_index'),
|
||||
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
||||
'name' => 'Email'
|
||||
));
|
||||
|
||||
OCP\App::addNavigationEntry(array(
|
||||
'id' => 'rainloop_index',
|
||||
'order' => 10,
|
||||
'href' => OCP\Util::linkTo('rainloop', 'index.php'),
|
||||
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
||||
'name' => 'Email'
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,57 +15,9 @@ OCP\App::setActiveNavigationEntry('rainloop_index');
|
|||
|
||||
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
|
||||
|
||||
$sUrl = '';
|
||||
$sPath = '';
|
||||
$sUrl = OC_RainLoop_Helper::normalizeUrl(OC_RainLoop_Helper::getAppUrl());
|
||||
|
||||
$bInstalledLocaly = file_exists(__DIR__.'/app/index.php');
|
||||
if ($bInstalledLocaly)
|
||||
{
|
||||
$sUrl = OC_RainLoop_Helper::getAppUrl();
|
||||
$sPath = __DIR__.'/app/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
}
|
||||
|
||||
$bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
|
||||
|
||||
if ('' === $sUrl || '' === $sPath)
|
||||
{
|
||||
$oTemplate = new OCP\Template('rainloop', 'index-empty', 'user');
|
||||
}
|
||||
else
|
||||
{
|
||||
$sUrl = OC_RainLoop_Helper::normalizeUrl($sUrl);
|
||||
if ($bInstalledLocaly)
|
||||
{
|
||||
$sResultUrl = $sUrl.'?OwnCloudAuth';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
if ($bAutologin)
|
||||
{
|
||||
$sEmail = $sUser;
|
||||
$sEncodedPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-autologin-password', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
$sEncodedPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
}
|
||||
|
||||
$sDecodedPassword = OC_RainLoop_Helper::decodePassword($sEncodedPassword, md5($sEmail));
|
||||
|
||||
$sSsoHash = OC_RainLoop_Helper::getSsoHash($sPath, $sEmail, $sDecodedPassword);
|
||||
$sResultUrl = empty($sSsoHash) ? $sUrl.'?sso' : $sUrl.'?sso&hash='.$sSsoHash;
|
||||
}
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'index', 'user');
|
||||
$oTemplate->assign('rainloop-url', $sResultUrl);
|
||||
}
|
||||
$oTemplate = new OCP\Template('rainloop', 'index', 'user');
|
||||
$oTemplate->assign('rainloop-iframe-url', OC_RainLoop_Helper::normalizeUrl($sUrl).'?OwnCloudAuth');
|
||||
|
||||
$oTemplate->printpage();
|
||||
|
|
|
|||
|
|
@ -7,13 +7,9 @@ class OC_RainLoop_Helper
|
|||
*/
|
||||
public static function getAppUrl()
|
||||
{
|
||||
if (class_exists('\\OC\\URLGenerator') && isset(\OC::$server))
|
||||
if (class_exists('\\OCP\\Util'))
|
||||
{
|
||||
$oUrlGenerator = new \OC\URLGenerator(\OC::$server->getConfig());
|
||||
if ($oUrlGenerator)
|
||||
{
|
||||
return $oUrlGenerator->linkToRoute('rainloop_app');
|
||||
}
|
||||
return OCP\Util::linkToRoute('rainloop_app');
|
||||
}
|
||||
|
||||
$sRequestUri = empty($_SERVER['REQUEST_URI']) ? '': trim($_SERVER['REQUEST_URI']);
|
||||
|
|
@ -105,14 +101,8 @@ class OC_RainLoop_Helper
|
|||
$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 OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-autologin-password',
|
||||
self::encodePassword($sPassword, md5($sEmail)));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -133,16 +123,15 @@ class OC_RainLoop_Helper
|
|||
$sEmail = $sUser;
|
||||
$sPassword = $aParams['password'];
|
||||
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
OCP\Util::writeLog('rainloop', 'rainloop|login: Setting new RainLoop password for '.$sEmail, OCP\Util::DEBUG);
|
||||
|
||||
if ('' !== $sUrl && '' !== $sPath)
|
||||
{
|
||||
OCP\Util::writeLog('rainloop', 'rainloop|login: Setting new RainLoop password for '.$sEmail, OCP\Util::DEBUG);
|
||||
OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-autologin-password',
|
||||
self::encodePassword($sPassword, md5($sEmail)));
|
||||
|
||||
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
||||
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', $sPassword);
|
||||
}
|
||||
OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password',
|
||||
self::encodePassword($sPassword, md5($sEmail)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -14,19 +14,7 @@ OCP\App::checkAppEnabled('rainloop');
|
|||
|
||||
OCP\Util::addScript('rainloop', 'personal');
|
||||
|
||||
$sUrl = '';
|
||||
$sPath = '';
|
||||
|
||||
$bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
|
||||
|
||||
$bInstalledLocaly = file_exists(__DIR__.'/app/index.php');
|
||||
if (!$bInstalledLocaly)
|
||||
{
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
}
|
||||
|
||||
if ($bAutologin || (!$bInstalledLocaly && ('' === $sUrl || '' === $sPath)))
|
||||
if (OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false))
|
||||
{
|
||||
$oTemplate = new OCP\Template('rainloop', 'empty');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
<div class="section">
|
||||
<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('Absolute (full) path to RainLoop Webmail installation')); ?>:
|
||||
<br />
|
||||
<input type="text" style="width:300px;" id="rainloop-path" name="rainloop-path" value="<?php echo $_['rainloop-path']; ?>" />
|
||||
<br />
|
||||
<br />
|
||||
<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 />
|
||||
<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>
|
||||
</div>
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
<div style="box-sizing: border-box; width: 100%; height: 100%; padding: 0px; margin: 0px; background-color: #383c43; position: relative; overflow: hidden;"
|
||||
><iframe id="rliframe" 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><?php OCP\Util::addScript('rainloop', 'resize');
|
||||
<div style="box-sizing: border-box; width: 100%; height: 100%; padding: 0px; margin: 0px; background-color: #383c43; position: relative; overflow: hidden;"
|
||||
><iframe id="rliframe" 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-iframe-url']; ?>"></iframe></div><?php OCP\Util::addScript('rainloop', 'resize');
|
||||
Loading…
Add table
Add a link
Reference in a new issue