[241055] Images used by the babel server should be hosted on the server with relative path
diff --git a/classes/base.conf b/classes/base.conf
index 59c32a1..ccc5ea6 100644
--- a/classes/base.conf
+++ b/classes/base.conf
@@ -7,4 +7,6 @@
 
 genie_id=40623
 
+image_root=http://dev.eclipse.org
+
 context=dev
diff --git a/html/content/en_login.php b/html/content/en_login.php
index 54c70de..7b4eecf 100644
--- a/html/content/en_login.php
+++ b/html/content/en_login.php
@@ -4,7 +4,7 @@
 
 <div id="index-page">
 
-	<a href="https://bugs.eclipse.org/bugs/createaccount.cgi"><img src="http://dev.eclipse.org/large_icons/categories/preferences-desktop-peripherals.png">	<h2>A Bugzilla Account is all you need</h2></a>
+	<a href="https://bugs.eclipse.org/bugs/createaccount.cgi"><img src="<?php echo imageRoot() ?>/large_icons/categories/preferences-desktop-peripherals.png">	<h2>A Bugzilla Account is all you need</h2></a>
     <br style='clear: both;'>
 	<p>If you don't already have an Eclipse Bugzilla account then <a href="https://bugs.eclipse.org/bugs/createaccount.cgi">create one today</a>.  
 	It takes Babel a few minutes to receive your new Bugzilla account information. 
@@ -19,13 +19,13 @@
 	<?php 
 		if($GLOBALS['g_ERRSTRS'][0]){ 
 			?>
-			  <img style='margin-left: 70px;' src='http://dev.eclipse.org/small_icons/actions/process-stop.png'>
+			  <img style='margin-left: 70px;' src='<?php echo imageRoot() ?>/small_icons/actions/process-stop.png'>
 		      <div style='color: red; font-weight: bold; '><?=$GLOBALS['g_ERRSTRS'][0]?></div>
 		      <br style='clear: both;'>
 		    <?
 	    }else{
 			?>
-	    		<img style='margin-left: 70px;' src="http://dev.eclipse.org/small_icons/emblems/emblem-important.png">	<h2 style='font-size: 14px; margin-top: 0px; background-color: yellow;'>Use your Bugzilla login information</h2>
+	    		<img style='margin-left: 70px;' src="<?php echo imageRoot() ?>/small_icons/emblems/emblem-important.png">	<h2 style='font-size: 14px; margin-top: 0px; background-color: yellow;'>Use your Bugzilla login information</h2>
 		    	<br style='clear: both;'>
 		   <?
 	    }
diff --git a/html/content/en_map_files.php b/html/content/en_map_files.php
index 3c0d812..5221945 100644
--- a/html/content/en_map_files.php
+++ b/html/content/en_map_files.php
@@ -26,11 +26,11 @@
   <td style='width:100px; color:red;'><?= $GLOBALS['g_ERRSTRS'][4] ?></td>
 </tr>
 <tr>
-  <td><a href="http://dev.eclipse.org/viewcvs/index.cgi">ViewCVS</a> download URL to map file:</td><td><input type="text" name="location" value="<?= $LOCATION ?>" size="80" onchange="fnCheckUrl();" /></td>
+  <td><a href="<?php echo imageRoot() ?>/viewcvs/index.cgi">ViewCVS</a> download URL to map file:</td><td><input type="text" name="location" value="<?= $LOCATION ?>" size="80" onchange="fnCheckUrl();" /></td>
   <td style='width:100px; color:red;'><?= $GLOBALS['g_ERRSTRS'][2] ?></td>
 </tr>
 <tr>
-  <td>&#160;</td><td>e.g. <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core.map?view=co">http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core.map?view=co</a></td>
+  <td>&#160;</td><td>e.g. <a href="<?php echo imageRoot() ?>/viewcvs/index.cgi/org.eclipse.releng/maps/core.map?view=co">http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core.map?view=co</a></td>
 </tr>
 <tr>
   <td>&#160;</td><td><b>NOTE: </b>If you're defining map files for a Release, you must use the download link to the CVS TAG of that release.  This is the pathrev=R3_4 parameter in this example:<br />
