]> git.nbdom.net Git - nb.git/commitdiff
etc/dbq/pub.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 8 Jan 2018 03:41:30 +0000 (03:41 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 8 Jan 2018 03:41:30 +0000 (03:41 +0000)
etc/dbq/pub.php

index 16f7e092feb30a725e24fabf99b241edde74ac91..22c2d54bcea4ebc5710988c41735ebff441a02b0 100644 (file)
@@ -1,8 +1,14 @@
 <?php
 require_once(realpath(dirname(__FILE__).'/../../lib/php/maps.php'));
 
-$nohtml = (bool)( self::php_cli() or self::client_content_type('text/plain') != 'text/html' );
+$html = ( self::php_cli() or self::client_content_type('text/plain') != 'text/html' ) ? true : false;
+if ($html) {
+       # CORS Cross scheme allowed
+       header('Access-Control-Allow-Origin: *');
+       header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
+}
+
 $DBQ['pub'] = [
-       'row_parse_post' => $nohtml ? null : function(&$r,&$t) { Maps::html($r); },
+       'row_parse_post' => !$html ? null : function(&$r,&$t) { Maps::html($r); },
 ];
 ?>