Index: cron.php =================================================================== RCS file: /cvs/drupal/drupal/cron.php,v retrieving revision 1.36 diff -u -p -r1.36 cron.php --- cron.php 9 Aug 2006 07:42:55 -0000 1.36 +++ cron.php 20 Jan 2008 06:07:56 -0000 @@ -1,6 +1,7 @@ 45, '#maxlength' => 45, '#required' => TRUE, - '#description' => $db_path_description + '#description' => $db_path_description, ); // Database username @@ -287,7 +286,7 @@ function install_settings_form(&$form_st '#title' => st('Advanced options'), '#collapsible' => TRUE, '#collapsed' => TRUE, - '#description' => st("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider.") + '#description' => st("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider."), ); // Database host @@ -396,11 +395,11 @@ function install_settings_form_submit($f // Update global settings array and save $settings['db_url'] = array( - 'value' => $form_state['values']['_db_url'], + 'value' => $form_state['values']['_db_url'], 'required' => TRUE, ); $settings['db_prefix'] = array( - 'value' => $form_state['values']['db_prefix'], + 'value' => $form_state['values']['db_prefix'], 'required' => TRUE, ); drupal_rewrite_settings($settings); @@ -452,7 +451,7 @@ function install_select_profile() { */ function install_select_profile_form(&$form_state, $profiles) { foreach ($profiles as $profile) { - include_once($profile->filename); + include_once ($profile->filename); // Load profile details. $function = $profile->name .'_profile_details'; if (function_exists($function)) { @@ -469,7 +468,7 @@ function install_select_profile_form(&$f '#parents' => array('profile'), ); } - $form['submit'] = array( + $form['submit'] = array( '#type' => 'submit', '#value' => st('Save and continue'), ); @@ -481,7 +480,7 @@ function install_select_profile_form(&$f */ function install_find_locales($profilename) { $locales = file_scan_directory('./profiles/'. $profilename .'/translations', '\.po$', array('.', '..', 'CVS'), 0, FALSE); - array_unshift($locales, (object) array('name' => 'en')); + array_unshift($locales, (object)array('name' => 'en')); return $locales; } @@ -570,10 +569,10 @@ function install_select_locale_form(&$fo '#return_value' => $locale->name, '#default_value' => ($locale->name == 'en' ? TRUE : FALSE), '#title' => $name . ($locale->name == 'en' ? ' '. st('(built-in)') : ''), - '#parents' => array('locale') + '#parents' => array('locale'), ); } - $form['submit'] = array( + $form['submit'] = array( '#type' => 'submit', '#value' => st('Select language'), ); @@ -590,7 +589,6 @@ function install_no_profile_error() { exit; } - /** * Show an error page when Drupal has already been installed. */ @@ -624,7 +622,6 @@ function install_tasks($profile, $task) // We are using a list of if constructs here to allow for // passing from one task to the other in the same request. - // Install profile modules. if ($task == 'profile-install') { $modules = variable_get('install_profile_modules', array()); @@ -699,7 +696,7 @@ function install_tasks($profile, $task) // Warn about settings.php permissions risk $settings_dir = './'. conf_path(); $settings_file = $settings_dir .'/settings.php'; - if (!drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE) || !drupal_verify_install_file($settings_dir, FILE_NOT_WRITABLE, 'dir')) { + if (!drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE) || !drupal_verify_install_file($settings_dir, FILE_NOT_WRITABLE, 'dir')) { drupal_set_message(st('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, please consult the on-line handbook.', array('%dir' => $settings_dir, '%file' => $settings_file, '@handbook_url' => 'http://drupal.org/getting-started')), 'error'); } else { @@ -723,7 +720,6 @@ if (Drupal.jsEnabled) { // Build menu to allow clean URL check. menu_rebuild(); } - else { $task = 'profile'; } @@ -865,21 +861,21 @@ function install_check_requirements($pro // If Drupal is not set up already, we need to create a settings file. if (!$verify) { - $writable = FALSE; - $conf_path = './'. conf_path(); + $writable = FALSE; + $conf_path = './'. conf_path(); $settings_file = $conf_path .'/settings.php'; - $file = $conf_path; + $file = $conf_path; // Verify that the directory exists. if (drupal_verify_install_file($conf_path, FILE_EXIST, 'dir')) { // Check to see if a settings.php already exists. if (drupal_verify_install_file($settings_file, FILE_EXIST)) { // If it does, make sure it is writable. - $writable = drupal_verify_install_file($settings_file, FILE_READABLE|FILE_WRITABLE); + $writable = drupal_verify_install_file($settings_file, FILE_READABLE | FILE_WRITABLE); $file = $settings_file; } else { // If not, make sure the directory is. - $writable = drupal_verify_install_file($conf_path, FILE_READABLE|FILE_WRITABLE, 'dir'); + $writable = drupal_verify_install_file($conf_path, FILE_READABLE | FILE_WRITABLE, 'dir'); } } @@ -916,7 +912,7 @@ function install_check_requirements($pro drupal_set_message($message, 'warning'); } } - } + } } /** @@ -925,18 +921,18 @@ function install_check_requirements($pro function install_task_list($active = NULL) { // Default list of tasks. $tasks = array( - 'profile-select' => st('Choose profile'), - 'locale-select' => st('Choose language'), - 'requirements' => st('Verify requirements'), - 'database' => st('Set up database'), + 'profile-select' => st('Choose profile'), + 'locale-select' => st('Choose language'), + 'requirements' => st('Verify requirements'), + 'database' => st('Set up database'), 'profile-install-batch' => st('Install profile'), - 'locale-initial-batch' => st('Set up translations'), - 'configure' => st('Configure site'), + 'locale-initial-batch' => st('Set up translations'), + 'configure' => st('Configure site'), ); $profiles = install_find_profiles(); - $profile = isset($_GET['profile']) && isset($profiles[$_GET['profile']]) ? $_GET['profile'] : '.'; - $locales = install_find_locales($profile); + $profile = isset($_GET['profile']) && isset($profiles[$_GET['profile']]) ? $_GET['profile'] : '.'; + $locales = install_find_locales($profile); // If we have only one profile, remove 'Choose profile' // and rename 'Install profile'. @@ -967,7 +963,7 @@ function install_task_list($active = NUL // Add finished step as the last task. $tasks += array( - 'finished' => st('Finished') + 'finished' => st('Finished'), ); // Let the theming function know that 'finished' and 'done' @@ -1150,3 +1146,4 @@ function install_configure_form_submit($ // Start the installer. install_main(); + Index: includes/actions.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/actions.inc,v retrieving revision 1.8 diff -u -p -r1.8 actions.inc --- includes/actions.inc 31 Dec 2007 14:51:04 -0000 1.8 +++ includes/actions.inc 20 Jan 2008 06:07:56 -0000 @@ -1,6 +1,7 @@ $params) { - if (is_numeric($action_id)) { // Configurable actions need parameters. - $function = $params['callback']; - $context = array_merge($context, $params); + if (is_numeric($action_id)) { + // Configurable actions need parameters. + $function = $params['callback']; + $context = array_merge($context, $params); $result[$action_id] = $function($object, $context, $a1, $a2); } // Singleton action; $action_id is the function name. @@ -93,9 +95,9 @@ function actions_do($action_ids, &$objec else { // If it's a configurable action, retrieve stored parameters. if (is_numeric($action_ids)) { - $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $action_ids)); - $function = $action->callback; - $context = array_merge($context, unserialize($action->parameters)); + $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $action_ids)); + $function = $action->callback; + $context = array_merge($context, unserialize($action->parameters)); $result[$action_ids] = $function($object, $context, $a1, $a2); } // Singleton action; $action_ids is the function name. @@ -106,7 +108,6 @@ function actions_do($action_ids, &$objec return $result; } - /** * Discover all action functions by invoking hook_action_info(). * @@ -210,9 +211,9 @@ function actions_actions_map($actions) { $actions_map = array(); foreach ($actions as $callback => $array) { $key = md5($callback); - $actions_map[$key]['callback'] = isset($array['callback']) ? $array['callback'] : $callback; - $actions_map[$key]['description'] = $array['description']; - $actions_map[$key]['type'] = $array['type']; + $actions_map[$key]['callback'] = isset($array['callback']) ? $array['callback'] : $callback; + $actions_map[$key]['description'] = $array['description']; + $actions_map[$key]['type'] = $array['type']; $actions_map[$key]['configurable'] = $array['configurable']; } return $actions_map; @@ -363,3 +364,4 @@ function actions_delete($aid) { db_query("DELETE FROM {actions} WHERE aid = %d", $aid); module_invoke_all('actions_delete', $aid); } + Index: includes/batch.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/batch.inc,v retrieving revision 1.14 diff -u -p -r1.14 batch.inc --- includes/batch.inc 20 Dec 2007 11:57:20 -0000 1.14 +++ includes/batch.inc 20 Jan 2008 06:07:56 -0000 @@ -1,6 +1,7 @@ &$current_set['sandbox'], 'results' => &$current_set['results'], 'finished' => &$finished, 'message' => &$task_message); + $batch_context = array('sandbox' => & $current_set['sandbox'], 'results' => & $current_set['results'], 'finished' => & $finished, 'message' => & $task_message); // Process the current operation. call_user_func_array($function, array_merge($args, array(&$batch_context))); } @@ -204,12 +204,11 @@ function _batch_process() { $set_changed = FALSE; $old_set = $current_set; while (empty($current_set['operations']) && ($current_set['success'] = TRUE) && _batch_next_set()) { - $current_set =& _batch_current_set(); + $current_set = &_batch_current_set(); $set_changed = TRUE; } // At this point, either $current_set is a 'real' batch set (has operations), // or all sets have been completed. - // If we're in progressive mode, stop after 1 second. if ($batch['progressive'] && timer_read('batch_processing') > 1000) { break; @@ -218,31 +217,30 @@ function _batch_process() { if ($batch['progressive']) { // Gather progress information. - // Reporting 100% progress will cause the whole batch to be considered // processed. If processing was paused right after moving to a new set, // we have to use the info from the new (unprocessed) one. if ($set_changed && isset($current_set['operations'])) { // Processing will continue with a fresh batch set. - $remaining = count($current_set['operations']); - $total = $current_set['total']; + $remaining = count($current_set['operations']); + $total = $current_set['total']; $progress_message = $current_set['init_message']; - $task_message = ''; + $task_message = ''; } else { - $remaining = count($old_set['operations']); - $total = $old_set['total']; + $remaining = count($old_set['operations']); + $total = $old_set['total']; $progress_message = $old_set['progress_message']; } $current = $total - $remaining + $finished; $percentage = $total ? floor($current / $total * 100) : 100; - $values = array( - '@remaining' => $remaining, - '@total' => $total, - '@current' => floor($current), + $values = array( + '@remaining' => $remaining, + '@total' => $total, + '@current' => floor($current), '@percentage' => $percentage, - ); + ); $message = strtr($progress_message, $values) .'
'; $message .= $task_message ? $task_message : ' '; @@ -252,14 +250,13 @@ function _batch_process() { // If we're not in progressive mode, the whole batch has been processed by now. return _batch_finished(); } - } /** * Retrieve the batch set being currently processed. */ function &_batch_current_set() { - $batch =& batch_get(); + $batch = &batch_get(); return $batch['sets'][$batch['current_set']]; } @@ -269,10 +266,10 @@ function &_batch_current_set() { * additional batch sets). */ function _batch_next_set() { - $batch =& batch_get(); + $batch = &batch_get(); if (isset($batch['sets'][$batch['current_set'] + 1])) { $batch['current_set']++; - $current_set =& _batch_current_set(); + $current_set = &_batch_current_set(); if (isset($current_set['form_submit']) && ($function = $current_set['form_submit']) && function_exists($function)) { // We use our stored copies of $form and $form_state, to account for // possible alteration by the submit handlers. @@ -288,14 +285,14 @@ function _batch_next_set() { * and resolve page redirection. */ function _batch_finished() { - $batch =& batch_get(); + $batch = &batch_get(); // Execute the 'finished' callbacks for each batch set. foreach ($batch['sets'] as $key => $batch_set) { if (isset($batch_set['finished'])) { // Check if the set requires an additional file for functions definitions. if (isset($batch_set['file']) && is_file($batch_set['file'])) { - include_once($batch_set['file']); + include_once ($batch_set['file']); } if (function_exists($batch_set['finished'])) { $batch_set['finished']($batch_set['success'], $batch_set['results'], $batch_set['operations']); @@ -352,3 +349,4 @@ function _batch_shutdown() { db_query("UPDATE {batch} SET batch = '%s' WHERE bid = %d", serialize($batch), $batch['id']); } } + Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.206 diff -u -p -r1.206 bootstrap.inc --- includes/bootstrap.inc 10 Jan 2008 22:47:17 -0000 1.206 +++ includes/bootstrap.inc 20 Jan 2008 06:07:56 -0000 @@ -1,6 +1,7 @@ 0; $i--) { for ($j = count($server); $j > 0; $j--) { $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i)); @@ -318,7 +330,7 @@ function conf_init() { else { // Otherwise use $base_url as session name, without the protocol // to use the same session identifiers across http and https. - list( , $session_name) = explode('://', $base_url, 2); + list(, $session_name) = explode('://', $base_url, 2); // We escape the hostname because it can be modified by a visitor. if (!empty($_SERVER['HTTP_HOST'])) { $cookie_domain = check_plain($_SERVER['HTTP_HOST']); @@ -391,8 +403,8 @@ function drupal_get_filename($type, $nam // Fallback to searching the filesystem if the database connection is // not established or the requested file is not found. $config = conf_path(); - $dir = (($type == 'theme_engine') ? 'themes/engines' : "${type}s"); - $file = (($type == 'theme_engine') ? "$name.engine" : "$name.$type"); + $dir = (($type == 'theme_engine') ? 'themes/engines' : "${type}s"); + $file = (($type == 'theme_engine') ? "$name.engine" : "$name.$type"); foreach (array("$config/$dir/$file", "$config/$dir/$name/$file", "$dir/$file", "$dir/$name/$file") as $file) { if (file_exists($file)) { @@ -441,6 +453,7 @@ function variable_init($conf = array()) * The name of the variable to return. * @param $default * The default value to use if this variable has never been set. + * * @return * The value of the variable. */ @@ -488,7 +501,6 @@ function variable_del($name) { unset($conf[$name]); } - /** * Retrieve the current page from the cache. * @@ -590,8 +602,10 @@ function drupal_page_cache_header($cache $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : FALSE; if ($if_modified_since && $if_none_match - && $if_none_match == $etag // etag must match - && $if_modified_since == $last_modified) { // if-modified-since must match + && $if_none_match == $etag// etag must match + && $if_modified_since == $last_modified + ) { + // if-modified-since must match header('HTTP/1.1 304 Not Modified'); // All 304 responses must send an etag if the 200 response for the same object contained an etag header("Etag: $etag"); @@ -699,6 +713,7 @@ function check_plain($text) { * * @param $text * The text to check. + * * @return * TRUE if the text is valid UTF-8, FALSE if not. */ @@ -758,17 +773,17 @@ function watchdog($type, $message, $vari // Prepare the fields to be logged $log_message = array( - 'type' => $type, - 'message' => $message, - 'variables' => $variables, - 'severity' => $severity, - 'link' => $link, - 'user' => $user, + 'type' => $type, + 'message' => $message, + 'variables' => $variables, + 'severity' => $severity, + 'link' => $link, + 'user' => $user, 'request_uri' => $base_root . request_uri(), - 'referer' => referer_uri(), - 'ip' => ip_address(), - 'timestamp' => time(), - ); + 'referer' => referer_uri(), + 'ip' => ip_address(), + 'timestamp' => time(), + ); // Call the logging hooks to log/process the message foreach (module_implements('watchdog', TRUE) as $module) { @@ -820,6 +835,7 @@ function drupal_set_message($message = N * (optional) Only return messages of this type. * @param $clear_queue * (optional) Set to FALSE if you do not want to clear the messages queue + * * @return * An associative array, the key is the message type, the value an array * of messages. If the $type parameter is passed, you get only that type, @@ -861,6 +877,7 @@ function drupal_get_messages($type = NUL * @param $mask string * String or mask to test: '_' matches any character, '%' matches any * number of characters. + * * @return bool * TRUE if access is denied, FALSE if access is allowed. */ @@ -924,7 +941,6 @@ function _drupal_bootstrap($phase) { global $conf; switch ($phase) { - case DRUPAL_BOOTSTRAP_CONFIGURATION: drupal_unset_globals(); // Start a page timer: @@ -1104,7 +1120,7 @@ function language_list($field = 'languag * Optional property of the language object to return */ function language_default($property = NULL) { - $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '')); + $language = variable_get('language_default', (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; } @@ -1135,3 +1151,4 @@ function ip_address() { return $ip_address; } + Index: includes/cache-install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/cache-install.inc,v retrieving revision 1.2 diff -u -p -r1.2 cache-install.inc --- includes/cache-install.inc 7 Aug 2007 08:39:35 -0000 1.2 +++ includes/cache-install.inc 20 Jan 2008 06:07:56 -0000 @@ -1,6 +1,7 @@ 'alternate', - 'type' => 'application/rss+xml', - 'title' => $title, - 'href' => $url)); + 'type' => 'application/rss+xml', + 'title' => $title, + 'href' => $url, + )); } return $stored_feed_links; } @@ -200,6 +202,7 @@ function drupal_get_feeds($delimiter = " * nested items. * @param $parent * Should not be passed, only used in recursive calls. + * * @return * An urlencoded string which can be appended to/as the URL query string. */ @@ -332,7 +335,8 @@ function drupal_site_offline() { 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')))))); + t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal'))) + ))); } /** @@ -409,6 +413,7 @@ function drupal_access_denied() { * @param $retry * An integer representing how many times to retry the request in case of a * redirect. + * * @return * An object containing the HTTP request headers, response code, headers, * data and redirect status. @@ -422,7 +427,7 @@ function drupal_http_request($url, $head // some parsing has failed. if (!$self_test && variable_get('drupal_http_request_fails', FALSE)) { $self_test = TRUE; - $works = module_invoke('system', 'check_http_request'); + $works = module_invoke('system', 'check_http_request'); $self_test = FALSE; if (!$works) { // Do not bother with further operations if we already know that we @@ -439,14 +444,16 @@ function drupal_http_request($url, $head case 'http': $port = isset($uri['port']) ? $uri['port'] : 80; $host = $uri['host'] . ($port != 80 ? ':'. $port : ''); - $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); + $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); break; + case 'https': // Note: Only works for PHP 4.3 compiled with OpenSSL. $port = isset($uri['port']) ? $uri['port'] : 443; $host = $uri['host'] . ($port != 443 ? ':'. $port : ''); - $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20); + $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20); break; + default: $result->error = 'invalid schema '. $uri['scheme']; return $result; @@ -474,7 +481,7 @@ function drupal_http_request($url, $head // host that do not take into account the port number. 'Host' => "Host: $host", 'User-Agent' => 'User-Agent: Drupal (+http://drupal.org/)', - 'Content-Length' => 'Content-Length: '. strlen($data) + 'Content-Length' => 'Content-Length: '. strlen($data), ); // If the server url has a user then attempt to use basic authentication @@ -528,7 +535,7 @@ function drupal_http_request($url, $head 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', - 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported' + 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', ); // RFC 2616 states that all unknown HTTP codes must be treated the same as the // base code in their class. @@ -537,12 +544,18 @@ function drupal_http_request($url, $head } switch ($code) { - case 200: // OK - case 304: // Not modified + case 200: + // OK + case 304: + // Not modified break; - case 301: // Moved permanently - case 302: // Moved temporarily - case 307: // Moved temporarily + + case 301: + // Moved permanently + case 302: + // Moved temporarily + case 307: + // Moved temporarily $location = $result->headers['Location']; if ($retry) { @@ -550,8 +563,8 @@ function drupal_http_request($url, $head $result->redirect_code = $result->code; } $result->redirect_url = $location; - break; + default: $result->error = $text; } @@ -559,6 +572,7 @@ function drupal_http_request($url, $head $result->code = $code; return $result; } + /** * @} End of "HTTP handling". */ @@ -747,6 +761,7 @@ function fix_gpc_magic() { * @param $langcode * Optional language code to translate to a language other than what is used * to display the page. + * * @return * The translated string. */ @@ -810,14 +825,15 @@ function t($string, $args = array(), $la * * @param $mail * A string containing an e-mail address. + * * @return * TRUE if the address is in a valid format. */ function valid_email_address($mail) { - $user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+'; + $user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+'; $domain = '(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.?)+'; - $ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}'; - $ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}'; + $ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}'; + $ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}'; return preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail); } @@ -832,6 +848,7 @@ function valid_email_address($mail) { * The URL to verify. * @param $absolute * Whether the URL is absolute (beginning with a scheme such as "http:"). + * * @return * TRUE if the URL is in a valid format. */ @@ -865,6 +882,7 @@ function flood_register_event($name) { * The name of the event. * @param $number * The maximum number of the specified event per hour (per visitor). + * * @return * True if the user did not exceed the hourly threshold. False otherwise. */ @@ -1013,6 +1031,7 @@ function format_xml_elements($array) { * @param $langcode * Optional language code to translate to a language other than * what is used to display the page. + * * @return * A translated string. */ @@ -1032,8 +1051,10 @@ function format_plural($count, $singular switch ($index) { case "0": return t($singular, $args, $langcode); + case "1": return t($plural, $args, $langcode); + default: unset($args['@count']); $args['@count['. $index .']'] = $count; @@ -1048,6 +1069,7 @@ function format_plural($count, $singular * @param $size * A size expressed as a number of bytes with optional SI size and unit * suffix (e.g. 2, 3K, 5MB, 10G). + * * @return * An integer representation of the size. */ @@ -1056,7 +1078,7 @@ function parse_size($size) { '' => 1, 'k' => 1024, 'm' => 1048576, // 1024 * 1024 - 'g' => 1073741824, // 1024 * 1024 * 1024 + 'g' => 1073741824, // 1024 * 1024 * 1024, ); if (preg_match('/([0-9]+)\s*(k|m|g)?(b?(ytes?)?)/i', $size, $match)) { return $match[1] * $suffixes[drupal_strtolower($match[2])]; @@ -1071,6 +1093,7 @@ function parse_size($size) { * @param $langcode * Optional language code to translate to a language other than what is used * to display the page. + * * @return * A translated string representation of the size. */ @@ -1099,6 +1122,7 @@ function format_size($size, $langcode = * @param $langcode * Optional language code to translate to a language other than * what is used to display the page. + * * @return * A translated string representation of the interval. */ @@ -1141,6 +1165,7 @@ function format_interval($timestamp, $gr * @param $langcode * Optional language code to translate to a language other than what is used * to display the page. + * * @return * A translated date string in the requested format. */ @@ -1161,12 +1186,15 @@ function format_date($timestamp, $type = case 'small': $format = variable_get('date_format_short', 'm/d/Y - H:i'); break; + case 'large': $format = variable_get('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'); @@ -1244,6 +1272,7 @@ function format_date($timestamp, $type = * 'prefix' * Only used internally, to modify the path when a language dependent URL * requires so. + * * @return * A string containing a URL to the given path. * @@ -1257,7 +1286,7 @@ function url($path = NULL, $options = ar 'query' => '', 'absolute' => FALSE, 'alias' => FALSE, - 'prefix' => '' + 'prefix' => '', ); if (!isset($options['external'])) { // Return an external link if $path contains an allowed absolute URL. @@ -1367,6 +1396,7 @@ function url($path = NULL, $options = ar * * @param $attributes * An associative array of HTML attributes. + * * @return * An HTML string ready for insertion in a tag. */ @@ -1420,15 +1450,16 @@ function drupal_attributes($attributes = * escaped HTML. * 'alias' (default FALSE) * Whether the given path is an alias already. + * * @return * an HTML string containing a link to the given path. */ function l($text, $path, $options = array()) { // Merge in defaults. $options += array( - 'attributes' => array(), - 'html' => FALSE, - ); + 'attributes' => array(), + 'html' => FALSE, + ); // Append active class. if ($path == $_GET['q'] || ($path == '' && drupal_is_front_page())) { @@ -1509,6 +1540,7 @@ function drupal_map_assoc($array, $funct * * @param $code * The code to evaluate. + * * @return * A string containing the printed output of the code, followed by the returned * output of the code. @@ -1633,6 +1665,7 @@ function drupal_add_link($attributes) { * * Typical candidates for caching are for example styles for nodes across * the site, or used in the theme. + * * @return * An array of CSS files. */ @@ -1695,6 +1728,7 @@ function drupal_add_css($path = NULL, $t * @param $css * (optional) An array of CSS files. If no array is provided, the default * stylesheets array is used instead. + * * @return * A string of XHTML CSS tags. */ @@ -1757,6 +1791,7 @@ function drupal_get_css($css = NULL) { * compress into one file. * @param $filename * The name of the aggregate CSS file. + * * @return * The name of the CSS file. */ @@ -1832,6 +1867,7 @@ function _drupal_build_css_path($matches * Name of the stylesheet to be processed. * @param $optimize * Defines if CSS contents should be compressed or not. + * * @return * Contents of the stylesheet including the imported stylesheets. */ @@ -1945,6 +1981,7 @@ function drupal_clear_css_cache() { * @param $preprocess * (optional) Should this JS file be aggregated if this * feature has been turned on under the performance section? + * * @return * If the first parameter is NULL, the JavaScript array that has been built so * far for $scope is returned. If the first three parameters are NULL, @@ -1984,9 +2021,11 @@ function drupal_add_js($data = NULL, $ty case 'setting': $javascript[$scope][$type][] = $data; break; + case 'inline': $javascript[$scope][$type][] = array('code' => $data, 'defer' => $defer); break; + default: // If cache is FALSE, don't preprocess the JS file. $javascript[$scope][$type][$data] = array('cache' => $cache, 'defer' => $defer, 'preprocess' => (!$cache ? FALSE : $preprocess)); @@ -2021,6 +2060,7 @@ function drupal_add_js($data = NULL, $ty * @parameter $javascript * (optional) An array with all JavaScript code. Defaults to the default * JavaScript array for the given scope. + * * @return * All JavaScript code segments and includes for the scope as HTML tags. */ @@ -2037,13 +2077,13 @@ function drupal_get_js($scope = 'header' return ''; } - $output = ''; - $preprocessed = ''; + $output = ''; + $preprocessed = ''; $no_preprocess = array('core' => '', 'module' => '', 'theme' => ''); - $files = array(); + $files = array(); $preprocess_js = (variable_get('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); + $directory = file_directory_path(); + $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('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 @@ -2061,11 +2101,13 @@ function drupal_get_js($scope = 'header' case 'setting': $output .= '\n"; break; + case 'inline': foreach ($data as $info) { $output .= '\n"; } break; + default: // If JS preprocessing is off, we still need to output the scripts. // Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones. @@ -2229,6 +2271,7 @@ function drupal_add_tabledrag($table_id, * An array of JS files to aggregate and compress into one file. * @param $filename * The name of the aggregate JS file. + * * @return * The name of the JS file. */ @@ -2271,20 +2314,25 @@ function drupal_clear_js_cache() { function drupal_to_js($var) { switch (gettype($var)) { case 'boolean': - return $var ? 'true' : 'false'; // Lowercase necessary! + // Lowercase necessary! + return $var ? 'true' : 'false'; + case 'integer': case 'double': return $var; + case 'resource': case 'string': return '"'. str_replace(array("\r", "\n", "<", ">", "&"), - array('\r', '\n', '\x3c', '\x3e', '\x26'), - addslashes($var)) .'"'; + array('\r', '\n', '\x3c', '\x3e', '\x26'), + addslashes($var) + ) .'"'; + case 'array': // Arrays in JSON can't be associative. If the array is empty or if it // has sequential whole number keys starting with 0, it's not associative // so we can go ahead and convert it as an array. - if (empty ($var) || array_keys($var) === range(0, sizeof($var) - 1)) { + if (empty($var) || array_keys($var) === range(0, sizeof($var) - 1)) { $output = array(); foreach ($var as $v) { $output[] = drupal_to_js($v); @@ -2298,6 +2346,7 @@ function drupal_to_js($var) { $output[] = drupal_to_js(strval($k)) .': '. drupal_to_js($v); } return '{ '. implode(', ', $output) .' }'; + default: return 'null'; } @@ -2343,8 +2392,9 @@ function drupal_json($var = NULL) { function drupal_urlencode($text) { if (variable_get('clean_url', '0')) { return str_replace(array('%2F', '%26', '%23', '//'), - array('/', '%2526', '%2523', '/%252F'), - rawurlencode($text)); + array('/', '%2526', '%2523', '/%252F'), + rawurlencode($text) + ); } else { return str_replace('%2F', '/', rawurlencode($text)); @@ -2385,6 +2435,7 @@ function drupal_get_token($value = '') { * An additional value to base the token on. * @param $skip_anonymous * Set to true to skip token validation for anonymous users. + * * @return * True for a valid token, false for an invalid token. When $skip_anonymous * is true, the return value will always be true for anonymous users. @@ -2407,6 +2458,7 @@ function drupal_valid_token($token, $val * For multiple requests (system.multicall): * An array of call arrays. Each call array follows the pattern of the single * request: method name followed by the arguments to the method. + * * @return * For one request: * Either the return value of the method on success, or FALSE. @@ -2498,6 +2550,7 @@ function page_set_cache() { /** * Executes a cron run when called + * * @return * Returns TRUE if ran successfully */ @@ -2624,7 +2677,6 @@ function drupal_system_listing($mask, $d return $files; } - /** * This dispatch function hands off structured Drupal arrays to type-specific * *_alter implementations. It ensures a consistent interface for all altering @@ -2673,7 +2725,6 @@ function drupal_alter($type, &$data) { } } - /** * Renders HTML given a structured array tree. * @@ -2683,6 +2734,7 @@ function drupal_alter($type, &$data) { * * @param $elements * The structured array describing the data to be rendered. + * * @return * The rendered HTML. */ @@ -2824,7 +2876,7 @@ function drupal_common_theme() { return array( // theme.inc 'placeholder' => array( - 'arguments' => array('text' => NULL) + 'arguments' => array('text' => NULL), ), 'page' => array( 'arguments' => array('content' => NULL, 'show_blocks' => TRUE, 'show_messages' => TRUE), @@ -2894,7 +2946,7 @@ function drupal_common_theme() { 'arguments' => array('url' => NULL, 'title' => NULL), ), 'more_link' => array( - 'arguments' => array('url' => NULL, 'title' => NULL) + 'arguments' => array('url' => NULL, 'title' => NULL), ), 'closure' => array( 'arguments' => array('main' => 0), @@ -3079,6 +3131,7 @@ function drupal_get_schema($table = NULL * * @param $module * The module for which the tables will be created. + * * @return * An array of arrays with the following key/value pairs: * success: a boolean indicating whether the query succeeded @@ -3104,6 +3157,7 @@ function drupal_install_schema($module) * * @param $module * The module for which the tables will be removed. + * * @return * An array of arrays with the following key/value pairs: * success: a boolean indicating whether the query succeeded @@ -3219,6 +3273,7 @@ function drupal_schema_fields_sql($table * If this is an update, specify the primary keys' field names. It is the * caller's responsibility to know if a record for this object already * exists in the database. If there is only 1 key, you may pass a simple string. + * * @return * Failure to write a record will return FALSE. Otherwise SAVED_NEW or * SAVED_UPDATED is returned depending on the operation performed. The @@ -3297,7 +3352,7 @@ function drupal_write_record($table, &$o $query .= $field .' = '. $placeholders[$id]; } - foreach ($update as $key){ + foreach ($update as $key) { $conditions[] = "$key = ". db_type_placeholder($schema['fields'][$key]['type']); $values[] = $object->$key; } @@ -3386,6 +3441,7 @@ function drupal_write_record($table, &$o * * @param $filename * The file we are parsing. Accepts file with relative or absolute path. + * * @return * The info array. */ @@ -3419,8 +3475,8 @@ function drupal_parse_info_file($filenam $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3; // Parse array syntax - $keys = preg_split('/\]?\[/', rtrim($key, ']')); - $last = array_pop($keys); + $keys = preg_split('/\]?\[/', rtrim($key, ']')); + $last = array_pop($keys); $parent = &$info; // Create nested arrays @@ -3451,6 +3507,7 @@ function drupal_parse_info_file($filenam } /** + * * @return * Array of the possible severity levels for log messages. * @@ -3458,18 +3515,17 @@ function drupal_parse_info_file($filenam */ function watchdog_severity_levels() { return array( - WATCHDOG_EMERG => t('emergency'), - WATCHDOG_ALERT => t('alert'), + WATCHDOG_EMERG => t('emergency'), + WATCHDOG_ALERT => t('alert'), WATCHDOG_CRITICAL => t('critical'), - WATCHDOG_ERROR => t('error'), - WATCHDOG_WARNING => t('warning'), - WATCHDOG_NOTICE => t('notice'), - WATCHDOG_INFO => t('info'), - WATCHDOG_DEBUG => t('debug'), + WATCHDOG_ERROR => t('error'), + WATCHDOG_WARNING => t('warning'), + WATCHDOG_NOTICE => t('notice'), + WATCHDOG_INFO => t('info'), + WATCHDOG_DEBUG => t('debug'), ); } - /** * Explode a string of given tags into an array. */ @@ -3545,10 +3601,11 @@ function drupal_flush_all_caches() { */ function _drupal_flush_css_js() { $string_history = variable_get('css_js_query_string', '00000000000000000000'); - $new_character = $string_history[0]; - $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + $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)); } + Index: includes/database.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.inc,v retrieving revision 1.92 diff -u -p -r1.92 database.inc --- includes/database.inc 8 Jan 2008 16:03:31 -0000 1.92 +++ includes/database.inc 20 Jan 2008 06:07:57 -0000 @@ -1,6 +1,7 @@ 'VARCHAR', - 'char:normal' => 'CHAR', - - 'text:tiny' => 'SMALLTEXT', - 'text:small' => 'SMALLTEXT', - 'text:medium' => 'MEDIUMTEXT', - 'text:big' => 'LONGTEXT', - 'text:normal' => 'TEXT', - - 'serial:tiny' => 'TINYINT', - 'serial:small' => 'SMALLINT', - 'serial:medium' => 'MEDIUMINT', - 'serial:big' => 'BIGINT', - 'serial:normal' => 'INT', - - 'int:tiny' => 'TINYINT', - 'int:small' => 'SMALLINT', - 'int:medium' => 'MEDIUMINT', - 'int:big' => 'BIGINT', - 'int:normal' => 'INT', - - 'float:tiny' => 'FLOAT', - 'float:small' => 'FLOAT', - 'float:medium' => 'FLOAT', - 'float:big' => 'DOUBLE', - 'float:normal' => 'FLOAT', - - 'numeric:normal' => 'DECIMAL', - - 'blob:big' => 'LONGBLOB', - 'blob:normal' => 'BLOB', - + 'varchar:normal' => 'VARCHAR', + 'char:normal' => 'CHAR', + 'text:tiny' => 'SMALLTEXT', + 'text:small' => 'SMALLTEXT', + 'text:medium' => 'MEDIUMTEXT', + 'text:big' => 'LONGTEXT', + 'text:normal' => 'TEXT', + 'serial:tiny' => 'TINYINT', + 'serial:small' => 'SMALLINT', + 'serial:medium' => 'MEDIUMINT', + 'serial:big' => 'BIGINT', + 'serial:normal' => 'INT', + 'int:tiny' => 'TINYINT', + 'int:small' => 'SMALLINT', + 'int:medium' => 'MEDIUMINT', + 'int:big' => 'BIGINT', + 'int:normal' => 'INT', + 'float:tiny' => 'FLOAT', + 'float:small' => 'FLOAT', + 'float:medium' => 'FLOAT', + 'float:big' => 'DOUBLE', + 'float:normal' => 'FLOAT', + 'numeric:normal' => 'DECIMAL', + 'blob:big' => 'LONGBLOB', + 'blob:normal' => 'BLOB', 'datetime:normal' => 'DATETIME', ); return $map; @@ -298,9 +294,9 @@ function db_add_field(&$ret, $table, $fi $ret[] = update_sql($query); if (isset($spec['initial'])) { // All this because update_sql does not support %-placeholders. - $sql = 'UPDATE {'. $table .'} SET '. $field .' = '. db_type_placeholder($spec['type']); + $sql = 'UPDATE {'. $table .'} SET '. $field .' = '. db_type_placeholder($spec['type']); $result = db_query($sql, $spec['initial']); - $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql .' ('. $spec['initial'] .')')); + $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql .' ('. $spec['initial'] .')')); } if ($fixnull) { $spec['not null'] = TRUE; @@ -371,7 +367,8 @@ function db_field_set_no_default(&$ret, */ function db_add_primary_key(&$ret, $table, $fields) { $ret[] = update_sql('ALTER TABLE {'. $table .'} ADD PRIMARY KEY ('. - _db_create_key_sql($fields) .')'); + _db_create_key_sql($fields) .')' + ); } /** @@ -400,7 +397,8 @@ function db_drop_primary_key(&$ret, $tab */ function db_add_unique_key(&$ret, $table, $name, $fields) { $ret[] = update_sql('ALTER TABLE {'. $table .'} ADD UNIQUE KEY '. - $name .' ('. _db_create_key_sql($fields) .')'); + $name .' ('. _db_create_key_sql($fields) .')' + ); } /** @@ -510,10 +508,8 @@ function db_drop_index(&$ret, $table, $n * table along with changing the field. The format is the same as a * table specification but without the 'fields' element. */ - function db_change_field(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) { - $sql = 'ALTER TABLE {'. $table .'} CHANGE '. $field .' '. - _db_create_field_sql($field_new, _db_process_field($spec)); + $sql = 'ALTER TABLE {'. $table .'} CHANGE '. $field .' '. _db_create_field_sql($field_new, _db_process_field($spec)); if (count($keys_new)) { $sql .= ', ADD '. implode(', ADD ', _db_create_keys_sql($keys_new)); } @@ -531,3 +527,4 @@ function db_change_field(&$ret, $table, function db_last_insert_id($table, $field) { return db_result(db_query('SELECT LAST_INSERT_ID()')); } + Index: includes/database.mysql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v retrieving revision 1.87 diff -u -p -r1.87 database.mysql.inc --- includes/database.mysql.inc 4 Jan 2008 09:31:48 -0000 1.87 +++ includes/database.mysql.inc 20 Jan 2008 06:07:57 -0000 @@ -1,6 +1,7 @@ $t('MySQL database'), @@ -117,8 +118,8 @@ function _db_query($query, $debug = 0) { if (variable_get('dev_query', 0)) { $query = $bt[2]['function'] ."\n". $query; list($usec, $sec) = explode(' ', microtime()); - $stop = (float)$usec + (float)$sec; - $diff = $stop - $timer; + $stop = (float)$usec + (float)$sec; + $diff = $stop - $timer; $queries[] = array($query, $diff); } @@ -142,6 +143,7 @@ function _db_query($query, $debug = 0) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * An object representing the next row of the result, or FALSE. The attributes * of this object are the table fields selected by the query. @@ -157,6 +159,7 @@ function db_fetch_object($result) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * An associative array representing the next row of the result, or FALSE. * The keys of this object are the names of the table fields selected by the @@ -176,6 +179,7 @@ function db_fetch_array($result) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * The resulting field or FALSE. */ @@ -229,18 +233,20 @@ function db_affected_rows() { * The first result row to return. * @param $count * The maximum number of result rows to return. + * * @return * A database query result resource, or FALSE if the query was not executed * correctly. */ function db_query_range($query) { - $args = func_get_args(); + $args = func_get_args(); $count = array_pop($args); - $from = array_pop($args); + $from = array_pop($args); array_shift($args); $query = db_prefix_tables($query); - if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax + if (isset($args[0]) and is_array($args[0])) { + // 'All arguments in one array' syntax $args = $args[0]; } _db_query_callback($args, TRUE); @@ -277,6 +283,7 @@ function db_query_range($query) { * @param $table * The name of the temporary table to select into. This name will not be * prefixed as there is no risk of collision. + * * @return * A database query result resource, or FALSE if the query was not executed * correctly. @@ -287,7 +294,8 @@ function db_query_temporary($query) { array_shift($args); $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' Engine=HEAP SELECT', db_prefix_tables($query)); - if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax + if (isset($args[0]) and is_array($args[0])) { + // 'All arguments in one array' syntax $args = $args[0]; } _db_query_callback($args, TRUE); @@ -300,6 +308,7 @@ function db_query_temporary($query) { * * @param $data * Data to encode. + * * @return * Encoded data. */ @@ -313,6 +322,7 @@ function db_encode_blob($data) { * * @param $data * Data to decode. + * * @return * Decoded data. */ @@ -365,6 +375,7 @@ function db_column_exists($table, $colum * @param $table Table containing the field to set as DISTINCT * @param $field Field to set as DISTINCT * @param $query Query to apply the wrapper to + * * @return SQL query with the DISTINCT wrapper surrounding the given table.field. */ function db_distinct_field($table, $field, $query) { @@ -376,3 +387,4 @@ function db_distinct_field($table, $fiel /** * @} End of "ingroup database". */ + Index: includes/database.mysqli.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysqli.inc,v retrieving revision 1.53 diff -u -p -r1.53 database.mysqli.inc --- includes/database.mysqli.inc 4 Jan 2008 09:31:48 -0000 1.53 +++ includes/database.mysqli.inc 20 Jan 2008 06:07:57 -0000 @@ -1,13 +1,14 @@ $t('MySQL database'), @@ -115,8 +116,8 @@ function _db_query($query, $debug = 0) { if (variable_get('dev_query', 0)) { $query = $bt[2]['function'] ."\n". $query; list($usec, $sec) = explode(' ', microtime()); - $stop = (float)$usec + (float)$sec; - $diff = $stop - $timer; + $stop = (float)$usec + (float)$sec; + $diff = $stop - $timer; $queries[] = array($query, $diff); } @@ -140,6 +141,7 @@ function _db_query($query, $debug = 0) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * An object representing the next row of the result, or FALSE. The attributes * of this object are the table fields selected by the query. @@ -156,6 +158,7 @@ function db_fetch_object($result) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * An associative array representing the next row of the result, or FALSE. * The keys of this object are the names of the table fields selected by the @@ -176,6 +179,7 @@ function db_fetch_array($result) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * The resulting field or FALSE. */ @@ -201,7 +205,8 @@ function db_error() { * Determine the number of rows changed by the preceding query. */ function db_affected_rows() { - global $active_db; /* mysqli connection resource */ + /* mysqli connection resource */ + global $active_db; return mysqli_affected_rows($active_db); } @@ -229,18 +234,20 @@ function db_affected_rows() { * The first result row to return. * @param $count * The maximum number of result rows to return. + * * @return * A database query result resource, or FALSE if the query was not executed * correctly. */ function db_query_range($query) { - $args = func_get_args(); + $args = func_get_args(); $count = array_pop($args); - $from = array_pop($args); + $from = array_pop($args); array_shift($args); $query = db_prefix_tables($query); - if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax + if (isset($args[0]) and is_array($args[0])) { + // 'All arguments in one array' syntax $args = $args[0]; } _db_query_callback($args, TRUE); @@ -277,6 +284,7 @@ function db_query_range($query) { * @param $table * The name of the temporary table to select into. This name will not be * prefixed as there is no risk of collision. + * * @return * A database query result resource, or FALSE if the query was not executed * correctly. @@ -287,7 +295,8 @@ function db_query_temporary($query) { array_shift($args); $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' Engine=HEAP SELECT', db_prefix_tables($query)); - if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax + if (isset($args[0]) and is_array($args[0])) { + // 'All arguments in one array' syntax $args = $args[0]; } _db_query_callback($args, TRUE); @@ -300,6 +309,7 @@ function db_query_temporary($query) { * * @param $data * Data to encode. + * * @return * Encoded data. */ @@ -313,6 +323,7 @@ function db_encode_blob($data) { * * @param $data * Data to decode. + * * @return * Decoded data. */ @@ -365,6 +376,7 @@ function db_column_exists($table, $colum * @param $table Table containing the field to set as DISTINCT * @param $field Field to set as DISTINCT * @param $query Query to apply the wrapper to + * * @return SQL query with the DISTINCT wrapper surrounding the given table.field. */ function db_distinct_field($table, $field, $query) { Index: includes/database.pgsql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v retrieving revision 1.68 diff -u -p -r1.68 database.pgsql.inc --- includes/database.pgsql.inc 4 Jan 2008 09:31:48 -0000 1.68 +++ includes/database.pgsql.inc 20 Jan 2008 06:07:57 -0000 @@ -1,6 +1,7 @@ $t('PostgreSQL database'), @@ -116,7 +117,8 @@ function db_query($query) { $args = func_get_args(); array_shift($args); $query = db_prefix_tables($query); - if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax + if (isset($args[0]) and is_array($args[0])) { + // 'All arguments in one array' syntax $args = $args[0]; } _db_query_callback($args, TRUE); @@ -141,8 +143,8 @@ function _db_query($query, $debug = 0) { $bt = debug_backtrace(); $query = $bt[2]['function'] ."\n". $query; list($usec, $sec) = explode(' ', microtime()); - $stop = (float)$usec + (float)$sec; - $diff = $stop - $timer; + $stop = (float)$usec + (float)$sec; + $diff = $stop - $timer; $queries[] = array($query, $diff); } @@ -166,6 +168,7 @@ function _db_query($query, $debug = 0) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * An object representing the next row of the result, or FALSE. The attributes * of this object are the table fields selected by the query. @@ -181,6 +184,7 @@ function db_fetch_object($result) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * An associative array representing the next row of the result, or FALSE. * The keys of this object are the names of the table fields selected by the @@ -200,6 +204,7 @@ function db_fetch_array($result) { * * @param $result * A database query result resource, as returned from db_query(). + * * @return * The resulting field or FALSE. */ @@ -264,18 +269,20 @@ function db_affected_rows() { * The first result row to return. * @param $count * The maximum number of result rows to return. + * * @return * A database query result resource, or FALSE if the query was not executed * correctly. */ function db_query_range($query) { - $args = func_get_args(); + $args = func_get_args(); $count = array_pop($args); - $from = array_pop($args); + $from = array_pop($args); array_shift($args); $query = db_prefix_tables($query); - if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax + if (isset($args[0]) and is_array($args[0])) { + // 'All arguments in one array' syntax $args = $args[0]; } _db_query_callback($args, TRUE); @@ -312,6 +319,7 @@ function db_query_range($query) { * @param $table * The name of the temporary table to select into. This name will not be * prefixed as there is no risk of collision. + * * @return * A database query result resource, or FALSE if the query was not executed * correctly. @@ -322,7 +330,8 @@ function db_query_temporary($query) { array_shift($args); $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' AS SELECT', db_prefix_tables($query)); - if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax + if (isset($args[0]) and is_array($args[0])) { + // 'All arguments in one array' syntax $args = $args[0]; } _db_query_callback($args, TRUE); @@ -336,6 +345,7 @@ function db_query_temporary($query) { * * @param $data * Data to encode. + * * @return * Encoded data. */ @@ -349,6 +359,7 @@ function db_encode_blob($data) { * * @param $data * Data to decode. + * * @return * Decoded data. */ @@ -415,13 +426,14 @@ function db_check_setup() { * @param $table Table containing the field to set as DISTINCT * @param $field Field to set as DISTINCT * @param $query Query to apply the wrapper to + * * @return SQL query with the DISTINCT wrapper surrounding the given table.field. */ function db_distinct_field($table, $field, $query) { $field_to_select = 'DISTINCT ON ('. $table .'.'. $field .") $table.$field"; // (? 'varchar', 'char:normal' => 'character', - 'text:tiny' => 'text', 'text:small' => 'text', 'text:medium' => 'text', 'text:big' => 'text', 'text:normal' => 'text', - 'int:tiny' => 'smallint', 'int:small' => 'smallint', 'int:medium' => 'int', 'int:big' => 'bigint', 'int:normal' => 'int', - 'float:tiny' => 'real', 'float:small' => 'real', 'float:medium' => 'real', 'float:big' => 'double precision', 'float:normal' => 'real', - 'numeric:normal' => 'numeric', - 'blob:big' => 'bytea', 'blob:normal' => 'bytea', - 'datetime:normal' => 'timestamp', - 'serial:tiny' => 'serial', 'serial:small' => 'serial', 'serial:medium' => 'serial', @@ -487,6 +492,7 @@ function db_type_map() { * The name of the table to create. * @param $table * A Schema API table definition array. + * * @return * An array of SQL statements to create the table. */ @@ -684,9 +690,9 @@ function db_add_field(&$ret, $table, $fi $ret[] = update_sql($query); if (isset($spec['initial'])) { // All this because update_sql does not support %-placeholders. - $sql = 'UPDATE {'. $table .'} SET '. $field .' = '. db_type_placeholder($spec['type']); + $sql = 'UPDATE {'. $table .'} SET '. $field .' = '. db_type_placeholder($spec['type']); $result = db_query($sql, $spec['initial']); - $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql .' ('. $spec['initial'] .')')); + $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql .' ('. $spec['initial'] .')')); } if ($fixnull) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $field SET NOT NULL"); @@ -759,7 +765,8 @@ function db_field_set_no_default(&$ret, */ function db_add_primary_key(&$ret, $table, $fields) { $ret[] = update_sql('ALTER TABLE {'. $table .'} ADD PRIMARY KEY ('. - implode(',', $fields) .')'); + implode(',', $fields) .')' + ); } /** @@ -789,7 +796,8 @@ function db_drop_primary_key(&$ret, $tab function db_add_unique_key(&$ret, $table, $name, $fields) { $name = '{'. $table .'}_'. $name .'_key'; $ret[] = update_sql('ALTER TABLE {'. $table .'} ADD CONSTRAINT '. - $name .' UNIQUE ('. implode(',', $fields) .')'); + $name .' UNIQUE ('. implode(',', $fields) .')' + ); } /** Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.118 diff -u -p -r1.118 file.inc --- includes/file.inc 9 Jan 2008 10:39:48 -0000 1.118 +++ includes/file.inc 20 Jan 2008 06:07:57 -0000 @@ -1,6 +1,7 @@ TRUE)); } @@ -57,6 +60,7 @@ function file_create_url($path) { * * @param $dest A string containing the path to verify. If this value is * omitted, Drupal's 'files' directory will be used. + * * @return A string containing the path to file, with file system directory * appended if necessary, or FALSE if the path is invalid (i.e. outside the * configured 'files' or temp directories). @@ -93,6 +97,7 @@ function file_create_path($dest = 0) { * any errors will be attached to. This is useful for settings forms that * require the user to specify a writable directory. If it can't be made to * work, a form error will be set preventing them from saving the settings. + * * @return FALSE when directory not found, or TRUE when directory exists. */ function file_check_directory(&$directory, $mode = 0, $form_item = NULL) { @@ -102,7 +107,8 @@ function file_check_directory(&$director if (!is_dir($directory)) { if (($mode & FILE_CREATE_DIRECTORY) && @mkdir($directory)) { drupal_set_message(t('The directory %directory has been created.', array('%directory' => $directory))); - @chmod($directory, 0775); // Necessary for non-webserver users. + // Necessary for non-webserver users. + @chmod($directory, 0775); } else { if ($form_item) { @@ -145,6 +151,7 @@ function file_check_directory(&$director * * @param $path A string containing a file path. This will be set to the * directory's path. + * * @return If the directory is not in a Drupal writable directory, FALSE is * returned. Otherwise, the base name of the path is returned. */ @@ -176,6 +183,7 @@ function file_check_path(&$path) { * * @param $source A string set to the file to check. * @param $directory A string where the file should be located. + * * @return 0 for invalid path or the real path of the source. */ function file_check_location($source, $directory = '') { @@ -211,13 +219,14 @@ function file_check_location($source, $d * - FILE_EXISTS_REPLACE - Replace the existing file * - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is unique * - FILE_EXISTS_ERROR - Do nothing and return FALSE. + * * @return True for success, FALSE for failure. */ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) { - $dest = file_create_path($dest); + $dest = file_create_path($dest); $directory = $dest; - $basename = file_check_path($directory); + $basename = file_check_path($directory); // Make sure we at least have a valid directory. if ($basename === FALSE) { @@ -270,13 +279,14 @@ function file_copy(&$source, $dest = 0, if (isset($file) && is_object($file)) { $file->filename = $basename; $file->filepath = $dest; - $source = $file; + $source = $file; } else { $source = $dest; } - return 1; // Everything went ok. + // Everything went ok. + return 1; } /** @@ -289,6 +299,7 @@ function file_copy(&$source, $dest = 0, * - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is * unique * - FILE_EXISTS_ERROR - Do nothing and return FALSE. + * * @return The destination file path or FALSE if the file already exists and * FILE_EXISTS_ERROR was specified. */ @@ -296,8 +307,8 @@ function file_destination($destination, if (file_exists($destination)) { switch ($replace) { case FILE_EXISTS_RENAME: - $basename = basename($destination); - $directory = dirname($destination); + $basename = basename($destination); + $directory = dirname($destination); $destination = file_create_filename($basename, $directory); break; @@ -325,6 +336,7 @@ function file_destination($destination, * - FILE_EXISTS_REPLACE - Replace the existing file * - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is unique * - FILE_EXISTS_ERROR - Do nothing and return FALSE. + * * @return True for success, FALSE for failure. */ function file_move(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) { @@ -350,6 +362,7 @@ function file_move(&$source, $dest = 0, * be altered. * @param $alerts Whether alerts (watchdog, drupal_set_message()) should be * displayed. + * * @return $filename The potentially modified $filename. */ function file_munge_filename($filename, $extensions, $alerts = TRUE) { @@ -362,9 +375,10 @@ function file_munge_filename($filename, // Split the filename up by periods. The first part becomes the basename // the last part the final extension. $filename_parts = explode('.', $filename); - $new_filename = array_shift($filename_parts); // Remove file basename. - $final_extension = array_pop($filename_parts); // Remove final extension. - + // Remove file basename. + $new_filename = array_shift($filename_parts); + // Remove final extension. + $final_extension = array_pop($filename_parts); // Loop through the middle parts of the name and add an underscore to the // end of each section that could be a file extension but isn't in the list // of allowed extensions. @@ -388,6 +402,7 @@ function file_munge_filename($filename, * Undo the effect of upload_munge_filename(). * * @param $filename string filename + * * @return string */ function file_unmunge_filename($filename) { @@ -400,6 +415,7 @@ function file_unmunge_filename($filename * * @param $basename string filename * @param $directory string directory + * * @return */ function file_create_filename($basename, $directory) { @@ -428,6 +444,7 @@ function file_create_filename($basename, * Delete a file. * * @param $path A string containing a file path. + * * @return TRUE for success, FALSE for failure. */ function file_delete($path) { @@ -474,6 +491,7 @@ function file_space_used($uid = NULL) { * A boolean indicating whether an existing file of the same name in the * destination directory should overwritten. A false value will generate a * new, unique filename in the destination directory. + * * @return * An object containing the file information, or 0 in the event of an error. */ @@ -496,6 +514,7 @@ function file_save_upload($source, $vali // lower level system error occurred. switch ($_FILES['files']['error'][$source]) { // @see http://php.net/manual/en/features.file-upload.errors.php + case UPLOAD_ERR_OK: break; @@ -509,7 +528,8 @@ function file_save_upload($source, $vali drupal_set_message(t('The file %file could not be saved, because the upload did not complete.', array('%file' => $source)), 'error'); return 0; - // Unknown error + // Unknown error + default: drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $source)), 'error'); return 0; @@ -520,11 +540,12 @@ function file_save_upload($source, $vali $extensions = ''; foreach ($user->roles as $rid => $name) { $extensions .= ' '. variable_get("upload_extensions_$rid", - variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp')); + variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp') + ); } // Begin building file object. - $file = new stdClass(); + $file = new stdClass(); $file->filename = file_munge_filename(trim(basename($_FILES['files']['name'][$source]), '.'), $extensions); $file->filepath = $_FILES['files']['tmp_name'][$source]; $file->filemime = $_FILES['files']['type'][$source]; @@ -542,9 +563,9 @@ function file_save_upload($source, $vali $dest = file_directory_temp(); } - $file->source = $source; + $file->source = $source; $file->destination = file_destination(file_create_path($dest .'/'. $file->filename), FILE_EXISTS_RENAME); - $file->filesize = $_FILES['files']['size'][$source]; + $file->filesize = $_FILES['files']['size'][$source]; // Call the validation functions. $errors = array(); @@ -576,8 +597,8 @@ function file_save_upload($source, $vali } // If we made it this far it's safe to record this file in the database. - $file->uid = $user->uid; - $file->status = FILE_STATUS_TEMPORARY; + $file->uid = $user->uid; + $file->status = FILE_STATUS_TEMPORARY; $file->timestamp = time(); drupal_write_record('files', $file); @@ -593,6 +614,7 @@ function file_save_upload($source, $vali * * @param $file * A Drupal file object. + * * @return * An array. If the file name is too long, it will contain an error message. */ @@ -613,6 +635,7 @@ function file_validate_name_length($file * A Drupal file object. * @param $extensions * A string with a space separated + * * @return * An array. If the file extension is not allowed, it will contain an error message. */ @@ -643,6 +666,7 @@ function file_validate_extensions($file, * @param $$user_limit * An integer specifying the maximum number of bytes the user is allowed. Zero * indicates that no limit should be enforced. + * * @return * An array. If the file size exceeds limits, it will contain an error message. */ @@ -670,6 +694,7 @@ function file_validate_size($file, $file * * @param $file * A Drupal file object. + * * @return * An array. If the file is not an image, it will contain an error message. */ @@ -698,6 +723,7 @@ function file_validate_is_image(&$file) * @param $minimum_dimensions * An optional string in the form WIDTHxHEIGHT. This will check that the image * meets a minimum size. A value of 0 indicates no restriction. + * * @return * An array. If the file is an image and did not meet the requirements, it * will contain an error message. @@ -773,6 +799,7 @@ function file_save_data($data, $dest, $r * * @param file A Drupal file object * @param status A status value to set the file to. + * * @return FALSE on failure, TRUE on success and $file->status will contain the * status. */ @@ -831,7 +858,7 @@ function file_download() { // Maintain compatibility with old ?file=paths saved in node bodies. if (isset($_GET['file'])) { - $filepath = $_GET['file']; + $filepath = $_GET['file']; } if (file_exists(file_create_path($filepath))) { @@ -846,7 +873,6 @@ function file_download() { return drupal_not_found(); } - /** * Finds all files that match a given mask in a given directory. * Directories and files beginning with a period are excluded; this @@ -930,8 +956,8 @@ function file_directory_temp() { // Operating system specific dirs. if (substr(PHP_OS, 0, 3) == 'WIN') { - $directories[] = 'c:\\windows\\temp'; - $directories[] = 'c:\\winnt\\temp'; + $directories[] = 'c:\\windows\\temp'; + $directories[] = 'c:\\winnt\\temp'; $path_delimiter = '\\'; } else { @@ -973,8 +999,9 @@ function file_upload_max_size() { if ($max_size < 0) { $upload_max = parse_size(ini_get('upload_max_filesize')); - $post_max = parse_size(ini_get('post_max_size')); - $max_size = ($upload_max < $post_max) ? $upload_max : $post_max; + $post_max = parse_size(ini_get('post_max_size')); + $max_size = ($upload_max < $post_max) ? $upload_max : $post_max; } return $max_size; } + Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.258 diff -u -p -r1.258 form.inc --- includes/form.inc 2 Jan 2008 15:18:15 -0000 1.258 +++ includes/form.inc 20 Jan 2008 06:07:57 -0000 @@ -1,6 +1,7 @@ NULL, 'submitted' => FALSE); - $args = func_get_args(); - $cacheable = FALSE; + $args = func_get_args(); + $cacheable = FALSE; if (isset($_SESSION['batch_form_state'])) { // We've been redirected here after a batch processing : the form has @@ -80,8 +82,8 @@ function drupal_get_form($form_id) { $args_temp[0] = &$form_state; array_unshift($args_temp, $form_id); - $form = call_user_func_array('drupal_retrieve_form', $args_temp); - $form_build_id = 'form-'. md5(mt_rand()); + $form = call_user_func_array('drupal_retrieve_form', $args_temp); + $form_build_id = 'form-'. md5(mt_rand()); $form['#build_id'] = $form_build_id; drupal_prepare_form($form_id, $form, $form_state); // Store a copy of the unprocessed form for caching and indicate that it @@ -119,7 +121,6 @@ function drupal_get_form($form_id) { // workflow is NOT complete. We need to construct a fresh copy of // the form, passing in the latest $form_state in addition to any // other variables passed into drupal_get_form(). - if (!empty($form_state['rebuild']) || !empty($form_state['storage'])) { $form = drupal_rebuild_form($form_id, $form_state, $args); } @@ -163,6 +164,7 @@ function drupal_get_form($form_id) { * If the AHAH callback calling this function only alters part of the form, * then pass in the existing form_build_id so we can re-cache with the same * csid. + * * @return * The newly built form. */ @@ -263,8 +265,8 @@ function form_set_cache($form_build_id, * drupal_execute('story_node_form', $form_state, $node); */ function drupal_execute($form_id, &$form_state) { - $args = func_get_args(); - $form = call_user_func_array('drupal_retrieve_form', $args); + $args = func_get_args(); + $form = call_user_func_array('drupal_retrieve_form', $args); $form['#post'] = $form_state['values']; drupal_prepare_form($form_id, $form, $form_state); drupal_process_form($form_id, $form, $form_state); @@ -392,7 +394,7 @@ function drupal_process_form($form_id, & // possibly ending execution. We make sure we do not react to the batch // that is already being processed (if a batch operation performs a // drupal_execute). - if ($batch =& batch_get() && !isset($batch['current_set'])) { + if ($batch = &batch_get() && !isset($batch['current_set'])) { // The batch uses its own copies of $form and $form_state for // late execution of submit handers and post-batch redirection. $batch['form'] = $form; @@ -511,7 +513,6 @@ function drupal_prepare_form($form_id, & drupal_alter('form', $data, $form_id); } - /** * Validates user-submitted form data from the $form_state using * the validate functions defined in a structured form array. @@ -560,6 +561,7 @@ function drupal_validate_form($form_id, * theming, and hook_form_alter functions. * @param $form * An associative array containing the structure of the form. + * * @return * A string containing the path of the page to display when processing * is complete. @@ -685,7 +687,7 @@ function _form_validate($elements, &$for // #value data. elseif (isset($elements['#element_validate'])) { foreach ($elements['#element_validate'] as $function) { - if (function_exists($function)) { + if (function_exists($function)) { $function($elements, $form_state); } } @@ -722,8 +724,8 @@ function form_execute_handlers($type, &$ } foreach ($handlers as $function) { - if (function_exists($function)) { - if ($type == 'submit' && ($batch =& batch_get())) { + if (function_exists($function)) { + if ($type == 'submit' && ($batch = &batch_get())) { // Some previous _submit handler has set a batch. We store the call // in a special 'control' batch set, for execution at the correct // time during the batch processing workflow. @@ -748,6 +750,7 @@ function form_execute_handlers($type, &$ * element where the #parents array starts with 'foo'. * @param $message * The error message to present to the user. + * * @return * Never use the return value of this function, use form_get_errors and * form_get_error instead. @@ -865,7 +868,7 @@ function form_builder($form_id, $form, & // Assign a decimal placeholder weight to preserve original array order. if (!isset($form[$key]['#weight'])) { - $form[$key]['#weight'] = $count/1000; + $form[$key]['#weight'] = $count / 1000; } else { // If one of the child elements has a weight then we will need to sort @@ -1073,6 +1076,7 @@ function _form_builder_ie_cleanup($form, * @param $edit * The incoming POST data to populate the form element. If this is FALSE, * the element's default value should be returned. + * * @return * The data that will appear in the $form_state['values'] collection * for this element. Return nothing to use the default. @@ -1118,6 +1122,7 @@ function form_type_image_button_value($f * @param $edit * The incoming POST data to populate the form element. If this is FALSE, * the element's default value should be returned. + * * @return * The data that will appear in the $form_state['values'] collection * for this element. Return nothing to use the default. @@ -1136,6 +1141,7 @@ function form_type_checkbox_value($form, * @param $edit * The incoming POST data to populate the form element. If this is FALSE, * the element's default value should be returned. + * * @return * The data that will appear in the $form_state['values'] collection * for this element. Return nothing to use the default. @@ -1163,6 +1169,7 @@ function form_type_checkboxes_value($for * @param $edit * The incoming POST data to populate the form element. If this is FALSE, * the element's default value should be returned. + * * @return * The data that will appear in the $form_state['values'] collection * for this element. Return nothing to use the default. @@ -1182,6 +1189,7 @@ function form_type_password_confirm_valu * @param $edit * The incoming POST data to populate the form element. If this is FALSE, * the element's default value should be returned. + * * @return * The data that will appear in the $form_state['values'] collection * for this element. Return nothing to use the default. @@ -1205,6 +1213,7 @@ function form_type_select_value($form, $ * @param $edit * The incoming POST data to populate the form element. If this is FALSE, * the element's default value should be returned. + * * @return * The data that will appear in the $form_state['values'] collection * for this element. Return nothing to use the default. @@ -1225,6 +1234,7 @@ function form_type_textfield_value($form * @param $edit * The incoming POST data to populate the form element. If this is FALSE, * the element's default value should be returned. + * * @return * The data that will appear in the $form_state['values'] collection * for this element. Return nothing to use the default. @@ -1283,7 +1293,7 @@ function _element_info($type, $refresh = '#attributes' => array(), '#required' => FALSE, '#tree' => FALSE, - '#parents' => array() + '#parents' => array(), ); if (!isset($cache) || $refresh) { $cache = array(); @@ -1331,6 +1341,7 @@ function form_options_flatten($array, $r * @param $element * An associative array containing the properties of the element. * Properties used: title, value, options, description, extra, multiple, required + * * @return * A themed HTML string representing the form element. * @@ -1354,9 +1365,9 @@ function form_select_options($element, $ } // array_key_exists() accommodates the rare event where $element['#value'] is NULL. // isset() fails in this situation. - $value_valid = isset($element['#value']) || array_key_exists('#value', $element); + $value_valid = isset($element['#value']) || array_key_exists('#value', $element); $value_is_array = is_array($element['#value']); - $options = ''; + $options = ''; foreach ($choices as $key => $choice) { if (is_array($choice)) { $options .= ''; @@ -1408,6 +1419,7 @@ function form_select_options($element, $ * The select element to search. * @param $key * The key to look for. + * * @return * An array of indexes that match the given $key. Array will be * empty if no elements were found. FALSE if optgroups were found. @@ -1436,6 +1448,7 @@ function form_get_options($element, $key * @param $element * An associative array containing the properties of the element. * Properties used: attributes, title, value, description, children, collapsible, collapsed + * * @return * A themed HTML string representing the form item group. * @@ -1464,6 +1477,7 @@ function theme_fieldset($element) { * @param $element * An associative array containing the properties of the element. * Properties used: required, return_value, value, attributes, title, description + * * @return * A themed HTML string representing the form item group. * @@ -1490,6 +1504,7 @@ function theme_radio($element) { * @param $element * An associative array containing the properties of the element. * Properties used: title, value, options, description, required and attributes. + * * @return * A themed HTML string representing the radio button set. * @@ -1516,6 +1531,7 @@ function theme_radios($element) { * @param $element * An associative array containing the properties of the element. * Properties used: title, value, id, required, error. + * * @return * A themed HTML string representing the form item. * @@ -1529,14 +1545,14 @@ function theme_password_confirm($element * Expand a password_confirm field into two text boxes. */ function expand_password_confirm($element) { - $element['pass1'] = array( + $element['pass1'] = array( '#type' => 'password', '#title' => t('Password'), '#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'], '#required' => $element['#required'], '#attributes' => array('class' => 'password-field'), ); - $element['pass2'] = array( + $element['pass2'] = array( '#type' => 'password', '#title' => t('Confirm password'), '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'], @@ -1575,7 +1591,6 @@ function password_confirm_validate($form form_set_value($form, $pass1, $form_state); return $form; - } /** @@ -1584,6 +1599,7 @@ function password_confirm_validate($form * @param $element * An associative array containing the properties of the element. * Properties used: title, value, options, description, required and attributes. + * * @return * A themed HTML string representing the date selection boxes. * @@ -1600,18 +1616,19 @@ function expand_date($element) { // Default to current date if (empty($element['#value'])) { $element['#value'] = array('day' => format_date(time(), 'custom', 'j'), - 'month' => format_date(time(), 'custom', 'n'), - 'year' => format_date(time(), 'custom', 'Y')); + 'month' => format_date(time(), 'custom', 'n'), + 'year' => format_date(time(), 'custom', 'Y'), + ); } $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'); - $sort = array(); - $sort['day'] = max(strpos($format, 'd'), strpos($format, 'j')); + $format = variable_get('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')); - $sort['year'] = strpos($format, 'Y'); + $sort['year'] = strpos($format, 'Y'); asort($sort); $order = array_keys($sort); @@ -1621,15 +1638,17 @@ function expand_date($element) { case 'day': $options = drupal_map_assoc(range(1, 31)); break; + case 'month': $options = drupal_map_assoc(range(1, 12), 'map_month'); break; + case 'year': $options = drupal_map_assoc(range(1900, 2050)); break; } - $parents = $element['#parents']; - $parents[] = $type; + $parents = $element['#parents']; + $parents[] = $type; $element[$type] = array( '#type' => 'select', '#value' => $element['#value'][$type], @@ -1705,6 +1724,7 @@ function expand_radios($element) { * An associative array containing the properties of the element. * Properties used: ahah_event, ahah_path, ahah_wrapper, ahah_parameters, * ahah_effect. + * * @return * None. Additional code is added to the header of the page using * drupal_add_js. @@ -1719,11 +1739,13 @@ function form_expand_ahah($element) { case 'image_button': $element['#ahah']['event'] = 'click'; break; + case 'password': case 'textfield': case 'textarea': $element['#ahah']['event'] = 'blur'; break; + case 'radio': case 'checkbox': case 'select': @@ -1739,14 +1761,14 @@ function form_expand_ahah($element) { drupal_add_js('misc/ahah.js'); $ahah_binding = array( - 'url' => url($element['#ahah']['path']), - 'event' => $element['#ahah']['event'], - 'wrapper' => empty($element['#ahah']['wrapper']) ? NULL : $element['#ahah']['wrapper'], + 'url' => url($element['#ahah']['path']), + 'event' => $element['#ahah']['event'], + 'wrapper' => empty($element['#ahah']['wrapper']) ? NULL : $element['#ahah']['wrapper'], 'selector' => empty($element['#ahah']['selector']) ? '#'. $element['#id'] : $element['#ahah']['selector'], - 'effect' => empty($element['#ahah']['effect']) ? 'none' : $element['#ahah']['effect'], - 'method' => empty($element['#ahah']['method']) ? 'replace' : $element['#ahah']['method'], + 'effect' => empty($element['#ahah']['effect']) ? 'none' : $element['#ahah']['effect'], + 'method' => empty($element['#ahah']['method']) ? 'replace' : $element['#ahah']['method'], 'progress' => empty($element['#ahah']['progress']) ? array('type' => 'throbber') : $element['#ahah']['progress'], - 'button' => isset($element['#executes_submit_callback']) ? array($element['#name'] => $element['#value']) : FALSE, + 'button' => isset($element['#executes_submit_callback']) ? array($element['#name'] => $element['#value']) : FALSE, ); // Convert a simple #ahah[progress] type string into an array. @@ -1777,6 +1799,7 @@ function form_expand_ahah($element) { * @param $element * An associative array containing the properties of the element. * Properties used: title, value, description, required, error + * * @return * A themed HTML string representing the form item. * @@ -1792,6 +1815,7 @@ function theme_item($element) { * @param $element * An associative array containing the properties of the element. * Properties used: title, value, return_value, description, required + * * @return * A themed HTML string representing the checkbox. * @@ -1802,7 +1826,7 @@ function theme_checkbox($element) { $checkbox = ''; @@ -1820,6 +1844,7 @@ function theme_checkbox($element) { * * @param $element * An associative array containing the properties of the element. + * * @return * A themed HTML string representing the checkbox set. * @@ -1896,13 +1921,7 @@ function theme_image_button($element) { $element['#attributes']['class'] = 'form-'. $element['#button_type']; } - return '\n"; + return '\n"; } /** @@ -1911,6 +1930,7 @@ function theme_image_button($element) { * @param $element * An associative array containing the properties of the element. * Properties used: value, edit + * * @return * A themed HTML string representing the hidden form field. * @@ -1935,22 +1955,23 @@ function theme_token($element) { * @param $element * An associative array containing the properties of the element. * Properties used: title, value, description, size, maxlength, required, attributes autocomplete_path + * * @return * A themed HTML string representing the textfield. * * @ingroup themeable */ function theme_textfield($element) { - $size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"'; + $size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"'; $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"'; - $class = array('form-text'); - $extra = ''; - $output = ''; + $class = array('form-text'); + $extra = ''; + $output = ''; if ($element['#autocomplete_path']) { drupal_add_js('misc/autocomplete.js'); $class[] = 'form-autocomplete'; - $extra = ''; + $extra = ''; } _form_set_class($element, $class); @@ -1973,6 +1994,7 @@ function theme_textfield($element) { * @param $element * An associative array containing the properties of the element. * Properties used: action, method, attributes, children + * * @return * A themed HTML string representing the form. * @@ -1990,6 +2012,7 @@ function theme_form($element) { * @param $element * An associative array containing the properties of the element. * Properties used: title, value, description, rows, cols, required, attributes + * * @return * A themed HTML string representing the textarea. * @@ -2025,12 +2048,12 @@ function theme_textarea($element) { * @param $element * An associative array containing the properties of the element. * Properties used: value, children. + * * @return * A themed HTML string representing the HTML markup. * * @ingroup themeable */ - function theme_markup($element) { return (isset($element['#value']) ? $element['#value'] : '') . (isset($element['#children']) ? $element['#children'] : ''); } @@ -2041,6 +2064,7 @@ function theme_markup($element) { * @param $element * An associative array containing the properties of the element. * Properties used: title, value, description, size, maxlength, required, attributes + * * @return * A themed HTML string representing the form. * @@ -2082,6 +2106,7 @@ function process_weight($element) { * Explanatory text to display after the form item. * @param $required * Whether the user must upload a file to the field. + * * @return * A themed HTML string representing the field. * @@ -2103,6 +2128,7 @@ function theme_file($element) { * Properties used: title, description, id, required * @param $value * The form element's data. + * * @return * A string representing the form element. * @@ -2176,6 +2202,7 @@ function _form_set_class(&$element, $cla * used if a form has completed the validation process. This parameter * should never be set to TRUE if this function is being called to * assign an ID to the #ID element. + * * @return * The cleaned ID. */ @@ -2346,7 +2373,7 @@ function form_clean_id($id = NULL, $flus */ function batch_set($batch_definition) { if ($batch_definition) { - $batch =& batch_get(); + $batch = &batch_get(); // Initialize the batch if (empty($batch)) { $batch = array( @@ -2377,8 +2404,8 @@ function batch_set($batch_definition) { // insert the new set after the current one. if (isset($batch['current_set'])) { // array_insert does not exist... - $slice1 = array_slice($batch['sets'], 0, $batch['current_set'] + 1); - $slice2 = array_slice($batch['sets'], $batch['current_set'] + 1); + $slice1 = array_slice($batch['sets'], 0, $batch['current_set'] + 1); + $slice2 = array_slice($batch['sets'], $batch['current_set'] + 1); $batch['sets'] = array_merge($slice1, array($batch_set), $slice2); } else { @@ -2403,7 +2430,7 @@ function batch_set($batch_definition) { * URL of the batch processing page. */ function batch_process($redirect = NULL, $url = NULL) { - $batch =& batch_get(); + $batch = &batch_get(); if (isset($batch)) { // Add process information @@ -2465,3 +2492,4 @@ function &batch_get() { /** * @} End of "defgroup batch". */ + Index: includes/image.gd.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/image.gd.inc,v retrieving revision 1.4 diff -u -p -r1.4 image.gd.inc --- includes/image.gd.inc 15 Jan 2008 10:17:42 -0000 1.4 +++ includes/image.gd.inc 20 Jan 2008 06:07:58 -0000 @@ -1,6 +1,7 @@ t('The GD toolkit is installed and working properly.') + '#value' => t('The GD toolkit is installed and working properly.'), ); $form['image_jpeg_quality'] = array( @@ -38,7 +39,7 @@ function image_gd_settings() { '#field_suffix' => t('%'), ); $form['#element_validate'] = array('image_gd_settings_validate'); - + return $form; } else { @@ -178,6 +179,7 @@ function image_gd_crop($source, $destina * A string file path where the iamge should be saved. * @param $extension * A string containing one of the following extensions: gif, jpg, jpeg, png. + * * @return * An image resource, or FALSE on error. */ @@ -199,6 +201,7 @@ function image_gd_open($file, $extension * A string file path where the iamge should be saved. * @param $extension * A string containing one of the following extensions: gif, jpg, jpeg, png. + * * @return * Boolean indicating success. */ @@ -219,3 +222,4 @@ function image_gd_close($res, $destinati /** * @} End of "ingroup image". */ + Index: includes/image.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/image.inc,v retrieving revision 1.23 diff -u -p -r1.23 image.inc --- includes/image.inc 8 Aug 2007 07:46:09 -0000 1.23 +++ includes/image.inc 20 Jan 2008 06:07:58 -0000 @@ -1,6 +1,7 @@ 'gif', '2' => 'jpg', '3' => 'png'); - $extension = array_key_exists($data[2], $extensions) ? $extensions[$data[2]] : ''; - $details = array('width' => $data[0], - 'height' => $data[1], - 'extension' => $extension, - 'file_size' => $file_size, - 'mime_type' => $data['mime']); + $extension = array_key_exists($data[2], $extensions) ? $extensions[$data[2]] : ''; + $details = array('width' => $data[0], + 'height' => $data[1], + 'extension' => $extension, + 'file_size' => $file_size, + 'mime_type' => $data['mime'], + ); } return $details; @@ -176,15 +178,16 @@ function image_get_info($file) { * The target width, in pixels. * @param $height * The target height, in pixels. + * * @return * TRUE or FALSE, based on success. */ function image_scale_and_crop($source, $destination, $width, $height) { - $info = image_get_info($source); + $info = image_get_info($source); $scale = max($width / $info['width'], $height / $info['height']); - $x = round(($info['width'] * $scale - $width) / 2); - $y = round(($info['height'] * $scale - $height) / 2); + $x = round(($info['width'] * $scale - $width) / 2); + $y = round(($info['height'] * $scale - $height) / 2); if (image_toolkit_invoke('resize', array($source, $destination, $info['width'] * $scale, $info['height'] * $scale))) { return image_toolkit_invoke('crop', array($destination, $destination, $x, $y, $width, $height)); @@ -206,6 +209,7 @@ function image_scale_and_crop($source, $ * The target width, in pixels. * @param $height * The target height, in pixels. + * * @return * TRUE or FALSE, based on success. */ @@ -241,7 +245,8 @@ function image_scale($source, $destinati * The target width, in pixels. * @param $height * The target height, in pixels. - * @return + * + * @return * TRUE or FALSE, based on success. */ function image_resize($source, $destination, $width, $height) { @@ -261,6 +266,7 @@ function image_resize($source, $destinat * An hexidecimal integer specifying the background color to use for the * uncovered area of the image after the rotation. E.g. 0x000000 for black, * 0xff00ff for magenta, and 0xffffff for white. + * * @return * TRUE or FALSE, based on success. */ @@ -283,6 +289,7 @@ function image_rotate($source, $destinat * The target width, in pixels. * @param $height * The target height, in pixels. + * * @return * TRUE or FALSE, based on success. */ @@ -293,3 +300,4 @@ function image_crop($source, $destinatio /** * @} End of "defgroup image". */ + Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.56 diff -u -p -r1.56 install.inc --- includes/install.inc 19 Dec 2007 11:15:18 -0000 1.56 +++ includes/install.inc 20 Jan 2008 06:07:58 -0000 @@ -9,13 +9,13 @@ define('REQUIREMENT_OK', 0); define('REQUIREMENT_WARNING', 1); define('REQUIREMENT_ERROR', 2); -define('FILE_EXIST', 1); -define('FILE_READABLE', 2); -define('FILE_WRITABLE', 4); -define('FILE_EXECUTABLE', 8); -define('FILE_NOT_EXIST', 16); -define('FILE_NOT_READABLE', 32); -define('FILE_NOT_WRITABLE', 64); +define('FILE_EXIST', 1); +define('FILE_READABLE', 2); +define('FILE_WRITABLE', 4); +define('FILE_EXECUTABLE', 8); +define('FILE_NOT_EXIST', 16); +define('FILE_NOT_READABLE', 32); +define('FILE_NOT_WRITABLE', 64); define('FILE_NOT_EXECUTABLE', 128); /** @@ -34,6 +34,7 @@ function drupal_load_updates() { * * @param $module * A module name. + * * @return * If the module has updates, an array of available updates. Otherwise, * FALSE. @@ -65,6 +66,7 @@ function drupal_get_schema_versions($mod * @param $array * Set to TRUE if you want to get information about all modules in the * system. + * * @return * The currently installed schema version. */ @@ -133,10 +135,10 @@ function drupal_install_profile_name() { function drupal_detect_baseurl($file = 'install.php') { global $profile; $proto = $_SERVER['HTTPS'] ? 'https://' : 'http://'; - $host = $_SERVER['SERVER_NAME']; - $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'. $_SERVER['SERVER_PORT']); - $uri = preg_replace("/\?.*/", '', $_SERVER['REQUEST_URI']); - $dir = str_replace("/$file", '', $uri); + $host = $_SERVER['SERVER_NAME']; + $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'. $_SERVER['SERVER_PORT']); + $uri = preg_replace("/\?.*/", '', $_SERVER['REQUEST_URI']); + $dir = str_replace("/$file", '', $uri); return "$proto$host$port$dir"; } @@ -234,7 +236,7 @@ function drupal_rewrite_settings($settin $fp = fopen($settings_file, 'w'); if ($fp && fwrite($fp, $buffer) === FALSE) { - drupal_set_message(st('Failed to modify %settings, please verify the file permissions.', array('%settings' => $settings_file)), 'error'); + drupal_set_message(st('Failed to modify %settings, please verify the file permissions.', array('%settings' => $settings_file)), 'error'); } } else { @@ -263,6 +265,7 @@ function drupal_get_install_files($modul * Name of profile to verify. * @param locale * Name of locale used (if any). + * * @return * The list of modules to install. */ @@ -276,7 +279,7 @@ function drupal_verify_profile($profile, install_no_profile_error(); } - require_once($profile_file); + require_once ($profile_file); // Get a list of modules required by this profile. $function = $profile .'_profile_modules'; @@ -316,8 +319,8 @@ function drupal_install_modules($module_ $file = $files[$module]; if (isset($file->info['dependencies']) && is_array($file->info['dependencies'])) { foreach ($file->info['dependencies'] as $dependency) { - if (isset($module_list[$dependency]) && $module_list[$module] < $module_list[$dependency] +1) { - $module_list[$module] = $module_list[$dependency] +1; + if (isset($module_list[$dependency]) && $module_list[$module] < $module_list[$dependency] + 1) { + $module_list[$module] = $module_list[$dependency] + 1; $moved = TRUE; } } @@ -365,7 +368,6 @@ function drupal_install_system() { module_rebuild_cache(); } - /** * Calls the uninstall function and updates the system table for a given module. * @@ -413,6 +415,7 @@ function drupal_uninstall_module($module * An optional bitmask created from various FILE_* constants. * @param $type * The type of file. Can be file (default), dir, or link. + * * @return * TRUE on success or FALSE on failure. A message is set for the latter. */ @@ -446,31 +449,37 @@ function drupal_verify_install_file($fil } } break; + case FILE_READABLE: if (!is_readable($file) && !drupal_install_fix_file($file, $mask)) { $return = FALSE; } break; + case FILE_WRITABLE: if (!is_writable($file) && !drupal_install_fix_file($file, $mask)) { $return = FALSE; } break; + case FILE_EXECUTABLE: if (!is_executable($file) && !drupal_install_fix_file($file, $mask)) { $return = FALSE; } break; + case FILE_NOT_READABLE: if (is_readable($file) && !drupal_install_fix_file($file, $mask)) { $return = FALSE; } break; + case FILE_NOT_WRITABLE: if (is_writable($file) && !drupal_install_fix_file($file, $mask)) { $return = FALSE; } break; + case FILE_NOT_EXECUTABLE: if (is_executable($file) && !drupal_install_fix_file($file, $mask)) { $return = FALSE; @@ -505,9 +514,11 @@ function drupal_install_mkdir($file, $ma case FILE_READABLE: $mod += 444; break; + case FILE_WRITABLE: $mod += 222; break; + case FILE_EXECUTABLE: $mod += 111; break; @@ -561,26 +572,31 @@ function drupal_install_fix_file($file, $mod |= 0444; } break; + case FILE_WRITABLE: if (!is_writable($file)) { $mod |= 0222; } break; + case FILE_EXECUTABLE: if (!is_executable($file)) { $mod |= 0111; } break; + case FILE_NOT_READABLE: if (is_readable($file)) { $mod &= ~0444; } break; + case FILE_NOT_WRITABLE: if (is_writable($file)) { $mod &= ~0222; } break; + case FILE_NOT_EXECUTABLE: if (is_executable($file)) { $mod &= ~0111; @@ -601,7 +617,6 @@ function drupal_install_fix_file($file, } } - /** * Send the user to a different installer page. This issues an on-site HTTP * redirect. Messages (and errors) are erased. @@ -612,7 +627,8 @@ function drupal_install_fix_file($file, function install_goto($path) { global $base_url; header('Location: '. $base_url .'/'. $path); - header('Cache-Control: no-cache'); // Not a permanent redirect. + // Not a permanent redirect. + header('Cache-Control: no-cache'); exit(); } @@ -630,7 +646,7 @@ function st($string, $args = array()) { $filename = './profiles/'. $profile .'/translations/'. $install_locale .'.po'; if (file_exists($filename)) { require_once './includes/locale.inc'; - $file = (object) array('filepath' => $filename); + $file = (object)array('filepath' => $filename); _locale_import_read_po('mem-store', $file); $locale_strings = _locale_import_one_string('mem-report'); } @@ -641,15 +657,18 @@ function st($string, $args = array()) { foreach ($args as $key => $value) { switch ($key[0]) { // Escaped only + case '@': $args[$key] = check_plain($value); break; // Escaped and placeholder + case '%': default: $args[$key] = ''. check_plain($value) .''; break; // Pass-through + case '!': } } @@ -671,7 +690,7 @@ function drupal_check_profile($profile) install_no_profile_error(); } - require_once($profile_file); + require_once ($profile_file); // Get a list of modules required by this profile. $function = $profile .'_profile_modules'; @@ -731,3 +750,4 @@ function drupal_check_module($module) { } return TRUE; } + Index: includes/install.mysql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.mysql.inc,v retrieving revision 1.8 diff -u -p -r1.8 install.mysql.inc --- includes/install.mysql.inc 8 Dec 2007 14:06:20 -0000 1.8 +++ includes/install.mysql.inc 20 Jan 2008 06:07:58 -0000 @@ -60,7 +60,7 @@ function drupal_test_mysql($url, &$succe drupal_set_message(st('Failed to create a test table on your MySQL database server with the command %query. MySQL reports the following message: %error.For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%query' => $query, '%error' => $error)), 'error'); return FALSE; } - $err = FALSE; + $err = FALSE; $success[] = 'SELECT'; $success[] = 'CREATE'; @@ -115,3 +115,4 @@ function drupal_test_mysql($url, &$succe mysql_close($connection); return TRUE; } + Index: includes/install.mysqli.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.mysqli.inc,v retrieving revision 1.11 diff -u -p -r1.11 install.mysqli.inc --- includes/install.mysqli.inc 19 Dec 2007 11:25:47 -0000 1.11 +++ includes/install.mysqli.inc 20 Jan 2008 06:07:58 -0000 @@ -33,7 +33,7 @@ function drupal_test_mysqli($url, &$succ $url['host'] = urldecode($url['host']); $url['path'] = urldecode($url['path']); - $connection = mysqli_init(); + $connection = mysqli_init(); @mysqli_real_connect($connection, $url['host'], $url['user'], $url['pass'], substr($url['path'], 1), $url['port'], NULL, MYSQLI_CLIENT_FOUND_ROWS); if (mysqli_connect_errno() >= 2000 || mysqli_connect_errno() == 1045) { drupal_set_message(st('Failed to connect to your MySQL database server. MySQL reports the following message: %error.For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%error' => mysqli_connect_error())), 'error'); @@ -55,7 +55,7 @@ function drupal_test_mysqli($url, &$succ drupal_set_message(st('Failed to create a test table on your MySQL database server with the command %query. MySQL reports the following message: %error.For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%query' => $query, '%error' => $error)), 'error'); return FALSE; } - $err = FALSE; + $err = FALSE; $success[] = 'SELECT'; $success[] = 'CREATE'; @@ -110,3 +110,4 @@ function drupal_test_mysqli($url, &$succ mysqli_close($connection); return TRUE; } + Index: includes/install.pgsql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.pgsql.inc,v retrieving revision 1.6 diff -u -p -r1.6 install.pgsql.inc --- includes/install.pgsql.inc 22 Oct 2007 15:22:39 -0000 1.6 +++ includes/install.pgsql.inc 20 Jan 2008 06:07:58 -0000 @@ -61,7 +61,7 @@ function drupal_test_pgsql($url, &$succe drupal_set_message(st('Failed to create a test table on your PostgreSQL database server with the command %query. PostgreSQL reports the following message: %error.For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%query' => $query, '%error' => $error)), 'error'); return FALSE; } - $err = FALSE; + $err = FALSE; $success[] = 'SELECT'; $success[] = 'CREATE'; @@ -137,4 +137,5 @@ function drupal_test_pgsql($url, &$succe pg_close($connection); return TRUE; -} \ No newline at end of file +} + Index: includes/language.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/language.inc,v retrieving revision 1.14 diff -u -p -r1.14 language.inc --- includes/language.inc 6 Jan 2008 16:46:02 -0000 1.14 +++ includes/language.inc 20 Jan 2008 06:07:58 -0000 @@ -1,6 +1,7 @@ prefix)) { $options['prefix'] = $options['language']->prefix .'/'; @@ -142,3 +142,4 @@ function language_url_rewrite(&$path, &$ } } } + Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.174 diff -u -p -r1.174 locale.inc --- includes/locale.inc 9 Jan 2008 21:36:13 -0000 1.174 +++ includes/locale.inc 20 Jan 2008 06:07:58 -0000 @@ -1,6 +1,7 @@ TRUE); foreach ($languages as $langcode => $language) { @@ -41,7 +42,7 @@ function locale_languages_overview_form( } $form['weight'][$langcode] = array( '#type' => 'weight', - '#default_value' => $language->weight + '#default_value' => $language->weight, ); $form['name'][$langcode] = array('#value' => check_plain($language->name)); $form['native'][$langcode] = array('#value' => check_plain($language->native)); @@ -83,7 +84,7 @@ function theme_locale_languages_overview drupal_render($form['direction'][$key]), drupal_render($form['site_default'][$key]), drupal_render($form['weight'][$key]), - l(t('edit'), 'admin/settings/language/edit/'. $key) . (($key != 'en' && $key != $default->language) ? ' '. l(t('delete'), 'admin/settings/language/delete/'. $key) : '') + l(t('edit'), 'admin/settings/language/edit/'. $key) . (($key != 'en' && $key != $default->language) ? ' '. l(t('delete'), 'admin/settings/language/delete/'. $key) : ''), ); } } @@ -98,8 +99,8 @@ function theme_locale_languages_overview * Process language overview form submissions, updating existing languages. */ function locale_languages_overview_form_submit($form, &$form_state) { - $languages = language_list(); - $default = language_default(); + $languages = language_list(); + $default = language_default(); $enabled_count = 0; foreach ($languages as $langcode => $language) { if ($form_state['values']['site_default'] == $langcode || $default->language == $langcode) { @@ -129,6 +130,7 @@ function locale_languages_overview_form_ $form_state['redirect'] = 'admin/settings/language'; return; } + /** * @} End of "locale-language-overview" */ @@ -180,7 +182,7 @@ function locale_languages_custom_form() _locale_languages_common_controls($form['custom language']); $form['custom language']['submit'] = array( '#type' => 'submit', - '#value' => t('Add custom language') + '#value' => t('Add custom language'), ); // Reuse the validation and submit functions of the predefined language setup form. $form['#submit'][] = 'locale_languages_predefined_form_submit'; @@ -200,7 +202,7 @@ function locale_languages_edit_form(&$fo _locale_languages_common_controls($form, $language); $form['submit'] = array( '#type' => 'submit', - '#value' => t('Save language') + '#value' => t('Save language'), ); $form['#submit'][] = 'locale_languages_edit_form_submit'; $form['#validate'][] = 'locale_languages_edit_form_validate'; @@ -227,11 +229,11 @@ function _locale_languages_common_contro $form['langcode_view'] = array( '#type' => 'item', '#title' => t('Language code'), - '#value' => $language->language + '#value' => $language->language, ); $form['langcode'] = array( '#type' => 'value', - '#value' => $language->language + '#value' => $language->language, ); } else { @@ -263,7 +265,7 @@ function _locale_languages_common_contro '#title' => t('Path prefix'), '#maxlength' => 64, '#default_value' => @$language->prefix, - '#description' => t('Language code or other custom string for pattern matching within the path. With language negotiation set to Path prefix only or Path prefix with language fallback, this site is presented in this language when the Path prefix value matches an element in the path. For the default language, this value may be left blank. Modifying this value will break existing URLs and should be used with caution in a production environment. Example: Specifying "deutsch" as the path prefix for German results in URLs in the form "www.example.com/deutsch/node".') + '#description' => t('Language code or other custom string for pattern matching within the path. With language negotiation set to Path prefix only or Path prefix with language fallback, this site is presented in this language when the Path prefix value matches an element in the path. For the default language, this value may be left blank. Modifying this value will break existing URLs and should be used with caution in a production environment. Example: Specifying "deutsch" as the path prefix for German results in URLs in the form "www.example.com/deutsch/node".'), ); $form['domain'] = array('#type' => 'textfield', '#title' => t('Language domain'), @@ -276,7 +278,7 @@ function _locale_languages_common_contro '#required' => TRUE, '#description' => t('Direction that text in this language is presented.'), '#default_value' => @$language->direction, - '#options' => array(LANGUAGE_LTR => t('Left to right'), LANGUAGE_RTL => t('Right to left')) + '#options' => array(LANGUAGE_LTR => t('Left to right'), LANGUAGE_RTL => t('Right to left')), ); return $form; } @@ -367,6 +369,7 @@ function locale_languages_edit_form_subm $form_state['redirect'] = 'admin/settings/language'; return; } + /** * @} End of "locale-language-add-edit" */ @@ -429,6 +432,7 @@ function locale_languages_delete_form_su $form_state['redirect'] = 'admin/settings/language'; return; } + /** * @} End of "locale-language-add-edit" */ @@ -449,13 +453,14 @@ function locale_languages_configure_form LANGUAGE_NEGOTIATION_NONE => t('None.'), LANGUAGE_NEGOTIATION_PATH_DEFAULT => t('Path prefix only.'), LANGUAGE_NEGOTIATION_PATH => t('Path prefix with language fallback.'), - LANGUAGE_NEGOTIATION_DOMAIN => t('Domain name only.')), + LANGUAGE_NEGOTIATION_DOMAIN => t('Domain name only.'), + ), '#default_value' => variable_get('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.") + '#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( '#type' => 'submit', - '#value' => t('Save settings') + '#value' => t('Save settings'), ); return $form; } @@ -469,6 +474,7 @@ function locale_languages_configure_form $form_state['redirect'] = 'admin/settings/language'; return; } + /** * @} End of "locale-languages-negotiation" */ @@ -507,12 +513,13 @@ function locale_translate_overview_scree // Languages with at least one record in the locale table. $translations = db_query("SELECT COUNT(*) AS translation, t.language, s.textgroup FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid GROUP BY textgroup, language"); while ($data = db_fetch_object($translations)) { - $ratio = (!empty($groupsums[$data->textgroup]) && $data->translation > 0) ? round(($data->translation/$groupsums[$data->textgroup])*100., 2) : 0; + $ratio = (!empty($groupsums[$data->textgroup]) && $data->translation > 0) ? round(($data->translation / $groupsums[$data->textgroup]) * 100., 2) : 0; $rows[$data->language][$data->textgroup] = $data->translation .'/'. $groupsums[$data->textgroup] ." ($ratio%)"; } return theme('table', $headers, $rows); } + /** * @} End of "locale-translate-overview" */ @@ -540,8 +547,8 @@ function locale_translate_seek_form() { unset($languages['en']); // Present edit form preserving previous user settings - $query = _locale_translate_seek_query(); - $form = array(); + $query = _locale_translate_seek_query(); + $form = array(); $form['search'] = array('#type' => 'fieldset', '#title' => t('Search'), ); @@ -575,6 +582,7 @@ function locale_translate_seek_form() { return $form; } + /** * @} End of "locale-translate-seek" */ @@ -599,7 +607,7 @@ function locale_translate_import_form() else { $languages = array( t('Already added languages') => $names, - t('Languages not yet added') => _locale_prepare_predefined_list() + t('Languages not yet added') => _locale_prepare_predefined_list(), ); $default = array_shift(array_keys($names)); } @@ -630,7 +638,7 @@ function locale_translate_import_form() '#default_value' => LOCALE_IMPORT_KEEP, '#options' => array( LOCALE_IMPORT_OVERWRITE => t('Strings in the uploaded file replace existing ones, new ones are added'), - LOCALE_IMPORT_KEEP => t('Existing strings are kept, only new strings are added') + LOCALE_IMPORT_KEEP => t('Existing strings are kept, only new strings are added'), ), ); $form['import']['submit'] = array('#type' => 'submit', '#value' => t('Import')); @@ -670,6 +678,7 @@ function locale_translate_import_form_su $form_state['redirect'] = 'admin/build/translate'; return; } + /** * @} End of "locale-translate-import" */ @@ -754,6 +763,7 @@ function locale_translate_export_po_form } _locale_export_po($language, _locale_export_po_generate($language, _locale_export_get_strings($language, $form_state['values']['group']))); } + /** * @} End of "locale-translate-export" */ @@ -777,21 +787,21 @@ function locale_translate_edit_form(&$fo // Add original text to the top and some values for form altering. $form = array( 'original' => array( - '#type' => 'item', + '#type' => 'item', '#title' => t('Original text'), '#value' => check_plain(wordwrap($source->source, 0)), ), 'lid' => array( - '#type' => 'value', - '#value' => $lid + '#type' => 'value', + '#value' => $lid, ), 'textgroup' => array( - '#type' => 'value', + '#type' => 'value', '#value' => $source->textgroup, ), 'location' => array( - '#type' => 'value', - '#value' => $source->location + '#type' => 'value', + '#value' => $source->location, ), ); @@ -858,6 +868,7 @@ function locale_translate_edit_form_subm $form_state['redirect'] = 'admin/build/translate/search'; return; } + /** * @} End of "locale-translate-edit" */ @@ -879,6 +890,7 @@ function locale_translate_delete($lid) { drupal_set_message(t('The string has been removed.')); drupal_goto('admin/build/translate/search'); } + /** * @} End of "locale-translate-delete" */ @@ -919,16 +931,16 @@ function locale_add_language($langcode, // If name was not set, we add a predefined language. if (!isset($name)) { $predefined = _locale_get_predefined_list(); - $name = $predefined[$langcode][0]; - $native = isset($predefined[$langcode][1]) ? $predefined[$langcode][1] : $predefined[$langcode][0]; - $direction = isset($predefined[$langcode][2]) ? $predefined[$langcode][2] : LANGUAGE_LTR; + $name = $predefined[$langcode][0]; + $native = isset($predefined[$langcode][1]) ? $predefined[$langcode][1] : $predefined[$langcode][0]; + $direction = isset($predefined[$langcode][2]) ? $predefined[$langcode][2] : LANGUAGE_LTR; } db_query("INSERT INTO {languages} (language, name, native, direction, domain, prefix, enabled) VALUES ('%s', '%s', '%s', %d, '%s', '%s', %d)", $langcode, $name, $native, $direction, $domain, $prefix, $enabled); // 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('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) { @@ -941,6 +953,7 @@ function locale_add_language($langcode, watchdog('locale', 'The %language language (%code) has been created.', array('%language' => $name, '%code' => $langcode)); } + /** * @} End of "locale-api-add" */ @@ -1016,19 +1029,24 @@ function _locale_import_po($file, $langc */ function _locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') { - $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return + // File will get closed by PHP on return + $fd = fopen($file->filepath, "rb"); if (!$fd) { _locale_import_message('The translation import failed, because the file %filename could not be read.', $file); return FALSE; } - $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR - $current = array(); // Current entry being read - $plural = 0; // Current plural form - $lineno = 0; // Current line - + // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR + $context = "COMMENT"; + // Current entry being read + $current = array(); + // Current plural form + $plural = 0; + // Current line + $lineno = 0; while (!feof($fd)) { - $line = fgets($fd, 10*1024); // A line should not be this long + // A line should not be this long + $line = fgets($fd, 10 * 1024); if ($lineno == 0) { // The first line might come with a UTF-8 BOM, which should be removed. $line = str_replace("\xEF\xBB\xBF", '', $line); @@ -1036,23 +1054,28 @@ function _locale_import_read_po($op, $fi $lineno++; $line = trim(strtr($line, array("\\\n" => ""))); - if (!strncmp("#", $line, 1)) { // A comment - if ($context == "COMMENT") { // Already in comment context: add + if (!strncmp("#", $line, 1)) { + // A comment + if ($context == "COMMENT") { + // Already in comment context: add $current["#"][] = substr($line, 1); } - elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one + elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { + // End current entry, start a new one _locale_import_one_string($op, $current, $mode, $lang, $file, $group); - $current = array(); + $current = array(); $current["#"][] = substr($line, 1); - $context = "COMMENT"; + $context = "COMMENT"; } - else { // Parse error + else { + // Parse error _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno); return FALSE; } } elseif (!strncmp("msgid_plural", $line, 12)) { - if ($context != "MSGID") { // Must be plural form for current entry + if ($context != "MSGID") { + // Must be plural form for current entry _locale_import_message('The translation file %filename contains an error: "msgid_plural" was expected but not found on line %line.', $file, $lineno); return FALSE; } @@ -1066,11 +1089,13 @@ function _locale_import_read_po($op, $fi $context = "MSGID_PLURAL"; } elseif (!strncmp("msgid", $line, 5)) { - if ($context == "MSGSTR") { // End current entry, start a new one + if ($context == "MSGSTR") { + // End current entry, start a new one _locale_import_one_string($op, $current, $mode, $lang, $file, $group); $current = array(); } - elseif ($context == "MSGID") { // Already in this context? Parse error + elseif ($context == "MSGID") { + // Already in this context? Parse error _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno); return FALSE; } @@ -1084,7 +1109,8 @@ function _locale_import_read_po($op, $fi $context = "MSGID"; } elseif (!strncmp("msgstr[", $line, 7)) { - if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[] + if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { + // Must come after msgid, msgid_plural, or msgstr[] _locale_import_message('The translation file %filename contains an error: "msgstr[]" is unexpected on line %line.', $file, $lineno); return FALSE; } @@ -1093,9 +1119,9 @@ function _locale_import_read_po($op, $fi return FALSE; } $frombracket = strstr($line, "["); - $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1); - $line = trim(strstr($line, " ")); - $quoted = _locale_import_parse_quoted($line); + $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1); + $line = trim(strstr($line, " ")); + $quoted = _locale_import_parse_quoted($line); if ($quoted === FALSE) { _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); return FALSE; @@ -1104,7 +1130,8 @@ function _locale_import_read_po($op, $fi $context = "MSGSTR_ARR"; } elseif (!strncmp("msgstr", $line, 6)) { - if ($context != "MSGID") { // Should come just after a msgid block + if ($context != "MSGID") { + // Should come just after a msgid block _locale_import_message('The translation file %filename contains an error: "msgstr" is unexpected on line %line.', $file, $lineno); return FALSE; } @@ -1147,7 +1174,6 @@ function _locale_import_read_po($op, $fi _locale_import_message('The translation file %filename ended unexpectedly at line %line.', $file, $lineno); return FALSE; } - } /** @@ -1192,19 +1218,23 @@ function _locale_import_one_string($op, switch ($op) { // Return stored strings + case 'mem-report': return $strings; // Store string in memory (only supports single strings) + case 'mem-store': $strings[$value['msgid']] = $value['msgstr']; return; // Called at end of import to inform the user + case 'db-report': return array($headerdone, $report[0], $report[1], $report[2]); // Store the string we got in the database. + case 'db-store': // We got header information. if ($value['msgid'] == '') { @@ -1220,7 +1250,6 @@ function _locale_import_one_string($op, } $headerdone = TRUE; } - else { // Some real string to import. $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); @@ -1241,7 +1270,6 @@ function _locale_import_one_string($op, $plid = _locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); } } - else { // A simple string to import. $english = $value['msgid']; @@ -1249,7 +1277,8 @@ function _locale_import_one_string($op, _locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode); } } - } // end of db-store operation + } + // end of db-store operation } /** @@ -1274,6 +1303,7 @@ function _locale_import_one_string($op, * Optional plural ID to use. * @param $plural * Optional plural value to use. + * * @return * The string ID of the existing string modified or the new string added. */ @@ -1318,6 +1348,7 @@ function _locale_import_one_string_db(&$ * * @param $header * A string containing the complete header + * * @return * An associative array of key-value pairs */ @@ -1340,6 +1371,7 @@ function _locale_import_parse_header($he * A string containing the Plural-Forms entry * @param $filename * A string containing the filename + * * @return * An array containing the number of plurals and a * formula in PHP for computing the plural form @@ -1384,6 +1416,7 @@ function _locale_import_parse_plural_for * * @param $string * A string containing the arithmetic formula + * * @return * The PHP version of the formula */ @@ -1428,9 +1461,11 @@ function _locale_import_parse_arithmetic $topop = array_pop($opstk); } if ($topop) { - $opstk[] = $topop; // Return element to top + // Return element to top + $opstk[] = $topop; } - $opstk[] = $ctok; // Parentheses are not needed + // Parentheses are not needed + $opstk[] = $ctok; } else { return FALSE; @@ -1481,6 +1516,7 @@ function _locale_import_parse_arithmetic * * @param $string * A string containing the arithmetic formula + * * @return * The PHP version of the formula */ @@ -1498,7 +1534,8 @@ function _locale_import_tokenize_formula $i = $j - 1; $tokens[] = $num; } - elseif ($pos = strpos(" =<>!&|", $formula[$i])) { // We won't have a space + elseif ($pos = strpos(" =<>!&|", $formula[$i])) { + // We won't have a space $next = $formula[$i + 1]; switch ($pos) { case 1: @@ -1513,6 +1550,7 @@ function _locale_import_tokenize_formula $tokens[] = $formula[$i]; } break; + case 5: if ($next == '&') { $tokens[] = '&&'; @@ -1522,6 +1560,7 @@ function _locale_import_tokenize_formula $tokens[] = $formula[$i]; } break; + case 6: if ($next == '|') { $tokens[] = '||'; @@ -1566,6 +1605,7 @@ function _locale_import_append_plural($e * * @param $comment * An array of strings containing a comment + * * @return * Short one string version of the comment */ @@ -1588,25 +1628,31 @@ function _locale_import_shorten_comments * * @param $string * A string specified with enclosing quotes + * * @return * The string parsed from inside the quotes */ function _locale_import_parse_quoted($string) { if (substr($string, 0, 1) != substr($string, -1, 1)) { - return FALSE; // Start and end quotes must be the same + // Start and end quotes must be the same + return FALSE; } $quote = substr($string, 0, 1); $string = substr($string, 1, -1); - if ($quote == '"') { // Double quotes: strip slashes + if ($quote == '"') { + // Double quotes: strip slashes return stripcslashes($string); } - elseif ($quote == "'") { // Simple quote: return as-is + elseif ($quote == "'") { + // Simple quote: return as-is return $string; } else { - return FALSE; // Unrecognized quote + // Unrecognized quote + return FALSE; } } + /** * @} End of "locale-api-import" */ @@ -1690,9 +1736,9 @@ function _locale_export_get_strings($lan $strings = array(); while ($child = db_fetch_object($result)) { $string = array( - 'comment' => $child->location, - 'source' => $child->source, - 'translation' => isset($child->translation) ? $child->translation : '' + 'comment' => $child->location, + 'source' => $child->source, + 'translation' => isset($child->translation) ? $child->translation : '', ); if ($child->plid) { // Has a parent lid. Since we process in the order of plids, @@ -1867,10 +1913,10 @@ function _locale_export_string($str) { */ function _locale_export_wrap($str, $len) { $words = explode(' ', $str); - $ret = array(); + $ret = array(); - $cur = ""; - $nstr = 1; + $cur = ""; + $nstr = 1; while (count($words)) { $word = array_shift($words); if ($nstr) { @@ -1896,6 +1942,7 @@ function _locale_export_wrap($str, $len) function _locale_export_remove_plural($entry) { return preg_replace('/(@count)\[[0-9]\]/', '\\1', $entry); } + /** * @} End of "locale-api-export" */ @@ -1913,26 +1960,28 @@ function _locale_translate_seek() { // We have at least one criterion to match if ($query = _locale_translate_seek_query()) { - $join = "SELECT s.source, s.location, s.lid, s.textgroup, t.translation, t.language FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid "; + $join = "SELECT s.source, s.location, s.lid, s.textgroup, t.translation, t.language FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid "; - $arguments = array(); + $arguments = array(); $limit_language = FALSE; // Compute LIKE section switch ($query['translation']) { case 'translated': - $where = "WHERE (t.translation LIKE '%%%s%%')"; - $orderby = "ORDER BY t.translation"; + $where = "WHERE (t.translation LIKE '%%%s%%')"; + $orderby = "ORDER BY t.translation"; $arguments[] = $query['string']; break; + case 'untranslated': - $where = "WHERE (s.source LIKE '%%%s%%' AND t.translation IS NULL)"; - $orderby = "ORDER BY s.source"; + $where = "WHERE (s.source LIKE '%%%s%%' AND t.translation IS NULL)"; + $orderby = "ORDER BY s.source"; $arguments[] = $query['string']; break; - case 'all' : + + case 'all': default: - $where = "WHERE (s.source LIKE '%%%s%%' OR t.translation LIKE '%%%s%%')"; - $orderby = ''; + $where = "WHERE (s.source LIKE '%%%s%%' OR t.translation LIKE '%%%s%%')"; + $orderby = ''; $arguments[] = $query['string']; $arguments[] = $query['string']; break; @@ -1945,18 +1994,22 @@ function _locale_translate_seek() { switch ($query['language']) { // Force search in source strings + case "en": $sql = $join ." WHERE s.source LIKE '%%%s%%' $grouplimit ORDER BY s.source"; - $arguments = array($query['string']); // $where is not used, discard its arguments + // $where is not used, discard its arguments + $arguments = array($query['string']); if (!empty($grouplimit)) { $arguments[] = $query['group']; } break; // Search in all languages + case "all": $sql = "$join $where $grouplimit $orderby"; break; // Some different language + default: $sql = "$join AND t.language = '%s' $where $grouplimit $orderby"; array_unshift($arguments, $query['language']); @@ -1968,7 +2021,7 @@ function _locale_translate_seek() { $groups = module_invoke_all('locale', 'groups'); $header = array(t('Text group'), t('String'), ($limit_language) ? t('Language') : t('Languages'), array('data' => t('Operations'), 'colspan' => '2')); - $arr = array(); + $arr = array(); while ($locale = db_fetch_object($result)) { $arr[$locale->lid]['group'] = $groups[$locale->textgroup]; $arr[$locale->lid]['languages'][$locale->language] = $locale->translation; @@ -2027,6 +2080,7 @@ function _locale_translate_seek_query() * * @param $langcode * The language code for which the file needs to be refreshed. + * * @return * New content of the 'javascript_parsed' variable. */ @@ -2160,15 +2214,19 @@ function _locale_rebuild_js($langcode = case 'updated': watchdog('locale', 'Updated JavaScript translation file for the language %language.', array('%language' => t($language->name))); return TRUE; + case 'created': watchdog('locale', 'Created JavaScript translation file for the language %language.', array('%language' => t($language->name))); return TRUE; + case 'deleted': watchdog('locale', 'Removed JavaScript translation file for the language %language, because no translations currently exist for that language.', array('%language' => t($language->name))); return TRUE; + case 'error': watchdog('locale', 'An error occurred during creation of the JavaScript translation file for the language %language.', array('%language' => t($language->name)), WATCHDOG_ERROR); return FALSE; + default: // No operation needed. return TRUE; @@ -2193,6 +2251,7 @@ function _locale_translate_language_list return $output; } + /** * @} End of "locale-api-seek" */ @@ -2239,7 +2298,8 @@ function _locale_get_predefined_list() { "af" => array("Afrikaans"), "ak" => array("Akan"), "am" => array("Amharic", "አማርኛ"), - "ar" => array("Arabic", /* Left-to-right marker "‭" */ "العربية", LANGUAGE_RTL), + "ar" => array("Arabic", /* Left-to-right marker "‭" */ + "العربية", LANGUAGE_RTL), "as" => array("Assamese"), "av" => array("Avar"), "ay" => array("Aymara"), @@ -2274,7 +2334,8 @@ function _locale_get_predefined_list() { "es" => array("Spanish", "Español"), "et" => array("Estonian", "Eesti"), "eu" => array("Basque", "Euskera"), - "fa" => array("Persian", /* Left-to-right marker "‭" */ "فارسی", LANGUAGE_RTL), + "fa" => array("Persian", /* Left-to-right marker "‭" */ + "فارسی", LANGUAGE_RTL), "ff" => array("Fulah", "Fulfulde"), "fi" => array("Finnish", "Suomi"), "fj" => array("Fiji"), @@ -2288,7 +2349,8 @@ function _locale_get_predefined_list() { "gu" => array("Gujarati"), "gv" => array("Manx"), "ha" => array("Hausa"), - "he" => array("Hebrew", /* Left-to-right marker "‭" */ "עברית", LANGUAGE_RTL), + "he" => array("Hebrew", /* Left-to-right marker "‭" */ + "עברית", LANGUAGE_RTL), "hi" => array("Hindi", "हिन्दी"), "ho" => array("Hiri Motu"), "hr" => array("Croatian", "Hrvatski"), @@ -2355,7 +2417,8 @@ function _locale_get_predefined_list() { "pa" => array("Punjabi"), "pi" => array("Pali"), "pl" => array("Polish", "Polski"), - "ps" => array("Pashto", /* Left-to-right marker "‭" */ "پښتو", LANGUAGE_RTL), + "ps" => array("Pashto", /* Left-to-right marker "‭" */ + "پښتو", LANGUAGE_RTL), "pt" => array("Portuguese, Portugal", "Português"), "pt-br" => array("Portuguese, Brazil", "Português"), "qu" => array("Quechua"), @@ -2399,7 +2462,8 @@ function _locale_get_predefined_list() { "ty" => array("Tahitian"), "ug" => array("Uighur"), "uk" => array("Ukrainian", "Українська"), - "ur" => array("Urdu", /* Left-to-right marker "‭" */ "اردو", LANGUAGE_RTL), + "ur" => array("Urdu", /* Left-to-right marker "‭" */ + "اردو", LANGUAGE_RTL), "uz" => array("Uzbek", "o'zbek"), "ve" => array("Venda"), "vi" => array("Vietnamese", "Tiếng Việt"), @@ -2413,6 +2477,7 @@ function _locale_get_predefined_list() { "zu" => array("Zulu", "isiZulu"), ); } + /** * @} End of "locale-api-languages-predefined" */ @@ -2433,14 +2498,15 @@ function _locale_get_predefined_list() { * @param $skip * Array of component names to skip. Used in the installer for the * second pass import, when most components are already imported. + * * @return * A batch structure or FALSE if no files found. */ function locale_batch_by_language($langcode, $finished = NULL, $skip = array()) { // Collect all files to import for all enabled modules and themes. - $files = array(); + $files = array(); $components = array(); - $query = "SELECT name, filename FROM {system} WHERE status = 1"; + $query = "SELECT name, filename FROM {system} WHERE status = 1"; if (count($skip)) { $query .= " AND name NOT IN (". db_placeholders($skip, 'varchar') .")"; } @@ -2499,6 +2565,7 @@ function locale_batch_by_component($comp * Optional finished callback for the batch. * @param $components * Optional list of component names the batch covers. Used in the installer. + * * @return * A batch structure */ @@ -2508,20 +2575,21 @@ function _locale_batch_build($files, $fi $operations = array(); foreach ($files as $file) { // We call _locale_batch_import for every batch operation. - $operations[] = array('_locale_batch_import', array($file->filename)); } - $batch = array( - 'operations' => $operations, - 'title' => $t('Importing interface translations'), - 'init_message' => $t('Starting import'), - 'error_message' => $t('Error importing interface translations'), - 'file' => './includes/locale.inc', - // This is not a batch API construct, but data passed along to the - // installer, so we know what did we import already. - '#components' => $components, - ); - if (isset($finished)) { - $batch['finished'] = $finished; - } + $operations[] = array('_locale_batch_import', array($file->filename)); + } + $batch = array( + 'operations' => $operations, + 'title' => $t('Importing interface translations'), + 'init_message' => $t('Starting import'), + 'error_message' => $t('Error importing interface translations'), + 'file' => './includes/locale.inc', + // This is not a batch API construct, but data passed along to the + // installer, so we know what did we import already. + '#components' => $components, + ); + if (isset($finished)) { + $batch['finished'] = $finished; + } return $batch; } return FALSE; @@ -2539,7 +2607,7 @@ function _locale_batch_import($filepath, // The filename is either {langcode}.po or {prefix}.{langcode}.po, so // we can extract the language code to use for the import from the end. if (preg_match('!(/|\.)([^\./]+)\.po$!', $filepath, $langcode)) { - $file = (object) array('filename' => basename($filepath), 'filepath' => $filepath); + $file = (object)array('filename' => basename($filepath), 'filepath' => $filepath); _locale_import_read_po('db-store', $file, LOCALE_IMPORT_KEEP, $langcode[2]); $context['results'][] = $filepath; } @@ -2568,3 +2636,4 @@ function _locale_batch_language_finished /** * @} End of "locale-autoimport" */ + Index: includes/mail.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/mail.inc,v retrieving revision 1.7 diff -u -p -r1.7 mail.inc --- includes/mail.inc 4 Sep 2007 21:10:45 -0000 1.7 +++ includes/mail.inc 20 Jan 2008 06:07:58 -0000 @@ -1,6 +1,7 @@ $module .'_'. $key, - 'to' => $to, - 'from' => isset($from) ? $from : $default_from, + 'id' => $module .'_'. $key, + 'to' => $to, + 'from' => isset($from) ? $from : $default_from, 'language' => $language, - 'params' => $params, - 'subject' => '', - 'body' => array() + 'params' => $params, + 'subject' => '', + 'body' => array(), ); // Build the default headers $headers = array( - 'MIME-Version' => '1.0', - 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes', + 'MIME-Version' => '1.0', + 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes', 'Content-Transfer-Encoding' => '8Bit', - 'X-Mailer' => 'Drupal' + 'X-Mailer' => 'Drupal', ); if ($default_from) { // To prevent e-mail from looking like spam, the addresses in the Sender and @@ -166,6 +168,7 @@ function drupal_mail($module, $key, $to, * smart plain text wrapping. * - headers * Associative array containing all mail headers. + * * @return * Returns TRUE if the mail was successfully accepted for delivery, * FALSE otherwise. @@ -253,6 +256,7 @@ function drupal_wrap_mail($text, $indent * @param $allowed_tags (optional) * If supplied, a list of tags that will be transformed. If omitted, all * all supported tags are transformed. + * * @return * The transformed string. */ @@ -276,9 +280,9 @@ function drupal_html_to_text($string, $a // Replace inline tags with the text of link and a footnote. // 'See the Drupal site' becomes // 'See the Drupal site [1]' with the URL included as a footnote. - $pattern = '@(]+?href="([^"]*)"[^>]*?>(.+?))@i'; - $string = preg_replace_callback($pattern, '_drupal_html_to_mail_urls', $string); - $urls = _drupal_html_to_mail_urls(); + $pattern = '@(]+?href="([^"]*)"[^>]*?>(.+?))@i'; + $string = preg_replace_callback($pattern, '_drupal_html_to_mail_urls', $string); + $urls = _drupal_html_to_mail_urls(); $footnotes = ''; if (count($urls)) { $footnotes .= "\n"; @@ -291,87 +295,108 @@ function drupal_html_to_text($string, $a $split = preg_split('/<([^>]+?)>/', $string, -1, PREG_SPLIT_DELIM_CAPTURE); // Note: PHP ensures the array consists of alternating delimiters and literals // and begins and ends with a literal (inserting $null as required). - - $tag = FALSE; // Odd/even counter (tag or no tag) - $casing = NULL; // Case conversion function + // Odd/even counter (tag or no tag) + $tag = FALSE; + // Case conversion function + $casing = NULL; $output = ''; - $indent = array(); // All current indentation string chunks - $lists = array(); // Array of counters for opened lists + // All current indentation string chunks + $indent = array(); + // Array of counters for opened lists + $lists = array(); foreach ($split as $value) { - $chunk = NULL; // Holds a string ready to be formatted and output. - + // Holds a string ready to be formatted and output. + $chunk = NULL; // Process HTML tags (but don't output any literally). if ($tag) { list($tagname) = explode(' ', strtolower($value), 2); switch ($tagname) { // List counters + case 'ul': array_unshift($lists, '*'); break; + case 'ol': array_unshift($lists, 1); break; + case '/ul': case '/ol': array_shift($lists); - $chunk = ''; // Ensure blank new-line. + // Ensure blank new-line. + $chunk = ''; break; // Quotation/list markers, non-fancy headers + case 'blockquote': // Format=flowed indentation cannot be mixed with lists. $indent[] = count($lists) ? ' "' : '>'; break; + case 'li': $indent[] = is_numeric($lists[0]) ? ' '. $lists[0]++ .') ' : ' * '; break; + case 'dd': $indent[] = ' '; break; + case 'h3': $indent[] = '.... '; break; + case 'h4': $indent[] = '.. '; break; + case '/blockquote': if (count($lists)) { // Append closing quote for inline quotes (immediately). $output = rtrim($output, "> \n") ."\"\n"; - $chunk = ''; // Ensure blank new-line. + // Ensure blank new-line. + $chunk = ''; } // Fall-through case '/li': case '/dd': array_pop($indent); break; + case '/h3': case '/h4': array_pop($indent); case '/h5': case '/h6': - $chunk = ''; // Ensure blank new-line. + // Ensure blank new-line. + $chunk = ''; break; // Fancy headers + case 'h1': $indent[] = '======== '; $casing = 'drupal_strtoupper'; break; + case 'h2': $indent[] = '-------- '; $casing = 'drupal_strtoupper'; break; + case '/h1': case '/h2': $casing = NULL; // Pad the line with dashes. $output = _drupal_html_to_text_pad($output, ($tagname == '/h1') ? '=' : '-', ' '); array_pop($indent); - $chunk = ''; // Ensure blank new-line. + // Ensure blank new-line. + $chunk = ''; break; // Horizontal rulers + case 'hr': // Insert immediately. $output .= drupal_wrap_mail('', implode('', $indent)) ."\n"; @@ -379,9 +404,11 @@ function drupal_html_to_text($string, $a break; // Paragraphs and definition lists + case '/p': case '/dl': - $chunk = ''; // Ensure blank new-line. + // Ensure blank new-line. + $chunk = ''; break; } } @@ -469,3 +496,4 @@ function _drupal_html_to_text_pad($text, // Add prefix and padding, and restore linebreak. return $text . $prefix . str_repeat($pad, $n - strlen($prefix)) ."\n"; } + Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.246 diff -u -p -r1.246 menu.inc --- includes/menu.inc 10 Jan 2008 20:16:50 -0000 1.246 +++ includes/menu.inc 20 Jan 2008 06:07:59 -0000 @@ -1,6 +1,7 @@ $end) { @@ -251,6 +251,7 @@ function menu_get_ancestors($parts) { * A serialized array. * @param @map * An array of potential replacements. + * * @return * The $data array unserialized and mapped. */ @@ -268,8 +269,6 @@ function menu_unserialize($data, $map) { } } - - /** * Replaces the statically cached item for a given path. * @@ -293,6 +292,7 @@ function menu_set_item($path, $router_it * node/% item and return that. * @param $router_item * Internal use only. + * * @return * The router item, an associate array corresponding to one row in the * menu_router table. The value of key map holds the loaded objects. The @@ -313,7 +313,7 @@ function menu_get_item($path = NULL, $ro $parts = array_slice($original_map, 0, MENU_MAX_PARTS); list($ancestors, $placeholders) = menu_get_ancestors($parts); - if ($router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN ('. implode (',', $placeholders) .') ORDER BY fit DESC', $ancestors, 0, 1))) { + if ($router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN ('. implode(',', $placeholders) .') ORDER BY fit DESC', $ancestors, 0, 1))) { $map = _menu_translate($router_item, $original_map); if ($map === FALSE) { $router_items[$path] = FALSE; @@ -342,7 +342,7 @@ function menu_execute_active_handler($pa if ($router_item = menu_get_item($path)) { if ($router_item['access']) { if ($router_item['file']) { - require_once($router_item['file']); + require_once ($router_item['file']); } return call_user_func_array($router_item['page_callback'], $router_item['page_arguments']); } @@ -360,6 +360,7 @@ function menu_execute_active_handler($pa * A menu router or menu link item * @param $map * An array of path arguments (ex: array('node', '5')) + * * @return * Returns TRUE for success, FALSE if an object cannot be loaded */ @@ -425,6 +426,7 @@ function _menu_load_objects(&$item, &$ma * A menu router or menu link item * @param $map * An array of path arguments (ex: array('node', '5')) + * * @return * $item['access'] becomes TRUE if the item is accessible, FALSE otherwise. */ @@ -451,7 +453,7 @@ function _menu_check_access(&$item, $map /** * Localize the router item title using t() or another callback. - * + * * Translate the title and description to allow storage of English title * strings in the database, yet display of them in the language required * by the current user. @@ -527,6 +529,7 @@ function _menu_item_localize(&$item, $ma * @param $to_arg * Execute $item['to_arg_functions'] or not. Use only if you want to render a * path from the menu table, for example tabs. + * * @return * Returns the map with objects loaded as defined in the * $item['load_functions. $item['access'] becomes TRUE if the item is @@ -597,6 +600,7 @@ function menu_tail_to_arg($arg, $map, $i * * @param $item * A menu link + * * @return * Returns the map of path arguments with objects loaded as defined in the * $item['load_functions']. @@ -608,9 +612,9 @@ function _menu_link_translate(&$item) { $item['options'] = unserialize($item['options']); if ($item['external']) { $item['access'] = 1; - $map = array(); - $item['href'] = $item['link_path']; - $item['title'] = $item['link_title']; + $map = array(); + $item['href'] = $item['link_path']; + $item['title'] = $item['link_title']; } else { $map = explode('/', $item['link_path']); @@ -673,6 +677,7 @@ function menu_get_object($type = 'node', * * @param $menu_name * The name of the menu. + * * @return * The rendered HTML of that menu on the current page. */ @@ -691,6 +696,7 @@ function menu_tree($menu_name = 'navigat * * @param $tree * A data structure representing the tree as returned from menu_tree_data. + * * @return * The rendered HTML of that data structure. */ @@ -738,6 +744,7 @@ function menu_tree_output($tree) { * A fully loaded menu link, or NULL. If a link is supplied, only the * path to root will be included in the returned tree- as if this link * represented the current page in a visible menu. + * * @return * An tree of menu links in an array, in the order they should be rendered. */ @@ -764,16 +771,16 @@ function menu_tree_all_data($menu_name = for ($i = 1; $i < MENU_MAX_DEPTH; $i++) { $args[] = $item["p$i"]; } - $args = array_unique($args); + $args = array_unique($args); $placeholders = implode(', ', array_fill(0, count($args), '%d')); - $where = ' AND ml.plid IN ('. $placeholders .')'; - $parents = $args; - $parents[] = $item['mlid']; + $where = ' AND ml.plid IN ('. $placeholders .')'; + $parents = $args; + $parents[] = $item['mlid']; } else { // Get all links in this menu. - $where = ''; - $args = array(); + $where = ''; + $args = array(); $parents = array(); } array_unshift($args, $menu_name); @@ -806,6 +813,7 @@ function menu_tree_all_data($menu_name = * * @param $menu_name * The named menu links to return + * * @return * An array of menu links, in the order they should be rendered. The array * is a list of associative arrays -- these have two keys, link and below. @@ -842,9 +850,9 @@ function menu_tree_page_data($menu_name $parents[] = '0'; // Use array_values() so that the indices are numeric for array_merge(). - $args = $parents = array_unique(array_values($parents)); + $args = $parents = array_unique(array_values($parents)); $placeholders = implode(', ', array_fill(0, count($args), '%d')); - $expanded = variable_get('menu_expanded', array()); + $expanded = variable_get('menu_expanded', 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 @@ -863,9 +871,9 @@ function menu_tree_page_data($menu_name } else { // Show only the top-level menu items when access is denied. - $args = array($menu_name, '0'); + $args = array($menu_name, '0'); $placeholders = '%d'; - $parents = array(); + $parents = array(); } // Select the links from the table, and recursively build the tree. We // LEFT JOIN since there is no match in {menu_router} for an external @@ -915,9 +923,9 @@ function menu_tree_check_access(&$tree, if ($node_links) { // Use db_rewrite_sql to evaluate view access without loading each full node. - $nids = array_keys($node_links); + $nids = array_keys($node_links); $placeholders = '%d'. str_repeat(', %d', count($nids) - 1); - $result = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE n.nid IN (". $placeholders .")"), $nids); + $result = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE n.nid IN (". $placeholders .")"), $nids); while ($node = db_fetch_array($result)) { $nid = $node['nid']; foreach ($node_links[$nid] as $mlid => $link) { @@ -962,6 +970,7 @@ function _menu_tree_check_access(&$tree) * to the root of the menu tree. * @param $depth * The depth of the current menu tree. + * * @return * See menu_tree_page_data for a description of the data structure. */ @@ -1091,11 +1100,11 @@ function drupal_help_arg($arg = array()) * Returns the help associated with the active menu item. */ function menu_get_active_help() { - $output = ''; + $output = ''; $router_path = menu_tab_root_path(); - $arg = drupal_help_arg(arg(NULL)); - $empty_arg = drupal_help_arg(); + $arg = drupal_help_arg(arg(NULL)); + $empty_arg = drupal_help_arg(); foreach (module_list() as $name) { if (module_hook($name, 'help')) { @@ -1165,6 +1174,7 @@ function menu_secondary_links() { * The name of the menu. * @param $level * Optional, the depth of the menu to be returned. + * * @return * An array of links of the specified menu and level. */ @@ -1193,8 +1203,8 @@ function menu_navigation_links($menu_nam $links = array(); foreach ($tree as $item) { if (!$item['link']['hidden']) { - $l = $item['link']['options']; - $l['href'] = $item['link']['href']; + $l = $item['link']['options']; + $l['href'] = $item['link']['href']; $l['title'] = $item['link']['title']; // Keyed with unique menu id to generate classes from theme_links(). $links['menu-'. $item['link']['mlid']] = $l; @@ -1210,6 +1220,7 @@ function menu_navigation_links($menu_nam * The level of tasks you ask for. Primary tasks are 0, secondary are 1. * @param $return_root * Whether to return the root path for the current page. + * * @return * Themed output corresponding to the tabs of the requested level, or * router path if $return_root == TRUE. This router path corresponds to @@ -1227,10 +1238,10 @@ function menu_local_tasks($level = 0, $r return ''; } // Get all tabs and the root page. - $result = db_query("SELECT * FROM {menu_router} WHERE tab_root = '%s' ORDER BY weight, title", $router_item['tab_root']); - $map = arg(); - $children = array(); - $tasks = array(); + $result = db_query("SELECT * FROM {menu_router} WHERE tab_root = '%s' ORDER BY weight, title", $router_item['tab_root']); + $map = arg(); + $children = array(); + $tasks = array(); $root_path = $router_item['path']; while ($item = db_fetch_array($result)) { @@ -1250,8 +1261,8 @@ function menu_local_tasks($level = 0, $r $depth = 1001; while (isset($children[$path])) { $tabs_current = ''; - $next_path = ''; - $count = 0; + $next_path = ''; + $count = 0; foreach ($children[$path] as $item) { if ($item['access']) { $count++; @@ -1276,15 +1287,15 @@ function menu_local_tasks($level = 0, $r } // Find all tabs at the same level or above the current one. - $parent = $router_item['tab_parent']; - $path = $router_item['path']; + $parent = $router_item['tab_parent']; + $path = $router_item['path']; $current = $router_item; - $depth = 1000; + $depth = 1000; while (isset($children[$parent])) { $tabs_current = ''; - $next_path = ''; - $next_parent = ''; - $count = 0; + $next_path = ''; + $next_parent = ''; + $count = 0; foreach ($children[$parent] as $item) { if ($item['access']) { $count++; @@ -1418,9 +1429,9 @@ function menu_set_active_trail($new_trai $trail = $new_trail; } elseif (!isset($trail)) { - $trail = array(); + $trail = array(); $trail[] = array('title' => t('Home'), 'href' => '', 'options' => array(), 'type' => 0); - $item = menu_get_item(); + $item = menu_get_item(); // Check whether the current item is a local task (displayed as a tab). if ($item['tab_parent']) { @@ -1522,6 +1533,7 @@ function menu_get_active_title() { * * @param $mlid * The mlid of the menu item. + * * @return * A menu link, with $item['access'] filled and link translated for * rendering. @@ -1644,9 +1656,9 @@ function _menu_navigation_links_rebuild( $menu_links = array(); foreach ($menu as $path => $item) { if ($item['_visible']) { - $item = _menu_link_build($item); + $item = _menu_link_build($item); $menu_links[$path] = $item; - $sort[$path] = $item['_number_parts']; + $sort[$path] = $item['_number_parts']; } } if ($menu_links) { @@ -1656,9 +1668,9 @@ function _menu_navigation_links_rebuild( foreach ($menu_links as $item) { $existing_item = db_fetch_array(db_query("SELECT mlid, menu_name, plid, customized FROM {menu_links} WHERE link_path = '%s' AND module = '%s'", $item['link_path'], 'system')); if ($existing_item) { - $item['mlid'] = $existing_item['mlid']; + $item['mlid'] = $existing_item['mlid']; $item['menu_name'] = $existing_item['menu_name']; - $item['plid'] = $existing_item['plid']; + $item['plid'] = $existing_item['plid']; } if (!$existing_item || !$existing_item['customized']) { menu_link_save($item); @@ -1742,7 +1754,7 @@ function menu_link_save(&$item) { // This is the easiest way to handle the unique internal path '', // since a path marked as external does not need to match a router path. - $item['_external'] = menu_path_is_external($item['link_path']) || $item['link_path'] == ''; + $item['_external'] = menu_path_is_external($item['link_path']) || $item['link_path'] == ''; // Load defaults. $item += array( 'menu_name' => 'navigation', @@ -1776,7 +1788,7 @@ function menu_link_save(&$item) { // Menu callbacks need to be in the links table for breadcrumbs, but can't // be parents if they are generated directly from a router item. if (empty($parent['mlid']) || $parent['hidden'] < 0) { - $item['plid'] = 0; + $item['plid'] = 0; } else { $item['plid'] = $parent['mlid']; @@ -1796,8 +1808,9 @@ function menu_link_save(&$item) { $item['menu_name'], $item['plid'], $item['link_path'], $item['hidden'], $item['_external'], $item['has_children'], $item['expanded'], $item['weight'], - $item['module'], $item['link_title'], serialize($item['options']), - $item['customized'], $item['updated']); + $item['module'], $item['link_title'], serialize($item['options']), + $item['customized'], $item['updated'] + ); $item['mlid'] = db_last_insert_id('menu_links', 'mlid'); } @@ -1828,7 +1841,7 @@ function menu_link_save(&$item) { } // Find the callback. During the menu update we store empty paths to be // fixed later, so we skip this. - if (!isset($_SESSION['system_update_6021']) && (empty($item['router_path']) || !$existing_item || ($existing_item['link_path'] != $item['link_path']))) { + if (!isset($_SESSION['system_update_6021']) && (empty($item['router_path']) || !$existing_item || ($existing_item['link_path'] != $item['link_path']))) { if ($item['_external']) { $item['router_path'] = ''; } @@ -1845,9 +1858,10 @@ function menu_link_save(&$item) { module = '%s', link_title = '%s', options = '%s', customized = %d WHERE mlid = %d", $item['menu_name'], $item['plid'], $item['link_path'], $item['router_path'], $item['hidden'], $item['_external'], $item['has_children'], - $item['expanded'], $item['weight'], $item['depth'], + $item['expanded'], $item['weight'], $item['depth'], $item['p1'], $item['p2'], $item['p3'], $item['p4'], $item['p5'], $item['p6'], $item['p7'], $item['p8'], $item['p9'], - $item['module'], $item['link_title'], serialize($item['options']), $item['customized'], $item['mlid']); + $item['module'], $item['link_title'], serialize($item['options']), $item['customized'], $item['mlid'] + ); // Check the has_children status of the parent. _menu_update_parental_status($item); menu_cache_clear($menu_name); @@ -1900,6 +1914,7 @@ function _menu_set_expanded_menus() { * The full built menu. * @param $link_path * The path for we are looking up its router path. + * * @return * A path from $menu keys or empty if $link_path points to a nonexisting * place. @@ -1931,6 +1946,7 @@ function _menu_find_router_path($menu, $ * @param $link_title * Title of the link to insert or new title to update the link to. * Unused for delete. + * * @return * The insert op returns the mlid of the new item. Others op return NULL. */ @@ -1943,11 +1959,13 @@ function menu_link_maintain($module, $op 'module' => $module, ); return menu_link_save($menu_link); - break; + break; + case 'update': db_query("UPDATE {menu_links} SET link_title = '%s' WHERE link_path = '%s' AND customized = 0 AND module = '%s'", $link_title, $link_path, $module); menu_cache_clear(); break; + case 'delete': menu_link_delete(NULL, $link_path); break; @@ -1962,19 +1980,20 @@ function menu_link_maintain($module, $op * * @param $item * An array representing a menu link item. + * * @return * The relative depth, or zero. * */ function menu_link_children_relative_depth($item) { - $i = 1; - $match = ''; + $i = 1; + $match = ''; $args[] = $item['menu_name']; - $p = 'p1'; + $p = 'p1'; while ($i <= MENU_MAX_DEPTH && $item[$p]) { $match .= " AND $p = %d"; $args[] = $item[$p]; - $p = 'p'. ++$i; + $p = 'p'. ++$i; } $max_depth = db_result(db_query_range("SELECT depth FROM {menu_links} WHERE menu_name = '%s'". $match ." ORDER BY depth DESC", $args, 0, 1)); @@ -1991,12 +2010,12 @@ function menu_link_children_relative_dep function _menu_link_move_children($item, $existing_item) { $args[] = $item['menu_name']; - $set[] = "menu_name = '%s'"; + $set[] = "menu_name = '%s'"; - $i = 1; + $i = 1; while ($i <= $item['depth']) { - $p = 'p'. $i++; - $set[] = "$p = %d"; + $p = 'p'. $i++; + $set[] = "$p = %d"; $args[] = $item[$p]; } $j = $existing_item['depth'] + 1; @@ -2017,15 +2036,15 @@ function _menu_link_move_children($item, // old ones before they can be used because "Single-table UPDATE // assignments are generally evaluated from left to right" // see: http://dev.mysql.com/doc/refman/5.0/en/update.html - $set = array_reverse($set); - $args = array_reverse($args); + $set = array_reverse($set); + $args = array_reverse($args); $args[] = $shift; - $set[] = 'depth = depth + %d'; + $set[] = 'depth = depth + %d'; } $where[] = "menu_name = '%s'"; - $args[] = $existing_item['menu_name']; - $p = 'p1'; + $args[] = $existing_item['menu_name']; + $p = 'p1'; for ($i = 1; $i <= MENU_MAX_DEPTH && $existing_item[$p]; $p = 'p'. ++$i) { $where[] = "$p = %d"; $args[] = $existing_item[$p]; @@ -2076,13 +2095,13 @@ function _menu_router_build($callbacks) // matching. Calculate fitness, and fill some default values. $menu = array(); foreach ($callbacks as $path => $item) { - $load_functions = array(); + $load_functions = array(); $to_arg_functions = array(); - $fit = 0; - $move = FALSE; + $fit = 0; + $move = FALSE; - $parts = explode('/', $path, MENU_MAX_PARTS); - $number_parts = count($parts); + $parts = explode('/', $path, MENU_MAX_PARTS); + $number_parts = count($parts); // We store the highest index of parts here to save some work in the fit // calculation loop. $slashes = $number_parts - 1; @@ -2114,7 +2133,7 @@ function _menu_router_build($callbacks) $parts[$k] = '%'; } else { - $fit |= 1 << ($slashes - $k); + $fit |= 1 << ($slashes - $k); } } if ($fit) { @@ -2140,7 +2159,7 @@ function _menu_router_build($callbacks) '_tab' => (bool)($item['type'] & MENU_IS_LOCAL_TASK), ); if ($move) { - $new_path = implode('/', $item['_parts']); + $new_path = implode('/', $item['_parts']); $menu[$new_path] = $item; $sort[$new_path] = $number_parts; } @@ -2246,7 +2265,8 @@ function _menu_router_build($callbacks) serialize($item['access arguments']), $item['page callback'], serialize($item['page arguments']), $item['_fit'], $item['_number_parts'], $item['tab_parent'], $item['tab_root'], $item['title'], $item['title callback'], $title_arguments, - $item['type'], $item['block callback'], $item['description'], $item['position'], $item['weight'], $item['include file']); + $item['type'], $item['block callback'], $item['description'], $item['position'], $item['weight'], $item['include file'] + ); } // Sort the masks so they are in order of descending fit, and store them. $masks = array_keys($masks); @@ -2318,7 +2338,7 @@ function menu_valid_path($form_item) { $item['link_path'] = $form_item['link_path']; $item['link_title'] = $form_item['link_title']; $item['external'] = FALSE; - $item['options'] = ''; + $item['options'] = ''; _menu_link_translate($item); } } @@ -2328,3 +2348,4 @@ function menu_valid_path($form_item) { $menu_admin = FALSE; return $item && $item['access']; } + Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.115 diff -u -p -r1.115 module.inc --- includes/module.inc 27 Dec 2007 12:31:05 -0000 1.115 +++ includes/module.inc 20 Jan 2008 06:07:59 -0000 @@ -1,6 +1,7 @@ $pager_max) { @@ -141,11 +143,10 @@ function theme_pager($tags = array(), $l $i = 1; } // End of generation loop preparation. - - $li_first = theme('pager_first', (isset($tags[0]) ? $tags[0] : t('« first')), $limit, $element, $parameters); + $li_first = theme('pager_first', (isset($tags[0]) ? $tags[0] : t('« first')), $limit, $element, $parameters); $li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('‹ previous')), $limit, $element, 1, $parameters); - $li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('next ›')), $limit, $element, 1, $parameters); - $li_last = theme('pager_last', (isset($tags[4]) ? $tags[4] : t('last »')), $limit, $element, $parameters); + $li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('next ›')), $limit, $element, 1, $parameters); + $li_last = theme('pager_last', (isset($tags[4]) ? $tags[4] : t('last »')), $limit, $element, $parameters); if ($pager_total[$element] > 1) { if ($li_first) { @@ -214,7 +215,6 @@ function theme_pager($tags = array(), $l } } - /** * @name Pager pieces * @{ @@ -233,6 +233,7 @@ function theme_pager($tags = array(), $l * An optional integer to distinguish between multiple pagers on one page. * @param $parameters * An associative array of query string parameters to append to the pager links. + * * @return * An HTML string that generates this piece of the query pager. * @@ -263,6 +264,7 @@ function theme_pager_first($text, $limit * The number of pages to move backward when the link is clicked. * @param $parameters * An associative array of query string parameters to append to the pager links. + * * @return * An HTML string that generates this piece of the query pager. * @@ -302,6 +304,7 @@ function theme_pager_previous($text, $li * The number of pages to move forward when the link is clicked. * @param $parameters * An associative array of query string parameters to append to the pager links. + * * @return * An HTML string that generates this piece of the query pager. * @@ -338,6 +341,7 @@ function theme_pager_next($text, $limit, * An optional integer to distinguish between multiple pagers on one page. * @param $parameters * An associative array of query string parameters to append to the pager links. + * * @return * An HTML string that generates this piece of the query pager. * @@ -355,7 +359,6 @@ function theme_pager_last($text, $limit, return $output; } - /** * Format a link to a specific query result page. * @@ -367,6 +370,7 @@ function theme_pager_last($text, $limit, * An associative array of query string parameters to append to the pager link. * @param $attributes * An associative array of HTML attributes to apply to a pager anchor tag. + * * @return * An HTML string that generates the link. * @@ -432,3 +436,4 @@ function pager_load_array($value, $eleme $new_array[$element] = (int)$value; return $new_array; } + Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.19 diff -u -p -r1.19 path.inc --- includes/path.inc 4 Nov 2007 16:42:45 -0000 1.19 +++ includes/path.inc 20 Jan 2008 06:07:59 -0000 @@ -1,6 +1,7 @@ filename); + $theme_path = dirname($theme->filename); // Prepare stylesheets from this theme as well as all ancestor themes. // We work it this way so that we can have child themes override parent @@ -280,10 +282,10 @@ function _theme_process_registry(&$cache // files can prevent them from getting registered. if (isset($info['file']) && !isset($info['path'])) { $result[$hook]['file'] = $path .'/'. $info['file']; - include_once($result[$hook]['file']); + include_once ($result[$hook]['file']); } elseif (isset($info['file']) && isset($info['path'])) { - include_once($info['path'] .'/'. $info['file']); + include_once ($info['path'] .'/'. $info['file']); } if (isset($info['template']) && !isset($info['path'])) { @@ -402,6 +404,7 @@ function _theme_build_registry($theme, $ * * @param $refresh * Whether to reload the list of themes from the database. + * * @return * An array of the currently available themes. */ @@ -537,6 +540,7 @@ function list_themes($refresh = FALSE) { * priority than items in template_files. theme() will then look for these * files, one at a time, and use the first one * that exists. + * * @param $hook * The name of the theme function to call. May be an array, in which * case the first hook that actually has an implementation registered @@ -546,6 +550,7 @@ function list_themes($refresh = FALSE) { * implementations for named objects. * @param ... * Additional arguments to pass along to the theme function. + * * @return * An HTML string that generates the themed output. */ @@ -584,7 +589,7 @@ function theme() { if (isset($info['path'])) { $include_file = $info['path'] .'/'. $include_file; } - include_once($include_file); + include_once ($include_file); } if (isset($info['function'])) { // The theme call is a function. @@ -593,7 +598,7 @@ function theme() { else { // The theme call is a template. $variables = array( - 'template_files' => array() + 'template_files' => array(), ); if (!empty($info['arguments'])) { $count = 0; @@ -836,23 +841,23 @@ function drupal_find_theme_templates($ca */ function theme_get_settings($key = NULL) { $defaults = array( - 'mission' => '', - 'default_logo' => 1, - 'logo_path' => '', - 'default_favicon' => 1, - 'favicon_path' => '', - 'primary_links' => 1, - 'secondary_links' => 1, - 'toggle_logo' => 1, - 'toggle_favicon' => 1, - 'toggle_name' => 1, - 'toggle_search' => 1, - 'toggle_slogan' => 0, - 'toggle_mission' => 1, - 'toggle_node_user_picture' => 0, - 'toggle_comment_user_picture' => 0, - 'toggle_primary_links' => 1, - 'toggle_secondary_links' => 1, + 'mission' => '', + 'default_logo' => 1, + 'logo_path' => '', + 'default_favicon' => 1, + 'favicon_path' => '', + 'primary_links' => 1, + 'secondary_links' => 1, + 'toggle_logo' => 1, + 'toggle_favicon' => 1, + 'toggle_name' => 1, + 'toggle_search' => 1, + 'toggle_slogan' => 0, + 'toggle_mission' => 1, + 'toggle_node_user_picture' => 0, + 'toggle_comment_user_picture' => 0, + 'toggle_primary_links' => 1, + 'toggle_secondary_links' => 1, ); if (module_exists('node')) { @@ -895,9 +900,9 @@ function theme_get_setting($setting_name static $settings; if (empty($settings) || $refresh) { - $settings = theme_get_settings($theme_key); + $settings = theme_get_settings($theme_key); - $themes = list_themes(); + $themes = list_themes(); $theme_object = $themes[$theme_key]; if ($settings['mission'] == '') { @@ -950,12 +955,18 @@ function theme_get_setting($setting_name * The output generated by the template. */ function theme_render_template($file, $variables) { - extract($variables, EXTR_SKIP); // Extract the variables to a local namespace - ob_start(); // Start output buffering - include "./$file"; // Include the file - $contents = ob_get_contents(); // Get the contents of the buffer - ob_end_clean(); // End buffering and discard - return $contents; // Return the contents + // Extract the variables to a local namespace + extract($variables, EXTR_SKIP); + // Start output buffering + ob_start(); + // Include the file + include "./$file"; + // Get the contents of the buffer + $contents = ob_get_contents(); + // End buffering and discard + ob_end_clean(); + // Return the contents + return $contents; } /** @@ -1030,6 +1041,7 @@ function theme_render_template($file, $v * * @param $text * The text to format (plain-text). + * * @return * The formatted text (html). */ @@ -1073,6 +1085,7 @@ function theme_status_messages($display * A keyed array of links to be themed. * @param $attributes * A keyed array of attributes + * * @return * A string containing an unordered list of links. */ @@ -1080,10 +1093,10 @@ function theme_links($links, $attributes $output = ''; if (count($links) > 0) { - $output = ''; + $output = ''; $num_links = count($links); - $i = 1; + $i = 1; foreach ($links as $key => $link) { $class = $key; @@ -1139,6 +1152,7 @@ function theme_links($links, $attributes * Associative array of attributes to be placed in the img tag. * @param $getsize * If set to TRUE, the image's dimension are fetched and added as width/height attributes. + * * @return * A string containing the image tag. */ @@ -1155,6 +1169,7 @@ function theme_image($path, $alt = '', $ * * @param $breadcrumb * An array containing the breadcrumb links. + * * @return a string containing the breadcrumb output. */ function theme_breadcrumb($breadcrumb) { @@ -1224,6 +1239,7 @@ function theme_submenu($links) { * An array of HTML attributes to apply to the table tag. * @param $caption * A localized string to use for the tag. + * * @return * An HTML string representing the table. */ @@ -1323,6 +1339,7 @@ function theme_table_select_header_cell( * * @param $style * Set to either asc or desc. This sets which icon to show. + * * @return * A themed sort icon. */ @@ -1344,6 +1361,7 @@ function theme_tablesort_indicator($styl * The content of the box. * @param $region * The region in which the box is displayed. + * * @return * A string containing the box output. */ @@ -1359,6 +1377,7 @@ function theme_box($title, $content, $re * @param $type * Number representing the marker type to display * @see MARK_NEW, MARK_UPDATED, MARK_READ + * * @return * A string containing the marker. */ @@ -1389,6 +1408,7 @@ function theme_mark($type = MARK_NEW) { * The attributes applied to the list element. * @param $type * The type of list to return (e.g. "ul", "ol") + * * @return * A string containing the list output. */ @@ -1421,7 +1441,8 @@ function theme_item_list($items = array( $data = $item; } if (count($children) > 0) { - $data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list + // Render nested list + $data .= theme_item_list($children, NULL, $type, $attributes); } if ($i == 0) { $attributes['class'] = empty($attributes['class']) ? 'first' : ($attributes['class'] .' first'); @@ -1460,7 +1481,7 @@ function theme_xml_icon($url) { * The url of the feed. * @param $title * A descriptive title of the feed. - */ + */ function theme_feed_icon($url, $title) { if ($image = theme('image', 'misc/feed.png', t('Syndicate content'), $title)) { return ''. $image .''; @@ -1485,6 +1506,7 @@ function theme_more_link($url, $title) { * * @param $main (optional) * Whether the current page is the front page of the site. + * * @return * A string containing the results of the hook_footer() calls. */ @@ -1498,6 +1520,7 @@ function theme_closure($main = 0) { * * @param $region * Which set of blocks to retrieve. + * * @return * A string containing the themed blocks for this region. */ @@ -1522,6 +1545,7 @@ function theme_blocks($region) { * * @param $object * The user object to format, usually returned from user_load(). + * * @return * A string containing an HTML link to the user's page if the passed object * suggests that this is a site user. Otherwise, only the username is returned. @@ -1572,6 +1596,7 @@ function theme_username($object) { * The percentage of the progress. * @param $message * A string containing information to be displayed. + * * @return * A themed HTML string representing the progress bar. */ @@ -1590,6 +1615,7 @@ function theme_progress_bar($percent, $m * * @param $size * Optional. The number of indentations to create. + * * @return * A string containing indentations. */ @@ -1604,7 +1630,6 @@ function theme_indentation($size = 1) { /** * @} End of "defgroup themeable". */ - function _theme_table_cell($cell, $header = FALSE) { $attributes = ''; @@ -1641,18 +1666,18 @@ function template_preprocess(&$variables // Track run count for each hook to provide zebra striping. // See "template_preprocess_block()" which provides the same feature specific to blocks. - $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1; + $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1; $variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even'; - $variables['id'] = $count[$hook]++; + $variables['id'] = $count[$hook]++; // Tell all templates where they are located. $variables['directory'] = path_to_theme(); // Set default variables that depend on the database. - $variables['is_admin'] = FALSE; - $variables['is_front'] = FALSE; - $variables['logged_in'] = FALSE; - if ($variables['db_is_active'] = db_is_active() && !defined('MAINTENANCE_MODE')) { + $variables['is_admin'] = FALSE; + $variables['is_front'] = FALSE; + $variables['logged_in'] = FALSE; + if ($variables['db_is_active'] = db_is_active() && !defined('MAINTENANCE_MODE')) { // Check for administrators. if (user_access('access administration pages')) { $variables['is_admin'] = TRUE; @@ -1731,30 +1756,30 @@ function template_preprocess_page(&$vari $head_title[] = variable_get('site_slogan', ''); } } - $variables['head_title'] = implode(' | ', $head_title); - $variables['base_path'] = base_path(); - $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['head'] = drupal_get_html_head(); - $variables['help'] = theme('help'); - $variables['language'] = $GLOBALS['language']; - $variables['logo'] = theme_get_setting('logo'); - $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; - $variables['mission'] = isset($mission) ? $mission : ''; - $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['css'] = drupal_add_css(); - $variables['styles'] = drupal_get_css(); - $variables['scripts'] = drupal_get_js(); - $variables['tabs'] = theme('menu_local_tasks'); - $variables['title'] = drupal_get_title(); + $variables['head_title'] = implode(' | ', $head_title); + $variables['base_path'] = base_path(); + $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['head'] = drupal_get_html_head(); + $variables['help'] = theme('help'); + $variables['language'] = $GLOBALS['language']; + $variables['logo'] = theme_get_setting('logo'); + $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; + $variables['mission'] = isset($mission) ? $mission : ''; + $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['css'] = drupal_add_css(); + $variables['styles'] = drupal_get_css(); + $variables['scripts'] = drupal_get_js(); + $variables['tabs'] = theme('menu_local_tasks'); + $variables['title'] = drupal_get_title(); // Closure should be filled last. - $variables['closure'] = theme('closure'); + $variables['closure'] = theme('closure'); if ($node = menu_get_object()) { $variables['node'] = $node; @@ -1799,8 +1824,8 @@ function template_preprocess_page(&$vari // page-node-1.tpl.php // page-node.tpl.php // page.tpl.php - $i = 0; - $suggestion = 'page'; + $i = 0; + $suggestion = 'page'; $suggestions = array(); while ($arg = arg($i++)) { $suggestions[] = $suggestion .'-'. $arg; @@ -1850,12 +1875,12 @@ function template_preprocess_node(&$vari $variables['content'] = ''; } - $variables['date'] = format_date($node->created); - $variables['links'] = !empty($node->links) ? theme('links', $node->links, array('class' => 'links inline')) : ''; - $variables['name'] = theme('username', $node); - $variables['node_url'] = url('node/'. $node->nid); - $variables['terms'] = theme('links', $variables['taxonomy'], array('class' => 'links inline')); - $variables['title'] = check_plain($node->title); + $variables['date'] = format_date($node->created); + $variables['links'] = !empty($node->links) ? theme('links', $node->links, array('class' => 'links inline')) : ''; + $variables['name'] = theme('username', $node); + $variables['node_url'] = url('node/'. $node->nid); + $variables['terms'] = theme('links', $variables['taxonomy'], array('class' => 'links inline')); + $variables['title'] = check_plain($node->title); // Flatten the node object's member fields. $variables = array_merge((array)$node, $variables); Index: includes/theme.maintenance.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v retrieving revision 1.9 diff -u -p -r1.9 theme.maintenance.inc --- includes/theme.maintenance.inc 16 Jan 2008 10:47:17 -0000 1.9 +++ includes/theme.maintenance.inc 20 Jan 2008 06:08:00 -0000 @@ -1,6 +1,7 @@ '. st('Please check the error messages and try again.', array('!url' => request_uri())) .'

'; } - + // Special handling of warning messages if (isset($messages['warning'])) { $title = count($messages['warning']) > 1 ? st('The following installation warnings should be carefully reviewed') : st('The following installation warning should be carefully reviewed'); @@ -239,28 +240,28 @@ function template_preprocess_maintenance $head_title[] = variable_get('site_slogan', ''); } } - $variables['head_title'] = implode(' | ', $head_title); - $variables['base_path'] = base_path(); - $variables['breadcrumb'] = ''; - $variables['feed_icons'] = ''; - $variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE)); - $variables['head'] = drupal_get_html_head(); - $variables['help'] = ''; - $variables['language'] = $GLOBALS['language']; - $variables['logo'] = theme_get_setting('logo'); - $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; - $variables['mission'] = ''; - $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['css'] = drupal_add_css(); - $variables['styles'] = drupal_get_css(); - $variables['scripts'] = drupal_get_js(); - $variables['tabs'] = ''; - $variables['title'] = drupal_get_title(); - $variables['closure'] = ''; + $variables['head_title'] = implode(' | ', $head_title); + $variables['base_path'] = base_path(); + $variables['breadcrumb'] = ''; + $variables['feed_icons'] = ''; + $variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE)); + $variables['head'] = drupal_get_html_head(); + $variables['help'] = ''; + $variables['language'] = $GLOBALS['language']; + $variables['logo'] = theme_get_setting('logo'); + $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; + $variables['mission'] = ''; + $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['css'] = drupal_add_css(); + $variables['styles'] = drupal_get_css(); + $variables['scripts'] = drupal_get_js(); + $variables['tabs'] = ''; + $variables['title'] = drupal_get_title(); + $variables['closure'] = ''; // Compile a list of classes that are going to be applied to the body element. $body_classes = array(); @@ -285,3 +286,4 @@ function template_preprocess_maintenance $variables['template_file'] = 'maintenance-page-offline'; } } + Index: includes/unicode.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/unicode.inc,v retrieving revision 1.29 diff -u -p -r1.29 unicode.inc --- includes/unicode.inc 28 Dec 2007 12:02:50 -0000 1.29 +++ includes/unicode.inc 20 Jan 2008 06:08:00 -0000 @@ -1,6 +1,7 @@ 0) { $chunk = drupal_truncate_bytes($string, $chunk_size); $output .= ' =?UTF-8?B?'. base64_encode($chunk) ."?=\n"; @@ -371,19 +379,13 @@ function _decode_entities($prefix, $code $str = chr($codepoint); } else if ($codepoint < 0x800) { - $str = chr(0xC0 | ($codepoint >> 6)) - . chr(0x80 | ($codepoint & 0x3F)); + $str = chr(0xC0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3F)); } else if ($codepoint < 0x10000) { - $str = chr(0xE0 | ( $codepoint >> 12)) - . chr(0x80 | (($codepoint >> 6) & 0x3F)) - . chr(0x80 | ( $codepoint & 0x3F)); + $str = chr(0xE0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3F)) . chr(0x80 | ($codepoint & 0x3F)); } else if ($codepoint < 0x200000) { - $str = chr(0xF0 | ( $codepoint >> 18)) - . chr(0x80 | (($codepoint >> 12) & 0x3F)) - . chr(0x80 | (($codepoint >> 6) & 0x3F)) - . chr(0x80 | ( $codepoint & 0x3F)); + $str = chr(0xF0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3F)) . chr(0x80 | (($codepoint >> 6) & 0x3F)) . chr(0x80 | ($codepoint & 0x3F)); } // Check for excluded characters if (in_array($str, $exclude)) { @@ -479,7 +481,8 @@ function drupal_substr($text, $start, $l if ($start > 0) { // Count all the continuation bytes from the start until we have found // $start characters - $bytes = -1; $chars = -1; + $bytes = -1; + $chars = -1; while ($bytes < $strlen && $chars < $start) { $bytes++; $c = ord($text[$bytes]); @@ -492,7 +495,8 @@ function drupal_substr($text, $start, $l // Count all the continuation bytes from the end until we have found // abs($start) characters $start = abs($start); - $bytes = $strlen; $chars = 0; + $bytes = $strlen; + $chars = 0; while ($bytes > 0 && $chars < $start) { $bytes--; $c = ord($text[$bytes]); @@ -510,7 +514,8 @@ function drupal_substr($text, $start, $l else if ($length > 0) { // Count all the continuation bytes from the starting index until we have // found $length + 1 characters. Then backtrack one byte. - $bytes = $istart; $chars = 0; + $bytes = $istart; + $chars = 0; while ($bytes < $strlen && $chars < $length) { $bytes++; $c = ord($text[$bytes]); @@ -524,7 +529,8 @@ function drupal_substr($text, $start, $l // Count all the continuation bytes from the end until we have found // abs($length) characters $length = abs($length); - $bytes = $strlen - 1; $chars = 0; + $bytes = $strlen - 1; + $chars = 0; while ($bytes >= 0 && $chars < $length) { $c = ord($text[$bytes]); if ($c < 0x80 || $c >= 0xC0) { @@ -539,4 +545,3 @@ function drupal_substr($text, $start, $l } } - Index: includes/xmlrpc.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/xmlrpc.inc,v retrieving revision 1.47 diff -u -p -r1.47 xmlrpc.inc --- includes/xmlrpc.inc 9 Jan 2008 21:52:43 -0000 1.47 +++ includes/xmlrpc.inc 20 Jan 2008 06:08:00 -0000 @@ -1,6 +1,7 @@ data)) { - return 'int'; + return 'int'; } if (is_array($xmlrpc_value->data)) { // empty or integer-indexed arrays are 'array', string-indexed arrays 'struct' @@ -84,6 +87,7 @@ function xmlrpc_value_calculate_type(&$x * Generate XML representing the given value. * * @param $xmlrpc_value + * * @return * XML representation of value. */ @@ -91,18 +95,22 @@ function xmlrpc_value_get_xml($xmlrpc_va switch ($xmlrpc_value->type) { case 'boolean': return ''. (($xmlrpc_value->data) ? '1' : '0') .''; - break; + break; + case 'int': return ''. $xmlrpc_value->data .''; - break; + break; + case 'double': return ''. $xmlrpc_value->data .''; - break; + break; + case 'string': // Note: we don't escape apostrophes because of the many blogging clients // that don't support numerical entities (and XML in general) properly. return ''. htmlspecialchars($xmlrpc_value->data) .''; - break; + break; + case 'array': $return = ''."\n"; foreach ($xmlrpc_value->data as $item) { @@ -110,7 +118,8 @@ function xmlrpc_value_get_xml($xmlrpc_va } $return .= ''; return $return; - break; + break; + case 'struct': $return = ''."\n"; foreach ($xmlrpc_value->data as $name => $value) { @@ -119,13 +128,15 @@ function xmlrpc_value_get_xml($xmlrpc_va } $return .= ''; return $return; - break; + break; + case 'date': return xmlrpc_date_get_xml($xmlrpc_value->data); - break; + break; + case 'base64': return xmlrpc_base64_get_xml($xmlrpc_value->data); - break; + break; } return FALSE; } @@ -135,14 +146,18 @@ function xmlrpc_value_get_xml($xmlrpc_va * * @param $message * String containing XML as defined at http://www.xmlrpc.com/spec + * * @return * Object */ function xmlrpc_message($message) { $xmlrpc_message = new stdClass(); - $xmlrpc_message->array_structs = array(); // The stack used to keep track of the current array/struct - $xmlrpc_message->array_structs_types = array(); // The stack used to keep track of if things are structs or array - $xmlrpc_message->current_struct_name = array(); // A stack as well + // The stack used to keep track of the current array/struct + $xmlrpc_message->array_structs = array(); + // The stack used to keep track of if things are structs or array + $xmlrpc_message->array_structs_types = array(); + // A stack as well + $xmlrpc_message->current_struct_name = array(); $xmlrpc_message->message = $message; return $xmlrpc_message; } @@ -153,6 +168,7 @@ function xmlrpc_message($message) { * * @param $xmlrpc_message * Object generated by xmlrpc_message() + * * @return * TRUE if parsing succeeded; FALSE otherwise */ @@ -187,6 +203,7 @@ function xmlrpc_message_parse(&$xmlrpc_m * * @param $value * Object + * * @return * The most recently stored $xmlrpc_message */ @@ -213,10 +230,12 @@ function xmlrpc_message_tag_open($parser $xmlrpc_message->messagetype = $tag; break; // Deal with stacks of arrays and structs + case 'data': $xmlrpc_message->array_structs_types[] = 'array'; $xmlrpc_message->array_structs[] = array(); break; + case 'struct': $xmlrpc_message->array_structs_types[] = 'struct'; $xmlrpc_message->array_structs[] = array(); @@ -240,19 +259,23 @@ function xmlrpc_message_tag_close($parse $value = (int)trim($xmlrpc_message->current_tag_contents); $value_flag = TRUE; break; + case 'double': $value = (double)trim($xmlrpc_message->current_tag_contents); $value_flag = TRUE; break; + case 'string': $value = $xmlrpc_message->current_tag_contents; $value_flag = TRUE; break; + case 'dateTime.iso8601': $value = xmlrpc_date(trim($xmlrpc_message->current_tag_contents)); // $value = $iso->getTimestamp(); $value_flag = TRUE; break; + case 'value': // If no type is indicated, the type is string // We take special care for empty values @@ -262,41 +285,47 @@ function xmlrpc_message_tag_close($parse } unset($xmlrpc_message->last_open); break; + case 'boolean': $value = (boolean)trim($xmlrpc_message->current_tag_contents); $value_flag = TRUE; break; + case 'base64': $value = base64_decode(trim($xmlrpc_message->current_tag_contents)); $value_flag = TRUE; break; // Deal with stacks of arrays and structs + case 'data': case 'struct': - $value = array_pop($xmlrpc_message->array_structs ); + $value = array_pop($xmlrpc_message->array_structs); array_pop($xmlrpc_message->array_structs_types); $value_flag = TRUE; break; + case 'member': array_pop($xmlrpc_message->current_struct_name); break; + case 'name': $xmlrpc_message->current_struct_name[] = trim($xmlrpc_message->current_tag_contents); break; + case 'methodName': $xmlrpc_message->methodname = trim($xmlrpc_message->current_tag_contents); break; } if ($value_flag) { - if (count($xmlrpc_message->array_structs ) > 0) { + if (count($xmlrpc_message->array_structs) > 0) { // Add value to struct or array - if ($xmlrpc_message->array_structs_types[count($xmlrpc_message->array_structs_types)-1] == 'struct') { + if ($xmlrpc_message->array_structs_types[count($xmlrpc_message->array_structs_types) - 1] == 'struct') { // Add to struct - $xmlrpc_message->array_structs [count($xmlrpc_message->array_structs )-1][$xmlrpc_message->current_struct_name[count($xmlrpc_message->current_struct_name)-1]] = $value; + $xmlrpc_message->array_structs[count($xmlrpc_message->array_structs) - 1][$xmlrpc_message->current_struct_name[count($xmlrpc_message->current_struct_name) - 1]] = $value; } else { // Add to array - $xmlrpc_message->array_structs [count($xmlrpc_message->array_structs )-1][] = $value; + $xmlrpc_message->array_structs[count($xmlrpc_message->array_structs) - 1][] = $value; } } else { @@ -317,6 +346,7 @@ function xmlrpc_message_tag_close($parse * The name of the method to be called * @param $args * An array of parameters to send with the method. + * * @return * Object */ @@ -341,7 +371,6 @@ EOD; return $xmlrpc_request; } - function xmlrpc_error($code = NULL, $message = NULL) { static $xmlrpc_error; if (isset($code)) { @@ -475,3 +504,4 @@ function xmlrpc_error_msg() { $error = xmlrpc_error(); return $error->message; } + Index: includes/xmlrpcs.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/xmlrpcs.inc,v retrieving revision 1.24 diff -u -p -r1.24 xmlrpcs.inc --- includes/xmlrpcs.inc 31 Dec 2007 08:54:36 -0000 1.24 +++ includes/xmlrpcs.inc 20 Jan 2008 06:08:00 -0000 @@ -1,6 +1,7 @@ 'xmlrpc_server_multicall', + 'system.multicall' => 'xmlrpc_server_multicall', array( 'system.methodSignature', 'xmlrpc_server_method_signature', array('array', 'string'), - 'Returns an array describing the return type and required parameters of a method.' + 'Returns an array describing the return type and required parameters of a method.', ), array( 'system.getCapabilities', 'xmlrpc_server_get_capabilities', array('struct'), - 'Returns a struct describing the XML-RPC specifications supported by this server.' + 'Returns a struct describing the XML-RPC specifications supported by this server.', ), array( 'system.listMethods', 'xmlrpc_server_list_methods', array('array'), - 'Returns an array of available methods on this server.'), + 'Returns an array of available methods on this server.', + ), array( 'system.methodHelp', 'xmlrpc_server_method_help', array('string', 'string'), - 'Returns a documentation string for the specified method.') + 'Returns a documentation string for the specified method.', + ), ); // We build an array of all method names by combining the built-ins // with those defined by modules implementing the _xmlrpc hook. @@ -77,9 +80,7 @@ function xmlrpc_server($callbacks) { - '. - xmlrpc_value_get_xml($r) - .' + '. xmlrpc_value_get_xml($r) .' @@ -172,23 +173,27 @@ function xmlrpc_server_call($xmlrpc_serv $ok = FALSE; } break; + case 'base64': case 'string': if (!is_string($arg)) { $ok = FALSE; } break; + case 'boolean': if ($arg !== FALSE && $arg !== TRUE) { $ok = FALSE; } break; + case 'float': case 'double': if (!is_float($arg)) { $ok = FALSE; } break; + case 'date': case 'dateTime.iso8601': if (!$arg->is_date) { @@ -230,7 +235,7 @@ function xmlrpc_server_multicall($method if ($result->is_error) { $return[] = array( 'faultCode' => $result->code, - 'faultString' => $result->message + 'faultString' => $result->message, ); } else { @@ -240,7 +245,6 @@ function xmlrpc_server_multicall($method return $return; } - /** * XML-RPC method system.listMethods maps to this function. */ @@ -257,20 +261,20 @@ function xmlrpc_server_get_capabilities( return array( 'xmlrpc' => array( 'specUrl' => 'http://www.xmlrpc.com/spec', - 'specVersion' => 1 + 'specVersion' => 1, ), 'faults_interop' => array( 'specUrl' => 'http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php', - 'specVersion' => 20010516 + 'specVersion' => 20010516, ), 'system.multicall' => array( 'specUrl' => 'http://www.xmlrpc.com/discuss/msgReader$1208', - 'specVersion' => 1 + 'specVersion' => 1, ), 'introspection' => array( - 'specUrl' => 'http://scripts.incutio.com/xmlrpc/introspection.html', - 'specVersion' => 1 - ) + 'specUrl' => 'http://scripts.incutio.com/xmlrpc/introspection.html', + 'specVersion' => 1, + ), ); } @@ -279,6 +283,7 @@ function xmlrpc_server_get_capabilities( * * @param $methodname * Name of method for which we return a method signature. + * * @return array * An array of types representing the method signature of the * function that the methodname maps to. The methodSignature of @@ -311,3 +316,4 @@ function xmlrpc_server_method_help($meth $xmlrpc_server = xmlrpc_server_get(); return $xmlrpc_server->help[$method]; } + Index: modules/aggregator/aggregator-feed-source.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator-feed-source.tpl.php,v retrieving revision 1.1 diff -u -p -r1.1 aggregator-feed-source.tpl.php --- modules/aggregator/aggregator-feed-source.tpl.php 13 Sep 2007 08:02:38 -0000 1.1 +++ modules/aggregator/aggregator-feed-source.tpl.php 20 Jan 2008 06:08:00 -0000 @@ -1,6 +1,7 @@ -
- - -
- -
+?>
+ +
+
- -
+
+ Index: modules/aggregator/aggregator-item.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator-item.tpl.php,v retrieving revision 1.1 diff -u -p -r1.1 aggregator-item.tpl.php --- modules/aggregator/aggregator-item.tpl.php 13 Sep 2007 08:02:38 -0000 1.1 +++ modules/aggregator/aggregator-item.tpl.php 20 Jan 2008 06:08:00 -0000 @@ -1,6 +1,7 @@ -
+?>

- - - - - + - +
- -
- -
+
+
- -
- : -
- - +
+ :
+
+ Index: modules/aggregator/aggregator-summary-item.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator-summary-item.tpl.php,v retrieving revision 1.1 diff -u -p -r1.1 aggregator-summary-item.tpl.php --- modules/aggregator/aggregator-summary-item.tpl.php 13 Sep 2007 08:02:38 -0000 1.1 +++ modules/aggregator/aggregator-summary-item.tpl.php 20 Jan 2008 06:08:00 -0000 @@ -1,6 +1,7 @@ - , +?> , -

- - + Index: modules/system/page.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/system/page.tpl.php,v retrieving revision 1.10 diff -u -p -r1.10 page.tpl.php --- modules/system/page.tpl.php 8 Dec 2007 14:06:22 -0000 1.10 +++ modules/system/page.tpl.php 20 Jan 2008 06:08:06 -0000 @@ -1,6 +1,7 @@ - - + <?php print $head_title; ?> - - - - + + +/* Needed to avoid Flash of Unstyled Content in IE */ +
- - + - -
- -
+
+
-
- - - + -
- -
- + +
-

-
- - -
- -
- -
+

+
+ +
+
+
- - + -
- + Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.58 diff -u -p -r1.58 system.admin.inc --- modules/system/system.admin.inc 17 Jan 2008 16:08:35 -0000 1.58 +++ modules/system/system.admin.inc 20 Jan 2008 06:08:07 -0000 @@ -1,6 +1,7 @@ name; @@ -136,10 +136,10 @@ function system_settings_overview() { db_check_setup(); } - $item = menu_get_item('admin/settings'); + $item = menu_get_item('admin/settings'); $content = system_admin_menu_block($item); - $output = theme('admin_block_content', $content); + $output = theme('admin_block_content', $content); return $output; } @@ -192,9 +192,9 @@ function system_themes_form() { uasort($themes, 'system_sort_modules_by_info_name'); - $status = array(); + $status = array(); $incompatible_core = array(); - $incompatible_php = array(); + $incompatible_php = array(); foreach ($themes as $theme) { $screenshot = NULL; @@ -216,7 +216,7 @@ function system_themes_form() { $options[$theme->name] = ''; if (!empty($theme->status) || $theme->name == variable_get('admin_theme', '0')) { - $form[$theme->name]['operations'] = array('#value' => l(t('configure'), 'admin/build/themes/settings/'. $theme->name) ); + $form[$theme->name]['operations'] = array('#value' => l(t('configure'), 'admin/build/themes/settings/'. $theme->name)); } else { // Dummy element for drupal_render. Cleaner than adding a check in the theme function. @@ -286,10 +286,10 @@ function system_themes_form_submit($form } if (($admin_theme = variable_get('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'], - ))); + '!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']); } @@ -319,6 +319,7 @@ function system_themes_form_submit($form * * @param $key * A theme name. + * * @return * The form structure. * @ingroup forms @@ -331,8 +332,8 @@ function system_theme_settings(&$form_st // Default settings are defined in theme_get_settings() in includes/theme.inc if ($key) { $settings = theme_get_settings($key); - $var = str_replace('/', '_', 'theme_'. $key .'_settings'); - $themes = system_theme_data(); + $var = str_replace('/', '_', 'theme_'. $key .'_settings'); + $themes = system_theme_data(); $features = $themes[$key]->info['features']; } else { @@ -374,16 +375,16 @@ function system_theme_settings(&$form_st // Toggle settings $toggles = array( - 'logo' => t('Logo'), - 'name' => t('Site name'), - 'slogan' => t('Site slogan'), - 'mission' => t('Mission statement'), - 'node_user_picture' => t('User pictures in posts'), + 'logo' => t('Logo'), + 'name' => t('Site name'), + 'slogan' => t('Site slogan'), + 'mission' => t('Mission statement'), + 'node_user_picture' => t('User pictures in posts'), 'comment_user_picture' => t('User pictures in comments'), - 'search' => t('Search box'), - 'favicon' => t('Shortcut icon'), - 'primary_links' => t('Primary links'), - 'secondary_links' => t('Secondary links'), + 'search' => t('Search box'), + 'favicon' => t('Shortcut icon'), + 'primary_links' => t('Primary links'), + 'secondary_links' => t('Secondary links'), ); // Some features are not always available @@ -453,19 +454,20 @@ function system_theme_settings(&$form_st '#title' => t('Use the default logo'), '#default_value' => $settings['default_logo'], '#tree' => FALSE, - '#description' => t('Check here if you want the theme to use the logo supplied with it.') + '#description' => t('Check here if you want the theme to use the logo supplied with it.'), ); $form['logo']['logo_path'] = array( '#type' => 'textfield', '#title' => t('Path to custom logo'), '#default_value' => $settings['logo_path'], - '#description' => t('The path to the file you would like to use as your logo file instead of the default logo.')); + '#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'), + ); $form['logo']['logo_upload'] = array( '#type' => 'file', '#title' => t('Upload logo image'), '#maxlength' => 40, - '#description' => t("If you don't have direct file access to the server, use this field to upload your logo.") + '#description' => t("If you don't have direct file access to the server, use this field to upload your logo."), ); } @@ -473,25 +475,25 @@ function system_theme_settings(&$form_st $form['favicon'] = array( '#type' => 'fieldset', '#title' => t('Shortcut icon settings'), - '#description' => t("Your shortcut icon, or 'favicon', is displayed in the address bar and bookmarks of most browsers.") + '#description' => t("Your shortcut icon, or 'favicon', is displayed in the address bar and bookmarks of most browsers."), ); $form['favicon']['default_favicon'] = array( '#type' => 'checkbox', '#title' => t('Use the default shortcut icon.'), '#default_value' => $settings['default_favicon'], - '#description' => t('Check here if you want the theme to use the default shortcut icon.') + '#description' => t('Check here if you want the theme to use the default shortcut icon.'), ); $form['favicon']['favicon_path'] = array( '#type' => 'textfield', '#title' => t('Path to custom icon'), '#default_value' => $settings['favicon_path'], - '#description' => t('The path to the image file you would like to use as your custom shortcut icon.') + '#description' => t('The path to the image file you would like to use as your custom shortcut icon.'), ); $form['favicon']['favicon_upload'] = array( '#type' => 'file', '#title' => t('Upload icon image'), - '#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon.") + '#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon."), ); } @@ -567,6 +569,7 @@ function system_theme_settings_submit($f * The set of files that will be tested. * @param $file * The file at which the check starts. + * * @return * Returns TRUE if an incompatible file is found, NULL (no return value) otherwise. */ @@ -582,7 +585,7 @@ function _system_is_incompatible(&$incom } // The 'dependencies' key in .info files was a string in Drupal 5, but changed // to an array in Drupal 6. If it is not an array, the module is not - // compatible and we can skip the check below which requires an array. + // compatible and we can skip the check below which requires an array. if (!is_array($file->info['dependencies'])) { $file->info['dependencies'] = array(); $incompatible[$file->name] = TRUE; @@ -614,6 +617,7 @@ function _system_is_incompatible(&$incom * @ingroup forms * @see theme_system_modules() * @see system_modules_submit() + * * @return * The form array. */ @@ -787,6 +791,7 @@ function system_sort_modules_by_info_nam * @param $edit * Not used. * @ingroup forms + * * @return * The form structure. */ @@ -842,7 +847,8 @@ function system_modules_confirm_form($mo 'admin/build/modules', t('Would you like to continue with enabling the above?'), t('Continue'), - t('Cancel')); + t('Cancel') + ); return $form; } } @@ -949,7 +955,6 @@ function system_modules_submit($form, &$ return; } - /** * Generate a list of dependencies for modules that are going to be switched on. * @@ -957,6 +962,7 @@ function system_modules_submit($form, &$ * The list of modules to check. * @param $form_values * Submitted form values used to determine what modules have been enabled. + * * @return * An array of dependencies. */ @@ -992,8 +998,10 @@ function system_module_build_dependencie * @ingroup forms * @see system_modules_uninstall_validate() * @see system_modules_uninstall_submit() + * * @param $form_state['values'] * Submitted form values. + * * @return * A form array representing the currently disabled modules. */ @@ -1048,8 +1056,10 @@ function system_modules_uninstall($form_ * Confirm uninstall of selected modules. * * @ingroup forms + * * @param $storage * An associative array of modules selected to be uninstalled. + * * @return * A form array representing modules to confirm. */ @@ -1079,7 +1089,8 @@ function system_modules_uninstall_confir 'admin/build/modules/uninstall', t('Would you like to continue with uninstalling the above?'), t('Uninstall'), - t('Cancel')); + t('Cancel') + ); return $form; } } @@ -1129,7 +1140,7 @@ function system_site_information_setting '#title' => t('Name'), '#default_value' => variable_get('site_name', 'Drupal'), '#description' => t('The name of this website.'), - '#required' => TRUE + '#required' => TRUE, ); $form['site_mail'] = array( '#type' => 'textfield', @@ -1142,19 +1153,19 @@ function system_site_information_setting '#type' => 'textfield', '#title' => t('Slogan'), '#default_value' => variable_get('site_slogan', ''), - '#description' => t("Your site's motto, tag line, or catchphrase (often displayed alongside the title of the site).") + '#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', ''), - '#description' => t("Your site's mission or focus statement (often prominently displayed on the front page).") + '#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', ''), - '#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.') + '#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', @@ -1211,7 +1222,7 @@ function system_error_reporting_settings '#default_value' => variable_get('site_403', ''), '#size' => 40, '#description' => t('This page is displayed when the requested document is denied to the current user. If unsure, specify nothing.'), - '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') + '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), ); $form['site_404'] = array( @@ -1220,13 +1231,13 @@ function system_error_reporting_settings '#default_value' => variable_get('site_404', ''), '#size' => 40, '#description' => t('This page is displayed when no other content matches the requested document. If unsure, specify nothing.'), - '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') + '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), ); $form['error_level'] = array( '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('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.') + '#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.'), ); return system_settings_form($form); @@ -1236,10 +1247,10 @@ function system_error_reporting_settings * Menu callback; Menu page for the various logging options. */ function system_logging_overview() { - $item = menu_get_item('admin/settings/logging'); + $item = menu_get_item('admin/settings/logging'); $content = system_admin_menu_block($item); - $output = theme('admin_block_content', $content); + $output = theme('admin_block_content', $content); return $output; } @@ -1274,7 +1285,7 @@ function system_performance_settings() { '#title' => t('Caching mode'), '#default_value' => variable_get('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 + '#description' => $description, ); $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval'); @@ -1284,7 +1295,7 @@ function system_performance_settings() { '#title' => t('Minimum cache lifetime'), '#default_value' => variable_get('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.') + '#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', @@ -1312,7 +1323,7 @@ function system_performance_settings() { $form['bandwidth_optimizations'] = array( '#type' => 'fieldset', '#title' => t('Bandwidth optimizations'), - '#description' => t('

Drupal can automatically optimize external resources like CSS and JavaScript, which can reduce both the size and number of requests made to your website. CSS files can be aggregated and compressed into a single file, while JavaScript files are aggregated (but not compressed). These optional optimizations may reduce server load, bandwidth requirements, and page loading times.

These options are disabled if you have not set up your files directory, or if your download method is set to private.

') + '#description' => t('

Drupal can automatically optimize external resources like CSS and JavaScript, which can reduce both the size and number of requests made to your website. CSS files can be aggregated and compressed into a single file, while JavaScript files are aggregated (but not compressed). These optional optimizations may reduce server load, bandwidth requirements, and page loading times.

These options are disabled if you have not set up your files directory, or if your download method is set to private.

'), ); $directory = file_directory_path(); @@ -1393,7 +1404,7 @@ function system_file_system_settings() { '#title' => t('Download method'), '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using HTTP directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')), - '#description' => t('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.') + '#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.'), ); return system_settings_form($form); @@ -1412,7 +1423,7 @@ function system_image_toolkit_settings() '#type' => 'radios', '#title' => t('Select an image processing toolkit'), '#default_value' => variable_get('image_toolkit', image_get_toolkit()), - '#options' => $toolkits_available + '#options' => $toolkits_available, ); } elseif (count($toolkits_available) == 1) { @@ -1437,14 +1448,14 @@ function system_rss_feeds_settings() { '#title' => t('Number of items in each feed'), '#default_value' => variable_get('feed_default_items', 10), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), - '#description' => t('Default number of items to include in each feed.') + '#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'), '#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.') + '#description' => t('Global setting for the default display of content items in each feed.'), ); return system_settings_form($form); @@ -1466,15 +1477,18 @@ function system_date_time_settings() { // Date settings: possible date formats $date_short = array('Y-m-d H:i', 'm/d/Y - H:i', 'd/m/Y - H:i', 'Y/m/d - H:i', - 'd.m.Y - H:i', 'm/d/Y - g:ia', 'd/m/Y - g:ia', 'Y/m/d - g:ia', - 'M j Y - H:i', 'j M Y - H:i', 'Y M j - H:i', - 'M j Y - g:ia', 'j M Y - g:ia', 'Y M j - g:ia'); + 'd.m.Y - H:i', 'm/d/Y - g:ia', 'd/m/Y - g:ia', 'Y/m/d - g:ia', + 'M j Y - H:i', 'j M Y - H:i', 'Y M j - H:i', + 'M j Y - g:ia', 'j M Y - g:ia', 'Y M j - g:ia', + ); $date_medium = array('D, Y-m-d H:i', 'D, m/d/Y - H:i', 'D, d/m/Y - H:i', - 'D, Y/m/d - H:i', 'F j, Y - H:i', 'j F, Y - H:i', 'Y, F j - H:i', - 'D, m/d/Y - g:ia', 'D, d/m/Y - g:ia', 'D, Y/m/d - g:ia', - 'F j, Y - g:ia', 'j F Y - g:ia', 'Y, F j - g:ia', 'j. F Y - G:i'); + 'D, Y/m/d - H:i', 'F j, Y - H:i', 'j F, Y - H:i', 'Y, F j - H:i', + 'D, m/d/Y - g:ia', 'D, d/m/Y - g:ia', 'D, Y/m/d - g:ia', + 'F j, Y - g:ia', 'j F Y - g:ia', 'Y, F j - g:ia', 'j. F Y - G:i', + ); $date_long = array('l, F j, Y - H:i', 'l, j F, Y - H:i', 'l, Y, F j - H:i', - 'l, F j, Y - g:ia', 'l, j F Y - g:ia', 'l, Y, F j - g:ia', 'l, j. F Y - G:i'); + 'l, F j, Y - g:ia', 'l, j F Y - g:ia', 'l, Y, F j - g:ia', 'l, j. F Y - G:i', + ); // Date settings: construct choices for user foreach ($date_short as $f) { @@ -1499,7 +1513,7 @@ function system_date_time_settings() { '#title' => t('Default time zone'), '#default_value' => variable_get('date_default_timezone', 0), '#options' => $zones, - '#description' => t('Select the default site time zone.') + '#description' => t('Select the default site time zone.'), ); $form['locale']['configurable_timezones'] = array( @@ -1507,7 +1521,7 @@ function system_date_time_settings() { '#title' => t('User-configurable time zones'), '#default_value' => variable_get('configurable_timezones', 1), '#options' => array(t('Disabled'), t('Enabled')), - '#description' => t('When enabled, users can set their own time zone and dates will be displayed accordingly.') + '#description' => t('When enabled, users can set their own time zone and dates will be displayed accordingly.'), ); $form['locale']['date_first_day'] = array( @@ -1515,7 +1529,7 @@ function system_date_time_settings() { '#title' => t('First day of week'), '#default_value' => variable_get('date_first_day', 0), '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')), - '#description' => t('The first day of the week for calendar views.') + '#description' => t('The first day of the week for calendar views.'), ); $form['date_formats'] = array( @@ -1578,7 +1592,7 @@ function system_date_time_settings() { '#attributes' => array('class' => 'date-format'), '#default_value' => (isset($date_long_choices[$date_format_long]) ? $date_format_long : 'custom'), '#options' => $date_long_choices, - '#description' => t('Longer date format used for detailed display.') + '#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 : '')); @@ -1643,7 +1657,7 @@ function system_site_maintenance_setting '#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')))), - '#description' => t('Message to show visitors when the site is in off-line mode.') + '#description' => t('Message to show visitors when the site is in off-line mode.'), ); return system_settings_form($form); @@ -1735,6 +1749,7 @@ function system_php() { * The actual table data. * @param $keys * Data keys and descriptions. + * * @return * The output HTML. */ @@ -1761,33 +1776,33 @@ function system_sql() { $data[$entry->Variable_name] = $entry->Value; } - $output = '

'. t('Command counters') .'

'; + $output = '

'. t('Command counters') .'

'; $output .= _system_sql($data, array( - 'Com_select' => t('The number of SELECT-statements.'), - 'Com_insert' => t('The number of INSERT-statements.'), - 'Com_update' => t('The number of UPDATE-statements.'), - 'Com_delete' => t('The number of DELETE-statements.'), - 'Com_lock_tables' => t('The number of table locks.'), - 'Com_unlock_tables' => t('The number of table unlocks.') - )); + 'Com_select' => t('The number of SELECT-statements.'), + 'Com_insert' => t('The number of INSERT-statements.'), + 'Com_update' => t('The number of UPDATE-statements.'), + 'Com_delete' => t('The number of DELETE-statements.'), + 'Com_lock_tables' => t('The number of table locks.'), + 'Com_unlock_tables' => t('The number of table unlocks.'), + )); $output .= '

'. t('Query performance') .'

'; $output .= _system_sql($data, array( - 'Select_full_join' => t('The number of joins without an index; should be zero.'), - 'Select_range_check' => t('The number of joins without an index; should be zero.'), - 'Sort_scan' => t('The number of sorts done without using an index; should be zero.'), - 'Table_locks_immediate' => t('The number of times a lock could be acquired immediately.'), - 'Table_locks_waited' => t('The number of times the server had to wait for a lock.') - )); + 'Select_full_join' => t('The number of joins without an index; should be zero.'), + 'Select_range_check' => t('The number of joins without an index; should be zero.'), + 'Sort_scan' => t('The number of sorts done without using an index; should be zero.'), + 'Table_locks_immediate' => t('The number of times a lock could be acquired immediately.'), + 'Table_locks_waited' => t('The number of times the server had to wait for a lock.'), + )); $output .= '

'. t('Query cache information') .'

'; $output .= '

'. t('The MySQL query cache can improve performance of your site by storing the result of queries. Then, if an identical query is received later, the MySQL server retrieves the result from the query cache rather than parsing and executing the statement again.') .'

'; $output .= _system_sql($data, array( - 'Qcache_queries_in_cache' => t('The number of queries in the query cache.'), - 'Qcache_hits' => t('The number of times MySQL found previous results in the cache.'), - 'Qcache_inserts' => t('The number of times MySQL added a query to the cache (misses).'), - 'Qcache_lowmem_prunes' => t('The number of times MySQL had to remove queries from the cache because it ran out of memory. Ideally should be zero.') - )); + 'Qcache_queries_in_cache' => t('The number of queries in the query cache.'), + 'Qcache_hits' => t('The number of times MySQL found previous results in the cache.'), + 'Qcache_inserts' => t('The number of times MySQL added a query to the cache (misses).'), + 'Qcache_lowmem_prunes' => t('The number of times MySQL had to remove queries from the cache because it ran out of memory. Ideally should be zero.'), + )); return $output; } @@ -1927,11 +1942,11 @@ function theme_admin_page($blocks) { * @ingroup themeable */ function theme_system_admin_by_module($menu_items) { - $stripe = 0; - $output = ''; + $stripe = 0; + $output = ''; $container = array('left' => '', 'right' => ''); - $flip = array('left' => 'right', 'right' => 'left'); - $position = 'left'; + $flip = array('left' => 'right', 'right' => 'left'); + $position = 'left'; // Iterate over all modules foreach ($menu_items as $module => $block) { @@ -2072,8 +2087,8 @@ function theme_system_modules($form) { $row[] = ''. drupal_render($form['name'][$key]) .''; } - $row[] = drupal_render($form['version'][$key]); - $row[] = array('data' => $description, 'class' => 'description'); + $row[] = drupal_render($form['version'][$key]); + $row[] = array('data' => $description, 'class' => 'description'); $rows[] = $row; } $fieldset = array( @@ -2093,8 +2108,10 @@ function theme_system_modules($form) { * Themes a table of currently disabled modules. * * @ingroup themeable + * * @param $form * The form array representing the currently disabled modules. + * * @return * An HTML string representing the table. */ @@ -2125,7 +2142,7 @@ function theme_system_modules_uninstall( $rows[] = array(array('data' => t('No modules are available to uninstall.'), 'colspan' => '3', 'align' => 'center', 'class' => 'message')); } - $output = theme('table', $header, $rows); + $output = theme('table', $header, $rows); $output .= drupal_render($form); return $output; @@ -2133,6 +2150,7 @@ function theme_system_modules_uninstall( /** * Theme the theme select form. + * * @param $form * An associative array containing the structure of the form. * @ingroup themeable @@ -2194,7 +2212,7 @@ function theme_system_themes_form($form) $theme = '

'. $info['name'] .'

'. $description .'
'; // Build rows - $row = array(); + $row = array(); $row[] = drupal_render($form[$key]['screenshot']); $row[] = $theme; $row[] = isset($info['version']) ? $info['version'] : ''; @@ -2211,3 +2229,4 @@ function theme_system_themes_form($form) $output .= drupal_render($form); return $output; } + Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.231 diff -u -p -r1.231 system.install --- modules/system/system.install 16 Jan 2008 21:45:30 -0000 1.231 +++ modules/system/system.install 20 Jan 2008 06:08:07 -0000 @@ -1,11 +1,13 @@ $t('Not protected'), @@ -193,7 +195,8 @@ function system_requirements($phase) { // For installer, create the directory if possible. if ($phase == 'install' && !is_dir($directory) && @mkdir($directory)) { - @chmod($directory, 0775); // Necessary for non-webserver users. + // Necessary for non-webserver users. + @chmod($directory, 0775); } $is_writable = is_writable($directory); @@ -389,7 +392,6 @@ function system_install() { db_query("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('%s', '%s', %d)", 'Full HTML', '', 1); // Enable filters for each input format. - // Filtered HTML: // URL filter. db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 2, 0); @@ -428,15 +430,17 @@ function system_schema() { 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'value' => array( 'description' => t('The value of the variable.'), 'type' => 'text', 'not null' => TRUE, - 'size' => 'big'), + 'size' => 'big', ), + ), 'primary key' => array('name'), - ); + ); $schema['actions'] = array( 'description' => t('Stores action information.'), @@ -446,33 +450,38 @@ function system_schema() { 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => '0'), + 'default' => '0', + ), 'type' => array( 'description' => t('The object that that action acts on (node, user, comment, system or custom types.)'), 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'callback' => array( 'description' => t('The callback function that executes when the action runs.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'parameters' => array( 'description' => t('Parameters to be passed to the callback function.'), 'type' => 'text', 'not null' => TRUE, - 'size' => 'big'), + 'size' => 'big', + ), 'description' => array( 'description' => t('Description of the action.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => '0'), + 'default' => '0', ), + ), 'primary key' => array('aid'), - ); + ); $schema['actions_aid'] = array( 'description' => t('Stores action IDs for non-default actions.'), @@ -481,10 +490,11 @@ function system_schema() { 'description' => t('Primary Key: Unique actions ID.'), 'type' => 'serial', 'unsigned' => TRUE, - 'not null' => TRUE), + 'not null' => TRUE, ), + ), 'primary key' => array('aid'), - ); + ); $schema['batch'] = array( 'description' => t('Stores details about batches (processes that run in multiple HTTP requests).'), @@ -493,25 +503,29 @@ function system_schema() { 'description' => t('Primary Key: Unique batch ID.'), 'type' => 'serial', 'unsigned' => TRUE, - 'not null' => TRUE), + 'not null' => TRUE, + ), 'token' => array( 'description' => t("A string token generated against the current user's session id and the batch id, used to ensure that only the user who submitted the batch can effectively access it."), 'type' => 'varchar', 'length' => 64, - 'not null' => TRUE), + 'not null' => TRUE, + ), 'timestamp' => array( 'description' => t('A Unix timestamp indicating when this batch was submitted for processing. Stale batches are purged at cron time.'), 'type' => 'int', - 'not null' => TRUE), + 'not null' => TRUE, + ), 'batch' => array( 'description' => t('A serialized array containing the processing data for the batch.'), 'type' => 'text', 'not null' => FALSE, - 'size' => 'big') + 'size' => 'big', ), + ), 'primary key' => array('bid'), 'indexes' => array('token' => array('token')), - ); + ); $schema['cache'] = array( 'description' => t('Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.'), @@ -521,36 +535,42 @@ function system_schema() { 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'data' => array( 'description' => t('A collection of data to cache.'), 'type' => 'blob', 'not null' => FALSE, - 'size' => 'big'), + 'size' => 'big', + ), 'expire' => array( 'description' => t('A Unix timestamp indicating when the cache entry should expire, or 0 for never.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'created' => array( 'description' => t('A Unix timestamp indicating when the cache entry was created.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'headers' => array( 'description' => t('Any custom HTTP headers to be added to cached data.'), 'type' => 'text', - 'not null' => FALSE), + 'not null' => FALSE, + ), 'serialized' => array( 'description' => t('A flag to indicate whether content is serialized (1) or not (0).'), 'type' => 'int', 'size' => 'small', 'not null' => TRUE, - 'default' => 0) + 'default' => 0, ), + ), 'indexes' => array('expire' => array('expire')), 'primary key' => array('cid'), - ); + ); $schema['cache_form'] = $schema['cache']; $schema['cache_form']['description'] = t('Cache table for the form system to store recently built forms and their storage data, to be used in subsequent page requests.'); @@ -566,56 +586,64 @@ function system_schema() { 'description' => t('Primary Key: Unique files ID.'), 'type' => 'serial', 'unsigned' => TRUE, - 'not null' => TRUE), + 'not null' => TRUE, + ), 'uid' => array( 'description' => t('The {users}.uid of the user who is associated with the file.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'filename' => array( 'description' => t('Name of the file.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'filepath' => array( 'description' => t('Path of the file relative to Drupal root.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'filemime' => array( 'description' => t('The file MIME type.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'filesize' => array( 'description' => t('The size of the file in bytes.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'status' => array( 'description' => t('A flag indicating whether file is temporary (1) or permanent (0).'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'timestamp' => array( 'description' => t('UNIX timestamp for when the file was added.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, ), + ), 'indexes' => array( 'uid' => array('uid'), 'status' => array('status'), 'timestamp' => array('timestamp'), - ), + ), 'primary key' => array('fid'), - ); + ); $schema['flood'] = array( 'description' => t('Flood controls the threshold of events, such as the number of contact attempts.'), @@ -623,30 +651,34 @@ function system_schema() { 'fid' => array( 'description' => t('Unique flood event ID.'), 'type' => 'serial', - 'not null' => TRUE), + 'not null' => TRUE, + ), 'event' => array( 'description' => t('Name of event (e.g. contact).'), 'type' => 'varchar', 'length' => 64, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'hostname' => array( 'description' => t('Hostname of the visitor.'), 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'timestamp' => array( 'description' => t('Timestamp of the event.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0) + 'default' => 0, ), + ), 'primary key' => array('fid'), 'indexes' => array( 'allow' => array('event', 'hostname', 'timestamp'), ), - ); + ); $schema['history'] = array( 'description' => t('A record of which {users} have read which {node}s.'), @@ -655,23 +687,26 @@ function system_schema() { 'description' => t('The {users}.uid that read the {node} nid.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'nid' => array( 'description' => t('The {node}.nid that was read.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'timestamp' => array( 'description' => t('The Unix timestamp at which the read occurred.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0) + 'default' => 0, ), + ), 'primary key' => array('uid', 'nid'), 'indexes' => array( 'nid' => array('nid'), ), - ); + ); $schema['menu_router'] = array( 'description' => t('Maps paths to various callbacks (access, page and title)'), 'fields' => array( @@ -680,278 +715,325 @@ function system_schema() { 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'load_functions' => array( 'description' => t('A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'to_arg_functions' => array( 'description' => t('A serialized array of function names (like user_current_to_arg) to be called to replace a part of the router path with another string.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'access_callback' => array( 'description' => t('The callback which determines the access to this router path. Defaults to user_access.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'access_arguments' => array( 'description' => t('A serialized array of arguments for the access callback.'), 'type' => 'text', - 'not null' => FALSE), + 'not null' => FALSE, + ), 'page_callback' => array( 'description' => t('The name of the function that renders the page.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'page_arguments' => array( 'description' => t('A serialized array of arguments for the page callback.'), 'type' => 'text', - 'not null' => FALSE), + 'not null' => FALSE, + ), 'fit' => array( 'description' => t('A numeric representation of how specific the path is.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'number_parts' => array( 'description' => t('Number of parts in this router path.'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'small'), + 'size' => 'small', + ), 'tab_parent' => array( 'description' => t('Only for local tasks (tabs) - the router path of the parent page (which may also be a local task).'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'tab_root' => array( 'description' => t('Router path of the closest non-tab parent page. For pages that are not local tasks, this will be the same as the path.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'title' => array( 'description' => t('The title for the current page, or the title for the tab if this is a local task.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'title_callback' => array( 'description' => t('A function which will alter the title. Defaults to t()'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'title_arguments' => array( 'description' => t('A serialized array of arguments for the title callback. If empty, the title will be used as the sole argument for the title callback.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'type' => array( 'description' => t('Numeric representation of the type of the menu item, like MENU_LOCAL_TASK.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'block_callback' => array( 'description' => t('Name of a function used to render the block on the system administration page for this item.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'description' => array( 'description' => t('A description of this item.'), 'type' => 'text', - 'not null' => TRUE), + 'not null' => TRUE, + ), 'position' => array( 'description' => t('The position of the block (left or right) on the system administration page for this item.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'weight' => array( 'description' => t('Weight of the element. Lighter weights are higher up, heavier weights go down.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'file' => array( 'description' => t('The file to include for this element, usually the page callback function lives in this file.'), 'type' => 'text', - 'size' => 'medium') + 'size' => 'medium', ), + ), 'indexes' => array( 'fit' => array('fit'), - 'tab_parent' => array('tab_parent') - ), + 'tab_parent' => array('tab_parent'), + ), 'primary key' => array('path'), - ); + ); $schema['menu_links'] = array( 'description' => t('Contains the individual links within a menu.'), 'fields' => array( - 'menu_name' => array( + 'menu_name' => array( 'description' => t("The menu name. All links with the same menu name (such as 'navigation') are part of the same menu."), 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'mlid' => array( 'description' => t('The menu link ID (mlid) is the integer primary key.'), 'type' => 'serial', 'unsigned' => TRUE, - 'not null' => TRUE), + 'not null' => TRUE, + ), 'plid' => array( 'description' => t('The parent link ID (plid) is the mlid of the link above in the hierarchy, or zero if the link is at the top level in its menu.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'link_path' => array( 'description' => t('The Drupal path or external path this link points to.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'router_path' => array( 'description' => t('For links corresponding to a Drupal path (external = 0), this connects the link to a {menu_router}.path for joins.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'link_title' => array( - 'description' => t('The text displayed for the link, which may be modified by a title callback stored in {menu_router}.'), + 'description' => t('The text displayed for the link, which may be modified by a title callback stored in {menu_router}.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'options' => array( 'description' => t('A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.'), 'type' => 'text', - 'not null' => FALSE), + 'not null' => FALSE, + ), 'module' => array( 'description' => t('The name of the module that generated this link.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => 'system'), + 'default' => 'system', + ), 'hidden' => array( 'description' => t('A flag for whether the link should be rendered in menus. (1 = a disabled menu item that may be shown on admin screens, -1 = a menu callback, 0 = a normal, visible link)'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'small'), + 'size' => 'small', + ), 'external' => array( 'description' => t('A flag to indicate if the link points to a full URL starting with a protocol, like http:// (1 = external, 0 = internal).'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'small'), + 'size' => 'small', + ), 'has_children' => array( 'description' => t('Flag indicating whether any links have this link as a parent (1 = children exist, 0 = no children).'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'small'), + 'size' => 'small', + ), 'expanded' => array( 'description' => t('Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded)'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'small'), + 'size' => 'small', + ), 'weight' => array( 'description' => t('Link weight among links in the same menu at the same depth.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'depth' => array( 'description' => t('The depth relative to the top level. A link with plid == 0 will have depth == 1.'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'small'), + 'size' => 'small', + ), 'customized' => array( 'description' => t('A flag to indicate that the user has manually created or edited the link (1 = customized, 0 = not customized).'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'small'), + 'size' => 'small', + ), 'p1' => array( 'description' => t('The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the plid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'p2' => array( 'description' => t('The second mlid in the materialized path. See p1.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'p3' => array( 'description' => t('The third mlid in the materialized path. See p1.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'p4' => array( 'description' => t('The fourth mlid in the materialized path. See p1.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'p5' => array( 'description' => t('The fifth mlid in the materialized path. See p1.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'p6' => array( 'description' => t('The sixth mlid in the materialized path. See p1.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'p7' => array( 'description' => t('The seventh mlid in the materialized path. See p1.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'p8' => array( 'description' => t('The eighth mlid in the materialized path. See p1.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'p9' => array( 'description' => t('The ninth mlid in the materialized path. See p1.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'updated' => array( 'description' => t('Flag that indicates that this link was generated during the update from Drupal 5.'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'small'), + 'size' => 'small', ), + ), 'indexes' => array( 'path_menu' => array(array('link_path', 128), 'menu_name'), 'menu_plid_expand_child' => array( - 'menu_name', 'plid', 'expanded', 'has_children'), + 'menu_name', 'plid', 'expanded', 'has_children', + ), 'menu_parents' => array( - 'menu_name', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'), - 'router_path' => array(array('router_path', 128)), + 'menu_name', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9', ), + 'router_path' => array(array('router_path', 128)), + ), 'primary key' => array('mlid'), - ); + ); $schema['sessions'] = array( 'description' => t("Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated."), @@ -960,41 +1042,47 @@ function system_schema() { 'description' => t('The {users}.uid corresponding to a session, or 0 for anonymous user.'), 'type' => 'int', 'unsigned' => TRUE, - 'not null' => TRUE), + 'not null' => TRUE, + ), 'sid' => array( 'description' => t("Primary key: A session ID. The value is generated by PHP's Session API."), 'type' => 'varchar', 'length' => 64, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'hostname' => array( 'description' => t('The IP address that last used this session ID (sid).'), 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'timestamp' => array( 'description' => t('The Unix timestamp when this session last requested a page. Old records are purged by PHP automatically.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'cache' => array( 'description' => t("The time of this user's last post. This is used when the site has specified a minimum_cache_lifetime. See cache_get()."), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'session' => array( 'description' => t('The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.'), 'type' => 'text', 'not null' => FALSE, - 'size' => 'big') + 'size' => 'big', ), + ), 'primary key' => array('sid'), 'indexes' => array( 'timestamp' => array('timestamp'), - 'uid' => array('uid') - ), - ); + 'uid' => array('uid'), + ), + ); $schema['system'] = array( 'description' => t("A list of all modules, themes, and theme engines that are or have been installed in Drupal's file system."), @@ -1004,64 +1092,74 @@ function system_schema() { 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'name' => array( 'description' => t('The name of the item; e.g. node.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'type' => array( 'description' => t('The type of the item, either module, theme, or theme_engine.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'owner' => array( 'description' => t("A theme's 'parent'. Can be either a theme or an engine."), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'status' => array( 'description' => t('Boolean indicating whether or not this item is enabled.'), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'throttle' => array( 'description' => t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, - 'size' => 'tiny'), + 'size' => 'tiny', + ), 'bootstrap' => array( 'description' => t("Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted)."), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'schema_version' => array( 'description' => t("The module's database schema version number. -1 if the module is not installed (its tables do not exist); 0 or the largest N of the module's hook_update_N() function that has either been run or existed when the module was first installed."), 'type' => 'int', 'not null' => TRUE, 'default' => -1, - 'size' => 'small'), + 'size' => 'small', + ), 'weight' => array( 'description' => t("The order in which this module's hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name."), 'type' => 'int', 'not null' => TRUE, - 'default' => 0), + 'default' => 0, + ), 'info' => array( 'description' => t("A serialized array containing information from the module's .info file; keys can include name, description, package, version, core, dependencies, dependents, and php."), 'type' => 'text', - 'not null' => FALSE) + 'not null' => FALSE, ), + ), 'primary key' => array('filename'), 'indexes' => - array( - 'modules' => array(array('type', 12), 'status', 'weight', 'filename'), - 'bootstrap' => array(array('type', 12), 'status', 'bootstrap', 'weight', 'filename'), - ), - ); + array( + 'modules' => array(array('type', 12), 'status', 'weight', 'filename'), + 'bootstrap' => array(array('type', 12), 'status', 'bootstrap', 'weight', 'filename'), + ), + ); $schema['url_alias'] = array( 'description' => t('A list of URL aliases for Drupal paths; a user may visit either the source or destination path.'), @@ -1070,36 +1168,39 @@ function system_schema() { 'description' => t('A unique path alias identifier.'), 'type' => 'serial', 'unsigned' => TRUE, - 'not null' => TRUE), + 'not null' => TRUE, + ), 'src' => array( 'description' => t('The Drupal path this alias is for; e.g. node/12.'), 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'dst' => array( 'description' => t('The alias for this path; e.g. title-of-the-story.'), 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, - 'default' => ''), + 'default' => '', + ), 'language' => array( 'description' => t('The language this alias is for; if blank, the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.'), 'type' => 'varchar', 'length' => 12, 'not null' => TRUE, - 'default' => '') + 'default' => '', ), + ), 'unique keys' => array('dst_language' => array('dst', 'language')), 'primary key' => array('pid'), 'indexes' => array('src' => array('src')), - ); + ); return $schema; } // Updates for core. - function system_update_last_removed() { return 1021; } @@ -1138,7 +1239,7 @@ function system_update_6000() { switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': - $max = (int)db_result(db_query('SELECT MAX(bid) FROM {boxes}')); + $max = (int)db_result(db_query('SELECT MAX(bid) FROM {boxes}')); $ret[] = update_sql('ALTER TABLE {boxes} CHANGE COLUMN bid bid int NOT NULL'); $ret[] = update_sql("REPLACE INTO {sequences} VALUES ('{boxes}_bid', $max)"); break; @@ -1222,19 +1323,20 @@ function system_update_6005() { $err = error_reporting(0); $ret1 = update_sql('DROP INDEX {url_alias}_dst_idx'); if ($ret1['success']) { - $ret[] = $ret1; + $ret[] = $ret1; } $ret1 = array(); db_drop_unique_key($ret, 'url_alias', 'dst'); foreach ($ret1 as $r) { - if ($r['success']) { - $ret[] = $r; - } + if ($r['success']) { + $ret[] = $r; + } } error_reporting($err); $ret[] = update_sql('CREATE UNIQUE INDEX {url_alias}_dst_language_idx ON {url_alias}(dst, language)'); break; + case 'mysql': case 'mysqli': $ret[] = update_sql("ALTER TABLE {url_alias} ADD language varchar(12) NOT NULL default ''"); @@ -1256,6 +1358,7 @@ function system_update_6006() { $ret[] = update_sql('DROP INDEX {node_counter}_totalcount_idx'); $ret[] = update_sql('DROP INDEX {node_counter}_timestamp_idx'); break; + case 'mysql': case 'mysqli': $ret[] = update_sql("ALTER TABLE {node_counter} DROP INDEX daycount"); @@ -1270,7 +1373,7 @@ function system_update_6006() { * Change the severity column in the watchdog table to the new values. */ function system_update_6007() { - $ret = array(); + $ret = array(); $ret[] = update_sql("UPDATE {watchdog} SET severity = ". WATCHDOG_NOTICE ." WHERE severity = 0"); $ret[] = update_sql("UPDATE {watchdog} SET severity = ". WATCHDOG_WARNING ." WHERE severity = 1"); $ret[] = update_sql("UPDATE {watchdog} SET severity = ". WATCHDOG_ERROR ." WHERE severity = 2"); @@ -1340,6 +1443,7 @@ function system_update_6011() { case 'pgsql': db_add_column($ret, 'node', 'language', 'varchar(12)', array('default' => "''", 'not null' => TRUE)); break; + case 'mysql': case 'mysqli': $ret[] = update_sql("ALTER TABLE {node} ADD language varchar(12) NOT NULL default ''"); @@ -1396,6 +1500,7 @@ function system_update_6015() { )"); $ret[] = update_sql("CREATE INDEX {cache_form}_expire_idx ON {cache_form} (expire)"); break; + case 'mysql': case 'mysqli': $ret[] = update_sql("CREATE TABLE {cache_form} ( @@ -1437,6 +1542,7 @@ function system_update_6016() { db_add_column($ret, 'term_synonym', 'tsid', 'serial'); $ret[] = update_sql("ALTER TABLE {term_synonym} ADD PRIMARY KEY (tsid)"); break; + case 'mysql': case 'mysqli': $ret[] = update_sql('ALTER TABLE {node} ADD UNIQUE KEY nid_vid (nid, vid)'); @@ -1459,10 +1565,10 @@ function system_update_6017() { $ret = array(); // Maps old names to new ones. $var_names = array( - 'admin' => 'register_admin_created', + 'admin' => 'register_admin_created', 'approval' => 'register_pending_approval', - 'welcome' => 'register_no_approval_required', - 'pass' => 'password_reset', + 'welcome' => 'register_no_approval_required', + 'pass' => 'password_reset', ); foreach ($var_names as $old => $new) { foreach (array('_subject', '_body') as $suffix) { @@ -1558,7 +1664,8 @@ function system_update_6019() { if (db_table_exists('url_alias')) { db_drop_index($ret, 'url_alias', 'dst_language'); db_add_unique_key($ret, 'url_alias', 'dst_language', - array('dst', 'language')); + array('dst', 'language') + ); } // Fix term_node pkey: mysql and pgsql code had different orders. @@ -1574,7 +1681,6 @@ function system_update_6019() { // Fix primary key db_drop_primary_key($ret, 'node'); db_add_primary_key($ret, 'node', array('nid')); - break; case 'mysql': @@ -1619,7 +1725,6 @@ function system_update_6019() { db_drop_primary_key($ret, $table); db_change_field($ret, $table, $field, $field, array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array($field))); } - break; } @@ -1634,67 +1739,67 @@ function system_update_6020() { $schema['menu_router'] = array( 'fields' => array( - 'path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'load_functions' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'load_functions' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'to_arg_functions' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'access_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'access_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'access_arguments' => array('type' => 'text', 'not null' => FALSE), - 'page_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'page_arguments' => array('type' => 'text', 'not null' => FALSE), - 'fit' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'number_parts' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), - 'tab_parent' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'tab_root' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'title_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'title_arguments' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'type' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'block_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'description' => array('type' => 'text', 'not null' => TRUE), - 'position' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'file' => array('type' => 'text', 'size' => 'medium') + 'page_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'page_arguments' => array('type' => 'text', 'not null' => FALSE), + 'fit' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'number_parts' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), + 'tab_parent' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'tab_root' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'title_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'title_arguments' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'type' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'block_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'description' => array('type' => 'text', 'not null' => TRUE), + 'position' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'file' => array('type' => 'text', 'size' => 'medium'), ), 'indexes' => array( - 'fit' => array('fit'), - 'tab_parent' => array('tab_parent') + 'fit' => array('fit'), + 'tab_parent' => array('tab_parent'), ), 'primary key' => array('path'), ); $schema['menu_links'] = array( 'fields' => array( - 'menu_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), - 'mlid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), - 'plid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'link_path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'router_path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'link_title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'options' => array('type' => 'text', 'not null' => FALSE), - 'module' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'system'), - 'hidden' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), - 'external' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), + 'menu_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), + 'mlid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), + 'plid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'link_path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'router_path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'link_title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'options' => array('type' => 'text', 'not null' => FALSE), + 'module' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'system'), + 'hidden' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), + 'external' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), 'has_children' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), - 'expanded' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), - 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'depth' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), - 'customized' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), - 'p1' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'p2' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'p3' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'p4' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'p5' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'p6' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'p7' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'p8' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'p9' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'updated' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), + 'expanded' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), + 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'depth' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), + 'customized' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), + 'p1' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'p2' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'p3' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'p4' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'p5' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'p6' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'p7' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'p8' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'p9' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'updated' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'), ), 'indexes' => array( - 'path_menu' => array(array('link_path', 128), 'menu_name'), + 'path_menu' => array(array('link_path', 128), 'menu_name'), 'menu_plid_expand_child' => array('menu_name', 'plid', 'expanded', 'has_children'), - 'menu_parents' => array('menu_name', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'), - 'router_path' => array(array('router_path', 128)), + 'menu_parents' => array('menu_name', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'), + 'router_path' => array(array('router_path', 128)), ), 'primary key' => array('mlid'), ); @@ -1730,8 +1835,8 @@ function system_update_6021() { } $table = array( 'fields' => array( - 'menu_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), - 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'menu_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), + 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'description' => array('type' => 'text', 'not null' => FALSE), ), 'primary key' => array('menu_name'), @@ -1757,7 +1862,7 @@ function system_update_6021() { // Save user-defined titles. foreach (array($primary, $secondary) as $mid) { if ($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid))) { - $menus[$_SESSION['menu_menu_map'][$mid]]['title'] = $item['title']; + $menus[$_SESSION['menu_menu_map'][$mid]]['title'] = $item['title']; } } foreach ($menus as $menu) { @@ -1821,10 +1926,10 @@ function system_update_6021() { $_SESSION['menu_item_map'][$item['mid']] = array('mlid' => $item['mlid'], 'menu_name' => $item['menu_name']); } elseif (!isset($_SESSION['menu_menu_map'][$item['mid']])) { - $item['menu_name'] = 'menu-'. preg_replace('/[^a-zA-Z0-9]/', '-', strtolower($item['title'])); - $item['menu_name'] = substr($item['menu_name'], 0, 20); + $item['menu_name'] = 'menu-'. preg_replace('/[^a-zA-Z0-9]/', '-', strtolower($item['title'])); + $item['menu_name'] = substr($item['menu_name'], 0, 20); $original_menu_name = $item['menu_name']; - $i = 0; + $i = 0; while (db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = '%s'", $item['menu_name']))) { $item['menu_name'] = $original_menu_name . ($i++); } @@ -1978,7 +2083,6 @@ function system_update_6027() { // The cache_block table is created in update_fix_d6_requirements() since // calls to cache_clear_all() would otherwise cause warnings. - // Fill in the values for the new 'cache' column in the {blocks} table. foreach (module_list() as $module) { if ($module_blocks = module_invoke($module, 'block', 'list')) { @@ -2159,10 +2263,10 @@ function system_update_6036() { // Create the search_node_links Table. $search_node_links_schema = array( 'fields' => array( - 'sid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'type' => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''), - 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), - 'caption' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE), + 'sid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'type' => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''), + 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'caption' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE), ), 'primary key' => array('sid', 'type', 'nid'), 'indexes' => array('nid' => array('nid')), @@ -2262,10 +2366,10 @@ 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', '')); + $ret = array(); + $vid = intval(variable_get('forum_nav_vocabulary', '')); if (db_table_exists('vocabulary') && $vid) { - $ret[] = update_sql("UPDATE {vocabulary} SET required = 0 WHERE vid = " . $vid); + $ret[] = update_sql("UPDATE {vocabulary} SET required = 0 WHERE vid = ". $vid); $ret[] = update_sql("UPDATE {system} SET weight = ". $weight ." WHERE name = 'forum'"); } return $ret; @@ -2296,9 +2400,12 @@ function system_update_6043() { db_add_index($ret, 'history', 'nid', array('nid')); // Change length of theme field in {blocks} to be consistent with module, and // to avoid a MySQL error regarding a too-long index. Also add new indices. - db_change_field($ret, 'blocks', 'theme', 'theme', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''),array( - 'unique keys' => array('tmd' => array('theme', 'module', 'delta'),), - 'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'),),)); + db_change_field($ret, 'blocks', 'theme', 'theme', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''), array( + 'unique keys' => array('tmd' => array('theme', 'module', 'delta'), + ), + 'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'), + ), + )); db_add_index($ret, 'blocks_roles', 'rid', array('rid')); // Improve filter module indices. db_drop_index($ret, 'filters', 'weight'); @@ -2340,8 +2447,11 @@ function system_update_6043() { if (db_table_exists('profile_values')) { db_drop_index($ret, 'profile_values', 'uid'); db_drop_index($ret, 'profile_values', 'fid'); - db_change_field($ret,'profile_values' ,'fid', 'fid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,), array('indexes' => array('fid' => array('fid'),))); - db_change_field($ret,'profile_values' ,'uid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,)); + db_change_field($ret, 'profile_values', 'fid', 'fid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, + ), array('indexes' => array('fid' => array('fid'), + ))); + db_change_field($ret, 'profile_values', 'uid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, + )); db_add_primary_key($ret, 'profile_values', array('uid', 'fid')); } // Alter a statistics module table to add an index. @@ -2452,3 +2562,4 @@ function system_update_6045() { * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. */ + Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.578 diff -u -p -r1.578 system.module --- modules/system/system.module 10 Jan 2008 23:14:58 -0000 1.578 +++ modules/system/system.module 20 Jan 2008 06:08:08 -0000 @@ -1,6 +1,7 @@ '. t('basic configuration options for your site, including date and time settings, file system settings, clean URL support, site name and other information, and a site maintenance function for taking your site temporarily off-line.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) .''; $output .= '

'. t('For more information, see the online handbook entry for System module.', array('@system' => 'http://drupal.org/handbook/modules/system/')) .'

'; return $output; + case 'admin': return '

'. t('Welcome to the administration section. Here you may control how your site functions.') .'

'; + case 'admin/by-module': return '

'. t('This page shows you all available administration tasks for each module.') .'

'; + case 'admin/build/themes': $output = '

'. t('Select which themes are available to your users and specify the default theme. To configure site-wide display settings, click the "configure" task above. Alternatively, to override these settings in a specific theme, click the "configure" link for that theme. Note that different themes may have different regions available for displaying content; for consistency in presentation, you may wish to enable only one theme.') .'

'; $output .= '

'. t('To change the appearance of your site, a number of contributed themes are available.', array('@themes' => 'http://drupal.org/project/themes')) .'

'; return $output; + case 'admin/build/themes/settings/'. $arg[4]: $reference = explode('.', $arg[4], 2); $theme = array_pop($reference); return '

'. t('These options control the display settings for the %template theme. When your site is displayed using this theme, these settings will be used. By clicking "Reset to defaults," you can choose to use the global settings for this theme.', array('%template' => $theme, '@global' => url('admin/build/themes/settings'))) .'

'; + case 'admin/build/themes/settings': return '

'. t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') .'

'; + case 'admin/build/modules': $output = '

'. t('Modules are plugins that extend Drupal\'s core functionality. Enable modules by selecting the Enabled checkboxes below and clicking the Save configuration button. Once a module is enabled, new permissions may be available. To reduce server load, modules with their Throttle checkbox selected are temporarily disabled when your site becomes extremely busy. (Note that the Throttle checkbox is only available if the Throttle module is enabled.)', array('@permissions' => url('admin/user/permissions'))); if (module_exists('throttle')) { @@ -87,13 +94,16 @@ function system_help($path, $arg) { $output .= '

'. t('You can find all administration tasks belonging to a particular module on the administration by module page.', array('@by-module' => url('admin/by-module'))) .'

'; $output .= '

'. t('To extend the functionality of your site, a number of contributed modules are available.', array('@modules' => 'http://drupal.org/project/modules')) .'

'; return $output; + case 'admin/build/modules/uninstall': return '

'. t('The uninstall process removes all data related to a module. To uninstall a module, you must first disable it. Not all modules support this feature.') .'

'; + case 'admin/build/block/configure': if ($arg[4] == 'system' && $arg[5] == 0) { return '

'. t('The Powered by Drupal block is an optional link to the home page of the Drupal project. While there is absolutely no requirement that sites feature this link, it may be used to show support for Drupal.') .'

'; } break; + case 'admin/settings/actions': case 'admin/settings/actions/manage': $output = '

'. t('Actions are individual tasks that the system can do, such as unpublishing a piece of content or banning a user. Modules, such as the trigger module, can fire these actions when certain system events happen; for example, when a new post is added or when a user logs in. Modules may also provide additional actions.') .'

'; @@ -102,8 +112,10 @@ function system_help($path, $arg) { $output .= '

'. t('You may proceed to the Triggers page to assign these actions to system events.', array('@url' => url('admin/build/trigger'))) .'

'; } return $output; + case 'admin/settings/actions/configure': return t('An advanced action offers additional configuration options which may be filled out below. Changing the Description field is recommended, in order to better identify the precise action taking place. This description will be displayed in modules such as the trigger module when assigning actions to system events, so it is best if it is as descriptive as possible (for example, "Send e-mail to Moderation Team" rather than simply "Send e-mail").'); + case 'admin/reports/status': return '

'. t("Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on drupal.org's support forums and project issue queues.") .'

'; } @@ -114,46 +126,46 @@ function system_help($path, $arg) { */ function system_theme() { return array_merge(drupal_common_theme(), array( - 'system_theme_select_form' => array( - 'arguments' => array('form' => NULL), - 'file' => 'system.admin.inc', - ), - 'system_themes_form' => array( - 'arguments' => array('form' => NULL), - 'file' => 'system.admin.inc', - ), - 'system_modules' => array( - 'arguments' => array('form' => NULL), - 'file' => 'system.admin.inc', - ), - 'system_modules_uninstall' => array( - 'arguments' => array('form' => NULL), - 'file' => 'system.admin.inc', - ), - 'status_report' => array( - 'arguments' => array('requirements' => NULL), - 'file' => 'system.admin.inc', - ), - 'admin_page' => array( - 'arguments' => array('blocks' => NULL), - 'file' => 'system.admin.inc', - ), - 'admin_block' => array( - 'arguments' => array('block' => NULL), - 'file' => 'system.admin.inc', - ), - 'admin_block_content' => array( - 'arguments' => array('content' => NULL), - 'file' => 'system.admin.inc', - ), - 'system_admin_by_module' => array( - 'arguments' => array('menu_items' => NULL), - 'file' => 'system.admin.inc', - ), - 'system_powered_by' => array( - 'arguments' => array('image_path' => NULL), - ), - )); + 'system_theme_select_form' => array( + 'arguments' => array('form' => NULL), + 'file' => 'system.admin.inc', + ), + 'system_themes_form' => array( + 'arguments' => array('form' => NULL), + 'file' => 'system.admin.inc', + ), + 'system_modules' => array( + 'arguments' => array('form' => NULL), + 'file' => 'system.admin.inc', + ), + 'system_modules_uninstall' => array( + 'arguments' => array('form' => NULL), + 'file' => 'system.admin.inc', + ), + 'status_report' => array( + 'arguments' => array('requirements' => NULL), + 'file' => 'system.admin.inc', + ), + 'admin_page' => array( + 'arguments' => array('blocks' => NULL), + 'file' => 'system.admin.inc', + ), + 'admin_block' => array( + 'arguments' => array('block' => NULL), + 'file' => 'system.admin.inc', + ), + 'admin_block_content' => array( + 'arguments' => array('content' => NULL), + 'file' => 'system.admin.inc', + ), + 'system_admin_by_module' => array( + 'arguments' => array('menu_items' => NULL), + 'file' => 'system.admin.inc', + ), + 'system_powered_by' => array( + 'arguments' => array('image_path' => NULL), + ), + )); } /** @@ -188,12 +200,12 @@ function system_elements() { $type['file'] = array('#input' => TRUE, '#size' => 60); // Form structure - $type['item'] = array('#value' => ''); - $type['hidden'] = array('#input' => TRUE, '#process' => array('form_expand_ahah')); - $type['value'] = array('#input' => TRUE); - $type['markup'] = array('#prefix' => '', '#suffix' => ''); + $type['item'] = array('#value' => ''); + $type['hidden'] = array('#input' => TRUE, '#process' => array('form_expand_ahah')); + $type['value'] = array('#input' => TRUE); + $type['markup'] = array('#prefix' => '', '#suffix' => ''); $type['fieldset'] = array('#collapsible' => FALSE, '#collapsed' => FALSE, '#value' => NULL, '#process' => array('form_expand_ahah')); - $type['token'] = array('#input' => TRUE); + $type['token'] = array('#input' => TRUE); return $type; } @@ -338,7 +350,7 @@ function system_menu() { 'title' => 'Actions', 'description' => 'Manage the actions defined for your site.', 'access arguments' => array('administer actions'), - 'page callback' => 'system_actions_manage' + 'page callback' => 'system_actions_manage', ); $items['admin/settings/actions/manage'] = array( 'title' => 'Manage actions', @@ -582,6 +594,7 @@ function system_block($op = 'list', $del 'weight' => '10', ); return $blocks; + case 'configure': // Compile a list of fields to show $form['wrapper']['color'] = array( @@ -597,13 +610,16 @@ function system_block($op = 'list', $del '#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']); break; + case 'view': $image_path = 'misc/'. variable_get('drupal_badge_color', 'powered-blue') .'-'. variable_get('drupal_badge_size', '80x15') .'.png'; - $block['subject'] = NULL; // Don't display a title + // Don't display a title + $block['subject'] = NULL; $block['content'] = theme('system_powered_by', $image_path); return $block; } @@ -665,6 +681,7 @@ function system_admin_theme_submit($form * default value of theme radios * @param $weight * weight of the fieldset + * * @return * a form array */ @@ -687,15 +704,15 @@ function system_theme_select_form($descr '#title' => t('Theme configuration'), '#description' => $description, '#collapsible' => TRUE, - '#theme' => 'system_theme_select_form' + '#theme' => 'system_theme_select_form', ); foreach ($enabled as $info) { // For the default theme, revert to an empty string so the user's theme updates when the site theme is changed. - $info->key = $info->name == variable_get('theme_default', 'garland') ? '' : $info->name; + $info->key = $info->name == variable_get('theme_default', 'garland') ? '' : $info->name; $screenshot = NULL; - $theme_key = $info->name; + $theme_key = $info->name; while ($theme_key) { if (file_exists($themes[$theme_key]->info['screenshot'])) { $screenshot = $themes[$theme_key]->info['screenshot']; @@ -785,7 +802,7 @@ function system_theme_default() { 'secondary_links', ), 'stylesheets' => array( - 'all' => array('style.css') + 'all' => array('style.css'), ), 'scripts' => array('script.js'), 'screenshot' => 'screenshot.png', @@ -832,9 +849,9 @@ function _system_theme_data() { // Find themes $themes = drupal_system_listing('\.info$', 'themes'); // Find theme engines - $engines = drupal_system_listing('\.engine$', 'themes/engines'); + $engines = drupal_system_listing('\.engine$', 'themes/engines'); - $defaults = system_theme_default(); + $defaults = system_theme_default(); $sub_themes = array(); // Read info files for each theme @@ -922,6 +939,7 @@ function _system_theme_data() { * The name of the theme whose base we are looking for. * @param $used_keys * A recursion parameter preventing endless loops. + * * @return * Returns the top level parent that has no ancestor or returns NULL if there isn't a valid parent. */ @@ -950,6 +968,7 @@ function system_find_base_theme($themes, * * @param $theme_key * The name of a theme. + * * @return * An array of regions in the form $region['name'] = 'description'. */ @@ -969,6 +988,7 @@ function system_region_list($theme_key) * * @param $theme * The name of a theme. + * * @return * A string that is the region name. */ @@ -992,15 +1012,16 @@ function system_initialize_theme_blocks( // 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'); - $regions = system_region_list($theme); - $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $default_theme); + $regions = system_region_list($theme); + $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $default_theme); while ($block = db_fetch_array($result)) { // If the region isn't supported by the theme, assign the block to the theme's default region. if (!array_key_exists($block['region'], $regions)) { $block['region'] = system_default_region($theme); } db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d, %d)", - $block['module'], $block['delta'], $theme, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle'], $block['cache']); + $block['module'], $block['delta'], $theme, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle'], $block['cache'] + ); } } } @@ -1010,14 +1031,16 @@ function system_initialize_theme_blocks( * * @ingroup forms * @see system_settings_form_submit() + * * @param $form * An associative array containing the structure of the form. + * * @return * The form structure. */ function system_settings_form($form) { - $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') ); - $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') ); + $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); + $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults')); if (!empty($_POST) && form_get_errors()) { drupal_set_message(t('The settings have not been saved because of the errors.'), 'error'); @@ -1069,7 +1092,7 @@ function _system_sort_requirements($a, $ if (!isset($b['weight'])) { return strcmp($a['title'], $b['title']); } - return -$b['weight']; + return - $b['weight']; } return isset($b['weight']) ? $a['weight'] - $b['weight'] : $a['weight']; } @@ -1081,8 +1104,8 @@ function _system_sort_requirements($a, $ */ function system_node_type($op, $info) { if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) { - $old = 'toggle_node_info_'. $info->old_type; - $new = 'toggle_node_info_'. $info->type; + $old = 'toggle_node_info_'. $info->old_type; + $new = 'toggle_node_info_'. $info->type; $theme_settings = variable_get('theme_settings', array()); if (isset($theme_settings[$old])) { @@ -1105,6 +1128,7 @@ function system_node_type($op, $info) { * action was confirmed. * * @ingroup forms + * * @param $form * Additional elements to inject into the form, for example hidden elements. * @param $question @@ -1122,6 +1146,7 @@ function system_node_type($op, $info) { * A caption for the link which denies the action (e.g. "Cancel"). * @param $name * The internal name used to refer to the confirmation item. + * * @return * The form. */ @@ -1131,9 +1156,9 @@ function confirm_form($form, $question, // Prepare cancel link $query = $fragment = NULL; if (is_array($path)) { - $query = isset($path['query']) ? $path['query'] : NULL; + $query = isset($path['query']) ? $path['query'] : NULL; $fragment = isset($path['fragment']) ? $path['fragment'] : NULL; - $path = isset($path['path']) ? $path['path'] : NULL; + $path = isset($path['path']) ? $path['path'] : NULL; } $cancel = l($no ? $no : t('Cancel'), $path, array('query' => $query, 'fragment' => $fragment)); @@ -1166,6 +1191,7 @@ function system_admin_compact_mode() { * * @param $module * Module name. + * * @return * An array of task links. */ @@ -1191,14 +1217,14 @@ function system_get_module_admin_tasks($ $admin_task_count = 0; // Check for permissions. if (module_hook($module, 'perm') && $admin_access) { - $admin_tasks[-1] = l(t('Configure permissions'), 'admin/user/permissions', array('fragment' => 'module-'. $module)); + $admin_tasks[ - 1] = l(t('Configure permissions'), 'admin/user/permissions', array('fragment' => 'module-'. $module)); } // Check for menu items that are admin links. if ($menu = module_invoke($module, 'menu')) { foreach (array_keys($menu) as $path) { if (isset($items[$path])) { - $admin_tasks[$items[$path]['title'] . $admin_task_count ++] = l($items[$path]['title'], $path); + $admin_tasks[$items[$path]['title'] . $admin_task_count++] = l($items[$path]['title'], $path); } } } @@ -1272,7 +1298,7 @@ function system_action_info() { 'comment' => array('view', 'insert', 'update', 'delete'), 'user' => array('view', 'insert', 'update', 'delete', 'login'), 'taxonomy' => array('insert', 'update', 'delete'), - ) + ), ), 'system_goto_action' => array( 'description' => t('Redirect to URL'), @@ -1282,8 +1308,8 @@ function system_action_info() { 'nodeapi' => array('view', 'insert', 'update', 'delete'), 'comment' => array('view', 'insert', 'update', 'delete'), 'user' => array('view', 'insert', 'update', 'delete', 'login'), - ) - ) + ), + ), ); } @@ -1294,8 +1320,8 @@ function system_actions_manage() { $output = ''; $actions = actions_list(); actions_synchronize($actions); - $actions_map = actions_actions_map($actions); - $options = array(t('Choose an advanced action')); + $actions_map = actions_actions_map($actions); + $options = array(t('Choose an advanced action')); $unconfigurable = array(); foreach ($actions_map as $key => $array) { @@ -1307,12 +1333,12 @@ function system_actions_manage() { } } - $row = array(); + $row = array(); $instances_present = db_fetch_object(db_query("SELECT aid FROM {actions} WHERE parameters != ''")); - $header = array( + $header = array( array('data' => t('Action type'), 'field' => 'type'), array('data' => t('Description'), 'field' => 'description'), - array('data' => $instances_present ? t('Operations') : '', 'colspan' => '2') + array('data' => $instances_present ? t('Operations') : '', 'colspan' => '2'), ); $sql = 'SELECT * FROM {actions}'; $result = pager_query($sql . tablesort_sql($header), 50); @@ -1321,7 +1347,7 @@ function system_actions_manage() { array('data' => $action->type), array('data' => $action->description), array('data' => $action->parameters ? l(t('configure'), "admin/settings/actions/configure/$action->aid") : ''), - array('data' => $action->parameters ? l(t('delete'), "admin/settings/actions/delete/$action->aid") : '') + array('data' => $action->parameters ? l(t('delete'), "admin/settings/actions/delete/$action->aid") : ''), ); } @@ -1346,10 +1372,12 @@ function system_actions_manage() { * * @see system_actions_manage_form_submit() * @ingroup forms + * * @param $form_state * An associative array containing the current state of the form; not used. * @param $options * An array of configurable actions. + * * @return * Form definition. */ @@ -1392,10 +1420,12 @@ function system_actions_manage_form_subm * * @see system_actions_configure_validate() * @see system_actions_configure_submit() + * * @param $action * md5 hash of action ID or an integer. If it's an md5 hash, we * are creating a new instance. If it's an integer, we're editing * an existing instance. + * * @return * Form definition. */ @@ -1436,7 +1466,7 @@ function system_actions_configure($form_ '#default_value' => $edit['actions_description'], '#maxlength' => '255', '#description' => t('A unique description for this advanced action. This description will be displayed in the interface of modules that integrate with actions, such as Trigger module.'), - '#weight' => -10 + '#weight' => -10, ); $action_form = $function .'_form'; $form = array_merge($form, $action_form($edit)); @@ -1462,7 +1492,7 @@ function system_actions_configure($form_ $form['buttons']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), - '#weight' => 13 + '#weight' => 13, ); return $form; @@ -1556,8 +1586,10 @@ function system_actions_remove_orphans() * * @see system_send_email_action_validate() * @see system_send_email_action_submit() + * * @param $context * Default values (if we are editing an existing action instance). + * * @return * Form definition. */ @@ -1619,8 +1651,8 @@ function system_send_email_action_submit // we return will be serialized to the database. $params = array( 'recipient' => $form_values['recipient'], - 'subject' => $form_values['subject'], - 'message' => $form_values['message'], + 'subject' => $form_values['subject'], + 'message' => $form_values['message'], ); return $params; } @@ -1639,6 +1671,7 @@ function system_send_email_action($objec $node = $context['node']; break; // The comment hook provides nid, in $context. + case 'comment': $comment = $context['comment']; $node = node_load($comment->nid); @@ -1656,6 +1689,7 @@ function system_send_email_action($objec return; } break; + default: // We are being called directly. $node = $object; @@ -1674,7 +1708,6 @@ function system_send_email_action($objec if (!isset($account)) { $account = $user; - } $language = user_preferred_language($account); $params = array('account' => $account, 'object' => $object, 'context' => $context); @@ -1694,8 +1727,8 @@ function system_send_email_action($objec * Implementation of hook_mail(). */ function system_mail($key, &$message, $params) { - $account = $params['account']; - $context = $params['context']; + $account = $params['account']; + $context = $params['context']; $variables = array( '%site_name' => variable_get('site_name', 'Drupal'), '%username' => $account->name, @@ -1768,22 +1801,25 @@ function system_message_action(&$object, $node = $context['node']; break; // The comment hook also provides the node, in context. + case 'comment': $comment = $context['comment']; $node = node_load($comment->nid); break; + case 'taxonomy': $vocabulary = taxonomy_vocabulary_load($object->vid); $variables = array_merge($variables, array( - '%term_name' => $object->name, - '%term_description' => $object->description, - '%term_id' => $object->tid, - '%vocabulary_name' => $vocabulary->name, - '%vocabulary_description' => $vocabulary->description, - '%vocabulary_id' => $vocabulary->vid, + '%term_name' => $object->name, + '%term_description' => $object->description, + '%term_id' => $object->tid, + '%vocabulary_name' => $vocabulary->name, + '%vocabulary_description' => $vocabulary->description, + '%vocabulary_id' => $vocabulary->vid, ) ); break; + default: // We are being called directly. $node = $object; @@ -1791,12 +1827,12 @@ function system_message_action(&$object, if (isset($node) && is_object($node)) { $variables = array_merge($variables, array( - '%uid' => $node->uid, - '%node_url' => url('node/'. $node->nid, array('absolute' => TRUE)), - '%node_type' => check_plain(node_get_types('name', $node)), - '%title' => filter_xss($node->title), - '%teaser' => filter_xss($node->teaser), - '%body' => filter_xss($node->body), + '%uid' => $node->uid, + '%node_url' => url('node/'. $node->nid, array('absolute' => TRUE)), + '%node_type' => check_plain(node_get_types('name', $node)), + '%title' => filter_xss($node->title), + '%teaser' => filter_xss($node->teaser), + '%body' => filter_xss($node->body), ) ); } @@ -1820,7 +1856,7 @@ function system_goto_action_form($contex function system_goto_action_submit($form, $form_state) { return array( - 'url' => $form_state['values']['url'] + 'url' => $form_state['values']['url'], ); } @@ -1833,8 +1869,8 @@ function system_goto_action($object, $co */ function _system_zonelist() { $timestamp = time(); - $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14); - $zones = array(); + $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14); + $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); @@ -1877,3 +1913,4 @@ function theme_system_powered_by($image_ $image = theme('image', $image_path, t('Powered by Drupal, an open source content management system'), t('Powered by Drupal, an open source content management system')); return l($image, 'http://drupal.org', array('html' => TRUE, 'absolute' => TRUE, 'external' => TRUE)); } + Index: modules/taxonomy/taxonomy.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v retrieving revision 1.21 diff -u -p -r1.21 taxonomy.admin.inc --- modules/taxonomy/taxonomy.admin.inc 8 Jan 2008 10:35:42 -0000 1.21 +++ modules/taxonomy/taxonomy.admin.inc 20 Jan 2008 06:08:08 -0000 @@ -1,6 +1,7 @@ $row, 'class' => 'draggable'); } } @@ -185,7 +186,7 @@ function taxonomy_form_vocabulary(&$form $form['submit'] = array('#type' => 'submit', '#value' => t('Save')); if (isset($edit['vid'])) { $form['delete'] = array('#type' => 'submit', '#value' => t('Delete')); - $form['vid'] = array('#type' => 'value', '#value' => $edit['vid']); + $form['vid'] = array('#type' => 'value', '#value' => $edit['vid']); $form['module'] = array('#type' => 'value', '#value' => $edit['module']); } return $form; @@ -202,6 +203,7 @@ function taxonomy_form_vocabulary_submit drupal_set_message(t('Created new vocabulary %name.', array('%name' => $form_state['values']['name']))); watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/'. $form_state['values']['vid'])); break; + case SAVED_UPDATED: drupal_set_message(t('Updated vocabulary %name.', array('%name' => $form_state['values']['name']))); watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/'. $form_state['values']['vid'])); @@ -258,17 +260,21 @@ function taxonomy_overview_terms(&$form_ '#parent_fields' => FALSE, ); - $page = isset($_GET['page']) ? $_GET['page'] : 0; - $page_increment = 10; // Number of terms per page. - $page_entries = 0; // Elements shown on this page. - $before_entries = 0; // Elements at the root level before this page. - $after_entries = 0; // Elements at the root level after this page. - $root_entries = 0; // Elements at the root level on this page. - + $page = isset($_GET['page']) ? $_GET['page'] : 0; + // Number of terms per page. + $page_increment = 10; + // Elements shown on this page. + $page_entries = 0; + // Elements at the root level before this page. + $before_entries = 0; + // Elements at the root level after this page. + $after_entries = 0; + // Elements at the root level on this page. + $root_entries = 0; // Terms from previous and next pages are shown if the term tree would have // been cut in the middle. Keep track of how many extra terms we show on each // page of terms. - $back_peddle = NULL; + $back_peddle = NULL; $forward_peddle = 0; // An array of the terms to be displayed on this page. @@ -289,8 +295,8 @@ function taxonomy_overview_terms(&$form_ // Case for restricted vocabulary. else { $term_deltas = array(); - $tree = taxonomy_get_tree($vocabulary->vid); - $term = current($tree); + $tree = taxonomy_get_tree($vocabulary->vid); + $term = current($tree); do { // In case this tree is completely empty. if (empty($term)) { @@ -315,7 +321,8 @@ function taxonomy_overview_terms(&$form_ $back_peddle++; if ($pterm->depth == 0) { prev($tree); - continue 2; // Jump back to the start of the root level parent. + // Jump back to the start of the root level parent. + continue 2; } } } @@ -358,8 +365,10 @@ function taxonomy_overview_terms(&$form_ // If this form was already submitted once, it's probably hit a validation // error. Ensure the form is rebuilt in the same order as the user submitted. if (!empty($form_state['post'])) { - $order = array_flip(array_keys($form_state['post'])); // Get the $_POST order. - $current_page = array_merge($order, $current_page); // Update our form with the new order. + // Get the $_POST order. + $order = array_flip(array_keys($form_state['post'])); + // Update our form with the new order. + $current_page = array_merge($order, $current_page); foreach ($current_page as $key => $term) { // Verify this is a term for the current page and set at the current depth. if (is_array($form_state['post'][$key]) && is_numeric($form_state['post'][$key]['tid'])) { @@ -385,7 +394,7 @@ function taxonomy_overview_terms(&$form_ $form['#parent_fields'] = TRUE; $form[$key]['tid'] = array( '#type' => 'hidden', - '#value' => $term->tid + '#value' => $term->tid, ); $form[$key]['parent'] = array( '#type' => 'hidden', @@ -411,15 +420,15 @@ function taxonomy_overview_terms(&$form_ if (!$vocabulary->tags && $vocabulary->hierarchy < 2 && count($tree) > 1) { $form['submit'] = array( '#type' => 'submit', - '#value' => t('Save') + '#value' => t('Save'), ); $form['reset_alphabetical'] = array( '#type' => 'submit', - '#value' => t('Reset to alphabetical') + '#value' => t('Reset to alphabetical'), ); $form['destination'] = array( '#type' => 'hidden', - '#value' => $_GET['q'] . (isset($_GET['page']) ? '?page='. $_GET['page'] : '') + '#value' => $_GET['q'] . (isset($_GET['page']) ? '?page='. $_GET['page'] : ''), ); } @@ -453,14 +462,15 @@ function taxonomy_overview_terms_submit( return; } - $order = array_flip(array_keys($form['#post'])); // Get the $_POST order. - $form_state['values'] = array_merge($order, $form_state['values']); // Update our original form with the new order. - + // Get the $_POST order. + $order = array_flip(array_keys($form['#post'])); + // Update our original form with the new order. + $form_state['values'] = array_merge($order, $form_state['values']); $vocabulary = $form['#vocabulary']; - $hierarchy = 0; // Update the current hierarchy type as we go. - + // Update the current hierarchy type as we go. + $hierarchy = 0; $changed_terms = array(); - $tree = taxonomy_get_tree($vocabulary['vid']); + $tree = taxonomy_get_tree($vocabulary['vid']); if (empty($tree)) { return; @@ -538,10 +548,10 @@ function taxonomy_overview_terms_submit( * @see taxonomy_overview_terms() */ function theme_taxonomy_overview_terms($form) { - $page_increment = $form['#page_increment']; - $page_entries = $form['#page_entries']; - $back_peddle = $form['#back_peddle']; - $forward_peddle = $form['#forward_peddle']; + $page_increment = $form['#page_increment']; + $page_entries = $form['#page_entries']; + $back_peddle = $form['#back_peddle']; + $forward_peddle = $form['#forward_peddle']; // Add drag and drop if parent fields are present in the form. if ($form['#parent_fields']) { @@ -556,9 +566,9 @@ function theme_taxonomy_overview_terms($ $rows = array(); foreach (element_children($form) as $key) { if (isset($form[$key]['#term'])) { - $term = &$form[$key]; + $term = &$form[$key]; - $row = array(); + $row = array(); $row[] = (isset($term['#term']['depth']) && $term['#term']['depth'] > 0 ? theme('indentation', $term['#term']['depth']) : '') . drupal_render($term['view']); if ($form['#parent_fields']) { $term['tid']['#attributes']['class'] = 'term-id'; @@ -566,9 +576,9 @@ function theme_taxonomy_overview_terms($ $term['depth']['#attributes']['class'] = 'term-depth'; $row[0] .= drupal_render($term['parent']) . drupal_render($term['tid']) . drupal_render($term['depth']); } - $row[] = drupal_render($term['edit']); + $row[] = drupal_render($term['edit']); - $row = array('data' => $row); + $row = array('data' => $row); $rows[$key] = $row; } } @@ -622,7 +632,7 @@ function theme_taxonomy_overview_terms($ */ function taxonomy_add_term_page($vocabulary) { drupal_set_title(t('Add term to %vocabulary', array('%vocabulary' => $vocabulary->name))); - return drupal_get_form('taxonomy_form_term' , $vocabulary); + return drupal_get_form('taxonomy_form_term', $vocabulary); } /** @@ -664,12 +674,14 @@ function taxonomy_form_term(&$form_state '#default_value' => $edit['name'], '#maxlength' => 255, '#description' => t('The name of this term.'), - '#required' => TRUE); + '#required' => TRUE, + ); $form['identification']['description'] = array( '#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], - '#description' => t('A description of the term. To be displayed on taxonomy/term pages and RSS feeds.')); + '#description' => t('A description of the term. To be displayed on taxonomy/term pages and RSS feeds.'), + ); $form['advanced'] = array( '#type' => 'fieldset', @@ -699,28 +711,34 @@ function taxonomy_form_term(&$form_state '#type' => 'textarea', '#title' => t('Synonyms'), '#default_value' => implode("\n", taxonomy_get_synonyms($edit['tid'])), - '#description' => t('Synonyms of this term, one synonym per line.')); + '#description' => t('Synonyms of this term, one synonym per line.'), + ); $form['advanced']['weight'] = array( '#type' => 'textfield', '#title' => t('Weight'), '#size' => 6, '#default_value' => $edit['weight'], '#description' => t('Terms are displayed in ascending order by weight.'), - '#required' => TRUE); + '#required' => TRUE, + ); $form['vid'] = array( '#type' => 'value', - '#value' => $vocabulary->vid); + '#value' => $vocabulary->vid, + ); $form['submit'] = array( '#type' => 'submit', - '#value' => t('Save')); + '#value' => t('Save'), + ); if ($edit['tid']) { $form['delete'] = array( '#type' => 'submit', - '#value' => t('Delete')); + '#value' => t('Delete'), + ); $form['tid'] = array( '#type' => 'value', - '#value' => $edit['tid']); + '#value' => $edit['tid'], + ); } else { $form['destination'] = array('#type' => 'hidden', '#value' => $_GET['q']); @@ -768,6 +786,7 @@ function taxonomy_form_term_submit($form drupal_set_message(t('Created new term %term.', array('%term' => $form_state['values']['name']))); watchdog('taxonomy', 'Created new term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/term/'. $form_state['values']['tid'])); break; + case SAVED_UPDATED: drupal_set_message(t('Updated term %term.', array('%term' => $form_state['values']['name']))); watchdog('taxonomy', 'Updated term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/term/'. $form_state['values']['tid'])); @@ -828,19 +847,21 @@ function taxonomy_term_confirm_parents(& * @see taxonomy_term_confirm_delete_submit() */ function taxonomy_term_confirm_delete(&$form_state, $tid) { - $term = taxonomy_get_term($tid); + $term = taxonomy_get_term($tid); - $form['type'] = array('#type' => 'value', '#value' => 'term'); - $form['name'] = array('#type' => 'value', '#value' => $term->name); - $form['tid'] = array('#type' => 'value', '#value' => $tid); + $form['type'] = array('#type' => 'value', '#value' => 'term'); + $form['name'] = array('#type' => 'value', '#value' => $term->name); + $form['tid'] = array('#type' => 'value', '#value' => $tid); $form['delete'] = array('#type' => 'value', '#value' => TRUE); return confirm_form($form, - t('Are you sure you want to delete the term %title?', - array('%title' => $term->name)), - 'admin/content/taxonomy', - t('Deleting a term will delete all its children if there are any. This action cannot be undone.'), - t('Delete'), - t('Cancel')); + t('Are you sure you want to delete the term %title?', + array('%title' => $term->name) + ), + 'admin/content/taxonomy', + t('Deleting a term will delete all its children if there are any. This action cannot be undone.'), + t('Delete'), + t('Cancel') + ); } /** @@ -864,18 +885,20 @@ function taxonomy_term_confirm_delete_su * @see taxonomy_vocabulary_confirm_delete_submit() */ function taxonomy_vocabulary_confirm_delete(&$form_state, $vid) { - $vocabulary = taxonomy_vocabulary_load($vid); + $vocabulary = taxonomy_vocabulary_load($vid); $form['type'] = array('#type' => 'value', '#value' => 'vocabulary'); - $form['vid'] = array('#type' => 'value', '#value' => $vid); + $form['vid'] = array('#type' => 'value', '#value' => $vid); $form['name'] = array('#type' => 'value', '#value' => $vocabulary->name); return confirm_form($form, - t('Are you sure you want to delete the vocabulary %title?', - array('%title' => $vocabulary->name)), - 'admin/content/taxonomy', - t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), - t('Delete'), - t('Cancel')); + t('Are you sure you want to delete the vocabulary %title?', + array('%title' => $vocabulary->name) + ), + 'admin/content/taxonomy', + t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), + t('Delete'), + t('Cancel') + ); } /** @@ -905,12 +928,14 @@ function taxonomy_vocabulary_confirm_res $form['name'] = array('#type' => 'value', '#value' => $vocabulary->name); $form['reset_alphabetical'] = array('#type' => 'value', '#value' => TRUE); return confirm_form($form, - t('Are you sure you want to reset the vocabulary %title to alphabetical order?', - array('%title' => $vocabulary->name)), - 'admin/content/taxonomy/'. $vid, - t('Resetting a vocabulary will discard all custom ordering and sort items alphabetically.'), - t('Reset to alphabetical'), - t('Cancel')); + t('Are you sure you want to reset the vocabulary %title to alphabetical order?', + array('%title' => $vocabulary->name) + ), + 'admin/content/taxonomy/'. $vid, + t('Resetting a vocabulary will discard all custom ordering and sort items alphabetically.'), + t('Reset to alphabetical'), + t('Cancel') + ); } /** @@ -924,3 +949,4 @@ function taxonomy_vocabulary_confirm_res watchdog('taxonomy', 'Reset vocabulary %name to alphabetical order.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE); $form_state['redirect'] = 'admin/content/taxonomy/'. $form_state['values']['vid']; } + Index: modules/taxonomy/taxonomy.install =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.install,v retrieving revision 1.7 diff -u -p -r1.7 taxonomy.install --- modules/taxonomy/taxonomy.install 8 Jan 2008 07:46:41 -0000 1.7 +++ modules/taxonomy/taxonomy.install 20 Jan 2008 06:08:08 -0000 @@ -1,6 +1,7 @@ tid] = array( 'title' => $term->name, 'href' => taxonomy_term_path($term), - 'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)) + 'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)), ); } // Previewing free tagging terms; we don't link them because the @@ -93,10 +94,10 @@ function taxonomy_link($type, $node = NU * * @param $term * A term object. + * * @return * An internal Drupal path. */ - function taxonomy_term_path($term) { $vocabulary = taxonomy_vocabulary_load($term->vid); if ($vocabulary->module != 'taxonomy' && $path = module_invoke($vocabulary->module, 'term_path', $term)) { @@ -229,6 +230,7 @@ function taxonomy_save_vocabulary(&$edit * * @param $vid * A vocabulary ID. + * * @return * Constant indicating items were deleted. */ @@ -294,13 +296,14 @@ function taxonomy_check_vocabulary_hiera * Helper function for taxonomy_form_term_submit(). * * @param $form_state['values'] + * * @return * Status constant indicating if term was inserted or updated. */ function taxonomy_save_term(&$form_values) { $form_values += array( 'description' => '', - 'weight' => 0 + 'weight' => 0, ); if (!empty($form_values['tid']) && $form_values['name']) { @@ -348,7 +351,7 @@ function taxonomy_save_term(&$form_value db_query('DELETE FROM {term_synonym} WHERE tid = %d', $form_values['tid']); if (!empty($form_values['synonyms'])) { - foreach (explode ("\n", str_replace("\r", '', $form_values['synonyms'])) as $synonym) { + foreach (explode("\n", str_replace("\r", '', $form_values['synonyms'])) as $synonym) { if ($synonym) { db_query("INSERT INTO {term_synonym} (tid, name) VALUES (%d, '%s')", $form_values['tid'], chop($synonym)); } @@ -369,6 +372,7 @@ function taxonomy_save_term(&$form_value * * @param $tid * The term ID. + * * @return * Status constant indicating deletion. */ @@ -431,7 +435,9 @@ function taxonomy_form_all($free_tags = $vocabularies = taxonomy_get_vocabularies(); $options = array(); foreach ($vocabularies as $vid => $vocabulary) { - if ($vocabulary->tags && !$free_tags) { continue; } + if ($vocabulary->tags && !$free_tags) { + continue; + } $tree = taxonomy_get_tree($vid); if ($tree && (count($tree) > 0)) { $options[$vocabulary->name] = array(); @@ -660,7 +666,8 @@ function taxonomy_node_save($node, $term // See if the term exists in the chosen vocabulary // and return the tid; otherwise, add a new record. $possibilities = taxonomy_get_term_by_name($typed_term); - $typed_term_tid = NULL; // tid match, if any. + // tid match, if any. + $typed_term_tid = NULL; foreach ($possibilities as $possibility) { if ($possibility->vid == $vid) { $typed_term_tid = $possibility->tid; @@ -668,8 +675,8 @@ function taxonomy_node_save($node, $term } if (!$typed_term_tid) { - $edit = array('vid' => $vid, 'name' => $typed_term); - $status = taxonomy_save_term($edit); + $edit = array('vid' => $vid, 'name' => $typed_term); + $status = taxonomy_save_term($edit); $typed_term_tid = $edit['tid']; } @@ -1024,9 +1031,9 @@ function _taxonomy_term_select($title, $ if ($tree) { foreach ($tree as $term) { if (!in_array($term->tid, $exclude)) { - $choice = new stdClass(); + $choice = new stdClass(); $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name); - $options[] = $choice; + $options[] = $choice; } } } @@ -1068,6 +1075,7 @@ function theme_taxonomy_term_select($ele * pages) or not (in an XML feed, for example). * @param $order * The order clause for the query that retrieve the nodes. + * * @return * A resource identifier pointing to the query results. */ @@ -1079,21 +1087,21 @@ function taxonomy_select_nodes($tids = a $depth = NULL; } foreach ($tids as $index => $tid) { - $term = taxonomy_get_term($tid); - $tree = taxonomy_get_tree($term->vid, $tid, -1, $depth); + $term = taxonomy_get_term($tid); + $tree = taxonomy_get_tree($term->vid, $tid, -1, $depth); $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree)); } if ($operator == 'or') { - $args = call_user_func_array('array_merge', $descendant_tids); + $args = call_user_func_array('array_merge', $descendant_tids); $placeholders = db_placeholders($args, 'int'); - $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid WHERE tn.tid IN ('. $placeholders .') AND n.status = 1 ORDER BY '. $order; - $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid WHERE tn.tid IN ('. $placeholders .') AND n.status = 1'; + $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid WHERE tn.tid IN ('. $placeholders .') AND n.status = 1 ORDER BY '. $order; + $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid WHERE tn.tid IN ('. $placeholders .') AND n.status = 1'; } else { - $joins = ''; + $joins = ''; $wheres = ''; - $args = array(); + $args = array(); foreach ($descendant_tids as $index => $tids) { $joins .= ' INNER JOIN {term_node} tn'. $index .' ON n.vid = tn'. $index .'.vid'; $wheres .= ' AND tn'. $index .'.tid IN ('. db_placeholders($tids, 'int') .')'; @@ -1220,9 +1228,10 @@ function taxonomy_terms_parse_string($st function taxonomy_rss_item($node) { $output = array(); foreach ($node->taxonomy as $term) { - $output[] = array('key' => 'category', - 'value' => check_plain($term->name), - 'attributes' => array('domain' => url('taxonomy/term/'. $term->tid, array('absolute' => TRUE)))); + $output[] = array('key' => 'category', + 'value' => check_plain($term->name), + 'attributes' => array('domain' => url('taxonomy/term/'. $term->tid, array('absolute' => TRUE))), + ); } return $output; } @@ -1242,21 +1251,26 @@ function taxonomy_help($path, $arg) { $output .= '

'. t('The taxonomy module supports the use of both synonyms and related terms, but does not directly use this functionality. However, optional contributed or custom modules may make full use of these advanced features.') .'

'; $output .= '

'. t('For more information, see the online handbook entry for Taxonomy module.', array('@taxonomy' => 'http://drupal.org/handbook/modules/taxonomy/')) .'

'; return $output; + case 'admin/content/taxonomy': return '

'. t("The taxonomy module allows you to categorize your content using both tags and administrator defined terms. It is a flexible tool for classifying content with many advanced features. To begin, create a 'Vocabulary' to hold one set of terms or tags. You can create one free-tagging vocabulary for everything, or separate controlled vocabularies to define the various properties of your content, for example 'Countries' or 'Colors'.") .'

'; + case 'admin/content/taxonomy/%': $vocabulary = taxonomy_vocabulary_load($arg[3]); if ($vocabulary->tags) { return '

'. t('%capital_name is a free-tagging vocabulary. To change the name or description of a term, click the edit link next to the term.', array('%capital_name' => drupal_ucfirst($vocabulary->name))) .'

'; } switch ($vocabulary->hierarchy) { - case 0: - return '

'. t('%capital_name is a flat vocabulary. You may organize the terms in the %name vocabulary by using the handles on the left side of the table. To change the name or description of a term, click the edit link next to the term.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) .'

'; - case 1: - return '

'. t('%capital_name is a single hierarchy vocabulary. You may organize the terms in the %name vocabulary by using the handles on the left side of the table. To change the name or description of a term, click the edit link next to the term.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) .'

'; - case 2: - return '

'. t('%capital_name is a multiple hierarchy vocabulary. To change the name or description of a term, click the edit link next to the term. Drag and drop of multiple hierarchies is not supported, but you can re-enable drag and drop support by editing each term to include only a single parent.', array('%capital_name' => drupal_ucfirst($vocabulary->name))) .'

'; - } + case 0: + return '

'. t('%capital_name is a flat vocabulary. You may organize the terms in the %name vocabulary by using the handles on the left side of the table. To change the name or description of a term, click the edit link next to the term.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) .'

'; + + case 1: + return '

'. t('%capital_name is a single hierarchy vocabulary. You may organize the terms in the %name vocabulary by using the handles on the left side of the table. To change the name or description of a term, click the edit link next to the term.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) .'

'; + + case 2: + return '

'. t('%capital_name is a multiple hierarchy vocabulary. To change the name or description of a term, click the edit link next to the term. Drag and drop of multiple hierarchies is not supported, but you can re-enable drag and drop support by editing each term to include only a single parent.', array('%capital_name' => drupal_ucfirst($vocabulary->name))) .'

'; + } + case 'admin/content/taxonomy/add/vocabulary': return '

'. t('Define how your vocabulary will be presented to administrators and users, and which content types to categorize with it. Tags allows users to create terms when submitting posts by typing a comma separated list. Otherwise terms are chosen from a select list and can only be created by users with the "administer taxonomy" permission.') .'

'; } @@ -1303,9 +1317,10 @@ function taxonomy_hook_info() { 'runs when' => t('After saving an updated term to the database'), ), 'delete' => array( - 'runs when' => t('After deleting a term') + 'runs when' => t('After deleting a term'), ), ), ), ); } + Index: modules/taxonomy/taxonomy.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v retrieving revision 1.9 diff -u -p -r1.9 taxonomy.pages.inc --- modules/taxonomy/taxonomy.pages.inc 18 Jan 2008 16:23:57 -0000 1.9 +++ modules/taxonomy/taxonomy.pages.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ tid; @@ -44,7 +46,7 @@ function taxonomy_term_page($str_tids = $output = theme('taxonomy_term_page', $tids, taxonomy_select_nodes($tids, $terms['operator'], $depth, TRUE)); drupal_add_feed(url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'), 'RSS - '. $title); return $output; - break; + break; case 'feed': $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, array('absolute' => TRUE)); @@ -57,7 +59,7 @@ function taxonomy_term_page($str_tids = } $result = taxonomy_select_nodes($tids, $terms['operator'], $depth, FALSE); - $items = array(); + $items = array(); while ($row = db_fetch_object($result)) { $items[] = $row->nid; } @@ -135,3 +137,4 @@ function taxonomy_autocomplete($vid, $st drupal_json($matches); } + Index: modules/throttle/throttle.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/throttle/throttle.admin.inc,v retrieving revision 1.2 diff -u -p -r1.2 throttle.admin.inc --- modules/throttle/throttle.admin.inc 8 Jan 2008 10:35:43 -0000 1.2 +++ modules/throttle/throttle.admin.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ variable_get('throttle_anonymous', 0), '#size' => 5, '#maxlength' => 6, - '#description' => t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users. You can inspect the current number of anonymous users using the "Who\'s online" block.') + '#description' => t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users. You can inspect the current number of anonymous users using the "Who\'s online" block.'), ); $form['throttle_user'] = array( '#type' => 'textfield', @@ -30,14 +31,14 @@ function throttle_admin_settings() { '#default_value' => variable_get('throttle_user', 0), '#size' => 5, '#maxlength' => 6, - '#description' => t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users. You can inspect the current number of authenticated users using the "Who\'s online" block.') + '#description' => t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users. You can inspect the current number of authenticated users using the "Who\'s online" block.'), ); $form['throttle_probability_limiter'] = array( '#type' => 'select', '#title' => t('Auto-throttle probability limiter'), '#default_value' => variable_get('throttle_probability_limiter', 9), '#options' => $probabilities, - '#description' => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.') + '#description' => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.'), ); $form['#validate'] = array('throttle_admin_settings_validate'); @@ -53,3 +54,4 @@ function throttle_admin_settings_validat form_set_error('throttle_user', t("%value is not a valid auto-throttle setting. Please enter a positive numeric value.", array('%value' => $form_state['values']['throttle_user']))); } } + Index: modules/throttle/throttle.module =================================================================== RCS file: /cvs/drupal/drupal/modules/throttle/throttle.module,v retrieving revision 1.83 diff -u -p -r1.83 throttle.module --- modules/throttle/throttle.module 14 Dec 2007 18:08:49 -0000 1.83 +++ modules/throttle/throttle.module 20 Jan 2008 06:08:09 -0000 @@ -1,11 +1,11 @@ 'Throttle', @@ -85,16 +85,18 @@ function throttle_exit() { if (!$throttle) { variable_set('throttle_level', 1); $message = format_plural($users, - '1 user accessing site; throttle enabled.', - '@count users accessing site; throttle enabled.'); + '1 user accessing site; throttle enabled.', + '@count users accessing site; throttle enabled.' + ); } } elseif ($max_guests && $guests > $max_guests) { if (!$throttle) { variable_set('throttle_level', 1); $message = format_plural($guests, - '1 guest accessing site; throttle enabled.', - '@count guests accessing site; throttle enabled.'); + '1 guest accessing site; throttle enabled.', + '@count guests accessing site; throttle enabled.' + ); } } else { @@ -122,7 +124,9 @@ function throttle_help($path, $arg) { $output .= '

'. t('The congestion control throttle can be automatically enabled when the number of anonymous or authenticated users currently visiting the site exceeds a specified threshold.') .'

'; $output .= '

'. t('For more information, see the online handbook entry for Throttle module.', array('@throttle' => 'http://drupal.org/handbook/modules/throttle/')) .'

'; return $output; + case 'admin/settings/throttle': return '

'. t('The throttle module provides a congestion control mechanism that automatically adjusts to a surge in incoming traffic. If your site is referenced by a popular website, or experiences a "Denial of Service" (DoS) attack, your webserver might become overwhelmed. The throttle mechanism is utilized by modules to temporarily disable CPU-intensive functionality, increasing performance.') .'

'; } } + Index: modules/tracker/tracker.module =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.module,v retrieving revision 1.154 diff -u -p -r1.154 tracker.module --- modules/tracker/tracker.module 14 Dec 2007 18:08:49 -0000 1.154 +++ modules/tracker/tracker.module 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ name)); } - // TODO: These queries are very expensive, see http://drupal.org/node/105639 - $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC'; - $sql = db_rewrite_sql($sql); + // TODO: These queries are very expensive, see http://drupal.org/node/105639 + $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC'; + $sql = db_rewrite_sql($sql); $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)'; $sql_count = db_rewrite_sql($sql_count); - $result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $account->uid, $account->uid); + $result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $account->uid, $account->uid); } else { - $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_updated DESC'; - $sql = db_rewrite_sql($sql); + $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_updated DESC'; + $sql = db_rewrite_sql($sql); $sql_count = 'SELECT COUNT(n.nid) FROM {node} n WHERE n.status = 1'; $sql_count = db_rewrite_sql($sql_count); - $result = pager_query($sql, 25, 0, $sql_count); + $result = pager_query($sql, 25, 0, $sql_count); } $rows = array(); @@ -54,7 +54,7 @@ function tracker_page($account = NULL, $ l($node->title, "node/$node->nid") .' '. theme('mark', node_mark($node->nid, $node->changed)), theme('username', $node), array('class' => 'replies', 'data' => $comments), - t('!time ago', array('!time' => format_interval(time() - $node->last_updated))) + t('!time ago', array('!time' => format_interval(time() - $node->last_updated))), ); } @@ -71,3 +71,4 @@ function tracker_page($account = NULL, $ return $output; } + Index: modules/translation/translation.module =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v retrieving revision 1.22 diff -u -p -r1.22 translation.module --- modules/translation/translation.module 9 Jan 2008 11:51:54 -0000 1.22 +++ modules/translation/translation.module 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ '. t('Use the language switcher block provided by locale module to allow users to select a language. If available, both the site interface and site content are presented in the language selected.', array('@blocks' => url('admin/build/block'))) .'

'; $output .= '

'. t('For more information, see the online handbook entry for Translation module.', array('@translation' => 'http://drupal.org/handbook/modules/translation/')) .'

'; return $output; + case 'node/%/translate': $output = '

'. t('Translations of a piece of content are managed with translation sets. Each translation set has one source post and any number of translations in any of the enabled languages. All translations are tracked to be up to date or outdated based on whether the source post was modified significantly.', array('!languages' => url('admin/settings/language'))) .'

'; return $output; @@ -170,7 +172,7 @@ function translation_link($type, $node = 'title' => $languages[$language]->native, 'href' => "node/$translation->nid", 'language' => $languages[$language], - 'attributes' => array('title' => $translation->title, 'class' => 'translation-link') + 'attributes' => array('title' => $translation->title, 'class' => 'translation-link'), ); } } @@ -191,8 +193,9 @@ function translation_nodeapi(&$node, $op switch ($op) { case 'prepare': if (empty($node->nid) && isset($_GET['translation']) && isset($_GET['language']) && - ($source_nid = $_GET['translation']) && ($language = $_GET['language']) && - (user_access('translate content'))) { + ($source_nid = $_GET['translation']) && ($language = $_GET['language']) && + (user_access('translate content')) + ) { // We are translating a node from a source node, so // load the node to be translated and populate fields. $node->language = $language; @@ -265,6 +268,7 @@ function translation_remove_from_set($no * @param $tnid * The translation source nid of the translation set, the identifier * of the node used to derive all translations in the set. + * * @return * Array of partial node objects (nid, title, language) representing * all nodes in the translation set, in effect all translations @@ -303,6 +307,7 @@ function translation_supported_type($typ * * @param $path * A Drupal path, for example node/432. + * * @return * An array of paths of translations of the node accessible * to the current user keyed with language codes. Index: modules/translation/translation.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.pages.inc,v retrieving revision 1.2 diff -u -p -r1.2 translation.pages.inc --- modules/translation/translation.pages.inc 7 Jan 2008 13:18:40 -0000 1.2 +++ modules/translation/translation.pages.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ $node->title))); return theme('table', $header, $rows); } + Index: modules/trigger/trigger.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.admin.inc,v retrieving revision 1.5 diff -u -p -r1.5 trigger.admin.inc --- modules/trigger/trigger.admin.inc 8 Jan 2008 10:35:43 -0000 1.5 +++ modules/trigger/trigger.admin.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ $aid, ); - $action = actions_function_lookup($aid); - $actions = actions_get_all_actions(); + $action = actions_function_lookup($aid); + $actions = actions_get_all_actions(); $destination = 'admin/build/trigger/'. ($hook == 'nodeapi' ? 'node' : $hook); @@ -84,7 +86,7 @@ function trigger_unassign_submit($form, $aid = actions_function_lookup($form_values['aid']); db_query("DELETE FROM {trigger_assignments} WHERE hook = '%s' AND op = '%s' AND aid = '%s'", $form_values['hook'], $form_values['operation'], $aid); $actions = actions_get_all_actions(); - watchdog('actions', 'Action %action has been unassigned.', array('%action' => check_plain($actions[$aid]['description']))); + watchdog('actions', 'Action %action has been unassigned.', array('%action' => check_plain($actions[$aid]['description']))); drupal_set_message(t('Action %action has been unassigned.', array('%action' => $actions[$aid]['description']))); $hook = $form_values['hook'] == 'nodeapi' ? 'node' : $form_values['hook']; $form_state['redirect'] = 'admin/build/trigger/'. $hook; @@ -105,6 +107,7 @@ function trigger_unassign_submit($form, * The name of the hook operation, e.g., 'insert'. * @param $description * A plain English description of what this hook operation does. + * * @return * * @ingoup forms @@ -122,10 +125,10 @@ function trigger_assign_form($form_state ); // All of these forms use the same validate and submit functions. $form['#validate'][] = 'trigger_assign_form_validate'; - $form['#submit'][] = 'trigger_assign_form_submit'; + $form['#submit'][] = 'trigger_assign_form_submit'; - $options = array(); - $functions = array(); + $options = array(); + $functions = array(); // Restrict the options list to actions that declare support for this hook-op // combination. foreach (actions_list() as $func => $metadata) { @@ -142,8 +145,8 @@ function trigger_assign_form($form_state $form[$op] = array( '#type' => 'fieldset', '#title' => t('Trigger: ') . $description, - '#theme' => 'trigger_display' - ); + '#theme' => 'trigger_display', + ); // Retrieve actions that are already assigned to this hook-op combination. $actions = _trigger_get_hook_actions($hook, $op); $form[$op]['assigned']['#type'] = 'value'; @@ -151,7 +154,7 @@ function trigger_assign_form($form_state foreach ($actions as $aid => $description) { $form[$op]['assigned']['#value'][$aid] = array( 'description' => $description, - 'link' => l(t('unassign'), "admin/build/trigger/unassign/$hook/$op/". md5($aid)) + 'link' => l(t('unassign'), "admin/build/trigger/unassign/$hook/$op/". md5($aid)), ); } @@ -168,12 +171,12 @@ function trigger_assign_form($form_state ); $form[$op]['parent']['submit'] = array( '#type' => 'submit', - '#value' => t('Assign') + '#value' => t('Assign'), ); } else { $form[$op]['none'] = array( - '#value' => t('No available actions for this trigger.') + '#value' => t('No available actions for this trigger.'), ); } return $form; @@ -226,6 +229,7 @@ function trigger_assign_form_submit($for * * @param array $element * The fieldset including all assigned actions. + * * @return * The rendered form with the table prepended. * @@ -240,7 +244,7 @@ function theme_trigger_display($element) foreach ($element['assigned']['#value'] as $aid => $info) { $rows[] = array( $info['description'], - $info['link'] + $info['link'], ); } } @@ -254,7 +258,6 @@ function theme_trigger_display($element) return $output; } - /** * Get the actions that have already been defined for this * type-hook-op combination. @@ -267,6 +270,7 @@ function theme_trigger_display($element) * @param $op * The hook operation for which the actions have been assigned, * e.g., 'view'. + * * @return * An array of action descriptions keyed by action IDs. */ @@ -283,3 +287,4 @@ function _trigger_get_hook_actions($hook } return $actions; } + Index: modules/trigger/trigger.install =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.install,v retrieving revision 1.5 diff -u -p -r1.5 trigger.install --- modules/trigger/trigger.install 28 Dec 2007 12:02:52 -0000 1.5 +++ modules/trigger/trigger.install 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ '. t('Below you can assign actions to run when certain comment-related triggers happen. For example, you could promote a post to the front page when a comment is added.') .'

'; + case 'admin/build/trigger/node': return $explanation .'

'. t('Below you can assign actions to run when certain content-related triggers happen. For example, you could remove a post from the front page when the post is updated.') .'

'; + case 'admin/build/trigger/cron': return $explanation .'

'. t('Below you can assign actions to run during each pass of a cron maintenance task.', array('@cron' => url('admin/reports/status'))) .'

'; + case 'admin/build/trigger/taxonomy': return $explanation .'

'. t('Below you can assign actions to run when certain taxonomy-related triggers happen. For example, you could send an e-mail to an administrator when a term is deleted.') .'

'; + case 'admin/build/trigger/user': return $explanation .'

'. t("Below you can assign actions to run when certain user-related triggers happen. For example, you could send an e-mail to an administrator when a user account is deleted.") .'

'; + case 'admin/help#trigger': $output = '

'. t('The Trigger module provides the ability to trigger actions upon system events, such as when new content is added or when a user logs in.', array('@actions' => url('admin/settings/actions'))) .'

'; $output .= '

'. t('The combination of actions and triggers can perform many useful tasks, such as e-mailing an administrator if a user account is deleted, or automatically unpublishing comments that contain certain words. By default, there are five "contexts" of events (Comments, Content, Cron, Taxonomy, and Users), but more may be added by additional modules.') .'

'; @@ -134,6 +140,7 @@ function trigger_access_check($module) { * @param $op * The name of the operation being executed. Defaults to an empty string * because some hooks (e.g., hook_cron()) do not have operations. + * * @return * An array of action IDs. */ @@ -186,6 +193,7 @@ function trigger_forms() { * The type of action that is about to be called. * @param $node * The node that was passed via the nodeapi hook. + * * @return * The object expected by the action that is about to be called. */ @@ -195,9 +203,9 @@ function _trigger_normalize_node_context // the action is expecting a comment object. But we do not know which comment // to give it. The first? The most recent? All of them? So comment actions // in a node context are not supported. - // An action that works on users is being called in a node context. // Load the user object of the node's author. + case 'user': return user_load(array('uid' => $node->uid)); } @@ -255,16 +263,19 @@ function trigger_nodeapi(&$node, $op, $a * The type of action that is about to be called. * @param $comment * The comment that was passed via the comment hook. + * * @return * The object expected by the action that is about to be called. */ function _trigger_normalize_comment_context($type, $comment) { switch ($type) { // An action that works with nodes is being called in a comment context. + case 'node': return node_load(is_array($comment) ? $comment['nid'] : $comment->nid); // An action that works on users is being called in a comment context. + case 'user': return user_load(array('uid' => is_array($comment) ? $comment['uid'] : $comment->uid)); } @@ -330,6 +341,7 @@ function trigger_cron() { * The type of action that is about to be called. * @param $account * The account object that was passed via the user hook. + * * @return * The object expected by the action that is about to be called. */ @@ -339,9 +351,9 @@ function _trigger_normalize_user_context // the action is expecting a comment object. But we have no way of // determining the appropriate comment object to pass. So comment // actions in a user context are not supported. - // An action that works with nodes is being called in a user context. // If a single node is being viewed, return the node. + case 'node': // If we are viewing an individual node, return the node. if ((arg(0) == 'node') && is_numeric(arg(1)) && (arg(2) == NULL)) { @@ -364,7 +376,7 @@ function trigger_user($op, &$edit, &$acc $context = array( 'hook' => 'user', 'op' => $op, - 'form_values' => &$edit, + 'form_values' => & $edit, ); foreach ($aids as $aid => $action_info) { if ($action_info['type'] != 'user') { @@ -390,7 +402,7 @@ function trigger_taxonomy($op, $type, $a $aids = _trigger_get_hook_aids('taxonomy', $op); $context = array( 'hook' => 'taxonomy', - 'op' => $op + 'op' => $op, ); foreach ($aids as $aid => $action_info) { $taxonomy_object = (object) $array; @@ -404,6 +416,7 @@ function trigger_taxonomy($op, $type, $a * * @param $type * One of 'node', 'user', 'comment'. + * * @return * Array keyed by action ID. */ @@ -429,3 +442,4 @@ function trigger_options($type = 'all') function trigger_actions_delete($aid) { db_query("DELETE FROM {trigger_assignments} WHERE aid = '%s'", $aid); } + Index: modules/update/update.compare.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.compare.inc,v retrieving revision 1.4 diff -u -p -r1.4 update.compare.inc --- modules/update/update.compare.inc 17 Jan 2008 12:03:21 -0000 1.4 +++ modules/update/update.compare.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ t('This project has been labeled insecure by the Drupal security team, and is no longer available for download. Immediately disabling everything included by this project is strongly recommended!'), ); break; + case 'unpublished': case 'revoked': $projects[$project]['status'] = UPDATE_REVOKED; @@ -265,6 +267,7 @@ function update_calculate_project_data($ 'data' => t('This project has been revoked, and is no longer available for download. Disabling everything included by this project is strongly recommended!'), ); break; + case 'unsupported': $projects[$project]['status'] = UPDATE_NOT_SUPPORTED; if (empty($projects[$project]['extra'])) { @@ -276,6 +279,7 @@ function update_calculate_project_data($ 'data' => t('This project is no longer supported, and is no longer available for download. Disabling everything included by this project is strongly recommended!'), ); break; + default: // Assume anything else (e.g. 'published') is valid and we should // perform the rest of the logic in this function. @@ -346,7 +350,8 @@ function update_calculate_project_data($ // First, if this is the existing release, check a few conditions. if ($projects[$project]['existing_version'] == $version) { if (isset($release['terms']['Release type']) && - in_array('Insecure', $release['terms']['Release type'])) { + in_array('Insecure', $release['terms']['Release type']) + ) { $projects[$project]['status'] = UPDATE_NOT_SECURE; } elseif ($release['status'] == 'unpublished') { @@ -361,7 +366,8 @@ function update_calculate_project_data($ ); } elseif (isset($release['terms']['Release type']) && - in_array('Unsupported', $release['terms']['Release type'])) { + in_array('Unsupported', $release['terms']['Release type']) + ) { $projects[$project]['status'] = UPDATE_NOT_SUPPORTED; if (empty($projects[$project]['extra'])) { $projects[$project]['extra'] = array(); @@ -376,16 +382,20 @@ function update_calculate_project_data($ // Otherwise, ignore unpublished, insecure, or unsupported releases. if ($release['status'] == 'unpublished' || - (isset($release['terms']['Release type']) && - (in_array('Insecure', $release['terms']['Release type']) || - in_array('Unsupported', $release['terms']['Release type'])))) { + (isset($release['terms']['Release type']) && + (in_array('Insecure', $release['terms']['Release type']) || + in_array('Unsupported', $release['terms']['Release type']) + ) + ) + ) { continue; } // See if this is a higher major version than our target and yet still // supported. If so, record it as an "Also available" release. if ($release['version_major'] > $target_major && - in_array($release['version_major'], $supported_majors)) { + in_array($release['version_major'], $supported_majors) + ) { if (!isset($available[$project]['also'])) { $available[$project]['also'] = array(); } @@ -405,23 +415,26 @@ function update_calculate_project_data($ // Look for the 'latest version' if we haven't found it yet. Latest is // defined as the most recent version for the target major version. if (!isset($available[$project]['latest_version']) - && $release['version_major'] == $target_major) { + && $release['version_major'] == $target_major + ) { $available[$project]['latest_version'] = $version; } // Look for the development snapshot release for this branch. if (!isset($available[$project]['dev_version']) - && $release['version_major'] == $target_major - && isset($release['version_extra']) - && $release['version_extra'] == 'dev') { + && $release['version_major'] == $target_major + && isset($release['version_extra']) + && $release['version_extra'] == 'dev' + ) { $available[$project]['dev_version'] = $version; } // Look for the 'recommended' version if we haven't found it yet (see // phpdoc at the top of this function for the definition). if (!isset($available[$project]['recommended']) - && $release['version_major'] == $target_major - && isset($release['version_patch'])) { + && $release['version_major'] == $target_major + && isset($release['version_patch']) + ) { if ($patch != $release['version_patch']) { $patch = $release['version_patch']; $version_patch_changed = $release['version']; @@ -455,7 +468,8 @@ function update_calculate_project_data($ // See if this release is a security update. if (isset($release['terms']['Release type']) - && in_array('Security update', $release['terms']['Release type'])) { + && in_array('Security update', $release['terms']['Release type']) + ) { $projects[$project]['security updates'][] = $release; } } @@ -472,7 +486,6 @@ function update_calculate_project_data($ // // Check to see if we need an update or not. // - if (!empty($projects[$project]['security updates'])) { // If we found security updates, that always trumps any other status. $projects[$project]['status'] = UPDATE_NOT_SECURE; @@ -545,3 +558,4 @@ function update_calculate_project_data($ drupal_alter('update_status', $projects); return $projects; } + Index: modules/update/update.fetch.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.fetch.inc,v retrieving revision 1.5 diff -u -p -r1.5 update.fetch.inc --- modules/update/update.fetch.inc 20 Dec 2007 08:57:55 -0000 1.5 +++ modules/update/update.fetch.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ $project) { $url = _update_build_fetch_url($project, $site_key); @@ -107,7 +108,8 @@ function _update_cron_notify() { foreach (array('core', 'contrib') as $report_type) { $type = 'update_'. $report_type; if (isset($status[$type]['severity']) - && $status[$type]['severity'] == REQUIREMENT_ERROR) { + && $status[$type]['severity'] == REQUIREMENT_ERROR + ) { $params[$report_type] = $status[$type]['reason']; } } @@ -133,12 +135,12 @@ function _update_cron_notify() { * This uses PHP4's lame XML parsing, but it works. */ class update_xml_parser { - var $projects = array(); - var $current_project; - var $current_release; - var $current_term; - var $current_tag; - var $current_object; + var$projects = array(); + var$current_project; + var$current_release; + var$current_term; + var$current_tag; + var$current_object; /** * Parse an array of XML data files. @@ -163,11 +165,13 @@ class update_xml_parser { $this->current_project = array(); $this->current_object = &$this->current_project; break; + case 'RELEASE': unset($this->current_object); $this->current_release = array(); $this->current_object = &$this->current_release; break; + case 'TERM': unset($this->current_object); $this->current_term = array(); @@ -183,13 +187,16 @@ class update_xml_parser { $this->projects[$this->current_project['short_name']] = $this->current_project; $this->current_project = array(); break; + case 'RELEASE': unset($this->current_object); $this->current_project['releases'][$this->current_release['version']] = $this->current_release; break; + case 'RELEASES': $this->current_object = &$this->current_project; break; + case 'TERM': unset($this->current_object); $term_name = $this->current_term['name']; @@ -201,9 +208,11 @@ class update_xml_parser { } $this->current_release['terms'][$term_name][] = $this->current_term['value']; break; + case 'TERMS': $this->current_object = &$this->current_release; break; + default: $this->current_object[strtolower($this->current_tag)] = trim($this->current_object[strtolower($this->current_tag)]); $this->current_tag = ''; @@ -222,3 +231,4 @@ class update_xml_parser { } } } + Index: modules/update/update.install =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.install,v retrieving revision 1.3 diff -u -p -r1.3 update.install --- modules/update/update.install 10 Oct 2007 11:39:34 -0000 1.3 +++ modules/update/update.install 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ '. t('Here you can find information about available updates for your installed modules and themes. Note that each module or theme is part of a "project", which may or may not have the same name, and might include multiple modules or themes within it.') .'

'; $output .= '

'. t('To extend the functionality or to change the look of your site, a number of contributed modules and themes are available.', array('@modules' => 'http://drupal.org/project/modules', '@themes' => 'http://drupal.org/project/themes')) .'

'; return $output; + case 'admin/build/themes': case 'admin/build/modules': include_once './includes/install.inc'; @@ -94,19 +95,20 @@ function update_help($path, $arg) { // Otherwise, if we're on *any* admin page and there's a security // update missing, print an error message about it. if (arg(0) == 'admin' && strpos($path, '#') === FALSE - && user_access('administer site configuration')) { + && user_access('administer site configuration') + ) { include_once './includes/install.inc'; $status = update_requirements('runtime'); foreach (array('core', 'contrib') as $report_type) { $type = 'update_'. $report_type; if (isset($status[$type]) - && isset($status[$type]['reason']) - && $status[$type]['reason'] === UPDATE_NOT_SECURE) { + && isset($status[$type]['reason']) + && $status[$type]['reason'] === UPDATE_NOT_SECURE + ) { drupal_set_message($status[$type]['description'], 'error'); } } } - } } @@ -255,21 +257,26 @@ function _update_requirement_check($proj case UPDATE_NOT_SECURE: $requirement['value'] = t('Not secure!'); break; + case UPDATE_REVOKED: $requirement['value'] = t('Revoked!'); break; + case UPDATE_NOT_SUPPORTED: $requirement['value'] = t('Unsupported release'); break; + case UPDATE_NOT_CURRENT: $requirement['value'] = t('Out of date'); $requirement['severity'] = variable_get('update_notification_threshold', 'all') == 'all' ? REQUIREMENT_ERROR : REQUIREMENT_WARNING; break; + case UPDATE_UNKNOWN: case UPDATE_NOT_CHECKED: $requirement['value'] = isset($project['reason']) ? $project['reason'] : t('Can not determine status'); $requirement['severity'] = REQUIREMENT_WARNING; break; + default: $requirement['value'] = t('Up to date'); } @@ -300,7 +307,7 @@ function update_cron() { * @see update_invalidate_cache() */ function update_form_alter(&$form, $form_state, $form_id) { - if ($form_id == 'system_modules' || $form_id == 'system_themes' ) { + if ($form_id == 'system_modules' || $form_id == 'system_themes') { $form['#submit'][] = 'update_invalidate_cache'; } } @@ -311,9 +318,9 @@ function update_form_alter(&$form, $form function _update_no_data() { $destination = drupal_get_destination(); return t('No information is available about potential new releases for currently installed modules and themes. To check for updates, you may need to run cron or you can check manually. Please note that checking for available updates can take a long time, so please be patient.', array( - '@run_cron' => url('admin/reports/status/run-cron', array('query' => $destination)), - '@check_manually' => url('admin/reports/updates/check', array('query' => $destination)), - )); + '@run_cron' => url('admin/reports/status/run-cron', array('query' => $destination)), + '@check_manually' => url('admin/reports/updates/check', array('query' => $destination)), + )); } /** @@ -342,8 +349,8 @@ 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); - $projects = update_get_projects(); + $last_check = variable_get('update_last_check', 0); + $projects = update_get_projects(); foreach ($projects as $key => $project) { if ($project['info']['_info_file_ctime'] > $last_check) { $needs_refresh = TRUE; @@ -351,7 +358,8 @@ function update_get_available($refresh = } } if (!$needs_refresh && ($cache = cache_get('update_info', 'cache_update')) - && $cache->expire > time()) { + && $cache->expire > time() + ) { $available = $cache->data; } elseif ($needs_refresh || $refresh) { @@ -435,6 +443,7 @@ function update_mail($key, &$message, $p * Boolean that controls if a link to the updates report should be added. * @param $language * An optional language object to use. + * * @return * The properly translated error message for the given key. */ @@ -511,3 +520,4 @@ function _update_project_status_sort($a, $b_status = $b['status'] > 0 ? $b['status'] : (-10 * $b['status']); return $a_status - $b_status; } + Index: modules/update/update.report.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.report.inc,v retrieving revision 1.8 diff -u -p -r1.8 update.report.inc --- modules/update/update.report.inc 10 Jan 2008 14:14:54 -0000 1.8 +++ modules/update/update.report.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ '. t('Security update required!') .''; break; + case UPDATE_REVOKED: $row .= ''. t('Revoked!') .''; break; + case UPDATE_NOT_SUPPORTED: $row .= ''. t('Not supported!') .''; break; + case UPDATE_NOT_CURRENT: $row .= ''. t('Update available') .''; break; + case UPDATE_CURRENT: $row .= ''. t('Up to date') .''; break; + default: $row .= check_plain($project['reason']); break; @@ -124,14 +132,16 @@ function theme_update_report($data) { // Apply an extra class if we're displaying both a recommended // version and anything else for an extra visual hint. if ($project['recommended'] != $project['latest_version'] - || !empty($project['also']) - || ($project['install_type'] == 'dev' - && isset($project['dev_version']) - && $project['latest_version'] != $project['dev_version'] - && $project['recommended'] != $project['dev_version']) - || (isset($project['security updates'][0]) - && $project['recommended'] != $project['security updates'][0]) - ) { + || !empty($project['also']) + || ($project['install_type'] == 'dev' + && isset($project['dev_version']) + && $project['latest_version'] != $project['dev_version'] + && $project['recommended'] != $project['dev_version'] + ) + || (isset($project['security updates'][0]) + && $project['recommended'] != $project['security updates'][0] + ) + ) { $version_class .= ' version-recommended-strong'; } $row .= theme('update_version', $project['releases'][$project['recommended']], t('Recommended version:'), $version_class); @@ -149,9 +159,10 @@ function theme_update_report($data) { $row .= theme('update_version', $project['releases'][$project['latest_version']], t('Latest version:'), 'version-latest'); } if ($project['install_type'] == 'dev' - && $project['status'] != UPDATE_CURRENT - && isset($project['dev_version']) - && $project['recommended'] != $project['dev_version']) { + && $project['status'] != UPDATE_CURRENT + && isset($project['dev_version']) + && $project['recommended'] != $project['dev_version'] + ) { $row .= theme('update_version', $project['releases'][$project['dev_version']], t('Development version:'), 'version-latest'); } } @@ -162,8 +173,8 @@ function theme_update_report($data) { } } - $row .= "\n"; // versions div. - + // versions div. + $row .= "\n"; $row .= "
\n"; if (!empty($project['extra'])) { $row .= '
'."\n"; @@ -173,7 +184,8 @@ function theme_update_report($data) { $row .= theme('placeholder', $value['data']); $row .= "
\n"; } - $row .= "
\n"; // extra div. + // extra div. + $row .= "\n"; } $row .= '
'; @@ -181,8 +193,8 @@ function theme_update_report($data) { $row .= t('Includes: %includes', array('%includes' => implode(', ', $project['includes']))); $row .= "
\n"; - $row .= "\n"; // info div. - + // info div. + $row .= "\n"; if (!isset($rows[$project['project_type']])) { $rows[$project['project_type']] = array(); } @@ -239,3 +251,4 @@ function theme_update_version($version, $output .= "\n"; return $output; } + Index: modules/update/update.settings.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.settings.inc,v retrieving revision 1.3 diff -u -p -r1.3 update.settings.inc --- modules/update/update.settings.inc 20 Oct 2007 21:57:50 -0000 1.3 +++ modules/update/update.settings.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ t('All newer versions'), 'security' => t('Only security updates'), ), - '#description' => t('If there are updates available of Drupal core or any of your installed modules and themes, your site will print an error message on the status report, the modules page, and the themes page. You can choose to only see these error messages if a security update is available, or to be notified about any newer versions.', array('@status_report' => url('admin/reports/status'), '@modules_page' => url('admin/build/modules'), '@themes_page' => url('admin/build/themes'))) + '#description' => t('If there are updates available of Drupal core or any of your installed modules and themes, your site will print an error message on the status report, the modules page, and the themes page. You can choose to only see these error messages if a security update is available, or to be notified about any newer versions.', array('@status_report' => url('admin/reports/status'), '@modules_page' => url('admin/build/modules'), '@themes_page' => url('admin/build/themes'))), ); $form = system_settings_form($form); @@ -106,3 +107,4 @@ function update_settings_submit($form, $ } system_settings_form_submit($form, $form_state); } + Index: modules/upload/upload.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.admin.inc,v retrieving revision 1.7 diff -u -p -r1.7 upload.admin.inc --- modules/upload/upload.admin.inc 10 Jan 2008 20:22:57 -0000 1.7 +++ modules/upload/upload.admin.inc 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ format_size(file_upload_max_size()))) .'
'; - $more_info = t("Depending on your server environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory."); + $exceed_max_msg = t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))) .'
'; + $more_info = t("Depending on your server environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory."); if (!is_numeric($default_uploadsize) || ($default_uploadsize <= 0)) { form_set_error('upload_uploadsize_default', t('The %role file size limit must be a number and greater than zero.', array('%role' => t('default')))); @@ -71,7 +72,7 @@ function upload_admin_settings() { '#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'))), - '#field_suffix' => ''. t('WIDTHxHEIGHT') .'' + '#field_suffix' => ''. t('WIDTHxHEIGHT') .'', ); $form['settings_general']['upload_list_default'] = array( '#type' => 'select', @@ -150,3 +151,4 @@ function upload_admin_settings() { return system_settings_form($form); } + Index: modules/upload/upload.install =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.install,v retrieving revision 1.6 diff -u -p -r1.6 upload.install --- modules/upload/upload.install 18 Dec 2007 12:59:22 -0000 1.6 +++ modules/upload/upload.install 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ '. t('Users with the upload files permission can upload attachments to posts. Uploads may be enabled for specific content types on the content types settings page. Each user role can be customized to limit or control the file size of uploads, or the maximum dimension of image files.') .'

'; $output .= '

'. t('For more information, see the online handbook entry for Upload module.', array('@upload' => 'http://drupal.org/handbook/modules/upload/')) .'

'; return $output; + case 'admin/settings/upload': return '

'. t('Users with the upload files permission can upload attachments. Users with the view uploaded files permission can view uploaded attachments. You can choose which post types can take attachments on the content types settings page.', array('@permissions' => url('admin/user/permissions'), '@types' => url('admin/settings/types'))) .'

'; } @@ -65,7 +67,7 @@ function upload_link($type, $node = NULL 'title' => format_plural($num_files, '1 attachment', '@count attachments'), 'href' => "node/$node->nid", 'attributes' => array('title' => t('Read full article to view attachments.')), - 'fragment' => 'attachments' + 'fragment' => 'attachments', ); } } @@ -105,6 +107,7 @@ function upload_menu_alter(&$items) { * * @param $user * A Drupal user object. + * * @return * An associative array with the following keys: * 'extensions' @@ -118,18 +121,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); + $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')); 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')); $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('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('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)); @@ -146,7 +149,7 @@ function _upload_file_limits($user) { */ function upload_file_download($file) { if (!user_access('view uploaded files')) { - return -1; + return - 1; } $file = file_create_path($file); $result = db_query("SELECT f.* FROM {files} f INNER JOIN {upload} u ON f.fid = u.fid WHERE filepath = '%s'", $file); @@ -251,7 +254,7 @@ function upload_form_alter(&$form, $form $temp = file_directory_temp(); // Note: pass by reference if (!file_check_directory($path, FILE_CREATE_DIRECTORY) || !file_check_directory($temp, FILE_CREATE_DIRECTORY)) { - $form['attachments']['#description'] = t('File attachments are disabled. The file directories have not been properly configured.'); + $form['attachments']['#description'] = t('File attachments are disabled. The file directories have not been properly configured.'); if (user_access('administer site configuration')) { $form['attachments']['#description'] .= ' '. t('Please visit the file system configuration page.', array('@admin-file-system' => url('admin/settings/file-system'))); } @@ -273,7 +276,6 @@ function upload_form_alter(&$form, $form */ function upload_nodeapi(&$node, $op, $teaser) { switch ($op) { - case 'load': $output = ''; if (variable_get("upload_$node->type", 1) == 1) { @@ -342,9 +344,9 @@ function upload_nodeapi(&$node, $op, $te 'attributes' => array( 'url' => file_create_url($file->filepath), 'length' => $file->filesize, - 'type' => $file->filemime - ) - ) + 'type' => $file->filemime, + ), + ), ); } } @@ -363,8 +365,8 @@ function theme_upload_attachments($files foreach ($files as $file) { $file = (object)$file; if ($file->list && empty($file->remove)) { - $href = file_create_url($file->filepath); - $text = $file->description ? $file->description : $file->filename; + $href = file_create_url($file->filepath); + $text = $file->description ? $file->description : $file->filename; $rows[] = array(l($text, $href), format_size($file->filesize)); } } @@ -378,6 +380,7 @@ function theme_upload_attachments($files * * @param $uid * The integer user id of a user. + * * @return * The amount of disk space used by the user in bytes. */ @@ -489,10 +492,10 @@ function _upload_form($node) { $file = (object)$file; $description = file_create_url($file->filepath); $description = "". check_plain($description) .""; - $form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => !empty($file->description) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description ); + $form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => !empty($file->description) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description); $form['files'][$key]['size'] = array('#value' => format_size($file->filesize)); $form['files'][$key]['remove'] = array('#type' => 'checkbox', '#default_value' => !empty($file->remove)); - $form['files'][$key]['list'] = array('#type' => 'checkbox', '#default_value' => $file->list); + $form['files'][$key]['list'] = array('#type' => 'checkbox', '#default_value' => $file->list); // If the file was uploaded this page request, set value. this fixes the // problem formapi has recognizing new checkboxes. see comments in // _upload_prepare. @@ -500,11 +503,11 @@ function _upload_form($node) { $form['files'][$key]['list']['#value'] = variable_get('upload_list_default', 1); } $form['files'][$key]['weight'] = array('#type' => 'weight', '#delta' => count($node->files), '#default_value' => $file->weight); - $form['files'][$key]['filename'] = array('#type' => 'value', '#value' => $file->filename); - $form['files'][$key]['filepath'] = array('#type' => 'value', '#value' => $file->filepath); - $form['files'][$key]['filemime'] = array('#type' => 'value', '#value' => $file->filemime); - $form['files'][$key]['filesize'] = array('#type' => 'value', '#value' => $file->filesize); - $form['files'][$key]['fid'] = array('#type' => 'value', '#value' => $file->fid); + $form['files'][$key]['filename'] = array('#type' => 'value', '#value' => $file->filename); + $form['files'][$key]['filepath'] = array('#type' => 'value', '#value' => $file->filepath); + $form['files'][$key]['filemime'] = array('#type' => 'value', '#value' => $file->filemime); + $form['files'][$key]['filesize'] = array('#type' => 'value', '#value' => $file->filesize); + $form['files'][$key]['fid'] = array('#type' => 'value', '#value' => $file->fid); } } @@ -638,8 +641,8 @@ function upload_js() { ); drupal_alter('form', $form, array(), 'upload_js'); $form_state = array('submitted' => FALSE); - $form = form_builder('upload_js', $form, $form_state); - $output = theme('status_messages') . drupal_render($form); + $form = form_builder('upload_js', $form, $form_state); + $output = theme('status_messages') . drupal_render($form); // We send the updated file attachments form. // Don't call drupal_json(). ahah.js uses an iframe and @@ -647,3 +650,4 @@ function upload_js() { print drupal_to_js(array('status' => TRUE, 'data' => $output)); exit; } + Index: modules/user/user-picture.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user-picture.tpl.php,v retrieving revision 1.2 diff -u -p -r1.2 user-picture.tpl.php --- modules/user/user-picture.tpl.php 7 Aug 2007 08:39:36 -0000 1.2 +++ modules/user/user-picture.tpl.php 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ -
- -
+?>
+
+ Index: modules/user/user-profile-category.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user-profile-category.tpl.php,v retrieving revision 1.2 diff -u -p -r1.2 user-profile-category.tpl.php --- modules/user/user-profile-category.tpl.php 7 Aug 2007 08:39:36 -0000 1.2 +++ modules/user/user-profile-category.tpl.php 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ - -

+

- > - - + + Index: modules/user/user-profile-item.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user-profile-item.tpl.php,v retrieving revision 1.2 diff -u -p -r1.2 user-profile-item.tpl.php --- modules/user/user-profile-item.tpl.php 7 Aug 2007 08:39:36 -0000 1.2 +++ modules/user/user-profile-item.tpl.php 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ -> +?>> > + Index: modules/user/user-profile.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user-profile.tpl.php,v retrieving revision 1.2 diff -u -p -r1.2 user-profile.tpl.php --- modules/user/user-profile.tpl.php 7 Aug 2007 08:39:36 -0000 1.2 +++ modules/user/user-profile.tpl.php 20 Jan 2008 06:08:09 -0000 @@ -1,6 +1,7 @@ -
- -
+?>
+
+ Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.18 diff -u -p -r1.18 user.admin.inc --- modules/user/user.admin.inc 16 Jan 2008 22:54:41 -0000 1.18 +++ modules/user/user.admin.inc 20 Jan 2008 06:08:10 -0000 @@ -1,11 +1,11 @@ 'fieldset', '#title' => t('Show only users where'), @@ -47,7 +48,7 @@ function user_filter_form() { list($type, $value) = $filter; // Merge an array of arrays into one if necessary. $options = $type == 'permission' ? call_user_func_array('array_merge', $filters[$type]['options']) : $filters[$type]['options']; - $params = array('%property' => $filters[$type]['title'] , '%value' => $options[$value]); + $params = array('%property' => $filters[$type]['title'], '%value' => $options[$value]); if ($i++ > 0) { $form['filters']['current'][] = array('#value' => t('and where %property is %value', $params)); } @@ -95,7 +96,8 @@ function user_filter_form_submit($form, $op = $form_state['values']['op']; $filters = user_filters(); switch ($op) { - case t('Filter'): case t('Refine'): + case t('Filter'): + case t('Refine'): if (isset($form_state['values']['filter'])) { $filter = $form_state['values']['filter']; // Merge an array of arrays into one if necessary. @@ -105,12 +107,15 @@ function user_filter_form_submit($form, } } break; + case t('Undo'): array_pop($_SESSION['user_overview_filter']); break; + case t('Reset'): $_SESSION['user_overview_filter'] = array(); break; + case t('Update'): return; } @@ -136,13 +141,13 @@ function user_admin_account() { t('Roles'), array('data' => t('Member for'), 'field' => 'u.created', 'sort' => 'desc'), array('data' => t('Last access'), 'field' => 'u.access'), - t('Operations') + t('Operations'), ); $sql = 'SELECT DISTINCT u.uid, u.name, u.status, u.created, u.access FROM {users} u LEFT JOIN {users_roles} ur ON u.uid = ur.uid '. $filter['join'] .' WHERE u.uid != 0 '. $filter['where']; $sql .= tablesort_sql($header); - $query_count = 'SELECT COUNT(DISTINCT u.uid) FROM {users} u LEFT JOIN {users_roles} ur ON u.uid = ur.uid '. $filter['join'] .' WHERE u.uid != 0 '. $filter['where']; - $result = pager_query($sql, 50, 0, $query_count, $filter['args']); + $query_count = 'SELECT COUNT(DISTINCT u.uid) FROM {users} u LEFT JOIN {users_roles} ur ON u.uid = ur.uid '. $filter['join'] .' WHERE u.uid != 0 '. $filter['where']; + $result = pager_query($sql, 50, 0, $query_count, $filter['args']); $form['options'] = array( '#type' => 'fieldset', @@ -166,13 +171,13 @@ function user_admin_account() { $destination = drupal_get_destination(); - $status = array(t('blocked'), t('active')); - $roles = user_roles(TRUE); - $accounts = array(); + $status = array(t('blocked'), t('active')); + $roles = user_roles(TRUE); + $accounts = array(); while ($account = db_fetch_object($result)) { $accounts[$account->uid] = ''; $form['name'][$account->uid] = array('#value' => theme('username', $account)); - $form['status'][$account->uid] = array('#value' => $status[$account->status]); + $form['status'][$account->uid] = array('#value' => $status[$account->status]); $users_roles = array(); $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = %d', $account->uid); while ($user_role = db_fetch_object($roles_result)) { @@ -181,12 +186,12 @@ function user_admin_account() { asort($users_roles); $form['roles'][$account->uid][0] = array('#value' => theme('item_list', $users_roles)); $form['member_for'][$account->uid] = array('#value' => format_interval(time() - $account->created)); - $form['last_access'][$account->uid] = array('#value' => $account->access ? t('@time ago', array('@time' => format_interval(time() - $account->access))) : t('never')); + $form['last_access'][$account->uid] = array('#value' => $account->access ? t('@time ago', array('@time' => format_interval(time() - $account->access))) : t('never')); $form['operations'][$account->uid] = array('#value' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination))); } $form['accounts'] = array( '#type' => 'checkboxes', - '#options' => $accounts + '#options' => $accounts, ); $form['pager'] = array('#value' => theme('pager', NULL, 50, 0)); @@ -270,7 +275,7 @@ function user_admin_settings() { '#title' => t('Welcome, no approval required'), '#collapsible' => TRUE, '#collapsed' => (variable_get('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 + '#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( '#type' => 'textfield', @@ -830,6 +835,7 @@ function user_admin_access_check_submit( drupal_set_message(t('The username %name is allowed.', array('%name' => $form_state['values']['test']))); } break; + case 'mail': if (drupal_is_denied('mail', $form_state['values']['test'])) { drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => $form_state['values']['test']))); @@ -838,6 +844,7 @@ function user_admin_access_check_submit( drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => $form_state['values']['test']))); } break; + case 'host': if (drupal_is_denied('host', $form_state['values']['test'])) { drupal_set_message(t('The hostname %host is not allowed.', array('%host' => $form_state['values']['test']))); @@ -846,6 +853,7 @@ function user_admin_access_check_submit( drupal_set_message(t('The hostname %host is allowed.', array('%host' => $form_state['values']['test']))); } break; + default: break; } @@ -859,16 +867,17 @@ function user_admin_access_check_submit( */ function user_admin_access_delete_confirm($form_state, $aid = 0) { $access_types = array('user' => t('username'), 'mail' => t('e-mail'), 'host' => t('host')); - $edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid)); + $edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid)); - $form = array(); - $form['aid'] = array('#type' => 'hidden', '#value' => $aid); - $output = confirm_form($form, - t('Are you sure you want to delete the @type rule for %rule?', array('@type' => $access_types[$edit->type], '%rule' => $edit->mask)), - 'admin/user/rules', - t('This action cannot be undone.'), - t('Delete'), - t('Cancel')); + $form = array(); + $form['aid'] = array('#type' => 'hidden', '#value' => $aid); + $output = confirm_form($form, + t('Are you sure you want to delete the @type rule for %rule?', array('@type' => $access_types[$edit->type], '%rule' => $edit->mask)), + 'admin/user/rules', + t('This action cannot be undone.'), + t('Delete'), + t('Cancel') + ); return $output; } @@ -883,10 +892,10 @@ function user_admin_access_delete_confir * Menu callback: list all access rules */ function user_admin_access() { - $header = array(array('data' => t('Access type'), 'field' => 'status'), array('data' => t('Rule type'), 'field' => 'type'), array('data' => t('Mask'), 'field' => 'mask'), array('data' => t('Operations'), 'colspan' => 2)); - $result = db_query("SELECT aid, type, status, mask FROM {access}". tablesort_sql($header)); + $header = array(array('data' => t('Access type'), 'field' => 'status'), array('data' => t('Rule type'), 'field' => 'type'), array('data' => t('Mask'), 'field' => 'mask'), array('data' => t('Operations'), 'colspan' => 2)); + $result = db_query("SELECT aid, type, status, mask FROM {access}". tablesort_sql($header)); $access_types = array('user' => t('username'), 'mail' => t('e-mail'), 'host' => t('host')); - $rows = array(); + $rows = array(); while ($rule = db_fetch_object($result)) { $rows[] = array($rule->status ? t('allow') : t('deny'), $access_types[$rule->type], $rule->mask, l(t('edit'), 'admin/user/rules/edit/'. $rule->aid), l(t('delete'), 'admin/user/rules/delete/'. $rule->aid)); } @@ -910,7 +919,7 @@ function theme_user_admin_account($form) t('Roles'), array('data' => t('Member for'), 'field' => 'u.created', 'sort' => 'desc'), array('data' => t('Last access'), 'field' => 'u.access'), - t('Operations') + t('Operations'), ); $output = drupal_render($form['options']); @@ -1010,3 +1019,4 @@ function theme_user_filters($form) { return $output; } + Index: modules/user/user.install =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.install,v retrieving revision 1.5 diff -u -p -r1.5 user.install --- modules/user/user.install 8 Jan 2008 07:46:41 -0000 1.5 +++ modules/user/user.install 20 Jan 2008 06:08:10 -0000 @@ -1,6 +1,7 @@ uid))); if (!$success) { @@ -283,7 +285,8 @@ function user_save($account, $array = ar user_module_invoke('after_update', $array, $user, $category); } else { - if (!isset($array['created'])) { // Allow 'created' to be set by the caller + if (!isset($array['created'])) { + // Allow 'created' to be set by the caller $array['created'] = time(); } // Consider users created by an administrator as already logged in, so @@ -300,20 +303,27 @@ function user_save($account, $array = ar case 'pass': $fields[] = $key; $values[] = md5($value); - $s[] = "'%s'"; + $s[] = "'%s'"; break; - case 'mode': case 'sort': case 'timezone': - case 'threshold': case 'created': case 'access': - case 'login': case 'status': + + case 'mode': + case 'sort': + case 'timezone': + case 'threshold': + case 'created': + case 'access': + case 'login': + case 'status': $fields[] = $key; $values[] = $value; - $s[] = "%d"; + $s[] = "%d"; break; + default: if (substr($key, 0, 4) !== 'auth' && in_array($key, $user_fields)) { $fields[] = $key; $values[] = $value; - $s[] = "'%s'"; + $s[] = "'%s'"; } break; } @@ -324,7 +334,7 @@ function user_save($account, $array = ar // must abort to avoid overwirting their account. return FALSE; } - + // Build the initial user object. $array['uid'] = db_last_insert_id('users', 'uid'); $user = user_load(array('uid' => $array['uid'])); @@ -377,16 +387,16 @@ function user_validate_name($name) { if (substr($name, -1) == ' ') return t('The username cannot end with a space.'); if (strpos($name, ' ') !== FALSE) return t('The username cannot contain multiple spaces in a row.'); if (ereg("[^\x80-\xF7 [:alnum:]@_.-]", $name)) return t('The username contains an illegal character.'); - if (preg_match('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP - '\x{AD}'. // Soft-hyphen - '\x{2000}-\x{200F}'. // Various space characters - '\x{2028}-\x{202F}'. // Bidirectional text overrides - '\x{205F}-\x{206F}'. // Various text hinting characters - '\x{FEFF}'. // Byte order mark - '\x{FF01}-\x{FF60}'. // Full-width latin - '\x{FFF9}-\x{FFFD}'. // Replacement characters - '\x{0}]/u', // NULL byte - $name)) { + if (preg_match('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP + '\x{AD}'. // Soft-hyphen + '\x{2000}-\x{200F}'. // Various space characters + '\x{2028}-\x{202F}'. // Bidirectional text overrides + '\x{205F}-\x{206F}'. // Various text hinting characters + '\x{FEFF}'. // Byte order mark + '\x{FF01}-\x{FF60}'. // Full-width latin + '\x{FFF9}-\x{FFFD}'. // Replacement characters + '\x{0}]/u', // NULL byte + $name)) { return t('The username contains an illegal character.'); } if (strpos($name, '@') !== FALSE && !eregi('@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$', $name)) return t('The username is not a valid authentication ID.'); @@ -612,7 +622,7 @@ function user_user($type, &$edit, &$acco '#weight' => 5, '#title' => t('History'), ); - $account->content['summary']['member_for'] = array( + $account->content['summary']['member_for'] = array( '#type' => 'user_profile_item', '#title' => t('Member for'), '#value' => format_interval(time() - $account->created), @@ -740,7 +750,7 @@ function user_block($op = 'list', $delta while ($account = db_fetch_object($result)) { $items[] = $account; } - $output = theme('user_list', $items); + $output = theme('user_list', $items); $block['subject'] = t('Who\'s new'); $block['content'] = $output; @@ -754,11 +764,11 @@ function user_block($op = 'list', $delta // 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); + $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); - $items = array(); + $max_users = variable_get('user_block_max_list_count', 10); + $items = array(); while ($account = db_fetch_object($authenticated_users)) { if ($max_users > 0) { $items[] = $account; @@ -852,15 +862,14 @@ function user_register_access() { } function user_view_access($account) { - return $account && $account->uid && - ( - // Always let users view their own profile. - ($GLOBALS['user']->uid == $account->uid) || - // Administrators can view all accounts. - user_access('administer users') || - // The user is not blocked and logged in at least once. - ($account->access && $account->status && user_access('access user profiles')) - ); + return $account && $account->uid && ( + // Always let users view their own profile. + ($GLOBALS['user']->uid == $account->uid) || + // Administrators can view all accounts. + user_access('administer users') || + // The user is not blocked and logged in at least once. + ($account->access && $account->status && user_access('access user profiles')) + ); } function user_edit_access($account) { @@ -1174,7 +1183,7 @@ function user_page_title($account) { * array of modules and DA names. Called at external login. */ function user_get_authmaps($authname = NULL) { - $result = db_query("SELECT authname, module FROM {authmap} WHERE authname = '%s'", $authname); + $result = db_query("SELECT authname, module FROM {authmap} WHERE authname = '%s'", $authname); $authmaps = array(); $has_rows = FALSE; while ($authmap = db_fetch_object($result)) { @@ -1253,6 +1262,7 @@ function user_login(&$form_state, $msg = * @see user_login_name_validate() * @see user_login_authenticate_validate() * @see user_login_final_validate() + * * @return array * A simple list of validate functions. */ @@ -1311,7 +1321,8 @@ function user_authenticate($form_values // Name and pass keys are required. if (!empty($form_values['name']) && !empty($form_values['pass']) && - $account = user_load(array('name' => $form_values['name'], 'pass' => trim($form_values['pass']), 'status' => 1))) { + $account = user_load(array('name' => $form_values['name'], 'pass' => trim($form_values['pass']), 'status' => 1)) + ) { $user = $account; user_authenticate_finalize($form_values); return $user; @@ -1571,33 +1582,47 @@ function _user_mail_text($key, $language switch ($key) { case 'register_no_approval_required_subject': return t('Account details for !username at !site', $variables, $langcode); + case 'register_no_approval_required_body': return t("!username,\n\nThank you for registering at !site. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team", $variables, $langcode); + case 'register_admin_created_subject': return t('An administrator created an account for you at !site', $variables, $langcode); + case 'register_admin_created_body': return t("!username,\n\nA site administrator at !site has created an account for you. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team", $variables, $langcode); + case 'register_pending_approval_subject': case 'pending_approval_admin_subject': return t('Account details for !username at !site (pending admin approval)', $variables, $langcode); + case 'register_pending_approval_body': return t("!username,\n\nThank you for registering at !site. Your application for an account is currently pending approval. Once it has been approved, you will receive another e-mail containing information about how to log in, set your password, and other details.\n\n\n-- !site team", $variables, $langcode); + case 'register_pending_approval_admin_body': return t("!username has applied for an account.\n\n!edit_uri", $variables, $langcode); + case 'password_reset_subject': return t('Replacement login information for !username at !site', $variables, $langcode); + case 'password_reset_body': return t("!username,\n\nA request to reset the password for your account has been made at !site.\n\nYou may now log in to !uri_brief by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.", $variables, $langcode); + case 'status_activated_subject': return t('Account details for !username at !site (approved)', $variables, $langcode); + case 'status_activated_body': return t("!username,\n\nYour account at !site has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\nOnce you have set your own password, you will be able to log in to !login_uri in the future using:\n\nusername: !username\n", $variables, $langcode); + case 'status_blocked_subject': return t('Account details for !username at !site (blocked)', $variables, $langcode); + case 'status_blocked_body': return t("!username,\n\nYour account on !site has been blocked.", $variables, $langcode); + case 'status_deleted_subject': return t('Account details for !username at !site (deleted)', $variables, $langcode); + case 'status_deleted_body': return t("!username,\n\nYour account on !site has been deleted.", $variables, $langcode); } @@ -1634,14 +1659,17 @@ function user_roles($membersonly = FALSE while ($role = db_fetch_object($result)) { switch ($role->rid) { // We only translate the built in role names + case DRUPAL_ANONYMOUS_RID: if (!$membersonly) { $roles[$role->rid] = t($role->name); } break; + case DRUPAL_AUTHENTICATED_RID: $roles[$role->rid] = t($role->name); break; + default: $roles[$role->rid] = $role->name; } @@ -1671,8 +1699,8 @@ function user_user_operations($form_stat if (user_access('administer permissions')) { $roles = user_roles(TRUE); - unset($roles[DRUPAL_AUTHENTICATED_RID]); // Can't edit authenticated role. - + // Can't edit authenticated role. + unset($roles[DRUPAL_AUTHENTICATED_RID]); $add_roles = array(); foreach ($roles as $key => $value) { $add_roles['add_role-'. $key] = $value; @@ -1764,6 +1792,7 @@ function user_multiple_role_edit($accoun } } break; + case 'remove_role': foreach ($accounts as $uid) { $account = user_load(array('uid' => (int)$uid)); @@ -1789,9 +1818,10 @@ function user_multiple_delete_confirm(&$ $form['operation'] = array('#type' => 'hidden', '#value' => 'delete'); return confirm_form($form, - t('Are you sure you want to delete these users?'), - 'admin/user/user', t('This action cannot be undone.'), - t('Delete all'), t('Cancel')); + t('Are you sure you want to delete these users?'), + 'admin/user/user', t('This action cannot be undone.'), + t('Delete all'), t('Cancel') + ); } function user_multiple_delete_confirm_submit($form, &$form_state) { @@ -1818,21 +1848,27 @@ function user_help($path, $arg) { $output .= '

'. t('A visitor accessing your website is assigned a unique ID, or session ID, which is stored in a cookie. The cookie does not contain personal information, but acts as a key to retrieve information from your site. Users should have cookies enabled in their web browser when using your site.') .'

'; $output .= '

'. t('For more information, see the online handbook entry for User module.', array('@user' => 'http://drupal.org/handbook/modules/user/')) .'

'; return $output; + case 'admin/user/user': return '

'. t('Drupal allows users to register, login, log out, maintain user profiles, etc. Users of the site may not use their own names to post content until they have signed up for a user account.') .'

'; + case 'admin/user/user/create': case 'admin/user/user/account/create': return '

'. t("This web page allows administrators to register new users. Users' e-mail addresses and usernames must be unique.") .'

'; + case 'admin/user/rules': return '

'. t('Set up username and e-mail address access rules for new and existing accounts (currently logged in accounts will not be logged out). If a username or e-mail address for an account matches any deny rule, but not an allow rule, then the account will not be allowed to be created or to log in. A host rule is effective for every page view, not just registrations.') .'

'; + case 'admin/user/permissions': return '

'. t('Permissions let you control what users can do on your site. Each user role (defined on the user roles page) has its own set of permissions. For example, you could give users classified as "Administrators" permission to "administer nodes" but deny this power to ordinary, "authenticated" users. You can use permissions to reveal new features to privileged users (those with subscriptions, for example). Permissions also allow trusted users to share the administrative burden of running a busy site.', array('@role' => url('admin/user/roles'))) .'

'; + case 'admin/user/roles': return t('

Roles allow you to fine tune the security and administration of Drupal. A role defines a group of users that have certain privileges as defined in user permissions. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the role names of the various roles. To delete a role choose "edit".

By default, Drupal comes with two user roles:

  • Anonymous user: this role is used for users that don\'t have a user account or that are not authenticated.
  • Authenticated user: this role is automatically granted to all logged in users.
', array('@permissions' => url('admin/user/permissions'))); + case 'admin/user/search': return '

'. t('Enter a simple pattern ("*" may be used as a wildcard match) to search for a username or e-mail address. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda@example.com".') .'

'; } @@ -1868,7 +1904,8 @@ function user_filters() { // Regular filters $filters = array(); $roles = user_roles(TRUE); - unset($roles[DRUPAL_AUTHENTICATED_RID]); // Don't list authorized role. + // Don't list authorized role. + unset($roles[DRUPAL_AUTHENTICATED_RID]); if (count($roles)) { $filters['role'] = array( 'title' => t('role'), @@ -1917,24 +1954,24 @@ function user_build_filter_query() { // This checks to see if this permission filter is an enabled permission for the authenticated role. // If so, then all users would be listed, and we can skip adding it to the filter query. if ($key == 'permission') { - $account = new stdClass(); - $account->uid = 'user_filter'; + $account = new stdClass(); + $account->uid = 'user_filter'; $account->roles = array(DRUPAL_AUTHENTICATED_RID => 1); if (user_access($value, $account)) { continue; } } $where[] = $filters[$key]['where']; - $args[] = $value; - $join[] = $filters[$key]['join']; + $args[] = $value; + $join[] = $filters[$key]['join']; } $where = !empty($where) ? 'AND '. implode(' AND ', $where) : ''; $join = !empty($join) ? ' '. implode(' ', array_unique($join)) : ''; return array('where' => $where, - 'join' => $join, - 'args' => $args, - ); + 'join' => $join, + 'args' => $args, + ); } /** @@ -1987,6 +2024,7 @@ function theme_user_signature($signature * least the fields 'uid', 'name', and 'mail'. * @param $language * Language object to generate the tokens with. + * * @return * Array of mappings from token names to values (for use with strtr()). */ @@ -2054,6 +2092,7 @@ function user_preferred_language($accoun * least the fields 'uid', 'name', and 'mail'. * @param $language * Optional language to use for the notification, overriding account language. + * * @return * The return value from drupal_mail_send(), if ends up being called. */ @@ -2063,8 +2102,8 @@ function _user_mail_notify($op, $account $notify = variable_get('user_mail_'. $op .'_notify', $default_notify); if ($notify) { $params['account'] = $account; - $language = $language ? $language : user_preferred_language($account); - $mail = drupal_mail('user', $op, $account->mail, $language, $params); + $language = $language ? $language : user_preferred_language($account); + $mail = drupal_mail('user', $op, $account->mail, $language, $params); if ($op == 'register_pending_approval') { // If a user registered requiring admin approval, notify the admin, too. // We use the site default language for this. @@ -2088,22 +2127,25 @@ function _user_password_dynamic_validati drupal_add_js(drupal_get_path('module', 'user') .'/user.js', 'module'); drupal_add_js(array( - 'password' => array( - 'strengthTitle' => t('Password strength:'), - 'lowStrength' => t('Low'), - 'mediumStrength' => t('Medium'), - 'highStrength' => t('High'), - 'tooShort' => t('It is recommended to choose a password that contains at least six characters. It should include numbers, punctuation, and both upper and lowercase letters.'), - 'needsMoreVariation' => t('The password does not include enough variation to be secure. Try:'), - 'addLetters' => t('Adding both upper and lowercase letters.'), - 'addNumbers' => t('Adding numbers.'), - 'addPunctuation' => t('Adding punctuation.'), - 'sameAsUsername' => t('It is recommended to choose a password different from the username.'), - 'confirmSuccess' => t('Yes'), - 'confirmFailure' => t('No'), - 'confirmTitle' => t('Passwords match:'), - 'username' => (isset($user->name) ? $user->name : ''))), - 'setting'); + 'password' => array( + 'strengthTitle' => t('Password strength:'), + 'lowStrength' => t('Low'), + 'mediumStrength' => t('Medium'), + 'highStrength' => t('High'), + 'tooShort' => t('It is recommended to choose a password that contains at least six characters. It should include numbers, punctuation, and both upper and lowercase letters.'), + 'needsMoreVariation' => t('The password does not include enough variation to be secure. Try:'), + 'addLetters' => t('Adding both upper and lowercase letters.'), + 'addNumbers' => t('Adding numbers.'), + 'addPunctuation' => t('Adding punctuation.'), + 'sameAsUsername' => t('It is recommended to choose a password different from the username.'), + 'confirmSuccess' => t('Yes'), + 'confirmFailure' => t('No'), + 'confirmTitle' => t('Passwords match:'), + 'username' => (isset($user->name) ? $user->name : ''), + ), + ), + 'setting' + ); $complete = TRUE; } } @@ -2122,16 +2164,16 @@ function user_hook_info() { 'runs when' => t("After a user's profile has been updated"), ), 'delete' => array( - 'runs when' => t('After a user has been deleted') + 'runs when' => t('After a user has been deleted'), ), 'login' => array( - 'runs when' => t('After a user has logged in') + 'runs when' => t('After a user has logged in'), ), 'logout' => array( - 'runs when' => t('After a user has logged out') + 'runs when' => t('After a user has logged out'), ), 'view' => array( - 'runs when' => t("When a user's profile is being viewed") + 'runs when' => t("When a user's profile is being viewed"), ), ), ), @@ -2198,8 +2240,8 @@ function user_register_submit($form, &$f global $base_url; $admin = user_access('administer users'); - $mail = $form_state['values']['mail']; - $name = $form_state['values']['name']; + $mail = $form_state['values']['mail']; + $name = $form_state['values']['name']; if (!variable_get('user_email_verification', TRUE) || $admin) { $pass = $form_state['values']['pass']; } @@ -2209,7 +2251,8 @@ function user_register_submit($form, &$f $notify = isset($form_state['values']['notify']) ? $form_state['values']['notify'] : NULL; $from = variable_get('site_mail', ini_get('sendmail_from')); if (isset($form_state['values']['roles'])) { - $roles = array_filter($form_state['values']['roles']); // Remove unset roles + // Remove unset roles + $roles = array_filter($form_state['values']['roles']); } else { $roles = array(); @@ -2285,7 +2328,6 @@ function user_register_submit($form, &$f drupal_set_message(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.
In the meantime, a welcome message with further instructions has been sent to your e-mail address.')); $form_state['redirect'] = ''; return; - } } } @@ -2318,8 +2360,8 @@ function user_register() { $form = array_merge($form, user_edit_form($form_state, NULL, NULL, TRUE)); if ($admin) { $form['account']['notify'] = array( - '#type' => 'checkbox', - '#title' => t('Notify user of new account') + '#type' => 'checkbox', + '#title' => t('Notify user of new account'), ); // Redirect back to page which initiated the create request; usually admin/user/user/create $form['destination'] = array('#type' => 'hidden', '#value' => $_GET['q']); @@ -2385,3 +2427,4 @@ function _user_forms(&$edit, $account, $ return empty($groups) ? FALSE : $groups; } + Index: modules/user/user.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v retrieving revision 1.11 diff -u -p -r1.11 user.pages.inc --- modules/user/user.pages.inc 8 Jan 2008 10:35:43 -0000 1.11 +++ modules/user/user.pages.inc 20 Jan 2008 06:08:10 -0000 @@ -1,6 +1,7 @@ $uid, 'status' => 1)) ) { + if ($timestamp < $current && $account = user_load(array('uid' => $uid, 'status' => 1))) { // No time out for first time login. if ($account->login && $current - $timestamp > $timeout) { drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.')); @@ -106,8 +107,8 @@ function user_pass_reset(&$form_state, $ } else { $form['message'] = array('#value' => t('

This is a one-time login for %user_name and will expire on %expiration_date.

Click on this button to login to the site and change your password.

', array('%user_name' => $account->name, '%expiration_date' => format_date($timestamp + $timeout)))); - $form['help'] = array('#value' => '

'. t('This login can be used only once.') .'

'); - $form['submit'] = array('#type' => 'submit', '#value' => t('Log in')); + $form['help'] = array('#value' => '

'. t('This login can be used only once.') .'

'); + $form['submit'] = array('#type' => 'submit', '#value' => t('Log in')); $form['#action'] = url("user/reset/$uid/$timestamp/$hashed_pass/login"); return $form; } @@ -232,12 +233,12 @@ function user_edit($account, $category = */ function user_profile_form($form_state, $account, $category = 'account') { - $edit = (empty($form_state['values'])) ? (array)$account : $form_state['values']; + $edit = (empty($form_state['values'])) ? (array)$account : $form_state['values']; - $form = _user_forms($edit, $account, $category); + $form = _user_forms($edit, $account, $category); $form['_category'] = array('#type' => 'value', '#value' => $category); - $form['_account'] = array('#type' => 'value', '#value' => $account); - $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 30); + $form['_account'] = array('#type' => 'value', '#value' => $account); + $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 30); if (user_access('administer users')) { $form['delete'] = array( '#type' => 'submit', @@ -308,7 +309,8 @@ function user_confirm_delete(&$form_stat t('Are you sure you want to delete the account %name?', array('%name' => $account->name)), 'user/'. $account->uid, t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), - t('Delete'), t('Cancel')); + t('Delete'), t('Cancel') + ); } /** @@ -363,3 +365,4 @@ function user_page() { return drupal_get_form('user_login'); } } + Index: profiles/default/default.profile =================================================================== RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v retrieving revision 1.22 diff -u -p -r1.22 default.profile --- profiles/default/default.profile 17 Dec 2007 12:43:34 -0000 1.22 +++ profiles/default/default.profile 20 Jan 2008 06:08:10 -0000 @@ -1,6 +1,7 @@ 'Drupal', - 'description' => 'Select this profile to enable some basic Drupal functionality and the default theme.' + 'description' => 'Select this profile to enable some basic Drupal functionality and the default theme.', ); } @@ -35,8 +36,7 @@ function default_profile_details() { * while the values will be displayed to the user in the installer * task list. */ -function default_profile_task_list() { -} +function default_profile_task_list() {} /** * Perform any final installation tasks for this profile. @@ -149,3 +149,4 @@ function default_form_alter(&$form, $for $form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME']; } } +