[Mapbender-commits] r9938 - in trunk/mapbender: core http/extensions http/geoportal http/html http/javascripts http_auth/http lib owsproxy/http
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Aug 9 05:56:03 PDT 2018
Author: armin11
Date: 2018-08-09 05:56:03 -0700 (Thu, 09 Aug 2018)
New Revision: 9938
Modified:
trunk/mapbender/core/globalSettings.php
trunk/mapbender/http/extensions/DifferenceEngine.php
trunk/mapbender/http/extensions/JSON.php
trunk/mapbender/http/geoportal/class_gml2_DOG.php
trunk/mapbender/http/geoportal/class_gml3.php
trunk/mapbender/http/geoportal/gaz_geom.php
trunk/mapbender/http/geoportal/gaz_geom_mobile.php
trunk/mapbender/http/html/mod_blank.html
trunk/mapbender/http/javascripts/initWmcObj.php
trunk/mapbender/http_auth/http/index.php
trunk/mapbender/lib/exception.js
trunk/mapbender/owsproxy/http/index.php
Log:
Last fixes for php7 compatibility thanx to http://www.benndorf.de financed by the federal german state Hesse
Modified: trunk/mapbender/core/globalSettings.php
===================================================================
--- trunk/mapbender/core/globalSettings.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/core/globalSettings.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -48,5 +48,9 @@
require_once dirname(__FILE__) . "/../http/classes/class_locale.php";
$localeObj = new Mb_locale(Mapbender::session()->get("mb_lang"));
+//
+// globally used includes (due to PHP Version changes)
+//
+require_once dirname(__FILE__) . "/../http/php/wrappers/includes.php";
?>
Modified: trunk/mapbender/http/extensions/DifferenceEngine.php
===================================================================
--- trunk/mapbender/http/extensions/DifferenceEngine.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http/extensions/DifferenceEngine.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -30,13 +30,21 @@
class _DiffOp_Copy extends _DiffOp {
var $type = 'copy';
- function _DiffOp_Copy ($orig, $closing = false) {
+ function __construct ($orig, $closing = false) {
if (!is_array($closing))
$closing = $orig;
$this->orig = $orig;
$this->closing = $closing;
}
+
+/**
+* Old constructor to keep PHP downward compatibility
+*/
+ function _DiffOp_Copy ($orig, $closing = false) {
+ self::__construct($orig, $closing);
+ }
+
function reverse() {
return new _DiffOp_Copy($this->closing, $this->orig);
}
@@ -45,11 +53,16 @@
class _DiffOp_Delete extends _DiffOp {
var $type = 'delete';
- function _DiffOp_Delete ($lines) {
+ function __construct ($lines) {
$this->orig = $lines;
$this->closing = false;
}
+
+ function _DiffOp_Delete ($lines) {
+ self::__construct($lines);
+ }
+
function reverse() {
return new _DiffOp_Add($this->orig);
}
@@ -58,10 +71,14 @@
class _DiffOp_Add extends _DiffOp {
var $type = 'add';
- function _DiffOp_Add ($lines) {
+ function __construct ($lines) {
$this->closing = $lines;
$this->orig = false;
}
+
+ function _DiffOp_Add ($lines) {
+ self::__construct($lines);
+ }
function reverse() {
return new _DiffOp_Delete($this->closing);
@@ -71,11 +88,16 @@
class _DiffOp_Change extends _DiffOp {
var $type = 'change';
- function _DiffOp_Change ($orig, $closing) {
+ function __construct ($orig, $closing) {
$this->orig = $orig;
$this->closing = $closing;
}
+
+ function _DiffOp_Change ($orig, $closing) {
+ self::__construct($orig, $closing);
+ }
+
function reverse() {
return new _DiffOp_Change($this->closing, $this->orig);
}
@@ -501,12 +523,17 @@
* (Typically these are lines from a file.)
* @param $to_lines array An array of strings.
*/
- function Diff($from_lines, $to_lines) {
+ function __construct($from_lines, $to_lines) {
$eng = new _DiffEngine;
$this->edits = $eng->diff($from_lines, $to_lines);
//$this->_check($from_lines, $to_lines);
}
+
+ function Diff($from_lines, $to_lines) {
+ self::__construct($from_lines, $to_lines);
+ }
+
/**
* Compute reversed Diff.
*
@@ -627,52 +654,61 @@
class MappedDiff
extends Diff
{
- /**
- * Constructor.
- *
- * Computes diff between sequences of strings.
- *
- * This can be used to compute things like
- * case-insensitve diffs, or diffs which ignore
- * changes in white-space.
- *
- * @param $from_lines array An array of strings.
- * (Typically these are lines from a file.)
- *
- * @param $to_lines array An array of strings.
- *
- * @param $mapped_from_lines array This array should
- * have the same size number of elements as $from_lines.
- * The elements in $mapped_from_lines and
- * $mapped_to_lines are what is actually compared
- * when computing the diff.
- *
- * @param $mapped_to_lines array This array should
- * have the same number of elements as $to_lines.
- */
- function MappedDiff($from_lines, $to_lines,
- $mapped_from_lines, $mapped_to_lines) {
+ /**
+ * Constructor.
+ *
+ * Computes diff between sequences of strings.
+ *
+ * This can be used to compute things like
+ * case-insensitve diffs, or diffs which ignore
+ * changes in white-space.
+ *
+ * @param $from_lines array An array of strings.
+ * (Typically these are lines from a file.)
+ *
+ * @param $to_lines array An array of strings.
+ *
+ * @param $mapped_from_lines array This array should
+ * have the same size number of elements as $from_lines.
+ * The elements in $mapped_from_lines and
+ * $mapped_to_lines are what is actually compared
+ * when computing the diff.
+ *
+ * @param $mapped_to_lines array This array should
+ * have the same number of elements as $to_lines.
+ */
+ function __construct($from_lines, $to_lines,
+ $mapped_from_lines, $mapped_to_lines) {
- assert(sizeof($from_lines) == sizeof($mapped_from_lines));
- assert(sizeof($to_lines) == sizeof($mapped_to_lines));
+ assert(sizeof($from_lines) == sizeof($mapped_from_lines));
+ assert(sizeof($to_lines) == sizeof($mapped_to_lines));
- $this->Diff($mapped_from_lines, $mapped_to_lines);
+ $this->Diff($mapped_from_lines, $mapped_to_lines);
- $xi = $yi = 0;
- for ($i = 0; $i < sizeof($this->edits); $i++) {
- $orig = &$this->edits[$i]->orig;
- if (is_array($orig)) {
- $orig = array_slice($from_lines, $xi, sizeof($orig));
- $xi += sizeof($orig);
- }
+ $xi = $yi = 0;
+ for ($i = 0; $i < sizeof($this->edits); $i++) {
+ $orig = &$this->edits[$i]->orig;
+ if (is_array($orig)) {
+ $orig = array_slice($from_lines, $xi, sizeof($orig));
+ $xi += sizeof($orig);
+ }
- $closing = &$this->edits[$i]->closing;
- if (is_array($closing)) {
- $closing = array_slice($to_lines, $yi, sizeof($closing));
- $yi += sizeof($closing);
- }
+ $closing = &$this->edits[$i]->closing;
+ if (is_array($closing)) {
+ $closing = array_slice($to_lines, $yi, sizeof($closing));
+ $yi += sizeof($closing);
+ }
+ }
}
- }
+ /**
+ * Old constructor to keep PHP downward compatibility
+ */
+ function MappedDiff($from_lines, $to_lines, $mapped_from_lines,
+ $mapped_to_lines) {
+
+ self::__construct($from_lines, $to_lines, $mapped_from_lines,
+ $mapped_to_lines);
+ }
}
/**
@@ -837,12 +873,16 @@
define('NBSP', "\xC2\xA0"); // utf-8 non-breaking space.
class _HWLDF_WordAccumulator {
- function _HWLDF_WordAccumulator () {
+ function __construct () {
$this->_lines = array();
$this->_line = '';
$this->_group = '';
$this->_tag = '';
}
+
+ function _HWLDF_WordAccumulator () {
+ self::__construct();
+ }
function _flushGroup ($new_tag) {
if ($this->_group !== '') {
@@ -888,15 +928,19 @@
class WordLevelDiff extends MappedDiff
{
- function WordLevelDiff ($orig_lines, $closing_lines) {
+ function __construct ($orig_lines, $closing_lines) {
list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
-
$this->MappedDiff($orig_words, $closing_words,
$orig_stripped, $closing_stripped);
}
+
+ function WordLevelDiff ($orig_lines, $closing_lines) {
+ self::__construct($orig_lines, $closing_lines);
+ }
+
function _split($lines) {
// FIXME: fix POSIX char class.
# if (!preg_match_all('/ ( [^\S\n]+ | [[:alnum:]]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
@@ -940,11 +984,16 @@
*/
class UnifiedDiffFormatter extends DiffFormatter
{
- function UnifiedDiffFormatter($context_lines = 4) {
+ function __construct($context_lines = 4) {
$this->leading_context_lines = $context_lines;
$this->trailing_context_lines = $context_lines;
}
+
+ function UnifiedDiffFormatter($context_lines = 4) {
+ self::__construct($context_lines);
+ }
+
function _block_header($xbeg, $xlen, $ybeg, $ylen) {
if ($xlen != 1)
$xbeg .= "," . $xlen;
@@ -971,11 +1020,16 @@
*/
class TableDiffFormatter extends DiffFormatter
{
- function TableDiffFormatter() {
+ function __construct() {
$this->leading_context_lines = 2;
$this->trailing_context_lines = 2;
}
+
+ function TableDiffFormatter() {
+ self::__construct();
+ }
+
function _pre($text){
$text = htmlspecialchars($text);
$text = str_replace(' ',' ',$text);
Modified: trunk/mapbender/http/extensions/JSON.php
===================================================================
--- trunk/mapbender/http/extensions/JSON.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http/extensions/JSON.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -130,10 +130,18 @@
* bubble up with an error, so all return values
* from encode() should be checked with isError()
*/
- function Services_JSON($use = 0)
+ function __construct($use = 0)
{
$this->use = $use;
}
+
+ /**
+ * Old constructor to keep PHP downward compatibility
+ */
+ function Services_JSON($use = 0)
+ {
+ self::__construct($use);
+ }
/**
* convert a string from one UTF-16 char to one UTF-8 char
@@ -780,10 +788,16 @@
class Services_JSON_Error extends PEAR_Error
{
+ function __construct($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null)
+ {
+ parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
+ }
+
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
- parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
+ self::__construct($message, $code, $mode, $options, $userinfo);
}
}
@@ -794,11 +808,17 @@
*/
class Services_JSON_Error
{
- function Services_JSON_Error($message = 'unknown error', $code = null,
- $mode = null, $options = null, $userinfo = null)
+ function __construct($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null)
{
}
+
+ function Services_JSON_Error($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null)
+ {
+ self::__construct($message, $code, $mode, $options, $userinfo);
+ }
}
}
Modified: trunk/mapbender/http/geoportal/class_gml2_DOG.php
===================================================================
--- trunk/mapbender/http/geoportal/class_gml2_DOG.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http/geoportal/class_gml2_DOG.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -38,9 +38,18 @@
var $geomFeaturetypeElement = null;
- function gml2(){
+ function __construct(){
$this->geometries = array($this->geomtype_point, $this->geomtype_polygon, $this->geomtype_line, $this->geomtype_multipolygon, $this->geomtype_multiline);
}
+
+ /**
+ * Old constructor to keep PHP downward compatibility
+ */
+ function gml2(){
+ self::__construct();
+ }
+
+
function getGml($req){
$x = new connector($req);
return $x->file;
@@ -496,7 +505,7 @@
}
function sepNameSpace($s){
- list($ns,$FeaturePropertyName) = split(":",$s);
+ list($ns,$FeaturePropertyName) = mbw_split(":",$s);
$nodeName = array('ns' => $ns, 'value' => $FeaturePropertyName);
return $nodeName;
}
Modified: trunk/mapbender/http/geoportal/class_gml3.php
===================================================================
--- trunk/mapbender/http/geoportal/class_gml3.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http/geoportal/class_gml3.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -39,9 +39,17 @@
var $geomFeaturetypeElement = null;
- function gml3(){
+ function __construct(){
$this->geometries = array($this->geomtype_point, $this->geomtype_polygon, $this->geomtype_line, $this->geomtype_multipolygon, $this->geomtype_multiline);
}
+
+ /**
+ * Old constructor to keep PHP downward compatibility
+ */
+ function gml3(){
+ self::__construct();
+ }
+
function getGml($req){
$x = new connector($req);
return $x->file;
@@ -480,7 +488,7 @@
}
function sepNameSpace($s){
- list($ns,$FeaturePropertyName) = split(":",$s);
+ list($ns,$FeaturePropertyName) = mbw_split(":",$s);
$nodeName = array('ns' => $ns, 'value' => $FeaturePropertyName);
return $nodeName;
}
Modified: trunk/mapbender/http/geoportal/gaz_geom.php
===================================================================
--- trunk/mapbender/http/geoportal/gaz_geom.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http/geoportal/gaz_geom.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -79,7 +79,7 @@
/****** Workflow *********************************/
/**/
-$astr = split(",",replaceChars($sstr));
+$astr = mbw_split(",",replaceChars($sstr));
if(count($astr) == 1){
$astr[0] = trim($astr[0]);
$plz = getPlz($astr[0]);
Modified: trunk/mapbender/http/geoportal/gaz_geom_mobile.php
===================================================================
--- trunk/mapbender/http/geoportal/gaz_geom_mobile.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http/geoportal/gaz_geom_mobile.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -144,7 +144,7 @@
/**/
$test = str_replace("ß", "ss", $sstr);
$e = new mb_notice("replaced test string: ".$test);
-$astr = split(",",replaceChars($sstr));
+$astr = mbw_split(",",replaceChars($sstr));
$e = new mb_notice("replaced string: ".$astr[0]." ".$astr[1]." ".$astr[2]);
//if only one string without any comma is given
if(count($astr) == 1){
Modified: trunk/mapbender/http/html/mod_blank.html
===================================================================
--- trunk/mapbender/http/html/mod_blank.html 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http/html/mod_blank.html 2018-08-09 12:56:03 UTC (rev 9938)
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- version 2.0.0 -->
-<html>
+<html lang="en">
<head>
<title>Blank</title>
</head>
Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http/javascripts/initWmcObj.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -212,7 +212,7 @@
}
// WMS param given as comma separated list
else {
- $inputWmsArray = split(",",$getParams['WMS']);
+ $inputWmsArray = mbw_split(",",$getParams['WMS']);
}
$wmsArray = array();
$singleAssocArray = array();
Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/http_auth/http/index.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -524,13 +524,25 @@
}
break;
case '':
- $arrayFeatures = getWfsFeaturesFromTransaction($HTTP_RAW_POST_DATA);
+ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+ $arrayFeatures = getWfsFeaturesFromTransaction($HTTP_RAW_POST_DATA);
+ }
+ else {
+ $rawpostdata = file_get_contents("php://input");
+ $arrayFeatures = getWfsFeaturesFromTransaction($rawpostdata);
+ }
$arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
$query->setOnlineResource($arrayOnlineresources['wfs_transaction']);
$request = $query->getRequest();
//TODO: following is not the standard way because ows has not to handle vsp!!!
$request = delTotalFromQuery("wfs_id",$request);
- doTransaction($request, $HTTP_RAW_POST_DATA);
+ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+ doTransaction($request, $HTTP_RAW_POST_DATA);
+ }
+ else {
+ $rawpostdata = file_get_contents("php://input");
+ doTransaction($request, $rawpostdata);
+ }
break;
default:
echo 'Your are logged in as: <b>' . $requestHeaderArray['username'] . '</b> and requested the layer/featuretype with id=<b>' . $layerId . '</b> but your request is not a valid OWS request';
Modified: trunk/mapbender/lib/exception.js
===================================================================
--- trunk/mapbender/lib/exception.js 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/lib/exception.js 2018-08-09 12:56:03 UTC (rev 9938)
@@ -3,7 +3,7 @@
//An abstract class, logs JavaScript events like errors, warnings etc.
var Mb_log = function () {
var that = this;
-
+
var levelArray = global_log_levels.split(",");
var log_level = global_mb_log_level;
var log_js = global_mb_log_js;
@@ -23,6 +23,12 @@
return (isNotOff && isAppropriate);
};
this.throwException = function (message, level) {
+ if (Mb_log.caller == null){
+ message = ' NN - ' + message;
+ }
+ else {
+ message = Mb_log.caller + ' - ' + message;
+ }
if (isValidLevel(level)) {
if (log_js == "on") {
try {
Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php 2018-08-09 12:43:50 UTC (rev 9937)
+++ trunk/mapbender/owsproxy/http/index.php 2018-08-09 12:56:03 UTC (rev 9938)
@@ -481,11 +481,23 @@
break;
// case wfs transaction (because of raw POST the request param is empty)
case '':
- $arrayFeatures = getWfsFeaturesFromTransaction($HTTP_RAW_POST_DATA);
+ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+ $arrayFeatures = getWfsFeaturesFromTransaction($HTTP_RAW_POST_DATA);
+ }
+ else {
+ $rawpostdata = file_get_contents("php://input");
+ $arrayFeatures = getWfsFeaturesFromTransaction($rawpostdata);
+ }
$arrayOnlineresources = checkWfsPermission($query->getOwsproxyServiceId(), $arrayFeatures, $userId);
$query->setOnlineResource($arrayOnlineresources['wfs_transaction']);
$request = $query->getRequest();
- doTransaction($request, $HTTP_RAW_POST_DATA);
+ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+ doTransaction($request, $HTTP_RAW_POST_DATA);
+ }
+ else {
+ $rawpostdata = file_get_contents("php://input");
+ doTransaction($request, $rawpostdata);
+ }
break;
default:
throwText(array("Request parameter not known to mapbender security proxy!"));
More information about the Mapbender_commits
mailing list