Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Extensions
civimobileapi
Commits
aecebded
Commit
aecebded
authored
Dec 07, 2020
by
BohdanDmytryshyn
Browse files
Release 5.4.0
parent
de4acb30
Changes
10
Hide whitespace changes
Inline
Side-by-side
CRM/CiviMobileAPI/Api/CiviMobileCmsRegistration/Create.php
View file @
aecebded
...
...
@@ -25,13 +25,14 @@ class CRM_CiviMobileAPI_Api_CiviMobileCmsRegistration_Create extends CRM_CiviMob
'api.Email.create'
=>
[
'email'
=>
$this
->
validParams
[
"email"
]],
'first_name'
=>
$this
->
validParams
[
"first_name"
],
'last_name'
=>
$this
->
validParams
[
"last_name"
],
'sequential'
=>
1
]);
}
catch
(
CiviCRM_API3_Exception
$e
)
{
$transaction
->
rollback
();
throw
new
api_Exception
(
"CiviCRM creating Contact error: "
.
$e
->
getMessage
(),
'creating_contact_error'
);
}
$this
->
validParams
[
'contactID'
]
=
$contact
[
'id'
];
$this
->
validParams
[
'contactID'
]
=
$contact
[
'
values'
][
0
][
'
id'
];
if
(
!
CRM_Core_BAO_CMSUser
::
create
(
$this
->
validParams
,
'email'
))
{
$transaction
->
rollback
();
...
...
@@ -43,9 +44,14 @@ class CRM_CiviMobileAPI_Api_CiviMobileCmsRegistration_Create extends CRM_CiviMob
$message
=
'User was registered.'
;
$successCode
=
'registration_success'
;
if
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
)
{
$isEmailVerification
=
variable_get
(
'user_email_verification'
,
TRUE
);
$isAdministratorApproval
=
variable_get
(
'user_register'
,
TRUE
)
==
2
;
if
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
||
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
)
{
if
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
)
{
$isEmailVerification
=
variable_get
(
'user_email_verification'
,
TRUE
);
$isAdministratorApproval
=
variable_get
(
'user_register'
,
TRUE
)
==
2
;
}
elseif
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
)
{
$isEmailVerification
=
\
Drupal
::
config
(
'user.settings'
)
->
get
(
'verify_mail'
);
$isAdministratorApproval
=
\
Drupal
::
config
(
'user.settings'
)
->
get
(
'register'
)
==
'visitors_admin_approval'
;
}
if
(
$isEmailVerification
&&
$isAdministratorApproval
)
{
$message
=
'User was registered. You must to check your email to verify your account. Administrator will check your account and confirm user registration request.'
;
...
...
CRM/CiviMobileAPI/Api/CiviMobileParticipantPaymentLink/Get.php
View file @
aecebded
...
...
@@ -42,9 +42,14 @@ class CRM_CiviMobileAPI_Api_CiviMobileParticipantPaymentLink_Get extends CRM_Civ
);
$currentCMS
=
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
();
$config
=
CRM_Core_Config
::
singleton
();
$url
=
CRM_Utils_System
::
url
(
'civicrm/event/register'
,
'id='
.
$this
->
validParams
[
'event_id'
]
.
'&reset=1&cmbHash='
.
$cmbHash
);
if
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_JOOMLA
)
{
if
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_JOOMLA
)
{
$url
=
str_replace
(
"administrator/"
,
""
,
$url
);
}
elseif
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
)
{
$absoluteUrl
=
CRM_Utils_System
::
url
(
'civicrm/event/register'
,
'id='
.
$this
->
validParams
[
'event_id'
]
.
'&reset=1&cmbHash='
.
$cmbHash
,
TRUE
,
NULL
,
FALSE
);
$url
=
'/'
.
str_replace
(
$config
->
userFrameworkBaseURL
,
""
,
$absoluteUrl
);
}
$result
[
'link'
]
=
html_entity_decode
(
$url
);
...
...
CRM/CiviMobileAPI/Page/Auth.php
View file @
aecebded
...
...
@@ -109,6 +109,9 @@ class CRM_CiviMobileAPI_Page_Auth extends CRM_Core_Page {
$isBlocked
=
TRUE
;
}
break
;
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
$isBlocked
=
$user
->
isBlocked
();
break
;
}
return
$isBlocked
;
...
...
CRM/CiviMobileAPI/Utils/Cms.php
View file @
aecebded
...
...
@@ -22,6 +22,9 @@ class CRM_CiviMobileAPI_Utils_Cms {
elseif
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
||
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
)
{
return
variable_get
(
'site_name'
,
''
);
}
elseif
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
)
{
return
\
Drupal
::
config
(
'system.site'
)
->
get
(
"name"
);
}
return
null
;
}
...
...
@@ -41,7 +44,7 @@ class CRM_CiviMobileAPI_Utils_Cms {
elseif
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_JOOMLA
)
{
return
str_replace
(
"/administrator/"
,
"/"
,
$config
->
userFrameworkBaseURL
)
.
"?format=feed&type=rss"
;
}
elseif
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
||
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
)
{
elseif
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
||
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
||
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
)
{
return
$config
->
userFrameworkBaseURL
.
"rss.xml"
;
}
...
...
CRM/CiviMobileAPI/Utils/Cms/Registration.php
View file @
aecebded
...
...
@@ -18,6 +18,7 @@ class CRM_CiviMobileAPI_Utils_Cms_Registration {
*/
public
static
function
minPasswordLength
()
{
switch
(
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
())
{
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
:
$minPasswordLength
=
CRM_CiviMobileAPI_Utils_Cms_Registration_Drupal
::
minPasswordLength
();
...
...
@@ -40,6 +41,7 @@ class CRM_CiviMobileAPI_Utils_Cms_Registration {
*/
public
static
function
maxPasswordLength
()
{
switch
(
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
())
{
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
:
$maxPasswordLength
=
CRM_CiviMobileAPI_Utils_Cms_Registration_Drupal
::
maxPasswordLength
();
...
...
@@ -62,6 +64,7 @@ class CRM_CiviMobileAPI_Utils_Cms_Registration {
*/
public
static
function
minUsernameLength
()
{
switch
(
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
())
{
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
:
$minUsernameLength
=
CRM_CiviMobileAPI_Utils_Cms_Registration_Drupal
::
minUsernameLength
();
...
...
@@ -84,6 +87,7 @@ class CRM_CiviMobileAPI_Utils_Cms_Registration {
*/
public
static
function
maxUsernameLength
()
{
switch
(
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
())
{
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
:
$maxUsernameLength
=
CRM_CiviMobileAPI_Utils_Cms_Registration_Drupal
::
maxUsernameLength
();
...
...
@@ -106,6 +110,7 @@ class CRM_CiviMobileAPI_Utils_Cms_Registration {
*/
public
static
function
minPasswordIntegers
()
{
switch
(
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
())
{
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
:
$minPasswordIntegers
=
CRM_CiviMobileAPI_Utils_Cms_Registration_Drupal
::
minPasswordIntegers
();
...
...
@@ -128,6 +133,7 @@ class CRM_CiviMobileAPI_Utils_Cms_Registration {
*/
public
static
function
minPasswordSymbols
()
{
switch
(
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
())
{
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
:
$minPasswordSymbols
=
CRM_CiviMobileAPI_Utils_Cms_Registration_Drupal
::
minPasswordSymbols
();
...
...
@@ -150,6 +156,7 @@ class CRM_CiviMobileAPI_Utils_Cms_Registration {
*/
public
static
function
minPasswordUpperCase
()
{
switch
(
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
())
{
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
:
$minPasswordUpperCase
=
CRM_CiviMobileAPI_Utils_Cms_Registration_Drupal
::
minPasswordUpperCase
();
...
...
@@ -172,6 +179,7 @@ class CRM_CiviMobileAPI_Utils_Cms_Registration {
*/
public
static
function
minPasswordLowerCase
()
{
switch
(
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
())
{
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL8
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL7
:
case
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_DRUPAL6
:
$minPasswordLowerCase
=
CRM_CiviMobileAPI_Utils_Cms_Registration_Drupal
::
minPasswordLowerCase
();
...
...
CRM/CiviMobileAPI/Utils/CmsUser.php
View file @
aecebded
...
...
@@ -5,6 +5,11 @@
class
CRM_CiviMobileAPI_Utils_CmsUser
{
/**
* Drupal 8 CMS
*/
const
CMS_DRUPAL8
=
'Drupal8'
;
/**
* Drupal 7 CMS
*/
...
...
@@ -138,6 +143,7 @@ class CRM_CiviMobileAPI_Utils_CmsUser {
*/
public
function
validateCMS
()
{
return
in_array
(
$this
->
system
,
[
self
::
CMS_DRUPAL8
,
self
::
CMS_DRUPAL7
,
self
::
CMS_WORDPRESS
,
self
::
CMS_JOOMLA
,
...
...
@@ -155,6 +161,15 @@ class CRM_CiviMobileAPI_Utils_CmsUser {
public
function
validateAccount
(
$email
,
$password
)
{
$uid
=
FALSE
;
switch
(
$this
->
system
)
{
case
self
::
CMS_DRUPAL8
:
$account
=
$this
->
getDrupalAccount
(
$email
);
if
(
$account
)
{
$password_hasher
=
\
Drupal
::
service
(
'password'
);
if
(
$password_hasher
->
check
(
$password
,
$account
->
getPassword
()))
{
$uid
=
$account
->
uid
->
value
;
}
}
break
;
case
self
::
CMS_DRUPAL7
:
$account
=
$this
->
getDrupalAccount
(
$email
);
require_once
DRUPAL_ROOT
.
'/'
.
variable_get
(
'password_inc'
,
'includes/password.inc'
);
...
...
@@ -201,6 +216,7 @@ class CRM_CiviMobileAPI_Utils_CmsUser {
public
function
searchAccount
(
$identificator
)
{
$account
=
FALSE
;
switch
(
$this
->
system
)
{
case
self
::
CMS_DRUPAL8
:
case
self
::
CMS_DRUPAL7
:
$account
=
$this
->
getDrupalAccount
(
$identificator
);
break
;
...
...
CRM/CiviMobileAPI/Utils/File.php
View file @
aecebded
...
...
@@ -71,37 +71,21 @@ class CRM_CiviMobileAPI_Utils_File {
public
static
function
getFileUrl
(
$entityId
,
$entityTable
,
$filename
)
{
$url
=
''
;
$files
=
CRM_Core_BAO_File
::
getEntityFile
(
$entityTable
,
$entityId
);
$c
onfig
=
CRM_Core_Config
::
singleton
();
$c
urrentCMS
=
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
();
foreach
(
$files
as
$file
)
{
if
((
!
empty
(
$file
[
'fileName'
])
&&
$file
[
'fileName'
]
==
$filename
)
||
(
!
empty
(
$file
[
'cleanName'
])
&&
$file
[
'cleanName'
]
==
$filename
))
{
$url
=
$file
[
'url'
]
;
$url
=
CRM_Utils_System
::
url
(
'civicrm/file'
,
[
'filename'
=>
$filename
,
'mime-type'
=>
$file
[
'mime_type'
]],
TRUE
)
;
}
}
if
(
substr
(
$url
,
0
,
1
)
==
'/'
)
{
$url
=
substr
(
$url
,
1
);
}
//CiviCRM sometimes generate url with domain
$url
=
str_replace
(
$config
->
userFrameworkBaseURL
,
""
,
$url
);
$url
=
urldecode
(
$url
);
$currentCMS
=
CRM_CiviMobileAPI_Utils_CmsUser
::
getInstance
()
->
getSystem
();
if
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_WORDPRESS
)
{
if
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_JOOMLA
)
{
$url
=
preg_replace
(
'/administrator\//'
,
'index.php'
,
$url
);
}
elseif
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_WORDPRESS
)
{
$url
=
str_replace
(
"wp-admin/admin.php"
,
"index.php"
,
$url
);
}
if
(
$currentCMS
==
CRM_CiviMobileAPI_Utils_CmsUser
::
CMS_JOOMLA
)
{
$url
=
str_replace
(
"administrator/"
,
""
,
$config
->
userFrameworkBaseURL
)
.
$url
;
$url
=
str_replace
(
"administrator/"
,
"index.php"
,
$url
);
}
else
{
$url
=
$config
->
userFrameworkBaseURL
.
$url
;
}
$url
=
htmlspecialchars_decode
(
$url
);
return
$url
;
}
...
...
README.md
View file @
aecebded
...
...
@@ -39,7 +39,7 @@ The latest CiviMobile application can be downloaded from [AppStore](https://itun
-
CiviCRM v4.7.x+
-
PHP v5.4+
-
Drupal 7.x
-
Drupal 7.x
, 8.x
-
Joomla 3.x (CiviCRM 5.1+)
-
WordPress 4.8+
...
...
css/civimobileapiSettings.css
View file @
aecebded
...
...
@@ -15,3 +15,7 @@
.crm-container
table
.form-layout-compressed
{
width
:
100%
;
}
.crm-container
table
.form-layout-compressed
td
.label
{
display
:
table-cell
;
}
info.xml
View file @
aecebded
...
...
@@ -14,8 +14,8 @@
<url
desc=
"Support"
>
https://civimobile.org
</url>
<url
desc=
"Licensing"
>
http://www.gnu.org/licenses/agpl-3.0.html
</url>
</urls>
<releaseDate>
2020-
09
-0
2
</releaseDate>
<version>
5.
3
.0
</version>
<releaseDate>
2020-
12
-0
7
</releaseDate>
<version>
5.
4
.0
</version>
<compatibility>
<ver>
4.7
</ver>
<ver>
5.20
</ver>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment