[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_5-20717-g73913f1

Marc Delisle lem9 at users.sourceforge.net
Tue Oct 4 11:49:38 CEST 2011


The branch, master has been updated
       via  73913f135e51cbc3eba559ffd8af70a2938f0ac3 (commit)
      from  f06ab07979c5ca084955759a62092d51d90e1489 (commit)


- Log -----------------------------------------------------------------
commit 73913f135e51cbc3eba559ffd8af70a2938f0ac3
Author: Marc Delisle <marc at infomarc.info>
Date:   Tue Oct 4 05:49:20 2011 -0400

    Use standard SQL terminology in format string

-----------------------------------------------------------------------

Summary of changes:
 Documentation.html       |    4 ++--
 libraries/common.lib.php |   23 ++++++++++++++---------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Documentation.html b/Documentation.html
index af27b89..1c47508 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -4341,8 +4341,8 @@ INSERT INTO REL_towns VALUES ('M', 'Montréal');
         <dd>Currently opened database</dd>
     <dt><code>@TABLE@</code></dt>
         <dd>Currently opened table</dd>
-    <dt><code>@FIELDS@</code></dt>
-        <dd>Fields of currently opened table</dd>
+    <dt><code>@COLUMNS@</code></dt>
+        <dd>Columns of the currently opened table</dd>
     <dt><code>@PHPMYADMIN@</code></dt>
         <dd>phpMyAdmin with version</dd>
 </dl>
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 2cc2278..5dcf21e 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -3097,7 +3097,7 @@ function PMA_getTitleForTarget($target)
 }
 
 /**
- * Formats user string, expading @VARIABLES@, accepting strftime format string.
+ * Formats user string, expanding @VARIABLES@, accepting strftime format string.
  *
  * @param string   $string  Text where to do expansion.
  * @param function $escape  Function to call for escaping variable values.
@@ -3149,20 +3149,25 @@ function PMA_expandUserString($string, $escape = null, $updates = array())
         }
     }
 
-    /* Fetch fields list if required */
+    /* Backward compatibility in 3.5.x */
     if (strpos($string, '@FIELDS@') !== false) {
-        $fields_list = PMA_DBI_get_columns($GLOBALS['db'], $GLOBALS['table']);
+        $string = strtr($string, array('@FIELDS@' => '@COLUMNS@')); 
+    }
+
+    /* Fetch columns list if required */
+    if (strpos($string, '@COLUMNS@') !== false) {
+        $columns_list = PMA_DBI_get_columns($GLOBALS['db'], $GLOBALS['table']);
 
-        $field_names = array();
-        foreach ($fields_list as $field) {
-            if (!is_null($escape)) {
-                $field_names[] = $escape($field['Field']);
+        $column_names = array();
+        foreach ($columns_list as $column) {
+            if (! is_null($escape)) {
+                $column_names[] = $escape($column['Field']);
             } else {
-                $field_names[] = $field['Field'];
+                $column_names[] = $field['Field'];
             }
         }
 
-        $replace['@FIELDS@'] = implode(',', $field_names);
+        $replace['@COLUMNS@'] = implode(',', $column_names);
     }
 
     /* Do the replacement */


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list