Fix retrieving the git hash for output display.

Getting the git hashes for the current language files needs to be done in the
correct git repository. Read the mapping file from the correct folder as well.
diff --git a/submit.php b/submit.php
index 769fc95..6dee44e 100644
--- a/submit.php
+++ b/submit.php
@@ -5,6 +5,13 @@
 function submit() {
     header("Content-type: text/plain;charset=UTF-8");
     header(sprintf("Content-Disposition: attachment; filename=%s.diff", $_REQUEST['lang']));
+    $langs = array();
+    if (file_exists(VERSIONS)) {
+        foreach(file(VERSIONS) as $line) {
+            list($lang, $version) = explode(":", trim($line));
+            $langs[$lang] = $version;
+        }
+    }
     chdir('rockbox'); // chdir into the rockbox dir to get proper diffs
 
     $i = 0;
@@ -14,13 +21,6 @@
     } while (file_exists($filename));
 
     $fp = fopen($filename, 'w');
-    $langs = array();
-    if (file_exists(VERSIONS)) {
-        foreach(file(VERSIONS) as $line) {
-            list($lang, $version) = explode(":", trim($line)); 
-            $langs[$lang] = $version;
-        }
-    }
     
     // Write a header if one exists
     $original_lines = file(sprintf("apps/lang/%s.lang", $_REQUEST['lang']));
@@ -35,7 +35,7 @@
     printf("See\nhttp://git.rockbox.org/?p=rockbox.git;a=history;f=apps/lang/%s.lang;hb=HEAD\nfor details.\n", $_REQUEST['lang']);
     print("May be distributed under the terms of the GNU GPL version 2 or later\n");
     print("This file generated by http://translate.rockbox.org/\n\n");
-    printf("This translation was based on SVN revision %d of the original.\n\n", $langs[$_REQUEST['lang']]);
+    printf("This translation was based on git hash %s of the original.\n\n", $langs[$_REQUEST['lang']]);
 
     foreach($original as $id => $phrase) {
         foreach(array('dest', 'voice') as $type) {
diff --git a/update.php b/update.php
index 2bf13e8..b1a3aaf 100755
--- a/update.php
+++ b/update.php
@@ -40,8 +40,9 @@
 
     $fp = fopen(VERSIONS, 'w');
     foreach(glob('rockbox/apps/lang/*.lang') as $lang) {
-        $gitstr = shell_exec(sprintf("git log --pretty=%%h -1 %s", $lang));
-        $line = sprintf("%s:%s\n", basename($lang, '.lang'), $gitstr);
+        $gitstr = shell_exec(sprintf("cd rockbox && git log --pretty=%%h -1 %s",
+                "apps/lang/" . basename($lang)));
+        $line = sprintf("%s:%s\n", basename($lang, '.lang'), trim($gitstr));
         fwrite($fp, $line);
     }
     fclose($fp);