? variable_defaults.patch ? variable_defaults_02.patch ? variable_defaults_03.patch ? veggies.php ? misc/Thumbs.db ? misc/farbtastic/Thumbs.db ? sites/all/modules ? sites/default/settings.php Index: cron.php =================================================================== RCS file: /cvs/drupal/drupal/cron.php,v retrieving revision 1.39 diff -u -p -r1.39 cron.php --- cron.php 26 May 2008 17:24:42 -0000 1.39 +++ cron.php 25 Jul 2008 05:34:08 -0000 @@ -8,7 +8,7 @@ include_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); -if (isset($_GET['cron_key']) && variable_get('cron_key', 'drupal') == $_GET['cron_key']) { +if (isset($_GET['cron_key']) && variable_get('cron_key') == $_GET['cron_key']) { drupal_cron_run(); } else { Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.125 diff -u -p -r1.125 install.php --- install.php 18 Jul 2008 07:24:29 -0000 1.125 +++ install.php 25 Jul 2008 19:08:24 -0000 @@ -656,7 +656,7 @@ function install_tasks($profile, $task) // Install profile modules. if ($task == 'profile-install') { - $modules = variable_get('install_profile_modules', array()); + $modules = variable_get('install_profile_modules'); $files = module_rebuild_cache(); variable_del('install_profile_modules'); $operations = array(); @@ -712,7 +712,8 @@ function install_tasks($profile, $task) } if ($task == 'configure') { - if (variable_get('site_name', FALSE) || variable_get('site_mail', FALSE)) { + global $conf; + if (isset($conf['site_name']) || isset($conf['site_mail'])) { // Site already configured: This should never happen, means re-running // the installer, possibly by an attacker after the 'install_task' variable // got accidentally blown somewhere. Stop it now. @@ -720,7 +721,7 @@ function install_tasks($profile, $task) } $form = drupal_get_form('install_configure_form', $url); - if (!variable_get('site_name', FALSE) && !variable_get('site_mail', FALSE)) { + if (!isset($conf['site_name']) && !isset($conf['site_mail'])) { // Not submitted yet: Prepare to display the form. $output = $form; drupal_set_title(st('Configure site')); @@ -783,7 +784,7 @@ if (Drupal.jsEnabled) { include_once 'includes/locale.inc'; // Collect files to import for this language. Skip components // already covered in the initial batch set. - $batch = locale_batch_by_language($install_locale, '_install_locale_remaining_batch_finished', variable_get('install_locale_batch_components', array())); + $batch = locale_batch_by_language($install_locale, '_install_locale_remaining_batch_finished', variable_get('install_locale_batch_components')); // Remove temporary variable. variable_del('install_locale_batch_components'); if (!empty($batch)) { Index: update.php =================================================================== RCS file: /cvs/drupal/drupal/update.php,v retrieving revision 1.255 diff -u -p -r1.255 update.php --- update.php 16 Jul 2008 21:59:24 -0000 1.255 +++ update.php 25 Jul 2008 08:27:52 -0000 @@ -489,7 +489,7 @@ function update_check_incompatibility($n function update_fix_d6_requirements() { $ret = array(); - if (drupal_get_installed_schema_version('system') < 6000 && !variable_get('update_d6_requirements', FALSE)) { + if (drupal_get_installed_schema_version('system') < 6000 && !variable_get('update_d6_requirements')) { $spec = array('type' => 'int', 'size' => 'small', 'default' => 0, 'not null' => TRUE); db_add_field($ret, 'cache', 'serialized', $spec); db_add_field($ret, 'cache_filter', 'serialized', $spec); Index: includes/actions.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/actions.inc,v retrieving revision 1.13 diff -u -p -r1.13 actions.inc --- includes/actions.inc 29 Jun 2008 12:07:15 -0000 1.13 +++ includes/actions.inc 25 Jul 2008 05:34:09 -0000 @@ -40,7 +40,7 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL) { static $stack; $stack++; - if ($stack > variable_get('actions_max_stack', 35)) { + if ($stack > variable_get('actions_max_stack')) { watchdog('actions', 'Stack overflow: too many calls to actions_do(). Aborting to prevent infinite recursion.', array(), WATCHDOG_ERROR); return; } Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.217 diff -u -p -r1.217 bootstrap.inc --- includes/bootstrap.inc 17 Jul 2008 21:10:39 -0000 1.217 +++ includes/bootstrap.inc 25 Jul 2008 19:25:39 -0000 @@ -488,15 +488,12 @@ function variable_init($conf = array()) * * @param $name * The name of the variable to return. - * @param $default - * The default value to use if this variable has never been set. * @return * The value of the variable. */ -function variable_get($name, $default) { +function variable_get($name) { global $conf; - - return isset($conf[$name]) ? $conf[$name] : $default; + return isset($conf[$name]) ? $conf[$name] : variable_default($name); } /** @@ -511,6 +508,10 @@ function variable_get($name, $default) { function variable_set($name, $value) { global $conf; + if ($value == variable_default($name)) { + variable_del($name); + return; + } $serialized_value = serialize($value); db_query("UPDATE {variable} SET value = '%s' WHERE name = '%s'", $serialized_value, $name); if (!db_affected_rows()) { @@ -523,6 +524,104 @@ function variable_set($name, $value) { } /** + * Gets the default value for a given variable. + * + * @param $name + * The name of the variable in question. + * @param $refresh + * If TRUE, refreshes the internal static cache. Defaults to FALSE. + * @return + * The default value for that variable, to be used in case no value is set. + */ +function variable_default($name, $refresh = FALSE) { + static $defaults; + static $invoked = FALSE; + if ($refresh) { + $defaults = array(); + $invoked = FALSE; + } + if (empty($defaults)) { + // These variables need to be initialized here because they are required to + // exist before the database is set up and the variable system initialized. + $defaults['cache_inc'] = './includes/cache.inc'; + $defaults['page_cache_fastpath'] = FALSE; + $defaults['blocked_ips'] = NULL; + $defaults['session_inc'] = './includes/session.inc'; + $defaults['dev_query'] = 0; + $defaults['reverse_proxy'] = 0; + $defaults['reverse_proxy_addresses'] = array( + '#type' => 'value', + '#value' => array(), + ); + $defaults['cache_flush'] = 0; + $defaults['language_count'] = 1; + $defaults['session_write_interval'] = 180; + $defaults['site_frontpage'] = 'node'; + $defaults['install_profile_modules'] = array( + '#type' => 'value', + '#value' => array(), + ); + $defaults['install_locale_batch_components'] = array( + '#type' => 'value', + '#value' => array(), + ); + $defaults['password_inc'] = './includes/password.inc'; + $defaults['language_default'] = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); + } + // Intensional usage of function_exists(). + if (!$invoked && !isset($defaults[$name]) && !array_key_exists($name, $defaults) && function_exists('module_invoke_all') && function_exists('drupal_alter') && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')) { + $defaults += module_invoke_all('variables'); + drupal_alter('variable_defaults', $defaults); + $invoked = TRUE; + } + if (isset($defaults[$name]) || array_key_exists($name, $defaults)) { + if (is_array($defaults[$name])) { + switch ($defaults[$name]['#type']) { + case 'value': + return $defaults[$name]['#value']; + + case 'variable': + return variable_get($defaults[$name]['#value']); + + case 'callback': + if (drupal_function_exists($defaults[$name]['#value'])) { + return call_user_func_array($defaults[$name]['#value'], isset($defaults[$name]['#arguments']) ? $defaults[$name]['#arguments'] : array()); + } + // Deliberate fall-through. + + default: + return NULL; + } + } + return $defaults[$name]; + } + $ancestor = variable_ancestor($name); + if ($ancestor) { + return variable_get($ancestor); + } + return NULL; +} + +/** + * Returns the ancestor of a given variable. The ancestor is defined as the + * variable name with everything after the last underscore chopped off, and the + * last underscore chopped off too for good measure. + * + * @param $name + * The name of the variable to return the ancestor of. + * @return + * The ancestor of the variable specified in $name, or FALSE on failure. + */ +function variable_ancestor($name) { + $parts = explode('_', $name); + if (count($parts) === 1) { + return FALSE; + } + array_pop($parts); + return implode('_', $parts); +} + +/** * Unset a persistent variable. * * @param $name @@ -654,7 +753,7 @@ function drupal_page_cache_header($cache header("Expires: Sun, 19 Nov 1978 05:00:00 GMT"); header("Cache-Control: must-revalidate"); - if (variable_get('page_compression', TRUE)) { + if (variable_get('page_compression')) { // Determine if the browser accepts gzipped data. if (@strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE && function_exists('gzencode')) { // Strip the gzip header and run uncompress. @@ -911,7 +1010,7 @@ function drupal_is_denied($ip) { // Because this function is called on every page request, we first check // for an array of IP addresses in settings.php before querying the // database. - $blocked_ips = variable_get('blocked_ips', NULL); + $blocked_ips = variable_get('blocked_ips'); if (isset($blocked_ips) && is_array($blocked_ips)) { return in_array($ip, $blocked_ips); } @@ -983,12 +1082,12 @@ function _drupal_bootstrap($phase) { case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE: // Allow specifying special cache handlers in settings.php, like // using memcached or files for storing cache information. - require_once variable_get('cache_inc', './includes/cache.inc'); + require_once variable_get('cache_inc'); // If the page_cache_fastpath is set to TRUE in settings.php and // page_cache_fastpath (implemented in the special implementation of // cache.inc) printed the page and indicated this with a returned TRUE // then we are done. - if (variable_get('page_cache_fastpath', FALSE) && page_cache_fastpath()) { + if (variable_get('page_cache_fastpath') && page_cache_fastpath()) { exit; } break; @@ -1012,7 +1111,7 @@ function _drupal_bootstrap($phase) { break; case DRUPAL_BOOTSTRAP_SESSION: - require_once variable_get('session_inc', './includes/session.inc'); + require_once variable_get('session_inc'); session_set_save_handler('sess_open', 'sess_close', 'sess_read', 'sess_write', 'sess_destroy_sid', 'sess_gc'); session_start(); break; @@ -1022,7 +1121,7 @@ function _drupal_bootstrap($phase) { $conf = variable_init(isset($conf) ? $conf : array()); // Load module handling. require_once './includes/module.inc'; - $cache_mode = variable_get('cache', CACHE_DISABLED); + $cache_mode = variable_get('cache'); // Get the page from the cache. $cache = $cache_mode == CACHE_DISABLED ? '' : page_get_cache(); // If the skipping of the bootstrap hooks is not enforced, call hook_boot. @@ -1093,7 +1192,7 @@ function drupal_init_language() { // Ensure the language is correctly returned, even without multilanguage support. // Useful for eg. XML/HTML 'lang' attributes. - if (variable_get('language_count', 1) == 1) { + if (variable_get('language_count') == 1) { $language = language_default(); } else { @@ -1118,7 +1217,7 @@ function language_list($field = 'languag // Init language list if (!isset($languages)) { - if (variable_get('language_count', 1) > 1 || module_exists('locale')) { + if (variable_get('language_count') > 1 || module_exists('locale')) { $result = db_query('SELECT * FROM {languages} ORDER BY weight ASC, name ASC'); while ($row = db_fetch_object($result)) { $languages['language'][$row->language] = $row; @@ -1154,7 +1253,7 @@ function language_list($field = 'languag * Optional property of the language object to return */ function language_default($property = NULL) { - $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '')); + $language = variable_get('language_default'); return $property ? $language->$property : $language; } @@ -1176,11 +1275,11 @@ function ip_address($reset = false) { if (!isset($ip_address) || $reset) { $ip_address = $_SERVER['REMOTE_ADDR']; - if (variable_get('reverse_proxy', 0)) { + if (variable_get('reverse_proxy')) { if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { // If an array of known reverse proxy IPs is provided, then trust // the XFF header if request really comes from one of them. - $reverse_proxy_addresses = variable_get('reverse_proxy_addresses', array()); + $reverse_proxy_addresses = variable_get('reverse_proxy_addresses'); if (!empty($reverse_proxy_addresses) && in_array($ip_address, $reverse_proxy_addresses, TRUE)) { // If there are several arguments, we need to check the most // recently added one, i.e. the last one. Index: includes/cache.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/cache.inc,v retrieving revision 1.20 diff -u -p -r1.20 cache.inc --- includes/cache.inc 2 Jul 2008 20:42:25 -0000 1.20 +++ includes/cache.inc 25 Jul 2008 05:34:09 -0000 @@ -16,8 +16,8 @@ function cache_get($cid, $table = 'cache global $user; // Garbage collection necessary when enforcing a minimum cache lifetime - $cache_flush = variable_get('cache_flush', 0); - if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) { + $cache_flush = variable_get('cache_flush'); + if ($cache_flush && ($cache_flush + variable_get('cache_lifetime') <= time())) { // Reset the variable immediately to prevent a meltdown in heavy load situations. variable_set('cache_flush', 0); // Time to flush old cache data @@ -28,7 +28,7 @@ function cache_get($cid, $table = 'cache if (isset($cache->data)) { // If the data is permanent or we're not enforcing a minimum cache lifetime // always return the cached data. - if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime', 0)) { + if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime')) { $cache->data = db_decode_blob($cache->data); if ($cache->serialized) { $cache->data = unserialize($cache->data); @@ -143,19 +143,19 @@ function cache_clear_all($cid = NULL, $t } if (empty($cid)) { - if (variable_get('cache_lifetime', 0)) { + if (variable_get('cache_lifetime')) { // We store the time in the current user's $user->cache variable which // will be saved into the sessions table by sess_write(). We then // simulate that the cache was flushed for this user by not returning // cached data that was cached before the timestamp. $user->cache = time(); - $cache_flush = variable_get('cache_flush', 0); + $cache_flush = variable_get('cache_flush'); if ($cache_flush == 0) { // This is the first request to clear the cache, start a timer. variable_set('cache_flush', time()); } - else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) { + else if (time() > ($cache_flush + variable_get('cache_lifetime'))) { // Clear the cache for everyone, cache_flush_delay seconds have // passed since the first request to clear the cache. db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.779 diff -u -p -r1.779 common.inc --- includes/common.inc 19 Jul 2008 10:38:13 -0000 1.779 +++ includes/common.inc 25 Jul 2008 05:34:09 -0000 @@ -332,7 +332,7 @@ function drupal_site_offline() { drupal_set_header('HTTP/1.1 503 Service unavailable'); drupal_set_title(t('Site offline')); print theme('maintenance_page', filter_xss_admin(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')))))); + t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name')))))); } /** @@ -348,7 +348,7 @@ function drupal_not_found() { $_REQUEST['destination'] = $_GET['q']; } - $path = drupal_get_normal_path(variable_get('site_404', '')); + $path = drupal_get_normal_path(variable_get('site_404')); if ($path && $path != $_GET['q']) { // Set the active item in case there are tabs to display, or other // dependencies on the path. @@ -377,7 +377,7 @@ function drupal_access_denied() { $_REQUEST['destination'] = $_GET['q']; } - $path = drupal_get_normal_path(variable_get('site_403', '')); + $path = drupal_get_normal_path(variable_get('site_403')); if ($path && $path != $_GET['q']) { // Set the active item in case there are tabs to display or other // dependencies on the path. @@ -421,7 +421,7 @@ function drupal_http_request($url, $head // can't tie this call to any error because there is no surefire way to // tell whether a request has failed, so we add the check to places where // some parsing has failed. - if (!$self_test && variable_get('drupal_http_request_fails', FALSE)) { + if (!$self_test && variable_get('drupal_http_request_fails')) { $self_test = TRUE; $works = module_invoke('system', 'check_http_request'); $self_test = FALSE; @@ -613,7 +613,7 @@ function drupal_error_handler($errno, $m $entry = $types[$errno] . ': ' . $message . ' in ' . $filename . ' on line ' . $line . '.'; // Force display of error messages in update.php. - if (variable_get('error_level', 1) == 1 || strstr($_SERVER['SCRIPT_NAME'], 'update.php')) { + if (variable_get('error_level') == 1 || strstr($_SERVER['SCRIPT_NAME'], 'update.php')) { drupal_set_message($entry, 'error'); } @@ -1166,11 +1166,11 @@ function format_interval($timestamp, $gr function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) { if (!isset($timezone)) { global $user; - if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) { + if (variable_get('configurable_timezones') && $user->uid && strlen($user->timezone)) { $timezone = $user->timezone; } else { - $timezone = variable_get('date_default_timezone', 0); + $timezone = variable_get('date_default_timezone'); } } @@ -1178,17 +1178,17 @@ function format_date($timestamp, $type = switch ($type) { case 'small': - $format = variable_get('date_format_short', 'm/d/Y - H:i'); + $format = variable_get('date_format_short'); break; case 'large': - $format = variable_get('date_format_long', 'l, F j, Y - H:i'); + $format = variable_get('date_format_long'); break; case 'custom': // No change to format. break; case 'medium': default: - $format = variable_get('date_format_medium', 'D, m/d/Y - H:i'); + $format = variable_get('date_format_medium'); } $max = strlen($format); @@ -1326,7 +1326,7 @@ function url($path = NULL, $options = ar // Cache the clean_url variable to improve performance. if (!isset($clean_url)) { - $clean_url = (bool)variable_get('clean_url', '0'); + $clean_url = (bool)variable_get('clean_url'); } if (!isset($options['base_url'])) { @@ -1476,7 +1476,7 @@ function l($text, $path, $options = arra */ function drupal_page_footer() { - if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) { + if (variable_get('cache') != CACHE_DISABLED) { page_set_cache(); } @@ -1699,15 +1699,15 @@ function drupal_get_css($css = NULL) { $no_module_preprocess = ''; $no_theme_preprocess = ''; - $preprocess_css = (variable_get('preprocess_css', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')); + $preprocess_css = (variable_get('preprocess_css') && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')); $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); // A dummy query-string is added to filenames, to gain control over // browser-caching. The string changes on every update or full cache // flush, forcing browsers to load a new copy of the files, as the // URL changed. - $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1); + $query_string = '?' . substr(variable_get('css_js_query_string'), 0, 1); foreach ($css as $media => $types) { // If CSS preprocessing is off, we still need to output the styles. @@ -2051,9 +2051,9 @@ function drupal_get_js($scope = 'header' $preprocessed = ''; $no_preprocess = array('core' => '', 'module' => '', 'theme' => ''); $files = array(); - $preprocess_js = (variable_get('preprocess_js', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')); + $preprocess_js = (variable_get('preprocess_js') && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')); $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); // A dummy query-string is added to filenames, to gain control over // browser-caching. The string changes on every update or full cache @@ -2061,7 +2061,7 @@ function drupal_get_js($scope = 'header' // URL changed. Files that should not be cached (see drupal_add_js()) // get time() as query-string instead, to enforce reload on every // page request. - $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1); + $query_string = '?' . substr(variable_get('css_js_query_string'), 0, 1); foreach ($javascript as $type => $data) { @@ -2321,7 +2321,7 @@ function drupal_json($var = NULL) { * String to encode */ function drupal_urlencode($text) { - if (variable_get('clean_url', '0')) { + if (variable_get('clean_url')) { return str_replace(array('%2F', '%26', '%23', '//'), array('/', '%2526', '%2523', '/%252F'), rawurlencode($text)); @@ -2376,7 +2376,7 @@ function drupal_random_bytes($count) { * The private key. */ function drupal_get_private_key() { - if (!($key = variable_get('drupal_private_key', 0))) { + if (!($key = variable_get('drupal_private_key'))) { $key = md5(drupal_random_bytes(64)); variable_set('drupal_private_key', $key); } @@ -2409,7 +2409,7 @@ function drupal_get_token($value = '') { */ function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) { global $user; - return (($skip_anonymous && $user->uid == 0) || ($token == md5(session_id() . $value . variable_get('drupal_private_key', '')))); + return (($skip_anonymous && $user->uid == 0) || ($token == md5(session_id() . $value . variable_get('drupal_private_key')))); } /** @@ -2494,7 +2494,7 @@ function page_set_cache() { // This will fail in some cases, see page_get_cache() for the explanation. if ($data = ob_get_contents()) { $cache = TRUE; - if (variable_get('page_compression', TRUE) && function_exists('gzencode')) { + if (variable_get('page_compression') && function_exists('gzencode')) { // We do not store the data in case the zlib mode is deflate. // This should be rarely happening. if (zlib_get_coding_type() == 'deflate') { @@ -2527,7 +2527,7 @@ function drupal_cron_run() { @set_time_limit(240); // Fetch the cron semaphore - $semaphore = variable_get('cron_semaphore', FALSE); + $semaphore = variable_get('cron_semaphore'); if ($semaphore) { if (time() - $semaphore > 3600) { @@ -2570,7 +2570,7 @@ function drupal_cron_run() { */ function drupal_cron_cleanup() { // See if the semaphore is still locked. - if (variable_get('cron_semaphore', FALSE)) { + if (variable_get('cron_semaphore')) { watchdog('cron', 'Cron run exceeded the time limit and was aborted.', array(), WATCHDOG_WARNING); // Release cron semaphore @@ -2615,7 +2615,7 @@ function drupal_system_listing($mask, $d // table contains the name of the current profile, and we can call variable_get() // to determine what one is active. if (!isset($profile)) { - $profile = variable_get('install_profile', 'default'); + $profile = variable_get('install_profile'); } $searchdir = array($directory); $files = array(); @@ -3569,7 +3569,7 @@ function drupal_flush_all_caches() { * This is also called from update.php. */ function _drupal_flush_css_js() { - $string_history = variable_get('css_js_query_string', '00000000000000000000'); + $string_history = variable_get('css_js_query_string'); $new_character = $string_history[0]; $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; while (strpos($string_history, $new_character) !== FALSE) { Index: includes/database.mysql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v retrieving revision 1.91 diff -u -p -r1.91 database.mysql.inc --- includes/database.mysql.inc 14 Apr 2008 17:48:33 -0000 1.91 +++ includes/database.mysql.inc 25 Jul 2008 05:34:09 -0000 @@ -92,7 +92,7 @@ function db_connect($url) { function _db_query($query, $debug = 0) { global $active_db, $queries, $user; - if (variable_get('dev_query', 0)) { + if (variable_get('dev_query')) { list($usec, $sec) = explode(' ', microtime()); $timer = (float)$usec + (float)$sec; // If devel.module query logging is enabled, prepend a comment with the username and calling function @@ -100,7 +100,7 @@ function _db_query($query, $debug = 0) { // code is issueing the slow query. $bt = debug_backtrace(); // t() may not be available yet so we don't wrap 'Anonymous'. - $name = $user->uid ? $user->name : variable_get('anonymous', 'Anonymous'); + $name = $user->uid ? $user->name : variable_get('anonymous'); // str_replace() to prevent SQL injection via username or anonymous name. $name = str_replace(array('*', '/'), '', $name); $query = '/* ' . $name . ' : ' . $bt[2]['function'] . ' */ ' . $query; @@ -108,7 +108,7 @@ function _db_query($query, $debug = 0) { $result = mysql_query($query, $active_db); - if (variable_get('dev_query', 0)) { + if (variable_get('dev_query')) { $query = $bt[2]['function'] . "\n" . $query; list($usec, $sec) = explode(' ', microtime()); $stop = (float)$usec + (float)$sec; Index: includes/database.mysqli.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysqli.inc,v retrieving revision 1.57 diff -u -p -r1.57 database.mysqli.inc --- includes/database.mysqli.inc 14 Apr 2008 17:48:33 -0000 1.57 +++ includes/database.mysqli.inc 25 Jul 2008 05:34:09 -0000 @@ -93,7 +93,7 @@ function db_connect($url) { function _db_query($query, $debug = 0) { global $active_db, $queries, $user; - if (variable_get('dev_query', 0)) { + if (variable_get('dev_query')) { list($usec, $sec) = explode(' ', microtime()); $timer = (float)$usec + (float)$sec; // If devel.module query logging is enabled, prepend a comment with the username and calling function @@ -101,7 +101,7 @@ function _db_query($query, $debug = 0) { // code is issueing the slow query. $bt = debug_backtrace(); // t() may not be available yet so we don't wrap 'Anonymous' - $name = $user->uid ? $user->name : variable_get('anonymous', 'Anonymous'); + $name = $user->uid ? $user->name : variable_get('anonymous'); // str_replace() to prevent SQL injection via username or anonymous name. $name = str_replace(array('*', '/'), '', $name); $query = '/* ' . $name . ' : ' . $bt[2]['function'] . ' */ ' . $query; @@ -109,7 +109,7 @@ function _db_query($query, $debug = 0) { $result = mysqli_query($active_db, $query); - if (variable_get('dev_query', 0)) { + if (variable_get('dev_query')) { $query = $bt[2]['function'] . "\n" . $query; list($usec, $sec) = explode(' ', microtime()); $stop = (float)$usec + (float)$sec; Index: includes/database.pgsql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v retrieving revision 1.71 diff -u -p -r1.71 database.pgsql.inc --- includes/database.pgsql.inc 9 May 2008 19:18:11 -0000 1.71 +++ includes/database.pgsql.inc 25 Jul 2008 05:34:10 -0000 @@ -130,14 +130,14 @@ function db_query($query) { function _db_query($query, $debug = 0) { global $active_db, $last_result, $queries; - if (variable_get('dev_query', 0)) { + if (variable_get('dev_query')) { list($usec, $sec) = explode(' ', microtime()); $timer = (float)$usec + (float)$sec; } $last_result = pg_query($active_db, $query); - if (variable_get('dev_query', 0)) { + if (variable_get('dev_query')) { $bt = debug_backtrace(); $query = $bt[2]['function'] . "\n" . $query; list($usec, $sec) = explode(' ', microtime()); Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.127 diff -u -p -r1.127 file.inc --- includes/file.inc 5 Jul 2008 18:34:29 -0000 1.127 +++ includes/file.inc 25 Jul 2008 07:58:27 -0000 @@ -81,7 +81,7 @@ function file_create_url($path) { if (strpos($path, file_directory_path() . '/') === 0) { $path = trim(substr($path, strlen(file_directory_path())), '\\/'); } - switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) { + switch (variable_get('file_downloads')) { case FILE_DOWNLOADS_PUBLIC: return $GLOBALS['base_url'] . '/' . file_directory_path() . '/' . str_replace('\\', '/', $path); case FILE_DOWNLOADS_PRIVATE: @@ -391,7 +391,7 @@ function file_munge_filename($filename, $original = $filename; // Allow potentially insecure uploads for very savvy users and admin - if (!variable_get('allow_insecure_uploads', 0)) { + if (!variable_get('allow_insecure_uploads')) { $whitelist = array_unique(explode(' ', trim($extensions))); // Split the filename up by periods. The first part becomes the basename @@ -555,7 +555,7 @@ function file_save_upload($source, $vali $extensions = ''; foreach ($user->roles as $rid => $name) { $extensions .= ' ' . variable_get("upload_extensions_$rid", - variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp')); + variable_get('upload_extensions_default')); } // Begin building file object. @@ -953,7 +953,7 @@ function file_scan_directory($dir, $mask * @return A string containing a temp directory. */ function file_directory_temp() { - $temporary_directory = variable_get('file_directory_temp', NULL); + $temporary_directory = variable_get('file_directory_temp'); if (is_null($temporary_directory)) { $directories = array(); @@ -994,7 +994,7 @@ function file_directory_temp() { * @return A string containing the path to Drupal's 'files' directory. */ function file_directory_path() { - return variable_get('file_directory_path', conf_path() . '/files'); + return variable_get('file_directory_path'); } /** Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.277 diff -u -p -r1.277 form.inc --- includes/form.inc 18 Jul 2008 07:06:24 -0000 1.277 +++ includes/form.inc 25 Jul 2008 05:34:10 -0000 @@ -405,7 +405,7 @@ function drupal_process_form($form_id, & // We'll clear out the cached copies of the form and its stored data // here, as we've finished with them. The in-memory copies are still // here, though. - if (variable_get('cache', CACHE_DISABLED) == CACHE_DISABLED && !empty($form_state['values']['form_build_id'])) { + if (variable_get('cache') == CACHE_DISABLED && !empty($form_state['values']['form_build_id'])) { cache_clear_all('form_' . $form_state['values']['form_build_id'], 'cache_form'); cache_clear_all('storage_' . $form_state['values']['form_build_id'], 'cache_form'); } @@ -1653,7 +1653,7 @@ function form_process_date($element) { $element['#tree'] = TRUE; // Determine the order of day, month, year in the site's chosen date format. - $format = variable_get('date_format_short', 'm/d/Y - H:i'); + $format = variable_get('date_format_short'); $sort = array(); $sort['day'] = max(strpos($format, 'd'), strpos($format, 'j')); $sort['month'] = max(strpos($format, 'm'), strpos($format, 'M')); Index: includes/image.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/image.inc,v retrieving revision 1.26 diff -u -p -r1.26 image.inc --- includes/image.inc 8 Jul 2008 01:08:15 -0000 1.26 +++ includes/image.inc 25 Jul 2008 05:34:10 -0000 @@ -63,7 +63,7 @@ function image_get_toolkit() { static $toolkit; if (!$toolkit) { - $toolkit = variable_get('image_toolkit', 'gd'); + $toolkit = variable_get('image_toolkit'); if (isset($toolkit) && drupal_function_exists("image_" . $toolkit . "_resize")) { } Index: includes/language.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/language.inc,v retrieving revision 1.16 diff -u -p -r1.16 language.inc --- includes/language.inc 14 Apr 2008 17:48:33 -0000 1.16 +++ includes/language.inc 25 Jul 2008 05:34:10 -0000 @@ -13,7 +13,7 @@ function language_initialize() { global $user; // Configured presentation language mode. - $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); + $mode = variable_get('language_negotiation'); // Get a list of enabled languages. $languages = language_list('enabled'); $languages = $languages[1]; @@ -113,7 +113,7 @@ function language_url_rewrite(&$path, &$ $options['language'] = $language; } - switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) { + switch (variable_get('language_negotiation')) { case LANGUAGE_NEGOTIATION_NONE: // No language dependent path allowed in this mode. unset($options['language']); Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.178 diff -u -p -r1.178 locale.inc --- includes/locale.inc 22 Jul 2008 20:03:41 -0000 1.178 +++ includes/locale.inc 25 Jul 2008 18:48:03 -0000 @@ -453,7 +453,7 @@ function locale_languages_configure_form LANGUAGE_NEGOTIATION_PATH_DEFAULT => t('Path prefix only.'), LANGUAGE_NEGOTIATION_PATH => t('Path prefix with language fallback.'), LANGUAGE_NEGOTIATION_DOMAIN => t('Domain name only.')), - '#default_value' => variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE), + '#default_value' => variable_get('language_negotiation'), '#description' => t("Select the mechanism used to determine your site's presentation language. Modifying this setting may break all incoming URLs and should be used with caution in a production environment.") ); $form['submit'] = array( @@ -936,7 +936,7 @@ function locale_add_language($langcode, if ($enabled) { // Increment enabled language count if we are adding an enabled language. - variable_set('language_count', variable_get('language_count', 1) + 1); + variable_set('language_count', variable_get('language_count') + 1); } // Force JavaScript translation file creation for the newly added language. @@ -1728,7 +1728,7 @@ function _locale_export_po_generate($lan if (!isset($header)) { if (isset($language)) { - $header = '# ' . $language->name . ' translation of ' . variable_get('site_name', 'Drupal') . "\n"; + $header = '# ' . $language->name . ' translation of ' . variable_get('site_name') . "\n"; $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n"; $header .= "#\n"; $header .= "msgid \"\"\n"; @@ -2034,7 +2034,7 @@ function _locale_translate_seek_query() * New content of the 'javascript_parsed' variable. */ function _locale_invalidate_js($langcode = NULL) { - $parsed = variable_get('javascript_parsed', array()); + $parsed = variable_get('javascript_parsed'); if (empty($langcode)) { // Invalidate all languages. @@ -2117,7 +2117,7 @@ function _locale_rebuild_js($langcode = // Construct the filepath where JS translation files are stored. // There is (on purpose) no front end to edit that variable. - $dir = file_create_path(variable_get('locale_js_directory', 'languages')); + $dir = file_create_path(variable_get('locale_js_directory')); // Delete old file, if we have no translations anymore, or a different file to be saved. if (!empty($language->javascript) && (!$data || $language->javascript != $data_hash)) { Index: includes/mail.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/mail.inc,v retrieving revision 1.14 diff -u -p -r1.14 mail.inc --- includes/mail.inc 19 May 2008 19:25:24 -0000 1.14 +++ includes/mail.inc 25 Jul 2008 07:59:27 -0000 @@ -81,7 +81,7 @@ * accepted at php-level, which still doesn't guarantee it to be delivered.) */ function drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) { - $default_from = variable_get('site_mail', ini_get('sendmail_from')); + $default_from = variable_get('site_mail'); // Bundle up the variables into a structured array for altering. $message = array( @@ -172,8 +172,8 @@ function drupal_mail($module, $key, $to, */ function drupal_mail_send($message) { // Allow for a custom mail backend. - if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) { - include_once './' . variable_get('smtp_library', ''); + if (variable_get('smtp_library') && file_exists(variable_get('smtp_library'))) { + include_once './' . variable_get('smtp_library'); return drupal_mail_wrapper($message); } else { Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.282 diff -u -p -r1.282 menu.inc --- includes/menu.inc 10 Jul 2008 10:58:01 -0000 1.282 +++ includes/menu.inc 25 Jul 2008 07:57:30 -0000 @@ -256,7 +256,7 @@ function menu_get_ancestors($parts) { $ancestors = array(); $length = $number_parts - 1; $end = (1 << $number_parts) - 1; - $masks = variable_get('menu_masks', array()); + $masks = variable_get('menu_masks'); // Only examine patterns that actually exist as router items (the masks). foreach ($masks as $i) { if ($i > $end) { @@ -387,7 +387,7 @@ function menu_execute_active_handler($pa if (_menu_site_is_offline()) { return MENU_SITE_OFFLINE; } - if (variable_get('menu_rebuild_needed', FALSE)) { + if (variable_get('menu_rebuild_needed')) { menu_rebuild(); } if ($router_item = menu_get_item($path)) { @@ -950,7 +950,7 @@ function menu_tree_page_data($menu_name // Use array_values() so that the indices are numeric for array_merge(). $args = $parents = array_unique(array_values($parents)); $placeholders = implode(', ', array_fill(0, count($args), '%d')); - $expanded = variable_get('menu_expanded', array()); + $expanded = variable_get('menu_expanded'); // Check whether the current menu has any links set to be expanded. if (in_array($menu_name, $expanded)) { // Collect all the links set to be expanded, and then add all of @@ -1258,7 +1258,7 @@ function menu_list_system_menus() { * Return an array of links to be rendered as the Main menu. */ function menu_main_menu() { - return menu_navigation_links(variable_get('menu_main_menu_source', 'main-menu')); + return menu_navigation_links(variable_get('menu_main_menu_source')); } /** @@ -1268,11 +1268,11 @@ function menu_secondary_menu() { // If the secondary menu source is set as the primary menu, we display the // second level of the primary menu. - if (variable_get('menu_secondary_menu_source', 'secondary-menu') == variable_get('menu_main_menu_source', 'main-menu')) { - return menu_navigation_links(variable_get('menu_main_menu_source', 'main-menu'), 1); + if (variable_get('menu_secondary_menu_source') == variable_get('menu_main_menu_source')) { + return menu_navigation_links(variable_get('menu_main_menu_source'), 1); } else { - return menu_navigation_links(variable_get('menu_secondary_menu_source', 'secondary-menu'), 0); + return menu_navigation_links(variable_get('menu_secondary_menu_source'), 0); } } @@ -2436,7 +2436,7 @@ function menu_path_is_external($path) { */ function _menu_site_is_offline() { // Check if site is set to offline mode. - if (variable_get('site_offline', 0)) { + if (variable_get('site_offline')) { // Check if the user has administration privileges. if (user_access('administer site configuration')) { // Ensure that the offline message is displayed only once [allowing for Index: includes/password.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/password.inc,v retrieving revision 1.3 diff -u -p -r1.3 password.inc --- includes/password.inc 26 May 2008 17:12:54 -0000 1.3 +++ includes/password.inc 25 Jul 2008 08:11:25 -0000 @@ -15,13 +15,6 @@ */ /** - * 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); - -/** * The minimum allowed log2 number of iterations for password stretching. */ define('DRUPAL_MIN_HASH_COUNT', 7); @@ -180,7 +173,7 @@ function _password_get_count_log2($setti function user_hash_password($password, $count_log2 = 0) { if (empty($count_log2)) { // Use the standard iteration count. - $count_log2 = variable_get('password_count_log2', DRUPAL_HASH_COUNT); + $count_log2 = variable_get('password_count_log2'); } return _password_crypt($password, _password_generate_salt($count_log2)); } @@ -238,6 +231,6 @@ function user_needs_new_hash($account) { return TRUE; } // Check whether the iteration count used differs from the standard number. - return (_password_get_count_log2($account->pass) != variable_get('password_count_log2', DRUPAL_HASH_COUNT)); + return (_password_get_count_log2($account->pass) != variable_get('password_count_log2')); } Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.24 diff -u -p -r1.24 path.inc --- includes/path.inc 24 Jun 2008 22:12:15 -0000 1.24 +++ includes/path.inc 25 Jul 2008 05:34:12 -0000 @@ -18,7 +18,7 @@ function drupal_init_path() { $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/')); } else { - $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); + $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage')); } } @@ -218,7 +218,7 @@ function drupal_set_title($title = NULL) function drupal_is_front_page() { // As drupal_init_path updates $_GET['q'] with the 'site_frontpage' path, // we can check it against the 'site_frontpage' variable. - return $_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')); + return $_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage')); } /** @@ -236,7 +236,7 @@ function drupal_match_path($path, $patte static $regexps; if (!isset($regexps[$patterns])) { - $regexps[$patterns] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/'; + $regexps[$patterns] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/'; } return (bool)preg_match($regexps[$patterns], $path); } Index: includes/session.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/session.inc,v retrieving revision 1.49 diff -u -p -r1.49 session.inc --- includes/session.inc 11 Jul 2008 10:14:27 -0000 1.49 +++ includes/session.inc 25 Jul 2008 05:34:12 -0000 @@ -69,7 +69,7 @@ function sess_write($key, $value) { if (db_affected_rows()) { // Last access time is updated no more frequently than once every 180 seconds. // This reduces contention in the users table. - if ($user->uid && time() - $user->access > variable_get('session_write_interval', 180)) { + if ($user->uid && time() - $user->access > variable_get('session_write_interval')) { db_query("UPDATE {users} SET access = %d WHERE uid = %d", time(), $user->uid); } } Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.430 diff -u -p -r1.430 theme.inc --- includes/theme.inc 11 Jul 2008 02:23:08 -0000 1.430 +++ includes/theme.inc 25 Jul 2008 08:16:03 -0000 @@ -54,7 +54,7 @@ function init_theme() { // Only select the user selected theme if it is available in the // list of enabled themes. - $theme = !empty($user->theme) && !empty($themes[$user->theme]->status) ? $user->theme : variable_get('theme_default', 'garland'); + $theme = !empty($user->theme) && !empty($themes[$user->theme]->status) ? $user->theme : variable_get('theme_default'); // Allow modules to override the present theme... only select custom theme // if it is available in the list of installed themes. @@ -881,10 +881,10 @@ function theme_get_settings($key = NULL) $defaults['toggle_node_info_' . $type] = 1; } } - $settings = array_merge($defaults, variable_get('theme_settings', array())); + $settings = array_merge($defaults, variable_get('theme_settings')); if ($key) { - $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_' . $key . '_settings'), array())); + $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_settings_' . $key), array())); } // Only offer search box if search.module is enabled. @@ -922,7 +922,7 @@ function theme_get_setting($setting_name $theme_object = $themes[$theme_key]; if ($settings['mission'] == '') { - $settings['mission'] = variable_get('site_mission', ''); + $settings['mission'] = variable_get('site_mission'); } if (!$settings['toggle_mission']) { @@ -1651,7 +1651,7 @@ function theme_username($object) { $output .= ' (' . t('not verified') . ')'; } else { - $output = variable_get('anonymous', t('Anonymous')); + $output = variable_get('anonymous'); } return $output; @@ -1815,12 +1815,12 @@ function template_preprocess_page(&$vari // Construct page title if (drupal_get_title()) { - $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); + $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name')); } else { - $head_title = array(variable_get('site_name', 'Drupal')); - if (variable_get('site_slogan', '')) { - $head_title[] = variable_get('site_slogan', ''); + $head_title = array(variable_get('site_name')); + if (variable_get('site_slogan')) { + $head_title[] = variable_get('site_slogan'); } } $variables['head_title'] = implode(' | ', $head_title); @@ -1828,7 +1828,7 @@ function template_preprocess_page(&$vari $variables['front_page'] = url(); $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb()); $variables['feed_icons'] = drupal_get_feeds(); - $variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE)); + $variables['footer_message'] = filter_xss_admin(variable_get('site_footer')); $variables['head'] = drupal_get_html_head(); $variables['help'] = theme('help'); $variables['language'] = $GLOBALS['language']; @@ -1839,8 +1839,8 @@ function template_preprocess_page(&$vari $variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array(); $variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array(); $variables['search_box'] = (theme_get_setting('toggle_search') ? drupal_get_form('search_theme_form') : ''); - $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''); - $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''); + $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name') : ''); + $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan') : ''); $variables['css'] = drupal_add_css(); $variables['styles'] = drupal_get_css(); $variables['scripts'] = drupal_get_js(); Index: includes/theme.maintenance.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v retrieving revision 1.15 diff -u -p -r1.15 theme.maintenance.inc --- includes/theme.maintenance.inc 1 Jul 2008 20:36:40 -0000 1.15 +++ includes/theme.maintenance.inc 25 Jul 2008 05:34:13 -0000 @@ -43,7 +43,7 @@ function _drupal_maintenance_theme() { drupal_load('module', 'system'); drupal_load('module', 'filter'); - $theme = variable_get('maintenance_theme', 'minnelli'); + $theme = variable_get('maintenance_theme'); } $themes = list_themes(); @@ -231,12 +231,12 @@ function template_preprocess_maintenance // Construct page title if (drupal_get_title()) { - $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); + $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name')); } else { - $head_title = array(variable_get('site_name', 'Drupal')); - if (variable_get('site_slogan', '')) { - $head_title[] = variable_get('site_slogan', ''); + $head_title = array(variable_get('site_name')); + if (variable_get('site_slogan')) { + $head_title[] = variable_get('site_slogan'); } } $variables['head_title'] = implode(' | ', $head_title); @@ -244,7 +244,7 @@ function template_preprocess_maintenance $variables['front_page'] = url(); $variables['breadcrumb'] = ''; $variables['feed_icons'] = ''; - $variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE)); + $variables['footer_message'] = filter_xss_admin(variable_get('site_footer')); $variables['head'] = drupal_get_html_head(); $variables['help'] = ''; $variables['language'] = $GLOBALS['language']; @@ -255,8 +255,8 @@ function template_preprocess_maintenance $variables['main_menu'] = array(); $variables['secondary_menu'] = array(); $variables['search_box'] = ''; - $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''); - $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''); + $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name') : ''); + $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan') : ''); $variables['css'] = drupal_add_css(); $variables['styles'] = drupal_get_css(); $variables['scripts'] = drupal_get_js(); Index: modules/aggregator/aggregator.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.admin.inc,v retrieving revision 1.10 diff -u -p -r1.10 aggregator.admin.inc --- modules/aggregator/aggregator.admin.inc 15 May 2008 21:27:32 -0000 1.10 +++ modules/aggregator/aggregator.admin.inc 25 Jul 2008 05:34:20 -0000 @@ -236,24 +236,24 @@ function aggregator_admin_settings() { $form['aggregator_allowed_html_tags'] = array( '#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#size' => 80, '#maxlength' => 255, - '#default_value' => variable_get('aggregator_allowed_html_tags', '
      • '), + '#default_value' => variable_get('aggregator_allowed_html_tags'), '#description' => t('A space-separated list of HTML tags allowed in the content of feed items. (Tags in this list are not removed by Drupal.)'), ); $form['aggregator_summary_items'] = array( '#type' => 'select', '#title' => t('Items shown in sources and categories pages') , - '#default_value' => variable_get('aggregator_summary_items', 3), '#options' => $items, + '#default_value' => variable_get('aggregator_summary_items'), '#options' => $items, '#description' => t('Number of feed items displayed in feed and category summary pages.'), ); $form['aggregator_clear'] = array( '#type' => 'select', '#title' => t('Discard items older than'), - '#default_value' => variable_get('aggregator_clear', 9676800), '#options' => $period, + '#default_value' => variable_get('aggregator_clear'), '#options' => $period, '#description' => t('The length of time to retain feed items before discarding. (Requires a correctly configured cron maintenance task.)', array('@cron' => url('admin/reports/status'))), ); $form['aggregator_category_selector'] = array( - '#type' => 'radios', '#title' => t('Category selection type'), '#default_value' => variable_get('aggregator_category_selector', 'checkboxes'), + '#type' => 'radios', '#title' => t('Category selection type'), '#default_value' => variable_get('aggregator_category_selector'), '#options' => array('checkboxes' => t('checkboxes'), 'select' => t('multiple selector')), '#description' => t('The type of category selection widget displayed on categorization pages. (For a small number of categories, checkboxes are easier to use, while a multiple selector work well with large numbers of categories.)'), ); Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.382 diff -u -p -r1.382 aggregator.module --- modules/aggregator/aggregator.module 5 Jul 2008 05:57:00 -0000 1.382 +++ modules/aggregator/aggregator.module 25 Jul 2008 06:04:42 -0000 @@ -7,6 +7,20 @@ */ /** + * Implementation of hook_variables(). + */ +function aggregator_variables() { + return array( + 'aggregator_allowed_html_tags' => '
          • ', + 'aggregator_summary_items' => 3, + 'aggregator_clear' => 9676800, + 'aggregator_category_selector' => 'checkboxes', + 'feed_default_items' => 10, + 'feed_item_length' => 'teaser', + ); +} + +/** * Implementation of hook_help(). */ function aggregator_help($path, $arg) { @@ -787,7 +801,7 @@ function aggregator_parse_feed(&$data, $ } // Remove all items that are older than flush item timer. - $age = time() - variable_get('aggregator_clear', 9676800); + $age = time() - variable_get('aggregator_clear'); $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age); $items = array(); @@ -899,7 +913,7 @@ function theme_aggregator_block_item($it * The filtered content. */ function aggregator_filter_xss($value) { - return filter_xss($value, preg_split('/\s+|<|>/', variable_get('aggregator_allowed_html_tags', '
              • '), -1, PREG_SPLIT_NO_EMPTY)); + return filter_xss($value, preg_split('/\s+|<|>/', variable_get('aggregator_allowed_html_tags'), -1, PREG_SPLIT_NO_EMPTY)); } /** Index: modules/aggregator/aggregator.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.pages.inc,v retrieving revision 1.15 diff -u -p -r1.15 aggregator.pages.inc --- modules/aggregator/aggregator.pages.inc 16 Jul 2008 21:59:25 -0000 1.15 +++ modules/aggregator/aggregator.pages.inc 25 Jul 2008 05:34:21 -0000 @@ -13,7 +13,7 @@ * The items HTML. */ function aggregator_page_last() { - drupal_add_feed(url('aggregator/rss'), variable_get('site_name', 'Drupal') . ' ' . t('aggregator')); + drupal_add_feed(url('aggregator/rss'), variable_get('site_name') . ' ' . t('aggregator')); $items = aggregator_feed_items_load('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC'); @@ -65,7 +65,7 @@ function aggregator_page_category($arg1, // $form_state and $arg2 is $category. Otherwise, $arg1 is $category. $category = is_array($arg2) ? $arg2 : $arg1; - drupal_add_feed(url('aggregator/rss/' . $category['cid']), variable_get('site_name', 'Drupal') . ' ' . t('aggregator - @title', array('@title' => $category['title']))); + drupal_add_feed(url('aggregator/rss/' . $category['cid']), variable_get('site_name') . ' ' . t('aggregator - @title', array('@title' => $category['title']))); // It is safe to include the cid in the query because it's loaded from the // database by aggregator_category_load. @@ -171,7 +171,7 @@ function aggregator_categorize_items($it } $done = TRUE; $form['categories'][$item->iid] = array( - '#type' => variable_get('aggregator_category_selector', 'checkboxes'), + '#type' => variable_get('aggregator_category_selector'), '#default_value' => $selected, '#options' => $categories, '#size' => 10, @@ -269,7 +269,7 @@ function template_preprocess_aggregator_ $variables['source_date'] = t('%ago ago', array('%ago' => format_interval(time() - $item->timestamp))); } else { - $variables['source_date'] = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, m/d/Y - H:i')); + $variables['source_date'] = format_date($item->timestamp, 'custom', variable_get('date_format_medium')); } $variables['categories'] = array(); @@ -288,8 +288,8 @@ function aggregator_page_sources() { while ($feed = db_fetch_object($result)) { // Most recent items: $summary_items = array(); - if (variable_get('aggregator_summary_items', 3)) { - $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = %d ORDER BY i.timestamp DESC', $feed->fid, 0, variable_get('aggregator_summary_items', 3)); + if (variable_get('aggregator_summary_items')) { + $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = %d ORDER BY i.timestamp DESC', $feed->fid, 0, variable_get('aggregator_summary_items')); while ($item = db_fetch_object($items)) { $summary_items[] = theme('aggregator_summary_item', $item); } @@ -310,9 +310,9 @@ function aggregator_page_categories() { $output = ''; while ($category = db_fetch_object($result)) { - if (variable_get('aggregator_summary_items', 3)) { + if (variable_get('aggregator_summary_items')) { $summary_items = array(); - $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 0, variable_get('aggregator_summary_items', 3)); + $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 0, variable_get('aggregator_summary_items')); while ($item = db_fetch_object($items)) { $summary_items[] = theme('aggregator_summary_item', $item); } @@ -333,13 +333,13 @@ function aggregator_page_rss() { if (arg(2)) { $category = db_fetch_object(db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = %d', arg(2))); $sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = %d ORDER BY timestamp DESC, i.iid DESC'; - $result = db_query_range($sql, $category->cid, 0, variable_get('feed_default_items', 10)); + $result = db_query_range($sql, $category->cid, 0, variable_get('feed_default_items')); } // Or, get the default aggregator items. else { $category = NULL; $sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC'; - $result = db_query_range($sql, 0, variable_get('feed_default_items', 10)); + $result = db_query_range($sql, 0, variable_get('feed_default_items')); } $feeds = array(); @@ -363,7 +363,7 @@ function theme_aggregator_page_rss($feed drupal_set_header('Content-Type: application/rss+xml; charset=utf-8'); $items = ''; - $feed_length = variable_get('feed_item_length', 'teaser'); + $feed_length = variable_get('feed_item_length'); foreach ($feeds as $feed) { switch ($feed_length) { case 'teaser': @@ -380,7 +380,7 @@ function theme_aggregator_page_rss($feed $items .= format_rss_item($feed->ftitle . ': ' . $feed->title, $feed->link, $feed->description, array('pubDate' => date('r', $feed->timestamp))); } - $site_name = variable_get('site_name', 'Drupal'); + $site_name = variable_get('site_name'); $url = url((isset($category) ? 'aggregator/categories/' . $category->cid : 'aggregator'), array('absolute' => TRUE)); $description = isset($category) ? t('@site_name - aggregated feeds in category @title', array('@site_name' => $site_name, '@title' => $category->title)) : t('@site_name - aggregated feeds', array('@site_name' => $site_name)); @@ -429,7 +429,7 @@ function theme_aggregator_page_opml($fee $output = "\n"; $output .= "\n"; $output .= "\n"; - $output .= '' . check_plain(variable_get('site_name', 'Drupal')) . "\n"; + $output .= '' . check_plain(variable_get('site_name')) . "\n"; $output .= '' . gmdate('r') . "\n"; $output .= "\n"; $output .= "\n"; Index: modules/aggregator/aggregator.test =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.test,v retrieving revision 1.3 diff -u -p -r1.3 aggregator.test --- modules/aggregator/aggregator.test 30 May 2008 07:30:49 -0000 1.3 +++ modules/aggregator/aggregator.test 25 Jul 2008 05:34:21 -0000 @@ -65,7 +65,7 @@ class AggregatorTestCase extends DrupalW $this->assertResponse(200, t('rss.xml is reachable.')); // Our tests are based off of rss.xml, so let's find out how many elements should be related. - $feed_count = db_result(db_query_range(db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE n.promote = 1 AND n.status = 1'), 0, variable_get('feed_default_items', 10))); + $feed_count = db_result(db_query_range(db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE n.promote = 1 AND n.status = 1'), 0, variable_get('feed_default_items'))); $feed_count = $feed_count > 10 ? 10 : $feed_count; // Refresh the feed (simulated link click). Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.19 diff -u -p -r1.19 block.admin.inc --- modules/block/block.admin.inc 16 Jul 2008 21:59:25 -0000 1.19 +++ modules/block/block.admin.inc 25 Jul 2008 05:34:21 -0000 @@ -13,7 +13,7 @@ function block_admin_display($theme = NU global $custom_theme; // If non-default theme configuration has been selected, set the custom theme. - $custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland'); + $custom_theme = isset($theme) ? $theme : variable_get('theme_default'); // Fetch and sort blocks. $blocks = _block_rehash(); @@ -31,7 +31,7 @@ function block_admin_display_form(&$form drupal_add_css(drupal_get_path('module', 'block') . '/block.css', 'module', 'all', FALSE); // If non-default theme configuration has been selected, set the custom theme. - $custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland'); + $custom_theme = isset($theme) ? $theme : variable_get('theme_default'); init_theme(); $block_regions = system_region_list($theme_key) + array(BLOCK_REGION_NONE => '<' . t('none') . '>'); Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.308 diff -u -p -r1.308 block.module --- modules/block/block.module 17 Jul 2008 21:10:39 -0000 1.308 +++ modules/block/block.module 25 Jul 2008 06:07:09 -0000 @@ -61,6 +61,15 @@ define('BLOCK_CACHE_PER_PAGE', 0x0004); define('BLOCK_CACHE_GLOBAL', 0x0008); /** + * Implementation of hook_variables(). + */ +function block_variables() { + return array( + 'block_cache' => CACHE_DISABLED, + ); +} + +/** * Implementation of hook_help(). */ function block_help($path, $arg) { @@ -152,7 +161,7 @@ function block_menu() { 'access arguments' => array('administer blocks'), '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' => check_plain($theme->info['name']), @@ -170,7 +179,7 @@ function block_menu() { * Menu item access callback - only admin or enabled themes can be accessed. */ function _block_themes_access($theme) { - return user_access('administer blocks') && ($theme->status || $theme->name == variable_get('admin_theme', '0')); + return user_access('administer blocks') && ($theme->status || $theme->name == variable_get('admin_theme')); } /** @@ -533,7 +542,7 @@ function _block_get_cache_id($block) { // it brings too many chances of having unwanted output get in the cache // and later be served to other users. We therefore exclude user 1 from // block caching. - if (variable_get('block_cache', 0) && $block->cache != BLOCK_NO_CACHE && $user->uid != 1) { + if (variable_get('block_cache') && $block->cache != BLOCK_NO_CACHE && $user->uid != 1) { $cid_parts = array(); // Start with common sub-patterns: block identification, theme, language. Index: modules/blog/blog.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v retrieving revision 1.10 diff -u -p -r1.10 blog.pages.inc --- modules/blog/blog.pages.inc 22 May 2008 19:27:13 -0000 1.10 +++ modules/blog/blog.pages.inc 25 Jul 2008 05:34:22 -0000 @@ -25,7 +25,7 @@ function blog_page_user($account) { $output = theme('item_list', $items); - $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid); + $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main'), 0, NULL, $account->uid); $has_posts = FALSE; while ($node = db_fetch_object($result)) { @@ -34,7 +34,7 @@ function blog_page_user($account) { } if ($has_posts) { - $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); + $output .= theme('pager', NULL, variable_get('default_nodes_main')); } else { if ($account->uid == $user->uid) { @@ -64,7 +64,7 @@ function blog_page_last() { $output = theme('item_list', $items); - $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' 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.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main')); $has_posts = FALSE; while ($node = db_fetch_object($result)) { @@ -73,7 +73,7 @@ function blog_page_last() { } if ($has_posts) { - $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); + $output .= theme('pager', NULL, variable_get('default_nodes_main')); } else { drupal_set_message(t('No blog entries have been created.')); @@ -87,7 +87,7 @@ function blog_page_last() { * Menu callback; displays an RSS feed containing recent blog entries of a given user. */ function blog_feed_user($account) { - $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10)); + $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items')); $channel['title'] = $account->name . "'s blog"; $channel['link'] = url('blog/' . $account->uid, array('absolute' => TRUE)); @@ -102,8 +102,8 @@ function blog_feed_user($account) { * Menu callback; displays an RSS feed containing recent blog entries of all users. */ function blog_feed_last() { - $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10)); - $channel['title'] = variable_get('site_name', 'Drupal') . ' blogs'; + $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items')); + $channel['title'] = variable_get('site_name') . ' blogs'; $channel['link'] = url('blog', array('absolute' => TRUE)); $items = array(); Index: modules/blogapi/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v retrieving revision 1.120 diff -u -p -r1.120 blogapi.module --- modules/blogapi/blogapi.module 23 Jul 2008 07:42:08 -0000 1.120 +++ modules/blogapi/blogapi.module 25 Jul 2008 07:59:50 -0000 @@ -7,6 +7,18 @@ */ /** + * Implementation of hook_variables(). + */ +function blogapi_variables() { + return array( + 'blogapi_node_types' => array( + '#type' => 'callback', + '#value' => 'blogapi_node_types_default', + ), + ); +} + +/** * Implementation of hook_help(). */ function blogapi_help($path, $arg) { @@ -193,7 +205,7 @@ function blogapi_blogger_new_post($appke $edit = array(); $edit['type'] = $blogid; // Get the node type defaults. - $node_type_default = variable_get('node_options_' . $edit['type'], array('status', 'promote')); + $node_type_default = variable_get('node_options_' . $edit['type'], array('status')); $edit['uid'] = $user->uid; $edit['name'] = $user->name; $edit['promote'] = in_array('promote', $node_type_default); @@ -564,16 +576,22 @@ function blogapi_blogger_title(&$content } /** + * Returns the default value for the node types listing. + */ +function blogapi_node_types_default() { + $node_types = array_map('check_plain', node_get_types('names')); + return isset($node_types['blog']) ? array('blog' => 1) : array(); +} + +/** * Add some settings to the admin_settings form. */ function blogapi_admin_settings() { - $node_types = array_map('check_plain', node_get_types('names')); - $defaults = isset($node_types['blog']) ? array('blog' => 1) : array(); $form['blogapi_node_types'] = array( '#type' => 'checkboxes', '#title' => t('Enable for external blogging clients'), '#required' => TRUE, - '#default_value' => variable_get('blogapi_node_types', $defaults), + '#default_value' => variable_get('blogapi_node_types'), '#options' => $node_types, '#description' => t('Select the content types available to external blogging clients via Blog API. If supported, each enabled content type will be displayed as a separate "blog" by the external client.') ); @@ -730,7 +748,7 @@ function _blogapi_validate_blogid($blogi } function _blogapi_get_node_types() { - $available_types = array_keys(array_filter(variable_get('blogapi_node_types', array('blog' => 1)))); + $available_types = array_keys(array_filter(variable_get('blogapi_node_types'))); $types = array(); foreach (node_get_types() as $type => $name) { if (node_access('create', $type) && in_array($type, $available_types)) { Index: modules/book/book.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.admin.inc,v retrieving revision 1.12 diff -u -p -r1.12 book.admin.inc --- modules/book/book.admin.inc 5 Jul 2008 06:00:51 -0000 1.12 +++ modules/book/book.admin.inc 25 Jul 2008 08:19:51 -0000 @@ -31,7 +31,7 @@ function book_admin_settings() { $form['book_allowed_types'] = array( '#type' => 'checkboxes', '#title' => t('Allowed book outline types'), - '#default_value' => variable_get('book_allowed_types', array('book')), + '#default_value' => variable_get('book_allowed_types'), '#options' => $types, '#description' => t('Select content types which users with the %add-perm permission will be allowed to add to the book hierarchy. Users with the %outline-perm permission can add all content types.', array('%add-perm' => t('add content to books'), '%outline-perm' => t('administer book outlines'))), '#required' => TRUE, @@ -39,7 +39,7 @@ function book_admin_settings() { $form['book_child_type'] = array( '#type' => 'radios', '#title' => t('Default child page type'), - '#default_value' => variable_get('book_child_type', 'book'), + '#default_value' => variable_get('book_child_type'), '#options' => $types, '#description' => t('The content type for the %add-child link must be one of those selected as an allowed book outline type.', array('%add-child' => t('Add child page'))), '#required' => TRUE, Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.467 diff -u -p -r1.467 book.module --- modules/book/book.module 16 Jul 2008 21:59:26 -0000 1.467 +++ modules/book/book.module 25 Jul 2008 08:00:20 -0000 @@ -5,6 +5,20 @@ * @file * Allows users to structure the pages of a site in a hierarchy or outline. */ + +/** + * Implementation of hook_variables(). + */ +function book_variables() { + return array( + 'book_allowed_types' => array( + '#type' => 'value', + '#value' => array('book'), + ), + 'book_child_type' => 'book', + 'book_block_mode' => 'all pages', + ); +} /** * Implementation of hook_theme(). @@ -56,7 +70,7 @@ function book_link($type, $node = NULL, if ($type == 'node' && isset($node->book)) { if (!$teaser) { - $child_type = variable_get('book_child_type', 'book'); + $child_type = variable_get('book_child_type'); if ((user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && $node->book['depth'] < MENU_MAX_DEPTH) { $links['book_add_child'] = array( 'title' => t('Add child page'), @@ -188,7 +202,7 @@ function book_block($op = 'list', $delta $current_bid = empty($node->book['bid']) ? 0 : $node->book['bid']; } - if (variable_get('book_block_mode', 'all pages') == 'all pages') { + if (variable_get('book_block_mode') == 'all pages') { $block['subject'] = t('Book navigation'); $book_menus = array(); $pseudo_tree = array(0 => array('below' => FALSE)); @@ -232,7 +246,7 @@ function book_block($op = 'list', $delta '#type' => 'radios', '#title' => t('Book navigation block display'), '#options' => $options, - '#default_value' => variable_get('book_block_mode', 'all pages'), + '#default_value' => variable_get('book_block_mode'), '#description' => t("If Show block on all pages is selected, the block will contain the automatically generated menus for all of the site's books. If Show block only on book pages is selected, the block will contain only the one menu corresponding to the current page's book. In this case, if the current page is not in a book, no block will be displayed. The Page specific visibility settings or other visibility settings can be used in addition to selectively display this block."), ); @@ -332,7 +346,7 @@ function book_form_alter(&$form, $form_s * form element. */ function _book_parent_select($book_link) { - if (variable_get('menu_override_parent_selector', FALSE)) { + if (variable_get('menu_override_parent_selector')) { return array(); } // Offer a message or a drop-down to choose a different parent page. @@ -999,7 +1013,7 @@ function template_preprocess_book_node_e * Determine if a given node type is in the list of types allowed for books. */ function book_type_is_allowed($type) { - return in_array($type, variable_get('book_allowed_types', array('book'))); + return in_array($type, variable_get('book_allowed_types')); } /** @@ -1013,7 +1027,7 @@ function book_node_type($op, $type) { case 'update': if (!empty($type->old_type) && $type->old_type != $type->type) { // Update the list of node types that are allowed to be added to books. - $allowed_types = variable_get('book_allowed_types', array('book')); + $allowed_types = variable_get('book_allowed_types'); $key = array_search($type->old_type, $allowed_types); if ($key !== FALSE) { @@ -1023,7 +1037,7 @@ function book_node_type($op, $type) { } // Update the setting for the "Add child page" link. - if (variable_get('book_child_type', 'book') == $type->old_type) { + if (variable_get('book_child_type') == $type->old_type) { variable_set('book_child_type', $type->type); } } Index: modules/color/color.module =================================================================== RCS file: /cvs/drupal/drupal/modules/color/color.module,v retrieving revision 1.42 diff -u -p -r1.42 color.module --- modules/color/color.module 16 Jul 2008 21:59:26 -0000 1.42 +++ modules/color/color.module 25 Jul 2008 08:01:13 -0000 @@ -2,6 +2,28 @@ // $Id: color.module,v 1.42 2008/07/16 21:59:26 dries Exp $ /** + * Implementation of hook_variables(). + */ +function color_variables() { + return array( + 'color_screenshot' => NULL, + 'color_stylesheets' => array( + '#type' => 'value', + '#value' => array(), + ), + 'color_logo' => NULL, + 'color_palette' => array( + '#type' => 'value', + '#value' => array(), + ), + 'color_files' => array( + '#type' => 'value', + '#value' => array(), + ), + ); +} + +/** * Implementation of hook_help(). */ function color_help($path, $arg) { @@ -33,7 +55,7 @@ function color_theme() { function color_form_alter(&$form, $form_state, $form_id) { // Insert the color changer into the theme settings page. if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && function_exists('gd_info')) { - if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) != FILE_DOWNLOADS_PUBLIC) { + if (variable_get('file_downloads') != FILE_DOWNLOADS_PUBLIC) { // Disables the color changer when the private download method is used. // TODO: This should be solved in a different way. See issue #181003. drupal_set_message(t('The color picker only works if the download method is set to public.', array('@url' => url('admin/settings/file-system'))), 'warning'); @@ -55,7 +77,7 @@ function color_form_alter(&$form, $form_ 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('color_screenshot_' . $theme)) { if (isset($form[$theme]['screenshot'])) { $form[$theme]['screenshot']['#markup'] = theme('image', $screenshot, '', '', array('class' => 'screenshot'), FALSE); } @@ -71,7 +93,7 @@ function _color_page_alter(&$vars) { global $language, $theme_key; // Override stylesheets. - $color_paths = variable_get('color_' . $theme_key . '_stylesheets', array()); + $color_paths = variable_get('color_stylesheets_' . $theme_key); if (!empty($color_paths)) { // Loop over theme CSS files and try to rebuild CSS array with rewritten // stylesheets. Keep the orginal order intact for CSS cascading. @@ -111,7 +133,7 @@ function _color_page_alter(&$vars) { } // Override logo. - $logo = variable_get('color_' . $theme_key . '_logo', NULL); + $logo = variable_get('color_logo_' . $theme_key); if ($logo && $vars['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $vars['logo'])) { $vars['logo'] = base_path() . $logo; } @@ -142,7 +164,7 @@ function color_get_palette($theme, $defa } // Load variable. - return $default ? $palette : variable_get('color_' . $theme . '_palette', $palette); + return $default ? $palette : variable_get('color_palette_' . $theme); } /** @@ -164,7 +186,7 @@ function color_scheme_form(&$form_state, )), 'setting'); // See if we're using a predefined scheme. - $current = implode(',', variable_get('color_' . $theme . '_palette', array())); + $current = implode(',', variable_get('color_palette_' . $theme)); // Note: we use the original theme when the default scheme is chosen. $current = isset($info['schemes'][$current]) ? $current : ($current == '' ? reset($info['schemes']) : ''); @@ -270,7 +292,7 @@ function color_scheme_form_submit($form, } // Delete old files. - foreach (variable_get('color_' . $theme . '_files', array()) as $file) { + foreach (variable_get('color_files_' . $theme) as $file) { @unlink($file); } if (isset($file) && $file = dirname($file)) { Index: modules/comment/comment.install =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v retrieving revision 1.23 diff -u -p -r1.23 comment.install --- modules/comment/comment.install 3 Jul 2008 17:57:03 -0000 1.23 +++ modules/comment/comment.install 25 Jul 2008 05:34:25 -0000 @@ -17,7 +17,7 @@ function comment_update_1() { db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', time(), time()); // Unstuck node indexing timestamp if needed. - if (($last = variable_get('node_cron_last', FALSE)) !== FALSE) { + if (($last = variable_get('node_cron_last')) !== FALSE) { variable_set('node_cron_last', min(time(), $last)); } Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.643 diff -u -p -r1.643 comment.module --- modules/comment/comment.module 16 Jul 2008 21:59:26 -0000 1.643 +++ modules/comment/comment.module 25 Jul 2008 08:02:02 -0000 @@ -91,6 +91,17 @@ define('COMMENT_PREVIEW_OPTIONAL', 0); define('COMMENT_PREVIEW_REQUIRED', 1); /** + * Implementation of hook_variables(). + */ +function comment_variables() { + return array( + 'comment_block_count' => 10, + 'comment' => COMMENT_NODE_READ_WRITE, + 'node_cron_comments_scale' => 0, + ); +} + +/** * Implementation of hook_help(). */ function comment_help($path, $arg) { @@ -264,7 +275,7 @@ function comment_block($op = 'list', $de $form['comment_block_count'] = array( '#type' => 'select', '#title' => t('Number of recent comments'), - '#default_value' => variable_get('comment_block_count', 10), + '#default_value' => variable_get('comment_block_count'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30)), '#description' => t('Number of comments displayed in the Recent comments block.'), ); @@ -376,7 +387,7 @@ function comment_new_page_count($num_com */ function theme_comment_block() { $items = array(); - $number = variable_get('comment_block_count', 10); + $number = variable_get('comment_block_count'); foreach (comment_get_recent($number) as $comment) { $items[] = l($comment->subject, 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)) . '
                ' . t('@time ago', array('@time' => format_interval(time() - $comment->timestamp))); } @@ -566,7 +577,7 @@ function comment_nodeapi(&$node, $op, $a case 'prepare': if (!isset($node->comment)) { - $node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE); + $node->comment = variable_get("comment_$node->type"); } break; @@ -1281,7 +1292,7 @@ function comment_form(&$form_state, $edi '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, - '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')), + '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous'), ); $form['mail'] = array( '#type' => 'textfield', @@ -1304,7 +1315,7 @@ function comment_form(&$form_state, $edi '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, - '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')), + '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous'), '#required' => TRUE, ); $form['mail'] = array( @@ -1444,7 +1455,7 @@ function comment_form_add_preview($form, $comment->name = check_plain($account->name); } elseif (empty($comment->name)) { - $comment->name = variable_get('anonymous', t('Anonymous')); + $comment->name = variable_get('anonymous'); } $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : time(); @@ -1708,7 +1719,7 @@ function theme_comment_post_forbidden($n $destination = 'destination=' . drupal_urlencode("node/$node->nid#comment-form"); } - if (variable_get('user_register', 1)) { + if (variable_get('user_register')) { // Users can register themselves. return t('Login or register to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))); } @@ -1993,7 +2004,7 @@ function comment_ranking() { 'join' => 'LEFT JOIN {node_comment_statistics} node_comment_statistics ON node_comment_statistics.nid = i.sid', // Inverse law that maps the highest reply count on the site to 1 and 0 to 0. 'score' => '2.0 - 2.0 / (1.0 + node_comment_statistics.comment_count * %f)', - 'arguments' => array(variable_get('node_cron_comments_scale', 0)), + 'arguments' => array(variable_get('node_cron_comments_scale')), ), ); } Index: modules/contact/contact.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.admin.inc,v retrieving revision 1.5 diff -u -p -r1.5 contact.admin.inc --- modules/contact/contact.admin.inc 2 Jul 2008 20:05:11 -0000 1.5 +++ modules/contact/contact.admin.inc 25 Jul 2008 08:20:21 -0000 @@ -146,19 +146,19 @@ function contact_admin_delete_submit($fo function contact_admin_settings() { $form['contact_form_information'] = array('#type' => 'textarea', '#title' => t('Additional information'), - '#default_value' => variable_get('contact_form_information', t('You can leave a message using the contact form below.')), + '#default_value' => variable_get('contact_form_information'), '#description' => t('Information to show on the contact page. Can be anything from submission guidelines to your postal address or telephone number.', array('@form' => url('contact'))), ); $form['contact_hourly_threshold'] = array('#type' => 'select', '#title' => t('Hourly threshold'), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50)), - '#default_value' => variable_get('contact_hourly_threshold', 3), + '#default_value' => variable_get('contact_hourly_threshold'), '#description' => t('The maximum number of contact form submissions a user can perform per hour.'), ); $form['contact_default_status'] = array( '#type' => 'checkbox', '#title' => t('Enable personal contact form by default'), - '#default_value' => variable_get('contact_default_status', 1), + '#default_value' => variable_get('contact_default_status'), '#description' => t('Default status of the personal contact form for new users.'), ); return system_settings_form($form); Index: modules/contact/contact.module =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v retrieving revision 1.108 diff -u -p -r1.108 contact.module --- modules/contact/contact.module 24 Jul 2008 16:25:17 -0000 1.108 +++ modules/contact/contact.module 25 Jul 2008 06:26:56 -0000 @@ -7,6 +7,17 @@ */ /** + * Implementation of hook_variables(). + */ +function contact_variables() { + return array( + 'contact_form_information' => 'You can leave a message using the contact form below.', + 'contact_hourly_threshold' => 3, + 'contact_default_status' => 1, + ); +} + +/** * Implementation of hook_help(). */ function contact_help($path, $arg) { @@ -152,7 +163,7 @@ function contact_user($type, &$edit, &$u return array('contact' => isset($edit['contact']) ? $edit['contact'] : FALSE); } elseif ($type == 'insert') { - $edit['contact'] = variable_get('contact_default_status', 1); + $edit['contact'] = variable_get('contact_default_status'); } } @@ -178,9 +189,9 @@ function contact_mail($key, &$message, $ case 'user_copy': $user = $params['user']; $account = $params['account']; - $message['subject'] .= '[' . variable_get('site_name', 'Drupal') . '] ' . $params['subject']; + $message['subject'] .= '[' . variable_get('site_name') . '] ' . $params['subject']; $message['body'][] = "$account->name,"; - $message['body'][] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", array('absolute' => TRUE, 'language' => $language)), '!form-url' => url($_GET['q'], array('absolute' => TRUE, 'language' => $language)), '!site' => variable_get('site_name', 'Drupal')), $language->language); + $message['body'][] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", array('absolute' => TRUE, 'language' => $language)), '!form-url' => url($_GET['q'], array('absolute' => TRUE, 'language' => $language)), '!site' => variable_get('site_name')), $language->language); $message['body'][] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE, 'language' => $language))), $language->language); $message['body'][] = t('Message:', NULL, $language->language); $message['body'][] = $params['message']; Index: modules/contact/contact.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v retrieving revision 1.11 diff -u -p -r1.11 contact.pages.inc --- modules/contact/contact.pages.inc 16 Jul 2008 21:59:26 -0000 1.11 +++ modules/contact/contact.pages.inc 25 Jul 2008 08:18:40 -0000 @@ -13,8 +13,8 @@ function contact_site_page() { global $user; - if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3)) && !user_access('administer site-wide contact form')) { - $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); + if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold')) && !user_access('administer site-wide contact form')) { + $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold'))); } else { $output = drupal_get_form('contact_mail_page'); @@ -38,7 +38,7 @@ function contact_mail_page() { if (count($categories) > 0) { $form['#token'] = $user->uid ? $user->name . $user->mail : ''; - $form['contact_information'] = array('#markup' => filter_xss_admin(variable_get('contact_form_information', t('You can leave a message using the contact form below.')))); + $form['contact_information'] = array('#markup' => filter_xss_admin(variable_get('contact_form_information'))); $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 255, @@ -160,8 +160,8 @@ function contact_user_page($account) { if (!valid_email_address($user->mail)) { $output = t('You need to provide a valid e-mail address to contact other users. Please update your user information and try again.', array('@url' => url("user/$user->uid/edit", array('query' => 'destination=' . drupal_get_destination())))); } - else if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3)) && !user_access('administer site-wide contact form')) { - $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); + else if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold')) && !user_access('administer site-wide contact form')) { + $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold'))); } else { drupal_set_title(check_plain($account->name)); Index: modules/dblog/dblog.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.admin.inc,v retrieving revision 1.8 diff -u -p -r1.8 dblog.admin.inc --- modules/dblog/dblog.admin.inc 19 Jul 2008 07:44:45 -0000 1.8 +++ modules/dblog/dblog.admin.inc 25 Jul 2008 05:34:26 -0000 @@ -16,7 +16,7 @@ function dblog_admin_settings() { $form['dblog_row_limit'] = array( '#type' => 'select', '#title' => t('Discard log entries above the following row limit'), - '#default_value' => variable_get('dblog_row_limit', 1000), + '#default_value' => variable_get('dblog_row_limit'), '#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 a correctly configured cron maintenance task.)', array('@cron' => url('admin/reports/status'))) ); Index: modules/dblog/dblog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v retrieving revision 1.26 diff -u -p -r1.26 dblog.module --- modules/dblog/dblog.module 24 Jul 2008 16:25:17 -0000 1.26 +++ modules/dblog/dblog.module 25 Jul 2008 06:27:39 -0000 @@ -13,6 +13,15 @@ */ /** + * Implementation of hook_variables(). + */ +function dblog_variables() { + return array( + 'dblog_row_limit' => 1000, + ); +} + +/** * Implementation of hook_help(). */ function dblog_help($path, $arg) { @@ -97,7 +106,7 @@ function dblog_init() { function dblog_cron() { // Cleanup the watchdog table $max = db_result(db_query('SELECT MAX(wid) FROM {watchdog}')); - db_query('DELETE FROM {watchdog} WHERE wid <= %d', $max - variable_get('dblog_row_limit', 1000)); + db_query('DELETE FROM {watchdog} WHERE wid <= %d', $max - variable_get('dblog_row_limit')); } /** Index: modules/dblog/dblog.test =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.test,v retrieving revision 1.5 diff -u -p -r1.5 dblog.test --- modules/dblog/dblog.test 30 May 2008 07:30:50 -0000 1.5 +++ modules/dblog/dblog.test 25 Jul 2008 05:34:27 -0000 @@ -57,7 +57,7 @@ class DBLogTestCase extends DrupalWebTes $this->assertResponse(200); // Check row limit variable. - $current_limit = variable_get('dblog_row_limit', 1000); + $current_limit = variable_get('dblog_row_limit'); $this->assertTrue($current_limit == $row_limit, t('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit))); // Verify dblog row limit equals specified row limit. $current_limit = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = '%s'", 'dblog_row_limit'))); Index: modules/filter/filter.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v retrieving revision 1.13 diff -u -p -r1.13 filter.admin.inc --- modules/filter/filter.admin.inc 24 Jul 2008 16:27:51 -0000 1.13 +++ modules/filter/filter.admin.inc 25 Jul 2008 05:34:27 -0000 @@ -28,7 +28,7 @@ function filter_admin_overview() { $roles[] = $name; } } - $default = ($id == variable_get('filter_default_format', 1)); + $default = ($id == variable_get('filter_default_format')); $options[$id] = ''; $form[$id]['name'] = array('#markup' => $format->name); $form[$id]['roles'] = array('#markup' => $default ? t('All roles may use default format') : ($roles ? implode(', ', $roles) : t('No roles may use this format'))); @@ -36,7 +36,7 @@ function filter_admin_overview() { $form[$id]['delete'] = array('#markup' => $default ? '' : l(t('delete'), 'admin/settings/filters/delete/' . $id)); $form[$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight); } - $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('Save changes')); return $form; } @@ -108,7 +108,7 @@ function filter_admin_format_page($forma * @see filter_admin_format_form_submit() */ function filter_admin_format_form(&$form_state, $format) { - $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); @@ -261,7 +261,7 @@ function filter_admin_delete() { $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); @@ -284,7 +284,7 @@ function filter_admin_delete_submit($for db_query("DELETE FROM {filter_formats} WHERE format = %d", $form_state['values']['format']); db_query("DELETE FROM {filters} WHERE format = %d", $form_state['values']['format']); - $default = variable_get('filter_default_format', 1); + $default = variable_get('filter_default_format'); // Replace existing instances of the deleted format with the default format. db_query("UPDATE {node_revisions} SET format = %d WHERE format = %d", $default, $form_state['values']['format']); db_query("UPDATE {comments} SET format = %d WHERE format = %d", $default, $form_state['values']['format']); Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.217 diff -u -p -r1.217 filter.module --- modules/filter/filter.module 24 Jul 2008 16:25:17 -0000 1.217 +++ modules/filter/filter.module 25 Jul 2008 08:30:16 -0000 @@ -15,6 +15,22 @@ define('FILTER_FORMAT_DEFAULT', 0); /** + * Implementation of hook_variables(). + */ +function filter_variables() { + return array( + 'filter_default_format' => 1, + 'allowed_html' => '
                  1. ', + 'filter_html_help' => 1, + 'filter_html_nofollow' => FALSE, + 'filter_allowed_protocols' => array( + '#type' => 'value', + '#value' => array('ftp', 'http', 'https', 'irc', 'mailto', 'news', 'nntp', 'rtsp', 'sftp', 'ssh', 'telnet', 'webcal'), + ), + ); +} + +/** * Implementation of hook_help(). */ function filter_help($path, $arg) { @@ -166,20 +182,20 @@ function filter_filter_tips($delta, $for global $base_url; switch ($delta) { case 0: - if ($allowed_html = variable_get("allowed_html_$format", '
                      1. ')) { + if ($allowed_html = variable_get("allowed_html_$format")) { switch ($long) { case 0: return t('Allowed HTML tags: @tags', array('@tags' => $allowed_html)); case 1: $output = '

                        ' . t('Allowed HTML tags: @tags', array('@tags' => $allowed_html)) . '

                        '; - if (!variable_get("filter_html_help_$format", 1)) { + if (!variable_get("filter_html_help_$format")) { return $output; } $output .= '

                        ' . t('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.') . '

                        '; $output .= '

                        ' . t('For more information see W3C\'s HTML Specifications or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/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') . ''), @@ -303,7 +319,7 @@ function filter_formats($index = NULL) { $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 . ' ORDER by weight', $args); @@ -348,7 +364,7 @@ function _filter_list_cmp($a, $b) { * 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. @@ -505,7 +521,7 @@ function filter_form($value = FILTER_FOR // 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'), '#markup' => theme('filter_tips', $tips, FALSE, $extra), @@ -530,7 +546,7 @@ function filter_form_validate($form) { */ 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 { @@ -660,7 +676,7 @@ function _filter_html_settings($format) $form['filter_html']["allowed_html_$format"] = array( '#type' => 'textfield', '#title' => t('Allowed HTML tags'), - '#default_value' => variable_get("allowed_html_$format", '
                          1. '), + '#default_value' => variable_get("allowed_html_$format"), '#size' => 64, '#maxlength' => 255, '#description' => t('Specify a list of tags which should not be stripped. (Note that JavaScript event attributes are always stripped.)'), @@ -668,13 +684,13 @@ function _filter_html_settings($format) $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("filter_html_help_$format"), '#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("filter_html_nofollow_$format"), '#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; @@ -684,10 +700,10 @@ function _filter_html_settings($format) * HTML filter. Provides filtering of input into accepted HTML. */ function _filter_html($text, $format) { - $allowed_tags = preg_split('/\s+|<|>/', variable_get("allowed_html_$format", '
                              1. '), -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 19:24:20 -0000 @@ -42,6 +42,116 @@ 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, + '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 +784,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 +792,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 +822,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 +833,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 +863,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 +878,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 +924,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 +968,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 +983,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 +1267,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 +1360,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 +1434,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 +1992,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 +2048,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 +2142,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 19:22:15 -0000 @@ -17,6 +17,33 @@ 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' => '', + '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 +249,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 +428,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 +441,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 +611,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 +724,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 +759,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 +801,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 +815,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 +841,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 +864,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 +913,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 +1252,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 +1335,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 +1456,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 +1501,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 +1516,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 +1526,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 +2016,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 +2057,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 +2121,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 +2129,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 +2246,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 +2274,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 +2290,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('

                                Your password is %pass. You may change your password below.

                                ', array('%pass' => $pass))); } @@ -2280,7 +2305,7 @@ function user_register_submit($form, &$f if ($admin && !$notify) { drupal_set_message(t('Created a new user account for %name. No e-mail has been sent.', array('@url' => url("user/$account->uid"), '%name' => $account->name))); } - 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); @@ -2335,7 +2360,7 @@ function user_register() { // Display the registration form. if (!$admin) { - $form['user_registration_help'] = array('#markup' => filter_xss_admin(variable_get('user_registration_help', ''))); + $form['user_registration_help'] = array('#markup' => filter_xss_admin(variable_get('user_registration_help'))); } // Merge in the default user edit fields. @@ -2367,12 +2392,12 @@ function user_register() { $form = array_merge($form, $extra); } - if (variable_get('configurable_timezones', 1)) { + if (variable_get('configurable_timezones')) { // Override field ID, so we only change timezone on user registration, // and never touch it on user edit pages. $form['timezone'] = array( '#type' => 'hidden', - '#default_value' => variable_get('date_default_timezone', NULL), + '#default_value' => variable_get('date_default_timezone'), '#id' => 'edit-user-register-timezone', ); Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.10 diff -u -p -r1.10 user.test --- modules/user/user.test 27 Jun 2008 07:25:11 -0000 1.10 +++ modules/user/user.test 25 Jul 2008 05:34:42 -0000 @@ -44,8 +44,8 @@ class UserRegistrationTestCase extends D $this->assertEqual($user->theme, '', t('Correct theme field.')); $this->assertEqual($user->signature, '', t('Correct signature field.')); $this->assertTrue(($user->created > time() - 20 ), t('Correct creation time.')); - $this->assertEqual($user->status, variable_get('user_register', 1) == 1 ? 1 : 0, t('Correct status field.')); - $this->assertEqual($user->timezone, variable_get('date_default_timezone', NULL), t('Correct timezone field.')); + $this->assertEqual($user->status, variable_get('user_register') == 1 ? 1 : 0, t('Correct status field.')); + $this->assertEqual($user->timezone, variable_get('date_default_timezone'), t('Correct timezone field.')); $this->assertEqual($user->language, '', t('Correct language field.')); $this->assertEqual($user->picture, '', t('Correct picture field.')); $this->assertEqual($user->init, $mail, t('Correct init field.')); @@ -75,7 +75,7 @@ class UserRegistrationTestCase extends D $this->assertText(t('The changes have been saved.'), t('Password changed to @password', array('@password' => $new_pass))); // Make sure password changes are present in database. - require_once variable_get('password_inc', './includes/password.inc'); + require_once variable_get('password_inc'); $user = user_load(array('uid' => $user->uid)); $this->assertTrue(user_check_password($new_pass, $user), t('Correct password in database.')); @@ -225,7 +225,7 @@ class UserPictureTestCase extends Drupal $file_dir = file_directory_path(); $file_check = file_check_directory($file_dir, FILE_CREATE_DIRECTORY, 'file_directory_path'); - $picture_dir = variable_get('user_picture_path', 'pictures'); + $picture_dir = variable_get('user_picture_path'); $picture_path = $file_dir .'/'.$picture_dir; $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path'); @@ -329,7 +329,7 @@ class UserPictureTestCase extends Drupal variable_set('user_picture_file_size', $test_size); $pic_path = $this->saveUserPicture($image); - $text = t('The uploaded image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'))); + $text = t('The uploaded image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => variable_get('user_picture_dimensions'))); $this->assertText($text, t('Checking response on invalid image (dimensions).')); // check if file is not uploaded @@ -360,7 +360,7 @@ class UserPictureTestCase extends Drupal variable_set('user_picture_file_size', $test_size); $pic_path = $this->saveUserPicture($image); - $text = t('The uploaded image is too large; the maximum file size is %size kB.', array('%size' => variable_get('user_picture_file_size', '30'))); + $text = t('The uploaded image is too large; the maximum file size is %size kB.', array('%size' => variable_get('user_picture_file_size'))); $this->assertText($text, t('Checking response on invalid image size.')); // check if file is not uploaded @@ -403,7 +403,7 @@ class UserPictureTestCase extends Drupal $this->drupalPost('user/' . $this->user->uid.'/edit', $edit, t('Save')); $img_info = image_get_info($image->filename); - $picture_dir = variable_get('user_picture_path', 'pictures'); + $picture_dir = variable_get('user_picture_path'); $pic_path = file_directory_path() . '/' . $picture_dir . '/picture-' . $this->user->uid . '.' . $img_info['extension']; return $pic_path; Index: profiles/default/default.profile =================================================================== RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v retrieving revision 1.26 diff -u -p -r1.26 default.profile --- profiles/default/default.profile 24 Jun 2008 21:26:48 -0000 1.26 +++ profiles/default/default.profile 25 Jul 2008 18:32:46 -0000 @@ -129,7 +129,7 @@ function default_profile_tasks(&$task, $ 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('theme_settings'); $theme_settings['toggle_node_info_page'] = FALSE; variable_set('theme_settings', $theme_settings); Index: themes/chameleon/chameleon.theme =================================================================== RCS file: /cvs/drupal/drupal/themes/chameleon/chameleon.theme,v retrieving revision 1.78 diff -u -p -r1.78 chameleon.theme --- themes/chameleon/chameleon.theme 25 Jun 2008 09:12:25 -0000 1.78 +++ themes/chameleon/chameleon.theme 25 Jul 2008 05:34:45 -0000 @@ -30,7 +30,7 @@ function chameleon_page($content, $show_ $output = "\n"; $output .= "\n"; $output .= "\n"; - $output .= " " . ($title ? strip_tags($title) . " | " . variable_get("site_name", "Drupal") : variable_get("site_name", "Drupal") . " | " . variable_get("site_slogan", "")) . "\n"; + $output .= " " . ($title ? strip_tags($title) . " | " . variable_get("site_name") : variable_get("site_name") . " | " . variable_get("site_slogan")) . "\n"; $output .= drupal_get_html_head(); $output .= drupal_get_css(); $output .= drupal_get_js(); @@ -42,10 +42,10 @@ function chameleon_page($content, $show_ $output .= " \"""; } if (theme_get_setting('toggle_name')) { - $output .= "

                                " . l(variable_get('site_name', 'drupal'), "") . "

                                "; + $output .= "

                                " . l(variable_get('site_name'), "") . "

                                "; } if (theme_get_setting('toggle_slogan')) { - $output .= "
                                " . variable_get('site_slogan', '') . "
                                "; + $output .= "
                                " . variable_get('site_slogan') . "
                                "; } $output .= "\n"; @@ -92,7 +92,7 @@ function chameleon_page($content, $show_ $output .= drupal_get_feeds(); $output .= "\n\n"; - if ($footer = variable_get('site_footer', '')) { + if ($footer = variable_get('site_footer')) { $output .= "
                                $footer
                                \n"; }