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:
parent
2d119c81a4
commit
266dab1b59
@ -5,14 +5,13 @@ namespace Zotlabs\Module;
|
|||||||
class Siteinfo extends \Zotlabs\Web\Controller {
|
class Siteinfo extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if (argv(1) === 'json') {
|
logger(print_r($_REQUEST,true));
|
||||||
|
if (argv(1) === 'json' || $_REQUEST['module_format'] === 'json') {
|
||||||
$data = get_site_info();
|
$data = get_site_info();
|
||||||
json_return_and_die($data);
|
json_return_and_die($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function get() {
|
function get() {
|
||||||
|
|
||||||
$siteinfo = replace_macros(get_markup_template('siteinfo.tpl'),
|
$siteinfo = replace_macros(get_markup_template('siteinfo.tpl'),
|
||||||
|
@ -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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
5
boot.php
5
boot.php
@ -899,6 +899,11 @@ class App {
|
|||||||
self::$argv = explode('/', self::$cmd);
|
self::$argv = explode('/', self::$cmd);
|
||||||
self::$argc = count(self::$argv);
|
self::$argc = count(self::$argv);
|
||||||
if ((array_key_exists('0', self::$argv)) && strlen(self::$argv[0])) {
|
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::$argv[0]);
|
||||||
self::$module = str_replace("-", "_", self::$module);
|
self::$module = str_replace("-", "_", self::$module);
|
||||||
if(strpos(self::$module,'_') === 0)
|
if(strpos(self::$module,'_') === 0)
|
||||||
|
Reference in New Issue
Block a user