X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSystem%2FDrupalBase.php;h=2b0019a81ce20b8d57e8d93d575f92c6ca718904;hb=97f643ccac726d7da37f5983aa4c6c9132c8e872;hp=3fb5d8effa645dc6a93c5bcd7780e021f3ecadae;hpb=0fccb17f3cf8138fc43aed4b48fd23a38394bbf8;p=civicrm-core.git diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 3fb5d8effa..3129073181 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2015 | + | Copyright CiviCRM LLC (c) 2004-2016 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2015 + * @copyright CiviCRM LLC (c) 2004-2016 * $Id$ * */ @@ -100,13 +100,17 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { // compares $url (which is some unknown/untrusted value from a third-party dev) to the CMS's base url (which is independent of civi's url) // to see if the url is within our drupal dir, if it is we are able to treated it as an internal url if (strpos($url, $base_url) === 0) { - $internal = TRUE; - $url = trim(str_replace($base_url, '', $url), '/'); + $file = trim(str_replace($base_url, '', $url), '/'); + // CRM-18130: Custom CSS URL not working if aliased or rewritten + if (file_exists(DRUPAL_ROOT . $file)) { + $url = $file; + $internal = TRUE; + } } // Handle relative urls that are within the CiviCRM module directory elseif (strpos($url, $base) === 0) { $internal = TRUE; - $url = $this->appendCoreDirectoryToResourceBase(substr(drupal_get_path('module', 'civicrm'), 0, -6)) . trim(substr($url, strlen($base)), '/'); + $url = $this->appendCoreDirectoryToResourceBase(dirname(drupal_get_path('module', 'civicrm')) . '/') . trim(substr($url, strlen($base)), '/'); } // Strip query string $q = strpos($url, '?'); @@ -147,7 +151,6 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { $query = NULL, $absolute = FALSE, $fragment = NULL, - $htmlize = TRUE, $frontend = FALSE, $forceBackend = FALSE ) { @@ -162,7 +165,7 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { $base = $absolute ? $config->userFrameworkBaseURL : $config->useFrameworkRelativeBase; - $separator = $htmlize ? '&' : '&'; + $separator = '&'; if (!$config->cleanURL) { if (isset($path)) { @@ -249,7 +252,7 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { 'cms:view user account', )) ) { - return CRM_Utils_System::url('user/' . $uid); + return url('user/' . $uid); }; } @@ -278,6 +281,8 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { /** * Append Drupal js to coreResourcesList. + * + * @param array $list */ public function appendCoreResources(&$list) { $list[] = 'js/crm.drupal.js'; @@ -497,6 +502,10 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { /** * Fixme: Why are we overriding the parent function? Seems inconsistent. * This version supplies slightly different params to $this->url (not absolute and html encoded) but why? + * + * @param string $action + * + * @return string */ public function postURL($action) { if (!empty($action)) {