Changeset 691240
- Timestamp:
- 04/03/2013 03:50:16 PM (13 years ago)
- Location:
- open-data-viewer-for-austria/trunk
- Files:
-
- 6 edited
-
ckanfunc.php (modified) (4 diffs)
-
proxy.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
recline/initRecline.js (modified) (3 diffs)
-
recline/src/view.map.js (modified) (1 diff)
-
showdataexplorer.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
open-data-viewer-for-austria/trunk/ckanfunc.php
r682506 r691240 4 4 Plugin URI: http://apps4austria-open-data.ondics.de 5 5 Description: Open Data Viewer for Austria brings the full power of open data from Austria to your Wordpress site. 6 Version: 1.0. 66 Version: 1.0.7 7 7 Author: Ondics GmbH 8 8 Author URI: http://ondics.de … … 104 104 <script type="text/javascript"> 105 105 jQuery(document).ready(function($) { 106 wpCKANReclineViewer.createDataViewer(".data-explorer-here' . $NumberOfGrids . '", "' . urlencode(str_replace("&","&",$attr['url'])) . ' ", "' . $attr['type'] . '", ' . $strOptionsJson . ', "' . $attr['filters'] . '", "' . plugins_url("/proxy.php?url=", __FILE__) . '", "' . $attr['height'] . '", "' . $attr['width'] . '");106 wpCKANReclineViewer.createDataViewer(".data-explorer-here' . $NumberOfGrids . '", "' . urlencode(str_replace("&","&",$attr['url'])) . '&ispost=1&id=' . get_the_ID() . '", "' . urlencode(str_replace("&","&",$attr['metaurl'])) . '&ispost=1&id=' . get_the_ID() . '", "' . $attr['type'] . '", ' . $strOptionsJson . ', "' . $attr['filters'] . '", "' . plugins_url("/proxy.php?url=", __FILE__) . '", "' . $attr['height'] . '", "' . $attr['width'] . '"); 107 107 $.ajax({ 108 108 url: "' . $attr["metaurl"] . '", … … 364 364 var strClass = '.<?php echo $this->get_field_id( 'data-explorer-here' ); ?>'; 365 365 var strType = '<?php echo $instance['type']; ?>'; 366 var objOptions = <?php echo ($instance[$instance['type']] == "" ? "{}" : $instance[$instance['type']]); ?>;367 var url = "<?php echo urlencode($instance['url']); ?>" ;366 var objOptions = <?php echo ($instance[$instance['type']] == "" || $instance[$instance['type']] == "{" ? "{}" : $instance[$instance['type']]); ?>; 367 var url = "<?php echo urlencode($instance['url']); ?>" + "&ispost=0&id=<?php echo $this->number; ?>"; 368 368 var strFilters = "<?php echo $instance['filters']; ?>"; 369 369 var strFormat = "<?php echo $instance['format']; ?>"; … … 379 379 } 380 380 objOptions.format = strFormat; 381 wpCKANReclineViewer.createDataViewer(strClass, url, strType, objOptions, strFilters, "<?php echo plugins_url("/proxy.php?url=", __FILE__); ?>" , widgetHeight, widgetWidth); // Widget381 wpCKANReclineViewer.createDataViewer(strClass, url, '<?php echo urlencode(str_replace("&","&",$instance['metaurl'])); ?>' + "&ispost=0&id=<?php echo $this->number; ?>", strType, objOptions, strFilters, "<?php echo plugins_url("/proxy.php?url=", __FILE__); ?>" , widgetHeight, widgetWidth); // Widget 382 382 $(".<?php echo $this->get_field_id( 'ZoomLink' );?> > a").click(function() { 383 383 wpCKANReclineViewer.createDataViewer("#<?php echo $this->get_field_id( 'ZoomPopup' ); ?>", url, strType, objOptions, strFilters, "<?php echo plugins_url("/proxy.php?url=", __FILE__); ?>",popupHeight, popupWidth); // Widget im Popup -
open-data-viewer-for-austria/trunk/proxy.php
r681293 r691240 2 2 require( '../../../wp-load.php' ); 3 3 4 // this proxy is needed because to get the ckan data from a foreign server 5 // The code checks if the requested url is in shortcode-data or widget-data 6 // If yes the request will be executed, if not =>'forbidden' 7 // If the user is logined the request will be also executed 4 8 5 // this proxy is needed because to get the ckan data from a foreign server6 9 $url = urldecode(($_GET['url'])); 7 $url = str_replace(" ","%20",$url); 10 $nr = $_GET['id']; 11 $blnPost = $_GET['ispost']; 12 $urlCheck = $url; 13 $requestUrl = str_replace(" ","%20",$url); 8 14 if (strpos($url, "pop") !== FALSE) return ""; // http://www.heise.de/newsticker/meldung/cURL-auf-Abwegen-1800433.html 9 15 10 $response = wp_remote_get($url, array("user-agent" => "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0", 'sslverify' => false, 'timeout' => '1200', "redirection" => 5 )); 11 $output = wp_remote_retrieve_body($response); // using a common useragent to prevent blocking from some server 16 if (!is_user_logged_in()) { 17 if (isset($nr)) { 18 if ($blnPost === "1") { 19 $post = get_post($nr, ARRAY_A); 20 if ($post != null) { 21 $iPos = 0; 22 $content = $post["post_content"]; 23 $iPos = strpos($content, htmlentities($urlCheck)); 24 if ($iPos !== false) { 25 getAndReturn($requestUrl); 26 } 27 } 28 } else { 29 $aryWidgetDatas = get_option('widget_CkanWidget'); 30 if ($aryWidgetDatas[$nr]["url"] == $urlCheck || $aryWidgetDatas[$nr]["metaurl"] == $urlCheck) { 31 getAndReturn($requestUrl); 32 } 33 } 34 } 35 } else { 36 getAndReturn($url); 37 } 38 denied(); 12 39 13 // this code converts to utf-8 when needed. But mb_check_encoding is critical code! http://de2.php.net/manual/de/function.mb-check-encoding.php 14 if(!mb_check_encoding($output, 'UTF-8')) { // only convert when string is not utf-8 15 echo utf8_encode($output); 16 } else { 17 echo $output; 40 41 42 function getAndReturn($url) { 43 $url = str_replace(" ","%20",$url); 44 $response = wp_remote_get($url, array("user-agent" => "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0", 'sslverify' => true, 'timeout' => '1200', "redirection" => 10 )); 45 $output = wp_remote_retrieve_body($response); // using a common useragent to prevent blocking from some server 46 47 // this code converts to utf-8 when needed. But mb_check_encoding is critical code! http://de2.php.net/manual/de/function.mb-check-encoding.php 48 if(!mb_check_encoding($output, 'UTF-8')) { // only convert when string is not utf-8 49 echo utf8_encode($output); 50 } else { 51 echo $output; 52 } 53 exit; 54 } 55 56 function denied() { 57 header('HTTP/1.1 403 Forbidden'); 58 echo "Access denied"; 59 exit; 18 60 } 19 61 -
open-data-viewer-for-austria/trunk/readme.txt
r682511 r691240 1 === Open Data Viewer for Austria ===1 === Open Data Viewer for Austria === 2 2 Contributors: ondics 3 3 Donate link: http://ondics.de … … 5 5 Requires at least: 3.3 6 6 Tested up to: 3.5.1 7 Stable tag: 1.0. 67 Stable tag: 1.0.7 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 175 175 == Changelog == 176 176 177 = 1.0.7 = 178 179 * security fix (thanks to C. Mehlmauer) 180 177 181 = 1.0.6 = 178 182 -
open-data-viewer-for-austria/trunk/recline/initRecline.js
r680599 r691240 100 100 var wpCKANReclineViewer = function () {} 101 101 wpCKANReclineViewer.prototype = { 102 createDataViewer: function (strContainerId, strUrl, str Type, objTypeOptions, strFilters, strProxyUrl, height, width) {102 createDataViewer: function (strContainerId, strUrl, strMetaUrl, strType, objTypeOptions, strFilters, strProxyUrl, height, width) { 103 103 $(strContainerId).html(""); 104 104 window.dataExplorer = null; … … 113 113 var $el = $('<div />'); 114 114 $el.appendTo(window.explorerDiv); 115 116 115 var strProxy = strProxyUrl || "../wp-content/plugins/ckan/proxy.php?url="; 117 116 var format = objTypeOptions.format || "csv"; 118 117 if (format == "json") format = "geojson"; 118 119 119 var dataset = new recline.Model.Dataset({ 120 120 url: strProxy + strUrl, … … 191 191 var url = opts.metaurl; 192 192 $.ajax({ 193 url: strProxy + opts.metaurl,193 url: strProxy + (strMetaUrl), 194 194 contentType: "json", 195 195 dataType: "json" -
open-data-viewer-for-austria/trunk/recline/src/view.map.js
r668365 r691240 407 407 var lat = doc.get(this.state.get('latField')); 408 408 // Replaces in lat- and lonField , with . as decimal seperator 409 lon = lon.replace(",", ".");410 lat = lat.replace(",", ".");411 409 if (lon != null) lon = lon.toString().replace(",", "."); 410 if (lat != null) lat = lat.toString().replace(",", "."); 411 412 412 if (!isNaN(parseFloat(lon)) && !isNaN(parseFloat(lat))) { 413 413 return { -
open-data-viewer-for-austria/trunk/showdataexplorer.php
r681293 r691240 63 63 var strType = '<?php echo $aryData['type']; ?>'; 64 64 var objOptions = <?php echo ($aryData[$aryData['type']] == "" ? "{}": $aryData[$aryData['type']]); ?>; 65 var url = "<?php echo urlencode($aryData['url']); ?>" ;65 var url = "<?php echo urlencode($aryData['url']); ?>" + "&ispost=0&id=<?php echo $id; ?>"; 66 66 var strFilters = "<?php echo $aryData['filters']; ?>"; 67 67 wpCKANReclineViewer.createDataViewer(strClass, url, strType, objOptions, strFilters, "proxy.php?url=", 500, 500);
Note: See TracChangeset
for help on using the changeset viewer.