Commit 58752cfa authored by Dries's avatar Dries
Browse files

- Patch #72284 by me:

   + reorganized ?q=admin/settings
   + deprecated the _settings hook
parent c45ca20d
......@@ -6,14 +6,14 @@ Drupal x.x.x, xxxx-xx-xx (development version)
- added support for a generic "sites/all" directory.
- usability:
* added support for auto-complete forms (AJAX) to user profiles.
* made it possible to instantly assign roles to newly created user accounts.
* improved configurability of the contact forms.
* reorganized the settings pages.
- block system:
* extended the block visibility settings with a role specific settings..
* extended the block visibility settings with a role specific settings.
- poll module:
* optionally allow people to inspect all votes.
* optionally allow people to cancel their vote.
- user module:
* made it possible to instantly assign roles to newly created user accounts.
- distributed authentication:
* added default server option.
- fixed critical SQL issue, see SA-2006-005
......
......@@ -4,7 +4,8 @@ UPGRADING
---------
1. Backup your database and Drupal directory - especially your
configuration file in 'sites/default/settings.php'.
sites-directory which contains your configuration file and
any added modules and themes.
2. Log on as the user with user ID 1.
......
......@@ -75,6 +75,11 @@ function aggregator_menu($may_cache) {
'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10);
$items[] = array('path' => 'admin/settings/aggregator',
'title' => t('RSS aggregator'),
'callback' => 'aggregator_admin_settings',
'type' => MENU_NORMAL_ITEM,
'access' => $edit);
$items[] = array('path' => 'aggregator',
'title' => t('news aggregator'),
......@@ -188,10 +193,7 @@ function aggregator_menu($may_cache) {
return $items;
}
/**
* Implementation of hook_settings().
*/
function aggregator_settings() {
function aggregator_admin_settings() {
$items = array(0 => t('none')) + drupal_map_assoc(array(3, 5, 10, 15, 20, 25), '_aggregator_items');
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
......@@ -218,7 +220,8 @@ function aggregator_settings() {
'#options' => array('checkboxes' => t('checkboxes'), 'select' => t('multiple selector')),
'#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
);
return $form;
return system_settings_form('aggregator_admin_settings', $form);
}
/**
......
......@@ -75,6 +75,11 @@ function aggregator_menu($may_cache) {
'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10);
$items[] = array('path' => 'admin/settings/aggregator',
'title' => t('RSS aggregator'),
'callback' => 'aggregator_admin_settings',
'type' => MENU_NORMAL_ITEM,
'access' => $edit);
$items[] = array('path' => 'aggregator',
'title' => t('news aggregator'),
......@@ -188,10 +193,7 @@ function aggregator_menu($may_cache) {
return $items;
}
/**
* Implementation of hook_settings().
*/
function aggregator_settings() {
function aggregator_admin_settings() {
$items = array(0 => t('none')) + drupal_map_assoc(array(3, 5, 10, 15, 20, 25), '_aggregator_items');
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
......@@ -218,7 +220,8 @@ function aggregator_settings() {
'#options' => array('checkboxes' => t('checkboxes'), 'select' => t('multiple selector')),
'#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
);
return $form;
return system_settings_form('aggregator_admin_settings', $form);
}
/**
......
......@@ -553,9 +553,11 @@ function blogapi_blogger_title(&$contents) {
return $title;
}
function blogapi_settings() {
function blogapi_admin_settings() {
$form['blogapi_engine'] = array(
'#type' => 'select', '#title' => t('XML-RPC Engine'), '#default_value' => variable_get('blogapi_engine', 0),
'#type' => 'select',
'#title' => t('XML-RPC Engine'),
'#default_value' => variable_get('blogapi_engine', 0),
'#options' => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'),
'#description' => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')
);
......@@ -563,12 +565,15 @@ function blogapi_settings() {
$node_types = node_get_types();
$defaults = isset($node_types['blog']) ? array('blog' => 1) : array();
$form['blogapi_node_types'] = array(
'#type' => 'checkboxes', '#title' => t('Blog types'), '#required' => TRUE,
'#default_value' => variable_get('blogapi_node_types', $defaults), '#options' => $node_types,
'#type' => 'checkboxes',
'#title' => t('Blog types'),
'#required' => TRUE,
'#default_value' => variable_get('blogapi_node_types', $defaults),
'#options' => $node_types,
'#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
);
return $form;
return system_settings_form('blogapi_admin_settings', $form);
}
function blogapi_menu($may_cache) {
......@@ -582,7 +587,19 @@ function blogapi_menu($may_cache) {
}
if ($may_cache) {
$items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access content'), 'type' => MENU_CALLBACK);
$items[] = array(
'path' => 'blogapi',
'title' => t('RSD'),
'callback' => 'blogapi_blogapi',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
$items[] = array(
'path' => 'admin/settings/blogapi',
'title' => t('blog APIs'),
'callback' => 'blogapi_admin_settings',
'access' => user_access('administer site configuration'),
'type' => MENU_NORMAL_ITEM
);
}
return $items;
......
......@@ -553,9 +553,11 @@ function blogapi_blogger_title(&$contents) {
return $title;
}
function blogapi_settings() {
function blogapi_admin_settings() {
$form['blogapi_engine'] = array(
'#type' => 'select', '#title' => t('XML-RPC Engine'), '#default_value' => variable_get('blogapi_engine', 0),
'#type' => 'select',
'#title' => t('XML-RPC Engine'),
'#default_value' => variable_get('blogapi_engine', 0),
'#options' => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'),
'#description' => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')
);
......@@ -563,12 +565,15 @@ function blogapi_settings() {
$node_types = node_get_types();
$defaults = isset($node_types['blog']) ? array('blog' => 1) : array();
$form['blogapi_node_types'] = array(
'#type' => 'checkboxes', '#title' => t('Blog types'), '#required' => TRUE,
'#default_value' => variable_get('blogapi_node_types', $defaults), '#options' => $node_types,
'#type' => 'checkboxes',
'#title' => t('Blog types'),
'#required' => TRUE,
'#default_value' => variable_get('blogapi_node_types', $defaults),
'#options' => $node_types,
'#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
);
return $form;
return system_settings_form('blogapi_admin_settings', $form);
}
function blogapi_menu($may_cache) {
......@@ -582,7 +587,19 @@ function blogapi_menu($may_cache) {
}
if ($may_cache) {
$items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access content'), 'type' => MENU_CALLBACK);
$items[] = array(
'path' => 'blogapi',
'title' => t('RSD'),
'callback' => 'blogapi_blogapi',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
$items[] = array(
'path' => 'admin/settings/blogapi',
'title' => t('blog APIs'),
'callback' => 'blogapi_admin_settings',
'access' => user_access('administer site configuration'),
'type' => MENU_NORMAL_ITEM
);
}
return $items;
......
......@@ -77,7 +77,7 @@ function comment_help($section) {
<li>control access for various comment module functions through access permissions <a href="%admin-access">administer &gt;&gt; access control</a>.</li>
<li>administer comments <a href="%admin-comment-configure"> administer &gt;&gt; comments &gt;&gt; configure</a>.</li>
</ul>
', array('%admin-access' => url('admin/access'), '%admin-comment-configure' => url('admin/comment/configure')));
', array('%admin-access' => url('admin/access'), '%admin-settings-comment' => url('admin/settings/comment')));
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%comment">Comment page</a>.', array('%comment' => 'http://drupal.org/handbook/modules/comment/')) .'</p>';
return $output;
case 'admin/modules#description':
......@@ -87,8 +87,7 @@ function comment_help($section) {
return t("<p>Below is a list of the latest comments posted to your site. Click on a subject to see the comment, the author's name to edit the author's user information , \"edit\" to modify the text, and \"delete\" to remove their submission.</p>");
case 'admin/comment/approval':
return t("<p>Below is a list of the comments posted to your site that need approval. To approve a comment, click on \"edit\" and then change its \"moderation status\" to Approved. Click on a subject to see the comment, the author's name to edit the author's user information, \"edit\" to modify the text, and \"delete\" to remove their submission.</p>");
case 'admin/comment/configure':
case 'admin/comment/configure/settings':
case 'admin/settings/comment':
return t("<p>Comments can be attached to any node, and their settings are below. The display comes in two types: a \"flat list\" where everything is flush to the left side, and comments come in chronological order, and a \"threaded list\" where replies to other comments are placed immediately below and slightly indented, forming an outline. They also come in two styles: \"expanded\", where you see both the title and the contents, and \"collapsed\" where you only see the title. Preview comment forces a user to look at their comment by clicking on a \"Preview\" button before they can actually add the comment.</p>");
}
}
......@@ -107,8 +106,6 @@ function comment_menu($may_cache) {
// Tabs:
$items[] = array('path' => 'admin/comment/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/comment/configure', 'title' => t('configure'),
'callback' => 'comment_configure', 'access' => $access, 'type' => MENU_LOCAL_TASK);
// Subtabs:
$items[] = array('path' => 'admin/comment/list/new', 'title' => t('published comments'),
......@@ -118,8 +115,12 @@ function comment_menu($may_cache) {
'callback arguments' => array('approval'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/comment/configure/settings', 'title' => t('settings'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array(
'path' => 'admin/settings/comments',
'title' => t('comments'),
'callback' => 'comment_admin_settings',
'access' => $access,
'type' => MENU_NORMAL_ITEM);
$items[] = array('path' => 'comment/delete', 'title' => t('delete comment'),
'callback' => 'comment_delete', 'access' => $access, 'type' => MENU_CALLBACK);
......@@ -361,7 +362,7 @@ function comment_user($type, $edit, &$user, $category = NULL) {
/**
* Menu callback; presents the comment settings page.
*/
function comment_configure() {
function comment_admin_settings() {
$form['viewing_options'] = array(
'#type' => 'fieldset',
'#title' => t('Viewing options'),
......@@ -448,7 +449,7 @@ function comment_configure() {
'#options' => array(t('Display on separate page'), t('Display below post or comments')),
);
return system_settings_form('comment_settings_form', $form);
return system_settings_form('comment_admin_settings', $form);
}
/**
......
......@@ -77,7 +77,7 @@ function comment_help($section) {
<li>control access for various comment module functions through access permissions <a href="%admin-access">administer &gt;&gt; access control</a>.</li>
<li>administer comments <a href="%admin-comment-configure"> administer &gt;&gt; comments &gt;&gt; configure</a>.</li>
</ul>
', array('%admin-access' => url('admin/access'), '%admin-comment-configure' => url('admin/comment/configure')));
', array('%admin-access' => url('admin/access'), '%admin-settings-comment' => url('admin/settings/comment')));
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%comment">Comment page</a>.', array('%comment' => 'http://drupal.org/handbook/modules/comment/')) .'</p>';
return $output;
case 'admin/modules#description':
......@@ -87,8 +87,7 @@ function comment_help($section) {
return t("<p>Below is a list of the latest comments posted to your site. Click on a subject to see the comment, the author's name to edit the author's user information , \"edit\" to modify the text, and \"delete\" to remove their submission.</p>");
case 'admin/comment/approval':
return t("<p>Below is a list of the comments posted to your site that need approval. To approve a comment, click on \"edit\" and then change its \"moderation status\" to Approved. Click on a subject to see the comment, the author's name to edit the author's user information, \"edit\" to modify the text, and \"delete\" to remove their submission.</p>");
case 'admin/comment/configure':
case 'admin/comment/configure/settings':
case 'admin/settings/comment':
return t("<p>Comments can be attached to any node, and their settings are below. The display comes in two types: a \"flat list\" where everything is flush to the left side, and comments come in chronological order, and a \"threaded list\" where replies to other comments are placed immediately below and slightly indented, forming an outline. They also come in two styles: \"expanded\", where you see both the title and the contents, and \"collapsed\" where you only see the title. Preview comment forces a user to look at their comment by clicking on a \"Preview\" button before they can actually add the comment.</p>");
}
}
......@@ -107,8 +106,6 @@ function comment_menu($may_cache) {
// Tabs:
$items[] = array('path' => 'admin/comment/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/comment/configure', 'title' => t('configure'),
'callback' => 'comment_configure', 'access' => $access, 'type' => MENU_LOCAL_TASK);
// Subtabs:
$items[] = array('path' => 'admin/comment/list/new', 'title' => t('published comments'),
......@@ -118,8 +115,12 @@ function comment_menu($may_cache) {
'callback arguments' => array('approval'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/comment/configure/settings', 'title' => t('settings'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array(
'path' => 'admin/settings/comments',
'title' => t('comments'),
'callback' => 'comment_admin_settings',
'access' => $access,
'type' => MENU_NORMAL_ITEM);
$items[] = array('path' => 'comment/delete', 'title' => t('delete comment'),
'callback' => 'comment_delete', 'access' => $access, 'type' => MENU_CALLBACK);
......@@ -361,7 +362,7 @@ function comment_user($type, $edit, &$user, $category = NULL) {
/**
* Menu callback; presents the comment settings page.
*/
function comment_configure() {
function comment_admin_settings() {
$form['viewing_options'] = array(
'#type' => 'fieldset',
'#title' => t('Viewing options'),
......@@ -448,7 +449,7 @@ function comment_configure() {
'#options' => array(t('Display on separate page'), t('Display below post or comments')),
);
return system_settings_form('comment_settings_form', $form);
return system_settings_form('comment_admin_settings', $form);
}
/**
......
......@@ -26,7 +26,7 @@ function contact_help($section) {
case 'admin/modules#description':
return t('Enables the use of both personal and site-wide contact forms.');
case 'admin/contact':
$output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/contact/settings'), '%form' => url('contact')));
$output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/settings/contact'), '%form' => url('contact')));
if (!module_exist('menu')) {
$menu_note = t('The menu item can be customized and configured only once the menu module has been <a href="%modules-page">enabled</a>.', array('%modules-page' => url('admin/modules')));
}
......@@ -55,43 +55,36 @@ function contact_menu($may_cache) {
'callback' => 'contact_admin_categories',
'access' => user_access('administer site configuration'),
);
$items[] = array('path' => 'admin/contact/category',
'title' => t('categories'),
'callback' => 'contact_admin_categories',
'access' => user_access('administer site configuration'),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array('path' => 'admin/contact/category/list',
$items[] = array('path' => 'admin/contact/list',
'title' => t('list'),
'callback' => 'contact_admin_categories',
'access' => user_access('administer site configuration'),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array('path' => 'admin/contact/category/add',
$items[] = array('path' => 'admin/contact/add',
'title' => t('add category'),
'callback' => 'contact_admin_edit',
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
$items[] = array('path' => 'admin/contact/category/edit',
$items[] = array('path' => 'admin/contact/edit',
'title' => t('edit contact category'),
'callback' => 'contact_admin_edit',
'access' => user_access('administer site configuration'),
'type' => MENU_CALLBACK,
);
$items[] = array('path' => 'admin/contact/category/delete',
$items[] = array('path' => 'admin/contact/delete',
'title' => t('delete contact'),
'callback' => 'contact_admin_delete',
'access' => user_access('administer site configuration'),
'type' => MENU_CALLBACK,
);
$items[] = array('path' => 'admin/contact/settings',
'title' => t('settings'),
$items[] = array('path' => 'admin/settings/contact',
'title' => t('contact form'),
'callback' => 'contact_admin_settings',
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
'type' => MENU_NORMAL_ITEM,
);
$items[] = array('path' => 'contact',
'title' => t('contact'),
......@@ -154,7 +147,7 @@ function contact_admin_categories() {
$result = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category');
$rows = array();
while ($category = db_fetch_object($result)) {
$rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/category/edit/'. $category->cid), l(t('delete'), 'admin/contact/category/delete/'. $category->cid));
$rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/edit/'. $category->cid), l(t('delete'), 'admin/contact/delete/'. $category->cid));
}
$header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2));
......@@ -165,7 +158,7 @@ function contact_admin_categories() {
* Category edit page.
*/
function contact_admin_edit($cid = NULL) {
if (arg(3) == "edit" && $cid > 0) {
if (arg(2) == "edit" && $cid > 0) {
$edit = db_fetch_array(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid));
}
$form['category'] = array('#type' => 'textfield',
......@@ -241,7 +234,7 @@ function contact_admin_edit_submit($form_id, $form_values) {
$recipients[$key] = trim($recipient);
}
$form_values['recipients'] = implode(',', $recipients);
if (arg(3) == 'add') {
if (arg(2) == 'add') {
db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']);
drupal_set_message(t('Category %category has been added.', array('%category' => theme('placeholder', $form_values['category']))));
watchdog('mail', t('Contact form: category %category added.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact'));
......@@ -277,16 +270,13 @@ function contact_admin_delete($cid = NULL) {
* Process category delete form submission.
*/
function contact_admin_delete_submit($form_id, $form_values) {
db_query("DELETE FROM {contact} WHERE cid = %d", arg(4));
db_query("DELETE FROM {contact} WHERE cid = %d", arg(3));
drupal_set_message(t('Category %category has been deleted.', array('%category' => theme('placeholder', $form_values['category']))));
watchdog('mail', t('Contact form: category %category deleted.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE);
return 'admin/contact';
}
/**
* Settings tab. Using a form rather than hook_settings().
*/
function contact_admin_settings() {
$form['contact_form_information'] = array('#type' => 'textarea',
'#title' => t('Additional information'),
......@@ -311,7 +301,7 @@ function contact_admin_settings() {
$form['reset'] = array('#type' => 'submit',
'#value' => t('Reset to defaults'),
);
// Use system_settings_form for the callback.
return drupal_get_form('contact_admin_settings', $form, 'system_settings_form');
}
......
......@@ -26,7 +26,7 @@ function contact_help($section) {
case 'admin/modules#description':
return t('Enables the use of both personal and site-wide contact forms.');
case 'admin/contact':
$output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/contact/settings'), '%form' => url('contact')));
$output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/settings/contact'), '%form' => url('contact')));
if (!module_exist('menu')) {
$menu_note = t('The menu item can be customized and configured only once the menu module has been <a href="%modules-page">enabled</a>.', array('%modules-page' => url('admin/modules')));
}
......@@ -55,43 +55,36 @@ function contact_menu($may_cache) {
'callback' => 'contact_admin_categories',
'access' => user_access('administer site configuration'),
);
$items[] = array('path' => 'admin/contact/category',
'title' => t('categories'),
'callback' => 'contact_admin_categories',
'access' => user_access('administer site configuration'),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array('path' => 'admin/contact/category/list',
$items[] = array('path' => 'admin/contact/list',
'title' => t('list'),
'callback' => 'contact_admin_categories',
'access' => user_access('administer site configuration'),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array('path' => 'admin/contact/category/add',
$items[] = array('path' => 'admin/contact/add',
'title' => t('add category'),
'callback' => 'contact_admin_edit',
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
$items[] = array('path' => 'admin/contact/category/edit',
$items[] = array('path' => 'admin/contact/edit',
'title' => t('edit contact category'),
'callback' => 'contact_admin_edit',
'access' => user_access('administer site configuration'),
'type' => MENU_CALLBACK,
);
$items[] = array('path' => 'admin/contact/category/delete',
$items[] = array('path' => 'admin/contact/delete',
'title' => t('delete contact'),
'callback' => 'contact_admin_delete',
'access' => user_access('administer site configuration'),
'type' => MENU_CALLBACK,
);
$items[] = array('path' => 'admin/contact/settings',
'title' => t('settings'),
$items[] = array('path' => 'admin/settings/contact',
'title' => t('contact form'),
'callback' => 'contact_admin_settings',
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
'type' => MENU_NORMAL_ITEM,
);
$items[] = array('path' => 'contact',
'title' => t('contact'),
......@@ -154,7 +147,7 @@ function contact_admin_categories() {
$result = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category');
$rows = array();
while ($category = db_fetch_object($result)) {
$rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/category/edit/'. $category->cid), l(t('delete'), 'admin/contact/category/delete/'. $category->cid));
$rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/edit/'. $category->cid), l(t('delete'), 'admin/contact/delete/'. $category->cid));
}
$header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2));
......@@ -165,7 +158,7 @@ function contact_admin_categories() {
* Category edit page.
*/
function contact_admin_edit($cid = NULL) {
if (arg(3) == "edit" && $cid > 0) {
if (arg(2) == "edit" && $cid > 0) {
$edit = db_fetch_array(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid));
}
$form['category'] = array('#type' => 'textfield',
......@@ -241,7 +234,7 @@ function contact_admin_edit_submit($form_id, $form_values) {
$recipients[$key] = trim($recipient);
}
$form_values['recipients'] = implode(',', $recipients);
if (arg(3) == 'add') {
if (arg(2) == 'add') {
db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']);
drupal_set_message(t('Category %category has been added.', array('%category' => theme('placeholder', $form_values['category']))));
watchdog('mail', t('Contact form: category %category added.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact'));
......@@ -277,16 +270,13 @@ function contact_admin_delete($cid = NULL) {
* Process category delete form submission.
*/
function contact_admin_delete_submit($form_id, $form_values) {
db_query("DELETE FROM {contact} WHERE cid = %d", arg(4));
db_query("DELETE FROM {contact} WHERE cid = %d", arg(3));
drupal_set_message(t('Category %category has been deleted.', array('%category' => theme('placeholder', $form_values['category']))));
watchdog('mail', t('Contact form: category %category deleted.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE);
return 'admin/contact';
}
/**
* Settings tab. Using a form rather than hook_settings().
*/
function contact_admin_settings() {
$form['contact_form_information'] = array('#type' => 'textarea',
'#title' => t('Additional information'),
......@@ -311,7 +301,7 @@ function contact_admin_settings() {
$form['reset'] = array('#type' => 'submit',
'#value' => t('Reset to defaults'),
);
// Use system_settings_form for the callback.
return drupal_get_form('contact_admin_settings', $form, 'system_settings_form');
}
......
......@@ -47,39 +47,31 @@ function drupal_help($section) {
case 'admin/modules#description':
return t('Lets you register your site with a central server and improve ranking of Drupal projects by posting information on your installed modules and themes; also enables users to log in using a Drupal ID.');
case 'admin/settings/drupal':
return t('<p>Using this your site can "call home" to another Drupal server. By calling home to drupal.org and sending a list of your installed modules and themes, you help rank projects on drupal.org and so assist all Drupal administrators to find the best components for meeting their needs. If you want to register with a different server, you can change the Drupal XML-RPC server setting -- but the server has to be able to handle Drupal XML. Some XML-RPC servers may present directories of all registered sites. To get all your site information listed, go to the <a href="%site-settings">settings page</a> and set the site name, the e-mail address, the slogan, and the mission statement.</p>', array('%site-settings' => url('admin/settings')));
return t('<p>Using this your site can "call home" to another Drupal server. By calling home to drupal.org and sending a list of your installed modules and themes, you help rank projects on drupal.org and so assist all Drupal administrators to find the best components for meeting their needs. If you want to register with a different server, you can change the Drupal XML-RPC server setting -- but the server has to be able to handle Drupal XML. Some XML-RPC servers may present directories of all registered sites. To get all your site information listed, go to the <a href="%site-settings">site information settings page</a> and set the site name, the e-mail address, the slogan, and the mission statement.</p>', array('%site-settings' => url('admin/settings/site-informationl')));
case 'user/help#drupal':
return variable_get('drupal_authentication_service', 0) ? t("<p><a href=\"%Drupal\">Drupal</a> is the name of the software that powers %this-site. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely log in to any Drupal site using a single <strong>Drupal ID</strong>.</p>
<p>So please feel free to log in to your account here at %this-site with a username from another Drupal site. The format of a Drupal ID is similar to an e-mail address: <strong>username</strong>@<em>server</em>. An example of a valid Drupal ID is <strong>mwlily</strong>@<em>drupal.org</em>.</p>", array('%Drupal' => 'http://drupal.org', '%this-site' => '<em>'. variable_get('site_name', 'this web site') .'</em>')) : '';
}
}
/**
* Implementation of hook_settings().
*/
function drupal_settings() {
function drupal_sites_registry_settings() {
// Check if all required fields are present
if ((variable_get('site_name', 'drupal') == 'drupal') || (variable_get('site_name', 'drupal') == '')) {
form_set_error('drupal_directory', t('You must set the name of your site on the <a href="%url">administer &raquo; settings</a> page.', array('%url' => url('admin/settings'))));
form_set_error('drupal_directory', t('You must set the name of your site on the <a href="%url">administer &raquo; settings</a> page.', array('%url' => url('admin/settings/site-information'))));
}
else if (variable_get('site_mail', ini_get('sendmail_from')) == '') {
form_set_error('drupal_directory', t('You must set an e-mail address for your site on the <a href="%url">administer &raquo; settings</a> page.', array('%url' => url('admin/settings'))));
form_set_error('drupal_directory', t('You must set an e-mail address for your site on the <a href="%url">site information settings page</a>.', array('%url' => url('admin/settings/site-information'))));
}
else if (variable_get('site_slogan', '') == '') {
form_set_error('drupal_directory', t('You must set your site slogan on the <a href="%url">administer &raquo; settings</a> page.', array('%url' => url('admin/settings'))));
form_set_error('drupal_directory', t('You must set your site slogan on the <a href="%url">site information settings page</a>.', array('%url' => url('admin/settings/site-information'))));
}
else if (variable_get('site_mission', '') == '') {
form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">administer &raquo; settings</a> page.' , array('%url' => url('admin/settings'))));
form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">site information settings page</a>.' , array('%url' => url('admin/settings/site-information'))));
}
$options = array('1' => t('Enabled'), '0' => t('Disabled'));
$form['drupal'] = array(
'#type' => 'fieldset',
'#title' => t('Post data to another site'),
'#tree' => FALSE
);
$options = array('1' => t('Enabled'), '0' => t('Disabled'));
$form['drupal']['drupal_register'] = array(
$form['drupal_register'] = array(
'#type' => 'radios',
'#title' => t('Register with a Drupal server'),
'#default_value' => variable_get('drupal_register', 0),
......@@ -87,14 +79,14 @@ function drupal_settings() {
'#description' => t("If enabled, your Drupal site will register itself with the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will register itself with drupal.org. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://drupal.org/xmlrpc.php", "%drupal-sites" => "http://drupal.org/drupal-sites/"))
);