This commit is contained in:
Dennis Eichhorn 2023-08-28 22:06:34 +00:00
parent ace50dd276
commit 23307c6116
3 changed files with 8 additions and 10 deletions

View File

@ -255,7 +255,7 @@ final class ApiController extends Controller
$doc->isVersioned = $request->getDataBool('versioned') ?? false; $doc->isVersioned = $request->getDataBool('versioned') ?? false;
$doc->createdBy = new NullAccount($request->header->account); $doc->createdBy = new NullAccount($request->header->account);
$doc->version = $request->getDataString('version') ?? ''; $doc->version = $request->getDataString('version') ?? '';
$doc->setVirtualPath((string) ($request->getData('virtualpath') ?? '/')); $doc->setVirtualPath($request->getDataString('virtualpath') ?? '/');
if (!empty($tags = $request->getDataJson('tags'))) { if (!empty($tags = $request->getDataJson('tags'))) {
foreach ($tags as $tag) { foreach ($tags as $tag) {
@ -344,11 +344,11 @@ final class ApiController extends Controller
{ {
/** @var \Modules\Editor\Models\EditorDoc $doc */ /** @var \Modules\Editor\Models\EditorDoc $doc */
$doc = EditorDocMapper::get()->where('id', (int) $request->getData('id'))->execute(); $doc = EditorDocMapper::get()->where('id', (int) $request->getData('id'))->execute();
$doc->isVersioned = (bool) ($request->getData('versioned') ?? $doc->isVersioned); $doc->isVersioned = $request->getDataBool('versioned') ?? $doc->isVersioned;
$doc->title = (string) ($request->getData('title') ?? $doc->title); $doc->title = $request->getDataString('title') ?? $doc->title;
$doc->plain = (string) ($request->getData('plain') ?? $doc->plain); $doc->plain = $request->getDataString('plain') ?? $doc->plain;
$doc->content = Markdown::parse((string) ($request->getData('plain') ?? $doc->plain)); $doc->content = Markdown::parse($request->getDataString('plain') ?? $doc->plain);
$doc->version = (string) ($request->getData('version') ?? $doc->version); $doc->version = $request->getDataString('version') ?? $doc->version;
return $doc; return $doc;
} }

View File

@ -101,7 +101,7 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/Editor/Theme/Backend/editor-list'); $view->setTemplate('/Modules/Editor/Theme/Backend/editor-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005301001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005301001, $request, $response);
$path = \str_replace('+', ' ', (string) ($request->getData('path') ?? '/')); $path = \strtr($request->getDataString('path') ?? '/', '+', ' ');
$docs = EditorDocMapper::getByVirtualPath($path, $request->header->account)->where('tags/title/language', $response->header->l11n->language)->execute(); $docs = EditorDocMapper::getByVirtualPath($path, $request->header->account)->where('tags/title/language', $response->header->l11n->language)->execute();
list($collection, $parent) = CollectionMapper::getCollectionsByPath($path); list($collection, $parent) = CollectionMapper::getCollectionsByPath($path);

View File

@ -71,14 +71,12 @@ final class Autoloader
* *
* @return void * @return void
* *
* @throws AutoloadException Throws this exception if the class to autoload doesn't exist. This could also be related to a wrong namespace/file path correlation.
*
* @since 1.0.0 * @since 1.0.0
*/ */
public static function defaultAutoloader(string $class) : void public static function defaultAutoloader(string $class) : void
{ {
$class = \ltrim($class, '\\'); $class = \ltrim($class, '\\');
$class = \str_replace(['_', '\\'], '/', $class); $class = \strtr($class, '_\\', '//');
foreach (self::$paths as $path) { foreach (self::$paths as $path) {
$file = $path . $class . '.php'; $file = $path . $class . '.php';