function anonymous_publishing_cl_admin_privacy in Anonymous Publishing 7
Menu callback: Form to change privacy settings and flush queue.
Return value
array Form.
1 string reference to 'anonymous_publishing_cl_admin_privacy'
- anonymous_publishing_cl_menu in modules/
cl/ anonymous_publishing_cl.admin.inc - Implements hook_menu().
File
- modules/
cl/ anonymous_publishing_cl.admin.inc, line 973 - Menu callbacks for the CL tabs on the module admin page.
Code
function anonymous_publishing_cl_admin_privacy($form, &$form_state) {
// Count the number of used aliases on file.
$sql = "SELECT a.nid, a.email, m.alias FROM {anonymous_publishing} a JOIN {anonymous_publishing_emails} m ON a.email = m.email WHERE m.alias <> '' ORDER BY a.nid DESC";
$aliases = db_query($sql)
->rowCount();
$period = array(
0 => t('Delete ASAP'),
3600 => format_interval(3600),
21600 => format_interval(21600),
43200 => format_interval(43200),
86400 => format_interval(86400),
259200 => format_interval(259200),
604800 => format_interval(604800),
2592000 => format_interval(2592000),
-1 => t('Indefinitely'),
);
$form = array();
$disablepa = variable_get('anonymous_publishing_cl_alias', 0);
$disablerp = 2 == variable_get('anonymous_publishing_cl_vrfypers', 0) ? FALSE : TRUE;
$disablerp = $disablerp && $disablepa;
if ($disablepa && $disablerp) {
$warn = '<br/>' . t('<strong>Note:</strong> For now, these settigs are greyed out, as they are incompatible with other settings in your configuration.');
}
elseif ($aliases) {
$warn = '<br/>' . t('You have !count linking verification e-mail to content. !these will be deleted when these links are purged.', array(
'!count' => format_plural($aliases, '1 record', '@count records'),
'!these' => format_plural($aliases, 'This', 'These'),
));
}
else {
$warn = '<br/>' . t('There are no existing records that will be removed by purging, but limiting the retention period will affect records collected in the future.');
}
$form['anonymous_publishing_privacy'] = array(
'#markup' => '<p>' . t('For enhanced privacy, you can set a limited retention period for identifying information, or purge this information instantly or periodically.') . ' ' . $warn . '</p>',
);
$form['apperiod'] = array(
'#type' => 'fieldset',
'#title' => t('Retention period'),
'#collapsible' => FALSE,
);
$form['apperiod']['anonymous_publishing_cl_period'] = array(
'#type' => 'select',
'#title' => t('Maximum period to retain records that links verification e-mails, ip-addresses and generated aliases to <em>specific</em> contents:'),
'#default_value' => variable_get('anonymous_publishing_cl_period', array(
-1,
)),
'#options' => $period,
'#description' => t('This is the only setting compatible with having a <em>persistent</em> byline.'),
'#description' => $disablerp ? t('Purging emails is incompatible with having a <em>persistent</em> byline. To !action, you need to turn this setting off in main settings (i.e.: Use “Require verification for each posting”).', array(
'!action' => t('limit the retention period'),
)) : t('Select “Indefinitely” to make the records linking verification e-mail to content persistent. The other settings will delete the e-mail address after the period set has elapsed.'),
);
$form['apperiod']['submit'] = array(
'#type' => 'submit',
'#disabled' => $disablerp,
'#value' => t('Save setting'),
);
$form['appurgeemails'] = array(
'#type' => 'fieldset',
'#title' => t('Purge emails'),
'#collapsible' => FALSE,
);
$form['appurgeemails']['info'] = array(
'#markup' => $disablerp ? '<p>' . t('Purging emails is incompatible with having a <em>persistent</em> byline. To purge, you need to turn this setting off in main settings (i.e.: Use “Require verification for each posting”).') . '</p>' : '<p>' . t('Press button below to immediately purge e-mail-addresses (these are used to maintain a persistent alias). This operation can not be reversed.') . '</p>',
);
$form['appurgeemails']['submit'] = array(
'#type' => 'submit',
'#disabled' => $disablerp,
'#value' => t('Purge now'),
);
$form['appurgeall'] = array(
'#type' => 'fieldset',
'#title' => t('Purge all'),
'#collapsible' => FALSE,
);
$form['appurgeall']['info'] = array(
'#markup' => $disablepa ? '<p>' . t('Purging all is incompatible with having an alias or byline. To !action, you need to turn this setting off in main settings (i.e.: Use “@anon”).', array(
'!action' => t('purge'),
'@anon' => variable_get('anonymous', 'Anonymous'),
)) . '</p>' : '<p>' . t('Press button below to immediately purge all information linking e-mails, ip-addresses and generated aliases to anonymously published content. This operation can not be reversed.') . '</p>',
);
$form['appurgeall']['submit'] = array(
'#type' => 'submit',
'#disabled' => $disablepa,
'#value' => t('Purge now'),
);
return $form;
}