ownCloud integration improvements

This commit is contained in:
RainLoop Team 2015-02-12 04:48:11 +04:00
parent c0d016293d
commit d30292d500
9 changed files with 170 additions and 59 deletions

View file

@ -307,6 +307,57 @@ class Utils
@\setcookie($sName, '', \time() - 3600 * 24 * 30, '/');
}
/**
* @return bool
*/
public static function IsOwnCloud()
{
return isset($_ENV['RAINLOOP_OWNCLOUD']) && $_ENV['RAINLOOP_OWNCLOUD'] &&
\class_exists('\\OC');
}
/**
* @return string
*/
public static function WebPath()
{
$sAppPath = '';
if (\RainLoop\Utils::IsOwnCloud())
{
if (\class_exists('\\OC_App'))
{
$sAppPath = \rtrim(\trim(\OC_App::getAppWebPath('rainloop')), '\\/').'/app/';
}
if (empty($sAppPath))
{
$sUrl = \MailSo\Base\Http::SingletonInstance()->GetUrl();
if ($sUrl && \preg_match('/\/index\.php\/apps\/rainloop/', $sUrl))
{
$sAppPath = \preg_replace('/\/index\.php\/apps\/rainloop.+$/',
'/apps/rainloop/app/', $sUrl);
}
}
}
return $sAppPath;
}
/**
* @return string
*/
public static function WebVersionPath()
{
return self::WebPath().'rainloop/v/'.APP_VERSION.'/';
}
/**
* @return string
*/
public static function WebStaticPath()
{
return self::WebVersionPath().'static/';
}
/**
* @param string $sFileName
* @param bool $bProcessSections = false