Skip to content

Commit 9409394

Browse files
committed
Merge branch 'hotfix_shorturl' into develop
2 parents d8d8028 + 7437f1f commit 9409394

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

protected/library/Stuffpress/Application.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ public static function _unsetInstance()
3838
}
3939

4040
public function getPublicDomain($cname=true) {
41-
$config = Zend_Registry::get("configuration");
42-
43-
$user = $this->user;
44-
41+
return Stuffpress_Application::getDomain($this->user, $cname);
42+
}
43+
44+
public static function getDomain($user, $cname=true) {
45+
$config = Zend_Registry::get("configuration");
46+
4547
// No user logged in... no url. We should not get here.
4648
if (!$user) {
4749
throw new Stuffpress_Exception("Unexpected request to base->myUrl()");
@@ -56,12 +58,17 @@ public function getPublicDomain($cname=true) {
5658
if ($config->app->user && ($config->app->user == $user->username)) {
5759
$host = trim($config->web->host, " /");
5860
$path = trim($config->web->path, " /");
59-
return "$host/$path";
61+
62+
if ($path) {
63+
return "$host/$path";
64+
} else {
65+
return $host;
66+
}
6067
}
6168

6269
// Otherwise, rebuild the URL
6370
return $user->username . "." . $config->web->host;
6471
}
65-
72+
6673
}
6774
?>

0 commit comments

Comments
 (0)