'), -1, PREG_SPLIT_NO_EMPTY);
+ $allowed_tags = preg_split('/\s+|<|>/', variable_get("allowed_html_$format"), -1, PREG_SPLIT_NO_EMPTY);
$text = filter_xss($text, $allowed_tags);
- if (variable_get("filter_html_nofollow_$format", FALSE)) {
+ if (variable_get("filter_html_nofollow_$format")) {
$text = preg_replace('/]+)>/i', '', $text);
}
@@ -1158,7 +1174,13 @@ function _filter_xss_attributes($attr) {
function filter_xss_bad_protocol($string, $decode = TRUE) {
static $allowed_protocols;
if (!isset($allowed_protocols)) {
- $allowed_protocols = array_flip(variable_get('filter_allowed_protocols', array('ftp', 'http', 'https', 'irc', 'mailto', 'news', 'nntp', 'rtsp', 'sftp', 'ssh', 'telnet', 'webcal')));
+ if (defined('MAINTENANCE_MODE')) {
+ $protocols = array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal');
+ }
+ else {
+ $protocols = variable_get('filter_allowed_protocols');
+ }
+ $allowed_protocols = array_flip($protocols);
}
// Get the plain text representation of the attribute value (i.e. its meaning).
Index: modules/forum/forum.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.admin.inc,v
retrieving revision 1.12
diff -u -p -r1.12 forum.admin.inc
--- modules/forum/forum.admin.inc 16 Jul 2008 21:59:26 -0000 1.12
+++ modules/forum/forum.admin.inc 25 Jul 2008 08:23:26 -0000
@@ -54,7 +54,7 @@ function forum_form_forum(&$form_state,
'#description' => t('Forums are displayed in ascending order by weight (forums with equal weights are displayed alphabetically).'),
);
- $form['vid'] = array('#type' => 'hidden', '#value' => variable_get('forum_nav_vocabulary', ''));
+ $form['vid'] = array('#type' => 'hidden', '#value' => variable_get('forum_nav_vocabulary'));
$form['submit' ] = array('#type' => 'submit', '#value' => t('Save'));
if ($edit['tid']) {
$form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
@@ -83,7 +83,7 @@ function forum_form_submit($form, &$form
switch ($status) {
case SAVED_NEW:
if ($container) {
- $containers = variable_get('forum_containers', array());
+ $containers = variable_get('forum_containers');
$containers[] = $form_state['values']['tid'];
variable_set('forum_containers', $containers);
}
@@ -138,7 +138,7 @@ function forum_form_container(&$form_sta
$form['vid'] = array(
'#type' => 'hidden',
- '#value' => variable_get('forum_nav_vocabulary', ''),
+ '#value' => variable_get('forum_nav_vocabulary'),
);
$form['submit'] = array(
'#type' => 'submit',
@@ -190,21 +190,21 @@ function forum_admin_settings() {
$number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500));
$form['forum_hot_topic'] = array('#type' => 'select',
'#title' => t('Hot topic threshold'),
- '#default_value' => variable_get('forum_hot_topic', 15),
+ '#default_value' => variable_get('forum_hot_topic'),
'#options' => $number,
'#description' => t('The number of posts a topic must have to be considered "hot".'),
);
$number = drupal_map_assoc(array(10, 25, 50, 75, 100));
$form['forum_per_page'] = array('#type' => 'select',
'#title' => t('Topics per page'),
- '#default_value' => variable_get('forum_per_page', 25),
+ '#default_value' => variable_get('forum_per_page'),
'#options' => $number,
'#description' => t('Default number of forum topics displayed per page.'),
);
$forder = array(1 => t('Date - newest first'), 2 => t('Date - oldest first'), 3 => t('Posts - most active first'), 4 => t('Posts - least active first'));
$form['forum_order'] = array('#type' => 'radios',
'#title' => t('Default order'),
- '#default_value' => variable_get('forum_order', '1'),
+ '#default_value' => variable_get('forum_order'),
'#options' => $forder,
'#description' => t('Default display order for topics.'),
);
@@ -217,7 +217,7 @@ function forum_admin_settings() {
function forum_overview(&$form_state) {
module_load_include('inc', 'taxonomy', 'taxonomy.admin');
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
$vocabulary = taxonomy_vocabulary_load($vid);
$form = taxonomy_overview_terms($form_state, $vocabulary);
drupal_set_title('Forums');
@@ -226,7 +226,7 @@ function forum_overview(&$form_state) {
if (isset($form[$key]['#term'])) {
$term = $form[$key]['#term'];
$form[$key]['view']['#markup'] = l($term['name'], 'forum/' . $term['tid']);
- if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) {
+ if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers'))) {
$form[$key]['edit']['#markup'] = l(t('edit container'), 'admin/build/forum/edit/container/' . $term['tid']);
}
else {
@@ -264,7 +264,7 @@ function _forum_parent_select($tid, $tit
$parent = 0;
}
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
$children = taxonomy_get_tree($vid, $tid);
// A term can't be the child of itself, nor of its children.
Index: modules/forum/forum.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.install,v
retrieving revision 1.19
diff -u -p -r1.19 forum.install
--- modules/forum/forum.install 25 Jun 2008 07:47:20 -0000 1.19
+++ modules/forum/forum.install 25 Jul 2008 05:34:28 -0000
@@ -12,7 +12,7 @@ function forum_install() {
}
function forum_enable() {
- if ($vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0))) {
+ if ($vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary'))) {
// Existing install. Add back forum node type, if the forums
// vocabulary still exists. Keep all other node types intact there.
$vocabulary = (array) $vocabulary;
@@ -47,7 +47,7 @@ function forum_uninstall() {
drupal_load('module', 'taxonomy');
// Delete the vocabulary.
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
taxonomy_del_vocabulary($vid);
db_query('DROP TABLE {forum}');
@@ -108,7 +108,7 @@ function forum_schema() {
function forum_update_6000() {
$ret = array();
- $vid = variable_get('forum_nav_vocabulary', 0);
+ $vid = variable_get('forum_nav_vocabulary');
$vocabularies = taxonomy_get_vocabularies();
if (!isset($vocabularies[$vid])) {
$vocabulary = array(
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.459
diff -u -p -r1.459 forum.module
--- modules/forum/forum.module 24 Jul 2008 16:25:17 -0000 1.459
+++ modules/forum/forum.module 25 Jul 2008 08:08:32 -0000
@@ -7,6 +7,24 @@
*/
/**
+ * Implementation of hook_variables().
+ */
+function forum_variables() {
+ return array(
+ 'forum_nav_vocabulary' => '',
+ 'forum_containers' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ 'forum_hot_topic' => 15,
+ 'forum_per_page' => 25,
+ 'forum_order' => 1,
+ 'forum_block_num_active' => 5,
+ 'forum_block_num_new' => 5,
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function forum_help($path, $arg) {
@@ -28,7 +46,7 @@ function forum_help($path, $arg) {
case 'admin/build/forum/add/forum':
return '' . t('A forum holds related or similar forum topics (a forum topic is the initial post to a threaded discussion). For example, a forum named "Fruit" may contain forum topics titled "Apples" and "Bananas", respectively.') . '
';
case 'admin/build/forum/settings':
- return '' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the Content types on the forum vocabulary page.', array('@forum-vocabulary' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary', '')))) . '
';
+ return '' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the Content types on the forum vocabulary page.', array('@forum-vocabulary' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary')))) . '
';
}
}
@@ -74,7 +92,7 @@ function forum_theme() {
* An associative array containing the term data or FALSE if the term cannot be loaded, or is not part of the forum vocabulary.
*/
function forum_term_load($tid) {
- $result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get('forum_nav_vocabulary', ''));
+ $result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get('forum_nav_vocabulary'));
return db_fetch_array($result);
}
@@ -163,7 +181,7 @@ function forum_nodeapi(&$node, $op, $tea
// types assigned to the forum vocabulary. If forum_nav_vocabulary
// is undefined or the vocabulary does not exist, it clearly cannot
// be assigned to $node->type, so return to avoid E_ALL warnings.
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
$vocabulary = taxonomy_vocabulary_load($vid);
if (empty($vocabulary)) {
return;
@@ -220,7 +238,7 @@ function forum_nodeapi(&$node, $op, $tea
if ($node->taxonomy) {
// Extract the node's proper topic ID.
$vocabulary = $vid;
- $containers = variable_get('forum_containers', array());
+ $containers = variable_get('forum_containers');
foreach ($node->taxonomy as $term) {
if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
if (in_array($term, $containers)) {
@@ -328,7 +346,7 @@ function forum_perm() {
* Implementation of hook_taxonomy().
*/
function forum_taxonomy($op, $type, $term = NULL) {
- if ($op == 'delete' && $term['vid'] == variable_get('forum_nav_vocabulary', '')) {
+ if ($op == 'delete' && $term['vid'] == variable_get('forum_nav_vocabulary')) {
switch ($type) {
case 'term':
$results = db_query('SELECT tn.nid FROM {term_node} tn WHERE tn.tid = %d', $term['tid']);
@@ -338,7 +356,7 @@ function forum_taxonomy($op, $type, $ter
}
// For containers, remove the tid from the forum_containers variable.
- $containers = variable_get('forum_containers', array());
+ $containers = variable_get('forum_containers');
$key = array_search($term['tid'], $containers);
if ($key !== FALSE) {
unset($containers[$key]);
@@ -355,7 +373,7 @@ function forum_taxonomy($op, $type, $ter
* Implementation of hook_form_alter().
*/
function forum_form_alter(&$form, $form_state, $form_id) {
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
if (isset($form['vid']) && $form['vid']['#value'] == $vid) {
// Hide critical options from forum vocabulary.
if ($form_id == 'taxonomy_form_vocabulary') {
@@ -378,7 +396,7 @@ function forum_form_alter(&$form, $form_
}
if ($form_id == 'forum_node_form') {
// Make the vocabulary required for 'real' forum-nodes.
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
$form['taxonomy'][$vid]['#required'] = TRUE;
$form['taxonomy'][$vid]['#options'][''] = t('- Please choose -');
}
@@ -420,14 +438,14 @@ function forum_block($op = 'list', $delt
case 'active':
$title = t('Active forum topics');
$sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid INNER JOIN {term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY l.last_comment_timestamp DESC");
- $result = db_query_range($sql, variable_get('forum_nav_vocabulary', ''), 0, variable_get('forum_block_num_active', '5'));
+ $result = db_query_range($sql, variable_get('forum_nav_vocabulary'), 0, variable_get('forum_block_num_active'));
$content = node_title_list($result);
break;
case 'new':
$title = t('New forum topics');
$sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid INNER JOIN {term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY n.nid DESC");
- $result = db_query_range($sql, variable_get('forum_nav_vocabulary', ''), 0, variable_get('forum_block_num_new', '5'));
+ $result = db_query_range($sql, variable_get('forum_nav_vocabulary'), 0, variable_get('forum_block_num_new'));
$content = node_title_list($result);
break;
}
@@ -449,7 +467,7 @@ function forum_form(&$node, $form_state)
$form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => !empty($node->title) ? $node->title : '', '#required' => TRUE, '#weight' => -5);
if (!empty($node->nid)) {
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
$forum_terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
// if editing, give option to leave shadows
$shadow = (count($forum_terms) > 1);
@@ -470,7 +488,7 @@ function forum_link_alter(&$links, $node
// Link back to the forum and not the taxonomy term page. We'll only
// do this if the taxonomy term in question belongs to forums.
$tid = str_replace('taxonomy/term/', '', $link['href']);
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
$term = taxonomy_get_term($tid);
if ($term->vid == $vid) {
$links[$module]['href'] = str_replace('taxonomy/term', 'forum', $link['href']);
@@ -495,7 +513,7 @@ function forum_link_alter(&$links, $node
function forum_get_forums($tid = 0) {
$forums = array();
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
$_forums = taxonomy_get_tree($vid, $tid);
if (count($_forums)) {
@@ -511,7 +529,7 @@ function forum_get_forums($tid = 0) {
}
foreach ($_forums as $forum) {
- if (in_array($forum->tid, variable_get('forum_containers', array()))) {
+ if (in_array($forum->tid, variable_get('forum_containers'))) {
$forum->container = 1;
}
@@ -643,7 +661,7 @@ function _forum_new($tid) {
function template_preprocess_forums(&$variables) {
global $user;
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
$vocabulary = taxonomy_vocabulary_load($vid);
$title = !empty($vocabulary->name) ? $vocabulary->name : '';
@@ -699,7 +717,7 @@ function template_preprocess_forums(&$va
$variables['forums'] = '';
}
- if ($variables['tid'] && !in_array($variables['tid'], variable_get('forum_containers', array()))) {
+ if ($variables['tid'] && !in_array($variables['tid'], variable_get('forum_containers'))) {
$variables['topics'] = theme('forum_topic_list', $variables['tid'], $variables['topics'], $variables['sortby'], $variables['forum_per_page']);
drupal_add_feed(url('taxonomy/term/' . $variables['tid'] . '/0/feed'), 'RSS - ' . $title);
}
@@ -854,7 +872,7 @@ function template_preprocess_forum_topic
* @see theme_forum_icon()
*/
function template_preprocess_forum_icon(&$variables) {
- $variables['hot_threshold'] = variable_get('forum_hot_topic', 15);
+ $variables['hot_threshold'] = variable_get('forum_hot_topic');
if ($variables['num_posts'] > $variables['hot_threshold']) {
$variables['icon'] = $variables['new_posts'] ? 'hot-new' : 'hot';
}
@@ -883,7 +901,7 @@ function template_preprocess_forum_topic
$output = '';
// get previous and next topic
- $sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get('forum_order', 1));
+ $sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get('forum_order'));
$result = db_query(db_rewrite_sql($sql), isset($variables['node']->tid) ? $variables['node']->tid : 0);
$stop = $variables['prev'] = $variables['next'] = 0;
Index: modules/forum/forum.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.pages.inc,v
retrieving revision 1.2
diff -u -p -r1.2 forum.pages.inc
--- modules/forum/forum.pages.inc 26 Jul 2007 06:48:03 -0000 1.2
+++ modules/forum/forum.pages.inc 25 Jul 2008 08:19:15 -0000
@@ -11,12 +11,12 @@
*/
function forum_page($tid = 0) {
$topics = '';
- $forum_per_page = variable_get('forum_per_page', 25);
- $sortby = variable_get('forum_order', 1);
+ $forum_per_page = variable_get('forum_per_page');
+ $sortby = variable_get('forum_order');
$forums = forum_get_forums($tid);
$parents = taxonomy_get_parents_all($tid);
- if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
+ if ($tid && !in_array($tid, variable_get('forum_containers'))) {
$topics = forum_get_topics($tid, $sortby, $forum_per_page);
}
Index: modules/forum/forum.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.test,v
retrieving revision 1.3
diff -u -p -r1.3 forum.test
--- modules/forum/forum.test 30 May 2008 18:17:35 -0000 1.3
+++ modules/forum/forum.test 25 Jul 2008 05:34:28 -0000
@@ -117,7 +117,7 @@ class ForumTestCase extends DrupalWebTes
*/
function editForumTaxonomy() {
// Backup forum taxonomy.
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get('forum_nav_vocabulary');
// This function returns NULL (the cache value is false).
// $original_settings = taxonomy_vocabulary_load($vid);
$original_settings = db_fetch_array(db_query('SELECT v.* FROM {vocabulary} v WHERE v.vid = %d', $vid));
@@ -197,7 +197,7 @@ class ForumTestCase extends DrupalWebTes
$this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created'));
// Verify forum.
- $term = db_fetch_array(db_query("SELECT * FROM {term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary', ''), $name, $description));
+ $term = db_fetch_array(db_query("SELECT * FROM {term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary'), $name, $description));
$this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database');
// Verify forum hierarchy.
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.220
diff -u -p -r1.220 locale.module
--- modules/locale/locale.module 24 Jul 2008 16:25:18 -0000 1.220
+++ modules/locale/locale.module 25 Jul 2008 08:02:58 -0000
@@ -22,9 +22,14 @@ define('LANGUAGE_LTR', 0);
*/
define('LANGUAGE_RTL', 1);
-
-// ---------------------------------------------------------------------------------
-// Hook implementations
+/**
+ * Implementation of hook_variables().
+ */
+function locale_variables() {
+ return array(
+ 'locale_cache_strings' => 1,
+ );
+}
/**
* Implementation of hook_help().
@@ -219,7 +224,7 @@ function locale_user($type, $edit, &$use
// If we have more then one language and either creating a user on the
// admin interface or edit the user, show the language selector.
- if (variable_get('language_count', 1) > 1 && ($type == 'register' && user_access('administer users') || $type == 'form' && $category == 'account' )) {
+ if (variable_get('language_count') > 1 && ($type == 'register' && user_access('administer users') || $type == 'form' && $category == 'account' )) {
$languages = language_list('enabled');
$languages = $languages[1];
@@ -238,7 +243,7 @@ function locale_user($type, $edit, &$use
);
// Get language negotiation settings.
- $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE);
+ $mode = variable_get('language_negotiation');
$form['locale']['language'] = array(
'#type' => (count($names) <= 5 ? 'radios' : 'select'),
'#title' => t('Language'),
@@ -355,7 +360,7 @@ function locale($string = NULL, $langcod
// the exact list of strings used on a page. From a performance
// perspective that is a really bad idea, so we have no user
// interface for this. Be careful when turning this option off!
- if (variable_get('locale_cache_strings', 1) == 1) {
+ if (variable_get('locale_cache_strings') == 1) {
if ($cache = cache_get('locale:' . $langcode, 'cache')) {
$locale_t[$langcode] = $cache->data;
}
@@ -501,8 +506,8 @@ function locale_system_update($component
function locale_update_js_files() {
global $language;
- $dir = file_create_path(variable_get('locale_js_directory', 'languages'));
- $parsed = variable_get('javascript_parsed', array());
+ $dir = file_create_path(variable_get('locale_js_directory'));
+ $parsed = variable_get('javascript_parsed');
// The first three parameters are NULL in order to get an array with all
// scopes. This is necessary to prevent recreation of JS translation files
@@ -575,7 +580,7 @@ function locale_block($op = 'list', $del
// Only show if we have at least two languages and language dependent
// web addresses, so we can actually link to other language versions.
- elseif ($op == 'view' && variable_get('language_count', 1) > 1 && variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE) != LANGUAGE_NEGOTIATION_NONE) {
+ elseif ($op == 'view' && variable_get('language_count') > 1 && variable_get('language_negotiation') != LANGUAGE_NEGOTIATION_NONE) {
$languages = language_list('enabled');
$links = array();
foreach ($languages[1] as $language) {
Index: modules/menu/menu.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v
retrieving revision 1.32
diff -u -p -r1.32 menu.admin.inc
--- modules/menu/menu.admin.inc 16 Jul 2008 21:59:27 -0000 1.32
+++ modules/menu/menu.admin.inc 25 Jul 2008 05:34:29 -0000
@@ -607,12 +607,12 @@ function menu_configure() {
$form['menu_default_node_menu'] = array(
'#type' => 'select',
'#title' => t('Default menu for content'),
- '#default_value' => variable_get('menu_default_node_menu', 'main-menu'),
+ '#default_value' => variable_get('menu_default_node_menu'),
'#options' => $menu_options,
'#description' => t('Choose the menu to be the default in the menu options in the content authoring form.'),
);
- $main = variable_get('menu_main_menu_source', 'main-menu');
+ $main = variable_get('menu_main_menu_source');
$main_options = array_merge($menu_options, array('' => t('No Main menu')));
$form['menu_main_menu_source'] = array(
'#type' => 'select',
@@ -627,7 +627,7 @@ function menu_configure() {
$form["menu_secondary_menu_source"] = array(
'#type' => 'select',
'#title' => t('Source for the Secondary menu'),
- '#default_value' => variable_get('menu_secondary_menu_source', 'secondary-menu'),
+ '#default_value' => variable_get('menu_secondary_menu_source'),
'#options' => $secondary_options,
'#tree' => FALSE,
'#description' => t("Select the source for the Secondary menu. An advanced option allows you to use the same source for both Main menu (currently %main) and Secondary menu: if your source menu has two levels of hierarchy, the top level menu items will appear in the Main menu, and the children of the active item will appear in the Secondary menu." , array('%main' => $main_options[$main])),
Index: modules/menu/menu.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v
retrieving revision 1.166
diff -u -p -r1.166 menu.module
--- modules/menu/menu.module 24 Jul 2008 16:25:18 -0000 1.166
+++ modules/menu/menu.module 25 Jul 2008 06:34:12 -0000
@@ -13,6 +13,16 @@
define('MENU_MAX_MENU_NAME_LENGTH_UI', 27);
/**
+ * Implementation of hook_variables().
+ */
+function menu_variables() {
+ return array(
+ 'menu_default_node_menu' => 'main-menu',
+ 'menu_override_parent_selector' => FALSE,
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function menu_help($path, $arg) {
@@ -197,7 +207,7 @@ function menu_parent_options($menus, $it
// allow contrib modules to provide more scalable pattern choosers.
// hook_form_alter is too late in itself because all the possible parents are
// retrieved here, unless menu_override_parent_selector is set to TRUE.
- if (variable_get('menu_override_parent_selector', FALSE)) {
+ if (variable_get('menu_override_parent_selector')) {
return array();
}
// If the item has children, there is an added limit to the depth of valid parents.
@@ -310,7 +320,7 @@ function menu_nodeapi(&$node, $op) {
case 'prepare':
if (empty($node->menu)) {
// Prepare the node for the edit form so that $node->menu always exists.
- $menu_name = variable_get('menu_default_node_menu', 'main-menu');
+ $menu_name = variable_get('menu_default_node_menu');
$item = array();
if (isset($node->nid)) {
// Give priority to the default menu
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.57
diff -u -p -r1.57 content_types.inc
--- modules/node/content_types.inc 16 Jul 2008 21:59:27 -0000 1.57
+++ modules/node/content_types.inc 25 Jul 2008 05:34:29 -0000
@@ -152,7 +152,7 @@ function node_type_form(&$form_state, $t
);
$form['workflow']['node_options'] = array('#type' => 'checkboxes',
'#title' => t('Default options'),
- '#default_value' => variable_get('node_options_' . $type->type, array('status', 'promote')),
+ '#default_value' => variable_get('node_options_' . $type->type, array('status')),
'#options' => array(
'status' => t('Published'),
'promote' => t('Promoted to front page'),
Index: modules/node/node.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v
retrieving revision 1.24
diff -u -p -r1.24 node.admin.inc
--- modules/node/node.admin.inc 19 Jul 2008 19:04:24 -0000 1.24
+++ modules/node/node.admin.inc 25 Jul 2008 05:34:29 -0000
@@ -29,12 +29,12 @@ function node_configure() {
}
$form['default_nodes_main'] = array(
- '#type' => 'select', '#title' => t('Number of posts on main page'), '#default_value' => variable_get('default_nodes_main', 10),
+ '#type' => 'select', '#title' => t('Number of posts on main page'), '#default_value' => variable_get('default_nodes_main'),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
'#description' => t('The default maximum number of posts to display per page on overview pages such as the main page.')
);
$form['teaser_length'] = array(
- '#type' => 'select', '#title' => t('Length of trimmed posts'), '#default_value' => variable_get('teaser_length', 600),
+ '#type' => 'select', '#title' => t('Length of trimmed posts'), '#default_value' => variable_get('teaser_length'),
'#options' => drupal_map_assoc(array(0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000), '_node_characters'),
'#description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited' . Note that this setting will only affect new or updated content and will not affect existing teasers.")
);
@@ -42,7 +42,7 @@ function node_configure() {
$form['node_preview'] = array(
'#type' => 'radios',
'#title' => t('Preview post'),
- '#default_value' => variable_get('node_preview', 0),
+ '#default_value' => variable_get('node_preview'),
'#options' => array(t('Optional'), t('Required')),
'#description' => t('Must users preview posts before submitting?'),
);
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.969
diff -u -p -r1.969 node.module
--- modules/node/node.module 24 Jul 2008 16:25:18 -0000 1.969
+++ modules/node/node.module 25 Jul 2008 06:37:13 -0000
@@ -46,6 +46,23 @@ define('NODE_BUILD_RSS', 4);
define('NODE_BUILD_PRINT', 5);
/**
+ * Implementation of hook_variables().
+ */
+function node_variables() {
+ return array(
+ 'node_options' => array(
+ '#type' => 'value',
+ '#value' => array('status', 'promote'),
+ ),
+ 'node_cron_last' => 0,
+ 'default_nodes_main' => 10,
+ 'teaser_length' => 600,
+ 'node_preview' => 0,
+ 'node_access_needs_rebuild' => FALSE,
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function node_help($path, $arg) {
@@ -330,7 +347,7 @@ function node_teaser_include_verify(&$fo
function node_teaser($body, $format = NULL, $size = NULL) {
if (!isset($size)) {
- $size = variable_get('teaser_length', 600);
+ $size = variable_get('teaser_length');
}
// Find where the delimiter is in the body
@@ -1358,7 +1375,7 @@ function node_ranking() {
);
// Add relevance based on creation or changed date.
- if ($node_cron_last = variable_get('node_cron_last', 0)) {
+ if ($node_cron_last = variable_get('node_cron_last')) {
$ranking['recent'] = array(
'title' => t('Recently posted'),
// Exponential decay with half-life of 6 months, starting at last indexed node
@@ -1703,13 +1720,13 @@ function node_feed($nids = FALSE, $chann
if ($nids === FALSE) {
$nids = array();
- $result = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));
+ $result = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items'));
while ($row = db_fetch_object($result)) {
$nids[] = $row->nid;
}
}
- $item_length = variable_get('feed_item_length', 'teaser');
+ $item_length = variable_get('feed_item_length');
$namespaces = array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/');
$items = '';
@@ -1764,9 +1781,9 @@ function node_feed($nids = FALSE, $chann
$channel_defaults = array(
'version' => '2.0',
- 'title' => variable_get('site_name', 'Drupal'),
+ 'title' => variable_get('site_name'),
'link' => $base_url,
- 'description' => variable_get('site_mission', ''),
+ 'description' => variable_get('site_mission'),
'language' => $language->language
);
$channel = array_merge($channel_defaults, $channel);
@@ -1784,7 +1801,7 @@ function node_feed($nids = FALSE, $chann
* Menu callback; Generate a listing of promoted nodes.
*/
function node_page_default() {
- $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
+ $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main'));
$output = '';
$num_rows = FALSE;
@@ -1795,8 +1812,8 @@ function node_page_default() {
if ($num_rows) {
$feed_url = url('rss.xml', array('absolute' => TRUE));
- drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') . ' ' . t('RSS'));
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ drupal_add_feed($feed_url, variable_get('site_name') . ' ' . t('RSS'));
+ $output .= theme('pager', NULL, variable_get('default_nodes_main'));
}
else {
$default_message = '' . t('Welcome to your new Drupal website!') . '
';
@@ -1828,7 +1845,7 @@ function node_page_view($node, $cid = NU
* Implementation of hook_update_index().
*/
function node_update_index() {
- $limit = (int)variable_get('search_cron_limit', 100);
+ $limit = (int)variable_get('search_cron_limit');
// Store the maximum possible comments per thread (used for ranking by reply count)
variable_set('node_cron_comments_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'))));
@@ -2327,7 +2344,7 @@ function node_access_write_grants($node,
*/
function node_access_needs_rebuild($rebuild = NULL) {
if (!isset($rebuild)) {
- return variable_get('node_access_needs_rebuild', FALSE);
+ return variable_get('node_access_needs_rebuild');
}
elseif ($rebuild) {
variable_set('node_access_needs_rebuild', TRUE);
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.31
diff -u -p -r1.31 node.pages.inc
--- modules/node/node.pages.inc 10 Jul 2008 11:12:02 -0000 1.31
+++ modules/node/node.pages.inc 25 Jul 2008 08:18:58 -0000
@@ -67,7 +67,7 @@ function node_form_validate($form, &$for
function node_object_prepare(&$node) {
// Set up default values, if required.
- $node_options = variable_get('node_options_' . $node->type, array('status', 'promote'));
+ $node_options = variable_get('node_options_' . $node->type, array('status'));
// If this is a new node, fill in the default values.
if (!isset($node->nid)) {
foreach (array('status', 'promote', 'sticky') as $key) {
@@ -180,7 +180,7 @@ function node_form(&$form_state, $node)
'#autocomplete_path' => 'user/autocomplete',
'#default_value' => $node->name ? $node->name : '',
'#weight' => -1,
- '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),
+ '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous'))),
);
$form['author']['date'] = array(
'#type' => 'textfield',
Index: modules/openid/openid.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v
retrieving revision 1.27
diff -u -p -r1.27 openid.module
--- modules/openid/openid.module 24 Jul 2008 16:25:18 -0000 1.27
+++ modules/openid/openid.module 25 Jul 2008 05:34:31 -0000
@@ -63,7 +63,7 @@ function openid_help($path, $arg) {
function openid_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'insert' && isset($_SESSION['openid']['values'])) {
// The user has registered after trying to login via OpenID.
- if (variable_get('user_email_verification', TRUE)) {
+ if (variable_get('user_email_verification')) {
drupal_set_message(t('Once you have verified your email address, you may log in via OpenID.'));
}
unset($_SESSION['openid']);
@@ -118,7 +118,7 @@ function openid_form_alter(&$form, $form
$form['mail']['#default_value'] = $_SESSION['openid']['values']['mail'];
// If user_email_verification is off, hide the password field and just fill
// with random password to avoid confusion.
- if (!variable_get('user_email_verification', TRUE)) {
+ if (!variable_get('user_email_verification')) {
$form['pass']['#type'] = 'hidden';
$form['pass']['#value'] = user_password();
}
@@ -387,20 +387,20 @@ function openid_authentication($response
$account = user_external_load($identity);
if (isset($account->uid)) {
- if (!variable_get('user_email_verification', TRUE) || $account->login) {
+ if (!variable_get('user_email_verification') || $account->login) {
user_external_login($account, $_SESSION['openid']['user_login_values']);
}
else {
drupal_set_message(t('You must validate your email address for this account before logging in via OpenID'));
}
}
- elseif (variable_get('user_register', 1)) {
+ elseif (variable_get('user_register')) {
// Register new user
$form_state['redirect'] = NULL;
$form_state['values']['name'] = (empty($response['openid.sreg.nickname'])) ? $identity : $response['openid.sreg.nickname'];
$form_state['values']['mail'] = (empty($response['openid.sreg.email'])) ? '' : $response['openid.sreg.email'];
$form_state['values']['pass'] = user_password();
- $form_state['values']['status'] = variable_get('user_register', 1) == 1;
+ $form_state['values']['status'] = variable_get('user_register') == 1;
$form_state['values']['response'] = $response;
$form = drupal_retrieve_form('user_register', $form_state);
drupal_prepare_form('user_register', $form, $form_state);
Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.8
diff -u -p -r1.8 path.admin.inc
--- modules/path/path.admin.inc 14 Apr 2008 17:48:38 -0000 1.8
+++ modules/path/path.admin.inc 25 Jul 2008 05:34:31 -0000
@@ -95,7 +95,7 @@ function path_admin_form(&$form_state, $
'#maxlength' => 64,
'#size' => 45,
'#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url') ? '' : '?q='),
'#required' => TRUE,
);
$form['dst'] = array(
@@ -105,7 +105,7 @@ function path_admin_form(&$form_state, $
'#maxlength' => 64,
'#size' => 45,
'#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url') ? '' : '?q='),
'#required' => TRUE,
);
// This will be a hidden value unless locale module is enabled
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.243
diff -u -p -r1.243 profile.module
--- modules/profile/profile.module 24 Jul 2008 16:25:18 -0000 1.243
+++ modules/profile/profile.module 25 Jul 2008 08:04:18 -0000
@@ -27,6 +27,18 @@ define('PROFILE_PUBLIC_LISTINGS', 3);
define('PROFILE_HIDDEN', 4);
/**
+ * Implementation of hook_variables().
+ */
+function profile_variables() {
+ return array(
+ 'profile_block_author_fields' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function profile_help($path, $arg) {
@@ -146,7 +158,7 @@ function profile_block($op = 'list', $de
$form['profile_block_author_fields'] = array(
'#type' => 'checkboxes',
'#title' => t('Profile fields to display'),
- '#default_value' => variable_get('profile_block_author_fields', array()),
+ '#default_value' => variable_get('profile_block_author_fields'),
'#options' => $fields,
'#description' => t('Select which profile fields you wish to display in the block. Only fields designated as public in the profile field configuration are available.', array('@profile-admin' => url('admin/user/profile'))),
);
@@ -162,7 +174,7 @@ function profile_block($op = 'list', $de
$node = node_load(arg(1));
$account = user_load(array('uid' => $node->uid));
- if ($use_fields = variable_get('profile_block_author_fields', array())) {
+ if ($use_fields = variable_get('profile_block_author_fields')) {
// Compile a list of fields to show.
$fields = array();
$result = db_query('SELECT name, title, type, visibility, weight FROM {profile_fields} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
@@ -261,7 +273,7 @@ function profile_view_field($user, $fiel
case 'url':
return '' . check_plain($value) . '';
case 'date':
- $format = substr(variable_get('date_format_short', 'm/d/Y - H:i'), 0, 5);
+ $format = substr(variable_get('date_format_short'), 0, 5);
// Note: Avoid PHP's date() because it does not handle dates before
// 1970 on Windows. This would make the date field useless for e.g.
// birthdays.
Index: modules/search/search.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.admin.inc,v
retrieving revision 1.6
diff -u -p -r1.6 search.admin.inc
--- modules/search/search.admin.inc 16 Jul 2008 21:59:27 -0000 1.6
+++ modules/search/search.admin.inc 25 Jul 2008 05:34:34 -0000
@@ -55,12 +55,12 @@ function search_admin_settings() {
// Indexing throttle:
$form['indexing_throttle'] = array('#type' => 'fieldset', '#title' => t('Indexing throttle'));
- $form['indexing_throttle']['search_cron_limit'] = array('#type' => 'select', '#title' => t('Number of items to index per cron run'), '#default_value' => variable_get('search_cron_limit', 100), '#options' => $items, '#description' => t('The maximum number of items indexed in each pass of a cron maintenance task. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => url('admin/reports/status'))));
+ $form['indexing_throttle']['search_cron_limit'] = array('#type' => 'select', '#title' => t('Number of items to index per cron run'), '#default_value' => variable_get('search_cron_limit'), '#options' => $items, '#description' => t('The maximum number of items indexed in each pass of a cron maintenance task. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => url('admin/reports/status'))));
// Indexing settings:
$form['indexing_settings'] = array('#type' => 'fieldset', '#title' => t('Indexing settings'));
$form['indexing_settings']['info'] = array('#markup' => t('Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.
The default settings should be appropriate for the majority of sites.
'));
- $form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).'));
- $form['indexing_settings']['overlap_cjk'] = array('#type' => 'checkbox', '#title' => t('Simple CJK handling'), '#default_value' => variable_get('overlap_cjk', TRUE), '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.'));
+ $form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size'), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).'));
+ $form['indexing_settings']['overlap_cjk'] = array('#type' => 'checkbox', '#title' => t('Simple CJK handling'), '#default_value' => variable_get('overlap_cjk'), '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.'));
$form['#validate'] = array('search_admin_settings_validate');
@@ -77,8 +77,8 @@ function search_admin_settings_validate(
drupal_goto('admin/settings/search/wipe');
}
// If these settings change, the index needs to be rebuilt.
- if ((variable_get('minimum_word_size', 3) != $form_state['values']['minimum_word_size']) ||
- (variable_get('overlap_cjk', TRUE) != $form_state['values']['overlap_cjk'])) {
+ if ((variable_get('minimum_word_size') != $form_state['values']['minimum_word_size']) ||
+ (variable_get('overlap_cjk') != $form_state['values']['overlap_cjk'])) {
drupal_set_message(t('The index will be rebuilt.'));
search_wipe();
}
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.260
diff -u -p -r1.260 search.module
--- modules/search/search.module 24 Jul 2008 16:25:18 -0000 1.260
+++ modules/search/search.module 25 Jul 2008 06:41:55 -0000
@@ -91,6 +91,17 @@ define('PREG_CLASS_CJK', '\x{3041}-\x{30
'\x{4e00}-\x{9fbb}\x{f900}-\x{fad9}');
/**
+ * Implementation of hook_variables().
+ */
+function search_variables() {
+ return array(
+ 'minimum_word_size' => 3,
+ 'overlap_cjk' => TRUE,
+ 'search_cron_limit' => 100,
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function search_help($path, $arg) {
@@ -312,7 +323,7 @@ function search_simplify($text) {
search_invoke_preprocess($text);
// Simple CJK handling
- if (variable_get('overlap_cjk', TRUE)) {
+ if (variable_get('overlap_cjk')) {
$text = preg_replace_callback('/[' . PREG_CLASS_CJK . ']+/u', 'search_expand_cjk', $text);
}
@@ -340,7 +351,7 @@ function search_simplify($text) {
* sequences of characters ('minimum_word_size' long).
*/
function search_expand_cjk($matches) {
- $min = variable_get('minimum_word_size', 3);
+ $min = variable_get('minimum_word_size');
$str = $matches[0];
$l = drupal_strlen($str);
// Passthrough short words
@@ -417,7 +428,7 @@ function search_invoke_preprocess(&$text
* @ingroup search
*/
function search_index($sid, $type, $text) {
- $minimum_word_size = variable_get('minimum_word_size', 3);
+ $minimum_word_size = variable_get('minimum_word_size');
// Link matching
global $base_url;
@@ -844,7 +855,7 @@ function _search_parse_query(&$word, &$s
$split = explode(' ', $word);
foreach ($split as $s) {
$num = is_numeric($s);
- if ($num || drupal_strlen($s) >= variable_get('minimum_word_size', 3)) {
+ if ($num || drupal_strlen($s) >= variable_get('minimum_word_size')) {
$s = $num ? ((int)ltrim($s, '-0')) : $s;
if (!isset($scores[$s])) {
$scores[$s] = $s;
@@ -916,7 +927,7 @@ function do_search($keywords, $type, $jo
$query = search_parse_query($keywords);
if ($query[2] == '') {
- form_set_error('keys', t('You must include at least one positive keyword with @count characters or more.', array('@count' => variable_get('minimum_word_size', 3))));
+ form_set_error('keys', t('You must include at least one positive keyword with @count characters or more.', array('@count' => variable_get('minimum_word_size'))));
}
if ($query[6]) {
if ($query[6] == 'or') {
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.27
diff -u -p -r1.27 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php 18 Jul 2008 07:30:34 -0000 1.27
+++ modules/simpletest/drupal_web_test_case.php 25 Jul 2008 05:34:35 -0000
@@ -626,7 +626,7 @@ class DrupalWebTestCase {
// Store necessary current values before switching to prefixed database.
$this->db_prefix_original = $db_prefix;
- $clean_url_original = variable_get('clean_url', 0);
+ $clean_url_original = variable_get('clean_url');
// Generate temporary prefixed database to ensure that tests have a clean starting point.
$db_prefix = 'simpletest' . mt_rand(1000, 1000000);
@@ -734,8 +734,8 @@ class DrupalWebTestCase {
if (preg_match('/simpletest\d+/', $db_prefix)) {
$curl_options[CURLOPT_USERAGENT] = $db_prefix;
}
- if (!isset($curl_options[CURLOPT_USERPWD]) && ($auth = variable_get('simpletest_httpauth_username', ''))) {
- if ($pass = variable_get('simpletest_httpauth_pass', '')) {
+ if (!isset($curl_options[CURLOPT_USERPWD]) && ($auth = variable_get('simpletest_httpauth_username'))) {
+ if ($pass = variable_get('simpletest_httpauth_pass')) {
$auth .= ':' . $pass;
}
$curl_options[CURLOPT_USERPWD] = $auth;
Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.7
diff -u -p -r1.7 simpletest.module
--- modules/simpletest/simpletest.module 16 Jul 2008 21:59:27 -0000 1.7
+++ modules/simpletest/simpletest.module 25 Jul 2008 06:42:42 -0000
@@ -2,6 +2,16 @@
// $Id: simpletest.module,v 1.7 2008/07/16 21:59:27 dries Exp $
/**
+ * Implementation of hook_variables().
+ */
+function simpletest_variables() {
+ return array(
+ 'simpletest_httpauth_username' => '',
+ 'simpletest_httpauth_pass' => '',
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function simpletest_help($path, $arg) {
Index: modules/simpletest/simpletest.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.test,v
retrieving revision 1.4
diff -u -p -r1.4 simpletest.test
--- modules/simpletest/simpletest.test 18 Jul 2008 07:24:29 -0000 1.4
+++ modules/simpletest/simpletest.test 25 Jul 2008 05:34:35 -0000
@@ -41,7 +41,7 @@ class SimpleTestTestCase extends DrupalW
global $conf;
if (!$this->inCURL()) {
$this->drupalGet('node');
- $this->assertTitle(variable_get('site_name', 'Drupal'), t('Site title matches.'));
+ $this->assertTitle(variable_get('site_name'), t('Site title matches.'));
// Make sure that we are locked out of the installer when prefixing
// using the user-agent header. This is an important security check.
global $base_url;
Index: modules/statistics/statistics.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v
retrieving revision 1.8
diff -u -p -r1.8 statistics.admin.inc
--- modules/statistics/statistics.admin.inc 7 May 2008 19:17:50 -0000 1.8
+++ modules/statistics/statistics.admin.inc 25 Jul 2008 05:34:35 -0000
@@ -64,7 +64,7 @@ function statistics_top_pages() {
$rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4));
}
- drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
+ drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer')))));
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
return $output;
@@ -97,7 +97,7 @@ function statistics_top_visitors() {
$rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4));
}
- drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
+ drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer')))));
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
return $output;
@@ -109,7 +109,7 @@ function statistics_top_visitors() {
function statistics_top_referrers() {
$query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%%%s%%' AND url <> '' GROUP BY url";
$query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE '%%%s%%'";
- drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
+ drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer')))));
$header = array(
array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'),
@@ -189,14 +189,14 @@ function statistics_access_logging_setti
$form['access']['statistics_enable_access_log'] = array(
'#type' => 'radios',
'#title' => t('Enable access log'),
- '#default_value' => variable_get('statistics_enable_access_log', 0),
+ '#default_value' => variable_get('statistics_enable_access_log'),
'#options' => $options,
'#description' => t('Log each page access. Required for referrer statistics.'));
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
$form['access']['statistics_flush_accesslog_timer'] = array(
'#type' => 'select',
'#title' => t('Discard access logs older than'),
- '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200),
+ '#default_value' => variable_get('statistics_flush_accesslog_timer'),
'#options' => $period,
'#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. (Requires a correctly configured cron maintenance task.)', array('@cron' => url('admin/reports/status'))));
@@ -207,7 +207,7 @@ function statistics_access_logging_setti
$form['content']['statistics_count_content_views'] = array(
'#type' => 'radios',
'#title' => t('Count content views'),
- '#default_value' => variable_get('statistics_count_content_views', 0),
+ '#default_value' => variable_get('statistics_count_content_views'),
'#options' => $options,
'#description' => t('Increment a counter each time content is viewed.'));
Index: modules/statistics/statistics.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v
retrieving revision 1.279
diff -u -p -r1.279 statistics.module
--- modules/statistics/statistics.module 12 Jun 2008 18:46:51 -0000 1.279
+++ modules/statistics/statistics.module 25 Jul 2008 06:45:17 -0000
@@ -7,6 +7,22 @@
*/
/**
+ * Implementation of hook_variables().
+ */
+function statistics_variables() {
+ return array(
+ 'statistics_flush_accesslog_timer' => 259200,
+ 'statistics_enable_access_log' => 0,
+ 'statistics_count_content_views' => 0,
+ 'statistics_day_timestamp' => '',
+ 'statistics_block_top_day_num' => 0,
+ 'statistics_block_top_all_num' => 0,
+ 'statistics_block_top_last_num' => 0,
+ 'node_cron_views_scale' => 0,
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function statistics_help($path, $arg) {
@@ -47,7 +63,7 @@ function statistics_exit() {
drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
- if (variable_get('statistics_count_content_views', 0)) {
+ if (variable_get('statistics_count_content_views')) {
// We are counting content views.
if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') {
// A node has been viewed, so update the node's counters.
@@ -59,7 +75,7 @@ function statistics_exit() {
}
}
}
- if (variable_get('statistics_enable_access_log', 0)) {
+ if (variable_get('statistics_enable_access_log')) {
// Log this page access.
db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", strip_tags(drupal_get_title()), $_GET['q'], referer_uri(), ip_address(), $user->uid, session_id(), timer_read('page'), time());
}
@@ -172,7 +188,7 @@ function statistics_user($op, &$edit, &$
* Implementation of hook_cron().
*/
function statistics_cron() {
- $statistics_timestamp = variable_get('statistics_day_timestamp', '');
+ $statistics_timestamp = variable_get('statistics_day_timestamp');
if ((time() - $statistics_timestamp) >= 86400) {
// Reset day counts.
@@ -181,7 +197,7 @@ function statistics_cron() {
}
// Clean up expired access logs.
- db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200));
+ db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer'));
}
/**
@@ -237,7 +253,7 @@ function statistics_get($nid) {
function statistics_block($op = 'list', $delta = '', $edit = array()) {
switch ($op) {
case 'list':
- if (variable_get('statistics_count_content_views', 0)) {
+ if (variable_get('statistics_count_content_views')) {
$blocks['popular']['info'] = t('Popular content');
// Too dynamic to cache.
$blocks['popular']['cache'] = BLOCK_NO_CACHE;
@@ -248,9 +264,9 @@ function statistics_block($op = 'list',
case 'configure':
// Popular content block settings
$numbers = array('0' => t('Disabled')) + drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
- $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => variable_get('statistics_block_top_day_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
- $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => variable_get('statistics_block_top_all_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
- $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => variable_get('statistics_block_top_last_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
+ $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => variable_get('statistics_block_top_day_num'), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
+ $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => variable_get('statistics_block_top_all_num'), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
+ $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => variable_get('statistics_block_top_last_num'), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
return $form;
case 'save':
@@ -263,17 +279,17 @@ function statistics_block($op = 'list',
if (user_access('access content')) {
$content = array();
- $daytop = variable_get('statistics_block_top_day_num', 0);
+ $daytop = variable_get('statistics_block_top_day_num');
if ($daytop && ($result = statistics_title_list('daycount', $daytop)) && ($node_title_list = node_title_list($result, t("Today's:")))) {
$content[] = $node_title_list;
}
- $alltimetop = variable_get('statistics_block_top_all_num', 0);
+ $alltimetop = variable_get('statistics_block_top_all_num');
if ($alltimetop && ($result = statistics_title_list('totalcount', $alltimetop)) && ($node_title_list = node_title_list($result, t('All time:')))) {
$content[] = $node_title_list;
}
- $lasttop = variable_get('statistics_block_top_last_num', 0);
+ $lasttop = variable_get('statistics_block_top_last_num');
if ($lasttop && ($result = statistics_title_list('timestamp', $lasttop)) && ($node_title_list = node_title_list($result, t('Last viewed:')))) {
$content[] = $node_title_list;
}
@@ -319,14 +335,14 @@ function statistics_nodeapi(&$node, $op,
* Implementation of hook_ranking().
*/
function statistics_ranking() {
- if (variable_get('statistics_count_content_views', 0)) {
+ if (variable_get('statistics_count_content_views')) {
return array(
'views' => array(
'title' => t('Number of views'),
'join' => 'LEFT JOIN {node_counter} node_counter ON node_counter.nid = i.sid',
// Inverse law that maps the highest view count on the site to 1 and 0 to 0.
'score' => '2.0 - 2.0 / (1.0 + node_counter.totalcount * %f)',
- 'arguments' => array(variable_get('node_cron_views_scale', 0)),
+ 'arguments' => array(variable_get('node_cron_views_scale')),
),
);
}
Index: modules/syslog/syslog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/syslog/syslog.module,v
retrieving revision 1.17
diff -u -p -r1.17 syslog.module
--- modules/syslog/syslog.module 24 Jul 2008 06:52:35 -0000 1.17
+++ modules/syslog/syslog.module 25 Jul 2008 06:47:33 -0000
@@ -14,6 +14,15 @@ else {
}
/**
+ * Implementation of hook_variables().
+ */
+function syslog_variables() {
+ return array(
+ 'syslog_facility' => DEFAULT_SYSLOG_FACILITY,
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function syslog_help($path, $arg) {
@@ -41,7 +50,7 @@ function syslog_admin_settings() {
$form['syslog_facility'] = array(
'#type' => 'select',
'#title' => t('Send events to this syslog facility'),
- '#default_value' => variable_get('syslog_facility', DEFAULT_SYSLOG_FACILITY),
+ '#default_value' => variable_get('syslog_facility'),
'#options' => syslog_facility_list(),
'#description' => t('Select the syslog facility code under which Drupal\'s messages should be sent. On UNIX/Linux systems, Drupal can flag its messages with the code LOG_LOCAL0 through LOG_LOCAL7; for Microsoft Windows, all messages are flagged with the code LOG_USER. Depending on the system configuration, syslog and other logging tools use this code to identify or filter Drupal messages from within the entire system log. For more information on syslog, see Syslog help.', array(
'@syslog_help' => url('admin/help/syslog'))),
@@ -73,7 +82,7 @@ function syslog_watchdog($entry) {
if (!$log_init) {
$log_init = TRUE;
- openlog('drupal', LOG_NDELAY, variable_get('syslog_facility', DEFAULT_SYSLOG_FACILITY));
+ openlog('drupal', LOG_NDELAY, variable_get('syslog_facility'));
}
syslog($entry['severity'], theme('syslog_format', $entry));
Index: modules/system/image.gd.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/image.gd.inc,v
retrieving revision 1.2
diff -u -p -r1.2 image.gd.inc
--- modules/system/image.gd.inc 16 Jul 2008 21:59:28 -0000 1.2
+++ modules/system/image.gd.inc 25 Jul 2008 05:34:36 -0000
@@ -34,7 +34,7 @@ function image_gd_settings() {
'#description' => t('Define the image quality for JPEG manipulations. Ranges from 0 to 100. Higher values mean better image quality but bigger files.'),
'#size' => 10,
'#maxlength' => 3,
- '#default_value' => variable_get('image_jpeg_quality', 75),
+ '#default_value' => variable_get('image_jpeg_quality'),
'#field_suffix' => t('%'),
);
$form['#element_validate'] = array('image_gd_settings_validate');
@@ -209,7 +209,7 @@ function image_gd_close($res, $destinati
return FALSE;
}
if ($extension == 'jpeg') {
- return $close_func($res, $destination, variable_get('image_jpeg_quality', 75));
+ return $close_func($res, $destination, variable_get('image_jpeg_quality'));
}
else {
return $close_func($res, $destination);
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.82
diff -u -p -r1.82 system.admin.inc
--- modules/system/system.admin.inc 23 Jul 2008 07:37:06 -0000 1.82
+++ modules/system/system.admin.inc 25 Jul 2008 08:22:48 -0000
@@ -153,14 +153,14 @@ function system_admin_theme_settings() {
'#options' => $options,
'#title' => t('Administration theme'),
'#description' => t('Choose which theme the administration pages should display in. If you choose "System default" the administration pages will use the same theme as the rest of the site.'),
- '#default_value' => variable_get('admin_theme', '0'),
+ '#default_value' => variable_get('admin_theme'),
);
$form['node_admin_theme'] = array(
'#type' => 'checkbox',
'#title' => t('Use administration theme for content editing'),
'#description' => t('Use the administration theme when editing existing posts or creating new ones.'),
- '#default_value' => variable_get('node_admin_theme', '0'),
+ '#default_value' => variable_get('node_admin_theme'),
);
$form['#submit'][] = 'system_admin_theme_submit';
@@ -203,7 +203,7 @@ function system_themes_form() {
);
$options[$theme->name] = '';
- if (!empty($theme->status) || $theme->name == variable_get('admin_theme', '0')) {
+ if (!empty($theme->status) || $theme->name == variable_get('admin_theme')) {
$form[$theme->name]['operations'] = array('#markup' => l(t('configure'), 'admin/build/themes/settings/' . $theme->name) );
}
else {
@@ -234,7 +234,7 @@ function system_themes_form() {
$form['theme_default'] = array(
'#type' => 'radios',
'#options' => $options,
- '#default_value' => variable_get('theme_default', 'garland'),
+ '#default_value' => variable_get('theme_default'),
);
$form['buttons']['submit'] = array(
'#type' => 'submit',
@@ -272,7 +272,7 @@ function system_themes_form_submit($form
}
}
}
- if (($admin_theme = variable_get('admin_theme', '0')) != '0' && $admin_theme != $form_state['values']['theme_default']) {
+ if (($admin_theme = variable_get('admin_theme')) != '0' && $admin_theme != $form_state['values']['theme_default']) {
drupal_set_message(t('Please note that the administration theme is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array(
'!admin_theme_page' => url('admin/settings/admin'),
'%admin_theme' => $admin_theme,
@@ -376,7 +376,7 @@ function system_theme_settings(&$form_st
// Some features are not always available
$disabled = array();
- if (!variable_get('user_pictures', 0)) {
+ if (!variable_get('user_pictures')) {
$disabled['toggle_node_user_picture'] = TRUE;
$disabled['toggle_comment_user_picture'] = TRUE;
}
@@ -1196,49 +1196,49 @@ function system_site_information_setting
$form['site_name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
- '#default_value' => variable_get('site_name', 'Drupal'),
+ '#default_value' => variable_get('site_name'),
'#description' => t('The name of this website.'),
'#required' => TRUE
);
$form['site_mail'] = array(
'#type' => 'textfield',
'#title' => t('E-mail address'),
- '#default_value' => variable_get('site_mail', ini_get('sendmail_from')),
+ '#default_value' => variable_get('site_mail'),
'#description' => t("The From address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)"),
'#required' => TRUE,
);
$form['site_slogan'] = array(
'#type' => 'textfield',
'#title' => t('Slogan'),
- '#default_value' => variable_get('site_slogan', ''),
+ '#default_value' => variable_get('site_slogan'),
'#description' => t("Your site's motto, tag line, or catchphrase (often displayed alongside the title of the site).")
);
$form['site_mission'] = array(
'#type' => 'textarea',
'#title' => t('Mission'),
- '#default_value' => variable_get('site_mission', ''),
+ '#default_value' => variable_get('site_mission'),
'#description' => t("Your site's mission or focus statement (often prominently displayed on the front page).")
);
$form['site_footer'] = array(
'#type' => 'textarea',
'#title' => t('Footer message'),
- '#default_value' => variable_get('site_footer', ''),
+ '#default_value' => variable_get('site_footer'),
'#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.')
);
$form['anonymous'] = array(
'#type' => 'textfield',
'#title' => t('Anonymous user'),
- '#default_value' => variable_get('anonymous', t('Anonymous')),
+ '#default_value' => variable_get('anonymous'),
'#description' => t('The name used to indicate anonymous users.'),
'#required' => TRUE,
);
$form['site_frontpage'] = array(
'#type' => 'textfield',
'#title' => t('Default front page'),
- '#default_value' => variable_get('site_frontpage', 'node'),
+ '#default_value' => variable_get('site_frontpage'),
'#size' => 40,
'#description' => t('The home page displays content from this relative URL. If unsure, specify "node".'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url') ? '' : '?q='),
'#required' => TRUE,
);
$form['#validate'][] = 'system_site_information_settings_validate';
@@ -1277,23 +1277,23 @@ function system_error_reporting_settings
$form['site_403'] = array(
'#type' => 'textfield',
'#title' => t('Default 403 (access denied) page'),
- '#default_value' => variable_get('site_403', ''),
+ '#default_value' => variable_get('site_403'),
'#size' => 40,
'#description' => t('This page is displayed when the requested document is denied to the current user. If unsure, specify nothing.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url') ? '' : '?q=')
);
$form['site_404'] = array(
'#type' => 'textfield',
'#title' => t('Default 404 (not found) page'),
- '#default_value' => variable_get('site_404', ''),
+ '#default_value' => variable_get('site_404'),
'#size' => 40,
'#description' => t('This page is displayed when no other content matches the requested document. If unsure, specify nothing.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url') ? '' : '?q=')
);
$form['error_level'] = array(
- '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1),
+ '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level'),
'#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')),
'#description' => t('Specify where Drupal, PHP and SQL errors are logged. While it is recommended that a site running in a production environment write errors to the log only, in a development or testing environment it may be helpful to write errors both to the log and to the screen.')
);
@@ -1341,7 +1341,7 @@ function system_performance_settings() {
$form['page_cache']['cache'] = array(
'#type' => 'radios',
'#title' => t('Caching mode'),
- '#default_value' => variable_get('cache', CACHE_DISABLED),
+ '#default_value' => variable_get('cache'),
'#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended for production sites, no side effects)'), CACHE_AGGRESSIVE => t('Aggressive (experts only, possible side effects)')),
'#description' => $description
);
@@ -1351,14 +1351,14 @@ function system_performance_settings() {
$form['page_cache']['cache_lifetime'] = array(
'#type' => 'select',
'#title' => t('Minimum cache lifetime'),
- '#default_value' => variable_get('cache_lifetime', 0),
+ '#default_value' => variable_get('cache_lifetime'),
'#options' => $period,
'#description' => t('On high-traffic sites, it may be necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will elapse before the cache is emptied and recreated, and is applied to both page and block caches. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
);
$form['page_cache']['page_compression'] = array(
'#type' => 'radios',
'#title' => t('Page compression'),
- '#default_value' => variable_get('page_compression', TRUE),
+ '#default_value' => variable_get('page_compression'),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t("By default, Drupal compresses the pages it caches in order to save bandwidth and improve download times. This option should be disabled when using a webserver that performs compression."),
);
@@ -1372,7 +1372,7 @@ function system_performance_settings() {
$form['block_cache']['block_cache'] = array(
'#type' => 'radios',
'#title' => t('Block cache'),
- '#default_value' => variable_get('block_cache', CACHE_DISABLED),
+ '#default_value' => variable_get('block_cache'),
'#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Enabled (recommended)')),
'#disabled' => count(module_implements('node_grants')),
'#description' => t('Note that block caching is inactive when modules defining content access restrictions are enabled.'),
@@ -1385,11 +1385,11 @@ function system_performance_settings() {
);
$directory = file_directory_path();
- $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC);
+ $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads') == FILE_DOWNLOADS_PUBLIC);
$form['bandwidth_optimizations']['preprocess_css'] = array(
'#type' => 'radios',
'#title' => t('Optimize CSS files'),
- '#default_value' => intval(variable_get('preprocess_css', 0) && $is_writable),
+ '#default_value' => intval(variable_get('preprocess_css') && $is_writable),
'#disabled' => !$is_writable,
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('This option can interfere with theme development and should only be enabled in a production environment.'),
@@ -1397,7 +1397,7 @@ function system_performance_settings() {
$form['bandwidth_optimizations']['preprocess_js'] = array(
'#type' => 'radios',
'#title' => t('Optimize JavaScript files'),
- '#default_value' => intval(variable_get('preprocess_js', 0) && $is_writable),
+ '#default_value' => intval(variable_get('preprocess_js') && $is_writable),
'#disabled' => !$is_writable,
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('This option can interfere with module development and should only be enabled in a production environment.'),
@@ -1460,7 +1460,7 @@ function system_file_system_settings() {
$form['file_downloads'] = array(
'#type' => 'radios',
'#title' => t('Download method'),
- '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
+ '#default_value' => variable_get('file_downloads'),
'#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using HTTP directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
'#description' => t('Choose the Public download method unless you wish to enforce fine-grained access controls over file downloads. Changing the download method will modify all download paths and may cause unexpected problems on an existing site.')
);
@@ -1480,7 +1480,7 @@ function system_image_toolkit_settings()
$form['image_toolkit'] = array(
'#type' => 'radios',
'#title' => t('Select an image processing toolkit'),
- '#default_value' => variable_get('image_toolkit', image_get_toolkit()),
+ '#default_value' => variable_get('image_toolkit'),
'#options' => $toolkits_available
);
}
@@ -1504,14 +1504,14 @@ function system_rss_feeds_settings() {
$form['feed_default_items'] = array(
'#type' => 'select',
'#title' => t('Number of items in each feed'),
- '#default_value' => variable_get('feed_default_items', 10),
+ '#default_value' => variable_get('feed_default_items'),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
'#description' => t('Default number of items to include in each feed.')
);
$form['feed_item_length'] = array(
'#type' => 'select',
'#title' => t('Feed content'),
- '#default_value' => variable_get('feed_item_length', 'teaser'),
+ '#default_value' => variable_get('feed_item_length'),
'#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')),
'#description' => t('Global setting for the default display of content items in each feed.')
);
@@ -1566,7 +1566,7 @@ function system_date_time_settings() {
$form['locale']['date_default_timezone'] = array(
'#type' => 'select',
'#title' => t('Default time zone'),
- '#default_value' => variable_get('date_default_timezone', 0),
+ '#default_value' => variable_get('date_default_timezone'),
'#options' => $zones,
'#description' => t('Select the default site time zone.')
);
@@ -1574,7 +1574,7 @@ function system_date_time_settings() {
$form['locale']['configurable_timezones'] = array(
'#type' => 'radios',
'#title' => t('User-configurable time zones'),
- '#default_value' => variable_get('configurable_timezones', 1),
+ '#default_value' => variable_get('configurable_timezones'),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('When enabled, users can set their own time zone and dates will be displayed accordingly.')
);
@@ -1582,7 +1582,7 @@ function system_date_time_settings() {
$form['locale']['date_first_day'] = array(
'#type' => 'select',
'#title' => t('First day of week'),
- '#default_value' => variable_get('date_first_day', 0),
+ '#default_value' => variable_get('date_first_day'),
'#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')),
'#description' => t('The first day of the week for calendar views.')
);
@@ -1592,7 +1592,7 @@ function system_date_time_settings() {
'#title' => t('Formatting'),
);
- $date_format_short = variable_get('date_format_short', $date_short[1]);
+ $date_format_short = variable_get('date_format_short');
$form['date_formats']['date_format_short'] = array(
'#prefix' => '',
'#suffix' => '
',
@@ -1604,7 +1604,7 @@ function system_date_time_settings() {
'#description' => t('The short format of date display.'),
);
- $default_short_custom = variable_get('date_format_short_custom', (isset($date_short_choices[$date_format_short]) ? $date_format_short : ''));
+ $default_short_custom = variable_get('date_format_short_custom');
$form['date_formats']['date_format_short_custom'] = array(
'#prefix' => '
',
'#suffix' => '
',
@@ -1615,7 +1615,7 @@ function system_date_time_settings() {
'#description' => t('A user-defined short date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(time(), 'custom', $default_short_custom))),
);
- $date_format_medium = variable_get('date_format_medium', $date_medium[1]);
+ $date_format_medium = variable_get('date_format_medium');
$form['date_formats']['date_format_medium'] = array(
'#prefix' => '',
'#suffix' => '
',
@@ -1627,7 +1627,7 @@ function system_date_time_settings() {
'#description' => t('The medium sized date display.'),
);
- $default_medium_custom = variable_get('date_format_medium_custom', (isset($date_medium_choices[$date_format_medium]) ? $date_format_medium : ''));
+ $default_medium_custom = variable_get('date_format_medium_custom');
$form['date_formats']['date_format_medium_custom'] = array(
'#prefix' => '
',
'#suffix' => '
',
@@ -1638,7 +1638,7 @@ function system_date_time_settings() {
'#description' => t('A user-defined medium date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(time(), 'custom', $default_medium_custom))),
);
- $date_format_long = variable_get('date_format_long', $date_long[0]);
+ $date_format_long = variable_get('date_format_long');
$form['date_formats']['date_format_long'] = array(
'#prefix' => '',
'#suffix' => '
',
@@ -1650,7 +1650,7 @@ function system_date_time_settings() {
'#description' => t('Longer date format used for detailed display.')
);
- $default_long_custom = variable_get('date_format_long_custom', (isset($date_long_choices[$date_format_long]) ? $date_format_long : ''));
+ $default_long_custom = variable_get('date_format_long_custom');
$form['date_formats']['date_format_long_custom'] = array(
'#prefix' => '
',
'#suffix' => '
',
@@ -1703,7 +1703,7 @@ function system_site_maintenance_setting
$form['site_offline'] = array(
'#type' => 'radios',
'#title' => t('Site status'),
- '#default_value' => variable_get('site_offline', 0),
+ '#default_value' => variable_get('site_offline'),
'#options' => array(t('Online'), t('Offline')),
'#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Offline", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site offline message configured below. Authorized users can log in during "Offline" mode directly via the user login page.', array('@user-login' => url('user'))),
);
@@ -1711,7 +1711,7 @@ function system_site_maintenance_setting
$form['site_offline_message'] = array(
'#type' => 'textarea',
'#title' => t('Site offline message'),
- '#default_value' => variable_get('site_offline_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))),
+ '#default_value' => variable_get('site_offline_message'),
'#description' => t('Message to show visitors when the site is in offline mode.')
);
@@ -1728,12 +1728,12 @@ function system_clean_url_settings() {
$form['clean_url'] = array(
'#type' => 'radios',
'#title' => t('Clean URLs'),
- '#default_value' => variable_get('clean_url', 0),
+ '#default_value' => variable_get('clean_url'),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('This option makes Drupal emit "clean" URLs (i.e. without ?q=
in the URL).'),
);
- if (!variable_get('clean_url', 0)) {
+ if (!variable_get('clean_url')) {
if (strpos(request_uri(), '?q=') !== FALSE) {
drupal_add_js(drupal_get_path('module', 'system') . '/system.js', 'module');
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.256
diff -u -p -r1.256 system.install
--- modules/system/system.install 1 Jul 2008 20:36:40 -0000 1.256
+++ modules/system/system.install 25 Jul 2008 05:34:37 -0000
@@ -126,19 +126,19 @@ function system_requirements($phase) {
// Report cron status.
if ($phase == 'runtime') {
// Cron warning threshold defaults to two days.
- $threshold_warning = variable_get('cron_threshold_warning', 172800);
+ $threshold_warning = variable_get('cron_threshold_warning');
// Cron error threshold defaults to two weeks.
- $threshold_error = variable_get('cron_threshold_error', 1209600);
+ $threshold_error = variable_get('cron_threshold_error');
// Cron configuration help text.
$help = $t('For more information, see the online handbook entry for configuring cron jobs.', array('@cron-handbook' => 'http://drupal.org/cron'));
// Determine when cron last ran. If never, use the install time to
// determine the warning or error status.
- $cron_last = variable_get('cron_last', NULL);
+ $cron_last = variable_get('cron_last');
$never_run = FALSE;
if (!is_numeric($cron_last)) {
$never_run = TRUE;
- $cron_last = variable_get('install_time', 0);
+ $cron_last = variable_get('install_time');
}
// Determine severity based on time since cron last ran.
@@ -171,7 +171,7 @@ function system_requirements($phase) {
}
$description .= ' ' . $t('You can run cron manually.', array('@cron' => url('admin/reports/status/run-cron')));
- $description .= '
' . $t('To run cron from outside the site, go to !cron', array('!cron' => url('cron.php', array('absolute' => true, 'query' => 'cron_key=' . variable_get('cron_key', 'drupal')))));
+ $description .= '
' . $t('To run cron from outside the site, go to !cron', array('!cron' => url('cron.php', array('absolute' => true, 'query' => 'cron_key=' . variable_get('cron_key')))));
$requirements['cron'] = array(
'title' => $t('Cron maintenance tasks'),
@@ -219,7 +219,7 @@ function system_requirements($phase) {
}
}
else {
- if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
+ if (variable_get('file_downloads') == FILE_DOWNLOADS_PUBLIC) {
$requirements['file system']['value'] = $t('Writable (public download method)');
}
else {
@@ -284,7 +284,7 @@ function system_requirements($phase) {
$requirements['update status'] = array(
'value' => $t('Enabled'),
);
- if (variable_get('drupal_http_request_fails', FALSE)) {
+ if (variable_get('drupal_http_request_fails')) {
$requirements['http requests'] = array(
'title' => $t('HTTP request status'),
'value' => $t('Fails'),
@@ -2010,7 +2010,7 @@ function system_update_6021() {
$ret[] = update_sql("DELETE FROM {menu_links} WHERE menu_name IN ('" . implode("', '", $_SESSION['menu_bogus_menus']) . "')");
}
- $menu_primary_menu = variable_get('menu_primary_menu', 0);
+ $menu_primary_menu = variable_get('menu_primary_menu');
// Ensure that we wind up with a system menu named 'primary-links'.
if (isset($_SESSION['menu_menu_map'][2])) {
// The primary links menu that ships with Drupal 5 has mid = 2. If this
@@ -2037,7 +2037,7 @@ function system_update_6021() {
$_SESSION['menu_menu_map'][$updated_primary_links_menu] = 'primary-links';
}
- $menu_secondary_menu = variable_get('menu_secondary_menu', 0);
+ $menu_secondary_menu = variable_get('menu_secondary_menu');
// Ensure that we wind up with a system menu named 'secondary-links'.
if (isset($_SESSION['menu_menu_map'][$menu_secondary_menu]) && $menu_secondary_menu > 1 && $menu_secondary_menu != $updated_primary_links_menu) {
// We use the menu that is currently assigned to the secondary links
@@ -2062,7 +2062,7 @@ function system_update_6021() {
}
// Update menu OTF preferences.
- $mid = variable_get('menu_parent_items', 0);
+ $mid = variable_get('menu_parent_items');
$menu_name = ($mid && isset($_SESSION['menu_menu_map'][$mid])) ? $_SESSION['menu_menu_map'][$mid] : 'navigation';
variable_set('menu_default_node_menu', $menu_name);
variable_del('menu_parent_items');
@@ -2485,7 +2485,7 @@ function system_update_6040() {
function system_update_6041() {
$weight = intval((db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"))) + 1);
$ret = array();
- $vid = intval(variable_get('forum_nav_vocabulary', ''));
+ $vid = intval(variable_get('forum_nav_vocabulary'));
if (db_table_exists('vocabulary') && $vid) {
$ret[] = update_sql("UPDATE {vocabulary} SET required = 0 WHERE vid = " . $vid);
$ret[] = update_sql("UPDATE {system} SET weight = " . $weight . " WHERE name = 'forum'");
@@ -2498,7 +2498,7 @@ function system_update_6041() {
*/
function system_update_6042() {
foreach (list_themes() as $theme) {
- $stylesheet = variable_get('color_' . $theme->name . '_stylesheet', NULL);
+ $stylesheet = variable_get('color_' . $theme->name . '_stylesheet');
if (!empty($stylesheet)) {
variable_set('color_' . $theme->name . '_stylesheets', array($stylesheet));
variable_del('color_' . $theme->name . '_stylesheet');
@@ -2613,7 +2613,7 @@ function system_update_6044() {
$ret[] = update_sql("DELETE FROM {term_node} WHERE vid = 0");
// Only execute the rest of this function if 6043 was run in RC1 or before.
- if (variable_get('system_update_6043_RC2', FALSE)) {
+ if (variable_get('system_update_6043_RC2')) {
variable_del('system_update_6043_RC2');
return $ret;
}
@@ -2677,7 +2677,7 @@ function system_update_6045() {
*/
function system_update_6046() {
$ret = array();
- if (!variable_get('file_directory_path', FALSE)) {
+ if (!variable_get('file_directory_path')) {
variable_set('file_directory_path', 'files');
$ret[] = array('success' => TRUE, 'query' => "variable_set('file_directory_path')");
}
@@ -2848,12 +2848,12 @@ function system_update_7004(&$sandbox) {
}
}
// Rename forum module's block variables.
- $forum_block_num_0 = variable_get('forum_block_num_0', NULL);
+ $forum_block_num_0 = variable_get('forum_block_num_0');
if (isset($forum_block_num_0)) {
variable_set('forum_block_num_active', $forum_block_num_0);
variable_del('forum_block_num_0');
}
- $forum_block_num_1 = variable_get('forum_block_num_1', NULL);
+ $forum_block_num_1 = variable_get('forum_block_num_1');
if (isset($forum_block_num_1)) {
variable_set('forum_block_num_new', $forum_block_num_1);
variable_del('forum_block_num_1');
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.611
diff -u -p -r1.611 system.module
--- modules/system/system.module 23 Jul 2008 07:37:06 -0000 1.611
+++ modules/system/system.module 25 Jul 2008 08:11:33 -0000
@@ -42,6 +42,117 @@ define('DRUPAL_MINIMUM_PGSQL', '8.1');
define('DRUPAL_MAXIMUM_TEMP_FILE_AGE', 1440);
/**
+ * The standard log2 number of iterations for password stretching. This should
+ * increase by 1 at least every other Drupal version in order to counteract
+ * increases in the speed and power of computers available to crack the hashes.
+ */
+define('DRUPAL_HASH_COUNT', 14);
+
+/**
+ * Implementation of hook_variables().
+ */
+function system_variables() {
+ return array(
+ 'cron_key' => 'drupal',
+ 'install_profile_modules' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ 'site_name' => 'drupal',
+ 'site_mail' => ini_get('sendmail_from'),
+ 'install_locale_batch_components' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ 'update_d6_requirements' => FALSE,
+ 'actions_max_stack' => 35,
+ 'page_compression' => TRUE,
+ 'cache' => CACHE_DISABLED,
+ 'language_default' => (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''),
+ 'cache_flush' => 0,
+ 'cache_lifetime' => 0,
+ 'site_404' => '',
+ 'site_403' => '',
+ 'drupal_http_request_fails' => FALSE,
+ 'error_level' => 1,
+ 'configurable_timezones' => 1,
+ 'date_default_timezone' => 0,
+ 'date_format_short' => 'm/d/Y - H:i',
+ 'date_format_long' => 'l, F j, Y - H:i',
+ 'date_format_medium' => 'D, m/d/Y - H:i',
+ 'clean_url' => '0',
+ 'preprocess_css' => FALSE,
+ 'file_downloads' => FILE_DOWNLOADS_PUBLIC,
+ 'css_js_query_string' => '0',
+ 'preprocess_js' => FALSE,
+ 'drupal_private_key' => '',
+ 'cron_semaphore' => FALSE,
+ 'install_profile' => 'default',
+ 'anonymous' => 'Anonymous',
+ 'allow_insecure_uploads' => 0,
+ 'upload_extensions_default' => 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp',
+ 'file_directory_temp' => NULL,
+ 'file_directory_path' => array(
+ '#type' => 'callback',
+ '#value' => 'conf_path',
+ ),
+ 'image_toolkit' => 'gd',
+ 'language_negotiation' => LANGUAGE_NEGOTIATION_NONE,
+ 'javascript_parsed' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ 'locale_js_directory' => 'languages',
+ 'smtp_library' => '',
+ 'menu_masks' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ 'menu_rebuild_needed' => FALSE,
+ 'menu_expanded' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ 'menu_main_menu_source' => 'main-menu',
+ 'menu_secondary_menu_source' => 'secondary-menu',
+ 'site_offline' => 0,
+ 'password_count_log2' => DRUPAL_HASH_COUNT,
+ 'theme_default' => 'garland',
+ 'theme_settings' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ 'site_mission' => '',
+ 'site_slogan' => '',
+ 'site_footer' => '',
+ 'maintenance_theme' => 'minnelli',
+ 'site_name' => 'Drupal',
+ 'site_slogan' => '',
+ 'admin_theme' => 0,
+ 'node_admin_theme' => 0,
+ 'image_jpeg_quality' => 75,
+ 'date_first_day' => 0,
+ 'date_format_short_custom' => '',
+ 'date_format_medium_custom' => '',
+ 'date_format_long_custom' => '',
+ 'site_offline_message' => '@site is currently under maintenance. We should be back shortly. Thank you for your patience.',
+ 'cron_threshold_warning' => 172800,
+ 'cron_threshold_error' => 1209600,
+ 'cron_last' => NULL,
+ 'install_time' => 0,
+ 'menu_primary_menu' => 0,
+ 'menu_secondary_menu' => 0,
+ 'menu_parent_items' => 0,
+ 'system_update_6043_RC2' => FALSE,
+ 'forum_block_num_0' => NULL,
+ 'forum_block_num_1' => NULL,
+ 'drupal_badge_color' => 'powered-blue',
+ 'drupal_badge_size' => '80x15',
+ 'admin_compact_mode' => FALSE,
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function system_help($path, $arg) {
@@ -674,7 +785,7 @@ function blocked_ip_load($iid) {
* Menu item access callback - only admin or enabled themes can be accessed.
*/
function _system_themes_access($theme) {
- return user_access('administer site configuration') && ($theme->status || $theme->name == variable_get('admin_theme', '0'));
+ return user_access('administer site configuration') && ($theme->status || $theme->name == variable_get('admin_theme'));
}
/**
@@ -682,9 +793,9 @@ function _system_themes_access($theme) {
*/
function system_init() {
// Use the administrative theme if the user is looking at a page in the admin/* path.
- if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) {
+ if (arg(0) == 'admin' || (variable_get('node_admin_theme') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) {
global $custom_theme;
- $custom_theme = variable_get('admin_theme', '0');
+ $custom_theme = variable_get('admin_theme');
drupal_add_css(drupal_get_path('module', 'system') . '/admin.css', 'module');
}
@@ -712,7 +823,7 @@ function system_user($type, $edit, &$use
if ($type == 'form' && $category == 'account') {
$form['theme_select'] = system_theme_select_form(t('Selecting a different theme will change the look and feel of the site.'), isset($edit['theme']) ? $edit['theme'] : NULL, 2);
- if (variable_get('configurable_timezones', 1)) {
+ if (variable_get('configurable_timezones')) {
$zones = _system_zonelist();
$form['timezone'] = array(
'#type' => 'fieldset',
@@ -723,7 +834,7 @@ function system_user($type, $edit, &$use
$form['timezone']['timezone'] = array(
'#type' => 'select',
'#title' => t('Time zone'),
- '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
+ '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone'),
'#options' => $zones,
'#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.'),
);
@@ -753,13 +864,13 @@ function system_block($op = 'list', $del
$form['wrapper']['color'] = array(
'#type' => 'select',
'#title' => t('Badge color'),
- '#default_value' => variable_get('drupal_badge_color', 'powered-blue'),
+ '#default_value' => variable_get('drupal_badge_color'),
'#options' => array('powered-black' => t('Black'), 'powered-blue' => t('Blue'), 'powered-gray' => t('Gray')),
);
$form['wrapper']['size'] = array(
'#type' => 'select',
'#title' => t('Badge size'),
- '#default_value' => variable_get('drupal_badge_size', '80x15'),
+ '#default_value' => variable_get('drupal_badge_size'),
'#options' => array('80x15' => t('Small'), '88x31' => t('Medium'), '135x42' => t('Large')),
);
return $form;
@@ -768,7 +879,7 @@ function system_block($op = 'list', $del
variable_set('drupal_badge_size', $edit['size']);
break;
case 'view':
- $image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png';
+ $image_path = 'misc/' . variable_get('drupal_badge_color') . '-' . variable_get('drupal_badge_size') . '.png';
$block['subject'] = NULL; // Don't display a title
$block['content'] = theme('system_powered_by', $image_path);
return $block;
@@ -814,7 +925,7 @@ function system_admin_menu_block($item)
*/
function system_admin_theme_submit($form, &$form_state) {
// If we're changing themes, make sure the theme has its blocks initialized.
- if ($form_state['values']['admin_theme'] && $form_state['values']['admin_theme'] != variable_get('admin_theme', '0')) {
+ if ($form_state['values']['admin_theme'] && $form_state['values']['admin_theme'] != variable_get('admin_theme')) {
$result = db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme = '%s'", $form_state['values']['admin_theme']));
if (!$result) {
system_initialize_theme_blocks($form_state['values']['admin_theme']);
@@ -858,7 +969,7 @@ function system_theme_select_form($descr
foreach ($enabled as $info) {
// For the default theme, revert to an empty string so the user's theme updates when the site theme is changed.
- $info->key = $info->name == variable_get('theme_default', 'garland') ? '' : $info->name;
+ $info->key = $info->name == variable_get('theme_default') ? '' : $info->name;
$screenshot = NULL;
$theme_key = $info->name;
@@ -873,7 +984,7 @@ function system_theme_select_form($descr
$screenshot = $screenshot ? theme('image', $screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), FALSE) : t('no screenshot');
$form['themes'][$info->key]['screenshot'] = array('#markup' => $screenshot);
- $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#markup' => dirname($info->filename) . ($info->name == variable_get('theme_default', 'garland') ? '
' . t('(site default theme)') . '' : ''));
+ $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#markup' => dirname($info->filename) . ($info->name == variable_get('theme_default') ? '
' . t('(site default theme)') . '' : ''));
$options[$info->key] = '';
}
@@ -1157,7 +1268,7 @@ function system_default_region($theme) {
function system_initialize_theme_blocks($theme) {
// Initialize theme's blocks if none already registered.
if (!(db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme = '%s'", $theme)))) {
- $default_theme = variable_get('theme_default', 'garland');
+ $default_theme = variable_get('theme_default');
$regions = system_region_list($theme);
$result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $default_theme);
while ($block = db_fetch_array($result)) {
@@ -1250,7 +1361,7 @@ function system_node_type($op, $info) {
$old = 'toggle_node_info_' . $info->old_type;
$new = 'toggle_node_info_' . $info->type;
- $theme_settings = variable_get('theme_settings', array());
+ $theme_settings = variable_get('theme_settings');
if (isset($theme_settings[$old])) {
$theme_settings[$new] = $theme_settings[$old];
unset($theme_settings[$old]);
@@ -1324,7 +1435,7 @@ function confirm_form($form, $question,
*/
function system_admin_compact_mode() {
global $user;
- return (isset($user->admin_compact_mode)) ? $user->admin_compact_mode : variable_get('admin_compact_mode', FALSE);
+ return (isset($user->admin_compact_mode)) ? $user->admin_compact_mode : variable_get('admin_compact_mode');
}
/**
@@ -1882,7 +1993,7 @@ function system_mail($key, &$message, $p
$account = $params['account'];
$context = $params['context'];
$variables = array(
- '%site_name' => variable_get('site_name', 'Drupal'),
+ '%site_name' => variable_get('site_name'),
'%username' => $account->name,
);
if ($context['hook'] == 'taxonomy') {
@@ -1938,8 +2049,8 @@ function system_message_action_submit($f
function system_message_action(&$object, $context = array()) {
global $user;
$variables = array(
- '%site_name' => variable_get('site_name', 'Drupal'),
- '%username' => $user->name ? $user->name : variable_get('anonymous', t('Anonymous')),
+ '%site_name' => variable_get('site_name'),
+ '%username' => $user->name ? $user->name : variable_get('anonymous'),
);
// This action can be called in any context, but if placeholders
@@ -2032,7 +2143,7 @@ function _system_zonelist() {
$zones = array();
foreach ($zonelist as $offset) {
$zone = $offset * 3600;
- $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') . ' O', $zone);
+ $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long') . ' O', $zone);
}
return $zones;
}
Index: modules/system/system.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.test,v
retrieving revision 1.9
diff -u -p -r1.9 system.test
--- modules/system/system.test 23 Jul 2008 07:37:06 -0000 1.9
+++ modules/system/system.test 25 Jul 2008 05:34:37 -0000
@@ -222,7 +222,7 @@ class CronRunTestCase extends DrupalWebT
$this->assertResponse(403);
// Run cron anonymously with the valid cron key.
- $key = variable_get('cron_key', 'drupal');
+ $key = variable_get('cron_key');
$this->drupalGet('cron.php', array('query' => 'cron_key=' . $key));
$this->assertResponse(200);
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.27
diff -u -p -r1.27 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc 16 Jul 2008 21:59:28 -0000 1.27
+++ modules/taxonomy/taxonomy.admin.inc 25 Jul 2008 05:34:37 -0000
@@ -689,7 +689,7 @@ function taxonomy_form_term(&$form_state
// items so we check for taxonomy_override_selector before loading the
// full vocabulary. Contrib modules can then intercept before
// hook_form_alter to provide scalable alternatives.
- if (!variable_get('taxonomy_override_selector', FALSE)) {
+ if (!variable_get('taxonomy_override_selector')) {
$parent = array_keys(taxonomy_get_parents($edit['tid']));
$children = taxonomy_get_tree($vocabulary->vid, $edit['tid']);
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.425
diff -u -p -r1.425 taxonomy.module
--- modules/taxonomy/taxonomy.module 24 Jul 2008 16:25:19 -0000 1.425
+++ modules/taxonomy/taxonomy.module 25 Jul 2008 06:56:57 -0000
@@ -7,6 +7,15 @@
*/
/**
+ * Implementation of hook_variables().
+ */
+function taxonomy_variables() {
+ return array(
+ 'taxonomy_override_selector' => FALSE,
+ );
+}
+
+/**
* Implementation of hook_perm().
*/
function taxonomy_perm() {
@@ -484,7 +493,7 @@ function taxonomy_get_vocabularies($type
* and provide scalable alternatives.
*/
function taxonomy_form_alter(&$form, $form_state, $form_id) {
- if (isset($form['type']) && isset($form['#node']) && (!variable_get('taxonomy_override_selector', FALSE)) && $form['type']['#value'] . '_node_form' == $form_id) {
+ if (isset($form['type']) && isset($form['#node']) && (!variable_get('taxonomy_override_selector')) && $form['type']['#value'] . '_node_form' == $form_id) {
$node = $form['#node'];
if (!isset($node->taxonomy)) {
@@ -1106,10 +1115,10 @@ function taxonomy_select_nodes($tids = a
$sql = db_rewrite_sql($sql);
$sql_count = db_rewrite_sql($sql_count);
if ($pager) {
- $result = pager_query($sql, variable_get('default_nodes_main', 10), 0, $sql_count, $args);
+ $result = pager_query($sql, variable_get('default_nodes_main'), 0, $sql_count, $args);
}
else {
- $result = db_query_range($sql, $args, 0, variable_get('feed_default_items', 10));
+ $result = db_query_range($sql, $args, 0, variable_get('feed_default_items'));
}
}
@@ -1128,7 +1137,7 @@ function taxonomy_render_nodes($result)
$has_rows = TRUE;
}
if ($has_rows) {
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10), 0);
+ $output .= theme('pager', NULL, variable_get('default_nodes_main'), 0);
}
else {
$output .= '' . t('There are currently no posts in this category.') . '
';
Index: modules/taxonomy/taxonomy.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v
retrieving revision 1.11
diff -u -p -r1.11 taxonomy.pages.inc
--- modules/taxonomy/taxonomy.pages.inc 14 Apr 2008 17:48:42 -0000 1.11
+++ modules/taxonomy/taxonomy.pages.inc 25 Jul 2008 05:34:38 -0000
@@ -48,7 +48,7 @@ function taxonomy_term_page($str_tids =
case 'feed':
$channel['link'] = url('taxonomy/term/' . $str_tids . '/' . $depth, array('absolute' => TRUE));
- $channel['title'] = variable_get('site_name', 'Drupal') . ' - ' . $title;
+ $channel['title'] = variable_get('site_name') . ' - ' . $title;
// Only display the description if we have a single term, to avoid clutter and confusion.
if (count($tids) == 1) {
$term = taxonomy_get_term($tids[0]);
Index: modules/update/update.fetch.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.fetch.inc,v
retrieving revision 1.9
diff -u -p -r1.9 update.fetch.inc
--- modules/update/update.fetch.inc 14 Apr 2008 17:48:43 -0000 1.9
+++ modules/update/update.fetch.inc 25 Jul 2008 05:34:40 -0000
@@ -51,7 +51,7 @@ function _update_refresh() {
$available = $parser->parse($data);
}
if (!empty($available) && is_array($available)) {
- $frequency = variable_get('update_check_frequency', 1);
+ $frequency = variable_get('update_check_frequency');
cache_set('update_info', $available, 'cache_update', time() + (60 * 60 * 24 * $frequency));
variable_set('update_last_check', time());
watchdog('update', 'Fetched information about all available new releases and updates.', array(), WATCHDOG_NOTICE, l(t('view'), 'admin/reports/updates'));
@@ -79,7 +79,7 @@ function _update_refresh() {
* @see update_get_projects()
*/
function _update_build_fetch_url($project, $site_key = '') {
- $default_url = variable_get('update_fetch_url', UPDATE_DEFAULT_URL);
+ $default_url = variable_get('update_fetch_url');
if (!isset($project['info']['project status url'])) {
$project['info']['project status url'] = $default_url;
}
@@ -119,7 +119,7 @@ function _update_cron_notify() {
}
}
if (!empty($params)) {
- $notify_list = variable_get('update_notify_emails', '');
+ $notify_list = variable_get('update_notify_emails');
if (!empty($notify_list)) {
$default_language = language_default();
foreach ($notify_list as $target) {
Index: modules/update/update.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.module,v
retrieving revision 1.20
diff -u -p -r1.20 update.module
--- modules/update/update.module 24 Jul 2008 16:25:19 -0000 1.20
+++ modules/update/update.module 25 Jul 2008 06:58:02 -0000
@@ -51,6 +51,21 @@ define('UPDATE_NOT_CHECKED', -1);
*/
define('UPDATE_UNKNOWN', -2);
+/**
+ * Implementation of hook_variables().
+ */
+function update_variables() {
+ return array(
+ 'update_check_frequency' => 1,
+ 'update_fetch_url' => UPDATE_DEFAULT_URL,
+ 'update_notify_emails' => array(
+ '#type' => 'value',
+ '#value' => array(),
+ ),
+ 'update_notification_threshold' => 'all',
+ 'update_last_check' => 0,
+ );
+}
/**
* Implementation of hook_help().
@@ -259,7 +274,7 @@ function _update_requirement_check($proj
break;
case UPDATE_NOT_CURRENT:
$requirement_label = t('Out of date');
- $requirement['severity'] = variable_get('update_notification_threshold', 'all') == 'all' ? REQUIREMENT_ERROR : REQUIREMENT_WARNING;
+ $requirement['severity'] = variable_get('update_notification_threshold') == 'all' ? REQUIREMENT_ERROR : REQUIREMENT_WARNING;
break;
case UPDATE_UNKNOWN:
case UPDATE_NOT_CHECKED:
@@ -280,9 +295,9 @@ function _update_requirement_check($proj
* Implementation of hook_cron().
*/
function update_cron() {
- $frequency = variable_get('update_check_frequency', 1);
+ $frequency = variable_get('update_check_frequency');
$interval = 60 * 60 * 24 * $frequency;
- if (time() - variable_get('update_last_check', 0) > $interval) {
+ if (time() - variable_get('update_last_check') > $interval) {
update_refresh();
_update_cron_notify();
}
@@ -339,7 +354,7 @@ function update_get_available($refresh =
// First, make sure that none of the .info files have a change time
// newer than the last time we checked for available updates.
$needs_refresh = FALSE;
- $last_check = variable_get('update_last_check', 0);
+ $last_check = variable_get('update_last_check');
$projects = update_get_projects();
foreach ($projects as $key => $project) {
if ($project['info']['_info_file_ctime'] > $last_check) {
@@ -408,7 +423,7 @@ function update_refresh() {
function update_mail($key, &$message, $params) {
$language = $message['language'];
$langcode = $language->language;
- $message['subject'] .= t('New release(s) available for !site_name', array('!site_name' => variable_get('site_name', 'Drupal')), $langcode);
+ $message['subject'] .= t('New release(s) available for !site_name', array('!site_name' => variable_get('site_name')), $langcode);
foreach ($params as $msg_type => $msg_reason) {
$message['body'][] = _update_message_text($msg_type, $msg_reason, FALSE, $language);
}
Index: modules/update/update.report.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.report.inc,v
retrieving revision 1.12
diff -u -p -r1.12 update.report.inc
--- modules/update/update.report.inc 14 Apr 2008 17:48:43 -0000 1.12
+++ modules/update/update.report.inc 25 Jul 2008 05:34:40 -0000
@@ -26,7 +26,7 @@ function update_status() {
* @ingroup themeable
*/
function theme_update_report($data) {
- $last = variable_get('update_last_check', 0);
+ $last = variable_get('update_last_check');
$output = '' . ($last ? t('Last checked: @time ago', array('@time' => format_interval(time() - $last))) : t('Last checked: never'));
$output .= ' (' . l(t('Check manually'), 'admin/reports/updates/check') . ')';
$output .= "
\n";
@@ -39,7 +39,7 @@ function theme_update_report($data) {
$header = array();
$rows = array();
- $notification_level = variable_get('update_notification_threshold', 'all');
+ $notification_level = variable_get('update_notification_threshold');
foreach ($data as $project) {
switch ($project['status']) {
Index: modules/update/update.settings.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.settings.inc,v
retrieving revision 1.3
diff -u -p -r1.3 update.settings.inc
--- modules/update/update.settings.inc 20 Oct 2007 21:57:50 -0000 1.3
+++ modules/update/update.settings.inc 25 Jul 2008 05:34:40 -0000
@@ -12,7 +12,7 @@
function update_settings() {
$form = array();
- $notify_emails = variable_get('update_notify_emails', array());
+ $notify_emails = variable_get('update_notify_emails'));
$form['update_notify_emails'] = array(
'#type' => 'textarea',
'#title' => t('E-mail addresses to notify when updates are available'),
@@ -24,7 +24,7 @@ function update_settings() {
$form['update_check_frequency'] = array(
'#type' => 'radios',
'#title' => t('Check for updates'),
- '#default_value' => variable_get('update_check_frequency', 1),
+ '#default_value' => variable_get('update_check_frequency'),
'#options' => array(
'1' => t('Daily'),
'7' => t('Weekly'),
@@ -35,7 +35,7 @@ function update_settings() {
$form['update_notification_threshold'] = array(
'#type' => 'radios',
'#title' => t('Notification threshold'),
- '#default_value' => variable_get('update_notification_threshold', 'all'),
+ '#default_value' => variable_get('update_notification_threshold'),
'#options' => array(
'all' => t('All newer versions'),
'security' => t('Only security updates'),
Index: modules/upload/upload.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.admin.inc,v
retrieving revision 1.10
diff -u -p -r1.10 upload.admin.inc
--- modules/upload/upload.admin.inc 16 Jul 2008 21:59:28 -0000 1.10
+++ modules/upload/upload.admin.inc 25 Jul 2008 05:34:40 -0000
@@ -55,9 +55,9 @@ function upload_admin_settings_validate(
* Menu callback for the upload settings form.
*/
function upload_admin_settings() {
- $upload_extensions_default = variable_get('upload_extensions_default', 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp');
- $upload_uploadsize_default = variable_get('upload_uploadsize_default', 1);
- $upload_usersize_default = variable_get('upload_usersize_default', 1);
+ $upload_extensions_default = variable_get('upload_extensions_default');
+ $upload_uploadsize_default = variable_get('upload_uploadsize_default');
+ $upload_usersize_default = variable_get('upload_usersize_default');
$form['settings_general'] = array(
'#type' => 'fieldset',
@@ -67,7 +67,7 @@ function upload_admin_settings() {
$form['settings_general']['upload_max_resolution'] = array(
'#type' => 'textfield',
'#title' => t('Maximum resolution for uploaded images'),
- '#default_value' => variable_get('upload_max_resolution', 0),
+ '#default_value' => variable_get('upload_max_resolution'),
'#size' => 15,
'#maxlength' => 10,
'#description' => t('The maximum allowed image size (e.g. 640x480). Set to 0 for no restriction. If an image toolkit is installed, files exceeding this value will be scaled down to fit.', array('!image-toolkit-link' => url('admin/settings/image-toolkit'))),
@@ -76,7 +76,7 @@ function upload_admin_settings() {
$form['settings_general']['upload_list_default'] = array(
'#type' => 'select',
'#title' => t('List files by default'),
- '#default_value' => variable_get('upload_list_default', 1),
+ '#default_value' => variable_get('upload_list_default'),
'#options' => array(0 => t('No'), 1 => t('Yes')),
'#description' => t('Display attached files when viewing a post.'),
);
Index: modules/upload/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v
retrieving revision 1.205
diff -u -p -r1.205 upload.module
--- modules/upload/upload.module 24 Jul 2008 16:25:19 -0000 1.205
+++ modules/upload/upload.module 25 Jul 2008 08:06:44 -0000
@@ -8,6 +8,34 @@
*/
/**
+ * Implementation of hook_variables().
+ */
+function upload_variables() {
+ return array(
+ 'upload_uploadsize_default' => 1,
+ 'upload_usersize_default' => 1,
+ 'upload_max_resolution' => 0,
+ 'upload_list_default' => 1,
+ 'upload_extensions_default' => 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp',
+ 'upload_uploadsize_default' => 1,
+ 'upload_usersize_default' => 1,
+ 'upload_extensions"' => array(
+ '#type' => 'variable',
+ '#value' => 'upload_extensions_default',
+ ),
+ 'upload_uploadsize' => array(
+ '#type' => 'variable',
+ '#value' => 'upload_uploadsize_default',
+ ),
+ 'upload_usersize' => array(
+ '#type' => 'variable',
+ '#value' => 'upload_usersize_default',
+ ),
+ 'upload' => 1,
+ );
+}
+
+/**
* Implementation of hook_help().
*/
function upload_help($path, $arg) {
@@ -120,18 +148,18 @@ function upload_menu_alter(&$items) {
* A string specifying the maximum resolution of images.
*/
function _upload_file_limits($user) {
- $file_limit = variable_get('upload_uploadsize_default', 1);
- $user_limit = variable_get('upload_usersize_default', 1);
- $all_extensions = explode(' ', variable_get('upload_extensions_default', 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp'));
+ $file_limit = variable_get('upload_uploadsize_default');
+ $user_limit = variable_get('upload_usersize_default');
+ $all_extensions = explode(' ', variable_get('upload_extensions_default'));
foreach ($user->roles as $rid => $name) {
- $extensions = variable_get("upload_extensions_$rid", variable_get('upload_extensions_default', 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp'));
+ $extensions = variable_get("upload_extensions_$rid");
$all_extensions = array_merge($all_extensions, explode(' ', $extensions));
// A zero value indicates no limit, take the least restrictive limit.
- $file_size = variable_get("upload_uploadsize_$rid", variable_get('upload_uploadsize_default', 1)) * 1024 * 1024;
+ $file_size = variable_get("upload_uploadsize_$rid") * 1024 * 1024;
$file_limit = ($file_limit && $file_size) ? max($file_limit, $file_size) : 0;
- $user_size = variable_get("upload_usersize_$rid", variable_get('upload_usersize_default', 1)) * 1024 * 1024;
+ $user_size = variable_get("upload_usersize_$rid") * 1024 * 1024;
$user_limit = ($user_limit && $user_size) ? max($user_limit, $user_size) : 0;
}
$all_extensions = implode(' ', array_unique($all_extensions));
@@ -139,7 +167,7 @@ function _upload_file_limits($user) {
'extensions' => $all_extensions,
'file_size' => $file_limit,
'user_size' => $user_limit,
- 'resolution' => variable_get('upload_max_resolution', 0),
+ 'resolution' => variable_get('upload_max_resolution'),
);
}
@@ -179,7 +207,7 @@ function upload_node_form_submit($form,
// Save new file uploads.
if (($user->uid != 1 || user_access('upload files')) && ($file = file_save_upload('upload', $validators, file_directory_path()))) {
- $file->list = variable_get('upload_list_default', 1);
+ $file->list = variable_get('upload_list_default');
$file->description = $file->filename;
$file->weight = 0;
$_SESSION['upload_files'][$file->fid] = $file;
@@ -219,7 +247,7 @@ function upload_form_alter(&$form, $form
if (isset($form['type']) && isset($form['#node'])) {
$node = $form['#node'];
- if ($form['type']['#value'] . '_node_form' == $form_id && variable_get("upload_$node->type", TRUE)) {
+ if ($form['type']['#value'] . '_node_form' == $form_id && variable_get("upload_$node->type")) {
// Attachments fieldset
$form['attachments'] = array(
'#type' => 'fieldset',
@@ -270,7 +298,7 @@ function upload_nodeapi(&$node, $op, $te
case 'load':
$output = '';
- if (variable_get("upload_$node->type", 1) == 1) {
+ if (variable_get("upload_$node->type") == 1) {
$output['files'] = upload_load($node);
return $output;
}
Index: modules/user/user.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v
retrieving revision 1.24
diff -u -p -r1.24 user.admin.inc
--- modules/user/user.admin.inc 24 Jul 2008 16:28:52 -0000 1.24
+++ modules/user/user.admin.inc 25 Jul 2008 05:34:41 -0000
@@ -231,9 +231,9 @@ function user_admin_account_validate($fo
function user_admin_settings() {
// User registration settings.
$form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'));
- $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
- $form['registration']['user_email_verification'] = array('#type' => 'checkbox', '#title' => t('Require e-mail verification when a visitor creates an account'), '#default_value' => variable_get('user_email_verification', TRUE), '#description' => t('If this box is checked, new users will be required to validate their e-mail address prior to logging into the site, and will be assigned a system-generated password. With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration.'));
- $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#description' => t('This text is displayed at the top of the user registration form and is useful for helping or instructing your users.'));
+ $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register'), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
+ $form['registration']['user_email_verification'] = array('#type' => 'checkbox', '#title' => t('Require e-mail verification when a visitor creates an account'), '#default_value' => variable_get('user_email_verification'), '#description' => t('If this box is checked, new users will be required to validate their e-mail address prior to logging into the site, and will be assigned a system-generated password. With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration.'));
+ $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help'), '#description' => t('This text is displayed at the top of the user registration form and is useful for helping or instructing your users.'));
// User e-mail settings.
$form['email'] = array(
@@ -249,7 +249,7 @@ function user_admin_settings() {
'#type' => 'fieldset',
'#title' => t('Welcome, new user created by administrator'),
'#collapsible' => TRUE,
- '#collapsed' => (variable_get('user_register', 1) != 0),
+ '#collapsed' => (variable_get('user_register') != 0),
'#description' => t('Customize welcome e-mail messages sent to new member accounts created by an administrator.') . ' ' . $email_token_help,
);
$form['email']['admin_created']['user_mail_register_admin_created_subject'] = array(
@@ -269,7 +269,7 @@ function user_admin_settings() {
'#type' => 'fieldset',
'#title' => t('Welcome, no approval required'),
'#collapsible' => TRUE,
- '#collapsed' => (variable_get('user_register', 1) != 1),
+ '#collapsed' => (variable_get('user_register') != 1),
'#description' => t('Customize welcome e-mail messages sent to new members upon registering, when no administrator approval is required.') . ' ' . $email_token_help
);
$form['email']['no_approval_required']['user_mail_register_no_approval_required_subject'] = array(
@@ -289,7 +289,7 @@ function user_admin_settings() {
'#type' => 'fieldset',
'#title' => t('Welcome, awaiting administrator approval'),
'#collapsible' => TRUE,
- '#collapsed' => (variable_get('user_register', 1) != 2),
+ '#collapsed' => (variable_get('user_register') != 2),
'#description' => t('Customize welcome e-mail messages sent to new members upon registering, when administrative approval is required.') . ' ' . $email_token_help,
);
$form['email']['pending_approval']['user_mail_register_pending_approval_subject'] = array(
@@ -335,7 +335,7 @@ function user_admin_settings() {
$form['email']['activated']['user_mail_status_activated_notify'] = array(
'#type' => 'checkbox',
'#title' => t('Notify user when account is activated.'),
- '#default_value' => variable_get('user_mail_status_activated_notify', TRUE),
+ '#default_value' => variable_get('user_mail_status_activated_notify'),
);
$form['email']['activated']['user_mail_status_activated_subject'] = array(
'#type' => 'textfield',
@@ -360,7 +360,7 @@ function user_admin_settings() {
$form['email']['blocked']['user_mail_status_blocked_notify'] = array(
'#type' => 'checkbox',
'#title' => t('Notify user when account is blocked.'),
- '#default_value' => variable_get('user_mail_status_blocked_notify', FALSE),
+ '#default_value' => variable_get('user_mail_status_blocked_notify'),
);
$form['email']['blocked']['user_mail_status_blocked_subject'] = array(
'#type' => 'textfield',
@@ -385,7 +385,7 @@ function user_admin_settings() {
$form['email']['deleted']['user_mail_status_deleted_notify'] = array(
'#type' => 'checkbox',
'#title' => t('Notify user when account is deleted.'),
- '#default_value' => variable_get('user_mail_status_deleted_notify', FALSE),
+ '#default_value' => variable_get('user_mail_status_deleted_notify'),
);
$form['email']['deleted']['user_mail_status_deleted_subject'] = array(
'#type' => 'textfield',
@@ -408,13 +408,13 @@ function user_admin_settings() {
$form['signatures']['user_signatures'] = array(
'#type' => 'radios',
'#title' => t('Signature support'),
- '#default_value' => variable_get('user_signatures', 0),
+ '#default_value' => variable_get('user_signatures'),
'#options' => array(t('Disabled'), t('Enabled')),
);
// If picture support is enabled, check whether the picture directory exists:
- if (variable_get('user_pictures', 0)) {
- $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
+ if (variable_get('user_pictures')) {
+ $picture_path = file_create_path(variable_get('user_picture_path'));
file_check_directory($picture_path, 1, 'user_picture_path');
}
@@ -422,7 +422,7 @@ function user_admin_settings() {
'#type' => 'fieldset',
'#title' => t('Pictures'),
);
- $picture_support = variable_get('user_pictures', 0);
+ $picture_support = variable_get('user_pictures');
$form['pictures']['user_pictures'] = array(
'#type' => 'radios',
'#title' => t('Picture support'),
@@ -446,7 +446,7 @@ function user_admin_settings() {
$form['pictures']['settings']['user_picture_path'] = array(
'#type' => 'textfield',
'#title' => t('Picture image path'),
- '#default_value' => variable_get('user_picture_path', 'pictures'),
+ '#default_value' => variable_get('user_picture_path'),
'#size' => 30,
'#maxlength' => 255,
'#description' => t('Subdirectory in the directory %dir where pictures will be stored.', array('%dir' => file_directory_path() . '/')),
@@ -454,7 +454,7 @@ function user_admin_settings() {
$form['pictures']['settings']['user_picture_default'] = array(
'#type' => 'textfield',
'#title' => t('Default picture'),
- '#default_value' => variable_get('user_picture_default', ''),
+ '#default_value' => variable_get('user_picture_default'),
'#size' => 30,
'#maxlength' => 255,
'#description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'),
@@ -462,7 +462,7 @@ function user_admin_settings() {
$form['pictures']['settings']['user_picture_dimensions'] = array(
'#type' => 'textfield',
'#title' => t('Picture maximum dimensions'),
- '#default_value' => variable_get('user_picture_dimensions', '85x85'),
+ '#default_value' => variable_get('user_picture_dimensions'),
'#size' => 15,
'#maxlength' => 10,
'#description' => t('Maximum dimensions for pictures, in pixels.'),
@@ -470,7 +470,7 @@ function user_admin_settings() {
$form['pictures']['settings']['user_picture_file_size'] = array(
'#type' => 'textfield',
'#title' => t('Picture maximum file size'),
- '#default_value' => variable_get('user_picture_file_size', '30'),
+ '#default_value' => variable_get('user_picture_file_size'),
'#size' => 15,
'#maxlength' => 10,
'#description' => t('Maximum file size for pictures, in kB.'),
@@ -478,7 +478,7 @@ function user_admin_settings() {
$form['pictures']['settings']['user_picture_guidelines'] = array(
'#type' => 'textarea',
'#title' => t('Picture guidelines'),
- '#default_value' => variable_get('user_picture_guidelines', ''),
+ '#default_value' => variable_get('user_picture_guidelines'),
'#description' => t("This text is displayed at the picture upload form in addition to the default guidelines. It's useful for helping or instructing your users."),
);
Index: modules/user/user.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.install,v
retrieving revision 1.12
diff -u -p -r1.12 user.install
--- modules/user/user.install 7 May 2008 19:34:24 -0000 1.12
+++ modules/user/user.install 25 Jul 2008 05:34:41 -0000
@@ -251,7 +251,7 @@ function user_update_7000(&$sandbox) {
$sandbox['user_count'] = db_result(db_query("SELECT COUNT(uid) FROM {users}"));
}
else {
- require_once variable_get('password_inc', './includes/password.inc');
+ require_once variable_get('password_inc');
// Hash again all current hashed passwords.
$has_rows = FALSE;
// Update this many per page load.
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.912
diff -u -p -r1.912 user.module
--- modules/user/user.module 16 Jul 2008 21:59:29 -0000 1.912
+++ modules/user/user.module 25 Jul 2008 08:07:31 -0000
@@ -17,6 +17,34 @@ define('USERNAME_MAX_LENGTH', 60);
define('EMAIL_MAX_LENGTH', 64);
/**
+ * Implementation of hook_variables().
+ */
+function user_variables() {
+ return array(
+ 'user_register' => 1,
+ 'user_registration_help' => '',
+ 'user_mail_status_activated_notify' => TRUE,
+ 'user_mail_status_blocked_notify' => FALSE,
+ 'user_mail_status_deleted_notify' => FALSE,
+ 'user_email_verification' => TRUE,
+ 'user_signatures' => 0,
+ 'user_pictures' => 0,
+ 'user_picture_path' => 'pictures',
+ 'user_picture_default' => '',
+ 'user_picture_dimensions' => '85x85',
+ 'user_picture_file_size' => 30,
+ 'user_picture_guidelines' => '',
+ 'password_inc' => './includes/password.inc',
+ 'user_block_whois_new_count' => 5,
+ 'user_block_seconds_online' => 900,
+ 'user_block_max_list_count' => 10,
+ 'user_mail_notify' => TRUE,
+ 'user_mail_notify_status_deleted' => FALSE,
+ 'user_mail_notify_status_blocked' => FALSE,
+ );
+}
+
+/**
* Invokes hook_user() in every module.
*
* We cannot use module_invoke() for this, because the arguments need to
@@ -222,7 +250,7 @@ function user_save($account, $array = ar
if (!empty($array['pass'])) {
// Allow alternate password hashing schemes.
- require_once variable_get('password_inc', './includes/password.inc');
+ require_once variable_get('password_inc');
$array['pass'] = user_hash_password(trim($array['pass']));
// Abort if the hashing failed and returned FALSE.
if (!$array['pass']) {
@@ -401,8 +429,8 @@ function user_validate_picture(&$form, &
// If required, validate the uploaded picture.
$validators = array(
'file_validate_is_image' => array(),
- 'file_validate_image_resolution' => array(variable_get('user_picture_dimensions', '85x85')),
- 'file_validate_size' => array(variable_get('user_picture_file_size', '30') * 1024),
+ 'file_validate_image_resolution' => array(variable_get('user_picture_dimensions')),
+ 'file_validate_size' => array(variable_get('user_picture_file_size') * 1024),
);
if ($file = file_save_upload('picture_upload', $validators)) {
// Remove the old picture.
@@ -414,12 +442,12 @@ function user_validate_picture(&$form, &
// files table as a temporary file. We'll make a copy and let the garbage
// collector delete the original upload.
$info = image_get_info($file->filepath);
- $destination = variable_get('user_picture_path', 'pictures') . '/picture-' . $form['#uid'] . '.' . $info['extension'];
+ $destination = variable_get('user_picture_path') . '/picture-' . $form['#uid'] . '.' . $info['extension'];
if (file_copy($file, $destination, FILE_EXISTS_REPLACE)) {
$form_state['values']['picture'] = $file->filepath;
}
else {
- form_set_error('picture_upload', t("Failed to upload the picture image; the %directory directory doesn't exist or is not writable.", array('%directory' => variable_get('user_picture_path', 'pictures'))));
+ form_set_error('picture_upload', t("Failed to upload the picture image; the %directory directory doesn't exist or is not writable.", array('%directory' => variable_get('user_picture_path'))));
}
}
}
@@ -584,7 +612,7 @@ function user_perm() {
* Ensure that user pictures (avatars) are always downloadable.
*/
function user_file_download($file) {
- if (strpos($file, variable_get('user_picture_path', 'pictures') . '/picture-') === 0) {
+ if (strpos($file, variable_get('user_picture_path') . '/picture-') === 0) {
$info = image_get_info(file_create_path($file));
return array('Content-type: ' . $info['mime_type']);
}
@@ -697,7 +725,7 @@ function user_login_block() {
'#value' => t('Log in'),
);
$items = array();
- if (variable_get('user_register', 1)) {
+ if (variable_get('user_register')) {
$items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
}
$items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
@@ -732,15 +760,15 @@ function user_block($op = 'list', $delta
$form['user_block_whois_new_count'] = array(
'#type' => 'select',
'#title' => t('Number of users to display'),
- '#default_value' => variable_get('user_block_whois_new_count', 5),
+ '#default_value' => variable_get('user_block_whois_new_count'),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
);
return $form;
}
else if ($op == 'configure' && $delta == 'online') {
$period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval');
- $form['user_block_seconds_online'] = array('#type' => 'select', '#title' => t('User activity'), '#default_value' => variable_get('user_block_seconds_online', 900), '#options' => $period, '#description' => t('A user is considered online for this long after they have last viewed a page.'));
- $form['user_block_max_list_count'] = array('#type' => 'select', '#title' => t('User list length'), '#default_value' => variable_get('user_block_max_list_count', 10), '#options' => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), '#description' => t('Maximum number of currently online users to display.'));
+ $form['user_block_seconds_online'] = array('#type' => 'select', '#title' => t('User activity'), '#default_value' => variable_get('user_block_seconds_online'), '#options' => $period, '#description' => t('A user is considered online for this long after they have last viewed a page.'));
+ $form['user_block_max_list_count'] = array('#type' => 'select', '#title' => t('User list length'), '#default_value' => variable_get('user_block_max_list_count'), '#options' => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), '#description' => t('Maximum number of currently online users to display.'));
return $form;
}
@@ -774,7 +802,7 @@ function user_block($op = 'list', $delta
case 'new':
if (user_access('access content')) {
// Retrieve a list of new users who have subsequently accessed the site successfully.
- $result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, variable_get('user_block_whois_new_count', 5));
+ $result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, variable_get('user_block_whois_new_count'));
while ($account = db_fetch_object($result)) {
$items[] = $account;
}
@@ -788,14 +816,14 @@ function user_block($op = 'list', $delta
case 'online':
if (user_access('access content')) {
// Count users active within the defined period.
- $interval = time() - variable_get('user_block_seconds_online', 900);
+ $interval = time() - variable_get('user_block_seconds_online');
// Perform database queries to gather online user lists. We use s.timestamp
// rather than u.access because it is much faster.
$anonymous_count = sess_count($interval);
$authenticated_users = db_query('SELECT DISTINCT u.uid, u.name, s.timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp >= %d AND s.uid > 0 ORDER BY s.timestamp DESC', $interval);
$authenticated_count = 0;
- $max_users = variable_get('user_block_max_list_count', 10);
+ $max_users = variable_get('user_block_max_list_count');
$items = array();
while ($account = db_fetch_object($authenticated_users)) {
if ($max_users > 0) {
@@ -814,7 +842,7 @@ function user_block($op = 'list', $delta
}
// Display a list of currently online users.
- $max_users = variable_get('user_block_max_list_count', 10);
+ $max_users = variable_get('user_block_max_list_count');
if ($authenticated_count && $max_users) {
$output .= theme('user_list', $items, t('Online users'));
}
@@ -837,17 +865,17 @@ function user_block($op = 'list', $delta
*/
function template_preprocess_user_picture(&$variables) {
$variables['picture'] = '';
- if (variable_get('user_pictures', 0)) {
+ if (variable_get('user_pictures')) {
$account = $variables['account'];
if (!empty($account->picture) && file_exists($account->picture)) {
$picture = file_create_url($account->picture);
}
- else if (variable_get('user_picture_default', '')) {
- $picture = variable_get('user_picture_default', '');
+ else if (variable_get('user_picture_default')) {
+ $picture = variable_get('user_picture_default');
}
if (isset($picture)) {
- $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous'))));
+ $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous')));
$variables['picture'] = theme('image', $picture, $alt, $alt, '', FALSE);
if (!empty($account->uid) && user_access('access user profiles')) {
$attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);
@@ -886,7 +914,7 @@ function user_is_logged_in() {
}
function user_register_access() {
- return user_is_anonymous() && variable_get('user_register', 1);
+ return user_is_anonymous() && variable_get('user_register');
}
function user_view_access($account) {
@@ -1225,7 +1253,7 @@ function user_login(&$form_state) {
'#attributes' => array('tabindex' => '1'),
);
- $form['name']['#description'] = t('Enter your @s username.', array('@s' => variable_get('site_name', 'Drupal')));
+ $form['name']['#description'] = t('Enter your @s username.', array('@s' => variable_get('site_name')));
$form['pass'] = array('#type' => 'password',
'#title' => t('Password'),
'#description' => t('Enter the password that accompanies your username.'),
@@ -1308,7 +1336,7 @@ function user_authenticate($form_values
$account = db_fetch_object(db_query("SELECT * FROM {users} WHERE name = '%s' AND status = 1", $form_values['name']));
if ($account) {
// Allow alternate password hashing schemes.
- require_once variable_get('password_inc', './includes/password.inc');
+ require_once variable_get('password_inc');
if (user_check_password($password, $account)) {
if (user_needs_new_hash($account)) {
$new_hash = user_hash_password($password);
@@ -1429,7 +1457,7 @@ function user_edit_form(&$form_state, $u
'#size' => 25,
);
}
- elseif (!variable_get('user_email_verification', TRUE) || $admin) {
+ elseif (!variable_get('user_email_verification') || $admin) {
$form['account']['pass'] = array(
'#type' => 'password_confirm',
'#description' => t('Provide a password for the new account in both fields.'),
@@ -1474,7 +1502,7 @@ function user_edit_form(&$form_state, $u
}
// Signature:
- if (variable_get('user_signatures', 0) && module_exists('comment') && !$register) {
+ if (variable_get('user_signatures') && module_exists('comment') && !$register) {
$form['signature_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Signature settings'),
@@ -1489,7 +1517,7 @@ function user_edit_form(&$form_state, $u
}
// Picture/avatar:
- if (variable_get('user_pictures', 0) && !$register) {
+ if (variable_get('user_pictures') && !$register) {
$form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1);
$picture = theme('user_picture', (object)$edit);
if ($edit['picture']) {
@@ -1499,7 +1527,7 @@ function user_edit_form(&$form_state, $u
else {
$form['picture']['picture_delete'] = array('#type' => 'hidden');
}
- $form['picture']['picture_upload'] = array('#type' => 'file', '#title' => t('Upload picture'), '#size' => 48, '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) . ' ' . variable_get('user_picture_guidelines', ''));
+ $form['picture']['picture_upload'] = array('#type' => 'file', '#title' => t('Upload picture'), '#size' => 48, '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions'), '%size' => variable_get('user_picture_file_size'))) . ' ' . variable_get('user_picture_guidelines'));
$form['#validate'][] = 'user_validate_picture';
}
$form['#uid'] = $uid;
@@ -1989,7 +2017,7 @@ function user_forms() {
function user_comment(&$comment, $op) {
// Validate signature.
if ($op == 'view') {
- if (variable_get('user_signatures', 0) && !empty($comment->signature)) {
+ if (variable_get('user_signatures') && !empty($comment->signature)) {
$comment->signature = check_markup($comment->signature, $comment->format);
}
else {
@@ -2030,7 +2058,7 @@ function user_mail_tokens($account, $lan
global $base_url;
$tokens = array(
'!username' => $account->name,
- '!site' => variable_get('site_name', 'Drupal'),
+ '!site' => variable_get('site_name'),
'!login_url' => user_pass_reset_url($account),
'!uri' => $base_url,
'!uri_brief' => substr($base_url, strlen('http://')),
@@ -2094,9 +2122,7 @@ function user_preferred_language($accoun
* The return value from drupal_mail_send(), if ends up being called.
*/
function _user_mail_notify($op, $account, $language = NULL) {
- // By default, we always notify except for deleted and blocked.
- $default_notify = ($op != 'status_deleted' && $op != 'status_blocked');
- $notify = variable_get('user_mail_' . $op . '_notify', $default_notify);
+ $notify = variable_get('user_mail_notify_' . $op);
if ($notify) {
$params['account'] = $account;
$language = $language ? $language : user_preferred_language($account);
@@ -2104,7 +2130,7 @@ function _user_mail_notify($op, $account
if ($op == 'register_pending_approval') {
// If a user registered requiring admin approval, notify the admin, too.
// We use the site default language for this.
- drupal_mail('user', 'register_pending_approval_admin', variable_get('site_mail', ini_get('sendmail_from')), language_default(), $params);
+ drupal_mail('user', 'register_pending_approval_admin', variable_get('site_mail'), language_default(), $params);
}
}
return empty($mail) ? NULL : $mail['result'];
@@ -2221,14 +2247,14 @@ function user_register_submit($form, &$f
$mail = $form_state['values']['mail'];
$name = $form_state['values']['name'];
- if (!variable_get('user_email_verification', TRUE) || $admin) {
+ if (!variable_get('user_email_verification') || $admin) {
$pass = $form_state['values']['pass'];
}
else {
$pass = user_password();
};
$notify = isset($form_state['values']['notify']) ? $form_state['values']['notify'] : NULL;
- $from = variable_get('site_mail', ini_get('sendmail_from'));
+ $from = variable_get('site_mail');
if (isset($form_state['values']['roles'])) {
// Remove unset roles.
$roles = array_filter($form_state['values']['roles']);
@@ -2249,7 +2275,7 @@ function user_register_submit($form, &$f
$merge_data = array('pass' => $pass, 'init' => $mail, 'roles' => $roles);
if (!$admin) {
// Set the user's status because it was not displayed in the form.
- $merge_data['status'] = variable_get('user_register', 1) == 1;
+ $merge_data['status'] = variable_get('user_register') == 1;
}
$account = user_save('', array_merge($form_state['values'], $merge_data));
// Terminate if an error occured during user_save().
@@ -2265,7 +2291,7 @@ function user_register_submit($form, &$f
// The first user may login immediately, and receives a customized welcome e-mail.
if ($account->uid == 1) {
drupal_set_message(t('Welcome to Drupal. You are now logged in as user #1, which gives you full control over your website.'));
- if (variable_get('user_email_verification', TRUE)) {
+ if (variable_get('user_email_verification')) {
drupal_set_message(t('