2014-07-16 02:45:15 +08:00
|
|
|
<?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');
|
|
|
|
|
|
|
|
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
2014-07-26 00:05:20 +08:00
|
|
|
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
2014-07-16 02:45:15 +08:00
|
|
|
|
2014-07-26 00:05:20 +08:00
|
|
|
if ('' === $sUrl || '' === $sPath)
|
2014-07-16 02:45:15 +08:00
|
|
|
{
|
|
|
|
$oTemplate = new OCP\Template('rainloop', 'index-empty', 'user');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OC_Config::setValue('xframe_restriction', false);
|
|
|
|
|
|
|
|
$sUser = OCP\User::getUser();
|
|
|
|
|
|
|
|
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
|
|
|
$sPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
|
|
|
|
2014-07-18 21:59:54 +08:00
|
|
|
|
2014-07-16 02:45:15 +08:00
|
|
|
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
|
2014-07-26 00:05:20 +08:00
|
|
|
$sPassword = OC_RainLoop_Helper::decodePassword($sPassword, md5($sEmail));
|
|
|
|
$sSsoHash = OC_RainLoop_Helper::getSsoHash($sPath, $sEmail, $sPassword);
|
2014-07-16 02:45:15 +08:00
|
|
|
|
2014-07-26 00:05:20 +08:00
|
|
|
$sUrl = OC_RainLoop_Helper::normalizeUrl($sUrl);
|
2014-07-16 02:45:15 +08:00
|
|
|
$sResultUrl = empty($sSsoHash) ? $sUrl.'?sso' : $sUrl.'?sso&hash='.$sSsoHash;
|
|
|
|
|
|
|
|
$oTemplate = new OCP\Template('rainloop', 'index', 'user');
|
|
|
|
$oTemplate->assign('rainloop-url', $sResultUrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
$oTemplate->printpage();
|