Skip to content

Commit

Permalink
Fixed CRM-14283. Strips protocol and domain name from premium image b…
Browse files Browse the repository at this point in the history
…efore storing URL in DB.

----------------------------------------
* CRM-14283: Premium image upload button => http-only URL for images => Firefox insecure page warning
  https://issues.civicrm.org/jira/browse/CRM-14283
  • Loading branch information
universalhandle committed Apr 29, 2014
1 parent 6fd6609 commit ffc4d2d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CRM/Contribute/BAO/ManagePremiums.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ static function setIsActive($id, $is_active) {
* @return object
*/
static function add(&$params, &$ids) {
// CRM-14283 - strip protocol and domain from image URLs
$image_type = array('image', 'thumbnail');
foreach ($image_type as $key) {
if (isset($params[$key])) {
$parsedURL = explode('/', $params[$key]);
$pathComponents = array_slice($parsedURL, 3);
$params[$key] = '/' . implode('/', $pathComponents);
}
}

$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, FALSE);
Expand Down

0 comments on commit ffc4d2d

Please sign in to comment.