Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/164675
Change subject: Upgrade CiviCRM to 4.2.19 upstream
......................................................................
Upgrade CiviCRM to 4.2.19 upstream
Change-Id: I1dc86c47206b9e1f2711aefd351784deb8668fc8
---
M CRM/Contact/Page/AJAX.php
M CRM/Core/BAO/CustomField.php
M CRM/Core/Permission.php
A CRM/Core/Permission/Base.php
M CRM/Core/Permission/Drupal.php
M CRM/Core/Permission/Drupal6.php
A CRM/Core/Permission/DrupalBase.php
M CRM/Core/Permission/Joomla.php
M CRM/Core/Permission/WordPress.php
A CRM/Core/Smarty/plugins/function.crmSigner.php
A CRM/Core/Smarty/plugins/function.crmVersion.php
M CRM/PCP/Page/PCPInfo.php
A CRM/Upgrade/Incremental/sql/4.2.18.mysql.tpl
A CRM/Upgrade/Incremental/sql/4.2.19.mysql.tpl
A CRM/Utils/Check/Message.php
M CRM/Utils/String.php
M civicrm-version.php
M drupal/civicrm.info
M drupal/modules/civicrm_contact_ref/civicrm_contact_ref.info
M drupal/modules/civicrm_engage/civicrm_engage.info
M drupal/modules/civicrm_group_roles/civicrm_group_roles.info
M drupal/modules/civicrm_member_roles/civicrm_member_roles.info
M drupal/modules/civicrm_og_sync/civicrm_og_sync.info
M drupal/modules/civicrm_rules/civicrm_rules.info
M drupal/modules/civicrmtheme/civicrmtheme.info
M sql/civicrm_data.mysql
M templates/CRM/common/checkUsernameAvailable.tpl
M templates/CRM/common/footer.tpl
M templates/CRM/common/version.tpl
29 files changed, 543 insertions(+), 103 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm
refs/changes/75/164675/1
diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php
index 03614b8..d1060a2 100644
--- a/CRM/Contact/Page/AJAX.php
+++ b/CRM/Contact/Page/AJAX.php
@@ -36,6 +36,15 @@
* This class contains all contact related functions that are called using
AJAX (jQuery)
*/
class CRM_Contact_Page_AJAX {
+ /**
+ * When a user chooses a username, CHECK_USERNAME_TTL
+ * is the time window in which they can check usernames
+ * (without reloading the overall form).
+ */
+ const CHECK_USERNAME_TTL = 10800; // 3hr; 3*60*60
+
+ const AUTOCOMPLETE_TTL = 21600; // 6hr; 6*60*60
+
static function getContactList() {
// if context is 'customfield'
if (CRM_Utils_Array::value('context', $_GET) == 'customfield') {
@@ -261,6 +270,13 @@
* Function to fetch the values
*/
static function autocomplete() {
+ $signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), array('cfid',
'ogid', 'sigts'));
+ if (CRM_Utils_Time::getTimeRaw() > $_REQUEST['sigts'] +
self::AUTOCOMPLETE_TTL
+ || !$signer->validate($_REQUEST['sig'], $_REQUEST)
+ ) {
+ CRM_Utils_System::civiExit();
+ }
+
$fieldID = CRM_Utils_Type::escape($_GET['cfid'], 'Integer');
$optionGroupID = CRM_Utils_Type::escape($_GET['ogid'], 'Integer');
$label = CRM_Utils_Type::escape($_GET['s'], 'String');
@@ -426,7 +442,7 @@
if ($organization) {
$query = "
-SELECT CONCAT_WS(' :: ',sort_name,LEFT(street_address,25),city) 'sort_name',
+SELECT CONCAT_WS(' :: ',sort_name,LEFT(street_address,25),city) 'sort_name',
civicrm_contact.id 'id'
FROM civicrm_contact
LEFT JOIN civicrm_address ON ( civicrm_contact.id = civicrm_address.contact_id
@@ -442,21 +458,21 @@
}
elseif ($hh) {
$query = "
-SELECT CONCAT_WS(' :: ' , sort_name, LEFT(street_address,25),city) 'sort_name'
, location_type_id 'location_type_id', is_primary 'is_primary', is_billing
'is_billing', civicrm_contact.id 'id'
-FROM civicrm_contact
+SELECT CONCAT_WS(' :: ' , sort_name, LEFT(street_address,25),city) 'sort_name'
, location_type_id 'location_type_id', is_primary 'is_primary', is_billing
'is_billing', civicrm_contact.id 'id'
+FROM civicrm_contact
LEFT JOIN civicrm_address ON (civicrm_contact.id =civicrm_address.contact_id
AND civicrm_address.is_primary =1 )
-WHERE civicrm_contact.contact_type ='Household'
+WHERE civicrm_contact.contact_type ='Household'
AND household_name LIKE '%$contactName%' {$addStreet} {$addCity}
{$whereIdClause} ORDER BY household_name ";
}
elseif ($relType) {
if (CRM_Utils_Array::value('case', $_GET)) {
$query = "
SELECT distinct(c.id), c.sort_name
-FROM civicrm_contact c
+FROM civicrm_contact c
LEFT JOIN civicrm_relationship ON civicrm_relationship.contact_id_{$rel} = c.id
WHERE c.sort_name LIKE '%$name%'
AND civicrm_relationship.relationship_type_id = $relType
-GROUP BY sort_name
+GROUP BY sort_name
";
}
}
@@ -524,8 +540,8 @@
/**
*
- * Function to check how many contact exits in db for given criteria,
- * if one then return contact id else null
+ * Function to check how many contact exits in db for given criteria,
+ * if one then return contact id else null
*/
static function contact() {
$name = CRM_Utils_Type::escape($_GET['name'], 'String');
@@ -612,6 +628,17 @@
*
*/
static public function checkUserName() {
+ $signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), array('for',
'ts'));
+ if (
+ CRM_Utils_Time::getTimeRaw() > $_REQUEST['ts'] + self::CHECK_USERNAME_TTL
+ || $_REQUEST['for'] != 'civicrm/ajax/cmsuser'
+ || !$signer->validate($_REQUEST['sig'], $_REQUEST)
+ ) {
+ $user = array('name' => 'error');
+ echo json_encode($user);
+ CRM_Utils_System::civiExit();
+ }
+
$config = CRM_Core_Config::singleton();
$username = trim(htmlentities($_POST['cms_name']));
@@ -637,8 +664,12 @@
* Function to get email address of a contact
*/
static function getContactEmail() {
- if (CRM_Utils_Array::value('contact_id', $_POST)) {
- $contactID = CRM_Utils_Type::escape($_POST['contact_id'], 'Positive');
+ if (CRM_Utils_Array::value('contact_id', $_REQUEST)) {
+ $contactID = CRM_Utils_Type::escape($_REQUEST['contact_id'], 'Positive');
+ if (!CRM_Contact_BAO_Contact_Permission::allow($contactID,
CRM_Core_Permission::EDIT)) {
+ return;
+ }
+
list($displayName,
$userEmail
) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
@@ -682,7 +713,7 @@
if ($noemail) {
$query = "
SELECT sort_name name, cc.id
-FROM civicrm_contact cc
+FROM civicrm_contact cc
{$aclFrom}
WHERE cc.is_deceased = 0 AND {$queryString}
{$aclWhere}
@@ -775,7 +806,7 @@
$query = "
SELECT sort_name name, cp.phone, cc.id
-FROM civicrm_phone cp INNER JOIN civicrm_contact cc ON cc.id = cp.contact_id
+FROM civicrm_phone cp INNER JOIN civicrm_contact cc ON cc.id = cp.contact_id
{$aclFrom}
WHERE cc.is_deceased = 0 AND cc.do_not_sms = 0 AND cp.phone_type_id =
{$mobileType} AND {$queryString}
{$aclWhere}
@@ -1077,7 +1108,7 @@
$selectorElements = array('src', 'dst', 'weight', 'actions');
- $join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 =
de.contact_id1 AND
+ $join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 =
de.contact_id1 AND
pn.entity_id2 =
de.contact_id2 )";
$where = "de.id IS NULL";
@@ -1146,7 +1177,7 @@
}
echo json_encode($elements);
- CRM_Utils_System::civiExit();
+ CRM_Utils_System::civiExit();
}
static function selectUnselectContacts() {
@@ -1197,7 +1228,7 @@
if (!$contactId) {
$addressVal["error_message"] = "no contact id found";
} else {
- $entityBlock =
+ $entityBlock =
array(
'contact_id' => $contactId,
'entity_id' => $contactId
@@ -1205,6 +1236,6 @@
$addressVal = CRM_Core_BAO_Address::getValues($entityBlock);
}
echo json_encode($addressVal);
- CRM_Utils_System::civiExit();
+ CRM_Utils_System::civiExit();
}
}
diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php
index c5ddfca..e2ea0d4 100644
--- a/CRM/Core/BAO/CustomField.php
+++ b/CRM/Core/BAO/CustomField.php
@@ -976,10 +976,15 @@
$qf->addRule($elementName, ts('Select a valid contact for %1.',
array(1 => $label)), 'validContact', $actualElementValue);
}
else {
- $customUrls[$elementName] =
CRM_Utils_System::url('civicrm/ajax/auto',
- "reset=1&ogid={$field->option_group_id}&cfid={$field->id}",
- FALSE, NULL, FALSE
+ $signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(),
array('cfid','ogid','sigts'));
+ $signParams = array(
+ 'reset' => 1,
+ 'sigts' => CRM_Utils_Time::getTimeRaw(),
+ 'ogid' => $field->option_group_id,
+ 'cfid' => $field->id,
);
+ $signParams['sig'] = $signer->sign($signParams);
+ $customUrls[$elementName] =
CRM_Utils_System::url('civicrm/ajax/auto', $signParams, FALSE, NULL, FALSE);
$qf->addRule($elementName, ts('Select a valid value for %1.',
array(1 => $label)),
'autocomplete', array(
'fieldID' => $field->id,
diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php
index 55876c3..b3797db 100644
--- a/CRM/Core/Permission.php
+++ b/CRM/Core/Permission.php
@@ -54,6 +54,16 @@
CONST EDIT = 1, VIEW = 2, DELETE = 3, CREATE = 4, SEARCH = 5, ALL = 6, ADMIN
= 7;
/**
+ * A placeholder permission which always fails
+ */
+ const ALWAYS_DENY_PERMISSION = "*always deny*";
+
+ /**
+ * A placeholder permission which always fails
+ */
+ const ALWAYS_ALLOW_PERMISSION = "*always allow*";
+
+ /**
* get the current permission of this user
*
* @return string the permission of the user (edit or view or null)
diff --git a/CRM/Core/Permission/Base.php b/CRM/Core/Permission/Base.php
new file mode 100644
index 0000000..d32d2ea
--- /dev/null
+++ b/CRM/Core/Permission/Base.php
@@ -0,0 +1,63 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.4 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2013
+ * $Id$
+ *
+ */
+
+/**
+ *
+ */
+class CRM_Core_Permission_Base {
+
+ /**
+ * Translate permission
+ *
+ * @param string $name e.g. "administer CiviCRM", "cms:access user record",
"Drupal:administer content", "Joomla:action:com_asset"
+ * @param string $nativePrefix
+ * @param array $map array($portableName => $nativeName)
+ *
+ * @return NULL|string a permission name
+ */
+ static public function translatePermission($perm, $nativePrefix, $map) {
+ list ($civiPrefix, $name) = CRM_Utils_String::parsePrefix(':', $perm,
NULL);
+ switch ($civiPrefix) {
+ case $nativePrefix:
+ return $name; // pass through
+ case 'cms':
+ return CRM_Utils_Array::value($name, $map,
CRM_Core_Permission::ALWAYS_DENY_PERMISSION);
+ case NULL:
+ return $name;
+ default:
+ return CRM_Core_Permission::ALWAYS_DENY_PERMISSION;
+ }
+ }
+}
diff --git a/CRM/Core/Permission/Drupal.php b/CRM/Core/Permission/Drupal.php
index 3a834fc..be40608 100644
--- a/CRM/Core/Permission/Drupal.php
+++ b/CRM/Core/Permission/Drupal.php
@@ -36,7 +36,7 @@
/**
*
*/
-class CRM_Core_Permission_Drupal {
+class CRM_Core_Permission_Drupal extends CRM_Core_Permission_DrupalBase{
/**
* is this user someone with access for the entire system
@@ -187,10 +187,10 @@
$whereTables['civicrm_group_contact'] = 1;
if($entityTable == 'civicrm_contact'){
- // foreach group that is potentially a saved search, add the saved
search clause if we are trying to determin
- // which contacts can be seen. per CRM-10667 - we don't need to add
smart group clauses if after a
- // list of groups
- foreach (array_keys(self::$_viewPermissionedGroups[$groupKey]) as $id)
{
+ // foreach group that is potentially a saved search, add the saved
search clause if we are trying to determin
+ // which contacts can be seen. per CRM-10667 - we don't need to add
smart group clauses if after a
+ // list of groups
+ foreach (array_keys(self::$_viewPermissionedGroups[$groupKey]) as
$id) {
$group = new CRM_Contact_DAO_Group();
$group->id = $id;
if ($group->find(TRUE) && $group->saved_search_id) {
@@ -253,24 +253,23 @@
* @param string $str the permission to check
*
* @return boolean true if yes, else false
- * @static
* @access public
*/
static function check($str, $contactID = NULL) {
+ $str = parent::translatePermission($str, 'Drupal', array(
+ 'view user account' => 'access user profiles',
+ 'administer users' => 'administer users',
+ ));
+ if ($str == CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
+ return FALSE;
+ }
+ if ($str == CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
+ return TRUE;
+ }
if (function_exists('user_access')) {
return user_access($str) ? TRUE : FALSE;
}
return TRUE;
-
- /**
- * lets introduce acl in 2.1
- static $isAdmin = null;
- if ( $isAdmin === null ) {
- $session = CRM_Core_Session::singleton( );
- $isAdmin = $session->get( 'ufID' ) == 1 ? true : false;
- }
- return ( $isAdmin) ? true : CRM_ACL_API::check( $str, $contactID );
- */
}
/**
diff --git a/CRM/Core/Permission/Drupal6.php b/CRM/Core/Permission/Drupal6.php
index 2013ba7..2cc1503 100644
--- a/CRM/Core/Permission/Drupal6.php
+++ b/CRM/Core/Permission/Drupal6.php
@@ -36,7 +36,7 @@
/**
*
*/
-class CRM_Core_Permission_Drupal6 {
+class CRM_Core_Permission_Drupal6 extends CRM_Core_Permission_DrupalBase{
/**
* is this user someone with access for the entire system
@@ -187,9 +187,9 @@
$whereTables['civicrm_group_contact'] = 1;
if($entityTable == 'civicrm_contact'){
- // foreach group that is potentially a saved search, add the saved
search clause if we are trying to determin
- // which contacts can be seen. per CRM-10667 - we don't need to add
smart group clauses if after a
- // list of groups
+ // foreach group that is potentially a saved search, add the saved
search clause if we are trying to determin
+ // which contacts can be seen. per CRM-10667 - we don't need to add
smart group clauses if after a
+ // list of groups
}
@@ -238,25 +238,23 @@
* @param string $str the permission to check
*
* @return boolean true if yes, else false
- * @static
* @access public
*/
- static
- function check($str, $contactID = NULL) {
+ static function check($str, $contactID = NULL) {
+ $str = parent::translatePermission($str, 'Drupal6', array(
+ 'view user account' => 'access user profiles',
+ 'administer users' => 'administer users',
+ ));
+ if ($str == CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
+ return FALSE;
+ }
+ if ($str == CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
+ return TRUE;
+ }
if (function_exists('user_access')) {
return user_access($str) ? TRUE : FALSE;
}
return TRUE;
-
- /**
- * lets introduce acl in 2.1
- static $isAdmin = null;
- if ( $isAdmin === null ) {
- $session = CRM_Core_Session::singleton( );
- $isAdmin = $session->get( 'ufID' ) == 1 ? true : false;
- }
- return ( $isAdmin) ? true : CRM_ACL_API::check( $str, $contactID );
- */
}
/**
@@ -282,4 +280,3 @@
return FALSE;
}
}
-
diff --git a/CRM/Core/Permission/DrupalBase.php
b/CRM/Core/Permission/DrupalBase.php
new file mode 100644
index 0000000..7f7fcfd
--- /dev/null
+++ b/CRM/Core/Permission/DrupalBase.php
@@ -0,0 +1,41 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.4 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2013
+ * $Id$
+ *
+ */
+
+/**
+ *
+ */
+class CRM_Core_Permission_DrupalBase extends CRM_Core_Permission_Base {
+
+}
diff --git a/CRM/Core/Permission/Joomla.php b/CRM/Core/Permission/Joomla.php
index c1e3bbb..44b9b86 100644
--- a/CRM/Core/Permission/Joomla.php
+++ b/CRM/Core/Permission/Joomla.php
@@ -36,7 +36,7 @@
/**
*
*/
-class CRM_Core_Permission_Joomla {
+class CRM_Core_Permission_Joomla extends CRM_Core_Permission_Base {
/**
* get the current permission of this user
@@ -90,20 +90,51 @@
static function check($str) {
$config = CRM_Core_Config::singleton();
+ $translated = self::translateJoomlaPermission($str);
+ if ($translated === CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
+ return FALSE;
+ }
+ if ($translated === CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
+ return TRUE;
+ }
+
// ensure that we are running in a joomla context
// we've not yet figured out how to bootstrap joomla, so we should
// not execute hooks if joomla is not loaded
if (defined('_JEXEC')) {
- $permissionStr = 'civicrm.' . CRM_Utils_String::munge(strtolower($str));
- $permission = JFactory::getUser()->authorise($permissionStr,
'com_civicrm');
+ $permission = JFactory::getUser()->authorise($translated[0],
$translated[1]);
return $permission;
}
else {
+ // This function is supposed to return a boolean. What does '(1)' mean?
return '(1)';
}
}
/**
+ * @param string $name e.g. "administer CiviCRM", "cms:access user record",
"Drupal:administer content", "Joomla:example.action:com_some_asset"
+ * @return ALWAYS_DENY_PERMISSION|ALWAYS_ALLOW_PERMISSION|array(0 =>
$joomlaAction, 1 => $joomlaAsset)
+ */
+ function translateJoomlaPermission($perm) {
+ if ($perm === CRM_Core_Permission::ALWAYS_DENY_PERMISSION || $perm ===
CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
+ return $perm;
+ }
+
+ list ($civiPrefix, $name) = CRM_Utils_String::parsePrefix(':', $perm,
NULL);
+ switch($civiPrefix) {
+ case 'Joomla':
+ return explode(':', $name);
+ case 'cms':
+ // FIXME: This needn't be DENY, but we don't currently have any
translations.
+ return CRM_Core_Permission::ALWAYS_DENY_PERMISSION;
+ case NULL:
+ return array('civicrm.' . CRM_Utils_String::munge(strtolower($name)),
'com_civicrm');
+ default:
+ return CRM_Core_Permission::ALWAYS_DENY_PERMISSION;
+ }
+ }
+
+ /**
* Given a roles array, check for access requirements
*
* @param array $array the roles to check
diff --git a/CRM/Core/Permission/WordPress.php
b/CRM/Core/Permission/WordPress.php
index e55e6c9..adf7099 100644
--- a/CRM/Core/Permission/WordPress.php
+++ b/CRM/Core/Permission/WordPress.php
@@ -36,7 +36,7 @@
/**
*
*/
-class CRM_Core_Permission_WordPress {
+class CRM_Core_Permission_WordPress extends CRM_Core_Permission_Base {
/**
* get the current permission of this user
@@ -89,6 +89,16 @@
*/
static
function check($str) {
+ $str = parent::translatePermission($str, 'WordPress', array(
+ 'view user account' => 'administrator',
+ ));
+ if ($str == CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
+ return FALSE;
+ }
+ if ($str == CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
+ return TRUE;
+ }
+
// for administrators give them all permissions
if (!function_exists('current_user_can')) {
return TRUE;
diff --git a/CRM/Core/Smarty/plugins/function.crmSigner.php
b/CRM/Core/Smarty/plugins/function.crmSigner.php
new file mode 100644
index 0000000..f023811
--- /dev/null
+++ b/CRM/Core/Smarty/plugins/function.crmSigner.php
@@ -0,0 +1,60 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.4 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC
+ * $Id$
+ *
+ */
+
+/**
+ * Generate a secure signature
+ *
+ * {code}
+ * {crmSigner var=mySig extra=123}
+ * var urlParams = ts={$mySig.ts}&extra={$mySig.extra}&sig={$mySig.signature}
+ * {endcode}
+ *
+ * @param $params array with keys:
+ * - var: string, a smarty variable to generate
+ * - ts: int, the current time (if omitted, autogenerated)
+ * - any other vars are put into the signature (sorted)
+ */
+function smarty_function_crmSigner($params, &$smarty) {
+ $var = $params['var'];
+ unset($params['var']);
+ $params['ts'] = CRM_Utils_Time::getTimeRaw();
+
+ $fields = array_keys($params);
+ sort($fields);
+
+ $signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), $fields);
+ $params['signature'] = $signer->sign($params);
+ $smarty->assign($var, $params);
+}
diff --git a/CRM/Core/Smarty/plugins/function.crmVersion.php
b/CRM/Core/Smarty/plugins/function.crmVersion.php
new file mode 100644
index 0000000..ad8c0d4
--- /dev/null
+++ b/CRM/Core/Smarty/plugins/function.crmVersion.php
@@ -0,0 +1,60 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.4 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CRM
+ * @copyright TTTP
+ * $Id$
+ *
+ */
+
+/**
+ * Display the CiviCRM version
+ *
+ * @code
+ * The version is {crmVersion}.
+ *
+ * {crmVersion redact=auto assign=ver}The version is {$ver}.
+ * @endcode
+ */
+function smarty_function_crmVersion($params, &$smarty) {
+ $version = CRM_Utils_System::version();
+
+ $redact = !CRM_Core_Permission::check('access CiviCRM');
+ if ($redact) {
+ $parts = explode('.', $version);
+ $version = $parts[0] . '.' . $parts[1];
+ }
+
+ if (isset($params['assign'])) {
+ $smarty->assign($params['assign'], $version);
+ }
+ else {
+ return $version;
+ }
+}
\ No newline at end of file
diff --git a/CRM/PCP/Page/PCPInfo.php b/CRM/PCP/Page/PCPInfo.php
index 642dfeb..2ebd15a 100644
--- a/CRM/PCP/Page/PCPInfo.php
+++ b/CRM/PCP/Page/PCPInfo.php
@@ -205,9 +205,12 @@
$honor = CRM_PCP_BAO_PCP::honorRoll($this->_id);
- if ($file_id = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile',
$this->_id, 'file_id', 'entity_id')) {
+ $entityFile = CRM_Core_BAO_File::getEntityFile('civicrm_pcp', $this->_id);
+ if (!empty($entityFile)) {
+ $fileInfo = reset($entityFile);
+ $fileId = $fileInfo['fileID'];
$image = '<img src="' . CRM_Utils_System::url('civicrm/file',
- "reset=1&id=$file_id&eid={$this->_id}"
+ "reset=1&id=$fileId&eid={$this->_id}"
) . '" />';
$this->assign('image', $image);
}
diff --git a/CRM/Upgrade/Incremental/sql/4.2.18.mysql.tpl
b/CRM/Upgrade/Incremental/sql/4.2.18.mysql.tpl
new file mode 100644
index 0000000..b2e7296
--- /dev/null
+++ b/CRM/Upgrade/Incremental/sql/4.2.18.mysql.tpl
@@ -0,0 +1 @@
+{* file to handle db changes in 4.2.18 during upgrade *}
diff --git a/CRM/Upgrade/Incremental/sql/4.2.19.mysql.tpl
b/CRM/Upgrade/Incremental/sql/4.2.19.mysql.tpl
new file mode 100644
index 0000000..aea84ab
--- /dev/null
+++ b/CRM/Upgrade/Incremental/sql/4.2.19.mysql.tpl
@@ -0,0 +1 @@
+{* file to handle db changes in 4.2.19 during upgrade *}
diff --git a/CRM/Utils/Check/Message.php b/CRM/Utils/Check/Message.php
new file mode 100644
index 0000000..1dfb818
--- /dev/null
+++ b/CRM/Utils/Check/Message.php
@@ -0,0 +1,93 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.5 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2014
+ * $Id: $
+ *
+ */
+class CRM_Utils_Check_Message {
+ /**
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @var string
+ */
+ private $message;
+
+ /**
+ * @var string
+ */
+ private $title;
+
+ /**
+ * @param $name
+ * @param $message
+ * @param $title
+ */
+ function __construct($name, $message, $title) {
+ $this->name = $name;
+ $this->message = $message;
+ $this->title = $title;
+ }
+
+ /**
+ * @return string
+ */
+ function getName() {
+ return $this->name;
+ }
+
+ /**
+ * @return string
+ */
+ function getMessage() {
+ return $this->message;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTitle() {
+ return $this->title;
+ }
+
+ /**
+ * @return array
+ */
+ function toArray() {
+ return array(
+ 'name' => $this->name,
+ 'message' => $this->message,
+ 'title' => $this->title,
+ );
+ }
+}
diff --git a/CRM/Utils/String.php b/CRM/Utils/String.php
index 07545d8..606bc24 100644
--- a/CRM/Utils/String.php
+++ b/CRM/Utils/String.php
@@ -628,5 +628,23 @@
}
return $result;
}
+
+ /**
+ * Examples:
+ * "admin foo" => array(NULL,"admin foo")
+ * "cms:admin foo" => array("cms", "admin foo")
+ *
+ * @param string $string e.g. "view all contacts". Syntax: "[prefix:]name"
+ * @return array (0 => string|NULL $prefix, 1 => string $value)
+ */
+ public static function parsePrefix($delim, $string, $defaultPrefix = NULL) {
+ $pos = strpos($string, $delim);
+ if ($pos === FALSE) {
+ return array($defaultPrefix, $string);
+ }
+ else {
+ return array(substr($string, 0, $pos), substr($string, 1+$pos));
+ }
+ }
}
diff --git a/civicrm-version.php b/civicrm-version.php
index 22e08ce..2499dec 100644
--- a/civicrm-version.php
+++ b/civicrm-version.php
@@ -1,7 +1,7 @@
<?php
function civicrmVersion( ) {
- return array( 'version' => '4.2.17',
+ return array( 'version' => '4.2.19',
'cms' => 'Drupal',
- 'revision' => 'c4d6febe4b' );
+ 'revision' => 'b99b3d5a2f' );
}
diff --git a/drupal/civicrm.info b/drupal/civicrm.info
index bb123ee..7046f91 100644
--- a/drupal/civicrm.info
+++ b/drupal/civicrm.info
@@ -1,6 +1,6 @@
name = CiviCRM
description = Constituent Relationship Management CRM - v4.2. Allows sites to
manage contacts, relationships and groups, and track contact activities,
contributions, memberships and events.
-version = 4.2.17
+version = 4.2.19
package = CiviCRM
core = 7.x
php = 5.2
diff --git a/drupal/modules/civicrm_contact_ref/civicrm_contact_ref.info
b/drupal/modules/civicrm_contact_ref/civicrm_contact_ref.info
index b89882f..52b7bef 100644
--- a/drupal/modules/civicrm_contact_ref/civicrm_contact_ref.info
+++ b/drupal/modules/civicrm_contact_ref/civicrm_contact_ref.info
@@ -3,7 +3,7 @@
description = Makes a CiviCRM Contact Reference Field
package = CiviCRM
core = 7.x
-version = 4.2.17
+version = 4.2.19
php = 5.2
dependencies[] = civicrm
diff --git a/drupal/modules/civicrm_engage/civicrm_engage.info
b/drupal/modules/civicrm_engage/civicrm_engage.info
index 7314a5a..eafc786 100755
--- a/drupal/modules/civicrm_engage/civicrm_engage.info
+++ b/drupal/modules/civicrm_engage/civicrm_engage.info
@@ -1,6 +1,6 @@
name = CiviEngage
description = Walklist and Phone-banking support for CiviCRM
-version = 4.2.17
+version = 4.2.19
dependencies[] = civicrm
package = CiviCRM
core = 7.x
diff --git a/drupal/modules/civicrm_group_roles/civicrm_group_roles.info
b/drupal/modules/civicrm_group_roles/civicrm_group_roles.info
index b97cdbd..8a3d76f 100644
--- a/drupal/modules/civicrm_group_roles/civicrm_group_roles.info
+++ b/drupal/modules/civicrm_group_roles/civicrm_group_roles.info
@@ -2,7 +2,7 @@
description = Sync Drupal Roles to CiviCRM Groups.
package = CiviCRM
core = 7.x
-version = 4.2.17
+version = 4.2.19
dependencies[] = civicrm
configure = admin/config/civicrm/civicrm_group_roles
files[] = civicrm_group_roles.module
diff --git a/drupal/modules/civicrm_member_roles/civicrm_member_roles.info
b/drupal/modules/civicrm_member_roles/civicrm_member_roles.info
index bed9381..6d15855 100644
--- a/drupal/modules/civicrm_member_roles/civicrm_member_roles.info
+++ b/drupal/modules/civicrm_member_roles/civicrm_member_roles.info
@@ -8,7 +8,7 @@
dependencies[] = civicrm
package = CiviCRM
core = 7.x
-version = 4.2.17
+version = 4.2.19
configure = admin/config/civicrm/civicrm_member_roles
files[] = civicrm_member_roles.module
files[] = civicrm_member_roles.install
diff --git a/drupal/modules/civicrm_og_sync/civicrm_og_sync.info
b/drupal/modules/civicrm_og_sync/civicrm_og_sync.info
index 2a07602..836360c 100644
--- a/drupal/modules/civicrm_og_sync/civicrm_og_sync.info
+++ b/drupal/modules/civicrm_og_sync/civicrm_og_sync.info
@@ -1,6 +1,6 @@
name = CiviCRM OG Sync
description = Synchronize Organic Groups and CiviCRM Groups and ACL's. More
information at:
http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+vs.+Organic+Groups
-version = 4.2.17
+version = 4.2.19
dependencies[] = civicrm
dependencies[] = og
package = CiviCRM
diff --git a/drupal/modules/civicrm_rules/civicrm_rules.info
b/drupal/modules/civicrm_rules/civicrm_rules.info
index 1b08ad9..d2c680d 100644
--- a/drupal/modules/civicrm_rules/civicrm_rules.info
+++ b/drupal/modules/civicrm_rules/civicrm_rules.info
@@ -4,4 +4,4 @@
dependencies[] = rules
package = CiviCRM
core = 7.x
-version = 4.2.17
+version = 4.2.19
diff --git a/drupal/modules/civicrmtheme/civicrmtheme.info
b/drupal/modules/civicrmtheme/civicrmtheme.info
index 8ecfe09..a71e19a 100644
--- a/drupal/modules/civicrmtheme/civicrmtheme.info
+++ b/drupal/modules/civicrmtheme/civicrmtheme.info
@@ -1,7 +1,7 @@
name = CiviCRM Theme
description = Define alternate themes for CiviCRM.
core = 7.x
-version = 4.2.17
+version = 4.2.19
package = CiviCRM
dependencies[] = civicrm
diff --git a/sql/civicrm_data.mysql b/sql/civicrm_data.mysql
index 3a1668f..5ea062c 100644
--- a/sql/civicrm_data.mysql
+++ b/sql/civicrm_data.mysql
@@ -19446,4 +19446,4 @@
VALUES
( @domainID, CONCAT('civicrm/report/instance/', @instanceID,'&reset=1'),
'Mailing Detail Report', 'Mailing Detail Report', 'administer CiviMail', 'OR',
@reportlastID, '1', NULL, @instanceID+2 );
UPDATE civicrm_report_instance SET navigation_id = LAST_INSERT_ID() WHERE id =
@instanceID;
- UPDATE civicrm_domain SET version = '4.2.17';
\ No newline at end of file
+ UPDATE civicrm_domain SET version = '4.2.19';
\ No newline at end of file
diff --git a/templates/CRM/common/checkUsernameAvailable.tpl
b/templates/CRM/common/checkUsernameAvailable.tpl
index 5395c5b..26f1ad7 100644
--- a/templates/CRM/common/checkUsernameAvailable.tpl
+++ b/templates/CRM/common/checkUsernameAvailable.tpl
@@ -24,6 +24,7 @@
+--------------------------------------------------------------------+
*}
{* This included tpl checks if a given username is taken or available. *}
+{crmSigner var=checkUserSig for=civicrm/ajax/cmsuser}
{literal}
var lastName = null;
cj("#checkavailability").click(function() {
@@ -37,46 +38,57 @@
var spchar = "\<|\>|\"|\'|\%|\;|\(|\)|\&|\\\\|\/";
{/literal}{if $config->userSystem->is_drupal == "1"}{literal}
- spchar = spchar +
"|\~|\`|\:|\@|\!|\=|\#|\$|\^|\*|\{|\}|\\[|\\]|\+|\?|\,";
- {/literal}{/if}{literal}
+ spchar = spchar +
"|\~|\`|\:|\@|\!|\=|\#|\$|\^|\*|\{|\}|\\[|\\]|\+|\?|\,";
+ {/literal}{/if}{literal}
var r = new RegExp( "["+spchar+"]", "i");
/*regular expression \\ matches a single backslash. this becomes r = /\\/
or r = new RegExp("\\\\").*/
if ( r.exec(cmsUserName) ) {
alert('{/literal}{ts escape="js"}Your username contains invalid
characters{/ts}{literal}');
return;
- }
+ }
{/literal}{if $config->userFramework == "Joomla"}{literal}
else if ( cmsUserName && cmsUserName.length < 2 ) {
alert('{/literal}{ts escape="js"}Your username is too
short{/ts}{literal}');
- return;
+ return;
}
{/literal}{/if}{literal}
if (cmsUserName) {
- /*take all messages in javascript variable*/
- var check = "{/literal}{ts}Checking...{/ts}{literal}";
- var available = "{/literal}{ts}This username is currently
available.{/ts}{literal}";
- var notavailable = "{/literal}{ts}This username is
taken.{/ts}{literal}";
-
+ /*take all messages in javascript variable*/
+ var check = "{/literal}{ts escape='js'}Checking...{/ts}{literal}";
+ var available = "{/literal}{ts escape='js'}This username is currently
available.{/ts}{literal}";
+ var notavailable = "{/literal}{ts escape='js'}This username is
taken.{/ts}{literal}";
+ var errorMsg = "{/literal}{ts escape='js'}Error checking username.
Please reload the form and try again.{/ts}{literal}";
+
//remove all the class add the messagebox classes and start fading
cj("#msgbox").removeClass().addClass('cmsmessagebox').css({"color":"#000","backgroundColor":"#FFC","border":"1px
solid #c93"}).text(check).fadeIn("slow");
-
- //check the username exists or not from ajax
- var contactUrl = {/literal}"{crmURL p='civicrm/ajax/cmsuser' h=0
}"{literal};
-
- cj.post(contactUrl,{ cms_name:cj("#cms_name").val() } ,function(data) {
- if ( data.name == "no") {/*if username not avaiable*/
- cj("#msgbox").fadeTo(200,0.1,function() {
-
cj(this).html(notavailable).addClass('cmsmessagebox').css({"color":"#CC0000","backgroundColor":"#F7CBCA","border":"1px
solid #CC0000"}).fadeTo(900,1);
- });
- } else {
- cj("#msgbox").fadeTo(200,0.1,function() {
-
cj(this).html(available).addClass('cmsmessagebox').css({"color":"#008000","backgroundColor":"#C9FFCA",
"border": "1px solid #349534"}).fadeTo(900,1);
- });
- }
- }, "json");
- lastName = cmsUserName;
+
+ //check the username exists or not from ajax
+ var contactUrl = {/literal}"{crmURL p='civicrm/ajax/cmsuser' h=0
}"{literal};
+
+ var checkUserParams = {
+ cms_name: cj("#cms_name").val(),
+ ts: {/literal}"{$checkUserSig.ts}"{literal},
+ sig: {/literal}"{$checkUserSig.signature}"{literal},
+ for: 'civicrm/ajax/cmsuser'
+ };
+ cj.post(contactUrl, checkUserParams ,function(data) {
+ if ( data.name == "no") {/*if username not avaiable*/
+ cj("#msgbox").fadeTo(200,0.1,function() {
+
cj(this).html(notavailable).addClass('cmsmessagebox').css({"color":"#CC0000","backgroundColor":"#F7CBCA","border":"1px
solid #CC0000"}).fadeTo(900,1);
+ });
+ } else if ( data.name == "error") {/*if username not avaiable*/
+ cj("#msgbox").fadeTo(200,0.1,function() {
+
cj(this).html(errorMsg).addClass('cmsmessagebox').css({"color":"#CC0000","backgroundColor":"#F7CBCA","border":"1px
solid #CC0000"}).fadeTo(900,1);
+ });
+ } else {
+ cj("#msgbox").fadeTo(200,0.1,function() {
+
cj(this).html(available).addClass('cmsmessagebox').css({"color":"#008000","backgroundColor":"#C9FFCA",
"border": "1px solid #349534"}).fadeTo(900,1);
+ });
+ }
+ }, "json");
+ lastName = cmsUserName;
} else {
cj("#msgbox").removeClass().text('').css({"backgroundColor":"#FFFFFF",
"border": "0px #FFFFFF"}).fadeIn("fast");
}
});
-{/literal}
\ No newline at end of file
+{/literal}
diff --git a/templates/CRM/common/footer.tpl b/templates/CRM/common/footer.tpl
index fb1afc6..827a8c4 100644
--- a/templates/CRM/common/footer.tpl
+++ b/templates/CRM/common/footer.tpl
@@ -37,10 +37,15 @@
</div>
{/if}
-<div class="footer" id="civicrm-footer">
-{ts 1=$version}Powered by CiviCRM %1.{/ts}
-{ts 1='http://www.gnu.org/licenses/agpl-3.0.html'}CiviCRM is openly available
under the <a href='%1'>GNU Affero General Public License (GNU
AGPL)</a>.{/ts}<br/>
-<a href='http://civicrm.org/download'>{ts}Download source.{/ts}</a>
-<a
href='http://issues.civicrm.org/jira/browse/CRM?report=com.atlassian.jira.plugin.system.project:roadmap-panel'>{ts}View
issues and report bugs.{/ts}</a>
-{docURL page="" text="Online documentation."}
+<div class="footer crm-footer" id="civicrm-footer">
+ {crmVersion assign=version}
+ {ts 1=$version}Powered by CiviCRM %1.{/ts}
+ {if !empty($newer_civicrm_version)}
+ <span class="status">{ts 1=$newer_civicrm_version}A newer version (%1){/ts}
+ <a href="http://civicrm.org/download">{ts}is available for
download{/ts}</a>.</span>
+ {/if}
+ {ts 1='http://www.gnu.org/licenses/agpl-3.0.html'}CiviCRM is openly
available under the <a href='%1'>GNU AGPL License</a>.{/ts}<br/>
+ <a href="http://civicrm.org/download">{ts}Download CiviCRM.{/ts}</a>
+ <a
href="http://issues.civicrm.org/jira/browse/CRM?report=com.atlassian.jira.plugin.system.project:roadmap-panel">{ts}View
issues and report bugs.{/ts}</a>
+ {docURL page="" text="Online documentation."}
</div>
diff --git a/templates/CRM/common/version.tpl b/templates/CRM/common/version.tpl
index d5e0e3c..9bde2e8 100644
--- a/templates/CRM/common/version.tpl
+++ b/templates/CRM/common/version.tpl
@@ -1 +1 @@
-4.2.17
\ No newline at end of file
+4.2.19
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/164675
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1dc86c47206b9e1f2711aefd351784deb8668fc8
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits