gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r4180 - in i18nHTML/src: . admin i18nHTML


From: grothoff
Subject: [GNUnet-SVN] r4180 - in i18nHTML/src: . admin i18nHTML
Date: Wed, 3 Jan 2007 21:33:53 -0800 (PST)

Author: grothoff
Date: 2007-01-03 21:33:51 -0800 (Wed, 03 Jan 2007)
New Revision: 4180

Modified:
   i18nHTML/src/admin/manage_account.php
   i18nHTML/src/admin/status.php
   i18nHTML/src/i18nHTML/i18nhtml.php
   i18nHTML/src/update0_3_0.php
Log:
bugfixes

Modified: i18nHTML/src/admin/manage_account.php
===================================================================
--- i18nHTML/src/admin/manage_account.php       2007-01-04 05:09:13 UTC (rev 
4179)
+++ i18nHTML/src/admin/manage_account.php       2007-01-04 05:33:51 UTC (rev 
4180)
@@ -26,7 +26,7 @@
 generateLanguageBar();
 H2("i18nHTML account administration");
 
-if ( (uid <= 0) || ($level <= 0) ) {
+if ( ($uid <= 0) || ($level <= 0) ) {
   W("Only authorized users can administer accounts.");
   die();
  }
@@ -50,37 +50,36 @@
   $num = mysql_numrows($result);
 if ($num == 0) {
   W("You did not select an account that you are authorized to administer at 
this time.");
-  die();
- }
-if ($action == "delete") {
+ } else if ($action == "delete") {
   $query = "DELETE FROM ${i18nHTMLsqlPrefix}accounts WHERE uid=$cid";
   mysql_query($query, $connection);
   W("Account deleted.");
-  die();
- }
-if ($action == "kill") {
+ } else if ($action == "kill") {
   $query = "DELETE FROM ${i18nHTMLsqlPrefix}map WHERE uid=$cid";
   mysql_query($query, $connection);
   W("All translations added by this account deleted.");
   $query = "DELETE FROM ${i18nHTMLsqlPrefix}accounts WHERE uid=$cid";
   mysql_query($query, $connection);
   W("Account deleted.");
-  die();
- }
-$row = mysql_fetch_array($row);
-$nlevel = $row['level'];
-if ($action == "promote") 
-  $nlevel++;
- else if ($action == "demote")
-   $nlevel--;
-if ($nlevel != $row['level']) {
-  $query = "UPDATE TABLE ${i18nHTMLsqlPrefix}accounts SET level=$nlevel WHERE 
uid=$cid";
-  mysql_query($query, $connection);
-  W("Account ${action}d to level $nlevel.");  
  } else {
-  W("Specified action '%s' unknown.",
-    $action);
+  $row = mysql_fetch_array($result);
+  $nlevel = $row['level'];
+  if ($action == "promote") 
+    $nlevel++;
+  else if ($action == "demote")
+    $nlevel--;
+  if ($nlevel != $row['level']) {
+    $query = "UPDATE ${i18nHTMLsqlPrefix}accounts SET level=$nlevel WHERE 
uid=$cid;";
+    mysql_query($query, $connection);
+    W("Account ${action}d to level $nlevel.");  
+  } else {
+    W("Specified action '%s' unknown.",
+      $action);
+  }
  }
+BP();
+intlink("accounts.php", "Continue account management");
+EP();
 generateFooter();
 echo "</body></html>\n";
 ?>
\ No newline at end of file

Modified: i18nHTML/src/admin/status.php
===================================================================
--- i18nHTML/src/admin/status.php       2007-01-04 05:09:13 UTC (rev 4179)
+++ i18nHTML/src/admin/status.php       2007-01-04 05:33:51 UTC (rev 4180)
@@ -1,6 +1,6 @@
 <?php
 /*
-     (C) 2003, 2004, 2005, 2006 Christian Grothoff
+     (C) 2003, 2004, 2005, 2006, 2007 Christian Grothoff
 
      This code is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -60,7 +60,7 @@
 $num = 0;
 if ($result)
   $num = mysql_numrows($result);
-for ($i=0;$i<$num;$i++) {
+while ($num-- > 0) {
   $row = mysql_fetch_array($result);
   $text = stripslashes($row["name"]);
   $translation = stripslashes($row["translation"]);

Modified: i18nHTML/src/i18nHTML/i18nhtml.php
===================================================================
--- i18nHTML/src/i18nHTML/i18nhtml.php  2007-01-04 05:09:13 UTC (rev 4179)
+++ i18nHTML/src/i18nHTML/i18nhtml.php  2007-01-04 05:33:51 UTC (rev 4180)
@@ -663,7 +663,7 @@
 function intlink_($a, $b) {
   global $lang;
 
-  $ret = "<a href=\"${a}?xlang=" . $lang . "\">" . TRANSLATE_($b) . "</a>";
+  $ret = "<a href=\"${a}?xlang=$lang\">" . TRANSLATE_($b) . "</a>";
   $ret = $ret . translateLink_($b);
   return $ret;
 }
@@ -784,6 +784,7 @@
   global $editor;
   global $HTTP_SERVER_VARS;
   global $i18nHTMLsrcLang;
+  global $i18nHTMLbase;
 
   P();
   echo "Translation engine based on <a 
href=\"http://gnunet.org/i18nHTML/\";>i18nHTML</a> (C) 2003, 2004, 2005, 2006, 
2007 <a href=\"http://grothoff.org/christian/\";>Christian Grothoff</a>.<br 
/>\n";
@@ -801,6 +802,10 @@
     echo "&nbsp;&nbsp;&nbsp;";
     intlink($i18nHTMLbase, "go to i18nHTML administration page");
     echo "</small></center>\n";
+  } else {
+    echo "<center><small>\n";
+    intlink($i18nHTMLbase, "go to i18nHTML administration page");
+    echo "</small></center>\n";
   }
   echo "</p>\n";
 }

Modified: i18nHTML/src/update0_3_0.php
===================================================================
--- i18nHTML/src/update0_3_0.php        2007-01-04 05:09:13 UTC (rev 4179)
+++ i18nHTML/src/update0_3_0.php        2007-01-04 05:33:51 UTC (rev 4180)
@@ -4,10 +4,25 @@
 /* run this script *after* accessing tables.php in order to update
  your existing i18nHTML 0.2.0 database to a 0.3.0 db */
 
+// alter map, adding UID field
 # UID 2 == legacy
 $query="ALTER TABLE ${i18nHTMLsqlPrefix}map ADD uid DEFAULT 2 INT AFTER ip;";
 $result = mysql_query($query, $connection);
 if (!$result) {
   die('Unable to initialize map table.  Invalid query: ' . mysql_error());
 }
+
+// add existing languages to language table
+$query="SELECT DISTINCT lang FROM ${i18nHTMLsqlPrefix}map;";
+$result = mysql_query($query, $connection);
+$num = 0;
+if ($result)
+  $num = mysql_numrows($result);
+while ($num-- > 0) {
+  $row = mysql_fetch_array($result);
+  $lx = $row['lang'];
+  $query="INSERT INTO ${i18nHTMLsqlPrefix}languages ($lx, 0)";
+  mysql_query($query, $connection);
+ }
+
 ?>





reply via email to

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