fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16136] enable quotes in dataset for import


From: sigurdne
Subject: [Fmsystem-commits] [16136] enable quotes in dataset for import
Date: Tue, 3 Jan 2017 17:50:05 +0000 (UTC)

Revision: 16136
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16136
Author:   sigurdne
Date:     2017-01-03 17:50:05 +0000 (Tue, 03 Jan 2017)
Log Message:
-----------
enable quotes in dataset for import

Modified Paths:
--------------
    branches/dev-syncromind-2/phpgwapi/inc/class.db.inc.php
    branches/dev-syncromind-2/property/inc/class.uiimport_components.inc.php

Modified: branches/dev-syncromind-2/phpgwapi/inc/class.db.inc.php
===================================================================
--- branches/dev-syncromind-2/phpgwapi/inc/class.db.inc.php     2017-01-03 
17:19:39 UTC (rev 16135)
+++ branches/dev-syncromind-2/phpgwapi/inc/class.db.inc.php     2017-01-03 
17:50:05 UTC (rev 16136)
@@ -412,13 +412,17 @@
                                {
                                        if ( is_numeric($value) )
                                        {
-                                               $insert_value[] = "'$value'";
+                                               $insert_value[] = "'{$value}'";
                                        }
                                        else
                                        {
                                                $insert_value[] = "'" . 
$this->db_addslashes(stripslashes($value)) . "'"; //in case slashes are already 
added.
                                        }
                                }
+                               else if($value && $this->isJson($value))
+                               {
+                                       $insert_value[] = "'{$value}'";
+                               }
                                else
                                {
                                        $insert_value[] = 'NULL';
@@ -427,6 +431,12 @@
                        return implode(",", $insert_value);
                }
 
+               final public function isJson($string)
+               {
+                       json_decode($string);
+                       return (json_last_error() == JSON_ERROR_NONE);
+               }
+
                /**
                 * Prepare the SET component of an UPDATE sql statement
                 *
@@ -461,6 +471,10 @@
                                                $value_entry[]= 
"{$field}='{$value}'";
                                        }
                                }
+                               else if($value && $this->isJson($value))
+                               {
+                                       $value_entry[]= "{$field}='{$value}'";
+                               }
                                else
                                {
                                        $value_entry[]= "{$field}=NULL";

Modified: 
branches/dev-syncromind-2/property/inc/class.uiimport_components.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uiimport_components.inc.php    
2017-01-03 17:19:39 UTC (rev 16135)
+++ branches/dev-syncromind-2/property/inc/class.uiimport_components.inc.php    
2017-01-03 17:50:05 UTC (rev 16136)
@@ -500,8 +500,7 @@
 
                                foreach ($columns as $_row_key => $_value_key)
                                {
-                                       $_result[$_value_key] = 
$objPHPExcel->getActiveSheet()->getCell("{$_row_key}{$i}")->getCalculatedValue();
-                               }
+                                       $_result[$_value_key] = 
htmlspecialchars($objPHPExcel->getActiveSheet()->getCell("{$_row_key}{$i}")->getCalculatedValue(),
 ENT_QUOTES, 'UTF-8');                                }
 
                                if ((int)$_result['building_part'] || 
$_result['building_part'] === '0')
                                {




reply via email to

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