diff --git a/html/content/en_map_files_show.php b/html/content/en_map_files_show.php
index 6eb4142..8650775 100644
--- a/html/content/en_map_files_show.php
+++ b/html/content/en_map_files_show.php
@@ -8,7 +8,7 @@
 		echo "<tr><td>"	. $myrow['project_id'] . "</td>
 		<td align='right'>" . $myrow['version'] . "</td>
 		<td><a href='" . $myrow['location'] . "' target='new'>" . $myrow['location'] . "</a></td>
-		<td><a onclick=\"javascript:return fnConfirm();\" href='map_files.php?submit=delete&project_id=" . $PROJECT_ID . "&version=" . $VERSION . "&filename=" . $myrow['filename'] . "'><img border=0 src='http://dev.eclipse.org/small_icons/actions/process-stop.png'></a></td></tr>";
+		<td><a onclick=\"javascript:return fnConfirm();\" href='map_files.php?submit=delete&project_id=" . $PROJECT_ID . "&version=" . $VERSION . "&filename=" . $myrow['filename'] . "'><img border=0 src='<?php echo imageRoot() ?>/small_icons/actions/process-stop.png'></a></td></tr>";
 	}
 ?>
 </table>
diff --git a/html/global.php b/html/global.php
index fcb49a3..ddd0a88 100644
--- a/html/global.php
+++ b/html/global.php
@@ -59,6 +59,17 @@
 if($context == "") {
 	$context = "staging";
 }
+
+$image_root = "";
+# get the image root
+if(isset($ini['image_root'])) 
+        $image_root = $ini['image_root'];
+
+$genie_id = "";
+#get the genie id
+if(isset($ini['genie_id'])) 
+        $genie_id = $ini['genie_id'];
+        
 global $context;
 
 session_name(COOKIE_SESSION);
@@ -210,15 +221,20 @@
 
 /**
 * Returns the genie user to be used for headless applications.
-* The user is found by looking for its id in the base.conf file.
+* The user is found by looking for genie_id in the base.conf file.
 */
 function getGenieUser() {
-  if (!($ini = @parse_ini_file(BABEL_BASE_DIR . 'classes/base.conf'))) {
-			errorLog("Failed to find/read conf file - aborting.");
-			exitTo("error.php?errNo=101300","error: 101300 - conf file can not be found");
-  }
   $User = new User();
-  $User->loadFromID($ini['genie_id']);  // genie
+  $User->loadFromID($genie_id); 
   return $User;
 }
+
+/**
+* Returns the folder in which the images may be found.
+* The folder may very well be an other server url.
+*/
+function imageRoot() {
+	return $image_root;
+}
+
 ?>
\ No newline at end of file
diff --git a/html/help_babel.php b/html/help_babel.php
index 36f73f9..4a88444 100644
--- a/html/help_babel.php
+++ b/html/help_babel.php
@@ -21,7 +21,7 @@
 <h1 id="page-message">Welcome to the Babel Project</h1>
 <div id="index-page" style='width: 510px; padding-right: 190px;'>
 
-	<img src="http://dev.eclipse.org/large_icons/categories/preferences-desktop-peripherals.png"><h2>Become a Committer on the Babel Project</h2>
+	<img src="<?php echo imageRoot() ?>/large_icons/categories/preferences-desktop-peripherals.png"><h2>Become a Committer on the Babel Project</h2>
 	<br style='clear: both;'>
 	<p>The main goal of the Babel project is to involve you the community in making Eclipse projects available in any language.  
 	   To make this effort a success we need quality translators to help with the translation.
diff --git a/html/importing.php b/html/importing.php
index 40f530e..f7d8a41 100644
--- a/html/importing.php
+++ b/html/importing.php
@@ -27,7 +27,7 @@
 	
 
 
