diff --git a/build/owncloud/rainloop-app/admin.php b/build/owncloud/rainloop-app/admin.php index 3fc6a67bd..3f7a6bf3f 100644 --- a/build/owncloud/rainloop-app/admin.php +++ b/build/owncloud/rainloop-app/admin.php @@ -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(); diff --git a/build/owncloud/rainloop-app/ajax/admin.php b/build/owncloud/rainloop-app/ajax/admin.php index 8c935d93e..29fe17eab 100644 --- a/build/owncloud/rainloop-app/ajax/admin.php +++ b/build/owncloud/rainloop-app/ajax/admin.php @@ -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; diff --git a/build/owncloud/rainloop-app/app.php b/build/owncloud/rainloop-app/app.php index 9fe0f27f8..802dc1a68 100644 --- a/build/owncloud/rainloop-app/app.php +++ b/build/owncloud/rainloop-app/app.php @@ -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', ''); diff --git a/build/owncloud/rainloop-app/appinfo/app.php b/build/owncloud/rainloop-app/appinfo/app.php index b3d808b56..48dc5ab3d 100644 --- a/build/owncloud/rainloop-app/appinfo/app.php +++ b/build/owncloud/rainloop-app/appinfo/app.php @@ -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' - )); -} diff --git a/build/owncloud/rainloop-app/index.php b/build/owncloud/rainloop-app/index.php index 9de5e2c4a..30bbb4f5d 100644 --- a/build/owncloud/rainloop-app/index.php +++ b/build/owncloud/rainloop-app/index.php @@ -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(); diff --git a/build/owncloud/rainloop-app/lib/RainLoopHelper.php b/build/owncloud/rainloop-app/lib/RainLoopHelper.php index c3d1ec1cd..78bdee728 100644 --- a/build/owncloud/rainloop-app/lib/RainLoopHelper.php +++ b/build/owncloud/rainloop-app/lib/RainLoopHelper.php @@ -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; diff --git a/build/owncloud/rainloop-app/personal.php b/build/owncloud/rainloop-app/personal.php index 0499d520e..92b1ee659 100644 --- a/build/owncloud/rainloop-app/personal.php +++ b/build/owncloud/rainloop-app/personal.php @@ -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'); } diff --git a/build/owncloud/rainloop-app/templates/admin.php b/build/owncloud/rainloop-app/templates/admin.php deleted file mode 100644 index d2dca468c..000000000 --- a/build/owncloud/rainloop-app/templates/admin.php +++ /dev/null @@ -1,31 +0,0 @@ -