turn url requests where argv[0] is something.xyz into module='something' and $_REQUEST['module_format'] = 'xyz'; But leave modules beginning with . (like .well_known) alone (convert the initial . to _ and then strip it). This really only affects Siteinfo_json at this time.

This commit is contained in:
zotlabs 2017-07-13 20:53:05 -07:00
parent 2d119c81a4
commit 266dab1b59
3 changed files with 8 additions and 18 deletions

View File

@ -5,14 +5,13 @@ namespace Zotlabs\Module;
class Siteinfo extends \Zotlabs\Web\Controller {
function init() {
if (argv(1) === 'json') {
logger(print_r($_REQUEST,true));
if (argv(1) === 'json' || $_REQUEST['module_format'] === 'json') {
$data = get_site_info();
json_return_and_die($data);
}
}
function get() {
$siteinfo = replace_macros(get_markup_template('siteinfo.tpl'),

View File

@ -1,14 +0,0 @@
<?php
namespace Zotlabs\Module;
class Siteinfo_json extends \Zotlabs\Web\Controller {
function init() {
$data = get_site_info();
json_return_and_die($data);
}
}

View File

@ -899,6 +899,11 @@ class App {
self::$argv = explode('/', self::$cmd);
self::$argc = count(self::$argv);
if ((array_key_exists('0', self::$argv)) && strlen(self::$argv[0])) {
if(strpos(self::$argv[0],'.')) {
$_REQUEST['module_format'] = substr(self::$argv[0],strpos(self::$argv[0],'.')+1);
self::$argv[0] = substr(self::$argv[0],0,strpos(self::$argv[0],'.'));
}
self::$module = str_replace(".", "_", self::$argv[0]);
self::$module = str_replace("-", "_", self::$module);
if(strpos(self::$module,'_') === 0)