mirror of
https://github.com/Karaka-Management/oms-OnlineResourceWatcher.git
synced 2026-02-04 02:28:41 +00:00
continue drafting
This commit is contained in:
parent
122c360504
commit
c720c09a82
26
.gitignore
vendored
26
.gitignore
vendored
|
|
@ -5,4 +5,28 @@ obj/
|
|||
bin/Debug
|
||||
x64/Debug
|
||||
app/server/Libraries
|
||||
.vscode
|
||||
.vscode
|
||||
Logs
|
||||
Vagrantfile
|
||||
cache
|
||||
.sass-cache
|
||||
.idea
|
||||
vendor
|
||||
bower_components
|
||||
node_modules
|
||||
Libraries
|
||||
puphpet
|
||||
.vagrant
|
||||
private.php
|
||||
private.sh
|
||||
.vscode
|
||||
cookie.txt
|
||||
config.php
|
||||
coverage.xml
|
||||
.htaccess
|
||||
.directory
|
||||
*.log
|
||||
*.jar
|
||||
*.cache
|
||||
*.phar
|
||||
*.xml
|
||||
|
|
|
|||
0
app/local/App.xaml
Normal file → Executable file
0
app/local/App.xaml
Normal file → Executable file
0
app/local/App.xaml.cs
Normal file → Executable file
0
app/local/App.xaml.cs
Normal file → Executable file
0
app/local/AssemblyInfo.cs
Normal file → Executable file
0
app/local/AssemblyInfo.cs
Normal file → Executable file
0
app/local/MainWindow.xaml
Normal file → Executable file
0
app/local/MainWindow.xaml
Normal file → Executable file
0
app/local/MainWindow.xaml.cs
Normal file → Executable file
0
app/local/MainWindow.xaml.cs
Normal file → Executable file
0
app/local/OnlineResourceWatcherLocalApp.csproj
Normal file → Executable file
0
app/local/OnlineResourceWatcherLocalApp.csproj
Normal file → Executable file
0
app/local/OnlineResourceWatcherLocalApp.csproj.user
Normal file → Executable file
0
app/local/OnlineResourceWatcherLocalApp.csproj.user
Normal file → Executable file
0
app/local/OnlineResourceWatcherLocalApp.sln
Normal file → Executable file
0
app/local/OnlineResourceWatcherLocalApp.sln
Normal file → Executable file
0
app/server/CMakeLists.txt
Normal file → Executable file
0
app/server/CMakeLists.txt
Normal file → Executable file
0
app/server/Controller/ApiController.h
Normal file → Executable file
0
app/server/Controller/ApiController.h
Normal file → Executable file
0
app/server/Controller/InstallController.h
Normal file → Executable file
0
app/server/Controller/InstallController.h
Normal file → Executable file
0
app/server/Install/config.json
Normal file → Executable file
0
app/server/Install/config.json
Normal file → Executable file
0
app/server/Install/db.sqlite
Normal file → Executable file
0
app/server/Install/db.sqlite
Normal file → Executable file
0
app/server/Models/Account.h
Normal file → Executable file
0
app/server/Models/Account.h
Normal file → Executable file
0
app/server/Models/AccountStatus.h
Normal file → Executable file
0
app/server/Models/AccountStatus.h
Normal file → Executable file
0
app/server/Models/Db.h
Normal file → Executable file
0
app/server/Models/Db.h
Normal file → Executable file
0
app/server/Models/File.h
Normal file → Executable file
0
app/server/Models/File.h
Normal file → Executable file
0
app/server/Models/InstallType.h
Normal file → Executable file
0
app/server/Models/InstallType.h
Normal file → Executable file
0
app/server/Models/Organization.h
Normal file → Executable file
0
app/server/Models/Organization.h
Normal file → Executable file
0
app/server/Models/ReosurceStatus.h
Normal file → Executable file
0
app/server/Models/ReosurceStatus.h
Normal file → Executable file
0
app/server/Models/Resource.h
Normal file → Executable file
0
app/server/Models/Resource.h
Normal file → Executable file
0
app/server/Models/ResourceInfo.h
Normal file → Executable file
0
app/server/Models/ResourceInfo.h
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.aps
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.aps
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.rc
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.rc
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.sln
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.sln
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.vcxproj
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.vcxproj
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.vcxproj.filters
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.vcxproj.filters
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.vcxproj.user
Normal file → Executable file
0
app/server/OnlineResourceWatcherServerApp.vcxproj.user
Normal file → Executable file
0
app/server/Routes.h
Normal file → Executable file
0
app/server/Routes.h
Normal file → Executable file
0
app/server/build/install.sh
Normal file → Executable file
0
app/server/build/install.sh
Normal file → Executable file
|
|
@ -1 +1 @@
|
|||
Subproject commit 324801f79a04c39558c4ca0d5dcb88236a851d26
|
||||
Subproject commit 9a2c89e12b4a3fce3382937f60990ded5ac36c37
|
||||
0
app/server/config.json
Normal file → Executable file
0
app/server/config.json
Normal file → Executable file
0
app/server/favicon.ico
Normal file → Executable file
0
app/server/favicon.ico
Normal file → Executable file
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
0
app/server/main.cpp
Normal file → Executable file
0
app/server/main.cpp
Normal file → Executable file
0
app/server/resource.h
Normal file → Executable file
0
app/server/resource.h
Normal file → Executable file
0
app/web/.htaccess
Normal file → Executable file
0
app/web/.htaccess
Normal file → Executable file
250
app/web/Applications/Api/Application.php
Normal file → Executable file
250
app/web/Applications/Api/Application.php
Normal file → Executable file
|
|
@ -1,23 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Applications\Api
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Applications\Api;
|
||||
|
||||
use Models\CoreSettings;
|
||||
use Models\SettingsEnum;
|
||||
use Models\AccountMapper;
|
||||
use Models\LocalizationMapper;
|
||||
use Models\NullAccount;
|
||||
use Models\PermissionCategory;
|
||||
use phpOMS\Account\Account;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\Application\ApplicationStatus;
|
||||
use phpOMS\Asset\AssetType;
|
||||
use phpOMS\Auth\Auth;
|
||||
use phpOMS\DataStorage\Cache\CachePool;
|
||||
use phpOMS\DataStorage\Cookie\CookieJar;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\DatabaseStatus;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\DataStorage\Session\HttpSession;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
|
|
@ -25,20 +30,17 @@ use phpOMS\Event\EventManager;
|
|||
use phpOMS\Localization\L11nManager;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestMethod;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Model\Html\Head;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\System\File\PathException;
|
||||
use phpOMS\System\MimeType;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
use phpOMS\Views\View;
|
||||
use WebApplication;
|
||||
|
||||
final class Application
|
||||
{
|
||||
|
||||
private WebApplication $app;
|
||||
|
||||
private array $config;
|
||||
|
|
@ -51,230 +53,8 @@ final class Application
|
|||
UriFactory::setQuery('/app', \strtolower($this->app->appName));
|
||||
}
|
||||
|
||||
public function run(HttpRequest $request, HttpResponse $response): void
|
||||
public function run(HttpRequest $request, HttpResponse $response) : void
|
||||
{
|
||||
$response->header->set('Content-Type', 'text/plain; charset=utf-8');
|
||||
$pageView = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$this->app->l11nManager = new L11nManager($this->app->appName);
|
||||
$this->app->dbPool = new DatabasePool();
|
||||
$this->app->router = new WebRouter();
|
||||
$this->app->router->importFromFile(__DIR__ . '/Routes.php');
|
||||
|
||||
$this->app->sessionManager = new HttpSession(0);
|
||||
$this->app->cookieJar = new CookieJar();
|
||||
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../Modules/');
|
||||
$this->app->dispatcher = new Dispatcher($this->app);
|
||||
|
||||
$this->app->dbPool->create('core', $this->config['db']['core']['masters']['admin']);
|
||||
$this->app->dbPool->create('insert', $this->config['db']['core']['masters']['insert']);
|
||||
$this->app->dbPool->create('select', $this->config['db']['core']['masters']['select']);
|
||||
$this->app->dbPool->create('update', $this->config['db']['core']['masters']['update']);
|
||||
$this->app->dbPool->create('delete', $this->config['db']['core']['masters']['delete']);
|
||||
$this->app->dbPool->create('schema', $this->config['db']['core']['masters']['schema']);
|
||||
|
||||
/* Checking csrf token, if a csrf token is required at all has to be decided in the route or controller */
|
||||
if ($request->getData('CSRF') !== null
|
||||
&& !\hash_equals($this->app->sessionManager->get('CSRF'), $request->getData('CSRF'))
|
||||
) {
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \phpOMS\DataStorage\Database\Connection\ConnectionAbstract $con */
|
||||
$con = $this->app->dbPool->get();
|
||||
DataMapperFactory::db($con);
|
||||
|
||||
$this->app->cachePool = new CachePool();
|
||||
$this->app->appSettings = new CoreSettings();
|
||||
$this->app->eventManager = new EventManager($this->app->dispatcher);
|
||||
$this->app->eventManager->importFromFile(__DIR__ . '/Hooks.php');
|
||||
|
||||
$this->app->accountManager = new AccountManager($this->app->sessionManager);
|
||||
$this->app->l11nServer = LocalizationMapper::get()->where('id', 1)->execute();
|
||||
|
||||
$this->app->orgId = $this->getApplicationOrganization($request, $this->config['app']);
|
||||
$pageView->setData('orgId', $this->app->orgId);
|
||||
|
||||
$aid = Auth::authenticate($this->app->sessionManager);
|
||||
$request->header->account = $aid;
|
||||
$response->header->account = $aid;
|
||||
|
||||
$account = $this->loadAccount($request);
|
||||
|
||||
if (!($account instanceof NullAccount)) {
|
||||
$response->header->l11n = $account->l11n;
|
||||
} elseif ($this->app->sessionManager->get('language') !== null) {
|
||||
$response->header->l11n
|
||||
->loadFromLanguage(
|
||||
$this->app->sessionManager->get('language'),
|
||||
$this->app->sessionManager->get('country') ?? '*'
|
||||
);
|
||||
} elseif ($this->app->cookieJar->get('language') !== null) {
|
||||
$response->header->l11n
|
||||
->loadFromLanguage(
|
||||
$this->app->cookieJar->get('language'),
|
||||
$this->app->cookieJar->get('country') ?? '*'
|
||||
);
|
||||
}
|
||||
|
||||
UriFactory::setQuery('/lang', $response->getLanguage());
|
||||
$response->header->set('content-language', $response->getLanguage(), true);
|
||||
|
||||
// Cache general settings
|
||||
$this->app->appSettings->get(null, [
|
||||
SettingsEnum::LOGGING_STATUS, SettingsEnum::CLI_ACTIVE,
|
||||
]);
|
||||
|
||||
$appStatus = (int) ($this->app->appSettings->get(null, SettingsEnum::LOGIN_STATUS)->content ?? 0);
|
||||
if ($appStatus === ApplicationStatus::READ_ONLY || $appStatus === ApplicationStatus::DISABLED) {
|
||||
if (!$account->hasPermission(PermissionType::CREATE | PermissionType::MODIFY, module: 'Admin', type: PermissionCategory::APP)) {
|
||||
if ($request->getRouteVerb() !== RouteVerb::GET) {
|
||||
// Application is in read only mode or completely disabled
|
||||
// If read only mode is active only GET requests are allowed
|
||||
// A user who is part of the admin group is excluded from this rule
|
||||
$response->header->status = RequestStatusCode::R_405;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->dbPool->remove('admin');
|
||||
$this->app->dbPool->remove('insert');
|
||||
$this->app->dbPool->remove('update');
|
||||
$this->app->dbPool->remove('delete');
|
||||
$this->app->dbPool->remove('schema');
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($uris = $request->uri->getQuery('r'))) {
|
||||
$this->handleBatchRequest($uris, $request, $response);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->moduleManager->initRequestModules($request);
|
||||
|
||||
// add tpl loading
|
||||
$this->app->router->add(
|
||||
'/api/tpl/.*',
|
||||
function () use ($account, $request, $response): void {
|
||||
$appName = \ucfirst($request->getData('app') ?? 'Backend');
|
||||
$app = new class() extends ApplicationAbstract
|
||||
{
|
||||
};
|
||||
|
||||
$app->appName = $appName;
|
||||
$app->dbPool = $this->app->dbPool;
|
||||
$app->orgId = $this->app->orgId;
|
||||
$app->accountManager = $this->app->accountManager;
|
||||
$app->appSettings = $this->app->appSettings;
|
||||
$app->l11nManager = new L11nManager($app->appName);
|
||||
$app->moduleManager = new ModuleManager($app, __DIR__ . '/../../Modules/');
|
||||
$app->dispatcher = new Dispatcher($app);
|
||||
$app->eventManager = new EventManager($app->dispatcher);
|
||||
$app->router = new WebRouter();
|
||||
|
||||
$app->eventManager->importFromFile(__DIR__ . '/../' . $appName . '/Hooks.php');
|
||||
$app->router->importFromFile(__DIR__ . '/../' . $appName . '/Routes.php');
|
||||
|
||||
$route = \str_replace('/api/tpl', '/' . $appName, $request->uri->getRoute());
|
||||
|
||||
$view = new View();
|
||||
$view->setTemplate('/Web/Api/index');
|
||||
|
||||
$response->set('Content', $view);
|
||||
$response->get('Content')->setData('head', new Head());
|
||||
|
||||
$app->l11nManager->loadLanguage(
|
||||
$response->getLanguage(),
|
||||
'0',
|
||||
include __DIR__ . '/../' . $appName . '/lang/' . $response->getLanguage() . '.lang.php'
|
||||
);
|
||||
|
||||
$routed = $app->router->route(
|
||||
$route,
|
||||
$request->getData('CSRF'),
|
||||
$request->getRouteVerb(),
|
||||
$appName,
|
||||
$this->app->orgId,
|
||||
$account,
|
||||
$request->getData()
|
||||
);
|
||||
|
||||
$response->get('Content')->setData('dispatch', $app->dispatcher->dispatch($routed, $request, $response));
|
||||
},
|
||||
RouteVerb::GET
|
||||
);
|
||||
|
||||
$routed = $this->app->router->route(
|
||||
$request->uri->getRoute(),
|
||||
$request->getData('CSRF'),
|
||||
$request->getRouteVerb(),
|
||||
$this->app->appName,
|
||||
$this->app->orgId,
|
||||
$account,
|
||||
$request->getData()
|
||||
);
|
||||
|
||||
$dispatched = $this->app->dispatcher->dispatch($routed, $request, $response);
|
||||
|
||||
if (empty($dispatched)) {
|
||||
$response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
|
||||
$response->header->status = RequestStatusCode::R_404;
|
||||
$response->set($request->uri->__toString(), [
|
||||
'status' => \phpOMS\Message\NotificationLevel::ERROR,
|
||||
'title' => '',
|
||||
'message' => '',
|
||||
'response' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
$pageView->addData('dispatch', $dispatched);
|
||||
}
|
||||
|
||||
private function loadAccount(HttpRequest $request): Account
|
||||
{
|
||||
$account = AccountMapper::getWithPermissions($request->header->account);
|
||||
$this->app->accountManager->add($account);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
private function handleBatchRequest(string $uris, HttpRequest $request, HttpResponse $response): void
|
||||
{
|
||||
$request_r = clone $request;
|
||||
$uris = \json_decode($uris, true);
|
||||
|
||||
foreach ($uris as $uri) {
|
||||
$modules = $this->app->moduleManager->getRoutedModules($request_r);
|
||||
$this->app->moduleManager->initModule($modules);
|
||||
|
||||
$this->app->dispatcher->dispatch(
|
||||
$this->app->router->route(
|
||||
$request->uri->getRoute(),
|
||||
$request->getData('CSRF') ?? null
|
||||
),
|
||||
$request,
|
||||
$response
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function getApplicationOrganization(HttpRequest $request, array $config): int
|
||||
{
|
||||
return (int) ($request->getData('u') ?? ($config['domains'][$request->uri->host]['org'] ?? $config['default']['org']));
|
||||
}
|
||||
|
||||
private function loadLanguageFromPath(string $language, string $path): void
|
||||
{
|
||||
/* Load theme language */
|
||||
if (($absPath = \realpath($path)) === false) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
$themeLanguage = include $absPath;
|
||||
$this->app->l11nManager->loadLanguage($language, '0', $themeLanguage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
60
app/web/Applications/Backend/Application.php
Normal file → Executable file
60
app/web/Applications/Backend/Application.php
Normal file → Executable file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Applications\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Applications\Backend;
|
||||
|
||||
use phpOMS\Account\Account;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Asset\AssetType;
|
||||
use phpOMS\Auth\Auth;
|
||||
use phpOMS\DataStorage\Cache\CachePool;
|
||||
use phpOMS\DataStorage\Cookie\CookieJar;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\DatabaseStatus;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\DataStorage\Session\HttpSession;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
use phpOMS\Localization\L11nManager;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestMethod;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Model\Html\Head;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
use phpOMS\Views\View;
|
||||
use WebApplication;
|
||||
|
||||
final class Application
|
||||
{
|
||||
private WebApplication $app;
|
||||
|
||||
private array $config;
|
||||
|
||||
public function __construct(WebApplication $app, array $config)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->app->appName = 'Backend';
|
||||
$this->config = $config;
|
||||
UriFactory::setQuery('/app', \strtolower($this->app->appName));
|
||||
}
|
||||
|
||||
public function run(HttpRequest $request, HttpResponse $response) : void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
app/web/Applications/E500/Application.php
Normal file → Executable file
11
app/web/Applications/E500/Application.php
Normal file → Executable file
|
|
@ -1,4 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Applications\E500
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Applications\E500;
|
||||
|
|
|
|||
7
app/web/Applications/E500/lang/en.lang.php
Normal file
7
app/web/Applications/E500/lang/en.lang.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
return [[
|
||||
'ErrorMessage' => 'Error 500 - Unexpected error',
|
||||
'Description' => 'Something unexpected happened but don\'t fear we already got informed about this error.',
|
||||
]];
|
||||
241
app/web/Applications/Frontend/Application.php
Normal file → Executable file
241
app/web/Applications/Frontend/Application.php
Normal file → Executable file
|
|
@ -0,0 +1,241 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Applications\Frontend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Applications\Frontend;
|
||||
|
||||
use Models\CoreSettings;
|
||||
use phpOMS\Account\Account;
|
||||
use phpOMS\Account\NullAccount;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\Asset\AssetType;
|
||||
use phpOMS\Auth\Auth;
|
||||
use phpOMS\DataStorage\Cache\CachePool;
|
||||
use phpOMS\DataStorage\Cookie\CookieJar;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Session\HttpSession;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
use phpOMS\Localization\L11nManager;
|
||||
use phpOMS\Localization\Localization;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestMethod;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Model\Html\Head;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
use phpOMS\Views\View;
|
||||
use WebApplication;
|
||||
|
||||
final class Application
|
||||
{
|
||||
private WebApplication $app;
|
||||
|
||||
private array $config;
|
||||
|
||||
public function __construct(WebApplication $app, array $config)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->app->appName = 'Frontend';
|
||||
$this->config = $config;
|
||||
UriFactory::setQuery('/app', \strtolower($this->app->appName));
|
||||
}
|
||||
|
||||
public function run(HttpRequest $request, HttpResponse $response) : void
|
||||
{
|
||||
$this->app->l11nManager = new L11nManager($this->app->appName);
|
||||
$this->app->dbPool = new DatabasePool();
|
||||
$this->app->sessionManager = new HttpSession(0);
|
||||
$this->app->cookieJar = new CookieJar();
|
||||
$this->app->dispatcher = new Dispatcher($this->app);
|
||||
|
||||
$this->app->router = new WebRouter();
|
||||
$this->app->router->importFromFile(__DIR__ . '/Routes.php');
|
||||
$this->app->router->add(
|
||||
'/backend/e403',
|
||||
function() use ($request, $response) {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Web/Backend/Error/403_inline');
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
|
||||
return $view;
|
||||
},
|
||||
RouteVerb::GET
|
||||
);
|
||||
|
||||
/* CSRF token OK? */
|
||||
if ($request->getData('CSRF') !== null
|
||||
&& !\hash_equals($this->app->sessionManager->get('CSRF'), $request->getData('CSRF'))
|
||||
) {
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->cachePool = new CachePool();
|
||||
$this->app->appSettings = new CoreSettings();
|
||||
$this->app->eventManager = new EventManager($this->app->dispatcher);
|
||||
$this->app->accountManager = new AccountManager($this->app->sessionManager);
|
||||
$this->app->l11nServer = new Localization();
|
||||
|
||||
$aid = Auth::authenticate($this->app->sessionManager);
|
||||
$request->header->account = $aid;
|
||||
$response->header->account = $aid;
|
||||
|
||||
$account = $this->loadAccount($request);
|
||||
|
||||
if ($this->app->sessionManager->get('language') !== null) {
|
||||
$response->header->l11n
|
||||
->loadFromLanguage(
|
||||
$this->app->sessionManager->get('language'),
|
||||
$this->app->sessionManager->get('country') ?? '*'
|
||||
);
|
||||
} elseif ($this->app->cookieJar->get('language') !== null) {
|
||||
$response->header->l11n
|
||||
->loadFromLanguage(
|
||||
$this->app->cookieJar->get('language'),
|
||||
$this->app->cookieJar->get('country') ?? '*'
|
||||
);
|
||||
}
|
||||
|
||||
if (!\in_array($response->getLanguage(), $this->config['language'])) {
|
||||
$response->header->l11n->setLanguage($this->app->l11nServer->getLanguage());
|
||||
}
|
||||
|
||||
$pageView = new FrontendView($this->app->l11nManager, $request, $response);
|
||||
$head = new Head();
|
||||
|
||||
$pageView->setData('orgId', $this->app->orgId);
|
||||
$pageView->setData('head', $head);
|
||||
$response->set('Content', $pageView);
|
||||
|
||||
/* Backend only allows GET */
|
||||
if ($request->getMethod() !== RequestMethod::GET) {
|
||||
$this->create406Response($response, $pageView);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
UriFactory::setQuery('/lang', $response->getLanguage());
|
||||
|
||||
$this->app->loadLanguageFromPath(
|
||||
$response->getLanguage(),
|
||||
__DIR__ . '/lang/' . $response->getLanguage() . '.lang.php'
|
||||
);
|
||||
|
||||
$response->header->set('content-language', $response->getLanguage(), true);
|
||||
|
||||
/* Create html head */
|
||||
$this->initResponseHead($head, $request, $response);
|
||||
|
||||
$this->createDefaultPageView($request, $response, $pageView);
|
||||
|
||||
$dispatched = $this->app->dispatcher->dispatch(
|
||||
$this->app->router->route(
|
||||
$request->uri->getRoute(),
|
||||
$request->getData('CSRF'),
|
||||
$request->getRouteVerb(),
|
||||
$this->app->appName,
|
||||
$this->app->orgId,
|
||||
$account,
|
||||
$request->getData()
|
||||
),
|
||||
$request,
|
||||
$response
|
||||
);
|
||||
$pageView->addData('dispatch', $dispatched);
|
||||
}
|
||||
|
||||
private function createDefaultPageView(HttpRequest $request, HttpResponse $response, FrontendView $pageView) : void
|
||||
{
|
||||
$pageView->setTemplate('/Applications/Frontend/index');
|
||||
}
|
||||
|
||||
private function create403Response(HttpResponse $response, View $pageView) : void
|
||||
{
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
$pageView->setTemplate('/Applications/Frontend/Error/403');
|
||||
$this->app->loadLanguageFromPath(
|
||||
$response->getLanguage(),
|
||||
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php'
|
||||
);
|
||||
}
|
||||
|
||||
private function create406Response(HttpResponse $response, View $pageView) : void
|
||||
{
|
||||
$response->header->status = RequestStatusCode::R_406;
|
||||
$pageView->setTemplate('/Applications/Frontend/Error/406');
|
||||
$this->app->loadLanguageFromPath(
|
||||
$response->getLanguage(),
|
||||
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php'
|
||||
);
|
||||
}
|
||||
|
||||
private function create503Response(HttpResponse $response, View $pageView) : void
|
||||
{
|
||||
$response->header->status = RequestStatusCode::R_503;
|
||||
$pageView->setTemplate('/Applications/Frontend/Error/503');
|
||||
$this->app->loadLanguageFromPath(
|
||||
$response->getLanguage(),
|
||||
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php'
|
||||
);
|
||||
}
|
||||
|
||||
private function loadAccount(HttpRequest $request) : Account
|
||||
{
|
||||
$account = new NullAccount();
|
||||
$this->app->accountManager->add($account);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
private function initResponseHead(Head $head, HttpRequest $request, HttpResponse $response) : void
|
||||
{
|
||||
/* Load assets */
|
||||
$head->addAsset(AssetType::CSS, 'Resources/fonts/fontawesome/css/font-awesome.min.css?v=1.0.0');
|
||||
$head->addAsset(AssetType::CSS, 'Resources/fonts/linearicons/css/style.css?v=1.0.0');
|
||||
$head->addAsset(AssetType::CSS, 'Resources/fonts/lineicons/css/lineicons.css?v=1.0.0');
|
||||
$head->addAsset(AssetType::CSS, 'cssOMS/styles.css?v=1.0.0');
|
||||
$head->addAsset(AssetType::CSS, 'Resources/fonts/Roboto/roboto.css?v=1.0.0');
|
||||
|
||||
// Framework
|
||||
$head->addAsset(AssetType::JS, 'jsOMS/Utils/oLib.js?v=1.0.0');
|
||||
$head->addAsset(AssetType::JS, 'jsOMS/UnhandledException.js?v=1.0.0');
|
||||
$head->addAsset(AssetType::JS, 'Applications/Frontend/js/frontend.js?v=1.0.0', ['type' => 'module']);
|
||||
|
||||
$script = '';
|
||||
$response->header->set(
|
||||
'content-security-policy',
|
||||
'base-uri \'self\'; script-src \'self\' blob: \'sha256-'
|
||||
. \base64_encode(\hash('sha256', $script, true))
|
||||
. '\'; worker-src \'self\'',
|
||||
true
|
||||
);
|
||||
|
||||
if ($request->hasData('debug')) {
|
||||
$head->addAsset(AssetType::CSS, 'cssOMS/debug.css?v=1.0.0');
|
||||
\phpOMS\DataStorage\Database\Query\Builder::$log = true;
|
||||
}
|
||||
|
||||
$css = \file_get_contents(__DIR__ . '/css/small.css');
|
||||
if ($css === false) {
|
||||
$css = '';
|
||||
}
|
||||
|
||||
$css = \preg_replace('!\s+!', ' ', $css);
|
||||
$head->setStyle('core', $css ?? '');
|
||||
$head->title = 'Karaka Frontend';
|
||||
}
|
||||
}
|
||||
7
app/web/Applications/Frontend/Error/lang/en.lang.php
Normal file
7
app/web/Applications/Frontend/Error/lang/en.lang.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
return [[
|
||||
'ErrorMessage' => 'Error 500 - Unexpected error',
|
||||
'Description' => 'Something unexpected happened but don\'t fear we already got informed about this error.',
|
||||
]];
|
||||
28
app/web/Applications/Frontend/FrontendView.php
Normal file
28
app/web/Applications/Frontend/FrontendView.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Web\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Applications\Frontend;
|
||||
|
||||
use phpOMS\Localization\L11nManager;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
class FrontendView extends View
|
||||
{
|
||||
public function __construct(L11nManager $l11n = null, RequestAbstract $request = null, ResponseAbstract $response = null)
|
||||
{
|
||||
parent::__construct($l11n, $request, $response);
|
||||
}
|
||||
}
|
||||
0
app/web/content/about.en.md → app/web/Applications/Frontend/content/about.de.md
Normal file → Executable file
0
app/web/content/about.en.md → app/web/Applications/Frontend/content/about.de.md
Normal file → Executable file
0
app/web/content/terms.de.md → app/web/Applications/Frontend/content/about.en.md
Normal file → Executable file
0
app/web/content/terms.de.md → app/web/Applications/Frontend/content/about.en.md
Normal file → Executable file
0
app/web/content/terms.en.md → app/web/Applications/Frontend/content/terms.de.md
Normal file → Executable file
0
app/web/content/terms.en.md → app/web/Applications/Frontend/content/terms.de.md
Normal file → Executable file
0
app/web/css/styles.css → app/web/Applications/Frontend/content/terms.en.md
Normal file → Executable file
0
app/web/css/styles.css → app/web/Applications/Frontend/content/terms.en.md
Normal file → Executable file
0
app/web/css/clean.css → app/web/Applications/Frontend/css/clean.css
Normal file → Executable file
0
app/web/css/clean.css → app/web/Applications/Frontend/css/clean.css
Normal file → Executable file
12
app/web/css/small.css → app/web/Applications/Frontend/css/small.css
Normal file → Executable file
12
app/web/css/small.css → app/web/Applications/Frontend/css/small.css
Normal file → Executable file
|
|
@ -11,4 +11,14 @@ body {
|
|||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
nav {
|
||||
overflow-y: auto;
|
||||
font-size: 0.8em;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
user-select: none;
|
||||
}
|
||||
0
app/web/js/app.js → app/web/Applications/Frontend/css/styles.css
Normal file → Executable file
0
app/web/js/app.js → app/web/Applications/Frontend/css/styles.css
Normal file → Executable file
0
app/web/css/vars.css → app/web/Applications/Frontend/css/vars.css
Normal file → Executable file
0
app/web/css/vars.css → app/web/Applications/Frontend/css/vars.css
Normal file → Executable file
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Web\Backend
|
||||
* @package Applications\Frontend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -15,15 +15,6 @@ declare(strict_types=1);
|
|||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var Web\Backend\BackendView $this */
|
||||
$nav = $this->getData('nav');
|
||||
|
||||
$nav->setTemplate('/Modules/Navigation/Theme/Backend/top');
|
||||
$top = $nav->render();
|
||||
|
||||
$nav->setTemplate('/Modules/Navigation/Theme/Backend/side');
|
||||
$side = $nav->render();
|
||||
|
||||
/** @var phpOMS\Model\Html\Head $head */
|
||||
$head = $this->getData('head');
|
||||
|
||||
|
|
@ -39,13 +30,11 @@ $dispatch = $this->getData('dispatch') ?? [];
|
|||
<meta name="msapplication-navbutton-color" content="#343a40">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="#343a40">
|
||||
<meta name="description" content="<?= $this->getHtml(':meta', '0', '0'); ?>">
|
||||
<base href="<?= UriFactory::build('{/base}'); ?>/">
|
||||
|
||||
<?= $head->meta->render(); ?>
|
||||
|
||||
<link rel="manifest" href="<?= UriFactory::build('Web/Backend/manifest.json'); ?>">
|
||||
<link rel="manifest" href="<?= UriFactory::build('Web/Backend/manifest.webmanifest'); ?>">
|
||||
<link rel="shortcut icon" href="<?= UriFactory::build('Web/Backend/img/favicon.ico?v=1.0.0'); ?>" type="image/x-icon">
|
||||
<base href="<?= UriFactory::build('{/base}'); ?>/">
|
||||
|
||||
<link rel="shortcut icon" href="<?= UriFactory::build('Applications/Frontend/img/favicon.ico?v=1.0.0'); ?>" type="image/x-icon">
|
||||
|
||||
<title><?= $this->printHtml($head->title); ?></title>
|
||||
|
||||
|
|
@ -55,19 +44,25 @@ $dispatch = $this->getData('dispatch') ?? [];
|
|||
<script><?= $head->renderScript(); ?></script>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
$c = 0;
|
||||
foreach ($dispatch as $view) {
|
||||
if (!($view instanceof \phpOMS\Views\NullView)
|
||||
&& $view instanceof \phpOMS\Contract\RenderableInterface
|
||||
) {
|
||||
++$c;
|
||||
echo $view->render();
|
||||
}
|
||||
}
|
||||
<?php include __DIR__ . '/tpl/nav.tpl.php'; ?>
|
||||
<main>
|
||||
<div id="content" class="container-fluid" role="main">
|
||||
<?php
|
||||
$c = 0;
|
||||
foreach ($dispatch as $view) {
|
||||
if (!($view instanceof \phpOMS\Views\NullView)
|
||||
&& $view instanceof \phpOMS\Contract\RenderableInterface
|
||||
) {
|
||||
++$c;
|
||||
echo $view->render();
|
||||
}
|
||||
}
|
||||
|
||||
if ($c === 0) {
|
||||
echo '<div class="emptyPage"></div>';
|
||||
}
|
||||
?>
|
||||
<?= $head->renderAssetsLate(); ?>
|
||||
if ($c === 0) {
|
||||
echo '<div class="emptyPage"></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</main>
|
||||
<?php include __DIR__ . '/tpl/footer.tpl.php'; ?>
|
||||
<?= $head->renderAssetsLate(); ?>
|
||||
0
app/web/lang/de.lang.php → app/web/Applications/Frontend/js/frontend.js
Normal file → Executable file
0
app/web/lang/de.lang.php → app/web/Applications/Frontend/js/frontend.js
Normal file → Executable file
5
app/web/Applications/Frontend/lang/en.lang.php
Normal file
5
app/web/Applications/Frontend/lang/en.lang.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
return [[
|
||||
]];
|
||||
3
app/web/Applications/Frontend/tpl/footer.tpl.php
Normal file
3
app/web/Applications/Frontend/tpl/footer.tpl.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<footer>
|
||||
footer
|
||||
</footer>
|
||||
2
app/web/Applications/Frontend/tpl/nav.tpl.php
Normal file
2
app/web/Applications/Frontend/tpl/nav.tpl.php
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<nav>ttt
|
||||
</nav>
|
||||
0
app/web/Controllers/ApiController.php
Normal file → Executable file
0
app/web/Controllers/ApiController.php
Normal file → Executable file
0
app/web/Controllers/FrontController.php
Normal file → Executable file
0
app/web/Controllers/FrontController.php
Normal file → Executable file
0
app/web/Install/Application.php
Normal file → Executable file
0
app/web/Install/Application.php
Normal file → Executable file
239
app/web/Install/InstallAbstract.php
Normal file → Executable file
239
app/web/Install/InstallAbstract.php
Normal file → Executable file
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Install;
|
||||
|
||||
use Models\CoreSettings;
|
||||
use Models\Account;
|
||||
use Models\AccountCredentialMapper;
|
||||
use Models\Group;
|
||||
|
|
@ -22,9 +21,6 @@ use Models\GroupMapper;
|
|||
use Models\GroupPermission;
|
||||
use Models\GroupPermissionMapper;
|
||||
use Models\PermissionCategory;
|
||||
use Models\ModuleStatusUpdateType;
|
||||
use Models\NullAccount;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\Account\AccountStatus;
|
||||
use phpOMS\Account\AccountType;
|
||||
use phpOMS\Account\GroupStatus;
|
||||
|
|
@ -32,48 +28,11 @@ use phpOMS\Account\PermissionType;
|
|||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionFactory;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\Schema\Builder as SchemaBuilder;
|
||||
use phpOMS\DataStorage\Session\HttpSession;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
use phpOMS\Localization\Localization;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\System\File\Local\Directory;
|
||||
use phpOMS\System\MimeType;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
use phpOMS\Utils\IO\Zip\Zip;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* Application class.
|
||||
*
|
||||
* @package Install
|
||||
* @license OMS License 1.0
|
||||
* @link https://karaka.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class InstallAbstract extends ApplicationAbstract
|
||||
{
|
||||
/**
|
||||
* Module manager
|
||||
*
|
||||
* @var null|ModuleManager
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static ?ModuleManager $mManager = null;
|
||||
|
||||
/**
|
||||
* Setup general handlers for the application.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function setupHandlers() : void
|
||||
{
|
||||
\set_exception_handler(['\phpOMS\UnhandledHandler', 'exceptionHandler']);
|
||||
|
|
@ -82,71 +41,23 @@ abstract class InstallAbstract extends ApplicationAbstract
|
|||
\mb_internal_encoding('UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear old install
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function clearOld() : void
|
||||
{
|
||||
\file_put_contents(__DIR__ . '/../Cli/Routes.php', '<?php return [];');
|
||||
\file_put_contents(__DIR__ . '/../Cli/Hooks.php', '<?php return [];');
|
||||
|
||||
$dirs = \scandir(__DIR__ . '/../Web');
|
||||
if ($dirs === false) {
|
||||
return; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
if ($dir === '.' || $dir === '..'
|
||||
|| $dir === 'Exception'
|
||||
|| $dir === 'WebApplication.php'
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Directory::delete(__DIR__ . '/../Web/' . $dir);
|
||||
}
|
||||
\file_put_contents(__DIR__ . '/../Routes.php', '<?php return [];');
|
||||
\file_put_contents(__DIR__ . '/../Hooks.php', '<?php return [];');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if has certain php extensions enabled
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function hasPhpExtensions() : bool
|
||||
{
|
||||
return \extension_loaded('pdo')
|
||||
&& \extension_loaded('mbstring');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if database connection is correct and working
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function testDbConnection(RequestAbstract $request) : bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create database connection
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return ConnectionAbstract
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function setupDatabaseConnection(RequestAbstract $request) : ConnectionAbstract
|
||||
{
|
||||
return ConnectionFactory::create([
|
||||
|
|
@ -159,30 +70,12 @@ abstract class InstallAbstract extends ApplicationAbstract
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install/setup configuration
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function installConfigFile(RequestAbstract $request) : void
|
||||
{
|
||||
self::editConfigFile($request);
|
||||
self::editHtaccessFile($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify config file
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function editConfigFile(RequestAbstract $request) : void
|
||||
{
|
||||
$db = $request->getData('dbtype');
|
||||
|
|
@ -200,23 +93,20 @@ abstract class InstallAbstract extends ApplicationAbstract
|
|||
$subdir = $request->getData('websubdir');
|
||||
$tld = $request->getData('domain');
|
||||
|
||||
$tldOrg = 1;
|
||||
$defaultOrg = 1;
|
||||
$pageType = $request->getData('installtype');
|
||||
|
||||
$defaultApp = 'Frontend';
|
||||
if ($pageType === 'oem') {
|
||||
$defaultApp = 'Backend';
|
||||
}
|
||||
|
||||
$defaultAppLower = \strtolower($defaultApp);
|
||||
|
||||
$config = include __DIR__ . '/Templates/config.tpl.php';
|
||||
|
||||
\file_put_contents(__DIR__ . '/../config.php', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify htaccess file
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function editHtaccessFile(RequestAbstract $request) : void
|
||||
{
|
||||
$fullTLD = $request->getData('domain');
|
||||
|
|
@ -226,31 +116,14 @@ abstract class InstallAbstract extends ApplicationAbstract
|
|||
$config = include __DIR__ . '/Templates/htaccess.tpl.php';
|
||||
|
||||
\file_put_contents(__DIR__ . '/../.htaccess', $config);
|
||||
\file_put_contents(__DIR__ . '/../../server/config.json', \json_encode($config, \JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Install core functionality
|
||||
*
|
||||
* @param ConnectionAbstract $db Database connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function installCore(ConnectionAbstract $db) : void
|
||||
{
|
||||
self::createBaseTables($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create module table
|
||||
*
|
||||
* @param ConnectionAbstract $db Database connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function createBaseTables(ConnectionAbstract $db) : void
|
||||
{
|
||||
$path = __DIR__ . '/db.json';
|
||||
|
|
@ -269,30 +142,12 @@ abstract class InstallAbstract extends ApplicationAbstract
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install basic groups
|
||||
*
|
||||
* @param ConnectionAbstract $db Database connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function installGroups(ConnectionAbstract $db) : void
|
||||
{
|
||||
self::installMainGroups($db);
|
||||
self::installGroupPermissions($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create basic groups in db
|
||||
*
|
||||
* @param ConnectionAbstract $db Database connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function installMainGroups(ConnectionAbstract $db) : void
|
||||
{
|
||||
$guest = new Group('guest');
|
||||
|
|
@ -308,15 +163,6 @@ abstract class InstallAbstract extends ApplicationAbstract
|
|||
GroupMapper::create()->execute($admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set permissions of basic groups
|
||||
*
|
||||
* @param ConnectionAbstract $db Database connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function installGroupPermissions(ConnectionAbstract $db) : void
|
||||
{
|
||||
$searchPermission = new GroupPermission(
|
||||
|
|
@ -334,75 +180,20 @@ abstract class InstallAbstract extends ApplicationAbstract
|
|||
GroupPermissionMapper::create()->execute($adminPermission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install users
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ConnectionAbstract $db Database connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function installUsers(RequestAbstract $request, ConnectionAbstract $db) : void
|
||||
{
|
||||
self::installMainUser($request, $db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install applications
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ConnectionAbstract $db Database connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function installApplications(RequestAbstract $request, ConnectionAbstract $db) : void
|
||||
{
|
||||
if (self::$mManager === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$apps = $request->getDataList('apps');
|
||||
$theme = 'Default';
|
||||
|
||||
/** @var \Modules\CMS\Controller\ApiController $module */
|
||||
$module = self::$mManager->get('CMS');
|
||||
|
||||
foreach ($apps as $app) {
|
||||
$temp = new HttpRequest(new HttpUri(''));
|
||||
$temp->header->account = 1;
|
||||
$temp->setData('name', \basename($app));
|
||||
$temp->setData('theme', $theme);
|
||||
|
||||
Zip::pack(__DIR__ . '/../' . $app, __DIR__ . '/' . \basename($app) . '.zip');
|
||||
|
||||
TestUtils::setMember($temp, 'files', [
|
||||
[
|
||||
'name' => \basename($app) . '.zip',
|
||||
'type' => MimeType::M_ZIP,
|
||||
'tmp_name' => __DIR__ . '/' . \basename($app) . '.zip',
|
||||
'error' => \UPLOAD_ERR_OK,
|
||||
'size' => \filesize(__DIR__ . '/' . \basename($app) . '.zip'),
|
||||
],
|
||||
]);
|
||||
|
||||
$module->apiApplicationInstall($temp, new HttpResponse());
|
||||
if ($request->getData('installtype') === 'orm') {
|
||||
\copy(__DIR__ . '/Templates/ORMRoutes.php', __DIR__ . '/../Routes.php');
|
||||
} else {
|
||||
\copy(__DIR__ . '/Templates/DistRoutes.php', __DIR__ . '/../Routes.php');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup root user in database
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ConnectionAbstract $db Database connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static function installMainUser(RequestAbstract $request, ConnectionAbstract $db) : void
|
||||
{
|
||||
$account = new Account();
|
||||
|
|
|
|||
15
app/web/Install/Templates/DistRoutes.php
Normal file
15
app/web/Install/Templates/DistRoutes.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'.*?/about' => 'FrontController:aboutView',
|
||||
'.*?/imprint' => 'FrontController:imprintView',
|
||||
'.*?/terms' => 'FrontController:termsView',
|
||||
'.*?/privacy' => 'FrontController:privacyView',
|
||||
'.*?/contact' => 'FrontController:contactView',
|
||||
|
||||
'^/*$' => 'FrontController:frontView',
|
||||
'.*?/login' => 'FrontController:loginView',
|
||||
|
||||
'.*?/api/download' => 'ApiController:downloadView',
|
||||
];
|
||||
15
app/web/Install/Templates/ORMRoutes.php
Normal file
15
app/web/Install/Templates/ORMRoutes.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'.*?/about' => 'FrontController:aboutView',
|
||||
'.*?/imprint' => 'FrontController:imprintView',
|
||||
'.*?/terms' => 'FrontController:termsView',
|
||||
'.*?/privacy' => 'FrontController:privacyView',
|
||||
'.*?/contact' => 'FrontController:contactView',
|
||||
|
||||
'^/*$' => 'FrontController:frontView',
|
||||
'.*?/login' => 'FrontController:loginView',
|
||||
|
||||
'.*?/api/download' => 'ApiController:downloadView',
|
||||
];
|
||||
|
|
@ -137,33 +137,23 @@ return [
|
|||
'page' => [
|
||||
'root' => '${subdir}',
|
||||
'https' => false,
|
||||
'type' => '${pageType}',
|
||||
],
|
||||
'app' => [
|
||||
'path' => __DIR__,
|
||||
'default' => [
|
||||
'app' => 'Backend',
|
||||
'id' => 'backend',
|
||||
'app' => '${defaultApp}',
|
||||
'id' => '${defaultAppLower}',
|
||||
'lang' => 'en',
|
||||
'theme' => 'Backend',
|
||||
'org' => ${defaultOrg},
|
||||
],
|
||||
'domains' => [
|
||||
'${tld}' => [
|
||||
'app' => 'Backend',
|
||||
'id' => 'backend',
|
||||
'app' => '${defaultApp}',
|
||||
'id' => '${defaultAppLower}',
|
||||
'lang' => 'en',
|
||||
'theme' => 'Backend',
|
||||
'org' => ${tldOrg},
|
||||
],
|
||||
],
|
||||
],
|
||||
'socket' => [
|
||||
'master' => [
|
||||
'host' => '${tld}',
|
||||
'limit' => 300,
|
||||
'port' => 4310,
|
||||
],
|
||||
],
|
||||
'language' => [
|
||||
'en', 'de', 'it',
|
||||
],
|
||||
|
|
|
|||
193
app/web/Install/WebApplication.php
Executable file
193
app/web/Install/WebApplication.php
Executable file
|
|
@ -0,0 +1,193 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Install
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Install;
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabaseStatus;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Localization\Localization;
|
||||
use phpOMS\Log\FileLogger;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\System\MimeType;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
final class WebApplication extends InstallAbstract
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setupHandlers();
|
||||
|
||||
if (!\is_dir(__DIR__ . '/../Logs')) {
|
||||
\mkdir(__DIR__ . '/../Logs');
|
||||
}
|
||||
|
||||
$this->logger = FileLogger::getInstance(__DIR__ . '/../Logs', false);
|
||||
$request = $this->initRequest();
|
||||
$response = $this->initResponse($request, ['en', 'de']);
|
||||
|
||||
UriFactory::setupUriBuilder($request->uri);
|
||||
|
||||
$this->run($request, $response);
|
||||
|
||||
$response->header->push();
|
||||
echo $response->getBody();
|
||||
}
|
||||
|
||||
private function initRequest() : HttpRequest
|
||||
{
|
||||
$request = HttpRequest::createFromSuperglobals();
|
||||
|
||||
$rootPath = $request->uri->getPath();
|
||||
$offset = \strripos($rootPath, '/');
|
||||
$rootPath = \substr($rootPath, -$offset);
|
||||
|
||||
$subDirDepth = \substr_count($rootPath, '/');
|
||||
|
||||
$request->createRequestHashs($subDirDepth);
|
||||
$request->uri->setRootPath($rootPath);
|
||||
UriFactory::setupUriBuilder($request->uri);
|
||||
|
||||
$langCode = \strtolower($request->uri->getPathElement(0));
|
||||
$request->header->l11n->setLanguage(
|
||||
empty($langCode) || !ISO639x1Enum::isValidValue($langCode) ? 'en' : $langCode
|
||||
);
|
||||
UriFactory::setQuery('/lang', $request->getLanguage());
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
private function initResponse(HttpRequest $request, array $languages) : HttpResponse
|
||||
{
|
||||
$response = new HttpResponse(new Localization());
|
||||
$response->header->set('content-type', 'text/html; charset=utf-8');
|
||||
$response->header->set('x-xss-protection', '1; mode=block');
|
||||
$response->header->set('x-content-type-options', 'nosniff');
|
||||
$response->header->set('x-frame-options', 'SAMEORIGIN');
|
||||
$response->header->set('referrer-policy', 'same-origin');
|
||||
|
||||
if ($request->isHttps()) {
|
||||
$response->header->set('strict-transport-security', 'max-age=31536000');
|
||||
}
|
||||
|
||||
$response->header->l11n->setLanguage(
|
||||
!\in_array($request->getLanguage(), $languages) ? 'en' : $request->getLanguage()
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function run(HttpRequest $request, HttpResponse $response) : void
|
||||
{
|
||||
$this->dispatcher = new Dispatcher($this);
|
||||
$this->router = new WebRouter();
|
||||
|
||||
$this->setupRoutes();
|
||||
$response->header->set('content-language', $response->getLanguage(), true);
|
||||
UriFactory::setQuery('/lang', $response->getLanguage());
|
||||
|
||||
$this->dispatcher->dispatch(
|
||||
$this->router->route(
|
||||
$request->uri->getRoute(),
|
||||
$request->getData('CSRF'),
|
||||
$request->getRouteVerb()
|
||||
),
|
||||
$request,
|
||||
$response
|
||||
);
|
||||
}
|
||||
|
||||
private function setupRoutes() : void
|
||||
{
|
||||
$this->router->add('^.*', '\Install\WebApplication::installView', RouteVerb::GET);
|
||||
$this->router->add('^.*', '\Install\WebApplication::installRequest', RouteVerb::PUT);
|
||||
}
|
||||
|
||||
public static function installView(HttpRequest $request, HttpResponse $response) : void
|
||||
{
|
||||
$view = new View(null, $request, $response);
|
||||
$view->setTemplate('/Install/index');
|
||||
$response->set('Content', $view);
|
||||
}
|
||||
|
||||
public static function installRequest(HttpRequest $request, HttpResponse $response) : void
|
||||
{
|
||||
$response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
|
||||
|
||||
if (!empty(self::validateRequest($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
return;
|
||||
}
|
||||
|
||||
$db = self::setupDatabaseConnection($request);
|
||||
$db->connect();
|
||||
|
||||
if ($db->getStatus() !== DatabaseStatus::OK) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMapperFactory::db($db);
|
||||
|
||||
self::clearOld();
|
||||
self::installConfigFile($request);
|
||||
self::installCore($db);
|
||||
self::installGroups($db);
|
||||
self::installUsers($request, $db);
|
||||
self::installApplications($request, $db);
|
||||
|
||||
$response->header->status = RequestStatusCode::R_200;
|
||||
}
|
||||
|
||||
private static function validateRequest(HttpRequest $request) : array
|
||||
{
|
||||
$valid = [];
|
||||
|
||||
if (($valid['php_extensions'] = !self::hasPhpExtensions())
|
||||
|| ($valid['iDbHost'] = empty($request->getData('dbhost')))
|
||||
|| ($valid['iDbType'] = empty($request->getData('dbtype')))
|
||||
|| ($valid['iDbPort'] = empty($request->getData('dbport')))
|
||||
|| ($valid['iDbName'] = empty($request->getData('dbname')))
|
||||
|| ($valid['iSchemaUser'] = empty($request->getData('schemauser')))
|
||||
//|| ($valid['iSchemaPassword'] = empty($request->getData('schemapassword')))
|
||||
|| ($valid['iCreateUser'] = empty($request->getData('createuser')))
|
||||
//|| ($valid['iCreatePassword'] = empty($request->getData('createpassword')))
|
||||
|| ($valid['iSelectUser'] = empty($request->getData('selectuser')))
|
||||
//|| ($valid['iSelectPassword'] = empty($request->getData('selectpassword')))
|
||||
|| ($valid['iDeleteUser'] = empty($request->getData('deleteuser')))
|
||||
//|| ($valid['iDeletePassword'] = empty($request->getData('deletepassword')))
|
||||
|| ($valid['iDbName'] = !self::testDbConnection($request))
|
||||
|| ($valid['iInstallType'] = empty($request->getData('installtype')))
|
||||
|| ($valid['iOrgName'] = empty($request->getData('orgname')))
|
||||
|| ($valid['iAdminName'] = empty($request->getData('adminname')))
|
||||
//|| ($valid['iAdminPassword'] = empty($request->getData('adminpassword')))
|
||||
|| ($valid['iAdminEmail'] = empty($request->getData('adminemail')))
|
||||
|| ($valid['iDomain'] = empty($request->getData('domain')))
|
||||
|| ($valid['iWebSubdir'] = empty($request->getData('websubdir')))
|
||||
|| ($valid['iDefaultLang'] = empty($request->getData('defaultlang')))
|
||||
) {
|
||||
return $valid;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
|
||||
}
|
||||
0
app/web/Install/db.sqlite
Normal file → Executable file
0
app/web/Install/db.sqlite
Normal file → Executable file
|
|
@ -17,10 +17,9 @@ declare(strict_types=1);
|
|||
|
||||
//<editor-fold desc="Require/Include">
|
||||
require_once __DIR__ . '/../phpOMS/Autoloader.php';
|
||||
$config = require_once __DIR__ . '/../config.php';
|
||||
//</editor-fold>
|
||||
|
||||
$App = new \Install\WebApplication($config);
|
||||
$App = new \Install\WebApplication();
|
||||
|
||||
if (\ob_get_level() > 0) {
|
||||
\ob_end_flush();
|
||||
|
|
|
|||
|
|
@ -27,18 +27,12 @@ declare(strict_types=1);
|
|||
<img alt="Logo" src="img/logo.png" class="logo" width="50">
|
||||
<h1>Welcome</h1>
|
||||
<div>
|
||||
<p>Karaka is a WebApp written in PHP and JavaScript supporting various database
|
||||
and caching technologies. Many modules/extensions provide functionality for businesses,
|
||||
education facilities, healthcare facilities and organizations in general.<p>
|
||||
<p>The Online Resource Watcher allows you to watch online resources such as websites, PDFs etc. for changes and receive an email if the resource changes. It's also possible to watch local resources which can be helpful for monitoring file changes on shared files and drives in a company network.<p>
|
||||
|
||||
<p>In the following pages you'll be guided through the installation process for the WebApp.
|
||||
Most of the customization can be done after installation such as configuring localization,
|
||||
installing additional modules, creating organization etc.</p>
|
||||
|
||||
<p>In case you don't want to use this web installation tool you can also use the console
|
||||
installation tool. Just navigate in your shell to the install directory and then into
|
||||
Console the subdirectory. There you simply run the install script and are good to go.</p>
|
||||
|
||||
<p>In case you encounter any problems during the installation process please feel free to
|
||||
ask for help on our website or contact our support email at
|
||||
<strong>test.email@karaka.de</strong></p>
|
||||
|
|
@ -88,7 +82,7 @@ declare(strict_types=1);
|
|||
features. All critical elements must be fixed before you can continue with the installation.</p>
|
||||
|
||||
<p>For help please check our <a href="https://karaka.app">Installation Guide</a>.</p>
|
||||
<?php $isOK = \version_compare('8.0.0', \PHP_VERSION) < 1 && \extension_loaded('pdo'); ?>
|
||||
<?php $isOK = \version_compare('8.1.0', \PHP_VERSION) < 1 && \extension_loaded('pdo'); ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -98,16 +92,15 @@ declare(strict_types=1);
|
|||
<th>Your Environment
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="<?= \version_compare('8.0.0', \PHP_VERSION) < 1 ? 'OK' : 'FAILED'; ?>"><?= \version_compare('8.0.0', \PHP_VERSION) < 1 ? 'OK' : 'FAILED'; ?>
|
||||
<td class="<?= \version_compare('8.1.0', \PHP_VERSION) < 1 ? 'OK' : 'FAILED'; ?>"><?= \version_compare('8.1.0', \PHP_VERSION) < 1 ? 'OK' : 'FAILED'; ?>
|
||||
<td>Critcal
|
||||
<td>PHP version >= 8.0.0
|
||||
<td>PHP version >= 8.1.0
|
||||
<td><?= \PHP_VERSION; ?>
|
||||
<tr>
|
||||
<td class="<?= ($filePerm = \is_writable(__DIR__ . '/../Install')
|
||||
&& \is_writable(__DIR__ . '/../Modules')
|
||||
&& \is_writable(__DIR__ . '/../Modules/Media/Files')
|
||||
&& \is_writable(__DIR__ . '/../Web')
|
||||
&& \is_writable(__DIR__ . '/../Console')) ? 'OK' : 'FAILED'; ?>">
|
||||
&& \is_writable(__DIR__ . '/../../server')
|
||||
&& \is_writable(__DIR__ . '/../../server/data')
|
||||
&& \is_writable(__DIR__ . '/../')) ? 'OK' : 'FAILED'; ?>">
|
||||
<?= $filePerm ? 'OK' : 'FAILED'; ?>
|
||||
<td>Critcal
|
||||
<td><strong>File permissions <?php if ($filePerm) : ?><?php else : ?>(<span class="FAILED">write permissions required!</span>)<?php endif; ?></strong>
|
||||
|
|
@ -115,28 +108,18 @@ declare(strict_types=1);
|
|||
<tr>
|
||||
<td>
|
||||
<td>Critcal
|
||||
<td>/Install
|
||||
<td>./
|
||||
<td class="<?= \is_writable(__DIR__ . '/../') ? 'OK' : 'FAILED'; ?>"><?= \decoct(\fileperms(__DIR__ . '/../') & 0777); ?>
|
||||
<tr>
|
||||
<td>
|
||||
<td>Critcal
|
||||
<td>./Install
|
||||
<td class="<?= \is_writable(__DIR__ . '/../Install') ? 'OK' : 'FAILED'; ?>"><?= \decoct(\fileperms(__DIR__ . '/../Install') & 0777); ?>
|
||||
<tr>
|
||||
<td>
|
||||
<td>Critcal
|
||||
<td>/Modules
|
||||
<td class="<?= \is_writable(__DIR__ . '/../Modules') ? 'OK' : 'FAILED'; ?>"><?= \decoct(\fileperms(__DIR__ . '/../Modules') & 0777); ?>
|
||||
<tr>
|
||||
<td>
|
||||
<td>Critcal
|
||||
<td>/Modules
|
||||
<td class="<?= \is_writable(__DIR__ . '/../Modules/Media/Files') ? 'OK' : 'FAILED'; ?>"><?= \decoct(\fileperms(__DIR__ . '/../Modules/Media/Files') & 0777); ?>
|
||||
<tr>
|
||||
<td>
|
||||
<td>Critcal
|
||||
<td>/Web
|
||||
<td class="<?= \is_writable(__DIR__ . '/../Web') ? 'OK' : 'FAILED'; ?>"><?= \decoct(\fileperms(__DIR__ . '/../Web') & 0777); ?>
|
||||
<tr>
|
||||
<td>
|
||||
<td>Critcal
|
||||
<td>/Console
|
||||
<td class="<?= \is_writable(__DIR__ . '/../Console') ? 'OK' : 'FAILED'; ?>"><?= \decoct(\fileperms(__DIR__ . '/../Console') & 0777); ?>
|
||||
<td>./../../server
|
||||
<td class="<?= \is_writable(__DIR__ . '/../../server') ? 'OK' : 'FAILED'; ?>"><?= \decoct(\fileperms(__DIR__ . '/../../server') & 0777); ?>
|
||||
<tr>
|
||||
<td class="<?= \extension_loaded('pdo') ? 'OK' : 'FAILED'; ?>"><?= \extension_loaded('pdo') ? 'OK' : 'FAILED'; ?>
|
||||
<td>Critcal
|
||||
|
|
@ -215,14 +198,12 @@ declare(strict_types=1);
|
|||
<li><label for="iDbType">Type</label>
|
||||
<li><select id="iDbType" name="dbtype">
|
||||
<option value="mysql" selected>MySQL
|
||||
<option value="postgresql">PostgreSQL
|
||||
<option value="mssql">MSSQL
|
||||
</select>
|
||||
<li><label for="iDbPort">Port</label>
|
||||
<li><input id="iDbPort" name="dbport" type="number" value="3306" required>
|
||||
<li><label for="iDbName">Database</label>
|
||||
<li><strong class="FAILED">Please make sure that you have created this database. Please also make sure that this database is empty!</strong>
|
||||
<li><input id="iDbName" name="dbname" type="text" value="oms" required>
|
||||
<li><input id="iDbName" name="dbname" type="text" value="oms_orw" required>
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
|
|
@ -300,6 +281,11 @@ declare(strict_types=1);
|
|||
<div>
|
||||
<p>The following configuration options are general WebApp settings.</p>
|
||||
<ul>
|
||||
<li><label for="iInstallType">Installation Type</label>
|
||||
<li><select id="iInstallType" name="installtype" form="installForm" required>
|
||||
<option value="oem" selected>OEM
|
||||
<option value="dist">Distributor
|
||||
</select>
|
||||
<li><label for="iOrgName">Organization Name</label>
|
||||
<li><input id="iOrgName" name="orgname" type="text" value="Karaka" form="installForm" required>
|
||||
<li><label for="iAdminName">Admin Login</label>
|
||||
|
|
|
|||
0
app/web/Models/Account.php
Normal file → Executable file
0
app/web/Models/Account.php
Normal file → Executable file
0
app/web/Models/AccountCredentialMapper.php
Normal file → Executable file
0
app/web/Models/AccountCredentialMapper.php
Normal file → Executable file
0
app/web/Models/AccountMapper.php
Normal file → Executable file
0
app/web/Models/AccountMapper.php
Normal file → Executable file
0
app/web/Models/AccountPermission.php
Normal file → Executable file
0
app/web/Models/AccountPermission.php
Normal file → Executable file
0
app/web/Models/AccountPermissionMapper.php
Normal file → Executable file
0
app/web/Models/AccountPermissionMapper.php
Normal file → Executable file
0
app/web/Models/GroupPermission.php
Normal file → Executable file
0
app/web/Models/GroupPermission.php
Normal file → Executable file
0
app/web/Models/GroupPermissionMapper.php
Normal file → Executable file
0
app/web/Models/GroupPermissionMapper.php
Normal file → Executable file
0
app/web/Models/LocalizationMapper.php
Normal file → Executable file
0
app/web/Models/LocalizationMapper.php
Normal file → Executable file
0
app/web/Models/NullAccount.php
Normal file → Executable file
0
app/web/Models/NullAccount.php
Normal file → Executable file
0
app/web/Models/PermissionCategory.php
Normal file → Executable file
0
app/web/Models/PermissionCategory.php
Normal file → Executable file
0
app/web/Models/SettingsEnum.php
Normal file → Executable file
0
app/web/Models/SettingsEnum.php
Normal file → Executable file
|
|
@ -1 +1 @@
|
|||
Subproject commit 8caf616b7d25355ab14768c242a1b5d57bfc2f94
|
||||
Subproject commit 7555fe814f03d567fb04ada35535817727382ed4
|
||||
0
app/web/Routes.php
Normal file → Executable file
0
app/web/Routes.php
Normal file → Executable file
1
app/web/WebApplication.php
Normal file → Executable file
1
app/web/WebApplication.php
Normal file → Executable file
|
|
@ -25,6 +25,7 @@ class WebApplication extends ApplicationAbstract
|
|||
$this->logger = FileLogger::getInstance($config['log']['file']['path'], false);
|
||||
|
||||
UriFactory::setQuery('/prefix', '');
|
||||
UriFactory::setQuery('/backend', 'backend/');
|
||||
UriFactory::setQuery('/api', 'api/');
|
||||
$applicationName = $this->getApplicationName(HttpUri::fromCurrent(), $config['app'], $config['page']['root']);
|
||||
$request = $this->initRequest($config['page']['root'], $config['app']);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit a4c1e7e8b2def04fb761027de2d8473cbe38850b
|
||||
Subproject commit 5d64c8c66010e6c58647d8d5439083b52690933d
|
||||
0
app/web/humans.txt
Normal file → Executable file
0
app/web/humans.txt
Normal file → Executable file
0
app/web/index.php
Normal file → Executable file
0
app/web/index.php
Normal file → Executable file
|
|
@ -1 +1 @@
|
|||
Subproject commit e3aef7338ab615b8520f4fcbe82572fbf71b0934
|
||||
Subproject commit ddb28a71425c3d94d6f6fa09b6f696f9eae33fb4
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit d631e4ce622bf1bd3dc2130efab4570005b5cfb6
|
||||
Subproject commit bc3b9154e9ac0097efbcd4aa97f103ae518409b9
|
||||
0
app/web/robots.txt
Normal file → Executable file
0
app/web/robots.txt
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user