The branch, master has been updated
       via  683a512c41a5474cb60f0e22cea4326aa359bb7a (commit)
       via  5f2a52153bd3f6b5f96e813180ec0a8875b0aa5e (commit)
       via  18f567a3f13ab78015521e46e3fa2b9873d44610 (commit)
       via  1a1833662fa4128c5d399e9813b1635ce88b21f7 (commit)
       via  d67165f7bcc7abe654d98085b7c44f48c5e451ba (commit)
      from  c5cbe212772a8ccebe7acf7c86bad3ba3a805b11 (commit)


- Log -----------------------------------------------------------------
commit 683a512c41a5474cb60f0e22cea4326aa359bb7a
Author: Madhura Jayaratne <[email protected]>
Date:   Thu Aug 18 00:04:40 2011 +0530

    Wrap long lines.

commit 5f2a52153bd3f6b5f96e813180ec0a8875b0aa5e
Author: Madhura Jayaratne <[email protected]>
Date:   Wed Aug 17 23:54:14 2011 +0530

    Use include_once when included conditionally

commit 18f567a3f13ab78015521e46e3fa2b9873d44610
Author: Madhura Jayaratne <[email protected]>
Date:   Wed Aug 17 23:52:36 2011 +0530

    Correcting indentation for switch statements

commit 1a1833662fa4128c5d399e9813b1635ce88b21f7
Author: Madhura Jayaratne <[email protected]>
Date:   Wed Aug 17 23:48:19 2011 +0530

    Wrap long lines

commit d67165f7bcc7abe654d98085b7c44f48c5e451ba
Author: Madhura Jayaratne <[email protected]>
Date:   Wed Aug 17 23:42:43 2011 +0530

    Fix code style

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

Summary of changes:
 gis_data_editor.php      |   10 ++--
 libraries/import/shp.php |  170 ++++++++++++++++++++++++++--------------------
 2 files changed, 101 insertions(+), 79 deletions(-)

diff --git a/gis_data_editor.php b/gis_data_editor.php
index 7614aba..23ce037 100644
--- a/gis_data_editor.php
+++ b/gis_data_editor.php
@@ -33,7 +33,7 @@ if (! isset($gis_data['gis_type'])) {
         $start = (substr($_REQUEST['value'], 0, 1) == "'") ? 1 : 0;
         $gis_data['gis_type'] = substr($_REQUEST['value'], $start, 
strpos($_REQUEST['value'], "(") - $start);
     }
-    if((! isset($gis_data['gis_type'])) || (! in_array($gis_data['gis_type'], 
$gis_types))) {
+    if ((! isset($gis_data['gis_type'])) || (! in_array($gis_data['gis_type'], 
$gis_types))) {
         $gis_data['gis_type'] = $gis_types[0];
     }
 }
