? constants.pl ? report.txt Index: cron.php =================================================================== RCS file: /cvs/drupal/drupal/cron.php,v retrieving revision 1.38 diff -u -F^f -r1.38 cron.php --- cron.php 9 May 2008 19:23:48 -0000 1.38 +++ cron.php 20 May 2008 20:39:52 -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(V_CRON_KEY, 'drupal') == $_GET['cron_key']) { drupal_cron_run(); } else { Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.118 diff -u -F^f -r1.118 install.php --- install.php 6 May 2008 12:18:44 -0000 1.118 +++ install.php 20 May 2008 20:39:52 -0000 @@ -1,6 +1,18 @@ sid = session_id(); // Record when this install ran. - variable_set('install_time', time()); + variable_set(V_INSTALL_TIME, time()); } // Start the installer. Index: update.php =================================================================== RCS file: /cvs/drupal/drupal/update.php,v retrieving revision 1.254 diff -u -F^f -r1.254 update.php --- update.php 14 Apr 2008 17:48:33 -0000 1.254 +++ update.php 20 May 2008 20:39:53 -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(V_UPDATE_D6_REQUIREMENTS, FALSE)) { $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); @@ -505,7 +505,7 @@ function update_fix_d6_requirements() { db_add_field($ret, 'locales_source', 'textgroup', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'default')); db_add_field($ret, 'locales_source', 'version', array('type' => 'varchar', 'length' => 20, 'not null' => TRUE, 'default' => 'none')); } - variable_set('update_d6_requirements', TRUE); + variable_set(V_UPDATE_D6_REQUIREMENTS, TRUE); // Create the cache_block table. See system_update_6027() for more details. $schema['cache_block'] = array( Index: includes/actions.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/actions.inc,v retrieving revision 1.11 diff -u -F^f -r1.11 actions.inc --- includes/actions.inc 23 Apr 2008 18:05:57 -0000 1.11 +++ includes/actions.inc 20 May 2008 20:39:53 -0000 @@ -6,6 +6,9 @@ * This is the actions engine for executing stored actions. */ +/** @variable V_ACTIONS_MAX_STACK: TODO: add documentation **/ +define('V_ACTIONS_MAX_STACK', 'actions_max_stack'); + /** * Perform a given list of actions by executing their callback functions. * @@ -40,7 +43,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(V_ACTIONS_MAX_STACK, 35)) { 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.210 diff -u -F^f -r1.210 bootstrap.inc --- includes/bootstrap.inc 13 May 2008 17:38:42 -0000 1.210 +++ includes/bootstrap.inc 20 May 2008 20:39:53 -0000 @@ -6,6 +6,45 @@ * Functions that need to be loaded on every Drupal request. */ +/** @variable V_BLOCKED_IPS: TODO: add documentation **/ +define('V_BLOCKED_IPS', 'blocked_ips'); + +/** @variable V_CACHE_INC: TODO: add documentation **/ +define('V_CACHE_INC', 'cache_inc'); + +/** @variable V_LANGUAGE_: TODO: add documentation **/ +define('V_LANGUAGE_', 'language_'); + +/** @variable V_LANGUAGE_CONTENT_TYPE_: TODO: add documentation **/ +define('V_LANGUAGE_CONTENT_TYPE_', 'language_content_type_'); + +/** @variable V_LANGUAGE_CONTENT_TYPE_DEFAULT: TODO: add documentation **/ +define('V_LANGUAGE_CONTENT_TYPE_DEFAULT', 'language_content_type_default'); + +/** @variable V_LANGUAGE_CONTENT_TYPE_NEGOTIATION: TODO: add documentation **/ +define('V_LANGUAGE_CONTENT_TYPE_NEGOTIATION', 'language_content_type_negotiation'); + +/** @variable V_LANGUAGE_COUNT: TODO: add documentation **/ +define('V_LANGUAGE_COUNT', 'language_count'); + +/** @variable V_LANGUAGE_DEFAULT: TODO: add documentation **/ +define('V_LANGUAGE_DEFAULT', 'language_default'); + +/** @variable V_LANGUAGE_NEGOTIATION: TODO: add documentation **/ +define('V_LANGUAGE_NEGOTIATION', 'language_negotiation'); + +/** @variable V_PAGE_CACHE_FASTPATH: TODO: add documentation **/ +define('V_PAGE_CACHE_FASTPATH', 'page_cache_fastpath'); + +/** @variable V_REVERSE_PROXY: TODO: add documentation **/ +define('V_REVERSE_PROXY', 'reverse_proxy'); + +/** @variable V_REVERSE_PROXY_ADDRESSES: TODO: add documentation **/ +define('V_REVERSE_PROXY_ADDRESSES', 'reverse_proxy_addresses'); + +/** @variable V_SESSION_INC: TODO: add documentation **/ +define('V_SESSION_INC', 'session_inc'); + /** * Indicates that the item should never be removed unless explicitly told to * using cache_clear_all() with a cache ID. @@ -605,7 +644,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(V_PAGE_COMPRESSION, TRUE)) { // 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. @@ -862,7 +901,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(V_BLOCKED_IPS, NULL); if (isset($blocked_ips) && is_array($blocked_ips)) { return in_array($ip, $blocked_ips); } @@ -934,12 +973,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(V_CACHE_INC, './includes/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(V_PAGE_CACHE_FASTPATH, FALSE) && page_cache_fastpath()) { exit; } break; @@ -963,7 +1002,7 @@ function _drupal_bootstrap($phase) { break; case DRUPAL_BOOTSTRAP_SESSION: - require_once variable_get('session_inc', './includes/session.inc'); + require_once variable_get(V_SESSION_INC, './includes/session.inc'); session_set_save_handler('sess_open', 'sess_close', 'sess_read', 'sess_write', 'sess_destroy_sid', 'sess_gc'); session_start(); break; @@ -973,7 +1012,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(V_CACHE, CACHE_DISABLED); // 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. @@ -1044,7 +1083,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(V_LANGUAGE_COUNT, 1) == 1) { $language = language_default(); } else { @@ -1069,7 +1108,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(V_LANGUAGE_COUNT, 1) > 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; @@ -1105,7 +1144,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(V_LANGUAGE_DEFAULT, (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '')); return $property ? $language->$property : $language; } @@ -1122,10 +1161,10 @@ function ip_address() { if (!isset($ip_address)) { $ip_address = $_SERVER['REMOTE_ADDR']; - if (variable_get('reverse_proxy', 0) && array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { + if (variable_get(V_REVERSE_PROXY, 0) && 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(V_REVERSE_PROXY_ADDRESSES, array()); 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.18 diff -u -F^f -r1.18 cache.inc --- includes/cache.inc 14 Apr 2008 17:48:33 -0000 1.18 +++ includes/cache.inc 20 May 2008 20:39:53 -0000 @@ -1,6 +1,12 @@ 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(V_CACHE_LIFETIME, 0)) { $cache->data = db_decode_blob($cache->data); if ($cache->serialized) { $cache->data = unserialize($cache->data); @@ -142,23 +148,23 @@ function cache_clear_all($cid = NULL, $t } if (empty($cid)) { - if (variable_get('cache_lifetime', 0)) { + if (variable_get(V_CACHE_LIFETIME, 0)) { // 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(V_CACHE_FLUSH, 0); if ($cache_flush == 0) { // This is the first request to clear the cache, start a timer. - variable_set('cache_flush', time()); + variable_set(V_CACHE_FLUSH, time()); } - else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) { + else if (time() > ($cache_flush + variable_get(V_CACHE_LIFETIME, 0))) { // 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()); - variable_set('cache_flush', 0); + variable_set(V_CACHE_FLUSH, 0); } } else { Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.768 diff -u -F^f -r1.768 common.inc --- includes/common.inc 16 May 2008 01:23:31 -0000 1.768 +++ includes/common.inc 20 May 2008 20:39:53 -0000 @@ -9,6 +9,69 @@ * a cached page are instead located in bootstrap.inc. */ +/** @variable V_CACHE: TODO: add documentation **/ +define('V_CACHE', 'cache'); + +/** @variable V_CRON_LAST: TODO: add documentation **/ +define('V_CRON_LAST', 'cron_last'); + +/** @variable V_CRON_SEMAPHORE: TODO: add documentation **/ +define('V_CRON_SEMAPHORE', 'cron_semaphore'); + +/** @variable V_CSS_JS_QUERY_STRING: TODO: add documentation **/ +define('V_CSS_JS_QUERY_STRING', 'css_js_query_string'); + +/** @variable V_DATE_FORMAT_SHORT: TODO: add documentation **/ +define('V_DATE_FORMAT_SHORT', 'date_format_short'); + +/** @variable V_DRUPAL_PRIVATE_KEY: TODO: add documentation **/ +define('V_DRUPAL_PRIVATE_KEY', 'drupal_private_key'); + +/** @variable V_ERROR_LEVEL: TODO: add documentation **/ +define('V_ERROR_LEVEL', 'error_level'); + +/** @variable V_FILE_DOWNLOADS: TODO: add documentation **/ +define('V_FILE_DOWNLOADS', 'file_downloads'); + +/** @variable V_PAGE_COMPRESSION: TODO: add documentation **/ +define('V_PAGE_COMPRESSION', 'page_compression'); + +/** @variable V_PREPROCESS_CSS: TODO: add documentation **/ +define('V_PREPROCESS_CSS', 'preprocess_css'); + +/** @variable V_PREPROCESS_JS: TODO: add documentation **/ +define('V_PREPROCESS_JS', 'preprocess_js'); + +/** @variable V_SITE_403: TODO: add documentation **/ +define('V_SITE_403', 'site_403'); + +/** @variable V_SITE_404: TODO: add documentation **/ +define('V_SITE_404', 'site_404'); + +/** @variable V_SITE_FOOTER: TODO: add documentation **/ +define('V_SITE_FOOTER', 'site_footer'); + +/** @variable V_SITE_FRONTPAGE: TODO: add documentation **/ +define('V_SITE_FRONTPAGE', 'site_frontpage'); + +/** @variable V_SITE_MAIL: TODO: add documentation **/ +define('V_SITE_MAIL', 'site_mail'); + +/** @variable V_SITE_MISSION: TODO: add documentation **/ +define('V_SITE_MISSION', 'site_mission'); + +/** @variable V_SITE_NAME: TODO: add documentation **/ +define('V_SITE_NAME', 'site_name'); + +/** @variable V_SITE_OFFLINE: TODO: add documentation **/ +define('V_SITE_OFFLINE', 'site_offline'); + +/** @variable V_SITE_OFFLINE_MESSAGE: TODO: add documentation **/ +define('V_SITE_OFFLINE_MESSAGE', 'site_offline_message'); + +/** @variable V_SITE_SLOGAN: TODO: add documentation **/ +define('V_SITE_SLOGAN', 'site_slogan'); + /** * Return status for saving which involved creating a new item. */ @@ -331,8 +394,8 @@ function drupal_site_offline() { drupal_maintenance_theme(); drupal_set_header('HTTP/1.1 503 Service unavailable'); drupal_set_title(t('Site off-line')); - 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')))))); + print theme('maintenance_page', filter_xss_admin(variable_get(V_SITE_OFFLINE_MESSAGE, + t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get(V_SITE_NAME, 'Drupal')))))); } /** @@ -348,7 +411,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(V_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 +440,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(V_SITE_403, '')); if ($path && $path != $_GET['q']) { // Set the active item in case there are tabs to display or other // dependencies on the path. @@ -420,7 +483,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(V_DRUPAL_HTTP_REQUEST_FAILS, FALSE)) { $self_test = TRUE; $works = module_invoke('system', 'check_http_request'); $self_test = FALSE; @@ -602,7 +665,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(V_ERROR_LEVEL, 1) == 1 || strstr($_SERVER['SCRIPT_NAME'], 'update.php')) { drupal_set_message($entry, 'error'); } @@ -761,7 +824,7 @@ function t($string, $args = array(), $la // handful of string replacements. See settings.php for examples. // Cache the $custom_strings variable to improve performance. if (!isset($custom_strings[$langcode])) { - $custom_strings[$langcode] = variable_get('locale_custom_strings_' . $langcode, array()); + $custom_strings[$langcode] = variable_get(V_LOCALE_CUSTOM_STRINGS_ . $langcode, array()); } // Custom strings work for English too, even if locale module is disabled. if (isset($custom_strings[$langcode][$string])) { @@ -1151,11 +1214,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(V_CONFIGURABLE_TIMEZONES, 1) && $user->uid && strlen($user->timezone)) { $timezone = $user->timezone; } else { - $timezone = variable_get('date_default_timezone', 0); + $timezone = variable_get(V_DATE_DEFAULT_TIMEZONE, 0); } } @@ -1163,17 +1226,17 @@ function format_date($timestamp, $type = switch ($type) { case 'small': - $format = variable_get('date_format_short', 'm/d/Y - H:i'); + $format = variable_get(V_DATE_FORMAT_SHORT, 'm/d/Y - H:i'); break; case 'large': - $format = variable_get('date_format_long', 'l, F j, Y - H:i'); + $format = variable_get(V_DATE_FORMAT_LONG, 'l, F j, Y - H:i'); 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(V_DATE_FORMAT_MEDIUM, 'D, m/d/Y - H:i'); } $max = strlen($format); @@ -1311,7 +1374,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(V_CLEAN_URL, '0'); } if (!isset($options['base_url'])) { @@ -1461,7 +1524,7 @@ function l($text, $path, $options = arra */ function drupal_page_footer() { - if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) { + if (variable_get(V_CACHE, CACHE_DISABLED) != CACHE_DISABLED) { page_set_cache(); } @@ -1684,15 +1747,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(V_PREPROCESS_CSS, FALSE) && (!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(V_FILE_DOWNLOADS, FILE_DOWNLOADS_PUBLIC) == 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(V_CSS_JS_QUERY_STRING, '0'), 0, 1); foreach ($css as $media => $types) { // If CSS preprocessing is off, we still need to output the styles. @@ -2033,9 +2096,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(V_PREPROCESS_JS, FALSE) && (!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(V_FILE_DOWNLOADS, FILE_DOWNLOADS_PUBLIC) == 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 @@ -2043,7 +2106,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(V_CSS_JS_QUERY_STRING, '0'), 0, 1); foreach ($javascript as $type => $data) { @@ -2252,7 +2315,7 @@ function drupal_build_js_cache($files, $ */ function drupal_clear_js_cache() { file_scan_directory(file_create_path('js'), '.*', array('.', '..', 'CVS'), 'file_delete', TRUE); - variable_set('javascript_parsed', array()); + variable_set(V_JAVASCRIPT_PARSED, array()); } /** @@ -2303,7 +2366,7 @@ function drupal_json($var = NULL) { * String to encode */ function drupal_urlencode($text) { - if (variable_get('clean_url', '0')) { + if (variable_get(V_CLEAN_URL, '0')) { return str_replace(array('%2F', '%26', '%23', '//'), array('/', '%2526', '%2523', '/%252F'), rawurlencode($text)); @@ -2358,9 +2421,9 @@ 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(V_DRUPAL_PRIVATE_KEY, 0))) { $key = md5(drupal_random_bytes(64)); - variable_set('drupal_private_key', $key); + variable_set(V_DRUPAL_PRIVATE_KEY, $key); } return $key; } @@ -2391,7 +2454,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(V_DRUPAL_PRIVATE_KEY, '')))); } /** @@ -2476,7 +2539,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(V_PAGE_COMPRESSION, TRUE) && 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') { @@ -2508,7 +2571,7 @@ function drupal_cron_run() { } // Fetch the cron semaphore - $semaphore = variable_get('cron_semaphore', FALSE); + $semaphore = variable_get(V_CRON_SEMAPHORE, FALSE); if ($semaphore) { if (time() - $semaphore > 3600) { @@ -2529,13 +2592,13 @@ function drupal_cron_run() { register_shutdown_function('drupal_cron_cleanup'); // Lock cron semaphore - variable_set('cron_semaphore', time()); + variable_set(V_CRON_SEMAPHORE, time()); // Iterate through the modules calling their cron handlers (if any): module_invoke_all('cron'); // Record cron time - variable_set('cron_last', time()); + variable_set(V_CRON_LAST, time()); watchdog('cron', 'Cron run completed.', array(), WATCHDOG_NOTICE); // Release cron semaphore @@ -2551,7 +2614,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(V_CRON_SEMAPHORE, FALSE)) { watchdog('cron', 'Cron run exceeded the time limit and was aborted.', array(), WATCHDOG_WARNING); // Release cron semaphore @@ -2596,7 +2659,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(V_INSTALL_PROFILE, 'default'); } $searchdir = array($directory); $files = array(); @@ -3559,11 +3622,11 @@ 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(V_CSS_JS_QUERY_STRING, '00000000000000000000'); $new_character = $string_history[0]; $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; while (strpos($string_history, $new_character) !== FALSE) { $new_character = $characters[mt_rand(0, strlen($characters) - 1)]; } - variable_set('css_js_query_string', $new_character . substr($string_history, 0, 19)); + variable_set(V_CSS_JS_QUERY_STRING, $new_character . substr($string_history, 0, 19)); } Index: includes/database.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.inc,v retrieving revision 1.94 diff -u -F^f -r1.94 database.inc --- includes/database.inc 20 Apr 2008 18:23:21 -0000 1.94 +++ includes/database.inc 20 May 2008 20:39:53 -0000 @@ -6,6 +6,9 @@ * Wrapper for database interface code. */ +/** @variable V_DEV_QUERY: TODO: add documentation **/ +define('V_DEV_QUERY', 'dev_query'); + /** * A hash value to check when outputting database errors, md5('DB_ERROR'). * Index: includes/database.mysql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v retrieving revision 1.91 diff -u -F^f -r1.91 database.mysql.inc --- includes/database.mysql.inc 14 Apr 2008 17:48:33 -0000 1.91 +++ includes/database.mysql.inc 20 May 2008 20:39:53 -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(V_DEV_QUERY, 0)) { 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(V_ANONYMOUS, '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(V_DEV_QUERY, 0)) { $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 -F^f -r1.57 database.mysqli.inc --- includes/database.mysqli.inc 14 Apr 2008 17:48:33 -0000 1.57 +++ includes/database.mysqli.inc 20 May 2008 20:39:53 -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(V_DEV_QUERY, 0)) { 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(V_ANONYMOUS, '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(V_DEV_QUERY, 0)) { $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 -F^f -r1.71 database.pgsql.inc --- includes/database.pgsql.inc 9 May 2008 19:18:11 -0000 1.71 +++ includes/database.pgsql.inc 20 May 2008 20:39:53 -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(V_DEV_QUERY, 0)) { 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(V_DEV_QUERY, 0)) { $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.124 diff -u -F^f -r1.124 file.inc --- includes/file.inc 23 Apr 2008 18:17:41 -0000 1.124 +++ includes/file.inc 20 May 2008 20:39:54 -0000 @@ -12,6 +12,12 @@ * Common file handling functions. */ +/** @variable V_ALLOW_INSECURE_UPLOADS: TODO: add documentation **/ +define('V_ALLOW_INSECURE_UPLOADS', 'allow_insecure_uploads'); + +/** @variable V_FILE_DIRECTORY_TEMP: TODO: add documentation **/ +define('V_FILE_DIRECTORY_TEMP', 'file_directory_temp'); + define('FILE_DOWNLOADS_PUBLIC', 1); define('FILE_DOWNLOADS_PRIVATE', 2); define('FILE_CREATE_DIRECTORY', 1); @@ -43,7 +49,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(V_FILE_DOWNLOADS, FILE_DOWNLOADS_PUBLIC)) { case FILE_DOWNLOADS_PUBLIC: return $GLOBALS['base_url'] . '/' . file_directory_path() . '/' . str_replace('\\', '/', $path); case FILE_DOWNLOADS_PRIVATE: @@ -356,7 +362,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(V_ALLOW_INSECURE_UPLOADS, 0)) { $whitelist = array_unique(explode(' ', trim($extensions))); // Split the filename up by periods. The first part becomes the basename @@ -520,7 +526,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(V_UPLOAD_EXTENSIONS_DEFAULT, 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp')); } // Begin building file object. @@ -918,7 +924,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(V_FILE_DIRECTORY_TEMP, NULL); if (is_null($temporary_directory)) { $directories = array(); @@ -947,7 +953,7 @@ function file_directory_temp() { // if a directory has been found, use it, otherwise default to 'files/tmp' or 'files\\tmp'; $temporary_directory = $temporary_directory ? $temporary_directory : file_directory_path() . $path_delimiter . 'tmp'; - variable_set('file_directory_temp', $temporary_directory); + variable_set(V_FILE_DIRECTORY_TEMP, $temporary_directory); } return $temporary_directory; @@ -959,7 +965,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(V_FILE_DIRECTORY_PATH, conf_path() . '/files'); } /** Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.272 diff -u -F^f -r1.272 form.inc --- includes/form.inc 6 May 2008 12:18:45 -0000 1.272 +++ includes/form.inc 20 May 2008 20:39:54 -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(V_CACHE, CACHE_DISABLED) == 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'); } @@ -1652,7 +1652,7 @@ function expand_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(V_DATE_FORMAT_SHORT, 'm/d/Y - H:i'); $sort = array(); $sort['day'] = max(strpos($format, 'd'), strpos($format, 'j')); $sort['month'] = max(strpos($format, 'm'), strpos($format, 'M')); Index: includes/image.gd.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/image.gd.inc,v retrieving revision 1.6 diff -u -F^f -r1.6 image.gd.inc --- includes/image.gd.inc 14 Apr 2008 17:48:33 -0000 1.6 +++ includes/image.gd.inc 20 May 2008 20:39:54 -0000 @@ -11,6 +11,9 @@ * @{ */ +/** @variable V_IMAGE_JPEG_QUALITY: TODO: add documentation **/ +define('V_IMAGE_JPEG_QUALITY', 'image_jpeg_quality'); + /** * Retrieve information about the toolkit. */ @@ -34,7 +37,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(V_IMAGE_JPEG_QUALITY, 75), '#field_suffix' => t('%'), ); $form['#element_validate'] = array('image_gd_settings_validate'); @@ -209,7 +212,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(V_IMAGE_JPEG_QUALITY, 75)); } else { return $close_func($res, $destination); Index: includes/image.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/image.inc,v retrieving revision 1.25 diff -u -F^f -r1.25 image.inc --- includes/image.inc 14 Apr 2008 17:48:33 -0000 1.25 +++ includes/image.inc 20 May 2008 20:39:54 -0000 @@ -62,7 +62,7 @@ function image_get_toolkit() { static $toolkit; if (!$toolkit) { - $toolkit = variable_get('image_toolkit', 'gd'); + $toolkit = variable_get(V_IMAGE_TOOLKIT, 'gd'); $toolkit_file = './includes/image.' . $toolkit . '.inc'; if (isset($toolkit) && file_exists($toolkit_file)) { include_once $toolkit_file; Index: includes/language.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/language.inc,v retrieving revision 1.16 diff -u -F^f -r1.16 language.inc --- includes/language.inc 14 Apr 2008 17:48:33 -0000 1.16 +++ includes/language.inc 20 May 2008 20:39:54 -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(V_LANGUAGE_NEGOTIATION, LANGUAGE_NEGOTIATION_NONE); // 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(V_LANGUAGE_NEGOTIATION, LANGUAGE_NEGOTIATION_NONE)) { 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.175 diff -u -F^f -r1.175 locale.inc --- includes/locale.inc 14 Apr 2008 17:48:33 -0000 1.175 +++ includes/locale.inc 20 May 2008 20:39:54 -0000 @@ -120,8 +120,8 @@ function locale_languages_overview_form_ $languages[$langcode] = $language; } drupal_set_message(t('Configuration saved.')); - variable_set('language_default', $languages[$form_state['values']['site_default']]); - variable_set('language_count', $enabled_count); + variable_set(V_LANGUAGE_DEFAULT, $languages[$form_state['values']['site_default']]); + variable_set(V_LANGUAGE_COUNT, $enabled_count); // Changing the language settings impacts the interface. cache_clear_all('*', 'cache_page', TRUE); @@ -362,7 +362,7 @@ function locale_languages_edit_form_subm $default->$keyname = $form_state['values'][$keyname]; } } - variable_set('language_default', $default); + variable_set(V_LANGUAGE_DEFAULT, $default); } $form_state['redirect'] = 'admin/settings/language'; return; @@ -450,7 +450,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(V_LANGUAGE_NEGOTIATION, LANGUAGE_NEGOTIATION_NONE), '#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( @@ -464,7 +464,7 @@ function locale_languages_configure_form * Submit function for language negotiation settings. */ function locale_languages_configure_form_submit($form, &$form_state) { - variable_set('language_negotiation', $form_state['values']['language_negotiation']); + variable_set(V_LANGUAGE_NEGOTIATION, $form_state['values']['language_negotiation']); drupal_set_message(t('Language negotiation configuration saved.')); $form_state['redirect'] = 'admin/settings/language'; return; @@ -928,12 +928,12 @@ function locale_add_language($langcode, // Only set it as default if enabled. if ($enabled && $default) { - variable_set('language_default', (object) array('language' => $langcode, 'name' => $name, 'native' => $native, 'direction' => $direction, 'enabled' => (int) $enabled, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => $prefix, 'weight' => 0, 'javascript' => '')); + variable_set(V_LANGUAGE_DEFAULT, (object) array('language' => $langcode, 'name' => $name, 'native' => $native, 'direction' => $direction, 'enabled' => (int) $enabled, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => $prefix, 'weight' => 0, 'javascript' => '')); } 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(V_LANGUAGE_COUNT, variable_get(V_LANGUAGE_COUNT, 1) + 1); } // Force JavaScript translation file creation for the newly added language. @@ -1725,7 +1725,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(V_SITE_NAME, 'Drupal') . "\n"; $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n"; $header .= "#\n"; $header .= "msgid \"\"\n"; @@ -2031,7 +2031,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(V_JAVASCRIPT_PARSED, array()); if (empty($langcode)) { // Invalidate all languages. @@ -2046,7 +2046,7 @@ function _locale_invalidate_js($langcode $parsed['refresh:' . $langcode] = 'waiting'; } - variable_set('javascript_parsed', $parsed); + variable_set(V_JAVASCRIPT_PARSED, $parsed); return $parsed; } @@ -2114,7 +2114,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(V_LOCALE_JS_DIRECTORY, 'languages')); // 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)) { @@ -2151,7 +2151,7 @@ function _locale_rebuild_js($langcode = $default_langcode = language_default('language'); if ($default_langcode == $language->language) { $default = db_fetch_object(db_query("SELECT * FROM {languages} WHERE language = '%s'", $default_langcode)); - variable_set('language_default', $default); + variable_set(V_LANGUAGE_DEFAULT, $default); } } Index: includes/mail.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/mail.inc,v retrieving revision 1.13 diff -u -F^f -r1.13 mail.inc --- includes/mail.inc 6 May 2008 12:18:45 -0000 1.13 +++ includes/mail.inc 20 May 2008 20:39:54 -0000 @@ -1,6 +1,9 @@ $end) { @@ -335,7 +365,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(V_MENU_REBUILD_NEEDED, FALSE)) { menu_rebuild(); } if ($router_item = menu_get_item($path)) { @@ -893,7 +923,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(V_MENU_EXPANDED, array()); // 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 @@ -1201,7 +1231,7 @@ function menu_list_system_menus() { * Return an array of links to be rendered as the Primary links. */ function menu_primary_links() { - return menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links')); + return menu_navigation_links(variable_get(V_MENU_PRIMARY_LINKS_SOURCE, 'primary-links')); } /** @@ -1211,11 +1241,11 @@ function menu_secondary_links() { // 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_links_source', 'secondary-links') == variable_get('menu_primary_links_source', 'primary-links')) { - return menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 1); + if (variable_get(V_MENU_SECONDARY_LINKS_SOURCE, 'secondary-links') == variable_get(V_MENU_PRIMARY_LINKS_SOURCE, 'primary-links')) { + return menu_navigation_links(variable_get(V_MENU_PRIMARY_LINKS_SOURCE, 'primary-links'), 1); } else { - return menu_navigation_links(variable_get('menu_secondary_links_source', 'secondary-links'), 0); + return menu_navigation_links(variable_get(V_MENU_SECONDARY_LINKS_SOURCE, 'secondary-links'), 0); } } @@ -1646,7 +1676,7 @@ function menu_rebuild() { // Clear the page and block caches. _menu_clear_page_cache(); if (defined('MAINTENANCE_MODE')) { - variable_set('menu_rebuild_needed', TRUE); + variable_set(V_MENU_REBUILD_NEEDED, TRUE); } } @@ -1996,7 +2026,7 @@ function _menu_set_expanded_menus() { while ($n = db_fetch_array($result)) { $names[] = $n['menu_name']; } - variable_set('menu_expanded', $names); + variable_set(V_MENU_EXPANDED, $names); } /** @@ -2343,7 +2373,7 @@ function _menu_router_build($callbacks) // Sort the masks so they are in order of descending fit, and store them. $masks = array_keys($masks); rsort($masks); - variable_set('menu_masks', $masks); + variable_set(V_MENU_MASKS, $masks); return $menu; } @@ -2368,7 +2398,7 @@ function menu_path_is_external($path) { */ function _menu_site_is_offline() { // Check if site is set to off-line mode. - if (variable_get('site_offline', 0)) { + if (variable_get(V_SITE_OFFLINE, 0)) { // Check if the user has administration privileges. if (user_access('administer site configuration')) { // Ensure that the off-line message is displayed only once [allowing for Index: includes/password.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/password.inc,v retrieving revision 1.2 diff -u -F^f -r1.2 password.inc --- includes/password.inc 28 Apr 2008 09:25:26 -0000 1.2 +++ includes/password.inc 20 May 2008 20:39:55 -0000 @@ -14,6 +14,9 @@ * user_needs_new_hash() functions. */ +/** @variable V_PASSWORD_COUNT_LOG2: TODO: add documentation **/ +define('V_PASSWORD_COUNT_LOG2', 'password_count_log2'); + /** * The standard log2 number of iterations for password stretching. This should * increase by 1 at least every other Drupal version in order to counteract @@ -176,7 +179,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(V_PASSWORD_COUNT_LOG2, DRUPAL_HASH_COUNT); } return _password_crypt($password, _password_generate_salt($count_log2)); } @@ -234,6 +237,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(V_PASSWORD_COUNT_LOG2, DRUPAL_HASH_COUNT)); } Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.22 diff -u -F^f -r1.22 path.inc --- includes/path.inc 14 Apr 2008 17:48:33 -0000 1.22 +++ includes/path.inc 20 May 2008 20:39:55 -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(V_SITE_FRONTPAGE, 'node')); } } @@ -213,7 +213,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(V_SITE_FRONTPAGE, 'node')); } /** @@ -231,7 +231,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(V_SITE_FRONTPAGE, 'node'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/'; } return preg_match($regexps[$patterns], $path); } Index: includes/session.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/session.inc,v retrieving revision 1.48 diff -u -F^f -r1.48 session.inc --- includes/session.inc 16 Apr 2008 11:35:51 -0000 1.48 +++ includes/session.inc 20 May 2008 20:39:55 -0000 @@ -6,6 +6,9 @@ * User session handling functions. */ +/** @variable V_SESSION_WRITE_INTERVAL: TODO: add documentation **/ +define('V_SESSION_WRITE_INTERVAL', 'session_write_interval'); + function sess_open($save_path, $session_name) { return TRUE; } @@ -78,7 +81,7 @@ function sess_write($key, $value) { // 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(V_SESSION_WRITE_INTERVAL, 180)) { 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.422 diff -u -F^f -r1.422 theme.inc --- includes/theme.inc 6 May 2008 12:18:45 -0000 1.422 +++ includes/theme.inc 20 May 2008 20:39:55 -0000 @@ -41,7 +41,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(V_THEME_DEFAULT, 'garland'); // Allow modules to override the present theme... only select custom theme // if it is available in the list of installed themes. @@ -870,7 +870,7 @@ 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(V_THEME_SETTINGS, array())); if ($key) { $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_' . $key . '_settings'), array())); @@ -911,7 +911,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(V_SITE_MISSION, ''); } if (!$settings['toggle_mission']) { @@ -1575,7 +1575,7 @@ function theme_username($object) { $output .= ' (' . t('not verified') . ')'; } else { - $output = variable_get('anonymous', t('Anonymous')); + $output = variable_get(V_ANONYMOUS, t('Anonymous')); } return $output; @@ -1739,12 +1739,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(V_SITE_NAME, 'Drupal')); } 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(V_SITE_NAME, 'Drupal')); + if (variable_get(V_SITE_SLOGAN, '')) { + $head_title[] = variable_get(V_SITE_SLOGAN, ''); } } $variables['head_title'] = implode(' | ', $head_title); @@ -1752,7 +1752,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(V_SITE_FOOTER, FALSE)); $variables['head'] = drupal_get_html_head(); $variables['help'] = theme('help'); $variables['language'] = $GLOBALS['language']; @@ -1763,8 +1763,8 @@ function template_preprocess_page(&$vari $variables['primary_links'] = theme_get_setting('toggle_primary_links') ? menu_primary_links() : array(); $variables['secondary_links'] = theme_get_setting('toggle_secondary_links') ? menu_secondary_links() : 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(V_SITE_NAME, 'Drupal') : ''); + $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get(V_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.13 diff -u -F^f -r1.13 theme.maintenance.inc --- includes/theme.maintenance.inc 28 Apr 2008 09:25:26 -0000 1.13 +++ includes/theme.maintenance.inc 20 May 2008 20:39:55 -0000 @@ -6,6 +6,9 @@ * Theming for maintenance pages. */ +/** @variable V_MAINTENANCE_THEME: TODO: add documentation **/ +define('V_MAINTENANCE_THEME', 'maintenance_theme'); + /** * Sets up the theming system for site installs, updates and when the site is * in off-line mode. It also applies when the database is unavailable. @@ -43,7 +46,7 @@ function _drupal_maintenance_theme() { drupal_load('module', 'system'); drupal_load('module', 'filter'); - $theme = variable_get('maintenance_theme', 'minnelli'); + $theme = variable_get(V_MAINTENANCE_THEME, 'minnelli'); } $themes = list_themes(); @@ -231,12 +234,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(V_SITE_NAME, 'Drupal')); } 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(V_SITE_NAME, 'Drupal')); + if (variable_get(V_SITE_SLOGAN, '')) { + $head_title[] = variable_get(V_SITE_SLOGAN, ''); } } $variables['head_title'] = implode(' | ', $head_title); @@ -244,7 +247,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(V_SITE_FOOTER, FALSE)); $variables['head'] = drupal_get_html_head(); $variables['help'] = ''; $variables['language'] = $GLOBALS['language']; @@ -255,8 +258,8 @@ function template_preprocess_maintenance $variables['primary_links'] = array(); $variables['secondary_links'] = 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(V_SITE_NAME, 'Drupal') : ''); + $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get(V_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 -F^f -r1.10 aggregator.admin.inc --- modules/aggregator/aggregator.admin.inc 15 May 2008 21:27:32 -0000 1.10 +++ modules/aggregator/aggregator.admin.inc 20 May 2008 20:39:55 -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(V_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(V_AGGREGATOR_SUMMARY_ITEMS, 3), '#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(V_AGGREGATOR_CLEAR, 9676800), '#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(V_AGGREGATOR_CATEGORY_SELECTOR, 'checkboxes'), '#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.380 diff -u -F^f -r1.380 aggregator.module --- modules/aggregator/aggregator.module 15 May 2008 21:27:32 -0000 1.380 +++ modules/aggregator/aggregator.module 20 May 2008 20:39:56 -0000 @@ -6,6 +6,18 @@ * Used to aggregate syndicated content (RSS, RDF, and Atom). */ +/** @variable V_AGGREGATOR_ALLOWED_HTML_TAGS: TODO: add documentation **/ +define('V_AGGREGATOR_ALLOWED_HTML_TAGS', 'aggregator_allowed_html_tags'); + +/** @variable V_AGGREGATOR_CATEGORY_SELECTOR: TODO: add documentation **/ +define('V_AGGREGATOR_CATEGORY_SELECTOR', 'aggregator_category_selector'); + +/** @variable V_AGGREGATOR_CLEAR: TODO: add documentation **/ +define('V_AGGREGATOR_CLEAR', 'aggregator_clear'); + +/** @variable V_AGGREGATOR_SUMMARY_ITEMS: TODO: add documentation **/ +define('V_AGGREGATOR_SUMMARY_ITEMS', 'aggregator_summary_items'); + /** * Implementation of hook_help(). */ @@ -787,7 +799,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(V_AGGREGATOR_CLEAR, 9676800); $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age); $items = array(); @@ -899,7 +911,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(V_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.14 diff -u -F^f -r1.14 aggregator.pages.inc --- modules/aggregator/aggregator.pages.inc 15 May 2008 21:27:32 -0000 1.14 +++ modules/aggregator/aggregator.pages.inc 20 May 2008 20:39:56 -0000 @@ -6,6 +6,15 @@ * User page callbacks for the aggregator module. */ +/** @variable V_DATE_FORMAT_MEDIUM: TODO: add documentation **/ +define('V_DATE_FORMAT_MEDIUM', 'date_format_medium'); + +/** @variable V_FEED_DEFAULT_ITEMS: TODO: add documentation **/ +define('V_FEED_DEFAULT_ITEMS', 'feed_default_items'); + +/** @variable V_FEED_ITEM_LENGTH: TODO: add documentation **/ +define('V_FEED_ITEM_LENGTH', 'feed_item_length'); + /** * Menu callback; displays the most recent items gathered from any feed. * @@ -13,7 +22,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(V_SITE_NAME, 'Drupal') . ' ' . 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 +74,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(V_SITE_NAME, 'Drupal') . ' ' . 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 +180,7 @@ function aggregator_categorize_items($it } $done = TRUE; $form['categories'][$item->iid] = array( - '#type' => variable_get('aggregator_category_selector', 'checkboxes'), + '#type' => variable_get(V_AGGREGATOR_CATEGORY_SELECTOR, 'checkboxes'), '#default_value' => $selected, '#options' => $categories, '#size' => 10, @@ -269,7 +278,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(V_DATE_FORMAT_MEDIUM, 'D, m/d/Y - H:i')); } $variables['categories'] = array(); @@ -288,8 +297,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(V_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(V_AGGREGATOR_SUMMARY_ITEMS, 3)); while ($item = db_fetch_object($items)) { $summary_items[] = theme('aggregator_summary_item', $item); } @@ -310,9 +319,9 @@ function aggregator_page_categories() { $output = ''; while ($category = db_fetch_object($result)) { - if (variable_get('aggregator_summary_items', 3)) { + if (variable_get(V_AGGREGATOR_SUMMARY_ITEMS, 3)) { $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(V_AGGREGATOR_SUMMARY_ITEMS, 3)); while ($item = db_fetch_object($items)) { $summary_items[] = theme('aggregator_summary_item', $item); } @@ -333,13 +342,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(V_FEED_DEFAULT_ITEMS, 10)); } // 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(V_FEED_DEFAULT_ITEMS, 10)); } $feeds = array(); @@ -363,7 +372,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(V_FEED_ITEM_LENGTH, 'teaser'); foreach ($feeds as $feed) { switch ($feed_length) { case 'teaser': @@ -380,7 +389,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(V_SITE_NAME, 'Drupal'); $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 +438,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(V_SITE_NAME, 'Drupal')) . "\n"; $output .= '' . gmdate('r') . "\n"; $output .= "\n"; $output .= "\n"; Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.17 diff -u -F^f -r1.17 block.admin.inc --- modules/block/block.admin.inc 15 May 2008 21:30:02 -0000 1.17 +++ modules/block/block.admin.inc 20 May 2008 20:39:56 -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(V_THEME_DEFAULT, 'garland'); // 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(V_THEME_DEFAULT, 'garland'); 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.306 diff -u -F^f -r1.306 block.module --- modules/block/block.module 15 May 2008 21:30:02 -0000 1.306 +++ modules/block/block.module 20 May 2008 20:39:56 -0000 @@ -6,6 +6,9 @@ * Controls the boxes that are displayed around the main content. */ +/** @variable V_BLOCK_CACHE: TODO: add documentation **/ +define('V_BLOCK_CACHE', 'block_cache'); + // Denotes that a block is not enabled in any region and should not be shown. define('BLOCK_REGION_NONE', -1); @@ -150,7 +153,7 @@ function block_menu() { 'access arguments' => array('administer blocks'), 'type' => MENU_LOCAL_TASK, ); - $default = variable_get('theme_default', 'garland'); + $default = variable_get(V_THEME_DEFAULT, 'garland'); foreach (list_themes() as $key => $theme) { $items['admin/build/block/list/' . $key] = array( 'title' => check_plain($theme->info['name']), @@ -168,7 +171,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(V_ADMIN_THEME, '0')); } /** @@ -531,7 +534,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(V_BLOCK_CACHE, 0) && $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.9 diff -u -F^f -r1.9 blog.pages.inc --- modules/blog/blog.pages.inc 13 May 2008 18:15:07 -0000 1.9 +++ modules/blog/blog.pages.inc 20 May 2008 20:39:56 -0000 @@ -6,6 +6,9 @@ * Page callback file for the blog module. */ +/** @variable V_DEFAULT_NODES_MAIN: TODO: add documentation **/ +define('V_DEFAULT_NODES_MAIN', 'default_nodes_main'); + /** * Menu callback; displays a Drupal page containing recent blog entries of a given user. */ @@ -25,7 +28,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(V_DEFAULT_NODES_MAIN, 10), 0, NULL, $account->uid); $has_posts = FALSE; while ($node = db_fetch_object($result)) { @@ -34,7 +37,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(V_DEFAULT_NODES_MAIN, 10)); } else { if ($account->uid == $user->uid) { @@ -64,7 +67,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(V_DEFAULT_NODES_MAIN, 10)); $has_posts = FALSE; while ($node = db_fetch_object($result)) { @@ -73,7 +76,7 @@ function blog_page_last() { } if ($has_posts) { - $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); + $output .= theme('pager', NULL, variable_get(V_DEFAULT_NODES_MAIN, 10)); } else { drupal_set_message(t('No blog entries have been created.')); @@ -87,7 +90,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(V_FEED_DEFAULT_ITEMS, 10)); $channel['title'] = $account->name . "'s blog"; $channel['link'] = url('blog/' . $account->uid, array('absolute' => TRUE)); @@ -102,8 +105,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(V_FEED_DEFAULT_ITEMS, 10)); + $channel['title'] = variable_get(V_SITE_NAME, 'Drupal') . ' 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.119 diff -u -F^f -r1.119 blogapi.module --- modules/blogapi/blogapi.module 13 May 2008 18:13:43 -0000 1.119 +++ modules/blogapi/blogapi.module 20 May 2008 20:39:56 -0000 @@ -6,6 +6,9 @@ * Enable users to post using applications that support XML-RPC blog APIs. */ +/** @variable V_BLOGAPI_NODE_TYPES: TODO: add documentation **/ +define('V_BLOGAPI_NODE_TYPES', 'blogapi_node_types'); + /** * Implementation of hook_help(). */ @@ -193,11 +196,11 @@ 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(V_NODE_OPTIONS_ . $edit['type'], array('status', 'promote')); $edit['uid'] = $user->uid; $edit['name'] = $user->name; $edit['promote'] = in_array('promote', $node_type_default); - $edit['comment'] = variable_get('comment_' . $edit['type'], 2); + $edit['comment'] = variable_get(V_COMMENT_ . $edit['type'], 2); $edit['revision'] = in_array('revision', $node_type_default); $edit['format'] = FILTER_FORMAT_DEFAULT; $edit['status'] = $publish; @@ -573,7 +576,7 @@ function blogapi_admin_settings() { '#type' => 'checkboxes', '#title' => t('Enable for external blogging clients'), '#required' => TRUE, - '#default_value' => variable_get('blogapi_node_types', $defaults), + '#default_value' => variable_get(V_BLOGAPI_NODE_TYPES, $defaults), '#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 +733,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(V_BLOGAPI_NODE_TYPES, array('blog' => 1)))); $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.10 diff -u -F^f -r1.10 book.admin.inc --- modules/book/book.admin.inc 15 May 2008 21:19:24 -0000 1.10 +++ modules/book/book.admin.inc 20 May 2008 20:39:56 -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(V_BOOK_ALLOWED_TYPES, array('book')), '#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(V_BOOK_CHILD_TYPE, 'book'), '#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.install =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.install,v retrieving revision 1.22 diff -u -F^f -r1.22 book.install --- modules/book/book.install 15 May 2008 21:19:24 -0000 1.22 +++ modules/book/book.install 20 May 2008 20:39:56 -0000 @@ -37,10 +37,10 @@ function _book_install_type_create() { $book_node_type = (object)_node_type_set_defaults($book_node_type); node_type_save($book_node_type); // Default to not promoted. - variable_set('node_options_book', array('status')); + variable_set(V_NODE_OPTIONS_BOOK, array('status')); // Use this default type for adding content to books. - variable_set('book_allowed_types', array('book')); - variable_set('book_child_type', 'book'); + variable_set(V_BOOK_ALLOWED_TYPES, array('book')); + variable_set(V_BOOK_CHILD_TYPE, 'book'); } /** Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.464 diff -u -F^f -r1.464 book.module --- modules/book/book.module 15 May 2008 21:19:24 -0000 1.464 +++ modules/book/book.module 20 May 2008 20:39:56 -0000 @@ -6,6 +6,15 @@ * Allows users to structure the pages of a site in a hierarchy or outline. */ +/** @variable V_BOOK_ALLOWED_TYPES: TODO: add documentation **/ +define('V_BOOK_ALLOWED_TYPES', 'book_allowed_types'); + +/** @variable V_BOOK_BLOCK_MODE: TODO: add documentation **/ +define('V_BOOK_BLOCK_MODE', 'book_block_mode'); + +/** @variable V_BOOK_CHILD_TYPE: TODO: add documentation **/ +define('V_BOOK_CHILD_TYPE', 'book_child_type'); + /** * Implementation of hook_theme(). */ @@ -56,7 +65,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(V_BOOK_CHILD_TYPE, 'book'); 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 +197,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(V_BOOK_BLOCK_MODE, 'all pages') == 'all pages') { $block['subject'] = t('Book navigation'); $book_menus = array(); $pseudo_tree = array(0 => array('below' => FALSE)); @@ -232,14 +241,14 @@ 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(V_BOOK_BLOCK_MODE, 'all pages'), '#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."), ); return $form; case 'save': - variable_set('book_block_mode', $edit['book_block_mode']); + variable_set(V_BOOK_BLOCK_MODE, $edit['book_block_mode']); break; } } @@ -332,7 +341,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(V_MENU_OVERRIDE_PARENT_SELECTOR, FALSE)) { return array(); } // Offer a message or a drop-down to choose a different parent page. @@ -676,7 +685,7 @@ function book_build_active_trail($book_l function book_nodeapi(&$node, $op, $teaser, $page) { switch ($op) { case 'load': - if (in_array($node->type, variable_get('book_allowed_types', array('book')))) { + if (in_array($node->type, variable_get(V_BOOK_ALLOWED_TYPES, array('book')))) { // Note - we cannot use book_link_load() because it will call node_load(). $info['book'] = db_fetch_array(db_query('SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid = %d', $node->nid)); @@ -1001,7 +1010,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(V_BOOK_ALLOWED_TYPES, array('book'))); } /** @@ -1015,18 +1024,18 @@ 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(V_BOOK_ALLOWED_TYPES, array('book')); $key = array_search($type->old_type, $allowed_types); if ($key !== FALSE) { $allowed_types[$type->type] = $allowed_types[$key] ? $type->type : 0; unset($allowed_types[$key]); - variable_set('book_allowed_types', $allowed_types); + variable_set(V_BOOK_ALLOWED_TYPES, $allowed_types); } // Update the setting for the "Add child page" link. - if (variable_get('book_child_type', 'book') == $type->old_type) { - variable_set('book_child_type', $type->type); + if (variable_get(V_BOOK_CHILD_TYPE, 'book') == $type->old_type) { + variable_set(V_BOOK_CHILD_TYPE, $type->type); } } break; Index: modules/color/color.module =================================================================== RCS file: /cvs/drupal/drupal/modules/color/color.module,v retrieving revision 1.40 diff -u -F^f -r1.40 color.module --- modules/color/color.module 14 Apr 2008 17:48:36 -0000 1.40 +++ modules/color/color.module 20 May 2008 20:39:56 -0000 @@ -1,6 +1,9 @@ download method is set to public.', array('@url' => url('admin/settings/file-system'))), 'warning'); @@ -54,7 +57,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(V_COLOR_ . $theme . '_screenshot', NULL)) { if (isset($form[$theme]['screenshot'])) { $form[$theme]['screenshot']['#value'] = theme('image', $screenshot, '', '', array('class' => 'screenshot'), FALSE); } @@ -70,7 +73,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(V_COLOR_ . $theme_key . '_stylesheets', array()); 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. @@ -110,7 +113,7 @@ function _color_page_alter(&$vars) { } // Override logo. - $logo = variable_get('color_' . $theme_key . '_logo', NULL); + $logo = variable_get(V_COLOR_ . $theme_key . '_logo', NULL); if ($logo && $vars['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $vars['logo'])) { $vars['logo'] = base_path() . $logo; } @@ -141,7 +144,7 @@ function color_get_palette($theme, $defa } // Load variable - return $default ? $palette : variable_get('color_' . $theme . '_palette', $palette); + return $default ? $palette : variable_get(V_COLOR_ . $theme . '_palette', $palette); } /** @@ -163,7 +166,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(V_COLOR_ . $theme . '_palette', array())); // Note: we use the original theme when the default scheme is chosen. $current = isset($info['schemes'][$current]) ? $current : ($current == '' ? reset($info['schemes']) : ''); @@ -274,7 +277,7 @@ function color_scheme_form_submit($form, } // Delete old files - foreach (variable_get('color_' . $theme . '_files', array()) as $file) { + foreach (variable_get(V_COLOR_ . $theme . '_files', array()) as $file) { @unlink($file); } if (isset($file) && $file = dirname($file)) { @@ -305,8 +308,8 @@ function color_scheme_form_submit($form, $paths['files'] = $paths['map'] = array(); // Save palette and logo location. - variable_set('color_' . $theme . '_palette', $palette); - variable_set('color_' . $theme . '_logo', $paths['target'] . 'logo.png'); + variable_set(V_COLOR_ . $theme . '_palette', $palette); + variable_set(V_COLOR_ . $theme . '_logo', $paths['target'] . 'logo.png'); // Copy over neutral images. foreach ($info['copy'] as $file) { @@ -359,8 +362,8 @@ function color_scheme_form_submit($form, } // Maintain list of files. - variable_set('color_' . $theme . '_stylesheets', $css); - variable_set('color_' . $theme . '_files', $paths['files']); + variable_set(V_COLOR_ . $theme . '_stylesheets', $css); + variable_set(V_COLOR_ . $theme . '_files', $paths['files']); } /** @@ -491,7 +494,7 @@ function _color_render_images($theme, &$ if ($file == 'screenshot.png') { $slice = imagecreatetruecolor(150, 90); imagecopyresampled($slice, $target, 0, 0, $x, $y, 150, 90, $width, $height); - variable_set('color_' . $theme . '_screenshot', $image); + variable_set(V_COLOR_ . $theme . '_screenshot', $image); } else { $slice = imagecreatetruecolor($width, $height); Index: modules/comment/comment.install =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v retrieving revision 1.22 diff -u -F^f -r1.22 comment.install --- modules/comment/comment.install 14 May 2008 13:12:40 -0000 1.22 +++ modules/comment/comment.install 20 May 2008 20:39:56 -0000 @@ -17,8 +17,8 @@ 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) { - variable_set('node_cron_last', min(time(), $last)); + if (($last = variable_get(V_NODE_CRON_LAST, FALSE)) !== FALSE) { + variable_set(V_NODE_CRON_LAST, min(time(), $last)); } return array(); Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.633 diff -u -F^f -r1.633 comment.module --- modules/comment/comment.module 14 May 2008 13:12:40 -0000 1.633 +++ modules/comment/comment.module 20 May 2008 20:39:57 -0000 @@ -10,6 +10,39 @@ * a forum topic, weblog post, story, collaborative book page, etc. */ +/** @variable V_ANONYMOUS: TODO: add documentation **/ +define('V_ANONYMOUS', 'anonymous'); + +/** @variable V_COMMENT_: TODO: add documentation **/ +define('V_COMMENT_', 'comment_'); + +/** @variable V_COMMENT_ANONYMOUS_: TODO: add documentation **/ +define('V_COMMENT_ANONYMOUS_', 'comment_anonymous_'); + +/** @variable V_COMMENT_BLOCK_COUNT: TODO: add documentation **/ +define('V_COMMENT_BLOCK_COUNT', 'comment_block_count'); + +/** @variable V_COMMENT_DEFAULT_MODE_: TODO: add documentation **/ +define('V_COMMENT_DEFAULT_MODE_', 'comment_default_mode_'); + +/** @variable V_COMMENT_DEFAULT_ORDER_: TODO: add documentation **/ +define('V_COMMENT_DEFAULT_ORDER_', 'comment_default_order_'); + +/** @variable V_COMMENT_DEFAULT_PER_PAGE_: TODO: add documentation **/ +define('V_COMMENT_DEFAULT_PER_PAGE_', 'comment_default_per_page_'); + +/** @variable V_COMMENT_FORM_LOCATION_: TODO: add documentation **/ +define('V_COMMENT_FORM_LOCATION_', 'comment_form_location_'); + +/** @variable V_COMMENT_PAGE: TODO: add documentation **/ +define('V_COMMENT_PAGE', 'comment_page'); + +/** @variable V_COMMENT_PREVIEW_: TODO: add documentation **/ +define('V_COMMENT_PREVIEW_', 'comment_preview_'); + +/** @variable V_COMMENT_SUBJECT_FIELD_: TODO: add documentation **/ +define('V_COMMENT_SUBJECT_FIELD_', 'comment_subject_field_'); + /** * Comment is published. */ @@ -268,7 +301,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(V_COMMENT_BLOCK_COUNT, 10), '#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.'), ); @@ -276,7 +309,7 @@ function comment_block($op = 'list', $de return $form; case 'save': - variable_set('comment_block_count', (int)$edit['comment_block_count']); + variable_set(V_COMMENT_BLOCK_COUNT, (int)$edit['comment_block_count']); break; case 'view': @@ -391,7 +424,7 @@ function comment_new_page_count($num_com */ function theme_comment_block() { $items = array(); - $number = variable_get('comment_block_count', 10); + $number = variable_get(V_COMMENT_BLOCK_COUNT, 10); 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))); } @@ -453,7 +486,7 @@ function comment_link($type, $node = NUL // if this node is not read-only, and if the comment form isn't already shown. if ($node->comment == COMMENT_NODE_READ_WRITE) { if (user_access('post comments')) { - if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { + if (variable_get(V_COMMENT_FORM_LOCATION_ . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { $links['comment_add'] = array( 'title' => t('Add new comment'), 'href' => "comment/reply/$node->nid", @@ -494,35 +527,35 @@ function comment_form_alter(&$form, $for $form['comment']['comment'] = array( '#type' => 'radios', '#title' => t('Default comment setting'), - '#default_value' => variable_get('comment_' . $form['#node_type']->type, COMMENT_NODE_READ_WRITE), + '#default_value' => variable_get(V_COMMENT_ . $form['#node_type']->type, COMMENT_NODE_READ_WRITE), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the administer comments permission will be able to override this setting.'), ); $form['comment']['comment_default_mode'] = array( '#type' => 'radios', '#title' => t('Default display mode'), - '#default_value' => variable_get('comment_default_mode_' . $form['#node_type']->type, COMMENT_MODE_THREADED_EXPANDED), + '#default_value' => variable_get(V_COMMENT_DEFAULT_MODE_ . $form['#node_type']->type, COMMENT_MODE_THREADED_EXPANDED), '#options' => _comment_get_modes(), '#description' => t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.'), ); $form['comment']['comment_default_order'] = array( '#type' => 'radios', '#title' => t('Default display order'), - '#default_value' => variable_get('comment_default_order_' . $form['#node_type']->type, COMMENT_ORDER_NEWEST_FIRST), + '#default_value' => variable_get(V_COMMENT_DEFAULT_ORDER_ . $form['#node_type']->type, COMMENT_ORDER_NEWEST_FIRST), '#options' => _comment_get_orders(), '#description' => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'), ); $form['comment']['comment_default_per_page'] = array( '#type' => 'select', '#title' => t('Default comments per page'), - '#default_value' => variable_get('comment_default_per_page_' . $form['#node_type']->type, 50), + '#default_value' => variable_get(V_COMMENT_DEFAULT_PER_PAGE_ . $form['#node_type']->type, 50), '#options' => _comment_per_page(), '#description' => t('Default number of comments for each page: more comments are distributed in several pages.'), ); $form['comment']['comment_anonymous'] = array( '#type' => 'radios', '#title' => t('Anonymous commenting'), - '#default_value' => variable_get('comment_anonymous_' . $form['#node_type']->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT), + '#default_value' => variable_get(V_COMMENT_ANONYMOUS_ . $form['#node_type']->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT), '#options' => array( COMMENT_ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'), COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'), @@ -537,21 +570,21 @@ function comment_form_alter(&$form, $for $form['comment']['comment_subject_field'] = array( '#type' => 'radios', '#title' => t('Comment subject field'), - '#default_value' => variable_get('comment_subject_field_' . $form['#node_type']->type, 1), + '#default_value' => variable_get(V_COMMENT_SUBJECT_FIELD_ . $form['#node_type']->type, 1), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Can users provide a unique subject for their comments?'), ); $form['comment']['comment_preview'] = array( '#type' => 'radios', '#title' => t('Preview comment'), - '#default_value' => variable_get('comment_preview_' . $form['#node_type']->type, COMMENT_PREVIEW_REQUIRED), + '#default_value' => variable_get(V_COMMENT_PREVIEW_ . $form['#node_type']->type, COMMENT_PREVIEW_REQUIRED), '#options' => array(t('Optional'), t('Required')), '#description' => t("Forces a user to look at their comment by clicking on a 'Preview' button before they can actually add the comment"), ); $form['comment']['comment_form_location'] = array( '#type' => 'radios', '#title' => t('Location of comment submission form'), - '#default_value' => variable_get('comment_form_location_' . $form['#node_type']->type, COMMENT_FORM_SEPARATE_PAGE), + '#default_value' => variable_get(V_COMMENT_FORM_LOCATION_ . $form['#node_type']->type, COMMENT_FORM_SEPARATE_PAGE), '#options' => array(t('Display on separate page'), t('Display below post or comments')), ); } @@ -1009,7 +1042,7 @@ function comment_render($node, $cid = 0) // If enabled, show new comment form if it's not already being displayed. $reply = arg(0) == 'comment' && arg(1) == 'reply'; - if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW) && !$reply) { + if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get(V_COMMENT_FORM_LOCATION_ . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW) && !$reply) { $output .= comment_form_box(array('nid' => $nid), t('Post new comment')); } $output = theme('comment_wrapper', $output, $node); @@ -1160,14 +1193,14 @@ function comment_validate($edit) { // Check validity of name, mail and homepage (if given). if (!$user->uid || isset($edit['is_anonymous'])) { $node = node_load($edit['nid']); - if (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) { + if (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) { if ($edit['name']) { $taken = db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE LOWER(name) = '%s'", $edit['name'])); if ($taken != 0) { form_set_error('name', t('The name you used belongs to a registered user.')); } } - elseif (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { + elseif (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { form_set_error('name', t('You have to leave your name.')); } @@ -1176,7 +1209,7 @@ function comment_validate($edit) { form_set_error('mail', t('The e-mail address you specified is not valid.')); } } - elseif (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { + elseif (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { form_set_error('mail', t('You have to leave an e-mail address.')); } @@ -1205,7 +1238,7 @@ function comment_form(&$form_state, $edi $op = isset($_POST['op']) ? $_POST['op'] : ''; $node = node_load($edit['nid']); - if (!$user->uid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { + if (!$user->uid && variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { drupal_add_js(drupal_get_path('module', 'comment') . '/comment.js'); } $edit += array('name' => '', 'mail' => '', 'homepage' => ''); @@ -1316,13 +1349,13 @@ function comment_form(&$form_state, $edi ); } } - elseif (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAY_CONTACT) { + elseif (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAY_CONTACT) { $form['name'] = array( '#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, - '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')), + '#default_value' => $edit['name'] ? $edit['name'] : variable_get(V_ANONYMOUS, t('Anonymous')), ); $form['mail'] = array( '#type' => 'textfield', @@ -1339,13 +1372,13 @@ function comment_form(&$form_state, $edi '#default_value' => $edit['homepage'], ); } - elseif (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { + elseif (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) { $form['name'] = array( '#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, - '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')), + '#default_value' => $edit['name'] ? $edit['name'] : variable_get(V_ANONYMOUS, t('Anonymous')), '#required' => TRUE, ); $form['mail'] = array( @@ -1365,7 +1398,7 @@ function comment_form(&$form_state, $edi ); } - if (variable_get('comment_subject_field_' . $node->type, 1) == 1) { + if (variable_get(V_COMMENT_SUBJECT_FIELD_ . $node->type, 1) == 1) { $form['subject'] = array( '#type' => 'textfield', '#title' => t('Subject'), @@ -1413,7 +1446,7 @@ function comment_form(&$form_state, $edi // Only show save button if preview is optional or if we are in preview mode. // We show the save button in preview mode even if there are form errors so that // optional form elements (e.g., captcha) can be updated in preview mode. - if (!form_get_errors() && ((variable_get('comment_preview_' . $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) { + if (!form_get_errors() && ((variable_get(V_COMMENT_PREVIEW_ . $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) { $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), @@ -1484,7 +1517,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(V_ANONYMOUS, t('Anonymous')); } $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : time(); @@ -1741,14 +1774,14 @@ function theme_comment_post_forbidden($n if ($authenticated_post_comments) { // We cannot use drupal_get_destination() because these links // sometimes appear on /node and taxonomy listing pages. - if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { + if (variable_get(V_COMMENT_FORM_LOCATION_ . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { $destination = 'destination=' . drupal_urlencode("comment/reply/$node->nid#comment-form"); } else { $destination = 'destination=' . drupal_urlencode("node/$node->nid#comment-form"); } - if (variable_get('user_register', 1)) { + if (variable_get(V_USER_REGISTER, 1)) { // 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)))); } @@ -1835,15 +1868,15 @@ function _comment_per_page() { function _comment_get_display_setting($setting, $node) { switch ($setting) { case 'mode': - $value = variable_get('comment_default_mode_' . $node->type, COMMENT_MODE_THREADED_EXPANDED); + $value = variable_get(V_COMMENT_DEFAULT_MODE_ . $node->type, COMMENT_MODE_THREADED_EXPANDED); break; case 'sort': - $value = variable_get('comment_default_order_' . $node->type, COMMENT_ORDER_NEWEST_FIRST); + $value = variable_get(V_COMMENT_DEFAULT_ORDER_ . $node->type, COMMENT_ORDER_NEWEST_FIRST); break; case 'comments_per_page': - $value = variable_get('comment_default_per_page_' . $node->type, 50); + $value = variable_get(V_COMMENT_DEFAULT_PER_PAGE_ . $node->type, 50); } return $value; @@ -2051,7 +2084,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(V_NODE_CRON_COMMENTS_SCALE, 0)), ), ); } Index: modules/contact/contact.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.admin.inc,v retrieving revision 1.4 diff -u -F^f -r1.4 contact.admin.inc --- modules/contact/contact.admin.inc 14 Apr 2008 17:48:36 -0000 1.4 +++ modules/contact/contact.admin.inc 20 May 2008 20:39:57 -0000 @@ -154,19 +154,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(V_CONTACT_FORM_INFORMATION, t('You can leave a message using the contact form below.')), '#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(V_CONTACT_HOURLY_THRESHOLD, 3), '#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(V_CONTACT_DEFAULT_STATUS, 1), '#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.107 diff -u -F^f -r1.107 contact.module --- modules/contact/contact.module 6 May 2008 12:18:47 -0000 1.107 +++ modules/contact/contact.module 20 May 2008 20:39:57 -0000 @@ -6,6 +6,15 @@ * Enables the use of personal and site-wide contact forms. */ +/** @variable V_CONTACT_DEFAULT_STATUS: TODO: add documentation **/ +define('V_CONTACT_DEFAULT_STATUS', 'contact_default_status'); + +/** @variable V_CONTACT_FORM_INFORMATION: TODO: add documentation **/ +define('V_CONTACT_FORM_INFORMATION', 'contact_form_information'); + +/** @variable V_CONTACT_HOURLY_THRESHOLD: TODO: add documentation **/ +define('V_CONTACT_HOURLY_THRESHOLD', 'contact_hourly_threshold'); + /** * Implementation of hook_help(). */ @@ -152,7 +161,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(V_CONTACT_DEFAULT_STATUS, 1); } } @@ -178,9 +187,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(V_SITE_NAME, 'Drupal') . '] ' . $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(V_SITE_NAME, 'Drupal')), $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.10 diff -u -F^f -r1.10 contact.pages.inc --- modules/contact/contact.pages.inc 19 Apr 2008 14:44:34 -0000 1.10 +++ modules/contact/contact.pages.inc 20 May 2008 20:39:57 -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(V_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(V_CONTACT_HOURLY_THRESHOLD, 3))); } 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('#value' => filter_xss_admin(variable_get('contact_form_information', t('You can leave a message using the contact form below.')))); + $form['contact_information'] = array('#value' => filter_xss_admin(variable_get(V_CONTACT_FORM_INFORMATION, t('You can leave a message using the contact form below.')))); $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(V_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(V_CONTACT_HOURLY_THRESHOLD, 3))); } 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.7 diff -u -F^f -r1.7 dblog.admin.inc --- modules/dblog/dblog.admin.inc 14 Apr 2008 17:48:36 -0000 1.7 +++ modules/dblog/dblog.admin.inc 20 May 2008 20:39:57 -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(V_DBLOG_ROW_LIMIT, 1000), '#options' => drupal_map_assoc(array(100, 1000, 10000, 100000, 1000000)), '#description' => t('The maximum number of rows to keep in the database log. Older entries will be automatically discarded. (Requires 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.25 diff -u -F^f -r1.25 dblog.module --- modules/dblog/dblog.module 6 May 2008 12:18:47 -0000 1.25 +++ modules/dblog/dblog.module 20 May 2008 20:39:57 -0000 @@ -12,6 +12,9 @@ * @see watchdog() */ +/** @variable V_DBLOG_ROW_LIMIT: TODO: add documentation **/ +define('V_DBLOG_ROW_LIMIT', 'dblog_row_limit'); + /** * Implementation of hook_help(). */ @@ -97,7 +100,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(V_DBLOG_ROW_LIMIT, 1000)); } /** Index: modules/filter/filter.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v retrieving revision 1.11 diff -u -F^f -r1.11 filter.admin.inc --- modules/filter/filter.admin.inc 14 Apr 2008 17:48:37 -0000 1.11 +++ modules/filter/filter.admin.inc 20 May 2008 20:39:57 -0000 @@ -28,7 +28,7 @@ function filter_admin_overview() { $roles[] = $name; } } - $default = ($id == variable_get('filter_default_format', 1)); + $default = ($id == variable_get(V_FILTER_DEFAULT_FORMAT, 1)); $options[$id] = ''; $form[$id]['name'] = array('#value' => $format->name); $form[$id]['roles'] = array('#value' => $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('#value' => $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(V_FILTER_DEFAULT_FORMAT, 1)); $form['submit'] = array('#type' => 'submit', '#value' => t('Save changes')); return $form; } @@ -45,7 +45,7 @@ function filter_admin_overview_submit($f // Process form submission to set the default format. if (is_numeric($form_state['values']['default'])) { drupal_set_message(t('Default format updated.')); - variable_set('filter_default_format', $form_state['values']['default']); + variable_set(V_FILTER_DEFAULT_FORMAT, $form_state['values']['default']); } foreach ($form_state['values'] as $id => $data) { if (is_array($data) && isset($data['weight'])) { @@ -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(V_FILTER_DEFAULT_FORMAT, 1)); 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(V_FILTER_DEFAULT_FORMAT, 1)) { $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(V_FILTER_DEFAULT_FORMAT, 1); // 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.install =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.install,v retrieving revision 1.9 diff -u -F^f -r1.9 filter.install --- modules/filter/filter.install 14 Apr 2008 17:48:37 -0000 1.9 +++ modules/filter/filter.install 20 May 2008 20:39:57 -0000 @@ -115,7 +115,7 @@ function filter_update_7001() { $result = db_query("SELECT format FROM {filter_formats}"); while ($format = db_fetch_object($result)) { // Deprecated constants FILTER_HTML_STRIP = 1 and FILTER_HTML_ESCAPE = 2. - if (variable_get('filter_html_' . $format->format, 1) == 2) { + if (variable_get(V_FILTER_HTML_ . $format->format, 1) == 2) { $ret[] = update_sql("INSERT INTO {filters} (format, module, delta, weight) VALUES (" . $format->format . ", 'filter', 4, 0)"); } variable_del('filter_html_' . $format->format); Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.213 diff -u -F^f -r1.213 filter.module --- modules/filter/filter.module 6 May 2008 12:18:47 -0000 1.213 +++ modules/filter/filter.module 20 May 2008 20:39:57 -0000 @@ -6,6 +6,18 @@ * Framework for handling filtering of content. */ +/** @variable V_FILTER_ALLOWED_PROTOCOLS: TODO: add documentation **/ +define('V_FILTER_ALLOWED_PROTOCOLS', 'filter_allowed_protocols'); + +/** @variable V_FILTER_DEFAULT_FORMAT: TODO: add documentation **/ +define('V_FILTER_DEFAULT_FORMAT', 'filter_default_format'); + +/** @variable V_FILTER_HTML_: TODO: add documentation **/ +define('V_FILTER_HTML_', 'filter_html_'); + +/** @variable V_FILTER_URL_LENGTH_: TODO: add documentation **/ +define('V_FILTER_URL_LENGTH_', 'filter_url_length_'); + /** * Special format ID which means "use the default format". * @@ -179,7 +191,7 @@ function filter_filter_tips($delta, $for $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(V_SITE_NAME, 'Drupal') . ''), '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 +315,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(V_FILTER_DEFAULT_FORMAT, 1); } $result = db_query($query . ' ORDER by weight', $args); @@ -348,7 +360,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(V_FILTER_DEFAULT_FORMAT, 1) : $format; } /** * Check if text in a certain input format is allowed to be cached. @@ -505,7 +517,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(V_FILTER_DEFAULT_FORMAT, 1), FALSE); $form['format']['guidelines'] = array( '#title' => t('Formatting guidelines'), '#value' => theme('filter_tips', $tips, FALSE, $extra), @@ -530,7 +542,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(V_FILTER_DEFAULT_FORMAT, 1))) { return TRUE; } else { @@ -706,7 +718,7 @@ function _filter_url_settings($format) { $form['filter_urlfilter']['filter_url_length_' . $format] = array( '#type' => 'textfield', '#title' => t('Maximum link text length'), - '#default_value' => variable_get('filter_url_length_' . $format, 72), + '#default_value' => variable_get(V_FILTER_URL_LENGTH_ . $format, 72), '#maxlength' => 4, '#description' => t('URLs longer than this number of characters will be truncated to prevent long strings that break formatting. The link itself will be retained; just the text portion of the link will be truncated.'), ); @@ -719,7 +731,7 @@ function _filter_url_settings($format) { */ function _filter_url($text, $format) { // Pass length to regexp callback - _filter_url_trim(NULL, variable_get('filter_url_length_' . $format, 72)); + _filter_url_trim(NULL, variable_get(V_FILTER_URL_LENGTH_ . $format, 72)); $text = ' ' . $text . ' '; @@ -1158,7 +1170,7 @@ 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('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'))); + $allowed_protocols = array_flip(variable_get(V_FILTER_ALLOWED_PROTOCOLS, array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'))); } // 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.10 diff -u -F^f -r1.10 forum.admin.inc --- modules/forum/forum.admin.inc 14 Apr 2008 17:48:37 -0000 1.10 +++ modules/forum/forum.admin.inc 20 May 2008 20:39:57 -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(V_FORUM_NAV_VOCABULARY, '')); $form['submit' ] = array('#type' => 'submit', '#value' => t('Save')); if ($edit['tid']) { $form['delete'] = array('#type' => 'submit', '#value' => t('Delete')); @@ -83,9 +83,9 @@ function forum_form_submit($form, &$form switch ($status) { case SAVED_NEW: if ($container) { - $containers = variable_get('forum_containers', array()); + $containers = variable_get(V_FORUM_CONTAINERS, array()); $containers[] = $form_state['values']['tid']; - variable_set('forum_containers', $containers); + variable_set(V_FORUM_CONTAINERS, $containers); } drupal_set_message(t('Created new @type %term.', array('%term' => $form_state['values']['name'], '@type' => $type))); break; @@ -138,7 +138,7 @@ function forum_form_container(&$form_sta $form['vid'] = array( '#type' => 'hidden', - '#value' => variable_get('forum_nav_vocabulary', ''), + '#value' => variable_get(V_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(V_FORUM_HOT_TOPIC, 15), '#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(V_FORUM_PER_PAGE, 25), '#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(V_FORUM_ORDER, '1'), '#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(V_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']['#value'] = 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(V_FORUM_CONTAINERS, array()))) { $form[$key]['edit']['#value'] = l(t('edit container'), 'admin/content/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(V_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.18 diff -u -F^f -r1.18 forum.install --- modules/forum/forum.install 10 Apr 2008 10:28:22 -0000 1.18 +++ modules/forum/forum.install 20 May 2008 20:39:57 -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(V_FORUM_NAV_VOCABULARY, 0))) { // Existing install. Add back forum node type, if the forums // vocabulary still exists. Keep all other node types intact there. $vocabulary = (array) $vocabulary; @@ -35,7 +35,7 @@ function forum_enable() { ); taxonomy_save_vocabulary($vocabulary); - variable_set('forum_nav_vocabulary', $vocabulary['vid']); + variable_set(V_FORUM_NAV_VOCABULARY, $vocabulary['vid']); } } @@ -47,7 +47,7 @@ function forum_uninstall() { drupal_load('module', 'taxonomy'); // Delete the vocabulary. - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get(V_FORUM_NAV_VOCABULARY, ''); taxonomy_del_vocabulary($vid); db_query("DELETE FROM {node} WHERE type = 'forum'"); @@ -109,7 +109,7 @@ function forum_schema() { function forum_update_6000() { $ret = array(); - $vid = variable_get('forum_nav_vocabulary', 0); + $vid = variable_get(V_FORUM_NAV_VOCABULARY, 0); $vocabularies = taxonomy_get_vocabularies(); if (!isset($vocabularies[$vid])) { $vocabulary = array( @@ -124,7 +124,7 @@ function forum_update_6000() { ); taxonomy_save_vocabulary($vocabulary); - variable_set('forum_nav_vocabulary', $vocabulary['vid']); + variable_set(V_FORUM_NAV_VOCABULARY, $vocabulary['vid']); } return $ret; Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.456 diff -u -F^f -r1.456 forum.module --- modules/forum/forum.module 6 May 2008 12:18:47 -0000 1.456 +++ modules/forum/forum.module 20 May 2008 20:39:57 -0000 @@ -6,6 +6,36 @@ * Enable threaded discussions about general topics. */ +/** @variable V_FORUM_BLOCK_NUM_: TODO: add documentation **/ +define('V_FORUM_BLOCK_NUM_', 'forum_block_num_'); + +/** @variable V_FORUM_BLOCK_NUM_0: TODO: add documentation **/ +define('V_FORUM_BLOCK_NUM_0', 'forum_block_num_0'); + +/** @variable V_FORUM_BLOCK_NUM_1: TODO: add documentation **/ +define('V_FORUM_BLOCK_NUM_1', 'forum_block_num_1'); + +/** @variable V_FORUM_BLOCK_NUM_ACTIVE: TODO: add documentation **/ +define('V_FORUM_BLOCK_NUM_ACTIVE', 'forum_block_num_active'); + +/** @variable V_FORUM_BLOCK_NUM_NEW: TODO: add documentation **/ +define('V_FORUM_BLOCK_NUM_NEW', 'forum_block_num_new'); + +/** @variable V_FORUM_CONTAINERS: TODO: add documentation **/ +define('V_FORUM_CONTAINERS', 'forum_containers'); + +/** @variable V_FORUM_HOT_TOPIC: TODO: add documentation **/ +define('V_FORUM_HOT_TOPIC', 'forum_hot_topic'); + +/** @variable V_FORUM_NAV_VOCABULARY: TODO: add documentation **/ +define('V_FORUM_NAV_VOCABULARY', 'forum_nav_vocabulary'); + +/** @variable V_FORUM_ORDER: TODO: add documentation **/ +define('V_FORUM_ORDER', 'forum_order'); + +/** @variable V_FORUM_PER_PAGE: TODO: add documentation **/ +define('V_FORUM_PER_PAGE', 'forum_per_page'); + /** * Implementation of hook_help(). */ @@ -28,7 +58,7 @@ function forum_help($path, $arg) { case 'admin/content/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/content/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(V_FORUM_NAV_VOCABULARY, '')))) . '

                    '; } } @@ -74,7 +104,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(V_FORUM_NAV_VOCABULARY, '')); return db_fetch_array($result); } @@ -163,7 +193,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(V_FORUM_NAV_VOCABULARY, ''); $vocabulary = taxonomy_vocabulary_load($vid); if (empty($vocabulary)) { return; @@ -220,7 +250,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(V_FORUM_CONTAINERS, array()); 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 +358,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(V_FORUM_NAV_VOCABULARY, '')) { switch ($type) { case 'term': $results = db_query('SELECT tn.nid FROM {term_node} tn WHERE tn.tid = %d', $term['tid']); @@ -338,12 +368,12 @@ 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(V_FORUM_CONTAINERS, array()); $key = array_search($term['tid'], $containers); if ($key !== FALSE) { unset($containers[$key]); } - variable_set('forum_containers', $containers); + variable_set(V_FORUM_CONTAINERS, $containers); break; case 'vocabulary': variable_del('forum_nav_vocabulary'); @@ -355,7 +385,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(V_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 +408,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(V_FORUM_NAV_VOCABULARY, ''); $form['taxonomy'][$vid]['#required'] = TRUE; $form['taxonomy'][$vid]['#options'][''] = t('- Please choose -'); } @@ -407,11 +437,11 @@ function forum_block($op = 'list', $delt return $blocks; case 'configure': - $form['forum_block_num_' . $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get('forum_block_num_' . $delta, '5'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20))); + $form['forum_block_num_' . $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get(V_FORUM_BLOCK_NUM_ . $delta, '5'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20))); return $form; case 'save': - variable_set('forum_block_num_' . $delta, $edit['forum_block_num_' . $delta]); + variable_set(V_FORUM_BLOCK_NUM_ . $delta, $edit['forum_block_num_' . $delta]); break; case 'view': @@ -420,14 +450,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(V_FORUM_NAV_VOCABULARY, ''), 0, variable_get(V_FORUM_BLOCK_NUM_ACTIVE, '5')); $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(V_FORUM_NAV_VOCABULARY, ''), 0, variable_get(V_FORUM_BLOCK_NUM_NEW, '5')); $content = node_title_list($result); break; } @@ -449,7 +479,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(V_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 +500,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(V_FORUM_NAV_VOCABULARY, ''); $term = taxonomy_get_term($tid); if ($term->vid == $vid) { $links[$module]['href'] = str_replace('taxonomy/term', 'forum', $link['href']); @@ -495,7 +525,7 @@ function forum_link_alter(&$links, $node function forum_get_forums($tid = 0) { $forums = array(); - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get(V_FORUM_NAV_VOCABULARY, ''); $_forums = taxonomy_get_tree($vid, $tid); if (count($_forums)) { @@ -511,7 +541,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(V_FORUM_CONTAINERS, array()))) { $forum->container = 1; } @@ -643,7 +673,7 @@ function _forum_new($tid) { function template_preprocess_forums(&$variables) { global $user; - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get(V_FORUM_NAV_VOCABULARY, ''); $vocabulary = taxonomy_vocabulary_load($vid); $title = !empty($vocabulary->name) ? $vocabulary->name : ''; @@ -699,7 +729,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(V_FORUM_CONTAINERS, array()))) { $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 +884,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(V_FORUM_HOT_TOPIC, 15); if ($variables['num_posts'] > $variables['hot_threshold']) { $variables['icon'] = $variables['new_posts'] ? 'hot-new' : 'hot'; } @@ -883,7 +913,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(V_FORUM_ORDER, 1)); $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 -F^f -r1.2 forum.pages.inc --- modules/forum/forum.pages.inc 26 Jul 2007 06:48:03 -0000 1.2 +++ modules/forum/forum.pages.inc 20 May 2008 20:39:57 -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(V_FORUM_PER_PAGE, 25); + $sortby = variable_get(V_FORUM_ORDER, 1); $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(V_FORUM_CONTAINERS, array()))) { $topics = forum_get_topics($tid, $sortby, $forum_per_page); } Index: modules/locale/locale.install =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.install,v retrieving revision 1.30 diff -u -F^f -r1.30 locale.install --- modules/locale/locale.install 14 Apr 2008 17:48:37 -0000 1.30 +++ modules/locale/locale.install 20 May 2008 20:39:57 -0000 @@ -104,11 +104,11 @@ function locale_update_6000() { // Save the language count in the variable table $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1')); - variable_set('language_count', $count); + variable_set(V_LANGUAGE_COUNT, $count); // Save the default language in the variable table $default = db_fetch_object(db_query('SELECT * FROM {locales_meta} WHERE isdefault = 1')); - variable_set('language_default', (object) array('language' => $default->locale, 'name' => $default->name, 'native' => '', 'direction' => 0, 'enabled' => 1, 'plurals' => $default->plurals, 'formula' => $default->formula, 'domain' => '', 'prefix' => $default->locale, 'weight' => 0)); + variable_set(V_LANGUAGE_DEFAULT, (object) array('language' => $default->locale, 'name' => $default->name, 'native' => '', 'direction' => 0, 'enabled' => 1, 'plurals' => $default->plurals, 'formula' => $default->formula, 'domain' => '', 'prefix' => $default->locale, 'weight' => 0)); $ret[] = update_sql("DROP TABLE {locales_meta}"); return $ret; @@ -172,11 +172,11 @@ function locale_update_6004() { function locale_update_6005() { foreach (node_get_types() as $type => $content_type) { // Default to NULL, so we can skip dealing with non-existent settings. - $setting = variable_get('language_' . $type, NULL); + $setting = variable_get(V_LANGUAGE_ . $type, NULL); if ($type == 'default' && is_numeric($setting)) { // language_default was overwritten with the content type setting, // so reset the default language and save the content type setting. - variable_set('language_content_type_default', $setting); + variable_set(V_LANGUAGE_CONTENT_TYPE_DEFAULT, $setting); variable_del('language_default'); drupal_set_message('The default language setting has been reset to its default value. Check the ' . l('language configuration page', 'admin/settings/language') . ' to configure it correctly.'); } @@ -185,19 +185,19 @@ function locale_update_6005() { // the negotiation setting or the content type setting. // The language_negotiation setting is not reset, but // the user is alerted that this setting possibly was overwritten - variable_set('language_content_type_negotiation', $setting); + variable_set(V_LANGUAGE_CONTENT_TYPE_NEGOTIATION, $setting); drupal_set_message('The language negotiation setting was possibly overwritten by a content type of the same name. Check the ' . l('language configuration page', 'admin/settings/language/configure') . ' and the ' . l('' . $content_type->name . " content type's multilingual support settings", 'admin/build/types/negotiation', array('html' => TRUE)) . ' to configure them correctly.'); } elseif (!is_null($setting)) { // Change the language setting variable for any other content type. // Do not worry about language_count, it will be updated below. - variable_set('language_content_type_' . $type, $setting); + variable_set(V_LANGUAGE_CONTENT_TYPE_ . $type, $setting); variable_del('language_' . $type); } } // Update language count variable that might be overwritten. $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1')); - variable_set('language_count', $count); + variable_set(V_LANGUAGE_COUNT, $count); return array(); } Index: modules/locale/locale.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v retrieving revision 1.217 diff -u -F^f -r1.217 locale.module --- modules/locale/locale.module 23 Apr 2008 20:01:52 -0000 1.217 +++ modules/locale/locale.module 20 May 2008 20:39:57 -0000 @@ -12,6 +12,18 @@ * Gettext portable object files are supported. */ +/** @variable V_JAVASCRIPT_PARSED: TODO: add documentation **/ +define('V_JAVASCRIPT_PARSED', 'javascript_parsed'); + +/** @variable V_LOCALE_CACHE_STRINGS: TODO: add documentation **/ +define('V_LOCALE_CACHE_STRINGS', 'locale_cache_strings'); + +/** @variable V_LOCALE_CUSTOM_STRINGS_: TODO: add documentation **/ +define('V_LOCALE_CUSTOM_STRINGS_', 'locale_custom_strings_'); + +/** @variable V_LOCALE_JS_DIRECTORY: TODO: add documentation **/ +define('V_LOCALE_JS_DIRECTORY', 'locale_js_directory'); + /** * Language written left to right. Possible value of $language->direction. */ @@ -219,7 +231,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(V_LANGUAGE_COUNT, 1) > 1 && ($type == 'register' && user_access('administer users') || $type == 'form' && $category == 'account' )) { $languages = language_list('enabled'); $languages = $languages[1]; @@ -238,7 +250,7 @@ function locale_user($type, $edit, &$use ); // Get language negotiation settings. - $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); + $mode = variable_get(V_LANGUAGE_NEGOTIATION, LANGUAGE_NEGOTIATION_NONE); $form['locale']['language'] = array( '#type' => (count($names) <= 5 ? 'radios' : 'select'), '#title' => t('Language'), @@ -274,7 +286,7 @@ function locale_form_alter(&$form, $form $form['workflow']['language_content_type'] = array( '#type' => 'radios', '#title' => t('Multilingual support'), - '#default_value' => variable_get('language_content_type_' . $form['#node_type']->type, 0), + '#default_value' => variable_get(V_LANGUAGE_CONTENT_TYPE_ . $form['#node_type']->type, 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the enabled languages. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/settings/language'))), ); @@ -284,7 +296,7 @@ function locale_form_alter(&$form, $form // Language field for nodes default: if (isset($form['#id']) && $form['#id'] == 'node-form') { - if (isset($form['#node']->type) && variable_get('language_content_type_' . $form['#node']->type, 0)) { + if (isset($form['#node']->type) && variable_get(V_LANGUAGE_CONTENT_TYPE_ . $form['#node']->type, 0)) { $form['language'] = array( '#type' => 'select', '#title' => t('Language'), @@ -355,7 +367,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(V_LOCALE_CACHE_STRINGS, 1) == 1) { if ($cache = cache_get('locale:' . $langcode, 'cache')) { $locale_t[$langcode] = $cache->data; } @@ -501,8 +513,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(V_LOCALE_JS_DIRECTORY, 'languages')); + $parsed = variable_get(V_JAVASCRIPT_PARSED, array()); // 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 @@ -544,12 +556,12 @@ function locale_update_js_files() { unset($parsed['refresh:' . $language->language]); } // Store any changes after refresh was attempted. - variable_set('javascript_parsed', $parsed); + variable_set(V_JAVASCRIPT_PARSED, $parsed); } // If no refresh was attempted, but we have new source files, we need // to store them too. This occurs if current page is in English. else if ($new_files) { - variable_set('javascript_parsed', $parsed); + variable_set(V_JAVASCRIPT_PARSED, $parsed); } // Add the translation JavaScript file to the page. @@ -575,7 +587,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(V_LANGUAGE_COUNT, 1) > 1 && variable_get(V_LANGUAGE_NEGOTIATION, LANGUAGE_NEGOTIATION_NONE) != 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.30 diff -u -F^f -r1.30 menu.admin.inc --- modules/menu/menu.admin.inc 14 Apr 2008 17:48:37 -0000 1.30 +++ modules/menu/menu.admin.inc 20 May 2008 20:39:58 -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', 'primary-links'), + '#default_value' => variable_get(V_MENU_DEFAULT_NODE_MENU, 'primary-links'), '#options' => $menu_options, '#description' => t('Choose the menu to be the default in the menu options in the content authoring form.'), ); - $primary = variable_get('menu_primary_links_source', 'primary-links'); + $primary = variable_get(V_MENU_PRIMARY_LINKS_SOURCE, 'primary-links'); $primary_options = array_merge($menu_options, array('' => t('No primary links'))); $form['menu_primary_links_source'] = array( '#type' => 'select', @@ -627,7 +627,7 @@ function menu_configure() { $form["menu_secondary_links_source"] = array( '#type' => 'select', '#title' => t('Source for the secondary links'), - '#default_value' => variable_get('menu_secondary_links_source', 'secondary-links'), + '#default_value' => variable_get(V_MENU_SECONDARY_LINKS_SOURCE, 'secondary-links'), '#options' => $secondary_options, '#tree' => FALSE, '#description' => t('Select what should be displayed as the secondary links. You can choose the same menu for secondary links as for primary links (currently %primary). If you do this, the children of the active primary menu link will be displayed as secondary links.', array('%primary' => $primary_options[$primary])), Index: modules/menu/menu.module =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v retrieving revision 1.164 diff -u -F^f -r1.164 menu.module --- modules/menu/menu.module 10 May 2008 06:52:32 -0000 1.164 +++ modules/menu/menu.module 20 May 2008 20:39:58 -0000 @@ -197,7 +197,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(V_MENU_OVERRIDE_PARENT_SELECTOR, FALSE)) { return array(); } // If the item has children, there is an added limit to the depth of valid parents. @@ -310,7 +310,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', 'primary-links'); + $menu_name = variable_get(V_MENU_DEFAULT_NODE_MENU, 'primary-links'); $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.53 diff -u -F^f -r1.53 content_types.inc --- modules/node/content_types.inc 13 May 2008 17:37:58 -0000 1.53 +++ modules/node/content_types.inc 20 May 2008 20:39:58 -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(V_NODE_OPTIONS_ . $type->type, array('status', 'promote')), '#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.22 diff -u -F^f -r1.22 node.admin.inc --- modules/node/node.admin.inc 14 Apr 2008 17:48:38 -0000 1.22 +++ modules/node/node.admin.inc 20 May 2008 20:39:58 -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(V_DEFAULT_NODES_MAIN, 10), '#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(V_TEASER_LENGTH, 600), '#options' => array( 0 => t('Unlimited'), 200 => t('200 characters'), @@ -54,7 +54,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(V_NODE_PREVIEW, 0), '#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.966 diff -u -F^f -r1.966 node.module --- modules/node/node.module 15 May 2008 21:40:31 -0000 1.966 +++ modules/node/node.module 20 May 2008 20:39:58 -0000 @@ -7,6 +7,39 @@ * programmatically submit nodes using the usual form API pattern. */ +/** @variable V_NODE_ACCESS_NEEDS_REBUILD: TODO: add documentation **/ +define('V_NODE_ACCESS_NEEDS_REBUILD', 'node_access_needs_rebuild'); + +/** @variable V_NODE_ADMIN_THEME: TODO: add documentation **/ +define('V_NODE_ADMIN_THEME', 'node_admin_theme'); + +/** @variable V_NODE_CRON_COMMENTS_SCALE: TODO: add documentation **/ +define('V_NODE_CRON_COMMENTS_SCALE', 'node_cron_comments_scale'); + +/** @variable V_NODE_CRON_LAST: TODO: add documentation **/ +define('V_NODE_CRON_LAST', 'node_cron_last'); + +/** @variable V_NODE_CRON_VIEWS_SCALE: TODO: add documentation **/ +define('V_NODE_CRON_VIEWS_SCALE', 'node_cron_views_scale'); + +/** @variable V_NODE_OPTIONS_: TODO: add documentation **/ +define('V_NODE_OPTIONS_', 'node_options_'); + +/** @variable V_NODE_OPTIONS_BOOK: TODO: add documentation **/ +define('V_NODE_OPTIONS_BOOK', 'node_options_book'); + +/** @variable V_NODE_OPTIONS_PAGE: TODO: add documentation **/ +define('V_NODE_OPTIONS_PAGE', 'node_options_page'); + +/** @variable V_NODE_PREVIEW: TODO: add documentation **/ +define('V_NODE_PREVIEW', 'node_preview'); + +/** @variable V_NODE_RANK_: TODO: add documentation **/ +define('V_NODE_RANK_', 'node_rank_'); + +/** @variable V_TEASER_LENGTH: TODO: add documentation **/ +define('V_TEASER_LENGTH', 'teaser_length'); + define('NODE_NEW_LIMIT', time() - 30 * 24 * 60 * 60); define('NODE_BUILD_NORMAL', 0); @@ -301,7 +334,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(V_TEASER_LENGTH, 600); } // Find where the delimiter is in the body @@ -1150,7 +1183,7 @@ function _node_rankings() { ); if ($ranking = module_invoke_all('ranking')) { foreach ($ranking as $rank => $values) { - if ($node_rank = variable_get('node_rank_'. $rank, 0)) { + if ($node_rank = variable_get(V_NODE_RANK_. $rank, 0)) { // If the table defined in the ranking isn't already joined, then add it. if (isset($values['join']) && !isset($rankings['join'][$values['join']])) { $rankings['join'][$values['join']] = $values['join']; @@ -1210,7 +1243,7 @@ function node_search($op = 'search', $ke '#title' => $values['title'], '#type' => 'select', '#options' => $options, - '#default_value' => variable_get('node_rank_'. $var, 0), + '#default_value' => variable_get(V_NODE_RANK_. $var, 0), ); } return $form; @@ -1329,7 +1362,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(V_NODE_CRON_LAST, 0)) { $ranking['recent'] = array( 'title' => t('Recently posted'), // Exponential decay with half-life of 6 months, starting at last indexed node @@ -1674,13 +1707,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(V_FEED_DEFAULT_ITEMS, 10)); while ($row = db_fetch_object($result)) { $nids[] = $row->nid; } } - $item_length = variable_get('feed_item_length', 'teaser'); + $item_length = variable_get(V_FEED_ITEM_LENGTH, 'teaser'); $namespaces = array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/'); $items = ''; @@ -1735,9 +1768,9 @@ function node_feed($nids = FALSE, $chann $channel_defaults = array( 'version' => '2.0', - 'title' => variable_get('site_name', 'Drupal'), + 'title' => variable_get(V_SITE_NAME, 'Drupal'), 'link' => $base_url, - 'description' => variable_get('site_mission', ''), + 'description' => variable_get(V_SITE_MISSION, ''), 'language' => $language->language ); $channel = array_merge($channel_defaults, $channel); @@ -1755,7 +1788,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(V_DEFAULT_NODES_MAIN, 10)); $output = ''; $num_rows = FALSE; @@ -1766,8 +1799,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(V_SITE_NAME, 'Drupal') . ' ' . t('RSS')); + $output .= theme('pager', NULL, variable_get(V_DEFAULT_NODES_MAIN, 10)); } else { $default_message = '

                    ' . t('Welcome to your new Drupal website!') . '

                    '; @@ -1799,11 +1832,11 @@ 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(V_SEARCH_CRON_LIMIT, 100); // Store the maximum possible comments per thread (used for ranking by reply count) - variable_set('node_cron_comments_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')))); - variable_set('node_cron_views_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(totalcount) FROM {node_counter}')))); + variable_set(V_NODE_CRON_COMMENTS_SCALE, 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')))); + variable_set(V_NODE_CRON_VIEWS_SCALE, 1.0 / max(1, db_result(db_query('SELECT MAX(totalcount) FROM {node_counter}')))); $result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit); @@ -1822,7 +1855,7 @@ function _node_index_node($node) { $node = node_load($node->nid); // save the changed time of the most recent indexed node, for the search results half-life calculation - variable_set('node_cron_last', $node->changed); + variable_set(V_NODE_CRON_LAST, $node->changed); // Build the node body. $node->build_mode = NODE_BUILD_SEARCH_INDEX; @@ -2298,10 +2331,10 @@ 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(V_NODE_ACCESS_NEEDS_REBUILD, FALSE); } elseif ($rebuild) { - variable_set('node_access_needs_rebuild', TRUE); + variable_set(V_NODE_ACCESS_NEEDS_REBUILD, TRUE); } else { variable_del('node_access_needs_rebuild'); Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.30 diff -u -F^f -r1.30 node.pages.inc --- modules/node/node.pages.inc 14 Apr 2008 17:48:38 -0000 1.30 +++ modules/node/node.pages.inc 20 May 2008 20:39: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(V_NODE_OPTIONS_ . $node->type, array('status', 'promote')); // If this is a new node, fill in the default values. if (!isset($node->nid)) { foreach (array('status', 'promote', 'sticky') as $key) { @@ -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(V_ANONYMOUS, t('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.25 diff -u -F^f -r1.25 openid.module --- modules/openid/openid.module 6 May 2008 12:18:48 -0000 1.25 +++ modules/openid/openid.module 20 May 2008 20:39:58 -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(V_USER_EMAIL_VERIFICATION, TRUE)) { 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(V_USER_EMAIL_VERIFICATION, TRUE)) { $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(V_USER_EMAIL_VERIFICATION, TRUE) || $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(V_USER_REGISTER, 1)) { // 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(V_USER_REGISTER, 1) == 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 -F^f -r1.8 path.admin.inc --- modules/path/path.admin.inc 14 Apr 2008 17:48:38 -0000 1.8 +++ modules/path/path.admin.inc 20 May 2008 20:39:58 -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(V_CLEAN_URL, 0) ? '' : '?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(V_CLEAN_URL, 0) ? '' : '?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.241 diff -u -F^f -r1.241 profile.module --- modules/profile/profile.module 6 May 2008 12:18:49 -0000 1.241 +++ modules/profile/profile.module 20 May 2008 20:39:59 -0000 @@ -6,6 +6,9 @@ * Support for configurable user profiles. */ +/** @variable V_PROFILE_BLOCK_AUTHOR_FIELDS: TODO: add documentation **/ +define('V_PROFILE_BLOCK_AUTHOR_FIELDS', 'profile_block_author_fields'); + /** * Private field, content only available to privileged users. */ @@ -146,14 +149,14 @@ 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(V_PROFILE_BLOCK_AUTHOR_FIELDS, array()), '#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'))), ); return $form; } else if ($op == 'save') { - variable_set('profile_block_author_fields', $edit['profile_block_author_fields']); + variable_set(V_PROFILE_BLOCK_AUTHOR_FIELDS, $edit['profile_block_author_fields']); } else if ($op == 'view') { if (user_access('access user profiles')) { @@ -162,7 +165,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(V_PROFILE_BLOCK_AUTHOR_FIELDS, array())) { // 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 +264,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(V_DATE_FORMAT_SHORT, 'm/d/Y - H:i'), 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.5 diff -u -F^f -r1.5 search.admin.inc --- modules/search/search.admin.inc 14 Apr 2008 17:48:41 -0000 1.5 +++ modules/search/search.admin.inc 20 May 2008 20:39:59 -0000 @@ -6,6 +6,9 @@ * Admin page callbacks for the search module. */ +/** @variable V_OVERLAP_CJK: TODO: add documentation **/ +define('V_OVERLAP_CJK', 'overlap_cjk'); + /** * Menu callback: confirm wiping of the index. */ @@ -55,12 +58,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(V_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')))); // Indexing settings: $form['indexing_settings'] = array('#type' => 'fieldset', '#title' => t('Indexing settings')); $form['indexing_settings']['info'] = array('#value' => 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(V_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(V_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['#validate'] = array('search_admin_settings_validate'); @@ -77,8 +80,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(V_MINIMUM_WORD_SIZE, 3) != $form_state['values']['minimum_word_size']) || + (variable_get(V_OVERLAP_CJK, TRUE) != $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.257 diff -u -F^f -r1.257 search.module --- modules/search/search.module 14 May 2008 15:07:25 -0000 1.257 +++ modules/search/search.module 20 May 2008 20:39:59 -0000 @@ -6,6 +6,15 @@ * Enables site-wide keyword searching. */ +/** @variable V_MINIMUM_WORD_SIZE: TODO: add documentation **/ +define('V_MINIMUM_WORD_SIZE', 'minimum_word_size'); + +/** @variable V_SEARCH_CRON_LIMIT: TODO: add documentation **/ +define('V_SEARCH_CRON_LIMIT', 'search_cron_limit'); + +/** @variable V_SEARCH_TAG_WEIGHTS: TODO: add documentation **/ +define('V_SEARCH_TAG_WEIGHTS', 'search_tag_weights'); + /** * Matches Unicode character classes to exclude from the search index. * @@ -312,7 +321,7 @@ function search_simplify($text) { search_invoke_preprocess($text); // Simple CJK handling - if (variable_get('overlap_cjk', TRUE)) { + if (variable_get(V_OVERLAP_CJK, TRUE)) { $text = preg_replace_callback('/[' . PREG_CLASS_CJK . ']+/u', 'search_expand_cjk', $text); } @@ -340,7 +349,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(V_MINIMUM_WORD_SIZE, 3); $str = $matches[0]; $l = drupal_strlen($str); // Passthrough short words @@ -417,7 +426,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(V_MINIMUM_WORD_SIZE, 3); // Link matching global $base_url; @@ -426,7 +435,7 @@ function search_index($sid, $type, $text // Multipliers for scores of words inside certain HTML tags. The weights are stored // in a variable so that modules can overwrite the default weights. // Note: 'a' must be included for link ranking to work. - $tags = variable_get('search_tag_weights', array( + $tags = variable_get(V_SEARCH_TAG_WEIGHTS, array( 'h1' => 25, 'h2' => 18, 'h3' => 15, @@ -844,7 +853,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(V_MINIMUM_WORD_SIZE, 3)) { $s = $num ? ((int)ltrim($s, '-0')) : $s; if (!isset($scores[$s])) { $scores[$s] = $s; @@ -916,7 +925,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(V_MINIMUM_WORD_SIZE, 3)))); } if ($query[6]) { if ($query[6] == 'or') { Index: modules/simpletest/drupal_test_suite.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_test_suite.php,v retrieving revision 1.3 diff -u -F^f -r1.3 drupal_test_suite.php --- modules/simpletest/drupal_test_suite.php 6 May 2008 11:21:10 -0000 1.3 +++ modules/simpletest/drupal_test_suite.php 20 May 2008 20:39:59 -0000 @@ -143,7 +143,7 @@ function cleanupBeforeRun() { cache_clear_all(); // Disable devel output, check simpletest settings page. - if (!variable_get('simpletest_devel', FALSE)) { + if (!variable_get(V_SIMPLETEST_DEVEL, FALSE)) { $GLOBALS['devel_shutdown'] = FALSE; } } Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.6 diff -u -F^f -r1.6 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 16 May 2008 02:09:22 -0000 1.6 +++ modules/simpletest/drupal_web_test_case.php 20 May 2008 20:39:59 -0000 @@ -1,6 +1,9 @@ db_prefix_original = $db_prefix; - $clean_url_original = variable_get('clean_url', 0); + $clean_url_original = variable_get(V_CLEAN_URL, 0); $db_prefix = 'simpletest' . mt_rand(1000, 1000000); include_once './includes/install.inc'; drupal_install_system(); @@ -369,13 +372,13 @@ menu_rebuild(); actions_synchronize(); _drupal_flush_css_js(); - variable_set('install_profile', 'default'); - variable_set('install_task', 'profile-finished'); - variable_set('clean_url', $clean_url_original); + variable_set(V_INSTALL_PROFILE, 'default'); + variable_set(V_INSTALL_TASK, 'profile-finished'); + variable_set(V_CLEAN_URL, $clean_url_original); // Use temporary files directory with the same prefix as database. $this->original_file_directory = file_directory_path(); - variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix); + variable_set(V_FILE_DIRECTORY_PATH, file_directory_path() . '/' . $db_prefix); file_check_directory(file_directory_path(), TRUE); // Create the files directory. parent::setUp(); } @@ -389,7 +392,7 @@ if (preg_match('/simpletest\d+/', $db_prefix)) { // Delete temporary files directory and reset files directory path. simpletest_clean_temporary_directory(file_directory_path()); - variable_set('file_directory_path', $this->original_file_directory); + variable_set(V_FILE_DIRECTORY_PATH, $this->original_file_directory); $schema = drupal_get_schema(NULL, TRUE); $ret = array(); @@ -436,8 +439,8 @@ 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(V_SIMPLETEST_HTTPAUTH_USERNAME, ''))) { + if ($pass = variable_get(V_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.3 diff -u -F^f -r1.3 simpletest.module --- modules/simpletest/simpletest.module 10 May 2008 07:46:22 -0000 1.3 +++ modules/simpletest/simpletest.module 20 May 2008 20:39:59 -0000 @@ -1,6 +1,18 @@ 'checkbox', '#title' => t('Use http authentication'), - '#default_value' => variable_get('simpletest_httpauth', FALSE), + '#default_value' => variable_get(V_SIMPLETEST_HTTPAUTH, FALSE), ); $form['http_auth']['simpletest_httpauth_username'] = array( '#type' => 'textfield', '#title' => t('Username'), - '#default_value' => variable_get('simpletest_httpauth_username', ''), + '#default_value' => variable_get(V_SIMPLETEST_HTTPAUTH_USERNAME, ''), ); $form['http_auth']['simpletest_httpauth_pass'] = array( '#title' => t('Password'), '#type' => 'password', - '#default_value' => variable_get('simpletest_httpauth_pass', ''), + '#default_value' => variable_get(V_SIMPLETEST_HTTPAUTH_PASS, ''), ); $form['devel'] = array( '#type' => 'fieldset', @@ -469,7 +481,7 @@ function simpletest_settings() { $form['devel']['simpletest_devel'] = array( '#type' => 'checkbox', '#title' => t('Use devel query log on test result pages'), - '#default_value' => variable_get('simpletest_devel', FALSE), + '#default_value' => variable_get(V_SIMPLETEST_DEVEL, FALSE), ); return system_settings_form($form); Index: modules/statistics/statistics.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v retrieving revision 1.8 diff -u -F^f -r1.8 statistics.admin.inc --- modules/statistics/statistics.admin.inc 7 May 2008 19:17:50 -0000 1.8 +++ modules/statistics/statistics.admin.inc 20 May 2008 20:40:00 -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(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200))))); $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(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200))))); $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(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200))))); $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(V_STATISTICS_ENABLE_ACCESS_LOG, 0), '#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(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200), '#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(V_STATISTICS_COUNT_CONTENT_VIEWS, 0), '#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.278 diff -u -F^f -r1.278 statistics.module --- modules/statistics/statistics.module 14 May 2008 11:10:54 -0000 1.278 +++ modules/statistics/statistics.module 20 May 2008 20:40:00 -0000 @@ -6,6 +6,27 @@ * Logs access statistics for your site. */ +/** @variable V_STATISTICS_BLOCK_TOP_ALL_NUM: TODO: add documentation **/ +define('V_STATISTICS_BLOCK_TOP_ALL_NUM', 'statistics_block_top_all_num'); + +/** @variable V_STATISTICS_BLOCK_TOP_DAY_NUM: TODO: add documentation **/ +define('V_STATISTICS_BLOCK_TOP_DAY_NUM', 'statistics_block_top_day_num'); + +/** @variable V_STATISTICS_BLOCK_TOP_LAST_NUM: TODO: add documentation **/ +define('V_STATISTICS_BLOCK_TOP_LAST_NUM', 'statistics_block_top_last_num'); + +/** @variable V_STATISTICS_COUNT_CONTENT_VIEWS: TODO: add documentation **/ +define('V_STATISTICS_COUNT_CONTENT_VIEWS', 'statistics_count_content_views'); + +/** @variable V_STATISTICS_DAY_TIMESTAMP: TODO: add documentation **/ +define('V_STATISTICS_DAY_TIMESTAMP', 'statistics_day_timestamp'); + +/** @variable V_STATISTICS_ENABLE_ACCESS_LOG: TODO: add documentation **/ +define('V_STATISTICS_ENABLE_ACCESS_LOG', 'statistics_enable_access_log'); + +/** @variable V_STATISTICS_FLUSH_ACCESSLOG_TIMER: TODO: add documentation **/ +define('V_STATISTICS_FLUSH_ACCESSLOG_TIMER', 'statistics_flush_accesslog_timer'); + /** * Implementation of hook_help(). */ @@ -47,7 +68,7 @@ function statistics_exit() { drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); - if (variable_get('statistics_count_content_views', 0)) { + if (variable_get(V_STATISTICS_COUNT_CONTENT_VIEWS, 0)) { // 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 +80,7 @@ function statistics_exit() { } } } - if (variable_get('statistics_enable_access_log', 0)) { + if (variable_get(V_STATISTICS_ENABLE_ACCESS_LOG, 0)) { // 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,16 +193,16 @@ function statistics_user($op, &$edit, &$ * Implementation of hook_cron(). */ function statistics_cron() { - $statistics_timestamp = variable_get('statistics_day_timestamp', ''); + $statistics_timestamp = variable_get(V_STATISTICS_DAY_TIMESTAMP, ''); if ((time() - $statistics_timestamp) >= 86400) { // Reset day counts. db_query('UPDATE {node_counter} SET daycount = 0'); - variable_set('statistics_day_timestamp', time()); + variable_set(V_STATISTICS_DAY_TIMESTAMP, time()); } // 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(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200)); } /** @@ -237,7 +258,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(V_STATISTICS_COUNT_CONTENT_VIEWS, 0)) { $blocks['popular']['info'] = t('Popular content'); // Too dynamic to cache. $blocks['popular']['cache'] = BLOCK_NO_CACHE; @@ -248,32 +269,32 @@ 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(V_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(V_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(V_STATISTICS_BLOCK_TOP_LAST_NUM, 0), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.')); return $form; case 'save': - variable_set('statistics_block_top_day_num', $edit['statistics_block_top_day_num']); - variable_set('statistics_block_top_all_num', $edit['statistics_block_top_all_num']); - variable_set('statistics_block_top_last_num', $edit['statistics_block_top_last_num']); + variable_set(V_STATISTICS_BLOCK_TOP_DAY_NUM, $edit['statistics_block_top_day_num']); + variable_set(V_STATISTICS_BLOCK_TOP_ALL_NUM, $edit['statistics_block_top_all_num']); + variable_set(V_STATISTICS_BLOCK_TOP_LAST_NUM, $edit['statistics_block_top_last_num']); break; case 'view': if (user_access('access content')) { $content = array(); - $daytop = variable_get('statistics_block_top_day_num', 0); + $daytop = variable_get(V_STATISTICS_BLOCK_TOP_DAY_NUM, 0); 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(V_STATISTICS_BLOCK_TOP_ALL_NUM, 0); 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(V_STATISTICS_BLOCK_TOP_LAST_NUM, 0); if ($lasttop && ($result = statistics_title_list('timestamp', $lasttop)) && ($node_title_list = node_title_list($result, t('Last viewed:')))) { $content[] = $node_title_list; } @@ -319,14 +340,14 @@ function statistics_nodeapi(&$node, $op, * Implementation of hook_ranking(). */ function statistics_ranking() { - if (variable_get('statistics_count_content_views', 0)) { + if (variable_get(V_STATISTICS_COUNT_CONTENT_VIEWS, 0)) { 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(V_NODE_CRON_VIEWS_SCALE, 0)), ), ); } Index: modules/syslog/syslog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/syslog/syslog.module,v retrieving revision 1.16 diff -u -F^f -r1.16 syslog.module --- modules/syslog/syslog.module 23 Apr 2008 20:01:53 -0000 1.16 +++ modules/syslog/syslog.module 20 May 2008 20:40:00 -0000 @@ -6,6 +6,9 @@ * Redirects logging messages to syslog. */ +/** @variable V_SYSLOG_FACILITY: TODO: add documentation **/ +define('V_SYSLOG_FACILITY', 'syslog_facility'); + if (defined('LOG_LOCAL0')) { define('DEFAULT_SYSLOG_FACILITY', LOG_LOCAL0); } @@ -41,7 +44,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(V_SYSLOG_FACILITY, DEFAULT_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'), @@ -75,7 +78,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(V_SYSLOG_FACILITY, DEFAULT_SYSLOG_FACILITY)); } syslog($entry['severity'], theme('syslog_format', $entry)); Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.76 diff -u -F^f -r1.76 system.admin.inc --- modules/system/system.admin.inc 10 May 2008 07:32:02 -0000 1.76 +++ modules/system/system.admin.inc 20 May 2008 20:40:00 -0000 @@ -6,6 +6,24 @@ * Admin page callbacks for the system module. */ +/** @variable V_CLEAN_URL: TODO: add documentation **/ +define('V_CLEAN_URL', 'clean_url'); + +/** @variable V_DATE_FIRST_DAY: TODO: add documentation **/ +define('V_DATE_FIRST_DAY', 'date_first_day'); + +/** @variable V_DATE_FORMAT_LONG_CUSTOM: TODO: add documentation **/ +define('V_DATE_FORMAT_LONG_CUSTOM', 'date_format_long_custom'); + +/** @variable V_DATE_FORMAT_MEDIUM_CUSTOM: TODO: add documentation **/ +define('V_DATE_FORMAT_MEDIUM_CUSTOM', 'date_format_medium_custom'); + +/** @variable V_DATE_FORMAT_SHORT_CUSTOM: TODO: add documentation **/ +define('V_DATE_FORMAT_SHORT_CUSTOM', 'date_format_short_custom'); + +/** @variable V_IMAGE_TOOLKIT: TODO: add documentation **/ +define('V_IMAGE_TOOLKIT', 'image_toolkit'); + /** * Menu callback; Provide the administration overview page. */ @@ -153,14 +171,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(V_ADMIN_THEME, '0'), ); $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(V_NODE_ADMIN_THEME, '0'), ); $form['#submit'][] = 'system_admin_theme_submit'; @@ -203,7 +221,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(V_ADMIN_THEME, '0')) { $form[$theme->name]['operations'] = array('#value' => l(t('configure'), 'admin/build/themes/settings/' . $theme->name) ); } else { @@ -234,7 +252,7 @@ function system_themes_form() { $form['theme_default'] = array( '#type' => 'radios', '#options' => $options, - '#default_value' => variable_get('theme_default', 'garland'), + '#default_value' => variable_get(V_THEME_DEFAULT, 'garland'), ); $form['buttons']['submit'] = array( '#type' => 'submit', @@ -272,14 +290,14 @@ 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(V_ADMIN_THEME, '0')) != '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, '%selected_theme' => $form_state['values']['theme_default'], ))); } - variable_set('theme_default', $form_state['values']['theme_default']); + variable_set(V_THEME_DEFAULT, $form_state['values']['theme_default']); } else { // Revert to defaults: only Garland is enabled. @@ -376,7 +394,7 @@ function system_theme_settings(&$form_st // Some features are not always available $disabled = array(); - if (!variable_get('user_pictures', 0)) { + if (!variable_get(V_USER_PICTURES, 0)) { $disabled['toggle_node_user_picture'] = TRUE; $disabled['toggle_comment_user_picture'] = TRUE; } @@ -1191,49 +1209,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(V_SITE_NAME, 'Drupal'), '#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(V_SITE_MAIL, ini_get('sendmail_from')), '#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(V_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(V_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(V_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(V_ANONYMOUS, t('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(V_SITE_FRONTPAGE, 'node'), '#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(V_CLEAN_URL, 0) ? '' : '?q='), '#required' => TRUE, ); $form['#validate'][] = 'system_site_information_settings_validate'; @@ -1272,23 +1290,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(V_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(V_CLEAN_URL, 0) ? '' : '?q=') ); $form['site_404'] = array( '#type' => 'textfield', '#title' => t('Default 404 (not found) page'), - '#default_value' => variable_get('site_404', ''), + '#default_value' => variable_get(V_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(V_CLEAN_URL, 0) ? '' : '?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(V_ERROR_LEVEL, 1), '#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.') ); @@ -1336,7 +1354,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(V_CACHE, CACHE_DISABLED), '#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 ); @@ -1346,14 +1364,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(V_CACHE_LIFETIME, 0), '#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(V_PAGE_COMPRESSION, TRUE), '#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."), ); @@ -1367,7 +1385,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(V_BLOCK_CACHE, CACHE_DISABLED), '#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.'), @@ -1380,11 +1398,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(V_FILE_DOWNLOADS, FILE_DOWNLOADS_PUBLIC) == 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(V_PREPROCESS_CSS, 0) && $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.'), @@ -1392,7 +1410,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(V_PREPROCESS_JS, 0) && $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.'), @@ -1455,7 +1473,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(V_FILE_DOWNLOADS, FILE_DOWNLOADS_PUBLIC), '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using HTTP directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')), '#description' => t('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.') ); @@ -1475,12 +1493,12 @@ 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(V_IMAGE_TOOLKIT, image_get_toolkit()), '#options' => $toolkits_available ); } elseif (count($toolkits_available) == 1) { - variable_set('image_toolkit', key($toolkits_available)); + variable_set(V_IMAGE_TOOLKIT, key($toolkits_available)); } $form['image_toolkit_settings'] = image_toolkit_invoke('settings'); @@ -1499,14 +1517,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(V_FEED_DEFAULT_ITEMS, 10), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), '#description' => t('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(V_FEED_ITEM_LENGTH, 'teaser'), '#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')), '#description' => t('Global setting for the default display of content items in each feed.') ); @@ -1561,7 +1579,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(V_DATE_DEFAULT_TIMEZONE, 0), '#options' => $zones, '#description' => t('Select the default site time zone.') ); @@ -1569,7 +1587,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(V_CONFIGURABLE_TIMEZONES, 1), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('When enabled, users can set their own time zone and dates will be displayed accordingly.') ); @@ -1577,7 +1595,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(V_DATE_FIRST_DAY, 0), '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')), '#description' => t('The first day of the week for calendar views.') ); @@ -1587,7 +1605,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(V_DATE_FORMAT_SHORT, $date_short[1]); $form['date_formats']['date_format_short'] = array( '#prefix' => '
                    ', '#suffix' => '
                    ', @@ -1599,7 +1617,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(V_DATE_FORMAT_SHORT_CUSTOM, (isset($date_short_choices[$date_format_short]) ? $date_format_short : '')); $form['date_formats']['date_format_short_custom'] = array( '#prefix' => '
                    ', '#suffix' => '
                    ', @@ -1610,7 +1628,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(V_DATE_FORMAT_MEDIUM, $date_medium[1]); $form['date_formats']['date_format_medium'] = array( '#prefix' => '
                    ', '#suffix' => '
                    ', @@ -1622,7 +1640,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(V_DATE_FORMAT_MEDIUM_CUSTOM, (isset($date_medium_choices[$date_format_medium]) ? $date_format_medium : '')); $form['date_formats']['date_format_medium_custom'] = array( '#prefix' => '
                    ', '#suffix' => '
                    ', @@ -1633,7 +1651,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(V_DATE_FORMAT_LONG, $date_long[0]); $form['date_formats']['date_format_long'] = array( '#prefix' => '
                    ', '#suffix' => '
                    ', @@ -1645,7 +1663,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(V_DATE_FORMAT_LONG_CUSTOM, (isset($date_long_choices[$date_format_long]) ? $date_format_long : '')); $form['date_formats']['date_format_long_custom'] = array( '#prefix' => '
                    ', '#suffix' => '
                    ', @@ -1698,7 +1716,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(V_SITE_OFFLINE, 0), '#options' => array(t('Online'), t('Off-line')), '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", 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 off-line message configured below. Authorized users can log in during "Off-line" mode directly via the user login page.', array('@user-login' => url('user'))), ); @@ -1706,7 +1724,7 @@ function system_site_maintenance_setting $form['site_offline_message'] = array( '#type' => 'textarea', '#title' => t('Site off-line 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(V_SITE_OFFLINE_MESSAGE, t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get(V_SITE_NAME, 'Drupal')))), '#description' => t('Message to show visitors when the site is in off-line mode.') ); @@ -1723,12 +1741,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(V_CLEAN_URL, 0), '#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(V_CLEAN_URL, 0)) { 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.254 diff -u -F^f -r1.254 system.install --- modules/system/system.install 15 May 2008 20:55:58 -0000 1.254 +++ modules/system/system.install 20 May 2008 20:40:00 -0000 @@ -1,6 +1,18 @@ 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(V_CRON_LAST, NULL); $never_run = FALSE; if (!is_numeric($cron_last)) { $never_run = TRUE; - $cron_last = variable_get('install_time', 0); + $cron_last = variable_get(V_INSTALL_TIME, 0); } // Determine severity based on time since cron last ran. @@ -171,7 +183,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(V_CRON_KEY, 'drupal'))))); $requirements['cron'] = array( 'title' => $t('Cron maintenance tasks'), @@ -219,7 +231,7 @@ function system_requirements($phase) { } } else { - if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) { + if (variable_get(V_FILE_DOWNLOADS, FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) { $requirements['file system']['value'] = $t('Writable (public download method)'); } else { @@ -284,7 +296,7 @@ function system_requirements($phase) { $requirements['update status'] = array( 'value' => $t('Enabled'), ); - if (variable_get('drupal_http_request_fails', FALSE)) { + if (variable_get(V_DRUPAL_HTTP_REQUEST_FAILS, FALSE)) { $requirements['http requests'] = array( 'title' => $t('HTTP request status'), 'value' => $t('Fails'), @@ -1292,7 +1304,7 @@ function system_update_1022() { $ret = array(); db_add_index($ret, 'users', 'created', array('created')); // Also appears as system_update_6004(). Ensure we don't update twice. - variable_set('system_update_1022', TRUE); + variable_set(V_SYSTEM_UPDATE_1022, TRUE); return $ret; } @@ -1548,9 +1560,9 @@ function system_update_6013() { * possible to run the installer on upgraded sites. */ function system_update_6014() { - variable_set('install_task', 'done'); + variable_set(V_INSTALL_TASK, 'done'); - return array(array('success' => TRUE, 'query' => "variable_set('install_task')")); + return array(array('success' => TRUE, 'query' => "variable_set(V_INSTALL_TASK)")); } /** @@ -2010,7 +2022,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(V_MENU_PRIMARY_MENU, 0); // 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 +2049,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(V_MENU_SECONDARY_MENU, 0); // 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,18 +2074,18 @@ function system_update_6021() { } // Update menu OTF preferences. - $mid = variable_get('menu_parent_items', 0); + $mid = variable_get(V_MENU_PARENT_ITEMS, 0); $menu_name = ($mid && isset($_SESSION['menu_menu_map'][$mid])) ? $_SESSION['menu_menu_map'][$mid] : 'navigation'; - variable_set('menu_default_node_menu', $menu_name); + variable_set(V_MENU_DEFAULT_NODE_MENU, $menu_name); variable_del('menu_parent_items'); // Update the source of the primary and secondary links. $menu_name = ($menu_primary_menu && isset($_SESSION['menu_menu_map'][$menu_primary_menu])) ? $_SESSION['menu_menu_map'][$menu_primary_menu] : ''; - variable_set('menu_primary_links_source', $menu_name); + variable_set(V_MENU_PRIMARY_LINKS_SOURCE, $menu_name); variable_del('menu_primary_menu'); $menu_name = ($menu_secondary_menu && isset($_SESSION['menu_menu_map'][$menu_secondary_menu])) ? $_SESSION['menu_menu_map'][$menu_secondary_menu] : ''; - variable_set('menu_secondary_links_source', $menu_name); + variable_set(V_MENU_SECONDARY_LINKS_SOURCE, $menu_name); variable_del('menu_secondary_menu'); // Skip the navigation menu - it is handled by the user module. @@ -2485,7 +2497,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(V_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,9 +2510,9 @@ function system_update_6041() { */ function system_update_6042() { foreach (list_themes() as $theme) { - $stylesheet = variable_get('color_' . $theme->name . '_stylesheet', NULL); + $stylesheet = variable_get(V_COLOR_ . $theme->name . '_stylesheet', NULL); if (!empty($stylesheet)) { - variable_set('color_' . $theme->name . '_stylesheets', array($stylesheet)); + variable_set(V_COLOR_ . $theme->name . '_stylesheets', array($stylesheet)); variable_del('color_' . $theme->name . '_stylesheet'); } } @@ -2598,7 +2610,7 @@ function system_update_6043() { db_add_index($ret, 'vocabulary_node_types', 'vid', array('vid')); } // If we updated in RC1 or before ensure we don't update twice. - variable_set('system_update_6043_RC2', TRUE); + variable_set(V_SYSTEM_UPDATE_6043_RC2, TRUE); return $ret; } @@ -2613,7 +2625,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(V_SYSTEM_UPDATE_6043_RC2, FALSE)) { variable_del('system_update_6043_RC2'); return $ret; } @@ -2677,9 +2689,9 @@ function system_update_6045() { */ function system_update_6046() { $ret = array(); - if (!variable_get('file_directory_path', FALSE)) { - variable_set('file_directory_path', 'files'); - $ret[] = array('success' => TRUE, 'query' => "variable_set('file_directory_path')"); + if (!variable_get(V_FILE_DIRECTORY_PATH, FALSE)) { + variable_set(V_FILE_DIRECTORY_PATH, 'files'); + $ret[] = array('success' => TRUE, 'query' => "variable_set(V_FILE_DIRECTORY_PATH)"); } return $ret; } @@ -2736,8 +2748,8 @@ function system_update_7000() { */ function system_update_7001() { $ret = array(); - variable_set('cron_key', md5(mt_rand())); - $ret[] = array('success' => TRUE, 'query' => "variable_set('cron_key')"); + variable_set(V_CRON_KEY, md5(mt_rand())); + $ret[] = array('success' => TRUE, 'query' => "variable_set(V_CRON_KEY)"); return $ret; } @@ -2848,14 +2860,14 @@ 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(V_FORUM_BLOCK_NUM_0, NULL); if (isset($forum_block_num_0)) { - variable_set('forum_block_num_active', $forum_block_num_0); + variable_set(V_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(V_FORUM_BLOCK_NUM_1, NULL); if (isset($forum_block_num_1)) { - variable_set('forum_block_num_new', $forum_block_num_1); + variable_set(V_FORUM_BLOCK_NUM_NEW, $forum_block_num_1); variable_del('forum_block_num_1'); } // Initialize batch update information. Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.602 diff -u -F^f -r1.602 system.module --- modules/system/system.module 7 May 2008 19:17:50 -0000 1.602 +++ modules/system/system.module 20 May 2008 20:40:01 -0000 @@ -6,6 +6,42 @@ * Configuration system that lets administrators modify the workings of the site. */ +/** @variable V_ADMIN_COMPACT_MODE: TODO: add documentation **/ +define('V_ADMIN_COMPACT_MODE', 'admin_compact_mode'); + +/** @variable V_ADMIN_THEME: TODO: add documentation **/ +define('V_ADMIN_THEME', 'admin_theme'); + +/** @variable V_CONFIGURABLE_TIMEZONES: TODO: add documentation **/ +define('V_CONFIGURABLE_TIMEZONES', 'configurable_timezones'); + +/** @variable V_DATE_DEFAULT_TIMEZONE: TODO: add documentation **/ +define('V_DATE_DEFAULT_TIMEZONE', 'date_default_timezone'); + +/** @variable V_DATE_FORMAT_LONG: TODO: add documentation **/ +define('V_DATE_FORMAT_LONG', 'date_format_long'); + +/** @variable V_DRUPAL_BADGE_COLOR: TODO: add documentation **/ +define('V_DRUPAL_BADGE_COLOR', 'drupal_badge_color'); + +/** @variable V_DRUPAL_BADGE_SIZE: TODO: add documentation **/ +define('V_DRUPAL_BADGE_SIZE', 'drupal_badge_size'); + +/** @variable V_DRUPAL_HTTP_REQUEST_FAILS: TODO: add documentation **/ +define('V_DRUPAL_HTTP_REQUEST_FAILS', 'drupal_http_request_fails'); + +/** @variable V_SYSTEM_UPDATE_1022: TODO: add documentation **/ +define('V_SYSTEM_UPDATE_1022', 'system_update_1022'); + +/** @variable V_SYSTEM_UPDATE_6043_RC2: TODO: add documentation **/ +define('V_SYSTEM_UPDATE_6043_RC2', 'system_update_6043_RC2'); + +/** @variable V_THEME_DEFAULT: TODO: add documentation **/ +define('V_THEME_DEFAULT', 'theme_default'); + +/** @variable V_THEME_SETTINGS: TODO: add documentation **/ +define('V_THEME_SETTINGS', 'theme_settings'); + /** * The current system version. */ @@ -664,7 +700,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(V_ADMIN_THEME, '0')); } /** @@ -672,9 +708,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(V_NODE_ADMIN_THEME, '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) { global $custom_theme; - $custom_theme = variable_get('admin_theme', '0'); + $custom_theme = variable_get(V_ADMIN_THEME, '0'); drupal_add_css(drupal_get_path('module', 'system') . '/admin.css', 'module'); } @@ -693,7 +729,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(V_CONFIGURABLE_TIMEZONES, 1)) { $zones = _system_zonelist(); $form['timezone'] = array( '#type' => 'fieldset', @@ -704,7 +740,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(V_DATE_DEFAULT_TIMEZONE, 0), '#options' => $zones, '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.'), ); @@ -734,22 +770,22 @@ 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(V_DRUPAL_BADGE_COLOR, 'powered-blue'), '#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(V_DRUPAL_BADGE_SIZE, '80x15'), '#options' => array('80x15' => t('Small'), '88x31' => t('Medium'), '135x42' => t('Large')), ); return $form; case 'save': - variable_set('drupal_badge_color', $edit['color']); - variable_set('drupal_badge_size', $edit['size']); + variable_set(V_DRUPAL_BADGE_COLOR, $edit['color']); + variable_set(V_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(V_DRUPAL_BADGE_COLOR, 'powered-blue') . '-' . variable_get(V_DRUPAL_BADGE_SIZE, '80x15') . '.png'; $block['subject'] = NULL; // Don't display a title $block['content'] = theme('system_powered_by', $image_path); return $block; @@ -795,7 +831,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(V_ADMIN_THEME, '0')) { $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']); @@ -839,7 +875,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(V_THEME_DEFAULT, 'garland') ? '' : $info->name; $screenshot = NULL; $theme_key = $info->name; @@ -854,7 +890,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('#value' => $screenshot); - $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => 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, '#value' => dirname($info->filename) . ($info->name == variable_get(V_THEME_DEFAULT, 'garland') ? '
                    ' . t('(site default theme)') . '' : '')); $options[$info->key] = ''; } @@ -1138,7 +1174,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(V_THEME_DEFAULT, 'garland'); $regions = system_region_list($theme); $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $default_theme); while ($block = db_fetch_array($result)) { @@ -1231,11 +1267,11 @@ 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(V_THEME_SETTINGS, array()); if (isset($theme_settings[$old])) { $theme_settings[$new] = $theme_settings[$old]; unset($theme_settings[$old]); - variable_set('theme_settings', $theme_settings); + variable_set(V_THEME_SETTINGS, $theme_settings); } } } @@ -1305,7 +1341,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(V_ADMIN_COMPACT_MODE, FALSE); } /** @@ -1863,7 +1899,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(V_SITE_NAME, 'Drupal'), '%username' => $account->name, ); if ($context['hook'] == 'taxonomy') { @@ -1919,8 +1955,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(V_SITE_NAME, 'Drupal'), + '%username' => $user->name ? $user->name : variable_get(V_ANONYMOUS, t('Anonymous')), ); // This action can be called in any context, but if placeholders @@ -2013,7 +2049,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(V_DATE_FORMAT_LONG, 'l, F j, Y - H:i') . ' O', $zone); } return $zones; } @@ -2040,7 +2076,7 @@ function system_check_http_request() { ob_end_clean(); $result = drupal_http_request(url($path, array('absolute' => TRUE))); $works = isset($result->data) && $result->data == $nothing; - variable_set('drupal_http_request_fails', !$works); + variable_set(V_DRUPAL_HTTP_REQUEST_FAILS, !$works); return $works; } Index: modules/taxonomy/taxonomy.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v retrieving revision 1.25 diff -u -F^f -r1.25 taxonomy.admin.inc --- modules/taxonomy/taxonomy.admin.inc 14 Apr 2008 17:48:42 -0000 1.25 +++ modules/taxonomy/taxonomy.admin.inc 20 May 2008 20:40:01 -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(V_TAXONOMY_OVERRIDE_SELECTOR, FALSE)) { $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.420 diff -u -F^f -r1.420 taxonomy.module --- modules/taxonomy/taxonomy.module 6 May 2008 12:18:51 -0000 1.420 +++ modules/taxonomy/taxonomy.module 20 May 2008 20:40:01 -0000 @@ -6,6 +6,9 @@ * Enables the organization of content into categories. */ +/** @variable V_TAXONOMY_OVERRIDE_SELECTOR: TODO: add documentation **/ +define('V_TAXONOMY_OVERRIDE_SELECTOR', 'taxonomy_override_selector'); + /** * Implementation of hook_perm(). */ @@ -484,7 +487,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(V_TAXONOMY_OVERRIDE_SELECTOR, FALSE)) && $form['type']['#value'] . '_node_form' == $form_id) { $node = $form['#node']; if (!isset($node->taxonomy)) { @@ -1105,10 +1108,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(V_DEFAULT_NODES_MAIN, 10), 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(V_FEED_DEFAULT_ITEMS, 10)); } } @@ -1127,7 +1130,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(V_DEFAULT_NODES_MAIN, 10), 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 -F^f -r1.11 taxonomy.pages.inc --- modules/taxonomy/taxonomy.pages.inc 14 Apr 2008 17:48:42 -0000 1.11 +++ modules/taxonomy/taxonomy.pages.inc 20 May 2008 20:40:01 -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(V_SITE_NAME, 'Drupal') . ' - ' . $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/translation/translation.module =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v retrieving revision 1.27 diff -u -F^f -r1.27 translation.module --- modules/translation/translation.module 6 May 2008 12:18:51 -0000 1.27 +++ modules/translation/translation.module 20 May 2008 20:40:01 -0000 @@ -295,7 +295,7 @@ function translation_node_get_translatio * Boolean value. */ function translation_supported_type($type) { - return variable_get('language_content_type_' . $type, 0) == TRANSLATION_ENABLED; + return variable_get(V_LANGUAGE_CONTENT_TYPE_ . $type, 0) == TRANSLATION_ENABLED; } /** Index: modules/update/update.fetch.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.fetch.inc,v retrieving revision 1.9 diff -u -F^f -r1.9 update.fetch.inc --- modules/update/update.fetch.inc 14 Apr 2008 17:48:43 -0000 1.9 +++ modules/update/update.fetch.inc 20 May 2008 20:40:01 -0000 @@ -51,9 +51,9 @@ function _update_refresh() { $available = $parser->parse($data); } if (!empty($available) && is_array($available)) { - $frequency = variable_get('update_check_frequency', 1); + $frequency = variable_get(V_UPDATE_CHECK_FREQUENCY, 1); cache_set('update_info', $available, 'cache_update', time() + (60 * 60 * 24 * $frequency)); - variable_set('update_last_check', time()); + variable_set(V_UPDATE_LAST_CHECK, time()); watchdog('update', 'Fetched information about all available new releases and updates.', array(), WATCHDOG_NOTICE, l(t('view'), 'admin/reports/updates')); } else { @@ -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(V_UPDATE_FETCH_URL, UPDATE_DEFAULT_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(V_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.19 diff -u -F^f -r1.19 update.module --- modules/update/update.module 6 May 2008 12:18:53 -0000 1.19 +++ modules/update/update.module 20 May 2008 20:40:02 -0000 @@ -9,6 +9,24 @@ * (admin/reports/status), the module and theme pages, and optionally via email. */ +/** @variable V_UPDATE_CHECK_FREQUENCY: TODO: add documentation **/ +define('V_UPDATE_CHECK_FREQUENCY', 'update_check_frequency'); + +/** @variable V_UPDATE_D6_REQUIREMENTS: TODO: add documentation **/ +define('V_UPDATE_D6_REQUIREMENTS', 'update_d6_requirements'); + +/** @variable V_UPDATE_FETCH_URL: TODO: add documentation **/ +define('V_UPDATE_FETCH_URL', 'update_fetch_url'); + +/** @variable V_UPDATE_LAST_CHECK: TODO: add documentation **/ +define('V_UPDATE_LAST_CHECK', 'update_last_check'); + +/** @variable V_UPDATE_NOTIFICATION_THRESHOLD: TODO: add documentation **/ +define('V_UPDATE_NOTIFICATION_THRESHOLD', 'update_notification_threshold'); + +/** @variable V_UPDATE_NOTIFY_EMAILS: TODO: add documentation **/ +define('V_UPDATE_NOTIFY_EMAILS', 'update_notify_emails'); + /** * URL to check for updates, if a given project doesn't define its own. */ @@ -259,7 +277,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(V_UPDATE_NOTIFICATION_THRESHOLD, 'all') == 'all' ? REQUIREMENT_ERROR : REQUIREMENT_WARNING; break; case UPDATE_UNKNOWN: case UPDATE_NOT_CHECKED: @@ -280,9 +298,9 @@ function _update_requirement_check($proj * Implementation of hook_cron(). */ function update_cron() { - $frequency = variable_get('update_check_frequency', 1); + $frequency = variable_get(V_UPDATE_CHECK_FREQUENCY, 1); $interval = 60 * 60 * 24 * $frequency; - if (time() - variable_get('update_last_check', 0) > $interval) { + if (time() - variable_get(V_UPDATE_LAST_CHECK, 0) > $interval) { update_refresh(); _update_cron_notify(); } @@ -339,7 +357,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(V_UPDATE_LAST_CHECK, 0); $projects = update_get_projects(); foreach ($projects as $key => $project) { if ($project['info']['_info_file_ctime'] > $last_check) { @@ -408,7 +426,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(V_SITE_NAME, 'Drupal')), $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 -F^f -r1.12 update.report.inc --- modules/update/update.report.inc 14 Apr 2008 17:48:43 -0000 1.12 +++ modules/update/update.report.inc 20 May 2008 20:40:02 -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(V_UPDATE_LAST_CHECK, 0); $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(V_UPDATE_NOTIFICATION_THRESHOLD, 'all'); 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 -F^f -r1.3 update.settings.inc --- modules/update/update.settings.inc 20 Oct 2007 21:57:50 -0000 1.3 +++ modules/update/update.settings.inc 20 May 2008 20:40:02 -0000 @@ -12,7 +12,7 @@ function update_settings() { $form = array(); - $notify_emails = variable_get('update_notify_emails', array()); + $notify_emails = variable_get(V_UPDATE_NOTIFY_EMAILS, array()); $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(V_UPDATE_CHECK_FREQUENCY, 1), '#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(V_UPDATE_NOTIFICATION_THRESHOLD, 'all'), '#options' => array( 'all' => t('All newer versions'), 'security' => t('Only security updates'), @@ -99,7 +99,7 @@ function update_settings_submit($form, $ variable_del('update_notify_emails'); } else { - variable_set('update_notify_emails', $form_state['notify_emails']); + variable_set(V_UPDATE_NOTIFY_EMAILS, $form_state['notify_emails']); } unset($form_state['notify_emails']); unset($form_state['values']['update_notify_emails']); Index: modules/upload/upload.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.admin.inc,v retrieving revision 1.9 diff -u -F^f -r1.9 upload.admin.inc --- modules/upload/upload.admin.inc 20 Apr 2008 07:58:38 -0000 1.9 +++ modules/upload/upload.admin.inc 20 May 2008 20:40:02 -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(V_UPLOAD_EXTENSIONS_DEFAULT, 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp'); + $upload_uploadsize_default = variable_get(V_UPLOAD_UPLOADSIZE_DEFAULT, 1); + $upload_usersize_default = variable_get(V_UPLOAD_USERSIZE_DEFAULT, 1); $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(V_UPLOAD_MAX_RESOLUTION, 0), '#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(V_UPLOAD_LIST_DEFAULT, 1), '#options' => array(0 => t('No'), 1 => t('Yes')), '#description' => t('Display attached files when viewing a post.'), ); @@ -122,14 +122,14 @@ function upload_admin_settings() { $form['settings_role_' . $rid]['upload_extensions_' . $rid] = array( '#type' => 'textfield', '#title' => t('Permitted file extensions'), - '#default_value' => variable_get('upload_extensions_' . $rid, $upload_extensions_default), + '#default_value' => variable_get(V_UPLOAD_EXTENSIONS_ . $rid, $upload_extensions_default), '#maxlength' => 255, '#description' => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.'), ); $form['settings_role_' . $rid]['upload_uploadsize_' . $rid] = array( '#type' => 'textfield', '#title' => t('Maximum file size per upload'), - '#default_value' => variable_get('upload_uploadsize_' . $rid, $upload_uploadsize_default), + '#default_value' => variable_get(V_UPLOAD_UPLOADSIZE_ . $rid, $upload_uploadsize_default), '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of a file a user can upload. If an image is uploaded and a maximum resolution is set, the size will be checked after the file has been resized.'), @@ -138,7 +138,7 @@ function upload_admin_settings() { $form['settings_role_' . $rid]['upload_usersize_' . $rid] = array( '#type' => 'textfield', '#title' => t('Total file size per user'), - '#default_value' => variable_get('upload_usersize_' . $rid, $upload_usersize_default), + '#default_value' => variable_get(V_UPLOAD_USERSIZE_ . $rid, $upload_usersize_default), '#size' => 7, '#maxlength' => 7, '#description' => t('The maximum size of all files a user can have on the site. Set to 0 for no restriction.'), Index: modules/upload/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v retrieving revision 1.202 diff -u -F^f -r1.202 upload.module --- modules/upload/upload.module 14 May 2008 13:19:48 -0000 1.202 +++ modules/upload/upload.module 20 May 2008 20:40:02 -0000 @@ -7,6 +7,33 @@ * */ +/** @variable V_UPLOAD_: TODO: add documentation **/ +define('V_UPLOAD_', 'upload_'); + +/** @variable V_UPLOAD_EXTENSIONS_: TODO: add documentation **/ +define('V_UPLOAD_EXTENSIONS_', 'upload_extensions_'); + +/** @variable V_UPLOAD_EXTENSIONS_DEFAULT: TODO: add documentation **/ +define('V_UPLOAD_EXTENSIONS_DEFAULT', 'upload_extensions_default'); + +/** @variable V_UPLOAD_LIST_DEFAULT: TODO: add documentation **/ +define('V_UPLOAD_LIST_DEFAULT', 'upload_list_default'); + +/** @variable V_UPLOAD_MAX_RESOLUTION: TODO: add documentation **/ +define('V_UPLOAD_MAX_RESOLUTION', 'upload_max_resolution'); + +/** @variable V_UPLOAD_UPLOADSIZE_: TODO: add documentation **/ +define('V_UPLOAD_UPLOADSIZE_', 'upload_uploadsize_'); + +/** @variable V_UPLOAD_UPLOADSIZE_DEFAULT: TODO: add documentation **/ +define('V_UPLOAD_UPLOADSIZE_DEFAULT', 'upload_uploadsize_default'); + +/** @variable V_UPLOAD_USERSIZE_: TODO: add documentation **/ +define('V_UPLOAD_USERSIZE_', 'upload_usersize_'); + +/** @variable V_UPLOAD_USERSIZE_DEFAULT: TODO: add documentation **/ +define('V_UPLOAD_USERSIZE_DEFAULT', 'upload_usersize_default'); + /** * Implementation of hook_help(). */ @@ -120,18 +147,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(V_UPLOAD_UPLOADSIZE_DEFAULT, 1); + $user_limit = variable_get(V_UPLOAD_USERSIZE_DEFAULT, 1); + $all_extensions = explode(' ', variable_get(V_UPLOAD_EXTENSIONS_DEFAULT, 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp')); 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", variable_get(V_UPLOAD_EXTENSIONS_DEFAULT, 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp')); $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", variable_get(V_UPLOAD_UPLOADSIZE_DEFAULT, 1)) * 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", variable_get(V_UPLOAD_USERSIZE_DEFAULT, 1)) * 1024 * 1024; $user_limit = ($user_limit && $user_size) ? max($user_limit, $user_size) : 0; } $all_extensions = implode(' ', array_unique($all_extensions)); @@ -139,7 +166,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(V_UPLOAD_MAX_RESOLUTION, 0), ); } @@ -179,7 +206,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(V_UPLOAD_LIST_DEFAULT, 1); $file->description = $file->filename; $file->weight = 0; $_SESSION['upload_files'][$file->fid] = $file; @@ -212,7 +239,7 @@ function upload_form_alter(&$form, $form $form['workflow']['upload'] = array( '#type' => 'radios', '#title' => t('Attachments'), - '#default_value' => variable_get('upload_' . $form['#node_type']->type, 1), + '#default_value' => variable_get(V_UPLOAD_ . $form['#node_type']->type, 1), '#options' => array(t('Disabled'), t('Enabled')), ); } Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.22 diff -u -F^f -r1.22 user.admin.inc --- modules/user/user.admin.inc 7 May 2008 19:34:24 -0000 1.22 +++ modules/user/user.admin.inc 20 May 2008 20:40:02 -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(V_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(V_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(V_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(V_USER_REGISTER, 1) != 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(V_USER_REGISTER, 1) != 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(V_USER_REGISTER, 1) != 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(V_USER_MAIL_STATUS_ACTIVATED_NOTIFY, TRUE), ); $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(V_USER_MAIL_STATUS_BLOCKED_NOTIFY, FALSE), ); $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(V_USER_MAIL_STATUS_DELETED_NOTIFY, FALSE), ); $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(V_USER_SIGNATURES, 0), '#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(V_USER_PICTURES, 0)) { + $picture_path = file_create_path(variable_get(V_USER_PICTURE_PATH, 'pictures')); 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(V_USER_PICTURES, 0); $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(V_USER_PICTURE_PATH, 'pictures'), '#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(V_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(V_USER_PICTURE_DIMENSIONS, '85x85'), '#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(V_USER_PICTURE_FILE_SIZE, '30'), '#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(V_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 -F^f -r1.12 user.install --- modules/user/user.install 7 May 2008 19:34:24 -0000 1.12 +++ modules/user/user.install 20 May 2008 20:40:02 -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(V_PASSWORD_INC, './includes/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.908 diff -u -F^f -r1.908 user.module --- modules/user/user.module 17 May 2008 17:02:56 -0000 1.908 +++ modules/user/user.module 20 May 2008 20:40:02 -0000 @@ -6,6 +6,60 @@ * Enables the user registration and login system. */ +/** @variable V_PASSWORD_INC: TODO: add documentation **/ +define('V_PASSWORD_INC', 'password_inc'); + +/** @variable V_USER_BLOCK_MAX_LIST_COUNT: TODO: add documentation **/ +define('V_USER_BLOCK_MAX_LIST_COUNT', 'user_block_max_list_count'); + +/** @variable V_USER_BLOCK_SECONDS_ONLINE: TODO: add documentation **/ +define('V_USER_BLOCK_SECONDS_ONLINE', 'user_block_seconds_online'); + +/** @variable V_USER_BLOCK_WHOIS_NEW_COUNT: TODO: add documentation **/ +define('V_USER_BLOCK_WHOIS_NEW_COUNT', 'user_block_whois_new_count'); + +/** @variable V_USER_EMAIL_VERIFICATION: TODO: add documentation **/ +define('V_USER_EMAIL_VERIFICATION', 'user_email_verification'); + +/** @variable V_USER_MAIL_: TODO: add documentation **/ +define('V_USER_MAIL_', 'user_mail_'); + +/** @variable V_USER_MAIL_STATUS_ACTIVATED_NOTIFY: TODO: add documentation **/ +define('V_USER_MAIL_STATUS_ACTIVATED_NOTIFY', 'user_mail_status_activated_notify'); + +/** @variable V_USER_MAIL_STATUS_BLOCKED_NOTIFY: TODO: add documentation **/ +define('V_USER_MAIL_STATUS_BLOCKED_NOTIFY', 'user_mail_status_blocked_notify'); + +/** @variable V_USER_MAIL_STATUS_DELETED_NOTIFY: TODO: add documentation **/ +define('V_USER_MAIL_STATUS_DELETED_NOTIFY', 'user_mail_status_deleted_notify'); + +/** @variable V_USER_PICTURE_DEFAULT: TODO: add documentation **/ +define('V_USER_PICTURE_DEFAULT', 'user_picture_default'); + +/** @variable V_USER_PICTURE_DIMENSIONS: TODO: add documentation **/ +define('V_USER_PICTURE_DIMENSIONS', 'user_picture_dimensions'); + +/** @variable V_USER_PICTURE_FILE_SIZE: TODO: add documentation **/ +define('V_USER_PICTURE_FILE_SIZE', 'user_picture_file_size'); + +/** @variable V_USER_PICTURE_GUIDELINES: TODO: add documentation **/ +define('V_USER_PICTURE_GUIDELINES', 'user_picture_guidelines'); + +/** @variable V_USER_PICTURE_PATH: TODO: add documentation **/ +define('V_USER_PICTURE_PATH', 'user_picture_path'); + +/** @variable V_USER_PICTURES: TODO: add documentation **/ +define('V_USER_PICTURES', 'user_pictures'); + +/** @variable V_USER_REGISTER: TODO: add documentation **/ +define('V_USER_REGISTER', 'user_register'); + +/** @variable V_USER_REGISTRATION_HELP: TODO: add documentation **/ +define('V_USER_REGISTRATION_HELP', 'user_registration_help'); + +/** @variable V_USER_SIGNATURES: TODO: add documentation **/ +define('V_USER_SIGNATURES', 'user_signatures'); + define('USERNAME_MAX_LENGTH', 60); define('EMAIL_MAX_LENGTH', 64); @@ -215,7 +269,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(V_PASSWORD_INC, './includes/password.inc'); $array['pass'] = user_hash_password(trim($array['pass'])); // Abort if the hashing failed and returned FALSE. if (!$array['pass']) { @@ -383,8 +437,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(V_USER_PICTURE_DIMENSIONS, '85x85')), + 'file_validate_size' => array(variable_get(V_USER_PICTURE_FILE_SIZE, '30') * 1024), ); if ($file = file_save_upload('picture_upload', $validators)) { // Remove the old picture. @@ -396,12 +450,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(V_USER_PICTURE_PATH, 'pictures') . '/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(V_USER_PICTURE_PATH, 'pictures')))); } } } @@ -566,7 +620,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(V_USER_PICTURE_PATH, 'pictures') . '/picture-') === 0) { $info = image_get_info(file_create_path($file)); return array('Content-type: ' . $info['mime_type']); } @@ -679,7 +733,7 @@ function user_login_block() { '#value' => t('Log in'), ); $items = array(); - if (variable_get('user_register', 1)) { + if (variable_get(V_USER_REGISTER, 1)) { $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.')))); @@ -714,24 +768,24 @@ 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(V_USER_BLOCK_WHOIS_NEW_COUNT, 5), '#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(V_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(V_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.')); return $form; } else if ($op == 'save' && $delta == 'new') { - variable_set('user_block_whois_new_count', $edit['user_block_whois_new_count']); + variable_set(V_USER_BLOCK_WHOIS_NEW_COUNT, $edit['user_block_whois_new_count']); } else if ($op == 'save' && $delta == 'online') { - variable_set('user_block_seconds_online', $edit['user_block_seconds_online']); - variable_set('user_block_max_list_count', $edit['user_block_max_list_count']); + variable_set(V_USER_BLOCK_SECONDS_ONLINE, $edit['user_block_seconds_online']); + variable_set(V_USER_BLOCK_MAX_LIST_COUNT, $edit['user_block_max_list_count']); } else if ($op == 'view') { $block = array(); @@ -756,7 +810,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(V_USER_BLOCK_WHOIS_NEW_COUNT, 5)); while ($account = db_fetch_object($result)) { $items[] = $account; } @@ -770,14 +824,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(V_USER_BLOCK_SECONDS_ONLINE, 900); // 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(V_USER_BLOCK_MAX_LIST_COUNT, 10); $items = array(); while ($account = db_fetch_object($authenticated_users)) { if ($max_users > 0) { @@ -796,7 +850,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(V_USER_BLOCK_MAX_LIST_COUNT, 10); if ($authenticated_count && $max_users) { $output .= theme('user_list', $items, t('Online users')); } @@ -819,17 +873,17 @@ function user_block($op = 'list', $delta */ function template_preprocess_user_picture(&$variables) { $variables['picture'] = ''; - if (variable_get('user_pictures', 0)) { + if (variable_get(V_USER_PICTURES, 0)) { $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(V_USER_PICTURE_DEFAULT, '')) { + $picture = variable_get(V_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(V_ANONYMOUS, t('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); @@ -868,7 +922,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(V_USER_REGISTER, 1); } function user_view_access($account) { @@ -1207,7 +1261,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(V_SITE_NAME, 'Drupal'))); $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#description' => t('Enter the password that accompanies your username.'), @@ -1290,7 +1344,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(V_PASSWORD_INC, './includes/password.inc'); if (user_check_password($password, $account)) { if (user_needs_new_hash($account)) { $new_hash = user_hash_password($password); @@ -1411,7 +1465,7 @@ function user_edit_form(&$form_state, $u '#size' => 25, ); } - elseif (!variable_get('user_email_verification', TRUE) || $admin) { + elseif (!variable_get(V_USER_EMAIL_VERIFICATION, TRUE) || $admin) { $form['account']['pass'] = array( '#type' => 'password_confirm', '#description' => t('Provide a password for the new account in both fields.'), @@ -1456,7 +1510,7 @@ function user_edit_form(&$form_state, $u } // Signature: - if (variable_get('user_signatures', 0) && module_exists('comment') && !$register) { + if (variable_get(V_USER_SIGNATURES, 0) && module_exists('comment') && !$register) { $form['signature_settings'] = array( '#type' => 'fieldset', '#title' => t('Signature settings'), @@ -1471,7 +1525,7 @@ function user_edit_form(&$form_state, $u } // Picture/avatar: - if (variable_get('user_pictures', 0) && !$register) { + if (variable_get(V_USER_PICTURES, 0) && !$register) { $form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1); $picture = theme('user_picture', (object)$edit); if ($edit['picture']) { @@ -1481,7 +1535,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(V_USER_PICTURE_DIMENSIONS, '85x85'), '%size' => variable_get(V_USER_PICTURE_FILE_SIZE, '30'))) . ' ' . variable_get(V_USER_PICTURE_GUIDELINES, '')); $form['#validate'][] = 'user_validate_picture'; } $form['#uid'] = $uid; @@ -1578,7 +1632,7 @@ function user_mail($key, &$message, $par function _user_mail_text($key, $language = NULL, $variables = array()) { $langcode = isset($language) ? $language->language : NULL; - if ($admin_setting = variable_get('user_mail_' . $key, FALSE)) { + if ($admin_setting = variable_get(V_USER_MAIL_ . $key, FALSE)) { // An admin setting overrides the default string. return strtr($admin_setting, $variables); } @@ -1971,7 +2025,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(V_USER_SIGNATURES, 0) && !empty($comment->signature)) { $comment->signature = check_markup($comment->signature, $comment->format); } else { @@ -2012,7 +2066,7 @@ function user_mail_tokens($account, $lan global $base_url; $tokens = array( '!username' => $account->name, - '!site' => variable_get('site_name', 'Drupal'), + '!site' => variable_get(V_SITE_NAME, 'Drupal'), '!login_url' => user_pass_reset_url($account), '!uri' => $base_url, '!uri_brief' => substr($base_url, strlen('http://')), @@ -2078,7 +2132,7 @@ function user_preferred_language($accoun 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(V_USER_MAIL_ . $op . '_notify', $default_notify); if ($notify) { $params['account'] = $account; $language = $language ? $language : user_preferred_language($account); @@ -2086,7 +2140,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(V_SITE_MAIL, ini_get('sendmail_from')), language_default(), $params); } } return empty($mail) ? NULL : $mail['result']; @@ -2203,14 +2257,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(V_USER_EMAIL_VERIFICATION, TRUE) || $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(V_SITE_MAIL, ini_get('sendmail_from')); if (isset($form_state['values']['roles'])) { // Remove unset roles. $roles = array_filter($form_state['values']['roles']); @@ -2231,7 +2285,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(V_USER_REGISTER, 1) == 1; } $account = user_save('', array_merge($form_state['values'], $merge_data)); // Terminate if an error occured during user_save(). @@ -2247,7 +2301,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(V_USER_EMAIL_VERIFICATION, TRUE)) { drupal_set_message(t('

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

                    ', array('%pass' => $pass))); } @@ -2262,7 +2316,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(V_USER_EMAIL_VERIFICATION, TRUE) && $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); @@ -2317,7 +2371,7 @@ function user_register() { // Display the registration form. if (!$admin) { - $form['user_registration_help'] = array('#value' => filter_xss_admin(variable_get('user_registration_help', ''))); + $form['user_registration_help'] = array('#value' => filter_xss_admin(variable_get(V_USER_REGISTRATION_HELP, ''))); } // Merge in the default user edit fields. @@ -2349,12 +2403,12 @@ function user_register() { $form = array_merge($form, $extra); } - if (variable_get('configurable_timezones', 1)) { + if (variable_get(V_CONFIGURABLE_TIMEZONES, 1)) { // 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(V_DATE_DEFAULT_TIMEZONE, NULL), '#id' => 'edit-user-register-timezone', ); Index: profiles/default/default.profile =================================================================== RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v retrieving revision 1.23 diff -u -F^f -r1.23 default.profile --- profiles/default/default.profile 10 Mar 2008 18:15:14 -0000 1.23 +++ profiles/default/default.profile 20 May 2008 20:40:02 -0000 @@ -125,13 +125,13 @@ function default_profile_tasks(&$task, $ } // Default page to not be promoted and have comments disabled. - variable_set('node_options_page', array('status')); - variable_set('comment_page', COMMENT_NODE_DISABLED); + variable_set(V_NODE_OPTIONS_PAGE, array('status')); + variable_set(V_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(V_THEME_SETTINGS, array()); $theme_settings['toggle_node_info_page'] = FALSE; - variable_set('theme_settings', $theme_settings); + variable_set(V_THEME_SETTINGS, $theme_settings); // Update the menu router information. menu_rebuild();