/**
* Does this CMS / UF support a CMS specific logging mechanism?
- * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
* @var bool
+ * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
*/
- var $supports_UF_Logging = TRUE;
+ public $supports_UF_Logging = TRUE;
/**
*/
$filesURL = $baseURL . "sites/default/files/civicrm/";
}
- return array(
+ return [
'url' => $filesURL,
'path' => CRM_Utils_File::baseFilePath(),
- );
+ ];
}
/**
public function getDefaultSiteSettings($dir) {
$config = CRM_Core_Config::singleton();
$siteName = $siteRoot = NULL;
- $matches = array();
+ $matches = [];
if (preg_match(
'|/sites/([\w\.\-\_]+)/|',
$config->templateCompileDir,
}
}
$url = $config->userFrameworkBaseURL;
- return array($url, $siteName, $siteRoot);
+ return [$url, $siteName, $siteRoot];
}
/**
public function getUserRecordUrl($contactID) {
$uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
if (CRM_Core_Session::singleton()
- ->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm(array(
- 'cms:administer users',
- 'cms:view user account',
- ))
+ ->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm([
+ 'cms:administer users',
+ 'cms:view user account',
+ ])
) {
return $this->url('user/' . $uid);
};
*/
public function logger($message) {
if (CRM_Core_Config::singleton()->userFrameworkLogging && function_exists('watchdog')) {
- watchdog('civicrm', '%message', array('%message' => $message), NULL, WATCHDOG_DEBUG);
+ watchdog('civicrm', '%message', ['%message' => $message], NULL, WATCHDOG_DEBUG);
}
}
* @inheritDoc
*/
public function getModules() {
- $result = array();
+ $result = [];
$q = db_query('SELECT name, status FROM {system} WHERE type = \'module\' AND schema_version <> -1');
foreach ($q as $row) {
$result[] = new CRM_Core_Module('drupal.' . $row->name, ($row->status == 1) ? TRUE : FALSE);
$roles = user_roles(FALSE, $oldPerm);
if (!empty($roles)) {
foreach (array_keys($roles) as $rid) {
- user_role_revoke_permissions($rid, array($oldPerm));
+ user_role_revoke_permissions($rid, [$oldPerm]);
user_role_grant_permissions($rid, $newPerms);
}
}
*
* FIXME: Document values accepted/required by $params
*/
- public function userLoginFinalize($params = array()) {
+ public function userLoginFinalize($params = []) {
user_login_finalize($params);
}
include $confdir . "/sites.php";
}
else {
- $sites = array();
+ $sites = [];
}
$uri = explode('/', $phpSelf);
return (!empty($language->language)) ? $language->language : $language;
}
+ /**
+ * Is a front end page being accessed.
+ *
+ * Generally this would be a contribution form or other public page as opposed to a backoffice page (like contact edit).
+ *
+ * See https://github.com/civicrm/civicrm-drupal/pull/546/files
+ *
+ * @return bool
+ */
+ public function isFrontEndPage() {
+ // Get the menu items.
+ $args = explode('?', $_GET['q']);
+ $path = $args[0];
+
+ // Get the menu for above URL.
+ $item = CRM_Core_Menu::get($path);
+ if (!empty(CRM_Utils_Array::value('is_public', $item))) {
+ return TRUE;
+ }
+ return FALSE;
+ }
+
}