@@ -59,7 +59,7 @@ $visualization = PMA_GIS_visualizationResults($data, 
$visualizationSettings, $fo
 $open_layers = PMA_GIS_visualizationResults($data, $visualizationSettings, 
'ol');
 
 // If the call is to update the WKT and visualization make an AJAX response
-if(isset($_REQUEST['generate']) && $_REQUEST['generate'] == true) {
+if (isset($_REQUEST['generate']) && $_REQUEST['generate'] == true) {
     $extra_data = array(
         'result'        => $result,
         'visualization' => $visualization,
@@ -69,7 +69,7 @@ if(isset($_REQUEST['generate']) && $_REQUEST['generate'] == 
true) {
 }
 
 // If the call is to get the whole content, start buffering, skipping </head> 
and <body> tags
-if(isset($_REQUEST['get_gis_editor']) && $_REQUEST['get_gis_editor'] == true) {
+if (isset($_REQUEST['get_gis_editor']) && $_REQUEST['get_gis_editor'] == true) 
{
     ob_start();
 } else {
 ?>
@@ -319,9 +319,9 @@ if(isset($_REQUEST['get_gis_editor']) && 
$_REQUEST['get_gis_editor'] == true) {
 <?php
 
 // If the call is to get the whole content, get the content in the buffer and 
make and AJAX response.
-if(isset($_REQUEST['get_gis_editor']) && $_REQUEST['get_gis_editor'] == true) {
+if (isset($_REQUEST['get_gis_editor']) && $_REQUEST['get_gis_editor'] == true) 
{
     $extra_data['gis_editor'] = ob_get_contents();
-    PMA_ajaxResponse(NULL, ob_end_clean(), $extra_data);
+    PMA_ajaxResponse(null, ob_end_clean(), $extra_data);
 }
 ?>
 </body>
diff --git a/libraries/import/shp.php b/libraries/import/shp.php
index 7ee62fd..b674f59 100644
--- a/libraries/import/shp.php
+++ b/libraries/import/shp.php
@@ -26,7 +26,7 @@ if (isset($plugin_list)) {
 
     // Append the bfShapeFiles directory to the include path variable
     set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . 
'/libraries/bfShapeFiles/');
-    require_once './libraries/bfShapeFiles/ShapeFile.lib.php';
+    include_once './libraries/bfShapeFiles/ShapeFile.lib.php';
 
     $GLOBALS['finished'] = false;
     $buffer = '';
@@ -51,10 +51,12 @@ if (isset($plugin_list)) {
     }
 
     /**
-     * This class extends ShapeFile class to cater following phpMyAdmin 
specific requirements.
+     * This class extends ShapeFile class to cater the following phpMyAdmin
+     * specific requirements.
      * 1) To load data from .dbf file only when the dBase extension is 
available.
-     * 2) To use PMA_importGetNextChunk() functionality to read data, rather 
than reading directly from a file.
-     *    Using readFromBuffer() in place of fread(). This makes it possible 
to use compressions.
+     * 2) To use PMA_importGetNextChunk() functionality to read data, rather 
than
+     *    reading directly from a file. Using readFromBuffer() in place of 
fread().
+     *    This makes it possible to use compressions.
      */
     class PMA_ShapeFile extends ShapeFile {
 
@@ -111,37 +113,39 @@ if (isset($plugin_list)) {
     }
 
     /**
-     * This class extends ShapeRecord class to cater following phpMyAdmin 
specific requirements.
+     * This class extends ShapeRecord class to cater the following phpMyAdmin
+     * specific requirements.
      * 1) To load data from .dbf file only when the dBase extension is 
available.
-     * 2) To use PMA_importGetNextChunk() functionality to read data, rather 
than reading directly from a file.
-     *    Using readFromBuffer() in place of fread(). This makes it possible 
to use compressions.
+     * 2) To use PMA_importGetNextChunk() functionality to read data, rather 
than
+     *    reading directly from a file. Using readFromBuffer() in place of 
fread().
+     *    This makes it possible to use compressions.
      */
-    class PMA_ShapeRecord extends ShapeRecord {
-
+    class PMA_ShapeRecord extends ShapeRecord
+    {
         function loadFromFile(&$SHPFile, &$DBFFile)
         {
             $this->DBFFile = $DBFFile;
             $this->_loadHeaders();
 
             switch ($this->shapeType) {
-                case 0:
-                    $this->_loadNullRecord();
-                    break;
-                case 1:
-                    $this->_loadPointRecord();
-                    break;
-                case 3:
-                    $this->_loadPolyLineRecord();
-                    break;
-                case 5:
-                    $this->_loadPolygonRecord();
-                    break;
-                case 8:
-                    $this->_loadMultiPointRecord();
-                    break;
-                default:
-                    $this->setError(sprintf("The Shape Type '%s' is not 
supported.", $this->shapeType));
-                    break;
+            case 0:
+                $this->_loadNullRecord();
+                break;
+            case 1:
+                $this->_loadPointRecord();
+                break;
+            case 3:
+                $this->_loadPolyLineRecord();
+                break;
+            case 5:
+                $this->_loadPolygonRecord();
+                break;
+            case 8:
+                $this->_loadMultiPointRecord();
+                break;
+            default:
+                $this->setError(sprintf("The Shape Type '%s' is not 
supported.", $this->shapeType));
+                break;
             }
             if (extension_loaded('dbase') && isset($this->DBFFile)) {
                 $this->_loadDBFData();
@@ -151,7 +155,8 @@ if (isset($plugin_list)) {
         function _loadHeaders()
         {
             $this->recordNumber = loadData("N", readFromBuffer(4));
-            $tmp = loadData("N", readFromBuffer(4)); //We read the length of 
the record
+            //We read the length of the record
+            $tmp = loadData("N", readFromBuffer(4));
             $this->shapeType = loadData("V", readFromBuffer(4));
         }
 
@@ -198,11 +203,15 @@ if (isset($plugin_list)) {
             $readPoints = 0;
             reset($this->SHPData["parts"]);
             while (list($partIndex, $partData) = 
each($this->SHPData["parts"])) {
-                if (!isset($this->SHPData["parts"][$partIndex]["points"]) || 
!is_array($this->SHPData["parts"][$partIndex]["points"])) {
+                if (! isset($this->SHPData["parts"][$partIndex]["points"])
+                    || !is_array($this->SHPData["parts"][$partIndex]["points"])
+                ) {
                     $this->SHPData["parts"][$partIndex] = array();
                     $this->SHPData["parts"][$partIndex]["points"] = array();
                 }
-                while (!in_array($readPoints, $this->SHPData["parts"]) && 
($readPoints < ($this->SHPData["numpoints"]))) {
+                while (! in_array($readPoints, $this->SHPData["parts"])
+                && ($readPoints < ($this->SHPData["numpoints"]))
+                ) {
                     $this->SHPData["parts"][$partIndex]["points"][] = 
$this->_loadPoint();
                     $readPoints++;
                 }
@@ -211,7 +220,8 @@ if (isset($plugin_list)) {
     }
 
     $shp = new PMA_ShapeFile(1);
-    // If the zip archive has more than one file, get the correct content to 
the buffer from .shp file.
+    // If the zip archive has more than one file,
+    // get the correct content to the buffer from .shp file.
     if ($compression == 'application/zip' && 
PMA_getNoOfFilesInZip($import_file) > 1) {
         $zip_content =  PMA_getZipContents($import_file, '/^.*\.shp$/i');
         $GLOBALS['import_text'] = $zip_content['data'];
@@ -220,7 +230,8 @@ if (isset($plugin_list)) {
     $temp_dbf_file = false;
     // We need dbase extension to handle .dbf file
     if (extension_loaded('dbase')) {
-        // If we can extract the zip archive to 'TempDir' and use the files in 
it for import
+        // If we can extract the zip archive to 'TempDir'
+        // and use the files in it for import
         if ($compression == 'application/zip'
             && ! empty($cfg['TempDir'])
             && is_writable($cfg['TempDir'])
@@ -229,9 +240,14 @@ if (isset($plugin_list)) {
             // If the corresponding .dbf file is in the zip archive
             if ($dbf_file_name) {
                 // Extract the .dbf file and point to it.
-                $extracted =  PMA_zipExtract($import_file, 
realpath($cfg['TempDir']), array($dbf_file_name));
+                $extracted =  PMA_zipExtract(
+                    $import_file,
+                    realpath($cfg['TempDir']),
+                    array($dbf_file_name)
+                );
                 if ($extracted) {
-                    $dbf_file_path = realpath($cfg['TempDir']) . 
(PMA_IS_WINDOWS ? '\\' : '/') . $dbf_file_name;
+                    $dbf_file_path = realpath($cfg['TempDir'])
+                        . (PMA_IS_WINDOWS ? '\\' : '/') . $dbf_file_name;
                     $temp_dbf_file = true;
                     // Replace the .dbf with .*, as required by the 
bsShapeFiles library.
                     $file_name = substr($dbf_file_path, 0, 
strlen($dbf_file_path) - 4) . '.*';
@@ -239,9 +255,14 @@ if (isset($plugin_list)) {
                 }
             }
         }
-        // If file is in UploadDir, use .dbf file in the same UploadDir to 
load extra data.
-        elseif (! empty($local_import_file) && ! empty($cfg['UploadDir']) && 
$compression == 'none') {
-            // Replace the .shp with .*, so the bsShapeFiles library correctly 
locates .dbf file.
+        // If file is in UploadDir, use .dbf file in the same UploadDir
+        // to load extra data.
+        elseif (! empty($local_import_file)
+            && ! empty($cfg['UploadDir'])
+            && $compression == 'none'
+        ) {
+            // Replace the .shp with .*,
+            // so the bsShapeFiles library correctly locates .dbf file.
             $file_name = substr($import_file, 0, strlen($import_file) - 4) . 
'.*';
             $shp->FileName = $file_name;
         }
@@ -278,41 +299,41 @@ if (isset($plugin_list)) {
         31 => 'MultiPatch',
     );
 
-    require_once './libraries/gis/pma_gis_geometry.php';
+    include_once './libraries/gis/pma_gis_geometry.php';
     switch ($shp->shapeType) {
-        // ESRI Null Shape
-        case 0:
-            $gis_obj = null;
-            break;
-        // ESRI Point
-        case 1:
-            require_once './libraries/gis/pma_gis_point.php';
-            $gis_obj = PMA_GIS_Point::singleton();
-            break;
-        // ESRI PolyLine
-        case 3:
-            require_once './libraries/gis/pma_gis_multilinestring.php';
-            $gis_obj = PMA_GIS_Multilinestring::singleton();
-            break;
-        // ESRI Polygon
-        case 5:
-            require_once './libraries/gis/pma_gis_multipolygon.php';
-            $gis_obj = PMA_GIS_Multipolygon::singleton();
-            break;
-        // ESRI MultiPoint
-        case 8:
-            require_once './libraries/gis/pma_gis_multipoint.php';
-            $gis_obj = PMA_GIS_Multipoint::singleton();
-            break;
-        default:
-            $error = true;
-            if (! isset($esri_types[$shp->shapeType])) {
-                $message = PMA_Message::error(__('You tried to import an 
invalid file or the imported file contains invalid data'));
-            } else {
-                $message = PMA_Message::error(__('MySQL Spatial Extension does 
not support ESRI type "%s".'));
-                $message->addParam($param);
-            }
-            return;
+    // ESRI Null Shape
+    case 0:
+        $gis_obj = null;
+        break;
+    // ESRI Point
+    case 1:
+        include_once './libraries/gis/pma_gis_point.php';
+        $gis_obj = PMA_GIS_Point::singleton();
+        break;
+    // ESRI PolyLine
+    case 3:
+        include_once './libraries/gis/pma_gis_multilinestring.php';
+        $gis_obj = PMA_GIS_Multilinestring::singleton();
+        break;
+    // ESRI Polygon
+    case 5:
+        include_once './libraries/gis/pma_gis_multipolygon.php';
+        $gis_obj = PMA_GIS_Multipolygon::singleton();
+        break;
+    // ESRI MultiPoint
+    case 8:
+        include_once './libraries/gis/pma_gis_multipoint.php';
+        $gis_obj = PMA_GIS_Multipoint::singleton();
+        break;
+    default:
+        $error = true;
+        if (! isset($esri_types[$shp->shapeType])) {
+            $message = PMA_Message::error(__('You tried to import an invalid 
file or the imported file contains invalid data'));
+        } else {
+            $message = PMA_Message::error(__('MySQL Spatial Extension does not 
support ESRI type "%s".'));
+            $message->addParam($param);
+        }
+        return;
     }
 
     $num_rows = count($shp->records);
@@ -322,7 +343,7 @@ if (isset($plugin_list)) {
     $rows = array();
     $col_names = array();
     if ($num_rows != 0) {
-        foreach($shp->records as $record){
+        foreach ($shp->records as $record) {
             $tempRow = array();
             if ($gis_obj == null) {
                 $tempRow[] = null;
@@ -345,13 +366,14 @@ if (isset($plugin_list)) {
         }
     }
 
-    if(count($rows) == 0) {
+    if (count($rows) == 0) {
         $error = true;
         $message = PMA_Message::error(__('The imported file does not contain 
any data'));
         return;
     }
 
-    // Column names for spatial column and the rest of the columns, if they 
are available
+    // Column names for spatial column and the rest of the columns,
+    // if they are available
     $col_names[] = 'SPATIAL';
     for ($n = 0; $n < $num_data_cols; $n++) {
         $col_names[] = $shp->DBFHeader[$n][0];


hooks/post-receive
-- 
phpMyAdmin

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Phpmyadmin-git mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-git

Reply via email to