diff --git a/CRM/Core/Config/Defaults.php b/CRM/Core/Config/Defaults.php index 664b798a094e572041baadbb13dde5295cc09e35..52d49deab8fc97bdf56d327339cbe43806a367a0 100644 --- a/CRM/Core/Config/Defaults.php +++ b/CRM/Core/Config/Defaults.php @@ -67,10 +67,6 @@ class CRM_Core_Config_Defaults { //$this->revampPages = array( 'CRM/Admin/Form/Setting/Url.tpl', 'CRM/Admin/Form/Preferences/Address.tpl' ); $this->revampPages = array(); - // IDS enablement - $this->useIDS = defined('CIVICRM_IDS_ENABLE') ? (bool) CIVICRM_IDS_ENABLE : TRUE; - - // $size = trim(ini_get('upload_max_filesize')); if ($size) { $last = strtolower($size{strlen($size) - 1}); diff --git a/CRM/Core/Form/Date.php b/CRM/Core/Form/Date.php index 7693b97eae1d965d598c1246062d6b1e787876fb..af50497fe97cdf0a8c2973deeac6cbb43ca399bb 100644 --- a/CRM/Core/Form/Date.php +++ b/CRM/Core/Form/Date.php @@ -89,9 +89,24 @@ Class CRM_Core_Form_Date { * @access public */ - static function buildDateRange(&$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $operators = array(), $dateFormat = 'searchDate', $displayTime = FALSE) { - $selector = CRM_Core_Form_Date::returnDateRangeSelector($form, $fieldName, $count, $from, $to, $fromLabel, $required, $operators, $dateFormat, $displayTime); - CRM_Core_Form_Date::addDateRangeToForm($form, $fieldName, $selector, $from, $to, $fromLabel, $required , $dateFormat, $displayTime); + static function buildDateRange( + &$form, $fieldName, $count = 1, + $from = '_from', $to = '_to', $fromLabel = 'From:', + $required = FALSE, $operators = array(), + $dateFormat = 'searchDate', $displayTime = FALSE + ) { + $selector = + CRM_Core_Form_Date::returnDateRangeSelector( + $form, $fieldName, $count, + $from, $to, $fromLabel, + $required, $operators, + $dateFormat, $displayTime + ); + CRM_Core_Form_Date::addDateRangeToForm( + $form, $fieldName, $selector, + $from, $to, $fromLabel, + $required, $dateFormat, $displayTime + ); } /** @@ -110,47 +125,54 @@ Class CRM_Core_Form_Date { * @param Boolean $displayTime * @return array Values for Selector */ - static function returnDateRangeSelector(&$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $operators = array(), $dateFormat = 'searchDate', $displayTime = FALSE) { - $selector = array('' => ts('- any -'), - 0 => ts('Choose Date Range'), - 'this.year' => ts('This Year'), - 'this.fiscal_year' => ts('This Fiscal Year'), - 'this.quarter' => ts('This Quarter'), - 'this.month' => ts('This Month'), - 'this.week' => ts('This Week'), - 'this.day' => ts('This Day'), - 'previous.year' => ts('Previous Year'), - 'previous.fiscal_year' => ts('Previous Fiscal Year'), - 'previous.quarter' => ts('Previous Quarter'), - 'previous.month' => ts('Previous Month'), - 'previous.week' => ts('Previous Week'), - 'previous.day' => ts('Previous Day'), - 'previous_before.year' => ts('Prior to Previous Year'), - 'previous_before.quarter' => ts('Prior to Previous Quarter'), - 'previous_before.month' => ts('Prior to Previous Month'), - 'previous_before.week' => ts('Prior to Previous Week'), - 'previous_before.day' => ts('Prior to Previous Day'), - 'previous_2.year' => ts('Previous 2 Years'), - 'previous_2.quarter' => ts('Previous 2 Quarters'), - 'previous_2.month' => ts('Previous 2 Months'), - 'previous_2.week' => ts('Previous 2 Weeks'), - 'previous_2.day' => ts('Previous 2 Days'), - 'earlier.year' => ts('To End of Prior Year'), - 'earlier.quarter' => ts('To End of Prior Quarter'), - 'earlier.month' => ts('To End of Prior Month'), - 'earlier.week' => ts('To End of Prior Week'), - 'earlier.day' => ts('To End of Prior Day'), - 'greater.year' => ts('Current Year to-date'), - 'greater.quarter' => ts('Current Quarter to-date'), - 'greater.month' => ts('Current Month to-date'), - 'greater.week' => ts('Current Week to-date'), - 'greater.day' => ts('Current Day'), - 'ending.year' => ts('From 12 Months Ago'), - 'ending.quarter' => ts('From 3 Months Ago'), - 'ending.month' => ts('From 1 Month Ago'), - 'ending.week' => ts('From 1 Week Ago'), - ); - $selector += $operators; + static function returnDateRangeSelector( + &$form, $fieldName, $count = 1, + $from = '_from', $to = '_to', $fromLabel = 'From:', + $required = FALSE, $operators = array(), + $dateFormat = 'searchDate', $displayTime = FALSE + ) { + $selector = + array( + '' => ts('- any -'), + 0 => ts('Choose Date Range'), + 'this.year' => ts('This Year'), + 'this.fiscal_year' => ts('This Fiscal Year'), + 'this.quarter' => ts('This Quarter'), + 'this.month' => ts('This Month'), + 'this.week' => ts('This Week'), + 'this.day' => ts('This Day'), + 'previous.year' => ts('Previous Year'), + 'previous.fiscal_year' => ts('Previous Fiscal Year'), + 'previous.quarter' => ts('Previous Quarter'), + 'previous.month' => ts('Previous Month'), + 'previous.week' => ts('Previous Week'), + 'previous.day' => ts('Previous Day'), + 'previous_before.year' => ts('Prior to Previous Year'), + 'previous_before.quarter' => ts('Prior to Previous Quarter'), + 'previous_before.month' => ts('Prior to Previous Month'), + 'previous_before.week' => ts('Prior to Previous Week'), + 'previous_before.day' => ts('Prior to Previous Day'), + 'previous_2.year' => ts('Previous 2 Years'), + 'previous_2.quarter' => ts('Previous 2 Quarters'), + 'previous_2.month' => ts('Previous 2 Months'), + 'previous_2.week' => ts('Previous 2 Weeks'), + 'previous_2.day' => ts('Previous 2 Days'), + 'earlier.year' => ts('To End of Prior Year'), + 'earlier.quarter' => ts('To End of Prior Quarter'), + 'earlier.month' => ts('To End of Prior Month'), + 'earlier.week' => ts('To End of Prior Week'), + 'earlier.day' => ts('To End of Prior Day'), + 'greater.year' => ts('Current Year to-date'), + 'greater.quarter' => ts('Current Quarter to-date'), + 'greater.month' => ts('Current Month to-date'), + 'greater.week' => ts('Current Week to-date'), + 'greater.day' => ts('Current Day'), + 'ending.year' => ts('From 12 Months Ago'), + 'ending.quarter' => ts('From 3 Months Ago'), + 'ending.month' => ts('From 1 Month Ago'), + 'ending.week' => ts('From 1 Week Ago'), + ); + $selector = array_merge($selector, $operators); $config = CRM_Core_Config::singleton(); //if fiscal year start on 1 jan then remove fiscal year task diff --git a/CRM/Core/Invoke.php b/CRM/Core/Invoke.php index 2bbf3581722d2d4669fb4915df284b352dc1e5aa..96583f77dacfe2ddbfe785f2d0399685b12151e6 100644 --- a/CRM/Core/Invoke.php +++ b/CRM/Core/Invoke.php @@ -119,7 +119,7 @@ class CRM_Core_Invoke { static public function init($args) { // first fire up IDS and check for bad stuff $config = CRM_Core_Config::singleton(); - if ($config->useIDS) { + if (!CRM_Core_Permission::check('skip IDS check')) { $ids = new CRM_Core_IDS(); $ids->check($args); } diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php index 066cc4c357d333b6764608309072cdd0ced44505..3a79f701c406c2d40901103fa166012e2184ce47 100644 --- a/CRM/Core/Permission.php +++ b/CRM/Core/Permission.php @@ -148,7 +148,8 @@ class CRM_Core_Permission { return TRUE; } - if (self::check('administer Multiple Organizations') && + if ( + self::check('administer Multiple Organizations') && self::isMultisiteEnabled() ) { return TRUE; @@ -451,6 +452,7 @@ class CRM_Core_Permission { 'import contacts' => $prefix . ts('import contacts'), 'edit groups' => $prefix . ts('edit groups'), 'administer CiviCRM' => $prefix . ts('administer CiviCRM'), + 'skip IDS check' => $prefix . ts('skip IDS check'), 'access uploaded files' => $prefix . ts('access uploaded files'), 'profile listings and forms' => $prefix . ts('profile listings and forms'), 'profile listings' => $prefix . ts('profile listings'), diff --git a/CRM/Upgrade/Incremental/php/FourFour.php b/CRM/Upgrade/Incremental/php/FourFour.php index 6c9f6a26901f369ee1706ee2675674c5b0f1a70f..2424e21fda6c541d803ce0f906b0cbdd520b0bf9 100644 --- a/CRM/Upgrade/Incremental/php/FourFour.php +++ b/CRM/Upgrade/Incremental/php/FourFour.php @@ -59,10 +59,16 @@ class CRM_Upgrade_Incremental_php_FourFour { * @return void */ function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { + if ($rev == '4.4.alpha1') { + $config = CRM_Core_Config::singleton(); + if (!empty($config->useIDS)) { + $postUpgradeMessage .= '<br />' . ts("The setting to skip IDS check has been deprecated. Please use the permission 'skip IDS check' to bypass the IDS system"); + } + } } function upgrade_4_4_alpha1($rev) { - // task to process sql + // task to process sql $this->addTask(ts('Upgrade DB to 4.4.alpha1: SQL'), 'task_4_4_x_runSql', $rev); // Consolidate activity contacts CRM-12274. @@ -83,12 +89,12 @@ class CRM_Upgrade_Incremental_php_FourFour { $ovValue[] = $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); $ovValue[] = $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $ovValue[] = $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); - + $optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'activity_contacts', 'id', 'name'); if (!empty($ovValue)) { $ovValues = implode(', ', $ovValue); $query = " -UPDATE civicrm_option_value +UPDATE civicrm_option_value SET is_reserved = 1 WHERE option_group_id = {$optionGroupID} AND value IN ($ovValues)"; @@ -109,7 +115,7 @@ WHERE option_group_id = {$optionGroupID} AND value IN ($ovValues)"; } if (!$assigneeID || !$sourceID || !$targetID ) { - $insert = " + $insert = " INSERT INTO civicrm_option_value (option_group_id, label, value, name, weight, is_reserved, is_active) VALUES @@ -134,24 +140,24 @@ CREATE TABLE IF NOT EXISTS civicrm_activity_contact ( "; $dao = CRM_Core_DAO::executeQuery($query); - - $query = " + + $query = " INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id) SELECT activity_id, target_contact_id, {$targetID} as record_type_id FROM civicrm_activity_target"; $dao = CRM_Core_DAO::executeQuery($query); - $query = " + $query = " INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id) SELECT activity_id, assignee_contact_id, {$assigneeID} as record_type_id FROM civicrm_activity_assignment"; $dao = CRM_Core_DAO::executeQuery($query); - + $query = " INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id) SELECT id, source_contact_id, {$sourceID} as record_type_id -FROM civicrm_activity +FROM civicrm_activity WHERE source_contact_id IS NOT NULL"; $dao = CRM_Core_DAO::executeQuery($query); @@ -162,9 +168,9 @@ WHERE source_contact_id IS NOT NULL"; $query = "DROP TABLE civicrm_activity_assignment"; $dao = CRM_Core_DAO::executeQuery($query); - $query = "ALTER TABLE civicrm_activity + $query = "ALTER TABLE civicrm_activity DROP FOREIGN KEY FK_civicrm_activity_source_contact_id"; - + $dao = CRM_Core_DAO::executeQuery($query); $query = "ALTER TABLE civicrm_activity DROP COLUMN source_contact_id"; diff --git a/templates/CRM/common/civicrm.settings.php.tpl b/templates/CRM/common/civicrm.settings.php.tpl index 38ed5bfe9942526c11ac271d276fbe116b428ca1..6883a92fbbc1468db2470fbe79c03387542e1ff1 100644 --- a/templates/CRM/common/civicrm.settings.php.tpl +++ b/templates/CRM/common/civicrm.settings.php.tpl @@ -170,11 +170,6 @@ define( 'CIVICRM_UF_BASEURL' , '%%baseURL%%' ); */ define( 'CIVICRM_SITE_KEY', '%%siteKey%%' ); -/* - * If you want to disable IDS, set this to 0. - */ -define( 'CIVICRM_IDS_ENABLE', 1); - /** * Enable this constant, if you want to send your email through the smarty * templating engine(allows you to do conditional and more complex logic)