mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 05:58:42 +00:00
General bug fixes
This commit is contained in:
parent
1f1090424b
commit
bab6abfd0d
|
|
@ -73,6 +73,8 @@ class Autoloader
|
||||||
return $class;
|
return $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo $class;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ class Dispatcher
|
||||||
throw new \UnexpectedValueException('Unexpected function.');
|
throw new \UnexpectedValueException('Unexpected function.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $views
|
return $views;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function dispatchArray(array $controller, RequestAbstract $request, ResponseAbstract $response, $data = null) : array
|
private function dispatchArray(array $controller, RequestAbstract $request, ResponseAbstract $response, $data = null) : array
|
||||||
|
|
|
||||||
32
Message/HeaderAbstract.php
Normal file
32
Message/HeaderAbstract.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.0
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright 2013 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
namespace phpOMS\Message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response class.
|
||||||
|
*
|
||||||
|
* @category Framework
|
||||||
|
* @package phpOMS\Response
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class HeaderAbstract
|
||||||
|
{
|
||||||
|
private static $isLocked = false;
|
||||||
|
}
|
||||||
|
|
@ -15,10 +15,7 @@
|
||||||
*/
|
*/
|
||||||
namespace phpOMS\Message\Http;
|
namespace phpOMS\Message\Http;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
use phpOMS\Message\HeaderAbstract;
|
||||||
use phpOMS\Contract\RenderableInterface;
|
|
||||||
use phpOMS\Message\ResponseAbstract;
|
|
||||||
use phpOMS\Model\Html\Head;
|
|
||||||
use phpOMS\Utils\ArrayUtils;
|
use phpOMS\Utils\ArrayUtils;
|
||||||
use phpOMS\DataStorage\Cookie\CookieJar;
|
use phpOMS\DataStorage\Cookie\CookieJar;
|
||||||
use phpOMS\DataStorage\Session\HttpSession;
|
use phpOMS\DataStorage\Session\HttpSession;
|
||||||
|
|
@ -50,6 +47,19 @@ class Header extends HeaderAbstract
|
||||||
$this->setHeader('Content-Type', 'text/html; charset=utf-8');
|
$this->setHeader('Content-Type', 'text/html; charset=utf-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHeaders() : array
|
||||||
|
{
|
||||||
|
return getallheaders();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getHeader(string $name) : string
|
||||||
|
{
|
||||||
|
return getallheaders()[$name];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove header by ID.
|
* Remove header by ID.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -401,30 +401,6 @@ class Request extends RequestAbstract
|
||||||
return $_SERVER['SERVER_PROTOCOL'];
|
return $_SERVER['SERVER_PROTOCOL'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getHeaders() : array
|
|
||||||
{
|
|
||||||
return getallheaders();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function hasHeader(string $name) : bool
|
|
||||||
{
|
|
||||||
return array_key_exists($name, getallheaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getHeader(string $name) : string
|
|
||||||
{
|
|
||||||
return getallheaders()[$name];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
@ -454,11 +430,6 @@ class Request extends RequestAbstract
|
||||||
return $this->files;
|
return $this->files;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setHeader($key, string $header, bool $overwrite = true)
|
|
||||||
{
|
|
||||||
// NOT Required for Http request
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRouteVerb() : int
|
public function getRouteVerb() : int
|
||||||
{
|
{
|
||||||
switch($this->method) {
|
switch($this->method) {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @link http://orange-management.com
|
* @link http://orange-management.com
|
||||||
*/
|
*/
|
||||||
namespace phpOMS\Message;
|
namespace phpOMS\Message\Http;
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
use phpOMS\Datatypes\Enum;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,9 @@
|
||||||
*/
|
*/
|
||||||
namespace phpOMS\Message\Http;
|
namespace phpOMS\Message\Http;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
use phpOMS\System\MimeType;
|
||||||
use phpOMS\Contract\RenderableInterface;
|
use phpOMS\Contract\RenderableInterface;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
use phpOMS\Model\Html\Head;
|
|
||||||
use phpOMS\Utils\ArrayUtils;
|
use phpOMS\Utils\ArrayUtils;
|
||||||
use phpOMS\DataStorage\Cookie\CookieJar;
|
use phpOMS\DataStorage\Cookie\CookieJar;
|
||||||
use phpOMS\DataStorage\Session\HttpSession;
|
use phpOMS\DataStorage\Session\HttpSession;
|
||||||
|
|
@ -44,6 +43,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->header = new Header();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
namespace phpOMS\Message\Http;
|
namespace phpOMS\Message\Http;
|
||||||
|
|
||||||
use phpOMS\Message\RequestMethod;
|
use phpOMS\Message\Http\RequestMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rest request class.
|
* Rest request class.
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,8 @@ abstract class RequestAbstract implements MessageInterface
|
||||||
*/
|
*/
|
||||||
protected $hash = [];
|
protected $hash = [];
|
||||||
|
|
||||||
|
protected $header = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
@ -321,6 +323,11 @@ abstract class RequestAbstract implements MessageInterface
|
||||||
return $this->status;
|
return $this->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHeader() : HeaderAbstract
|
||||||
|
{
|
||||||
|
return $this->header;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,9 @@
|
||||||
*/
|
*/
|
||||||
namespace phpOMS\Message;
|
namespace phpOMS\Message;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
|
||||||
use phpOMS\Contract\JsonableInterface;
|
|
||||||
use phpOMS\Localization\Localization;
|
use phpOMS\Localization\Localization;
|
||||||
use phpOMS\Utils\ArrayUtils;
|
use phpOMS\Utils\ArrayUtils;
|
||||||
|
use phpOMS\Message\Http\Header;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response abstract class.
|
* Response abstract class.
|
||||||
|
|
@ -31,7 +30,7 @@ use phpOMS\Utils\ArrayUtils;
|
||||||
* @link http://orange-management.com
|
* @link http://orange-management.com
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
abstract class ResponseAbstract implements MessageInterface, ArrayableInterface, JsonableInterface
|
abstract class ResponseAbstract implements MessageInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -162,5 +161,5 @@ abstract class ResponseAbstract implements MessageInterface, ArrayableInterface,
|
||||||
return $this->header;
|
return $this->header;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBody() : string;
|
abstract public function getBody() : string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
namespace phpOMS\Router;
|
namespace phpOMS\Router;
|
||||||
|
|
||||||
use phpOMS\Message\RequestMethod;
|
|
||||||
use phpOMS\Views\ViewLayout;
|
use phpOMS\Views\ViewLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
private function createNode() : bool
|
public function createNode() : bool
|
||||||
{
|
{
|
||||||
return self::createPath($this->path, $this->permission, true);
|
return self::createPath($this->path, $this->permission, true);
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +225,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
private function removeNode() : bool
|
public function removeNode() : bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class File extends FileAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
private function createNode() : bool
|
public function createNode() : bool
|
||||||
{
|
{
|
||||||
return self::create($this->path);
|
return self::create($this->path);
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +85,7 @@ class File extends FileAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
private function removeNode() : bool
|
public function removeNode() : bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ abstract class FileAbstract
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
*/
|
*/
|
||||||
abstract private function createNode() : bool;
|
abstract public function createNode() : bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get created at.
|
* Get created at.
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ use phpOMS\Validation\Validator;
|
||||||
* @link http://orange-management.com
|
* @link http://orange-management.com
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class View implements \Serializeable
|
class View implements \Serializable
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -250,25 +250,6 @@ class View implements \Serializeable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get view/template response of all views.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function renderAll() : string
|
|
||||||
{
|
|
||||||
ob_start();
|
|
||||||
|
|
||||||
foreach ($this->views as $key => $view) {
|
|
||||||
echo $view->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get view/template response.
|
* Get view/template response.
|
||||||
*
|
*
|
||||||
|
|
@ -373,7 +354,7 @@ class View implements \Serializeable
|
||||||
|
|
||||||
public function serialize()
|
public function serialize()
|
||||||
{
|
{
|
||||||
return $this->renderAll();
|
return $this->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unserialize($raw)
|
public function unserialize($raw)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user