-	<a href="https://bugs.eclipse.org/bugs/enter_bug_wizard.cgi"><img src="http://dev.eclipse.org/large_icons/apps/system-users.png"><h2>Eager Translators</h2></a>
+	<a href="https://bugs.eclipse.org/bugs/enter_bug_wizard.cgi"><img src="<?php echo imageRoot() ?>/large_icons/apps/system-users.png"><h2>Eager Translators</h2></a>
 	<br style='clear: both;'>
 	<p>
 	If Babel is missing an Eclipse project and you would like to help translate this project, follow the steps below to open a Bugzilla bug. 
@@ -42,7 +42,7 @@
 		<li>Submit the bug. 
 	</ol> 
 
-	<a href="login.php"><img src="http://dev.eclipse.org/large_icons/apps/preferences-desktop-theme.png"><h2>Project Leads</h2></a>
+	<a href="login.php"><img src="<?php echo imageRoot() ?>/large_icons/apps/preferences-desktop-theme.png"><h2>Project Leads</h2></a>
 	<br style='clear: both;'>
 	<p>
 	If you are a project lead and your project is not included in Babel then follow the steps below.
diff --git a/html/index.php b/html/index.php
index 0166027..b065361 100644
--- a/html/index.php
+++ b/html/index.php
@@ -27,19 +27,19 @@
 	  </div>
 
 	  <div style='float: left;border: 0px solid red;'>
-		  <a href="http://www.eclipse.org/babel/downloads.php"><img src="http://dev.eclipse.org/large_icons/apps/internet-web-browser.png"><h2>Eclipse Speaks your Language</h2></a>
+		  <a href="http://www.eclipse.org/babel/downloads.php"><img src="<?php echo imageRoot() ?>/large_icons/apps/internet-web-browser.png"><h2>Eclipse Speaks your Language</h2></a>
 	      <br style='clear: both;'>
 		  <p><a href="http://www.eclipse.org/babel/downloads.php">Download a language pack</a> in one of many different languages.</p>
 	         
-		  <a href="translate.php"><img src="http://dev.eclipse.org/large_icons/apps/accessories-text-editor.png"><h2>Help Translate Eclipse</h2></a>
+		  <a href="translate.php"><img src="<?php echo imageRoot() ?>/large_icons/apps/accessories-text-editor.png"><h2>Help Translate Eclipse</h2></a>
 	      <br style='clear: both;'>
 		  <p>Eclipse needs help from everyone in the community to <a href="translate.php">speak in many tongues</a>.</p>
 	      
-		  <a href="map_files.php"><img src="http://dev.eclipse.org/large_icons/apps/system-users.png"><h2>Add an Existing Eclipse Project to Babel</h2></a>
+		  <a href="map_files.php"><img src="<?php echo imageRoot() ?>/large_icons/apps/system-users.png"><h2>Add an Existing Eclipse Project to Babel</h2></a>
 	      <br style='clear: both;'>
 		  <p>Eclipse committers, find out how simple it is to include any existing Eclipse.org project <a href="map_files.php">in Babel</a>.</p>
 		  
-		  <a href="help_babel.php"><img src="http://dev.eclipse.org/large_icons/categories/preferences-desktop-peripherals.png"><h2>Become a Babel Team Player</h2></a>
+		  <a href="help_babel.php"><img src="<?php echo imageRoot() ?>/large_icons/categories/preferences-desktop-peripherals.png"><h2>Become a Babel Team Player</h2></a>
 	      <br style='clear: both;'>
 		  <p>The Babel project has lots of ideas and we need your help to take this project to the <a href="help_babel.php">next level</a>.</p>
 
diff --git a/html/process_map_files.php b/html/process_map_files.php
index 8f92194..e1a04b0 100755
--- a/html/process_map_files.php
+++ b/html/process_map_files.php
@@ -33,6 +33,18 @@
 chdir("/tmp/tmp-babel")  || die("Cannot use working directory");
 
 
