? .cvsignore
Index: robots.txt
===================================================================
RCS file: /cvs/drupal/drupal/robots.txt,v
retrieving revision 1.9.2.1
diff -u -p -r1.9.2.1 robots.txt
--- robots.txt	10 Dec 2008 20:12:19 -0000	1.9.2.1
+++ robots.txt	13 Dec 2010 15:17:16 -0000
@@ -44,7 +44,7 @@ Disallow: /admin/
 Disallow: /comment/reply/
 Disallow: /contact/
 Disallow: /logout/
-Disallow: /node/add/
+Disallow: /node/
 Disallow: /search/
 Disallow: /user/register/
 Disallow: /user/password/
@@ -54,7 +54,7 @@ Disallow: /?q=admin/
 Disallow: /?q=comment/reply/
 Disallow: /?q=contact/
 Disallow: /?q=logout/
-Disallow: /?q=node/add/
+Disallow: /?q=node/
 Disallow: /?q=search/
 Disallow: /?q=user/password/
 Disallow: /?q=user/register/
Index: modules/blog/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v
retrieving revision 1.297.2.4
diff -u -p -r1.297.2.4 blog.module
--- modules/blog/blog.module	25 Feb 2009 12:21:53 -0000	1.297.2.4
+++ modules/blog/blog.module	13 Dec 2010 15:17:17 -0000
@@ -193,14 +193,14 @@ function _blog_post_exists($account) {
  * Displays the most recent 10 blog titles.
  */
 function blog_block($op = 'list', $delta = 0) {
-  global $user;
+  global $user, $language;
   if ($op == 'list') {
     $block[0]['info'] = t('Recent blog posts');
     return $block;
   }
   else if ($op == 'view') {
     if (user_access('access content')) {
-      $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10);
+      $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.language = '$language->language' ORDER BY n.created DESC"), 0, 10);
       if ($node_title_list = node_title_list($result)) {
         $block['content'] = $node_title_list;
         $block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.'));
Index: modules/blog/blog.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v
retrieving revision 1.6.2.3
diff -u -p -r1.6.2.3 blog.pages.inc
--- modules/blog/blog.pages.inc	14 Sep 2009 15:08:00 -0000	1.6.2.3
+++ modules/blog/blog.pages.inc	13 Dec 2010 15:17:17 -0000
@@ -10,7 +10,7 @@
  * Menu callback; displays a Drupal page containing recent blog entries of a given user.
  */
 function blog_page_user($account) {
-  global $user;
+  global $user, $language;
 
   drupal_set_title($title = t("@name's blog", array('@name' => $account->name)));
 
@@ -25,7 +25,7 @@ function blog_page_user($account) {
 
   $output = theme('item_list', $items);
 
-  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
+  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 AND n.language = '$language->language' ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
   $has_posts = FALSE;
   
   while ($node = db_fetch_object($result)) {
@@ -53,7 +53,7 @@ function blog_page_user($account) {
  * Menu callback; displays a Drupal page containing recent blog entries of all users.
  */
 function blog_page_last() {
-  global $user;
+  global $user, $language;
 
   $output = '';
   $items = array();
@@ -64,7 +64,7 @@ function blog_page_last() {
 
   $output = theme('item_list', $items);
 
-  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10));
+  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.language = '$language->language' ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10));
   $has_posts = FALSE;
 
   while ($node = db_fetch_object($result)) {
@@ -87,7 +87,8 @@ function blog_page_last() {
  * Menu callback; displays an RSS feed containing recent blog entries of a given user.
  */
 function blog_feed_user($account) {
-  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n  WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10));
+  global $language;
+  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n  WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 AND n.language = '$language->language' ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10));
   $channel['title'] = t("!name's blog", array('!name' => $account->name));
   $channel['link'] = url('blog/'. $account->uid, array('absolute' => TRUE));
 
@@ -102,7 +103,8 @@ function blog_feed_user($account) {
  * Menu callback; displays an RSS feed containing recent blog entries of all users.
  */
 function blog_feed_last() {
-  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10));
+  global $language;
+  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.language = '$language->language' ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10));
   $channel['title'] = t('!site_name blogs', array('!site_name' => variable_get('site_name', 'Drupal')));
   $channel['link'] = url('blog', array('absolute' => TRUE));
 
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.212.2.10
diff -u -p -r1.212.2.10 locale.module
--- modules/locale/locale.module	4 Mar 2010 00:15:28 -0000	1.212.2.10
+++ modules/locale/locale.module	13 Dec 2010 15:17:17 -0000
@@ -561,6 +561,7 @@ function locale_update_js_files() {
  * Displays a language switcher. Translation links may be provided by other modules.
  */
 function locale_block($op = 'list', $delta = 0) {
+  global $language;
   if ($op == 'list') {
     $block[0]['info'] = t('Language switcher');
     // Not worth caching.
@@ -574,13 +575,29 @@ function locale_block($op = 'list', $del
     $path = drupal_is_front_page() ? '<front>' : $_GET['q'];
     $languages = language_list('enabled');
     $links = array();
-    foreach ($languages[1] as $language) {
-      $links[$language->language] = array(
+    foreach ($languages[1] as $lang) {
+      $links[$lang->language] = array(
         'href'       => $path,
-        'title'      => $language->native,
-        'language'   => $language,
+        'title'      => $lang->native,
+        'language'   => $lang,
         'attributes' => array('class' => 'language-link'),
       );
+      // no link to itself
+      if ($lang->language == $language->language) unset($links[$lang->language]['href']);
+
+      // no link if no transtation
+      $paths = array();
+      $found = false;
+      // Check for a node related path, and for its translations.
+      if ((preg_match("!^node/([0-9]+)(/.+|)$!", $path, $matches)) && ($node = node_load((int)$matches[1]))) {
+        $found = true;
+        if(!empty($node->tnid)) {
+          foreach (translation_node_get_translations($node->tnid) as $language1 => $translation_node) {
+            $paths[$language1] = 'node/'. $translation_node->nid . $matches[2];
+          }
+        }
+      }
+      if ($found && count($paths)==0) unset($links[$lang->language]['href']);
     }
 
     // Allow modules to provide translations for specific links.
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.947.2.26
diff -u -p -r1.947.2.26 node.module
--- modules/node/node.module	6 Aug 2010 11:41:13 -0000	1.947.2.26
+++ modules/node/node.module	13 Dec 2010 15:17:18 -0000
@@ -1661,7 +1661,7 @@ function node_feed($nids = FALSE, $chann
 
   if ($nids === FALSE) {
     $nids = array();
-    $result = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));
+    $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 AND n.language = '$language->language' ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10));
     while ($row = db_fetch_object($result)) {
       $nids[] = $row->nid;
     }
@@ -1757,7 +1757,8 @@ function node_feed($nids = FALSE, $chann
  * Menu callback; Generate a listing of promoted nodes.
  */
 function node_page_default() {
-  $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
+  global $language;
+  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 AND n.language = '$language->language' ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10));
 
   $output = '';
   $num_rows = FALSE;
Index: modules/search/search-results.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search-results.tpl.php,v
retrieving revision 1.1
diff -u -p -r1.1 search-results.tpl.php
--- modules/search/search-results.tpl.php	31 Oct 2007 18:06:38 -0000	1.1
+++ modules/search/search-results.tpl.php	13 Dec 2010 15:17:18 -0000
@@ -21,7 +21,9 @@
  * @see template_preprocess_search_results()
  */
 ?>
+<?php if ($search_results) {?>
 <dl class="search-results <?php print $type; ?>-results">
   <?php print $search_results; ?>
 </dl>
+<?php }?>
 <?php print $pager; ?>
Index: modules/search/search.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.pages.inc,v
retrieving revision 1.4
diff -u -p -r1.4 search.pages.inc
--- modules/search/search.pages.inc	6 Dec 2007 09:51:01 -0000	1.4
+++ modules/search/search.pages.inc	13 Dec 2010 15:17:18 -0000
@@ -61,6 +61,8 @@ function search_view($type = 'node') {
 function template_preprocess_search_results(&$variables) {
   $variables['search_results'] = '';
   foreach ($variables['results'] as $result) {
+    $url = check_url($result['link']);
+    if (!strstr($url,'node/'))
     $variables['search_results'] .= theme('search_result', $result, $variables['type']);
   }
   $variables['pager'] = theme('pager', NULL, 10, 0);
Index: modules/tracker/tracker.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v
retrieving revision 1.5
diff -u -p -r1.5 tracker.pages.inc
--- modules/tracker/tracker.pages.inc	28 Nov 2007 10:29:20 -0000	1.5
+++ modules/tracker/tracker.pages.inc	13 Dec 2010 15:17:18 -0000
@@ -11,6 +11,7 @@
  * Menu callback. Prints a listing of active nodes on the site.
  */
 function tracker_page($account = NULL, $set_title = FALSE) {
+  global $language;
   // Add CSS
   drupal_add_css(drupal_get_path('module', 'tracker') .'/tracker.css', 'module', 'all', FALSE);
 
@@ -22,14 +23,14 @@ function tracker_page($account = NULL, $
       drupal_set_title(check_plain($account->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 = "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) AND n.language = '$language->language' 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);
   }
   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 = "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 AND n.language = '$language->language' 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);
Index: modules/translation/translation.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v
retrieving revision 1.23.2.4
diff -u -p -r1.23.2.4 translation.module
--- modules/translation/translation.module	14 Jan 2009 23:34:07 -0000	1.23.2.4
+++ modules/translation/translation.module	13 Dec 2010 15:17:18 -0000
@@ -335,11 +335,12 @@ function translation_path_get_translatio
  * Replaces links with pointers to translated versions of the content.
  */
 function translation_translation_link_alter(&$links, $path) {
+  global $language;
   if ($paths = translation_path_get_translations($path)) {
     foreach ($links as $langcode => $link) {
       if (isset($paths[$langcode])) {
         // Translation in a different node.
-        $links[$langcode]['href'] = $paths[$langcode];
+        if ($langcode!=$language->language) $links[$langcode]['href'] = $paths[$langcode];
       }
       else {
         // No translation in this language, or no permission to view.
