+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
+ | Copyright CiviCRM LLC (c) 2004-2016 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
* $Id$
*
*/
// 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, '?');
$query = NULL,
$absolute = FALSE,
$fragment = NULL,
- $htmlize = TRUE,
$frontend = FALSE,
$forceBackend = FALSE
) {
$base = $absolute ? $config->userFrameworkBaseURL : $config->useFrameworkRelativeBase;
- $separator = $htmlize ? '&' : '&';
+ $separator = '&';
if (!$config->cleanURL) {
if (isset($path)) {
'cms:view user account',
))
) {
- return CRM_Utils_System::url('user/' . $uid);
+ return url('user/' . $uid);
};
}
* @inheritDoc
*/
public function logger($message) {
- if (CRM_Core_Config::singleton()->userFrameworkLogging) {
+ if (CRM_Core_Config::singleton()->userFrameworkLogging && function_exists('watchdog')) {
watchdog('civicrm', '%message', array('%message' => $message), NULL, WATCHDOG_DEBUG);
}
}
/**
* Append Drupal js to coreResourcesList.
+ *
+ * @param array $list
*/
public function appendCoreResources(&$list) {
$list[] = 'js/crm.drupal.js';
return CRM_Core_I18n_PseudoConstant::longForShort(substr($language->language, 0, 2));
}
+ /**
+ * @inheritDoc
+ */
+ public function setUFLocale($civicrm_language) {
+ global $language;
+
+ $langcode = substr($civicrm_language, 0, 2);
+ $languages = language_list();
+
+ if (isset($languages[$langcode])) {
+ $language = $languages[$langcode];
+
+ // Config must be re-initialized to reset the base URL
+ // otherwise links will have the wrong language prefix/domain.
+ $config = CRM_Core_Config::singleton();
+ $config->free();
+
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
/**
* Perform any post login activities required by the UF -
* e.g. for drupal: records a watchdog message about the new session, saves the login timestamp,
/**
* 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)) {