Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-15928 Backport fix for CRM-15928 to 4.6 #8931

Merged
merged 2 commits into from
Aug 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CRM/Admin/Form/Setting/Miscellaneous.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
'doNotAttachPDFReceipt' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'secondDegRelPermissions' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'checksumTimeout' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'remote_profile_submissions' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
);

public $_uploadMaxSize;
Expand Down
5 changes: 3 additions & 2 deletions CRM/Profile/Page/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ public function run($args = NULL) {
}

if ($secondArg == 'edit' || $secondArg == 'create') {
$allowRemoteSubmit = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'remote_profile_submissions');
if ($secondArg == 'edit') {
$controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit',
ts('Create Profile'),
CRM_Core_Action::UPDATE,
FALSE, FALSE, TRUE
FALSE, FALSE, $allowRemoteSubmit
);
$controller->set('edit', 1);
$controller->process();
Expand All @@ -113,7 +114,7 @@ public function run($args = NULL) {
ts('Create Profile'),
array(
'mode' => CRM_Core_Action::ADD,
'ignoreKey' => TRUE,
'ignoreKey' => $allowRemoteSubmit,
)
);
}
Expand Down
15 changes: 9 additions & 6 deletions CRM/UF/Page/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ public function &actionLinks() {
'qs' => 'action=delete&id=%%id%%',
'title' => ts('Delete CiviCRM Profile Group'),
),
CRM_Core_Action::PROFILE => array(
'name' => ts('HTML Form Snippet'),
'url' => 'civicrm/admin/uf/group',
'qs' => 'action=profile&gid=%%id%%',
'title' => ts('HTML Form Snippet for this Profile'),
),
CRM_Core_Action::COPY => array(
'name' => ts('Copy Profile'),
'url' => 'civicrm/admin/uf/group',
Expand All @@ -125,6 +119,15 @@ public function &actionLinks() {
'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"',
),
);
$allowRemoteSubmit = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'remote_profile_submissions');
if ($allowRemoteSubmit) {
self::$_actionLinks[CRM_Core_Action::PROFILE] = array(
'name' => ts('HTML Form Snippet'),
'url' => 'civicrm/admin/uf/group',
'qs' => 'action=profile&gid=%%id%%',
'title' => ts('HTML Form Snippet for this Profile'),
);
}
}
return self::$_actionLinks;
}
Expand Down
3 changes: 3 additions & 0 deletions CRM/Upgrade/Incremental/php/FourSix.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.6.alpha3') {
$postUpgradeMessage .= '<br /><br />' . ts('A new permission has been added for editing message templates. Previously, users needed the "administer CiviCRM" permission. Now, users need the new permission called "edit message templates." Please check your CMS permissions to ensure that users who should be able to edit message templates are assigned this new permission.');
}
if ($rev == '4.6.21') {
$postUpgradeMessage .= '<br /><br />' . ts("WARNING: For increased security, profile submissions embedded in remote sites are no longer allowed to create or edit data by default. If you need to allow users to submit profiles from external sites, you can restore this at Administer > System Settings > Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.) > 'Accept profile submissions from external sites'");
}
}


Expand Down
18 changes: 17 additions & 1 deletion settings/Core.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
* $Id$
*
*/
/*

/**
* Settings metadata file
*/
return array(
Expand Down Expand Up @@ -176,6 +177,21 @@
'description' => NULL,
'help_text' => NULL,
),
'remote_profile_submissions' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'remote_profile_submissions',
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => FALSE,
'html_type' => 'radio',
'add' => '4.6',
'title' => 'Accept profile submissions from external sites',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'If enabled, CiviCRM will permit submissions from external sites to profiles. This is disabled by default to limit abuse.',
'help_text' => NULL,
),
'editor_id' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
Expand Down
13 changes: 10 additions & 3 deletions templates/CRM/Admin/Form/Setting/Miscellaneous.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,16 @@
<p class="description">{ts}If enabled, contacts with the permission to edit a related contact will inherit that contact's permission to edit other related contacts.{/ts}</p>
</td>
</tr>

<tr class="crm-miscellaneous-form-block-remote_profile_submissions_allowed">
<td class="label">{$form.remote_profile_submissions.label}</td>
<td>{$form.remote_profile_submissions.html}<br />
<p class="description">{ts}If enabled, CiviCRM will allow users to submit profiles from external sites. This is disabled by default to limit abuse.{/ts}</p>
</td>
</tr>
</table>
<h3>{ts}reCAPTCHA Keys{/ts}</h3>

<h3>{ts}reCAPTCHA Keys{/ts}</h3>

<div class="description">
{ts 1="https://www.google.com/recaptcha"}reCAPTCHA is a free service that helps prevent automated abuse of your site. To use reCAPTCHA on public-facing CiviCRM forms: sign up at <a href="%1" "target=_blank">Google's reCaptcha site</a>; enter the provided public and private reCAPTCHA keys here; then enable reCAPTCHA under Advanced Settings in any Profile.{/ts}
</div>
Expand Down Expand Up @@ -164,4 +171,4 @@
});
});
</script>
{/literal}
{/literal}