aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Web
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-10-19 11:18:28 +0200
committerMario Vavti <mario@mariovavti.com>2018-10-19 11:18:28 +0200
commitfa9e9510e5d993d183feb942fe74be5fdd07f5cf (patch)
tree41fec09f527a9346e043b8099b458a97d81b03ed /Zotlabs/Web
parent32de123db0ac526795a237ff46885fe8a332cbc0 (diff)
parent06b3ad1071c755757555baf941e2c0f446f97b21 (diff)
downloadvolse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.tar.gz
volse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.tar.bz2
volse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.zip
Merge branch '3.8RC'3.8
Diffstat (limited to 'Zotlabs/Web')
-rw-r--r--Zotlabs/Web/HTTPSig.php13
-rw-r--r--Zotlabs/Web/HttpMeta.php15
-rw-r--r--Zotlabs/Web/Router.php32
-rw-r--r--Zotlabs/Web/SubModule.php17
4 files changed, 68 insertions, 9 deletions
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index df66ecf5c..f27aa0556 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -52,6 +52,7 @@ class HTTPSig {
$h = new \Zotlabs\Web\HTTPHeaders($data['header']);
$headers = $h->fetcharr();
$body = $data['body'];
+ $headers['(request-target)'] = $data['request_target'];
}
else {
@@ -60,6 +61,7 @@ class HTTPSig {
strtolower($_SERVER['REQUEST_METHOD']) . ' ' .
$_SERVER['REQUEST_URI'];
$headers['content-type'] = $_SERVER['CONTENT_TYPE'];
+ $headers['content-length'] = $_SERVER['CONTENT_LENGTH'];
foreach($_SERVER as $k => $v) {
if(strpos($k,'HTTP_') === 0) {
@@ -104,6 +106,17 @@ class HTTPSig {
if(strpos($h,'.')) {
$spoofable = true;
}
+ if($h === 'date') {
+ $d = new \DateTime($headers[$h]);
+ $d->setTimeZone(new \DateTimeZone('UTC'));
+ $dplus = datetime_convert('UTC','UTC','now + 1 day');
+ $dminus = datetime_convert('UTC','UTC','now - 1 day');
+ $c = $d->format('Y-m-d H:i:s');
+ if($c > $dplus || $c < $dminus) {
+ logger('bad time: ' . $c);
+ return $result;
+ }
+ }
}
$signed_data = rtrim($signed_data,"\n");
diff --git a/Zotlabs/Web/HttpMeta.php b/Zotlabs/Web/HttpMeta.php
index 469a9ed8b..ceaa82162 100644
--- a/Zotlabs/Web/HttpMeta.php
+++ b/Zotlabs/Web/HttpMeta.php
@@ -54,8 +54,19 @@ class HttpMeta {
}
}
if($this->check_required()) {
+ $arrayproperties = [ 'og:image' ];
foreach($this->og as $k => $v) {
- $o .= '<meta property="' . $k . '" content="' . urlencode($v) . '" />' . "\r\n" ;
+ if (in_array($k,$arrayproperties)) {
+ if (is_array($v)) {
+ foreach ($v as $v2) {
+ $o .= '<meta property="' . $k . '" content="' . $v2 . '" />' . "\r\n" ;
+ }
+ } else {
+ $o .= '<meta property="' . $k . '" content="' . $v . '" />' . "\r\n" ;
+ }
+ } else {
+ $o .= '<meta property="' . $k . '" content="' . $v . '" />' . "\r\n" ;
+ }
}
}
if($o)
@@ -63,4 +74,4 @@ class HttpMeta {
return $o;
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php
index fb551e36f..c4db0ef3e 100644
--- a/Zotlabs/Web/Router.php
+++ b/Zotlabs/Web/Router.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Web;
+use Zotlabs\Extend\Route;
use Exception;
/**
@@ -52,14 +53,31 @@ class Router {
* First see if we have a plugin which is masquerading as a module.
*/
- if(is_array(\App::$plugins) && in_array($module,\App::$plugins) && file_exists("addon/{$module}/{$module}.php")) {
- include_once("addon/{$module}/{$module}.php");
- if(class_exists($modname)) {
- $this->controller = new $modname;
- \App::$module_loaded = true;
+ $routes = Route::get();
+ if($routes) {
+ foreach($routes as $route) {
+ if(is_array($route) && strtolower($route[1]) === $module) {
+ include_once($route[0]);
+ if(class_exists($modname)) {
+ $this->controller = new $modname;
+ \App::$module_loaded = true;
+ }
+ }
}
- elseif(function_exists($module . '_module')) {
- \App::$module_loaded = true;
+ }
+
+ // legacy plugins - this can be removed when they have all been converted
+
+ if(! (\App::$module_loaded)) {
+ if(is_array(\App::$plugins) && in_array($module,\App::$plugins) && file_exists("addon/{$module}/{$module}.php")) {
+ include_once("addon/{$module}/{$module}.php");
+ if(class_exists($modname)) {
+ $this->controller = new $modname;
+ \App::$module_loaded = true;
+ }
+ elseif(function_exists($module . '_module')) {
+ \App::$module_loaded = true;
+ }
}
}
diff --git a/Zotlabs/Web/SubModule.php b/Zotlabs/Web/SubModule.php
index 7c8404201..763a55d86 100644
--- a/Zotlabs/Web/SubModule.php
+++ b/Zotlabs/Web/SubModule.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Web;
+use Zotlabs\Extend\Route;
+
/*
* @brief
*
@@ -31,9 +33,23 @@ class SubModule {
$filename = 'Zotlabs/Module/' . ucfirst(argv(0)) . '/'. ucfirst(argv($whicharg)) . '.php';
$modname = '\\Zotlabs\\Module\\' . ucfirst(argv(0)) . '\\' . ucfirst(argv($whicharg));
+
if(file_exists($filename)) {
$this->controller = new $modname();
}
+
+ $routes = Route::get();
+
+ if($routes) {
+ foreach($routes as $route) {
+ if(is_array($route) && strtolower($route[1]) === strtolower(argv(0)) . '/' . strtolower(argv($whicharg))) {
+ include_once($route[0]);
+ if(class_exists($modname)) {
+ $this->controller = new $modname;
+ }
+ }
+ }
+ }
}
/**
@@ -43,6 +59,7 @@ class SubModule {
* @return boolean|mixed
*/
function call($method) {
+
if(! $this->controller)
return false;