+$files = array();
+$sql = "SELECT * from files";
+$rs_files = mysql_query($sql, $dbh);
+while($myrow_file = mysql_fetch_assoc($rs_files)) {
+	$File = new File();
+	$File->project_id 	= $myrow_file['project_id'];
+	$File->version		= $myrow_file['version'];
+	$File->name 		= $myrow_file['name'];
+	$File->plugin_id	= $myrow_file['plugin_id'];
+	$File->file_id      = $myrow_file['file_id'];
+	$files[$File->file_id] = $File;
+}
 
 
 $sql = "SELECT * FROM map_files WHERE is_active = 1 ORDER BY RAND()";
@@ -40,6 +52,7 @@
 while($myrow_maps = mysql_fetch_assoc($rs_maps)) {
 	echo "Processing map file: " . $myrow_maps['filename'] . " in location: " . $myrow_maps['location'] . "\n";
 	
+	
 	$tmpdir = "/tmp/tmp-babel/" . $myrow_maps['project_id'];
 	if(is_dir($tmpdir)) {
 		# zap the directory to make sure CVS versions don't overlap
@@ -109,11 +122,20 @@
 						$file_name = trim(substr($out_line, 2)); 
 						echo $html_spacer . $html_spacer . $html_spacer . "Processing .properties file: " . $file_name . "\n";
 						
-						$File = new File();
-						$File->project_id 	= $myrow_maps['project_id'];
-						$File->version		= $myrow_maps['version'];
-						$File->name 		= $file_name;
-						$File->plugin_id	= $plugin_id;
+						$file_id = File->getFileID($file_name, $myrow_maps['project_id'], $myrow_maps['version']);
+						
+						if ($files[$file_id] != null) {
+							$File = $files[$file_id];
+							$File->isActive = 1;
+							unset($files[$file_id]);
+						} else {
+							$File = new File();
+							$File->project_id 	= $myrow_maps['project_id'];
+							$File->version		= $myrow_maps['version'];
+							$File->name 		= $file_name;
+							$File->plugin_id	= $plugin_id;
+							$File->isActive     = 1;
+						}
 						if(!$File->save()) {
 							echo $html_spacer . $html_spacer . $html_spacer . $html_spacer . "***ERROR saving file: " . $file_name . "\n";
 						}
@@ -135,6 +157,15 @@
 		}
 	}
 }
+echo "Marking the remaining files as inactive\n";
+
+foreach ($files as $file) {
+	$file->isActive = 0;
+	if(!$file->save()) {
+		echo $html_spacer . $html_spacer . $html_spacer . $html_spacer . "***ERROR saving file: " . $file->name . "\n";
+	}
+}
+
 echo "Done.";
 
 if($headless) {
diff --git a/html/query.php b/html/query.php
new file mode 100644
index 0000000..4991200
--- /dev/null
+++ b/html/query.php
@@ -0,0 +1,43 @@
+<?php
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Eclipse Foundation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Antoine Toulme, Intalio Inc. bug 255775: Open a REST API for people to query for translations
+*******************************************************************************/
+
+header("Content-type: text/plain");
+include("global.php");
+
+global $App, $dbh;
+
+$value = $_GET['string'];
+$nl = $_GET['nl'];
+
+if (!$value || !$nl) {
+	exit();
+}
+
+// we could add more checks on the values being entered.
+
+// we also need to discuss how to deal with the encoding of the value, 
+// since & and spaces should be encoded for example
+
+$value = html_entity_decode($value);
+
+$possible_translations = mysql_query(
+	"SELECT t.value 
+		from strings As s inner join translations AS t on s.string_id = t.string_id
+					inner join languages As l on l.language_id = t.language_id
+					where BINARY s.value = '" . addslashes($value) . "' 
+					and l.iso_code = '" . addslashes($nl) . "' ");
+		
+if ($possible_translations and (($translation_row = mysql_fetch_assoc($possible_translations)) != null)) {
+		echo $translation_row['value'];
+}
+
+?>
\ No newline at end of file