Skip to content

Commit

Permalink
Dev: better fix for #8141: Unable to set publicurl
Browse files Browse the repository at this point in the history
Dev: don't control publicurl if is set: let admin make good decision
Dev: don't update getComponent('urlManager')
  • Loading branch information
Shnoulle committed Oct 5, 2013
1 parent e90e086 commit f05f98c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions application/core/LSYii_Controller.php
Expand Up @@ -150,18 +150,13 @@ public function createAbsoluteUrl($route,$params=array(),$schema='',$ampersand='
{
$sPublicUrl=Yii::app()->getConfig("publicurl");
// Control if public url are really public : need scheme and host
// If yes: update baseUrl to config without restrictions
// If yes: use it directly (createUrl add index.php)
$aPublicUrl=parse_url($sPublicUrl);
if(isset($aPublicUrl['scheme']) && isset($aPublicUrl['host']))
{
$sActualBaseUrl=Yii::app()->getComponent('urlManager')->getBaseUrl();// Keep actual url to reset after
Yii::app()->getComponent('urlManager')->setBaseUrl($sPublicUrl);
return $sPublicUrl.parent::createUrl($route,$params,$ampersand);
}
$sAbsoluteUrl=parent::createAbsoluteUrl($route,$params,$schema,$ampersand);
if(isset($sActualBaseUrl))
{
Yii::app()->getComponent('urlManager')->setBaseUrl($sActualBaseUrl);
}
return $sAbsoluteUrl;
else
return parent::createAbsoluteUrl($route,$params,$schema,$ampersand);
}
}

0 comments on commit f05f98c

Please sign in to comment.