Skip to content

Commit

Permalink
Fixed issue #8238: Image url in email editor don't take publicurl con…
Browse files Browse the repository at this point in the history
…figuration

Dev: fix $_SESSION['KCFINDER']['uploadURL'] for emailsettings
Dev: need a function or reviewing configuration system ?
  • Loading branch information
Shnoulle committed Oct 5, 2013
1 parent 40674fa commit fd935cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions application/controllers/admin/emailtemplates.php
Expand Up @@ -37,6 +37,7 @@ function index($iSurveyId)
Yii::app()->loadHelper('surveytranslator');

Yii::app()->session['FileManagerContext'] = "edit:emailsettings:{$iSurveyId}";
initKcfinder();

if(isset($iSurveyId) && getEmailFormat($iSurveyId) == 'html')
{
Expand Down
16 changes: 15 additions & 1 deletion application/helpers/admin/htmleditor_helper.php
Expand Up @@ -43,7 +43,21 @@ function initKcfinder()
$_SESSION['KCFINDER']['disabled'] = false;
if (preg_match('/^edit:emailsettings/',$_SESSION['FileManagerContext']) != 0)
{
$_SESSION['KCFINDER']['uploadURL'] = Yii::app()->getRequest()->getHostInfo().Yii::app()->getConfig('uploadurl')."/surveys/{$surveyid}/";
// Uploadurl use public url or getBaseUrl(true);
// Maybe need external function
$sBaseAbsoluteUrl=Yii::app()->getBaseUrl(true);
$sPublicUrl=Yii::app()->getConfig("publicurl");
$aPublicUrl=parse_url($sPublicUrl);
if(isset($aPublicUrl['scheme']) && isset($aPublicUrl['host']))
{
$sBaseAbsoluteUrl=$sPublicUrl;
}
$sBaseUrl=Yii::app()->getBaseUrl();
$sUploadUrl=Yii::app()->getConfig('uploadurl');
if (substr($sUploadUrl, 0, strlen($sBaseUrl)) == $sBaseUrl) {
$sUploadUrl = substr($sUploadUrl, strlen($sBaseUrl));
}
$_SESSION['KCFINDER']['uploadURL'] = trim($sBaseAbsoluteUrl,"/").$sUploadUrl."/surveys/{$surveyid}/";
}
else
{
Expand Down

0 comments on commit fd935cd

Please sign in to comment.