feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
This commit is contained in:
182
modules/system/reportwidgets/Status.php
Normal file
182
modules/system/reportwidgets/Status.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php namespace System\ReportWidgets;
|
||||
|
||||
use Lang;
|
||||
use Config;
|
||||
use BackendAuth;
|
||||
use System\Models\Parameter;
|
||||
use System\Models\LogSetting;
|
||||
use System\Classes\UpdateManager;
|
||||
use System\Classes\PluginManager;
|
||||
use Backend\Classes\ReportWidgetBase;
|
||||
use Backend\Models\User;
|
||||
use System\Models\EventLog;
|
||||
use System\Models\RequestLog;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* System status report widget.
|
||||
*
|
||||
* @package winter\wn-system-module
|
||||
* @author Alexey Bobkov, Samuel Georges
|
||||
*/
|
||||
class Status extends ReportWidgetBase
|
||||
{
|
||||
/**
|
||||
* @var string A unique alias to identify this widget.
|
||||
*/
|
||||
protected $defaultAlias = 'status';
|
||||
|
||||
/**
|
||||
* Renders the widget.
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
try {
|
||||
$this->loadData();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
$this->vars['error'] = $ex->getMessage();
|
||||
}
|
||||
|
||||
return $this->makePartial('widget');
|
||||
}
|
||||
|
||||
public function defineProperties()
|
||||
{
|
||||
return [
|
||||
'title' => [
|
||||
'title' => 'backend::lang.dashboard.widget_title_label',
|
||||
'default' => 'backend::lang.dashboard.status.widget_title_default',
|
||||
'type' => 'string',
|
||||
'validationPattern' => '^.+$',
|
||||
'validationMessage' => 'backend::lang.dashboard.widget_title_error',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
protected function loadData()
|
||||
{
|
||||
$manager = UpdateManager::instance();
|
||||
|
||||
$this->vars['canUpdate'] = BackendAuth::getUser()->hasAccess('system.manage_updates');
|
||||
$this->vars['updates'] = $manager->check();
|
||||
$this->vars['warnings'] = $this->getSystemWarnings();
|
||||
$this->vars['coreBuild'] = Parameter::get('system::core.build');
|
||||
|
||||
$this->vars['eventLog'] = EventLog::count();
|
||||
$this->vars['eventLogMsg'] = LogSetting::get('log_events', false) ? false : true;
|
||||
$this->vars['requestLog'] = RequestLog::count();
|
||||
$this->vars['requestLogMsg'] = LogSetting::get('log_requests', false) ? false : true;
|
||||
|
||||
$this->vars['appBirthday'] = Parameter::get('system::app.birthday');
|
||||
}
|
||||
|
||||
public function onLoadWarningsForm()
|
||||
{
|
||||
$this->vars['warnings'] = $this->getSystemWarnings();
|
||||
return $this->makePartial('warnings_form');
|
||||
}
|
||||
|
||||
protected function getSystemWarnings()
|
||||
{
|
||||
$warnings = [];
|
||||
|
||||
$missingDependencies = PluginManager::instance()->findMissingDependencies();
|
||||
|
||||
$writablePaths = [
|
||||
temp_path(),
|
||||
storage_path(),
|
||||
storage_path('app'),
|
||||
storage_path('logs'),
|
||||
storage_path('framework'),
|
||||
storage_path('cms'),
|
||||
storage_path('cms/cache'),
|
||||
storage_path('cms/twig'),
|
||||
storage_path('cms/combiner'),
|
||||
];
|
||||
|
||||
if (in_array('Cms', Config::get('cms.loadModules', []))) {
|
||||
$writablePaths[] = themes_path();
|
||||
}
|
||||
|
||||
// Warn if debug mode is enabled - this is a security risk
|
||||
if (Config::get('app.debug', true)) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('backend::lang.warnings.debug'),
|
||||
'fixUrl' => 'https://wintercms.com/docs/v1.2/docs/setup/configuration#debug-mode',
|
||||
];
|
||||
}
|
||||
// Warn if CSRF protection is disabled - this is a security risk
|
||||
if (Config::get('cms.enableCsrfProtection', true) === false) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('backend::lang.warnings.csrf'),
|
||||
'fixUrl' => 'https://wintercms.com/docs/v1.2/docs/setup/configuration#csrf-protection',
|
||||
];
|
||||
}
|
||||
// Warn if backend auth throttling is disabled - this is a security risk
|
||||
if (Config::get('auth.throttle.enabled', true) === false) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('backend::lang.warnings.auth_throttle_disabled'),
|
||||
];
|
||||
}
|
||||
// Warn if the user has disabled base directory restriction - this is a security risk
|
||||
if (Config::get('cms.restrictBaseDir', true) === false) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('backend::lang.warnings.restrict_base_dir'),
|
||||
];
|
||||
}
|
||||
// Warn if the default backend user is using the default username or email, and has access to manage users
|
||||
if (
|
||||
BackendAuth::getUser()->hasAccess('backend.manage_users')
|
||||
&& User::where('login', 'admin')->orWhere('email', 'admin@domain.tld')->count()
|
||||
) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('backend::lang.warnings.default_backend_user'),
|
||||
];
|
||||
}
|
||||
// Warn if backend assets are being decompiled
|
||||
if (Config::get('develop.decompileBackendAssets', false)) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('backend::lang.warnings.decompileBackendAssets'),
|
||||
];
|
||||
}
|
||||
|
||||
$requiredExtensions = [
|
||||
'GD' => extension_loaded('gd'),
|
||||
'fileinfo' => extension_loaded('fileinfo'),
|
||||
'Zip' => class_exists('ZipArchive'),
|
||||
'cURL' => function_exists('curl_init') && defined('CURLOPT_FOLLOWLOCATION'),
|
||||
'OpenSSL' => function_exists('openssl_random_pseudo_bytes'),
|
||||
];
|
||||
|
||||
foreach ($writablePaths as $path) {
|
||||
if (!is_writable($path)) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('backend::lang.warnings.permissions', ['name' => '<strong>'.$path.'</strong>'])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($requiredExtensions as $extension => $installed) {
|
||||
if (!$installed) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('backend::lang.warnings.extension', ['name' => '<strong>'.$extension.'</strong>']),
|
||||
'fixUrl' => 'https://wintercms.com/docs/v1.2/docs/setup/installation#minimum-system-requirements',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($missingDependencies as $pluginCode => $plugin) {
|
||||
foreach ($plugin as $missingPluginCode) {
|
||||
$warnings[] = [
|
||||
'message' => Lang::get('system::lang.updates.update_warnings_plugin_missing', [
|
||||
'code' => '<strong>' . $missingPluginCode . '</strong>',
|
||||
'parent_code' => '<strong>' . $pluginCode . '</strong>'
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $warnings;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="popup" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title"><?= e(trans('backend::lang.warnings.tips')) ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if (count($warnings)): ?>
|
||||
<p><?= e(trans('backend::lang.warnings.tips_description')) ?></p>
|
||||
<ul>
|
||||
<?php foreach ($warnings as $warning): ?>
|
||||
<li>
|
||||
<?= $warning['message'] ?>
|
||||
<?php if (isset($warning['fixUrl'])): ?>
|
||||
(<a href="<?= $warning['fixUrl'] ?>" target="winter-fix"><?= e(trans('backend::lang.warnings.how_to_fix')) ?></a>)
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p>No warnings to display</p>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
data-dismiss="popup">
|
||||
<?= e(trans('backend::lang.form.close')) ?>
|
||||
</button>
|
||||
</div>
|
||||
87
modules/system/reportwidgets/status/partials/_widget.php
Normal file
87
modules/system/reportwidgets/status/partials/_widget.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<div class="report-widget">
|
||||
<h3><?= e(trans($this->property('title'))) ?></h3>
|
||||
|
||||
<?php if (!isset($error)): ?>
|
||||
<div class="control-status-list">
|
||||
<ul>
|
||||
<li>
|
||||
<?php if ($updates): ?>
|
||||
<span class="status-icon warning"><i class="icon-exclamation"></i></span>
|
||||
<span class="status-text warning">
|
||||
<?= e(trans('backend::lang.dashboard.status.updates_pending')) ?>
|
||||
</span>
|
||||
<?php if ($canUpdate): ?>
|
||||
<a href="<?= Backend::url('system/updates') ?>" class="status-label link"><?= e(trans('backend::lang.dashboard.status.updates_link')) ?></a>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<span class="status-icon success"><i class="icon-check"></i></span>
|
||||
<span class="status-text success">
|
||||
<?= e(trans('backend::lang.dashboard.status.updates_nil')) ?>
|
||||
</span>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php if ($warnings): ?>
|
||||
<span class="status-icon warning"><i class="icon-exclamation"></i></span>
|
||||
<span class="status-text warning">
|
||||
<?= e(trans('backend::lang.dashboard.status.warnings_pending')) ?>
|
||||
</span>
|
||||
<a
|
||||
href="javascript:;"
|
||||
data-control="popup"
|
||||
data-size="large"
|
||||
data-handler="<?= $this->getEventHandler('onLoadWarningsForm') ?>"
|
||||
class="status-label link"><?= e(trans('backend::lang.dashboard.status.warnings_link')) ?></a>
|
||||
<?php else: ?>
|
||||
<span class="status-icon success"><i class="icon-check"></i></span>
|
||||
<span class="status-text success">
|
||||
<?= e(trans('backend::lang.dashboard.status.warnings_nil')) ?>
|
||||
</span>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php if ($coreBuild): ?>
|
||||
<li>
|
||||
<span class="status-icon"><i class="icon-info"></i></span>
|
||||
<span class="status-text">
|
||||
<?= e(trans('backend::lang.dashboard.status.core_build')) ?>
|
||||
</span>
|
||||
<a href="<?= Backend::url('system/updates') ?>" class="status-label primary"><?= $coreBuild ?></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<li>
|
||||
<span class="status-icon"><i class="icon-exclamation-triangle"></i></span>
|
||||
<span class="status-text">
|
||||
<?= e(trans('backend::lang.dashboard.status.event_log')) ?>
|
||||
<?php if ($eventLogMsg): ?>
|
||||
<a href="<?= Backend::url('system/settings/update/winter/system/log_settings') ?>"><i class="icon-exclamation-triangle text-warning" title="<?= e(trans('system::lang.updates.disabled')) ?>" data-toggle="tooltip" data-placement="right"></i></a>
|
||||
<?php endif ?>
|
||||
</span>
|
||||
<a href="<?= Backend::url('system/eventlogs') ?>" class="status-label primary"><?= $eventLog ?></a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="status-icon"><i class="icon-file-o"></i></span>
|
||||
<span class="status-text">
|
||||
<?= e(trans('backend::lang.dashboard.status.request_log')) ?>
|
||||
<?php if ($requestLogMsg): ?>
|
||||
<a href="<?= Backend::url('system/settings/update/winter/system/log_settings') ?>"><i class="icon-exclamation-triangle text-warning" title="<?= e(trans('system::lang.updates.disabled')) ?>" data-toggle="tooltip" data-placement="right"></i></a>
|
||||
<?php endif ?>
|
||||
</span>
|
||||
<a href="<?= Backend::url('system/requestlogs') ?>" class="status-label primary"><?= $requestLog ?></a>
|
||||
</li>
|
||||
<?php if ($appBirthday): ?>
|
||||
<li>
|
||||
<span class="status-icon"><i class="icon-calendar"></i></span>
|
||||
<span class="status-text">
|
||||
<?= e(trans('backend::lang.dashboard.status.app_birthday')) ?>
|
||||
</span>
|
||||
<span class="status-label link"><?= Backend::dateTime($appBirthday, ['formatAlias' => 'dateLong']) ?></span>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="callout callout-warning">
|
||||
<div class="content"><?= e($error) ?></div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user