Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixed issue: Images inserted into HTML emails were not properly linke…
…d to the server
- Loading branch information
Showing
3 changed files
with
129 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,95 +1,101 @@ | |||
<?php | <?php | ||
|
|
||
/** This file is part of KCFinder project | /** This file is part of KCFinder project | ||
* | * | ||
* @desc Autoload classes magic function | * @desc Autoload classes magic function | ||
* @package KCFinder | * @package KCFinder | ||
* @version 2.21 | * @version 2.21 | ||
* @author Pavel Tzonkov <pavelc@users.sourceforge.net> | * @author Pavel Tzonkov <pavelc@users.sourceforge.net> | ||
* @copyright 2010 KCFinder Project | * @copyright 2010 KCFinder Project | ||
* @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 | * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 | ||
* @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 | * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 | ||
* @link http://kcfinder.sunhater.com | * @link http://kcfinder.sunhater.com | ||
*/ | */ | ||
|
|
||
require_once(dirname(__FILE__).'/../../../../config-defaults.php'); | require_once(dirname(__FILE__).'/../../../../config-defaults.php'); | ||
require_once(dirname(__FILE__).'/../../../../common.php'); | require_once(dirname(__FILE__).'/../../../../common.php'); | ||
require_once(dirname(__FILE__).'/../../../admin_functions.php'); | require_once(dirname(__FILE__).'/../../../admin_functions.php'); | ||
|
|
||
$usquery = "SELECT stg_value FROM ".db_table_name("settings_global")." where stg_name='SessionName'"; | $usquery = "SELECT stg_value FROM ".db_table_name("settings_global")." where stg_name='SessionName'"; | ||
$usresult = db_execute_assoc($usquery,'',true); | $usresult = db_execute_assoc($usquery,'',true); | ||
if ($usresult) | if ($usresult) | ||
{ | { | ||
$usrow = $usresult->FetchRow(); | $usrow = $usresult->FetchRow(); | ||
@session_name($usrow['stg_value']); | @session_name($usrow['stg_value']); | ||
} | } | ||
else | else | ||
{ | { | ||
session_name("LimeSurveyAdmin"); | session_name("LimeSurveyAdmin"); | ||
} | } | ||
|
|||
session_set_cookie_params(0,$relativeurl.'/'); | |||
|
|
||
if (session_id() == "") @session_start(); | session_set_cookie_params(0,$relativeurl.'/'); | ||
|
|
||
$_SESSION['KCFINDER'] = array(); | if (session_id() == "") @session_start(); | ||
|
|
||
$sAllowedExtensions = implode(' ',array_map('trim',explode(',',$allowedresourcesuploads))); | $_SESSION['KCFINDER'] = array(); | ||
$_SESSION['KCFINDER']['types']=array('files'=>$sAllowedExtensions, | |||
'flash'=>$sAllowedExtensions, | |||
'images'=>$sAllowedExtensions); | |||
|
|
||
if ($demoModeOnly === false && | $sAllowedExtensions = implode(' ',array_map('trim',explode(',',$allowedresourcesuploads))); | ||
$_SESSION['KCFINDER']['types']=array('files'=>$sAllowedExtensions, | |||
'flash'=>$sAllowedExtensions, | |||
'images'=>$sAllowedExtensions); | |||
if ($demoModeOnly === false && | |||
isset($_SESSION['loginID']) && | isset($_SESSION['loginID']) && | ||
isset($_SESSION['FileManagerContext'])) | isset($_SESSION['FileManagerContext'])) | ||
{ | { | ||
// disable upload at survey creation time | // disable upload at survey creation time | ||
// because we don't know the sid yet | // because we don't know the sid yet | ||
if (preg_match('/^(create|edit):(question|group|answer)/',$_SESSION['FileManagerContext']) != 0 || | if (preg_match('/^(create|edit):(question|group|answer)/',$_SESSION['FileManagerContext']) != 0 || | ||
preg_match('/^edit:survey/',$_SESSION['FileManagerContext']) !=0 || | preg_match('/^edit:survey/',$_SESSION['FileManagerContext']) !=0 || | ||
preg_match('/^edit:assessments/',$_SESSION['FileManagerContext']) !=0 || | preg_match('/^edit:assessments/',$_SESSION['FileManagerContext']) !=0 || | ||
preg_match('/^edit:emailsettings/',$_SESSION['FileManagerContext']) != 0) | preg_match('/^edit:emailsettings/',$_SESSION['FileManagerContext']) != 0) | ||
{ | { | ||
$contextarray=explode(':',$_SESSION['FileManagerContext'],3); | $contextarray=explode(':',$_SESSION['FileManagerContext'],3); | ||
$surveyid=$contextarray[2]; | $surveyid=$contextarray[2]; | ||
|
|
||
|
|
||
|
|
||
if(bHasSurveyPermission($surveyid,'surveycontent','update')) | if(bHasSurveyPermission($surveyid,'surveycontent','update')) | ||
{ | { | ||
$_SESSION['KCFINDER']['disabled'] = false ; | $_SESSION['KCFINDER']['disabled'] = false ; | ||
$_SESSION['KCFINDER']['uploadURL'] = "{$relativeurl}/upload/surveys/{$surveyid}/" ; | if (preg_match('/^edit:emailsettings/',$_SESSION['FileManagerContext']) != 0) | ||
$_SESSION['KCFINDER']['uploadDir'] = $uploaddir.'/surveys/'.$surveyid; | { | ||
} | $_SESSION['KCFINDER']['uploadURL'] = "{$rooturl}/upload/surveys/{$surveyid}/" ; | ||
} | |||
else | |||
{ | |||
$_SESSION['KCFINDER']['uploadURL'] = "{$relativeurl}/upload/surveys/{$surveyid}/" ; | |||
} | |||
$_SESSION['KCFINDER']['uploadDir'] = $uploaddir.'/surveys/'.$surveyid; | |||
} | |||
|
|
||
} | } | ||
elseif (preg_match('/^edit:label/',$_SESSION['FileManagerContext']) != 0) | elseif (preg_match('/^edit:label/',$_SESSION['FileManagerContext']) != 0) | ||
{ | |||
$contextarray=explode(':',$_SESSION['FileManagerContext'],3); | |||
$labelid=$contextarray[2]; | |||
// check if the user has label management right and labelid defined | |||
if ($_SESSION['USER_RIGHT_MANAGE_LABEL']==1 && isset($labelid) && $labelid != '') | |||
{ | { | ||
$_SESSION['KCFINDER']['disabled'] = false ; | $contextarray=explode(':',$_SESSION['FileManagerContext'],3); | ||
$_SESSION['KCFINDER']['uploadURL'] = "{$relativeurl}/upload/labels/{$labelid}/" ; | $labelid=$contextarray[2]; | ||
$_SESSION['KCFINDER']['uploadDir'] = "{$uploaddir}/labels/{$labelid}" ; | // check if the user has label management right and labelid defined | ||
if ($_SESSION['USER_RIGHT_MANAGE_LABEL']==1 && isset($labelid) && $labelid != '') | |||
{ | |||
$_SESSION['KCFINDER']['disabled'] = false ; | |||
$_SESSION['KCFINDER']['uploadURL'] = "{$relativeurl}/upload/labels/{$labelid}/" ; | |||
$_SESSION['KCFINDER']['uploadDir'] = "{$uploaddir}/labels/{$labelid}" ; | |||
} | |||
} | } | ||
} | |||
|
|
||
} | } | ||
|
|
||
|
|
||
function __autoload($class) { | function __autoload($class) { | ||
if ($class == "uploader") | if ($class == "uploader") | ||
require "core/uploader.php"; | require "core/uploader.php"; | ||
elseif ($class == "browser") | elseif ($class == "browser") | ||
require "core/browser.php"; | require "core/browser.php"; | ||
elseif (file_exists("core/types/$class.php")) | elseif (file_exists("core/types/$class.php")) | ||
require "core/types/$class.php"; | require "core/types/$class.php"; | ||
elseif (file_exists("lib/class_$class.php")) | elseif (file_exists("lib/class_$class.php")) | ||
require "lib/class_$class.php"; | require "lib/class_$class.php"; | ||
elseif (file_exists("lib/helper_$class.php")) | elseif (file_exists("lib/helper_$class.php")) | ||
require "lib/helper_$class.php"; | require "lib/helper_$class.php"; | ||
} | } | ||
|
|
||
?> | ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters