Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.261
diff -u -r1.261 block.module
--- modules/block/block.module 20 May 2007 16:40:20 -0000 1.261
+++ modules/block/block.module 29 May 2007 09:07:37 -0000
@@ -97,7 +97,7 @@
'page arguments' => array('block_add_block_form'),
'type' => MENU_LOCAL_TASK,
);
- $default = variable_get('theme_default', 'garland');
+ $default = variable_get('theme_default');
foreach (list_themes() as $key => $theme) {
$items['admin/build/block/list/'. $key] = array(
'title' => '!key settings',
@@ -228,7 +228,7 @@
$custom_theme = $theme;
}
else {
- $custom_theme = variable_get('theme_default', 'garland');
+ $custom_theme = variable_get('theme_default');
}
init_theme();
@@ -706,7 +706,7 @@
if ($block->pages) {
if ($block->visibility < 2) {
$path = drupal_get_path_alias($_GET['q']);
- $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\ '. t('There are currently no posts in this category.') .' Welcome to Drupal. You are now logged in as user #1, which gives you full control over your website.
Your password is %pass. You may change your password below.
', array('%pass' => $pass))); } @@ -1394,7 +1394,7 @@ if ($admin && !$notify) { drupal_set_message(t('Created a new user account. No e-mail has been sent.')); } - else if (!variable_get('user_email_verification', TRUE) && $account->status && !$admin) { + else if (!variable_get('user_email_verification') && $account->status && !$admin) { // No e-mail verification is required, create new user account, and login user immediately. _user_mail_notify('register_no_approval_required', $account, $pass); user_authenticate($account->name, trim($pass)); @@ -1452,7 +1452,7 @@ '#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.'), @@ -1473,7 +1473,7 @@ } // 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'), @@ -1488,7 +1488,7 @@ } // 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 ($picture) { @@ -1498,7 +1498,7 @@ 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; @@ -1671,41 +1671,14 @@ function _user_mail_text($messageid, $variables = array()) { // Check if an admin setting overrides the default string. - if ($admin_setting = variable_get('user_mail_'. $messageid, FALSE)) { + if ($admin_setting = variable_get('user_mail_'. $messageid)) { return strtr($admin_setting, $variables); } // No override, return with default strings. + // Replicate previous behaviour else { - switch ($messageid) { - case 'register_no_approval_required_subject': - return t('Account details for !username at !site', $variables); - case 'register_no_approval_required_body': - return t("!username,\n\nThank you for registering at !site. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team", $variables); - case 'register_admin_created_subject': - return t('An administrator created an account for you at !site', $variables); - case 'register_admin_created_body': - return t("!username,\n\nA site administrator at !site has created an account for you. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team", $variables); - case 'register_pending_approval_subject': - return t('Account details for !username at !site (pending admin approval)', $variables); - case 'register_pending_approval_body': - return t("!username,\n\nThank you for registering at !site. Your application for an account is currently pending approval. Once it has been approved, you will receive another e-mail containing information about how to log in, set your password, and other details.\n\n\n-- !site team", $variables); - case 'password_reset_subject': - return t('Replacement login information for !username at !site', $variables); - case 'password_reset_body': - return t("!username,\n\nA request to reset the password for your account has been made at !site.\n\nYou may now log in to !uri_brief clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.", $variables); - case 'status_activated_subject': - return t('Account details for !username at !site (approved)', $variables); - case 'status_activated_body': - return "!username,\n\nYour account at !site has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\nOnce you have set your own password, you will be able to log in to !login_uri in the future using the following username:\n\nusername: !username\n"; - case 'status_blocked_subject': - return t('Account details for !username at !site (blocked)', $variables); - case 'status_blocked_body': - return "!username,\n\nYour account on !site has been blocked."; - case 'status_deleted_subject': - return t('Account details for !username at !site (deleted)', $variables); - case 'status_deleted_body': - return "!username,\n\nYour account on !site has been deleted."; - } + $data = variable_get_metadata('user_mail_'. $messageid); + return t($data['default'], $variables); } } @@ -2448,9 +2421,9 @@ 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 to 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. It's useful for helping or instructing your users.")); + $form['registration']['user_register'] = array('#variable' => TRUE, '#type' => 'radios', '#title' => t('Public registrations'), '#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('#variable' => TRUE, '#type' => 'checkbox', '#title' => t('Require e-mail verification when a visitor creates an account'), '#description' => t('If this box is checked, new users will be required to validate their e-mail address prior to logging into to 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('#variable' => TRUE, '#type' => 'textarea', '#title' => t('User registration guidelines'), '#description' => t("This text is displayed at the top of the user registration form. It's useful for helping or instructing your users.")); // User e-mail settings. $form['email'] = array( @@ -2466,19 +2439,19 @@ '#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 the welcome e-mail message that is sent to new member accounts created by an administrator.') .' '. $email_token_help, ); $form['email']['admin_created']['user_mail_register_admin_created_subject'] = array( + '#variable' => TRUE, '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => _user_mail_text('register_admin_created_subject'), '#maxlength' => 180, ); $form['email']['admin_created']['user_mail_register_admin_created_body'] = array( + '#variable' => TRUE, '#type' => 'textarea', '#title' => t('Body'), - '#default_value' => _user_mail_text('register_admin_created_body'), '#rows' => 15, ); @@ -2486,19 +2459,19 @@ '#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 the welcome e-mail message that is 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( + '#variable' => TRUE, '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => _user_mail_text('register_no_approval_required_subject'), '#maxlength' => 180, ); $form['email']['no_approval_required']['user_mail_register_no_approval_required_body'] = array( + '#variable' => TRUE, '#type' => 'textarea', '#title' => t('Body'), - '#default_value' => _user_mail_text('register_no_approval_required_body'), '#rows' => 15, ); @@ -2510,15 +2483,15 @@ '#description' => t('Customize the welcome message which is sent to new members that are awaiting approval.') .' '. $email_token_help, ); $form['email']['pending_approval']['user_mail_register_pending_approval_subject'] = array( + '#variable' => TRUE, '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => _user_mail_text('register_pending_approval_subject'), '#maxlength' => 180, ); $form['email']['pending_approval']['user_mail_register_pending_approval_body'] = array( + '#variable' => TRUE, '#type' => 'textarea', '#title' => t('Body'), - '#default_value' => _user_mail_text('register_pending_approval_body'), '#rows' => 8, ); @@ -2530,15 +2503,15 @@ '#description' => t('Customize the e-mail message sent to users that request a new password.') .' '. $email_token_help, ); $form['email']['password_reset']['user_mail_password_reset_subject'] = array( + '#variable' => TRUE, '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => _user_mail_text('password_reset_subject'), '#maxlength' => 180, ); $form['email']['password_reset']['user_mail_password_reset_body'] = array( + '#variable' => TRUE, '#type' => 'textarea', '#title' => t('Body'), - '#default_value' => _user_mail_text('password_reset_body'), '#rows' => 12, ); @@ -2550,20 +2523,20 @@ '#description' => t('Configure if an e-mail message should be sent to users when their accounts are activated, and if so, what the subject and body should be. This is particularly useful if your site requires administrator approval for new account requests.') .' '. $email_token_help, ); $form['email']['activated']['user_mail_status_activated_notify'] = array( + '#variable' => TRUE, '#type' => 'checkbox', '#title' => t('Notify user when account is activated.'), - '#default_value' => variable_get('user_mail_status_activated_notify', TRUE), ); $form['email']['activated']['user_mail_status_activated_subject'] = array( + '#variable' => TRUE, '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => _user_mail_text('status_activated_subject'), '#maxlength' => 180, ); $form['email']['activated']['user_mail_status_activated_body'] = array( + '#variable' => TRUE, '#type' => 'textarea', '#title' => t('Body'), - '#default_value' => _user_mail_text('status_activated_body'), '#rows' => 15, ); @@ -2575,20 +2548,20 @@ '#description' => t('Configure if an e-mail message should be sent to users when their accounts are blocked, and if so, what the subject and body should be.') .' '. $email_token_help, ); $form['email']['blocked']['user_mail_status_blocked_notify'] = array( + '#variable' => TRUE, '#type' => 'checkbox', '#title' => t('Notify user when account is blocked.'), - '#default_value' => variable_get('user_mail_status_blocked_notify', FALSE), ); $form['email']['blocked']['user_mail_status_blocked_subject'] = array( + '#variable' => TRUE, '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => _user_mail_text('status_blocked_subject'), '#maxlength' => 180, ); $form['email']['blocked']['user_mail_status_blocked_body'] = array( + '#variable' => TRUE, '#type' => 'textarea', '#title' => t('Body'), - '#default_value' => _user_mail_text('status_blocked_body'), '#rows' => 3, ); @@ -2600,20 +2573,20 @@ '#description' => t('Configure if an e-mail message should be sent to users when their accounts are deleted, and if so, what the subject and body should be.') .' '. $email_token_help, ); $form['email']['deleted']['user_mail_status_deleted_notify'] = array( + '#variable' => TRUE, '#type' => 'checkbox', '#title' => t('Notify user when account is deleted.'), - '#default_value' => variable_get('user_mail_status_deleted_notify', FALSE), ); $form['email']['deleted']['user_mail_status_deleted_subject'] = array( + '#variable' => TRUE, '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => _user_mail_text('status_deleted_subject'), '#maxlength' => 180, ); $form['email']['deleted']['user_mail_status_deleted_body'] = array( + '#variable' => TRUE, '#type' => 'textarea', '#title' => t('Body'), - '#default_value' => _user_mail_text('status_deleted_body'), '#rows' => 3, ); @@ -2623,15 +2596,16 @@ '#title' => t('Signatures'), ); $form['signatures']['user_signatures'] = array( + '#variable' => TRUE, '#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')); + $picture_path = file_create_path(variable_get('user_picture_path')); file_check_directory($picture_path, 1, 'user_picture_path'); } @@ -2639,11 +2613,11 @@ '#type' => 'fieldset', '#title' => t('Pictures'), ); - $picture_support = variable_get('user_pictures', 0); + $picture_support = variable_get('user_pictures'); $form['pictures']['user_pictures'] = array( + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Picture support'), - '#default_value' => $picture_support, '#options' => array(t('Disabled'), t('Enabled')), '#prefix' => ''. t('Enter a simple pattern ("*" may be used as a wildcard match) to search for a username. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda".') .'
'; case 'user/help#user': - $site = variable_get('site_name', 'Drupal'); + $site = variable_get('site_name'); $affiliates = user_auth_help_links(); if (count($affiliates)) { @@ -3054,7 +3028,7 @@ 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 { @@ -3095,7 +3069,7 @@ 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://')), @@ -3146,10 +3120,10 @@ } // 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_default('user_mail_'. $op .'_notify', $default_notify); $result = NULL; if ($notify) { - $from = variable_get('site_mail', ini_get('sendmail_from')); + $from = variable_get('site_mail'); $variables = user_mail_tokens($account, $password); $subject = _user_mail_text($op .'_subject', $variables); $body = _user_mail_text($op .'_body', $variables); @@ -3161,3 +3135,62 @@ } return $result; } + +/** + * Implementation of hook_variable() + */ +function user_variable() { + return array( + // User registration settings + 'user_register' => array('type' => VARIABLE_DATA, 'default' => 1), + 'user_email_verification' => array('type' => VARIABLE_DATA, 'default' => TRUE), + 'user_registration_help' => array('type' => VARIABLE_STRING, 'default' => ''), + // User pictures + 'user_pictures' => array('type' => VARIABLE_DATA, 'default' => 0), + 'user_picture_default' => array('type' => VARIABLE_STRING, 'default' => ''), + 'user_picture_dimensions' => array('type' => VARIABLE_STRING, 'default' => '85x85'), + 'user_picture_file_size' => array('type' => VARIABLE_NUMBER, 'default' => 30), + 'user_picture_path' => array('type' => VARIABLE_PATH, 'default' => 'pictures'), + 'user_picture_guidelines' => array('type' => VARIABLE_STRING, 'default' => ''), + // User block + 'user_block_whois_new_count' => array('type' => VARIABLE_NUMBER, 'default' => 5), + 'user_block_seconds_online' => array('type' => VARIABLE_NUMBER, 'default' => 900), + 'user_block_max_list_count' => array('type' => VARIABLE_NUMBER, 'default' => 10), + + // User mail settings + 'user_mail_status_activated_notify' => array('type' => VARIABLE_DATA, 'default' => TRUE), + 'user_mail_status_blocked_notify' => array('type' => VARIABLE_DATA, 'default' => FALSE), + 'user_mail_status_deleted_notify' => array('type' => VARIABLE_DATA, 'default' => FALSE), + + // User mail text + 'user_mail_register_no_approval_required_subject' => array('type' => VARIABLE_TEXT, + 'default' => 'Account details for !username at !site'), + 'user_mail_register_no_approval_required_body' => array('type' => VARIABLE_TEXT, + 'default' => "!username,\n\nThank you for registering at !site. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team"), + 'user_mail_register_admin_created_subject' => array('type' => VARIABLE_TEXT, + 'default' => 'An administrator created an account for you at !site'), + 'user_mail_register_admin_created_body' => array('type' => VARIABLE_TEXT, + 'default' => "!username,\n\nA site administrator at !site has created an account for you. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team"), + 'user_mail_register_pending_approval_subject' => array('type' => VARIABLE_TEXT, + 'default' => 'Account details for !username at !site (pending admin approval)'), + 'user_mail_register_pending_approval_body' => array('type' => VARIABLE_TEXT, + 'default' => "!username,\n\nThank you for registering at !site. Your application for an account is currently pending approval. Once it has been approved, you will receive another e-mail containing information about how to log in, set your password, and other details.\n\n\n-- !site team"), + 'user_mail_password_reset_subject' => array('type' => VARIABLE_TEXT, + 'default' => 'Replacement login information for !username at !site'), + 'user_mail_password_reset_body' => array('type' => VARIABLE_TEXT, + 'default' => "!username,\n\nA request to reset the password for your account has been made at !site.\n\nYou may now log in to !uri_brief clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password."), + 'user_mail_status_activated_subject' => array('type' => VARIABLE_TEXT, + 'default' => 'Account details for !username at !site (approved)'), + 'user_mail_status_activated_body' => array('type' => VARIABLE_TEXT, + 'default' => "!username,\n\nYour account at !site has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\nOnce you have set your own password, you will be able to log in to !login_uri in the future using the following username:\n\nusername: !username\n"), + 'user_mail_status_blocked_subject' => array('type' => VARIABLE_TEXT, + 'default' => 'Account details for !username at !site (blocked)'), + 'user_mail_status_blocked_body' => array('type' => VARIABLE_TEXT, + 'default' => "!username,\n\nYour account on !site has been blocked."), + 'user_mail_status_deleted_subject' => array('type' => VARIABLE_TEXT, + 'default' => 'Account details for !username at !site (deleted)'), + 'user_mail_status_deleted_body' => array('type' => VARIABLE_TEXT, + 'default' => "!username,\n\nYour account on !site has been deleted."), + + ); +} \ No newline at end of file Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.545 diff -u -r1.545 comment.module --- modules/comment/comment.module 25 May 2007 15:04:41 -0000 1.545 +++ modules/comment/comment.module 29 May 2007 09:07:40 -0000 @@ -396,7 +396,7 @@ if ($node->comment == COMMENT_NODE_READ_WRITE) { if (user_access('post comments')) { - if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { + if (variable_get('comment_form_location') == COMMENT_FORM_SEPARATE_PAGE) { $links['comment_add'] = array( 'title' => t('Add new comment'), 'href' => "comment/reply/$node->nid", @@ -427,7 +427,7 @@ $form['workflow']['comment'] = array( '#type' => 'radios', '#title' => t('Default comment setting'), - '#default_value' => variable_get('comment_'. $form['#node_type']->type, COMMENT_NODE_READ_WRITE), + '#default_value' => variable_get_default('comment_'. $form['#node_type']->type, COMMENT_NODE_READ_WRITE), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the administer comments permission will be able to override this setting.'), ); @@ -465,7 +465,7 @@ case 'prepare': if (!isset($node->comment)) { - $node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE); + $node->comment = variable_get_default("comment_$node->type", COMMENT_NODE_READ_WRITE); } break; @@ -521,33 +521,33 @@ ); $form['viewing_options']['comment_default_mode'] = array( + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Default display mode'), - '#default_value' => variable_get('comment_default_mode', COMMENT_MODE_THREADED_EXPANDED), '#options' => _comment_get_modes(), '#description' => t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.'), ); $form['viewing_options']['comment_default_order'] = array( + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Default display order'), - '#default_value' => variable_get('comment_default_order', COMMENT_ORDER_NEWEST_FIRST), '#options' => _comment_get_orders(), '#description' => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'), ); $form['viewing_options']['comment_default_per_page'] = array( + '#variable' => TRUE, '#type' => 'select', '#title' => t('Default comments per page'), - '#default_value' => variable_get('comment_default_per_page', 50), '#options' => _comment_per_page(), '#description' => t('Default number of comments for each page: more comments are distributed in several pages.'), ); $form['viewing_options']['comment_controls'] = array( + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Comment controls'), - '#default_value' => variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN), '#options' => array( t('Display above the comments'), t('Display below the comments'), @@ -563,9 +563,9 @@ ); $form['posting_settings']['comment_anonymous'] = array( + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Anonymous commenting'), - '#default_value' => variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT), '#options' => array( COMMENT_ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'), COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'), @@ -577,24 +577,24 @@ } $form['posting_settings']['comment_subject_field'] = array( + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Comment subject field'), - '#default_value' => variable_get('comment_subject_field', 1), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Can users provide a unique subject for their comments?'), ); $form['posting_settings']['comment_preview'] = array( + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Preview comment'), - '#default_value' => variable_get('comment_preview', COMMENT_PREVIEW_REQUIRED), '#options' => array(t('Optional'), t('Required')), ); $form['posting_settings']['comment_form_location'] = array( + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Location of comment submission form'), - '#default_value' => variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE), '#options' => array(t('Display on separate page'), t('Display below post or comments')), ); @@ -759,7 +759,7 @@ // Add the comment to database. $status = user_access('post comments without approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED; - $roles = variable_get('comment_roles', array()); + $roles = variable_get_default('comment_roles', array()); $score = 0; foreach (array_intersect(array_keys($roles), array_keys($user->roles)) as $rid) { @@ -1036,7 +1036,7 @@ // Start a form, for use with comment control. $result = pager_query($query, $comments_per_page, 0, $query_count, $query_args); - if (db_num_rows($result) && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) { + if (db_num_rows($result) && (variable_get('comment_controls') == COMMENT_CONTROLS_ABOVE || variable_get('comment_controls') == COMMENT_CONTROLS_ABOVE_BELOW)) { $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page); } @@ -1081,13 +1081,13 @@ } $output .= theme('pager', NULL, $comments_per_page, 0); - if (db_num_rows($result) && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_BELOW || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) { + if (db_num_rows($result) && (variable_get('comment_controls') == COMMENT_CONTROLS_BELOW || variable_get('comment_controls') == COMMENT_CONTROLS_ABOVE_BELOW)) { $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page); } } // If enabled, show new comment form. - if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW)) { + if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location') == COMMENT_FORM_BELOW)) { $output .= comment_form_box(array('nid' => $nid), t('Post new comment')); } @@ -1416,7 +1416,7 @@ // Check validity of name, mail and homepage (if given) if (!$user->uid || isset($edit['is_anonymous'])) { - if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) { + if (variable_get('comment_anonymous') > COMMENT_ANONYMOUS_MAYNOT_CONTACT) { if ($edit['name']) { $taken = db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE LOWER(name) = '%s'", $edit['name']), 0); @@ -1425,7 +1425,7 @@ } } - else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { + else if (variable_get('comment_anonymous') == COMMENT_ANONYMOUS_MUST_CONTACT) { form_set_error('name', t('You have to leave your name.')); } @@ -1434,7 +1434,7 @@ form_set_error('mail', t('The e-mail address you specified is not valid.')); } } - else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { + else if (variable_get('comment_anonymous') == COMMENT_ANONYMOUS_MUST_CONTACT) { form_set_error('mail', t('You have to leave an e-mail address.')); } @@ -1458,7 +1458,7 @@ $op = isset($_POST['op']) ? $_POST['op'] : ''; - if (!$user->uid && variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { + if (!$user->uid && variable_get('comment_anonymous') != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { drupal_add_js(drupal_get_path('module', 'comment') . '/comment.js'); } @@ -1551,7 +1551,7 @@ $form['author'] = array('#type' => 'value', '#value' => $user->name); } } - else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAY_CONTACT) { + else if (variable_get('comment_anonymous') == COMMENT_ANONYMOUS_MAY_CONTACT) { $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')) ); @@ -1560,15 +1560,15 @@ $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']); } - else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { - $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')), '#required' => TRUE); + else if (variable_get('comment_anonymous') == COMMENT_ANONYMOUS_MUST_CONTACT) { + $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous'), '#required' => TRUE); $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'], '#description' => t('The content of this field is kept private and will not be shown publicly.'), '#required' => TRUE); $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']); } - if (variable_get('comment_subject_field', 1) == 1) { + if (variable_get('comment_subject_field') == 1) { $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => !empty($edit['subject']) ? $edit['subject'] : ''); } @@ -1602,7 +1602,7 @@ // Only show post button if preview is optional or if we are in preview mode. // We show the post button in preview mode even if there are form errors so that // optional form elements (e.g., captcha) can be updated in preview mode. - if (!form_get_errors() && ((variable_get('comment_preview', COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview comment')) || ($op == t('Post comment')))) { + if (!form_get_errors() && ((variable_get('comment_preview') == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview comment')) || ($op == t('Post comment')))) { $form['submit'] = array('#type' => 'submit', '#value' => t('Post comment'), '#weight' => 20); } @@ -1654,7 +1654,7 @@ $comment->name = check_plain($account->name); } else { - $comment->name = variable_get('anonymous', t('Anonymous')); + $comment->name = variable_get('anonymous'); } $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : time(); $output .= theme('comment_view', $comment); @@ -1878,14 +1878,14 @@ } else { // we cannot use drupal_get_destination() because these links sometimes appear on /node and taxo listing pages - if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { + if (variable_get('comment_form_location') == COMMENT_FORM_SEPARATE_PAGE) { $destination = "destination=". drupal_urlencode("comment/reply/$nid#comment-form"); } else { $destination = "destination=". drupal_urlencode("node/$nid#comment-form"); } - if (variable_get('user_register', 1)) { + if (variable_get('user_register')) { return t('Login or register to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))); } else { @@ -1972,15 +1972,15 @@ // get the setting's site default switch ($setting) { case 'mode': - $default = variable_get('comment_default_mode', COMMENT_MODE_THREADED_EXPANDED); + $default = variable_get('comment_default_mode'); break; case 'sort': - $default = variable_get('comment_default_order', COMMENT_ORDER_NEWEST_FIRST); + $default = variable_get('comment_default_order'); break; case 'comments_per_page': - $default = variable_get('comment_default_per_page', '50'); + $default = variable_get('comment_default_per_page'); } - if (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_HIDDEN) { + if (variable_get('comment_controls') == COMMENT_CONTROLS_HIDDEN) { // if comment controls are disabled use site default $value = $default; } @@ -2078,3 +2078,21 @@ return base_convert(substr($c, 1), 36, 10); } +/** + * Implementation of hook_variable(). + */ +function comment_variable() { + return array( + // Coment settings + 'comment_default_mode' => array('type' => VARIABLE_DATA, 'default' => COMMENT_MODE_THREADED_EXPANDED), + 'comment_default_mode' => array('type' => VARIABLE_DATA, 'default' => COMMENT_MODE_THREADED_EXPANDED), + 'comment_default_order' => array('type' => VARIABLE_DATA, 'default' => COMMENT_ORDER_NEWEST_FIRST), + 'comment_default_per_page' => array('type' => VARIABLE_NUMBER, 'default' => 50), + 'comment_controls' => array('type' => VARIABLE_DATA, 'default' => COMMENT_CONTROLS_HIDDEN), + 'comment_anonymous' => array('type' => VARIABLE_DATA, 'default' => COMMENT_ANONYMOUS_MAYNOT_CONTACT), + 'comment_subject_field' => array('type' => VARIABLE_DATA, 'default' => 1), + 'comment_preview' => array('type' => VARIABLE_DATA, 'default' => COMMENT_PREVIEW_REQUIRED), + 'comment_form_location' => array('type' => VARIABLE_DATA, 'default' => COMMENT_FORM_SEPARATE_PAGE), + + ); +} \ No newline at end of file Index: modules/node/content_types.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v retrieving revision 1.32 diff -u -r1.32 content_types.inc --- modules/node/content_types.inc 16 May 2007 13:45:16 -0000 1.32 +++ modules/node/content_types.inc 29 May 2007 09:07:43 -0000 @@ -152,7 +152,7 @@ ); $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_default('node_options_'. $type->type, array('status', 'promote')), '#options' => array( 'status' => t('Published'), 'promote' => t('Promoted to front page'), Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.819 diff -u -r1.819 node.module --- modules/node/node.module 23 May 2007 07:55:08 -0000 1.819 +++ modules/node/node.module 29 May 2007 09:07:46 -0000 @@ -197,7 +197,7 @@ */ function node_teaser($body, $format = NULL) { - $size = variable_get('teaser_length', 600); + $size = variable_get('teaser_length'); // Find where the delimiter is in the body $delimiter = strpos($body, ''); @@ -868,8 +868,8 @@ return; case 'status': - $last = variable_get('node_cron_last', 0); - $last_nid = variable_get('node_cron_last_nid', 0); + $last = variable_get_default('node_cron_last', 0); + $last_nid = variable_get_default('node_cron_last_nid', 0); $total = db_result(db_query('SELECT COUNT(*) FROM {node} WHERE status = 1')); $remaining = db_result(db_query('SELECT COUNT(*) FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND ((GREATEST(n.created, n.changed, c.last_comment_timestamp) = %d AND n.nid > %d ) OR (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d))', $last, $last_nid, $last, $last, $last)); return array('remaining' => $remaining, 'total' => $total); @@ -886,14 +886,14 @@ if (module_exists('comment')) { $ranking['node_rank_comments'] = t('Number of comments'); } - if (module_exists('statistics') && variable_get('statistics_count_content_views', 0)) { + if (module_exists('statistics') && variable_get_default('statistics_count_content_views', 0)) { $ranking['node_rank_views'] = t('Number of views'); } // Note: reversed to reflect that higher number = higher ranking. $options = drupal_map_assoc(range(0, 10)); foreach ($ranking as $var => $title) { - $form['content_ranking']['factors'][$var] = array('#title' => $title, '#type' => 'select', '#options' => $options, '#default_value' => variable_get($var, 5)); + $form['content_ranking']['factors'][$var] = array('#title' => $title, '#type' => 'select', '#options' => $options, '#default_value' => variable_get_default($var, 5)); } return $form; @@ -932,24 +932,24 @@ // Used to avoid joining on node_comment_statistics twice $stats_join = FALSE; $total = 0; - if ($weight = (int)variable_get('node_rank_relevance', 5)) { + if ($weight = (int)variable_get('node_rank_relevance')) { // Average relevance values hover around 0.15 $ranking[] = '%d * i.relevance'; $arguments2[] = $weight; $total += $weight; } - if ($weight = (int)variable_get('node_rank_recent', 5)) { + if ($weight = (int)variable_get('node_rank_recent')) { // Exponential decay with half-life of 6 months, starting at last indexed node $ranking[] = '%d * POW(2, (GREATEST(n.created, n.changed, c.last_comment_timestamp) - %d) * 6.43e-8)'; $arguments2[] = $weight; - $arguments2[] = (int)variable_get('node_cron_last', 0); + $arguments2[] = (int)variable_get_default('node_cron_last', 0); $join2 .= ' INNER JOIN {node} n ON n.nid = i.sid LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid'; $stats_join = TRUE; $total += $weight; } - if (module_exists('comment') && $weight = (int)variable_get('node_rank_comments', 5)) { + if (module_exists('comment') && $weight = (int)variable_get('node_rank_comments')) { // Inverse law that maps the highest reply count on the site to 1 and 0 to 0. - $scale = variable_get('node_cron_comments_scale', 0.0); + $scale = variable_get_default('node_cron_comments_scale', 0.0); $ranking[] = '%d * (2.0 - 2.0 / (1.0 + c.comment_count * %f))'; $arguments2[] = $weight; $arguments2[] = $scale; @@ -958,10 +958,10 @@ } $total += $weight; } - if (module_exists('statistics') && variable_get('statistics_count_content_views', 0) && - $weight = (int)variable_get('node_rank_views', 5)) { + if (module_exists('statistics') && variable_get_default('statistics_count_content_views', 0) && + $weight = (int)variable_get('node_rank_views')) { // Inverse law that maps the highest view count on the site to 1 and 0 to 0. - $scale = variable_get('node_cron_views_scale', 0.0); + $scale = variable_get_default('node_cron_views_scale', 0.0); $ranking[] = '%d * (2.0 - 2.0 / (1.0 + nc.totalcount * %f))'; $arguments2[] = $weight; $arguments2[] = $scale; @@ -1043,12 +1043,12 @@ } $form['default_nodes_main'] = array( - '#type' => 'select', '#title' => t('Number of posts on main page'), '#default_value' => variable_get('default_nodes_main', 10), + '#variable' => TRUE, '#type' => 'select', '#title' => t('Number of posts on main page'), '#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), + '#variable' => TRUE, '#type' => 'select', '#title' => t('Length of trimmed posts'), '#options' => array(0 => t('Unlimited'), 200 => t('200 characters'), 400 => t('400 characters'), 600 => t('600 characters'), 800 => t('800 characters'), 1000 => t('1000 characters'), 1200 => t('1200 characters'), 1400 => t('1400 characters'), 1600 => t('1600 characters'), 1800 => t('1800 characters'), 2000 => t('2000 characters')), @@ -1056,7 +1056,7 @@ ); $form['node_preview'] = array( - '#type' => 'radios', '#title' => t('Preview post'), '#default_value' => variable_get('node_preview', 0), + '#variable' => TRUE, '#type' => 'radios', '#title' => t('Preview post'), '#options' => array(t('Optional'), t('Required')), '#description' => t('Must users preview posts before submitting?') ); @@ -1855,10 +1855,10 @@ global $base_url, $language; if (!$nodes) { - $nodes = 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)); + $nodes = 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')); } - $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 = ''; @@ -1912,9 +1912,9 @@ $channel_defaults = array( 'version' => '2.0', - 'title' => variable_get('site_name', 'Drupal') .' - '. variable_get('site_slogan', ''), + 'title' => variable_get('site_name') .' - '. variable_get('site_slogan'), 'link' => $base_url, - 'description' => variable_get('site_mission', ''), + 'description' => variable_get('site_mission'), 'language' => $language->language ); $channel = array_merge($channel_defaults, $channel); @@ -2067,7 +2067,7 @@ $form['title']['#weight'] = -5; } - $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); + $node_options = variable_get_default('node_options_'. $node->type, array('status', 'promote')); // If this is a new node, fill in the default values. if (!isset($node->nid)) { foreach (array('status', 'promote', 'sticky') as $key) { @@ -2102,7 +2102,7 @@ '#collapsed' => TRUE, '#weight' => 20, ); - $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#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'))))); + $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name ? $node->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous')))); $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => $node->date))); if (isset($node->nid)) { @@ -2446,17 +2446,17 @@ * 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')); if (db_num_rows($result)) { $feed_url = url('rss.xml', array('absolute' => TRUE)); - drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') .' '. t('RSS')); + drupal_add_feed($feed_url, variable_get('site_name') .' '. t('RSS')); $output = ''; while ($node = db_fetch_object($result)) { $output .= node_view(node_load($node->nid), 1); } - $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); + $output .= theme('pager', NULL, variable_get('default_nodes_main')); } else { // Check for existence of admin account. @@ -2525,9 +2525,9 @@ register_shutdown_function('node_update_shutdown'); - $last = variable_get('node_cron_last', 0); - $last_nid = variable_get('node_cron_last_nid', 0); - $limit = (int)variable_get('search_cron_limit', 100); + $last = variable_get_default('node_cron_last', 0); + $last_nid = variable_get_default('node_cron_last_nid', 0); + $limit = (int)variable_get_default('search_cron_limit', 100); // 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}')))); @@ -3094,3 +3094,20 @@ } return $forms; } + +/** + * Implementation of hook_variable(). + */ +function node_variable() { + return array( + // Content settings + 'teaser_length' => array('type' => VARIABLE_NUMBER, 'default' => 600), + 'default_nodes_main' => array('type' => VARIABLE_NUMBER, 'default' => 10), + 'node_preview' => array('type' => VARIABLE_DATA, 'default' => 0), + // Search + 'node_rank_relevance' => array('type' => VARIABLE_NUMBER, 'default' => 5), + 'node_rank_recent' => array('type' => VARIABLE_NUMBER, 'default' => 5), + 'node_rank_comments' => array('type' => VARIABLE_NUMBER, 'default' => 5), + 'node_rank_views' => array('type' => VARIABLE_NUMBER, 'default' => 5), + ); +} \ No newline at end of file Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.482 diff -u -r1.482 system.module --- modules/system/system.module 25 May 2007 15:04:42 -0000 1.482 +++ modules/system/system.module 29 May 2007 09:07:49 -0000 @@ -348,7 +348,7 @@ // Use the administrative theme if the user is looking at a page in the admin/* path. if (arg(0) == 'admin') { 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'); } @@ -366,7 +366,7 @@ 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', @@ -377,7 +377,7 @@ $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.'), ); @@ -425,11 +425,11 @@ } $form['admin_theme'] = array( + '#variable' => 'true', '#type' => 'select', '#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'), ); $form['#submit'][] = 'system_admin_theme_submit'; @@ -439,7 +439,7 @@ function system_admin_theme_submit($form_values, $form, &$form_state) { // If we're changing themes, make sure the theme has its blocks initialized. - if ($form_values['admin_theme'] != variable_get('admin_theme', '0')) { + if ($form_values['admin_theme'] != variable_get_default('admin_theme', '0')) { $result = db_query("SELECT status FROM {blocks} WHERE theme = '%s'", $form_values['admin_theme']); if (!db_num_rows($result)) { system_initialize_theme_blocks($form_values['admin_theme']); @@ -483,7 +483,7 @@ 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; @@ -498,7 +498,7 @@ $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('#value' => $screenshot); - $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename) . ($info->name == variable_get('theme_default', 'garland') ? '?q=
in the URL).'),
);
- if (!variable_get('clean_url', 0)) {
+ if (!variable_get('clean_url')) {
if (strpos(request_uri(), '?q=') !== FALSE) {
drupal_add_js(array('cleanURL' => array('success' => t('Your server has been successfully tested to support this feature.'), 'failure' => t('Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information.'), 'testing' => t('Testing clean URLs...'))), 'setting');
drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module');
@@ -626,25 +625,26 @@
function system_error_reporting_settings() {
$form['site_403'] = array(
+ '#variable' => TRUE,
'#type' => 'textfield',
'#title' => t('Default 403 (access denied) page'),
- '#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(
+ '#variable' => TRUE,
'#type' => 'textfield',
'#title' => t('Default 404 (not found) page'),
- '#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),
+ '#variable' => TRUE,
+ '#type' => 'select', '#title' => t('Error reporting'),
'#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')),
'#description' => t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')
);
@@ -672,9 +672,9 @@
);
$form['page_cache']['cache'] = array(
+ '#variable' => TRUE,
'#type' => 'radios',
'#title' => t('Caching mode'),
- '#default_value' => variable_get('cache', CACHE_DISABLED),
'#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended, no side effects)'), CACHE_AGGRESSIVE => t('Aggressive (experts only, possible side effects)')),
'#description' => $description
);
@@ -682,9 +682,9 @@
$period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval');
$period[0] = t('none');
$form['page_cache']['cache_lifetime'] = array(
+ '#variable' => TRUE,
'#type' => 'select',
'#title' => t('Minimum cache lifetime'),
- '#default_value' => variable_get('cache_lifetime', 0),
'#options' => $period,
'#description' => t('On high-traffic sites it can become necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
);
@@ -696,11 +696,12 @@
);
$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(
+ '#variable' => TRUE,
'#type' => 'radios',
'#title' => t('Aggregate and compress CSS files'),
- '#default_value' => variable_get('preprocess_css', FALSE) && $is_writable,
+ '#default_value' => variable_get('preprocess_css') && $is_writable,
'#disabled' => !$is_writable,
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t("Some Drupal modules include their own CSS files. When these modules are enabled, each module's CSS file adds an additional HTTP request to the page, which can increase the load time of each page. These HTTP requests can also slightly increase server load. It is recommended to only turn this option on when your site is in production, as it can interfere with theme development. This option is disabled if you have not set up your files directory, or if your download method is set to private."),
@@ -713,9 +714,9 @@
);
$form['reverse_proxy']['reverse_proxy'] = array(
+ '#variable' => TRUE,
'#type' => 'radios',
'#title' => t('Reverse proxy'),
- '#default_value' => variable_get('reverse_proxy', FALSE),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('Enable this setting to determine the correct IP address of the remote client by examining information stored in the X-Forwarded-For headers. X-Forwarded-For headers are a standard mechanism for identifying client systems connecting through a reverse proxy server, such as Squid or Pound. Reverse proxy servers are often used to enhance the performance of heavily visited sites and may also provide other site caching, security or encryption benefits. If this Drupal installation operates behind a reverse proxy, this setting should be enabled so that correct IP address information is captured in Drupal\'s session management, logging, statistics and access management systems; if you are unsure about this setting, do not have a reverse proxy, or Drupal operates in a shared hosting environment, this setting should be set to disabled.'),
);
@@ -728,6 +729,7 @@
function system_file_system_settings() {
$form['file_directory_path'] = array(
+ '#variable' => TRUE,
'#type' => 'textfield',
'#title' => t('File system path'),
'#default_value' => file_directory_path(),
@@ -737,6 +739,7 @@
);
$form['file_directory_temp'] = array(
+ '#variable' => TRUE,
'#type' => 'textfield',
'#title' => t('Temporary directory'),
'#default_value' => file_directory_temp(),
@@ -746,9 +749,9 @@
);
$form['file_downloads'] = array(
+ '#variable' => TRUE,
'#type' => 'radios',
'#title' => t('Download method'),
- '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
'#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('If you want any sort of access control on the downloading of files, this needs to be set to private. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.')
);
@@ -760,9 +763,10 @@
$toolkits_available = image_get_available_toolkits();
if (count($toolkits_available) > 1) {
$form['image_toolkit'] = array(
+ '#variable' => TRUE,
'#type' => 'radios',
'#title' => t('Select an image processing toolkit'),
- '#default_value' => variable_get('image_toolkit', image_get_toolkit()),
+ '#default_value' => variable_get_default('image_toolkit', image_get_toolkit()),
'#options' => $toolkits_available
);
}
@@ -776,16 +780,16 @@
function system_rss_feeds_settings() {
$form['feed_default_items'] = array(
+ '#variable' => TRUE,
'#type' => 'select',
'#title' => t('Number of items per feed'),
- '#default_value' => variable_get('feed_default_items', 10),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
'#description' => t('The default number of items to include in a feed.')
);
$form['feed_item_length'] = array(
+ '#variable' => TRUE,
'#type' => 'select',
'#title' => t('Display of XML feed items'),
- '#default_value' => variable_get('feed_item_length', 'teaser'),
'#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')),
'#description' => t('Global setting for the length of XML feed items that are output by default.')
);
@@ -835,25 +839,25 @@
);
$form['locale']['date_default_timezone'] = array(
+ '#variable' => TRUE,
'#type' => 'select',
'#title' => t('Default time zone'),
- '#default_value' => variable_get('date_default_timezone', 0),
'#options' => $zones,
'#description' => t('Select the default site time zone.')
);
$form['locale']['configurable_timezones'] = array(
+ '#variable' => TRUE,
'#type' => 'radios',
'#title' => t('User-configurable time zones'),
- '#default_value' => variable_get('configurable_timezones', 1),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('When enabled, users can set their own time zone and dates will be displayed accordingly.')
);
$form['locale']['date_first_day'] = array(
+ '#variable' => TRUE,
'#type' => 'select',
'#title' => t('First day of week'),
- '#default_value' => variable_get('date_first_day', 0),
'#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.')
);
@@ -863,8 +867,9 @@
'#title' => t('Formatting'),
);
- $date_format_short = variable_get('date_format_short', $date_short[1]);
+ $date_format_short = variable_get_default('date_format_short', $date_short[1]);
$form['date_formats']['date_format_short'] = array(
+ '#variable' => TRUE,
'#prefix' => '?q=
in the URL).'),
'#disabled' => TRUE,
Index: modules/dblog/dblog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v
retrieving revision 1.6
diff -u -r1.6 dblog.module
--- modules/dblog/dblog.module 14 May 2007 13:43:35 -0000 1.6
+++ modules/dblog/dblog.module 29 May 2007 09:07:41 -0000
@@ -85,9 +85,9 @@
function dblog_admin_settings() {
$form['dblog_row_limit'] = array(
+ '#variable' => TRUE,
'#type' => 'select',
'#title' => t('Discard log entries above the following row limit'),
- '#default_value' => variable_get('dblog_row_limit', 1000),
'#options' => drupal_map_assoc(array(100, 1000, 10000, 100000, 1000000)),
'#description' => t('The maximum number of rows to keep in the database log. Older entries will be automatically discarded. Requires crontab.')
);
@@ -106,7 +106,7 @@
if ($min) {
$max = db_result(db_query('SELECT MAX(wid) FROM {watchdog}'));
if ($max) {
- if (($max - $min) > variable_get('dblog_row_limit', 1000)) {
+ if (($max - $min) > variable_get('dblog_row_limit')) {
db_query('DELETE FROM {watchdog} WHERE wid < %d', $max - $min);
}
}
@@ -452,3 +452,12 @@
'args' => $args,
);
}
+
+/**
+ * Implementation of hook_variable().
+ */
+function dblog_variable() {
+ return array(
+ 'dblog_row_limit' => array('type' => VARIABLE_NUMBER, 'default' => 1000),
+ );
+}
\ No newline at end of file
Index: profiles/default/default.profile
===================================================================
RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v
retrieving revision 1.12
diff -u -r1.12 default.profile
--- profiles/default/default.profile 16 May 2007 13:45:17 -0000 1.12
+++ profiles/default/default.profile 29 May 2007 09:07:55 -0000
@@ -110,7 +110,7 @@
variable_set('comment_page', COMMENT_NODE_DISABLED);
// Don't display date and author information for page nodes by default.
- $theme_settings = variable_get('theme_settings', array());
+ $theme_settings = variable_get_default('theme_settings', array());
$theme_settings['toggle_node_info_page'] = FALSE;
variable_set('theme_settings', $theme_settings);
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.174
diff -u -r1.174 filter.module
--- modules/filter/filter.module 20 May 2007 16:44:35 -0000 1.174
+++ modules/filter/filter.module 29 May 2007 09:07:42 -0000
@@ -155,14 +155,14 @@
global $base_url;
switch ($delta) {
case 0:
- if (variable_get("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_STRIP) {
- if ($allowed_html = variable_get("allowed_html_$format", ' -
-
- ')) {
+ if (variable_get_default("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_STRIP) {
+ if ($allowed_html = variable_get_default("allowed_html_$format", '
-
-
- ')) {
switch ($long) {
case 0:
return t('Allowed HTML tags') .': '. check_plain($allowed_html);
case 1:
$output = '
'. t('Allowed HTML tags') .': '. check_plain($allowed_html) .'
';
- if (!variable_get("filter_html_help_$format", 1)) {
+ if (!variable_get_default("filter_html_help_$format", 1)) {
return $output;
}
@@ -170,7 +170,7 @@
This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.
For more information see W3C\'s HTML Specifications or use your favorite search engine to find other sites that explain HTML.
');
$tips = array(
- 'a' => array( t('Anchors are used to make links to other pages.'), ''. variable_get('site_name', 'Drupal') .''),
+ 'a' => array( t('Anchors are used to make links to other pages.'), ''. variable_get('site_name') .''),
'br' => array( t('By default line break tags are automatically added, so use this tag to add additional ones. Use of this tag is different because it is not used with an open/close pair like all the others. Use the extra " /" inside the tag to maintain XHTML 1.0 compatibility'), t('Text with
line break')),
'p' => array( t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), ''. t('Paragraph one.') .'
'. t('Paragraph two.') .'
'),
'strong' => array( t('Strong'), ''. t('Strong') .''),
@@ -284,14 +284,14 @@
$roles[] = $name;
}
}
- $default = ($id == variable_get('filter_default_format', 1));
+ $default = ($id == variable_get('filter_default_format'));
$options[$id] = '';
$form[$format->name]['id'] = array('#value' => $id);
$form[$format->name]['roles'] = array('#value' => $default ? t('All roles may use default format') : ($roles ? implode(', ', $roles) : t('No roles may use this format')));
$form[$format->name]['configure'] = array('#value' => l(t('configure'), 'admin/settings/filters/'. $id));
$form[$format->name]['delete'] = array('#value' => $default ? '' : l(t('delete'), 'admin/settings/filters/delete/'. $id));
}
- $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
+ $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format'));
$form['submit'] = array('#type' => 'submit', '#value' => t('Set default format'));
return $form;
}
@@ -333,7 +333,7 @@
$format = db_fetch_object(db_query('SELECT * FROM {filter_formats} WHERE format = %d', $format));
if ($format) {
- if ($format->format != variable_get('filter_default_format', 1)) {
+ if ($format->format != variable_get('filter_default_format')) {
$form['format'] = array('#type' => 'hidden', '#value' => $format->format);
$form['name'] = array('#type' => 'hidden', '#value' => $format->name);
@@ -373,7 +373,7 @@
* Generate a filter format form.
*/
function filter_admin_format_form($format = NULL) {
- $default = ($format->format == variable_get('filter_default_format', 1));
+ $default = ($format->format == variable_get('filter_default_format'));
if ($default) {
$help = t('All roles for the default format must be enabled and cannot be changed.');
$form['default_format'] = array('#type' => 'hidden', '#value' => 1);
@@ -608,7 +608,7 @@
$args[] = $rid;
}
$query .= ' WHERE '. implode(' OR ', $where) .' OR format = %d';
- $args[] = variable_get('filter_default_format', 1);
+ $args[] = variable_get('filter_default_format');
}
$result = db_query($query, $args);
@@ -653,7 +653,7 @@
* Resolve a format id, including the default format.
*/
function filter_resolve_format($format) {
- return $format == FILTER_FORMAT_DEFAULT ? variable_get('filter_default_format', 1) : $format;
+ return $format == FILTER_FORMAT_DEFAULT ? variable_get('filter_default_format') : $format;
}
/**
* Check if text in a certain input format is allowed to be cached.
@@ -804,7 +804,7 @@
// Only one format available: use a hidden form item and only show tips.
$format = array_shift($formats);
$form[$format->format] = array('#type' => 'value', '#value' => $format->format, '#parents' => $parents);
- $tips = _filter_tips(variable_get('filter_default_format', 1), FALSE);
+ $tips = _filter_tips(variable_get('filter_default_format'), FALSE);
$form['format']['guidelines'] = array(
'#title' => t('Formatting guidelines'),
'#value' => theme('filter_tips', $tips, FALSE, $extra),
@@ -829,7 +829,7 @@
*/
function filter_access($format) {
$format = filter_resolve_format($format);
- if (user_access('administer filters') || ($format == variable_get('filter_default_format', 1))) {
+ if (user_access('administer filters') || ($format == variable_get('filter_default_format'))) {
return TRUE;
}
else {
@@ -1012,14 +1012,14 @@
$form['filter_html']["filter_html_$format"] = array(
'#type' => 'radios',
'#title' => t('Filter HTML tags'),
- '#default_value' => variable_get("filter_html_$format", FILTER_HTML_STRIP),
+ '#default_value' => variable_get_default("filter_html_$format", FILTER_HTML_STRIP),
'#options' => array(FILTER_HTML_STRIP => t('Strip disallowed tags'), FILTER_HTML_ESCAPE => t('Escape all tags')),
'#description' => t('How to deal with HTML tags in user-contributed content. If set to "Strip disallowed tags", dangerous tags are removed (see below). If set to "Escape tags", all HTML is escaped and presented as it was typed.'),
);
$form['filter_html']["allowed_html_$format"] = array(
'#type' => 'textfield',
'#title' => t('Allowed HTML tags'),
- '#default_value' => variable_get("allowed_html_$format", ' -
-
- '),
+ '#default_value' => variable_get_default("allowed_html_$format", '
-
-
- '),
'#size' => 64,
'#maxlength' => 255,
'#description' => t('If "Strip disallowed tags" is selected, optionally specify tags which should not be stripped. JavaScript event attributes are always stripped.'),
@@ -1027,13 +1027,13 @@
$form['filter_html']["filter_html_help_$format"] = array(
'#type' => 'checkbox',
'#title' => t('Display HTML help'),
- '#default_value' => variable_get("filter_html_help_$format", 1),
+ '#default_value' => variable_get_default("filter_html_help_$format", 1),
'#description' => t('If enabled, Drupal will display some basic HTML help in the long filter tips.'),
);
$form['filter_html']["filter_html_nofollow_$format"] = array(
'#type' => 'checkbox',
'#title' => t('Spam link deterrent'),
- '#default_value' => variable_get("filter_html_nofollow_$format", FALSE),
+ '#default_value' => variable_get_default("filter_html_nofollow_$format", FALSE),
'#description' => t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'),
);
return $form;
@@ -1043,17 +1043,17 @@
* HTML filter. Provides filtering of input into accepted HTML.
*/
function _filter_html($text, $format) {
- if (variable_get("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_STRIP) {
- $allowed_tags = preg_split('/\s+|<|>/', variable_get("allowed_html_$format", '
-
-
- '), -1, PREG_SPLIT_NO_EMPTY);
+ if (variable_get_default("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_STRIP) {
+ $allowed_tags = preg_split('/\s+|<|>/', variable_get_default("allowed_html_$format", '
-
-
- '), -1, PREG_SPLIT_NO_EMPTY);
$text = filter_xss($text, $allowed_tags);
}
- if (variable_get("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_ESCAPE) {
+ if (variable_get_default("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_ESCAPE) {
// Escape HTML
$text = check_plain($text);
}
- if (variable_get("filter_html_nofollow_$format", FALSE)) {
+ if (variable_get_default("filter_html_nofollow_$format", FALSE)) {
$text = preg_replace('/]+)>/i', '', $text);
}
@@ -1085,7 +1085,7 @@
*/
function _filter_url($text, $format) {
// Pass length to regexp callback
- _filter_url_trim(NULL, variable_get('filter_url_length_'. $format, 72));
+ _filter_url_trim(NULL, variable_get_default('filter_url_length_'. $format, 72));
$text = ' '. $text .' ';
@@ -1518,7 +1518,7 @@
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('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal')));
+ $allowed_protocols = array_flip(variable_get('filter_allowed_protocols'));
}
// Get the plain text representation of the attribute value (i.e. its meaning).
Index: modules/color/color.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/color/color.module,v
retrieving revision 1.20
diff -u -r1.20 color.module
--- modules/color/color.module 14 May 2007 13:43:34 -0000 1.20
+++ modules/color/color.module 29 May 2007 09:07:38 -0000
@@ -17,7 +17,7 @@
function color_form_alter(&$form, $form_id) {
// Insert the color changer into the theme settings page.
// TODO: Last condition in the following if disables color changer when private files are used this should be solved in a different way. See issue #92059.
- if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && function_exists('gd_info') && variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
+ if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && function_exists('gd_info') && variable_get('file_downloads') == FILE_DOWNLOADS_PUBLIC) {
$form['color'] = array(
'#type' => 'fieldset',
'#title' => t('Color scheme'),
@@ -33,7 +33,7 @@
if ($form_id == 'system_theme_select_form' || $form_id == 'system_themes') {
$themes = list_themes();
foreach (element_children($form) as $theme) {
- if ($screenshot = variable_get('color_'. $theme .'_screenshot', NULL)) {
+ if ($screenshot = variable_get_default('color_'. $theme .'_screenshot', NULL)) {
if (isset($form[$theme]['screenshot'])) {
$form[$theme]['screenshot']['#value'] = theme('image', $screenshot, '', '', array('class' => 'screenshot'), FALSE);
}
@@ -49,14 +49,14 @@
global $theme_key;
// Override stylesheet
- $path = variable_get('color_'. $theme_key .'_stylesheet', NULL);
+ $path = variable_get_default('color_'. $theme_key .'_stylesheet', NULL);
if ($path) {
$vars['css']['all']['theme'][$path] = TRUE;
$vars['styles'] = drupal_get_css($vars['css']);
}
// Override logo
- $logo = variable_get('color_'. $theme_key .'_logo', NULL);
+ $logo = variable_get_default('color_'. $theme_key .'_logo', NULL);
if ($logo && $vars['logo'] && preg_match('!'. $theme_key .'/logo.png$!', $vars['logo'])) {
$vars['logo'] = base_path() . $logo;
}
@@ -87,7 +87,7 @@
}
// Load variable
- return $default ? $palette : variable_get('color_'. $theme .'_palette', $palette);
+ return $default ? $palette : variable_get_default('color_'. $theme .'_palette', $palette);
}
/**
@@ -109,7 +109,7 @@
)), 'setting');
// See if we're using a predefined scheme
- $current = implode(',', variable_get('color_'. $theme .'_palette', array()));
+ $current = implode(',', variable_get_default('color_'. $theme .'_palette', array()));
// Note: we use the original theme when the default scheme is chosen.
$current = isset($info['schemes'][$current]) ? $current : ($current == '' ? reset($info['schemes']) : '');
@@ -218,7 +218,7 @@
}
// Delete old files
- foreach (variable_get('color_'. $theme .'_files', array()) as $file) {
+ foreach (variable_get_default('color_'. $theme .'_files', array()) as $file) {
@unlink($file);
}
if ($file = dirname($file)) {
@@ -238,7 +238,7 @@
// Prepare target locations for generated files
$id = $theme .'-'. substr(md5(serialize($palette) . microtime()), 0, 8);
- $paths['color'] = variable_get('file_directory_path', 'files') .'/color';
+ $paths['color'] = variable_get('file_directory_path') .'/color';
$paths['target'] = $paths['color'] .'/'. $id;
foreach ($paths as $path) {
if (!is_dir($path)) {