Skip to content

Commit

Permalink
Fixed issue #08141: Unable to set publicurl
Browse files Browse the repository at this point in the history
Dev: Replace default createAbsoluteUrl to use $config['publicurl'] if this one seems valid
  • Loading branch information
Shnoulle committed Sep 9, 2013
1 parent 9d0a803 commit 1ea7736
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions application/core/LSYii_Controller.php
Expand Up @@ -143,4 +143,25 @@ protected function _init()
Yii::app()->setConfig('adminimageurl', Yii::app()->getConfig('styleurl').Yii::app()->getConfig('admintheme').'/images/');
Yii::app()->setConfig('adminstyleurl', Yii::app()->getConfig('styleurl').Yii::app()->getConfig('admintheme').'/');
}

/**
* Creates an absolute URL based on the given controller and action information.
* @param string $route the URL route. This should be in the format of 'ControllerID/ActionID'.
* @param array $params additional GET parameters (name=>value). Both the name and value will be URL-encoded.
* @param string $schema schema to use (e.g. http, https). If empty, the schema used for the current request will be used.
* @param string $ampersand the token separating name-value pairs in the URL.
* @return string the constructed URL
*/
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
$aPublicUrl=parse_url($sPublicUrl);
if(isset($aPublicUrl['scheme']) && isset($aPublicUrl['host']))
{
Yii::app()->getComponent('urlManager')->setBaseUrl($sPublicUrl);
}
return parent::createAbsoluteUrl($route,$params,$schema,$ampersand);
}
}

0 comments on commit 1ea7736

Please sign in to comment.