gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r636 - doodle-docs/WWW


From: grothoff
Subject: [GNUnet-SVN] r636 - doodle-docs/WWW
Date: Sun, 10 Apr 2005 23:15:07 -0700 (PDT)

Author: grothoff
Date: 2005-04-10 23:15:05 -0700 (Sun, 10 Apr 2005)
New Revision: 636

Added:
   doodle-docs/WWW/update0_2_0.php
Log:
update

Added: doodle-docs/WWW/update0_2_0.php
===================================================================
--- doodle-docs/WWW/update0_2_0.php     2005-04-11 06:02:26 UTC (rev 635)
+++ doodle-docs/WWW/update0_2_0.php     2005-04-11 06:15:05 UTC (rev 636)
@@ -0,0 +1,37 @@
+<?php
+include("i18nhtml.inc");
+?>
+# This script merely generates the SQL statements<br>
+# to do the update.  You'll have to run the SQL<br>
+# commands yourself to prevent accidental data loss.<br>
+# <pre>
+<?php
+echo "use $i18nHTMLsqlDB;\n";
+$query = "SELECT * FROM map";
+$result = mysql_query($query, $connection);
+$num = 0;
+$loss = 0;
+if ($result) 
+  $num = mysql_numrows($result);
+for ($ii=0;$ii<$num;$ii++) {
+  $row = mysql_fetch_array($result);
+  $la = mysql_real_escape_string($row["lang"]);
+  $src = $row["name"]; // urlencoded
+  $src_sql = mysql_real_escape_string($src);
+  $dst_sql = mysql_real_escape_string($row["translation"]);
+  $rank = $row["ranking"];
+  $rname = fix(urldecode($src));
+  $rname_sql = mysql_real_escape_string(fix(urldecode($src)));
+  // detect "bad" translations (where conversion failed)
+  // if more than 5 values in [0..9] follow => bad conversion
+  $txtCnt = count_chars(urldecode($src), 1);
+  $tCnt = count_chars($rtrans, 1);
+
+  $dst = mysql_real_escape_string($dst);
+  $subquery = "UPDATE map SET name=\"$rname_sql\" WHERE name=\"$src_sql\" AND 
lang=\"$la\" AND translation=\"$dst_sql\" AND ranking=$rank;\n";
+      echo "$subquery\n";
+  echo "$subquery\n";
+}
+?>
+# </pre>
+# end of conversion





reply via email to

[Prev in Thread] Current Thread [Next in Thread]