Skip to content
This repository has been archived by the owner on Nov 14, 2018. It is now read-only.

Default External Site Not Working #2125

Open
benlochard opened this issue Dec 4, 2015 · 10 comments
Open

Default External Site Not Working #2125

benlochard opened this issue Dec 4, 2015 · 10 comments
Labels

Comments

@benlochard
Copy link

benlochard commented Dec 4, 2015

I have seen this quested posted in a couple different forums and nobody seems to have an answer and I'm not sure if this is a bug or if I am just doing something wrong? I really want to use owncloud as a replacement for onedrive, but I'd love to be able to use the external site feature as a way to incorporate it into our existing employee portal.

I would like to be able to be able to navigate to an external site upon login - this doesn't seem to be working like it is supposed to.

I have tried changing the config.php file to show:
'defaultapp' => 'external' (page doesn't load)
'defaultapp' => 'external/1' (redirects to files - this is the correct path of the actual url)
'defaultapp' => 'external?id=1' (redirects to files)

@karlitschek karlitschek added the bug label Dec 6, 2015
@benlochard
Copy link
Author

Anyone have any workarounds or ideas how to fix this?

@MichaelBarth
Copy link

Find the file
/lib/private/util.php

Find:
$location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');

Insert directly after this:
if ("external"==$appId)
{
$location=$location."1"; //you can use other page numbers if you like
}

@johncab
Copy link

johncab commented Feb 2, 2016

same problem here @MichaelBarth can't find this $location in /lib/private/util.php

any other solution?

Thanks!

@MichaelBarth
Copy link

Hi,John
what Version of OC are you using?
I’m using 8.2.2 stable and I attached my modificated owncloud/lib/private/util.php so you can try it.

You have also to change the config.php in the owncloud/config folder and add

'defaultapp' => 'external‘,

Hope that works for you.

Michael

… and here is the complete function I changed in util.php

/**
* Returns the URL of the default page
* based on the system configuration and
* the apps visible for the current user
*
* @return string URL
*/
public static function getDefaultPageUrl() {
$urlGenerator = \OC::$server->getURLGenerator();
// Deny the redirect if the URL contains a @
// This prevents unvalidated redirects like ?redirect_url=:[email protected]
if (isset($_REQUEST['redirect_url']) && strpos($_REQUEST['redirect_url'], '@') === false) {
$location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url']));
} else {
$defaultPage = \OC::$server->getAppConfig()->getValue('core', 'defaultpage');
if ($defaultPage) {
$location = $urlGenerator->getAbsoluteURL($defaultPage);
} else {
$appId = 'files';
$defaultApps = explode(',', \OCP\Config::getSystemValue('defaultapp', 'files'));
// find the first app that is enabled for the current user
foreach ($defaultApps as $defaultApp) {
$defaultApp = OC_App::cleanAppId(strip_tags($defaultApp));
if (static::getAppManager()->isEnabledForUser($defaultApp)) {
$appId = $defaultApp;
break;
}
}
$location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');
if ("external"==$appId)
{
$location=$location."1"; //you can use other page numbers if you like
}
}
}
return $location;
}

Am 02.02.2016 um 15:33 schrieb johncab [email protected]:

same problem here @MichaelBarth https://github.com/MichaelBarth can't find this $location in /lib/private/util.php

any other solution?

Thanks!


Reply to this email directly or view it on GitHub #2125 (comment).

@MichaelBarth
Copy link

… if you need the file please send me your email address!

@johncab
Copy link

johncab commented Feb 2, 2016

Thanks so much @MichaelBarth ! 👍 It works!

@MichaelBarth
Copy link

… thats great. If you want to pass the userID of the ownCloud with the URL of the external side, I know how to …

Am 02.02.2016 um 23:01 schrieb johncab [email protected]:

Thanks so much @MichaelBarth https://github.com/MichaelBarth ! It works!


Reply to this email directly or view it on GitHub #2125 (comment).

@johncab
Copy link

johncab commented Feb 2, 2016

Thank you. You’re so helpful.

@PVince81
Copy link
Contributor

Mind sending this patch as a PR ?

@pirate
Copy link

pirate commented Sep 9, 2017

@PVince81 done: owncloud/core#28962
I made the path user-configurable, so it can be set to things other than /1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants