Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
a5ecff8d
Commit
a5ecff8d
authored
11 years ago
by
xurizaemon
Browse files
Options
Downloads
Patches
Plain Diff
Code style & docs.
parent
f3d83384
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Utils/System/Drupal.php
+23
-20
23 additions, 20 deletions
CRM/Utils/System/Drupal.php
CRM/Utils/System/Drupal6.php
+18
-21
18 additions, 21 deletions
CRM/Utils/System/Drupal6.php
with
41 additions
and
41 deletions
CRM/Utils/System/Drupal.php
+
23
−
20
View file @
a5ecff8d
...
...
@@ -63,7 +63,7 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_Base {
$admin
=
user_access
(
'administer users'
);
if
(
!
variable_get
(
'user_email_verification'
,
TRUE
)
||
$admin
)
{
$form_state
[
'input'
][
'pass'
]
=
array
(
'pass1'
=>
$params
[
'cms_pass'
],
'pass2'
=>
$params
[
'cms_pass'
]);
$form_state
[
'input'
][
'pass'
]
=
array
(
'pass1'
=>
$params
[
'cms_pass'
],
'pass2'
=>
$params
[
'cms_pass'
]);
}
if
(
!
empty
(
$params
[
'notify'
])){
...
...
@@ -98,9 +98,7 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_Base {
if
(
form_get_errors
())
{
return
FALSE
;
}
else
{
return
$form_state
[
'user'
]
->
uid
;
}
return
$form_state
[
'user'
]
->
uid
;
}
/*
...
...
@@ -550,7 +548,8 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_Base {
*
* @param string $name the user name
* @param string $password the password for the above user name
* @param $loadCMSBootstrap boolean load cms bootstrap?
* @param boolean $loadCMSBootstrap load cms bootstrap?
* @param NULL|string $realPath filename of script
*
* @return mixed false if no auth
* array(
...
...
@@ -567,8 +566,6 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_Base {
CRM_Core_Error
::
fatal
(
"Cannot connect to drupal db via
$config->userFrameworkDSN
, "
.
$dbDrupal
->
getMessage
());
}
$account
=
$userUid
=
$userMail
=
NULL
;
if
(
$loadCMSBootstrap
)
{
$bootStrapParams
=
array
();
...
...
@@ -725,11 +722,11 @@ AND u.status = 1
/**
* load drupal bootstrap
*
* @param $params array with uid or name and password
* @param $loadUser boolean load cms user?
* @param $throwError throw error on failure?
* @param array $params Either uid, or name & pass.
* @param boolean $loadUser boolean Require CMS user load.
* @param boolean $throwError If true, print error on failure and exit.
* @param boolean|string $realPath path to script
*/
function
loadBootStrap
(
$params
=
array
(),
$loadUser
=
TRUE
,
$throwError
=
TRUE
,
$realPath
=
NULL
)
{
//take the cms root path.
$cmsPath
=
$this
->
cmsRootPath
(
$realPath
);
...
...
@@ -826,8 +823,10 @@ AND u.status = 1
return
FALSE
;
}
/**
*
*/
function
cmsRootPath
(
$scriptFilename
=
NULL
)
{
$cmsRoot
=
$valid
=
NULL
;
if
(
!
is_null
(
$scriptFilename
))
{
...
...
@@ -913,11 +912,7 @@ AND u.status = 1
* @return string $url, formatted url.
* @static
*/
function
languageNegotiationURL
(
$url
,
$addLanguagePart
=
TRUE
,
$removeLanguagePart
=
FALSE
)
{
function
languageNegotiationURL
(
$url
,
$addLanguagePart
=
TRUE
,
$removeLanguagePart
=
FALSE
)
{
if
(
empty
(
$url
))
{
return
$url
;
}
...
...
@@ -1009,12 +1004,17 @@ AND u.status = 1
/**
* Wrapper for og_membership creation
*
* @param integer $ogID Organic Group ID
* @param integer $drupalID drupal User ID
*/
function
og_membership_create
(
$ogID
,
$drupalID
){
if
(
function_exists
(
'og_entity_query_alter'
))
{
// sort-of-randomly chose a function that only exists in the 7.x-2.x branch
// TODO: Find a more solid way to make this test
// Also, since we don't know how to get the entity type of the group, we'll assume it's 'node'
// sort-of-randomly chose a function that only exists in the // 7.x-2.x branch
//
// @TODO Find more solid way to check - try system_get_info('module', 'og').
//
// Also, since we don't know how to get the entity type of the // group, we'll assume it's 'node'
og_group
(
'node'
,
$ogID
,
array
(
'entity'
=>
user_load
(
$drupalID
)));
}
else
{
...
...
@@ -1025,6 +1025,9 @@ AND u.status = 1
/**
* Wrapper for og_membership deletion
*
* @param integer $ogID Organic Group ID
* @param integer $drupalID drupal User ID
*/
function
og_membership_delete
(
$ogID
,
$drupalID
)
{
if
(
function_exists
(
'og_entity_query_alter'
))
{
...
...
This diff is collapsed.
Click to expand it.
CRM/Utils/System/Drupal6.php
+
18
−
21
View file @
a5ecff8d
...
...
@@ -119,9 +119,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_Base {
if
(
form_get_errors
()
||
!
isset
(
$form_state
[
'user'
]))
{
return
FALSE
;
}
return
$form_state
[
'user'
]
->
uid
;
}
/*
...
...
@@ -158,7 +156,6 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_Base {
$email
=
$dao
->
escape
(
CRM_Utils_Array
::
value
(
'mail'
,
$params
));
_user_edit_validate
(
NULL
,
$params
);
$errors
=
form_get_errors
();
if
(
$errors
)
{
if
(
CRM_Utils_Array
::
value
(
'name'
,
$errors
))
{
$errors
[
'cms_name'
]
=
$errors
[
'name'
];
...
...
@@ -170,7 +167,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_Base {
unset
(
$_SESSION
[
'messages'
]);
}
//
drupal api sucks d
o the name check manually
//
D
o the name check manually
.
$nameError
=
user_validate_name
(
$params
[
'name'
]);
if
(
$nameError
)
{
$errors
[
'cms_name'
]
=
$nameError
;
...
...
@@ -181,7 +178,6 @@ SELECT name, mail
FROM
{
$config
->
userFrameworkUsersTableName
}
WHERE (LOWER(name) = LOWER('
$name
')) OR (LOWER(mail) = LOWER('
$email
'))"
;
$db_cms
=
DB
::
connect
(
$config
->
userFrameworkDSN
);
if
(
DB
::
isError
(
$db_cms
))
{
die
(
"Cannot connect to UF db via
$dsn
, "
.
$db_cms
->
getMessage
());
...
...
@@ -426,7 +422,6 @@ SELECT name, mail
*
* @return string the url to post the form
* @access public
*/
function
postURL
(
$action
)
{
if
(
!
empty
(
$action
))
{
...
...
@@ -516,6 +511,8 @@ SELECT name, mail
*
* @param string $name the user name
* @param string $password the password for the above user name
* @param boolean $loadCMSBootstrap load cms bootstrap?
* @param NULL|string $realPath filename of script
*
* @return mixed false if no auth
* array(
...
...
@@ -557,8 +554,8 @@ SELECT name, mail
}
CRM_Utils_System
::
loadBootStrap
(
$bootStrapParams
,
TRUE
,
TRUE
,
$realPath
);
}
return
array
(
$contactID
,
$row
[
'uid'
],
mt_rand
());
}
return
array
(
$contactID
,
$row
[
'uid'
],
mt_rand
());
}
}
return
FALSE
;
}
...
...
@@ -641,11 +638,12 @@ SELECT name, mail
/**
* load drupal bootstrap
*
* @param $name string optional username for login
* @param $pass string optional password for login
* @param array $params Either uid, or name & pass.
* @param boolean $loadUser boolean Require CMS user load.
* @param boolean $throwError If true, print error on failure and exit.
* @param boolean|string $realPath path to script
*/
function
loadBootStrap
(
$params
=
array
(
),
$loadUser
=
TRUE
,
$throwError
=
TRUE
,
$realPath
=
NULL
)
{
function
loadBootStrap
(
$params
=
array
(),
$loadUser
=
TRUE
,
$throwError
=
TRUE
,
$realPath
=
NULL
)
{
$uid
=
CRM_Utils_Array
::
value
(
'uid'
,
$params
);
$name
=
CRM_Utils_Array
::
value
(
'name'
,
$params
,
FALSE
)
?
$params
[
'name'
]
:
trim
(
CRM_Utils_Array
::
value
(
'name'
,
$_REQUEST
));
$pass
=
CRM_Utils_Array
::
value
(
'pass'
,
$params
,
FALSE
)
?
$params
[
'pass'
]
:
trim
(
CRM_Utils_Array
::
value
(
'pass'
,
$_REQUEST
));
...
...
@@ -661,12 +659,11 @@ SELECT name, mail
require_once
'includes/bootstrap.inc'
;
@
drupal_bootstrap
(
DRUPAL_BOOTSTRAP_FULL
);
if
(
!
function_exists
(
'module_exists'
)
||
!
module_exists
(
'civicrm'
)
)
{
echo
'<br />Sorry, could not able to load drupal bootstrap.'
;
if
(
!
function_exists
(
'module_exists'
)
||
!
module_exists
(
'civicrm'
))
{
echo
'<br />Sorry, could not load drupal bootstrap.'
;
exit
();
}
// lets also fix the clean url setting
// CRM-6948
$config
->
cleanURL
=
(
int
)
variable_get
(
'clean_url'
,
'0'
);
...
...
@@ -701,6 +698,9 @@ SELECT name, mail
}
}
/**
*
*/
function
cmsRootPath
(
$scriptFilename
=
NULL
)
{
$cmsRoot
=
$valid
=
NULL
;
...
...
@@ -710,6 +710,7 @@ SELECT name, mail
else
{
$path
=
$_SERVER
[
'SCRIPT_FILENAME'
];
}
if
(
function_exists
(
'drush_get_context'
))
{
// drush anyway takes care of multisite install etc
return
drush_get_context
(
'DRUSH_DRUPAL_ROOT'
);
...
...
@@ -786,10 +787,7 @@ SELECT name, mail
* @return string $url, formatted url.
* @static
*/
function
languageNegotiationURL
(
$url
,
$addLanguagePart
=
TRUE
,
$removeLanguagePart
=
FALSE
)
{
function
languageNegotiationURL
(
$url
,
$addLanguagePart
=
TRUE
,
$removeLanguagePart
=
FALSE
)
{
if
(
empty
(
$url
))
{
return
$url
;
}
...
...
@@ -936,4 +934,3 @@ SELECT name, mail
drupal_flush_all_caches
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment