mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Fix after bug fixes and file changes
This commit is contained in:
parent
1c59c7bce0
commit
0d7c17aa88
|
|
@ -104,12 +104,11 @@ class FileLogger implements LoggerInterface
|
|||
}
|
||||
|
||||
if (is_dir($lpath) || strpos($lpath, '.') === false) {
|
||||
Directory::create($lpath, '0644');
|
||||
File::createFile($path = $lpath . '/' . date('Y-m-d') . '.log');
|
||||
File::create($path = $lpath . '/' . date('Y-m-d') . '.log');
|
||||
|
||||
$path = realpath($path);
|
||||
} else {
|
||||
File::createFile($lpath);
|
||||
File::create($lpath);
|
||||
|
||||
$path = realpath($lpath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
|
|||
*/
|
||||
public function createNode() : bool
|
||||
{
|
||||
return self::createPath($this->path, $this->permission, true);
|
||||
return self::create($this->path, $this->permission, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -433,7 +433,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
|
|||
// TODO: Implement owner() method.
|
||||
}
|
||||
|
||||
public static function permission(string $path) : string
|
||||
public static function permission(string $path) : int
|
||||
{
|
||||
// TODO: Implement permission() method.
|
||||
}
|
||||
|
|
@ -463,13 +463,13 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
|
|||
// TODO: Implement get() method.
|
||||
}
|
||||
|
||||
public static function size(string $path) : string
|
||||
public static function size(string $path) : int
|
||||
{
|
||||
// TODO: Implement size() method.
|
||||
}
|
||||
|
||||
public static function exists(string $path) : bool
|
||||
{
|
||||
// TODO: Implement exists() method.
|
||||
return file_exists($path);
|
||||
}
|
||||
}
|
||||
|
|
@ -49,6 +49,16 @@ class File extends FileAbstract
|
|||
}
|
||||
}
|
||||
|
||||
public function getDirName() : string
|
||||
{
|
||||
return basename(dirname($this->path));
|
||||
}
|
||||
|
||||
public function getDirPath() : string
|
||||
{
|
||||
return dirname($this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Index file.
|
||||
*
|
||||
|
|
@ -113,6 +123,18 @@ class File extends FileAbstract
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getFileName() : string
|
||||
{
|
||||
return explode('.', $this->name)[0];
|
||||
}
|
||||
|
||||
public function getExtension() : string
|
||||
{
|
||||
$extension = explode('.', $this->name);
|
||||
|
||||
return $extension[1] ?? '';
|
||||
}
|
||||
|
||||
public static function get(string $path) : string
|
||||
{
|
||||
if(!file_exists($path)) {
|
||||
|
|
@ -127,7 +149,7 @@ class File extends FileAbstract
|
|||
return file_exists($path);
|
||||
}
|
||||
|
||||
public static function create(string $path) : string
|
||||
public static function create(string $path) : bool
|
||||
{
|
||||
if(!file_exists($path)) {
|
||||
if(!Directory::exists(dirname($path))) {
|
||||
|
|
@ -186,7 +208,7 @@ class File extends FileAbstract
|
|||
throw new PathException($path);
|
||||
}
|
||||
|
||||
return fileperms($path);
|
||||
return fileowner($path);
|
||||
}
|
||||
|
||||
public static function permission(string $path) : int
|
||||
|
|
@ -195,7 +217,7 @@ class File extends FileAbstract
|
|||
throw new PathException($path);
|
||||
}
|
||||
|
||||
return fileowner($path);
|
||||
return fileperms($path);
|
||||
}
|
||||
|
||||
public static function dirname(string $path) : string
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ interface FileInterface
|
|||
|
||||
public static function owner(string $path) : int;
|
||||
|
||||
public static function permission(string $path) : string;
|
||||
public static function permission(string $path) : int;
|
||||
|
||||
public static function parent(string $path) : string;
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ interface FileInterface
|
|||
|
||||
public static function get(string $path) : string;
|
||||
|
||||
public static function size(string $path) : string;
|
||||
public static function size(string $path) : int;
|
||||
|
||||
public static function exists(string $path) : bool;
|
||||
}
|
||||
|
|
|
|||
52
Uri/Http.php
52
Uri/Http.php
|
|
@ -95,13 +95,21 @@ class Http implements UriInterface
|
|||
*/
|
||||
private $path = '';
|
||||
|
||||
/**
|
||||
* Uri query.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $query = [];
|
||||
|
||||
/**
|
||||
* Uri query.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $query = null;
|
||||
private $queryString = '';
|
||||
|
||||
/**
|
||||
* Uri fragment.
|
||||
|
|
@ -138,18 +146,18 @@ class Http implements UriInterface
|
|||
public function set(string $uri)
|
||||
{
|
||||
$this->uri = $uri;
|
||||
$url = parse_url($this->uri);
|
||||
|
||||
$url = parse_url($this->uri);
|
||||
|
||||
$this->scheme = $url['scheme'] ?? '';
|
||||
$this->host = $url['host'] ?? null;
|
||||
$this->port = $url['port'] ?? null;
|
||||
$this->user = $url['user'] ?? null;
|
||||
$this->pass = $url['pass'] ?? null;
|
||||
$this->path = $url['path'] ?? null;
|
||||
$this->path = rtrim($this->path, '.php');
|
||||
$this->path = strpos($this->path, $this->rootPath) === 0 ? substr($this->path, strlen($this->rootPath), strlen($this->path)) : $this->path; // TODO: this could cause a bug if the rootpath is the same as a regular path which is usually the language
|
||||
$this->query = $url['query'] ?? null;
|
||||
$this->scheme = $url['scheme'] ?? '';
|
||||
$this->host = $url['host'] ?? null;
|
||||
$this->port = $url['port'] ?? null;
|
||||
$this->user = $url['user'] ?? null;
|
||||
$this->pass = $url['pass'] ?? null;
|
||||
$this->path = $url['path'] ?? null;
|
||||
$this->path = rtrim($this->path, '.php');
|
||||
$this->path = strpos($this->path, $this->rootPath) === 0 ? substr($this->path, strlen($this->rootPath), strlen($this->path)) : $this->path; // TODO: this could cause a bug if the rootpath is the same as a regular path which is usually the language
|
||||
$this->query = $url['query'] ?? null;
|
||||
$this->queryString = $this->query;
|
||||
|
||||
if (isset($this->query)) {
|
||||
parse_str($this->query, $this->query);
|
||||
|
|
@ -192,7 +200,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getRootPath() : string
|
||||
{
|
||||
return $this->rootPath;
|
||||
return $this->rootPath ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -209,7 +217,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getScheme() : string
|
||||
{
|
||||
return $this->scheme;
|
||||
return $this->scheme ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -217,7 +225,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getHost() : string
|
||||
{
|
||||
return $this->host;
|
||||
return $this->host ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -225,7 +233,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getPort() : int
|
||||
{
|
||||
return $this->port;
|
||||
return $this->port ?? 80;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -238,7 +246,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getPass() : string
|
||||
{
|
||||
return $this->pass;
|
||||
return $this->pass ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -246,7 +254,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getPath() : string
|
||||
{
|
||||
return $this->path;
|
||||
return $this->path ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -254,7 +262,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getQuery(string $key = null)
|
||||
{
|
||||
return isset($key) ? $this->query[$key] ?? null : $this->query;
|
||||
return isset($key) ? $this->query[$key] ?? null : $this->queryString ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -262,7 +270,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getFragment() : string
|
||||
{
|
||||
return $this->fragment;
|
||||
return $this->fragment ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -270,7 +278,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getBase() : string
|
||||
{
|
||||
return $this->base;
|
||||
return $this->base ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -299,7 +307,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public function getUser() : string
|
||||
{
|
||||
return $this->user;
|
||||
return $this->user ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ use phpOMS\ApplicationAbstract;
|
|||
use phpOMS\Localization\Localization;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\System\File\PathException;
|
||||
use phpOMS\Utils\StringUtils;
|
||||
|
||||
/**
|
||||
* List view.
|
||||
|
|
@ -169,7 +167,7 @@ class View extends ViewAbstract
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function getText(string $translation, string $module = null, string $theme = null)
|
||||
protected function getText(string $translation, string $module = null, string $theme = null)
|
||||
{
|
||||
if (!isset($module)) {
|
||||
$match = '/Modules/';
|
||||
|
|
|
|||
|
|
@ -15,12 +15,7 @@
|
|||
*/
|
||||
namespace phpOMS\Views;
|
||||
|
||||
use phpOMS\ApplicationAbstract;
|
||||
use phpOMS\Localization\Localization;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\System\File\PathException;
|
||||
use phpOMS\Utils\StringUtils;
|
||||
|
||||
/**
|
||||
* List view.
|
||||
|
|
@ -55,10 +50,6 @@ abstract class ViewAbstract implements \Serializable
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Request
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user