Detect SuiteCRM only with global variable ['sugarcrm']
This commit is contained in:
parent
052824e4b7
commit
3249260653
6 changed files with 153 additions and 147 deletions
|
@ -356,7 +356,7 @@ function storm_user($op, &$edit, &$account, $category = NULL) {
|
|||
* $_SESSION['SuiteCRM_Session_ID'] = Session ID for user in SuiteCRM
|
||||
*/
|
||||
function storm_init() {
|
||||
global $user, $base_url, $conf;
|
||||
global $user, $base_url;
|
||||
|
||||
// It is intended to move these calls to pages which specifically need them rather than on hook_init.
|
||||
drupal_add_js(drupal_get_path('module', 'storm') .'/storm.js', 'module', 'header', FALSE);
|
||||
|
@ -397,7 +397,7 @@ function storm_init() {
|
|||
$_SESSION['deskmenu'] = $deskmenu;
|
||||
|
||||
// Verify SuiteCRM access. Get the SuiteCRM User ID:
|
||||
if ($conf['storm_suitecrm']) {
|
||||
if (storm_suitecrm_is_defined()) {
|
||||
$sugaruid = $user->uid == 1 ? 1 : db_result(db_query("SELECT field_stormperson_sugaruid_value FROM {stormperson} JOIN {content_type_stormperson} USING (vid) WHERE user_uid = %d", $user->uid));
|
||||
if (!empty($sugaruid)) {
|
||||
$password = md5(substr(md5(microtime()), rand(0, 26), 16));
|
||||
|
@ -3360,6 +3360,15 @@ function storm_cron_is_running() {
|
|||
return preg_match('/\/cron.php$/', $_SERVER['SCRIPT_NAME']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return TRUE if database connection with SuiteCRM is defined.
|
||||
*/
|
||||
function storm_suitecrm_is_defined() {
|
||||
global $db_url;
|
||||
|
||||
return !empty($db_url['sugarcrm']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch from original user to mail submission user and back. Notes:
|
||||
*
|
||||
|
|
Reference in a new issue