Conformidade KB: sem inc/includes.php, logo.png, limpeza e JSON_HEX_TAG
- front/*.php não incluem mais ../../../inc/includes.php: no GLPI 11 o LegacyFileLoadController boota o core antes do script, e o include quebra quando o plugin roda do marketplace dir (KB-PLUGIN-028/010). - logo.png (512x512) criado a partir de plugin.png: o LogoController só reconhece o nome fixo logo.png (KB-INFRA-002). - Removidos front/test_simple.php e front/login.css.php (deprecated), incluindo a firewall strategy correspondente no setup.php (KB-018). - json_encode com JSON_HEX_TAG|JSON_HEX_AMP em todo dado dinâmico embutido em <script> (KB-PLUGIN-003). - .gitignore padrão KB-018; .DS_Store removidos. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
072547ae8a
commit
18879bff6d
7 changed files with 18 additions and 39 deletions
|
|
@ -1,10 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$_GET["donotcheckversion"] = true;
|
// GLPI 11: o core já foi bootado pelo LegacyFileLoadController antes deste
|
||||||
$dont_check_maintenance_mode = true;
|
// arquivo executar — não incluir inc/includes.php (KB-PLUGIN-028)
|
||||||
|
|
||||||
define('GLPI_AJAX', true);
|
|
||||||
include('../../../inc/includes.php');
|
|
||||||
|
|
||||||
// FIX: Prevent this script from being stored as the "Return URL" after login
|
// FIX: Prevent this script from being stored as the "Return URL" after login
|
||||||
if (isset($_SESSION['glpi_currentpage']) && strpos($_SESSION['glpi_currentpage'], basename(__FILE__)) !== false) {
|
if (isset($_SESSION['glpi_currentpage']) && strpos($_SESSION['glpi_currentpage'], basename(__FILE__)) !== false) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$_GET["donotcheckversion"] = true;
|
// GLPI 11: o core já foi bootado pelo LegacyFileLoadController antes deste
|
||||||
$dont_check_maintenance_mode = true;
|
// arquivo executar — não incluir inc/includes.php (KB-PLUGIN-028)
|
||||||
|
|
||||||
define('GLPI_AJAX', true);
|
|
||||||
include('../../../inc/includes.php');
|
|
||||||
|
|
||||||
// FIX: Prevent this script from being stored as the "Return URL" after login
|
// FIX: Prevent this script from being stored as the "Return URL" after login
|
||||||
if (isset($_SESSION['glpi_currentpage']) && strpos($_SESSION['glpi_currentpage'], basename(__FILE__)) !== false) {
|
if (isset($_SESSION['glpi_currentpage']) && strpos($_SESSION['glpi_currentpage'], basename(__FILE__)) !== false) {
|
||||||
|
|
@ -56,14 +53,14 @@ if (false) {
|
||||||
?>
|
?>
|
||||||
var $icon = $('link[rel*=icon]');
|
var $icon = $('link[rel*=icon]');
|
||||||
$icon.attr('type', null);
|
$icon.attr('type', null);
|
||||||
$icon.attr('href', <?php echo json_encode($faviconUrl) ?>);
|
$icon.attr('href', <?php echo json_encode($faviconUrl, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
$pageTitle = PluginButterflyConfig::getConfig('page_title');
|
$pageTitle = PluginButterflyConfig::getConfig('page_title');
|
||||||
if ($pageTitle):
|
if ($pageTitle):
|
||||||
?>
|
?>
|
||||||
var $title = $('title');
|
var $title = $('title');
|
||||||
var newTitle = $title.text().replace('GLPI', <?php echo json_encode($pageTitle) ?>);
|
var newTitle = $title.text().replace('GLPI', <?php echo json_encode($pageTitle, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
$title.text(newTitle);
|
$title.text(newTitle);
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
|
@ -78,7 +75,7 @@ if (false) {
|
||||||
if ($footerDisplay === 'custom'):
|
if ($footerDisplay === 'custom'):
|
||||||
$footerText = \Glpi\RichText\RichText::getEnhancedHtml($footerText);
|
$footerText = \Glpi\RichText\RichText::getEnhancedHtml($footerText);
|
||||||
?>
|
?>
|
||||||
$('div[id^=about_modal_] .copyright').parent().parent().html(<?php echo json_encode($footerText) ?>);
|
$('div[id^=about_modal_] .copyright').parent().parent().html(<?php echo json_encode($footerText, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?php
|
|
||||||
// Deprecated endpoint kept for backward compatibility.
|
|
||||||
// All login styles are now injected inline from the display_login hook.
|
|
||||||
|
|
||||||
header('Content-Type: text/css');
|
|
||||||
header('Cache-Control: public, max-age=60');
|
|
||||||
|
|
||||||
echo "/* Butterfly plugin: login.css.php is deprecated. */\n";
|
|
||||||
|
|
@ -4,10 +4,8 @@
|
||||||
* Works without authentication and is compatible with GLPI 11 routing.
|
* Works without authentication and is compatible with GLPI 11 routing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$_GET['donotcheckversion'] = true;
|
// GLPI 11: o core já foi bootado pelo LegacyFileLoadController antes deste
|
||||||
$dont_check_maintenance_mode = true;
|
// arquivo executar — não incluir inc/includes.php (KB-PLUGIN-028)
|
||||||
|
|
||||||
require_once '../../../inc/includes.php';
|
|
||||||
|
|
||||||
$rawPath = $_GET['path'] ?? '';
|
$rawPath = $_GET['path'] ?? '';
|
||||||
if ($rawPath === '') {
|
if ($rawPath === '') {
|
||||||
|
|
|
||||||
18
hook.php
18
hook.php
|
|
@ -50,12 +50,12 @@ function plugin_butterfly_display_login() {
|
||||||
$(function() {
|
$(function() {
|
||||||
var $loginInputs = $('#login_name, #inputUsername');
|
var $loginInputs = $('#login_name, #inputUsername');
|
||||||
if ($loginInputs.length) {
|
if ($loginInputs.length) {
|
||||||
$loginInputs.attr('placeholder', <?php echo json_encode(__('Login')) ?>);
|
$loginInputs.attr('placeholder', <?php echo json_encode(__('Login'), JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
}
|
}
|
||||||
|
|
||||||
var $passwordInputs = $('input[type=password], input[name=password]');
|
var $passwordInputs = $('input[type=password], input[name=password]');
|
||||||
if ($passwordInputs.length) {
|
if ($passwordInputs.length) {
|
||||||
$passwordInputs.attr('placeholder', <?php echo json_encode(__('Password')) ?>);
|
$passwordInputs.attr('placeholder', <?php echo json_encode(__('Password'), JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
$passwordInputs.each(function() {
|
$passwordInputs.each(function() {
|
||||||
var $input = $(this);
|
var $input = $(this);
|
||||||
var $description = $input.siblings('.form-label-description').first();
|
var $description = $input.siblings('.form-label-description').first();
|
||||||
|
|
@ -71,14 +71,14 @@ function plugin_butterfly_display_login() {
|
||||||
?>
|
?>
|
||||||
var $icon = $('link[rel*=icon]');
|
var $icon = $('link[rel*=icon]');
|
||||||
$icon.attr('type', null);
|
$icon.attr('type', null);
|
||||||
$icon.attr('href', <?php echo json_encode($faviconUrl) ?>);
|
$icon.attr('href', <?php echo json_encode($faviconUrl, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
$pageTitle = PluginButterflyConfig::getConfig('page_title');
|
$pageTitle = PluginButterflyConfig::getConfig('page_title');
|
||||||
if ($pageTitle) :
|
if ($pageTitle) :
|
||||||
?>
|
?>
|
||||||
var $title = $('title');
|
var $title = $('title');
|
||||||
var newTitle = $title.text().replace('GLPI', <?php echo json_encode($pageTitle) ?>);
|
var newTitle = $title.text().replace('GLPI', <?php echo json_encode($pageTitle, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
$title.text(newTitle);
|
$title.text(newTitle);
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
|
@ -94,17 +94,17 @@ function plugin_butterfly_display_login() {
|
||||||
?>
|
?>
|
||||||
var $footerTarget = $('#footer-login, .login-footer').first();
|
var $footerTarget = $('#footer-login, .login-footer').first();
|
||||||
if ($footerTarget.length) {
|
if ($footerTarget.length) {
|
||||||
$footerTarget.html(<?php echo json_encode($footerText) ?>);
|
$footerTarget.html(<?php echo json_encode($footerText, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
} else {
|
} else {
|
||||||
$('a.copyright').parent().html(<?php echo json_encode($footerText) ?>);
|
$('a.copyright').parent().html(<?php echo json_encode($footerText, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?>);
|
||||||
}
|
}
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
if ($loginPicture) :
|
if ($loginPicture) :
|
||||||
?>
|
?>
|
||||||
var pictureUrl = <?php echo json_encode($pictureUrl); ?>;
|
var pictureUrl = <?php echo json_encode($pictureUrl, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP); ?>;
|
||||||
var maxWidth = <?php echo json_encode($maxWidth); ?>;
|
var maxWidth = <?php echo json_encode($maxWidth, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP); ?>;
|
||||||
var maxHeight = <?php echo json_encode($maxHeight); ?>;
|
var maxHeight = <?php echo json_encode($maxHeight, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP); ?>;
|
||||||
|
|
||||||
$('.page-anonymous .glpi-logo').css({
|
$('.page-anonymous .glpi-logo').css({
|
||||||
'background-image': 'url(' + pictureUrl + ')',
|
'background-image': 'url(' + pictureUrl + ')',
|
||||||
|
|
|
||||||
BIN
logo.png
Normal file
BIN
logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
|
|
@ -29,11 +29,6 @@ function plugin_init_butterfly()
|
||||||
'#^/front/picture\.send\.php$#',
|
'#^/front/picture\.send\.php$#',
|
||||||
\Glpi\Http\Firewall::STRATEGY_NO_CHECK
|
\Glpi\Http\Firewall::STRATEGY_NO_CHECK
|
||||||
);
|
);
|
||||||
\Glpi\Http\Firewall::addPluginStrategyForLegacyScripts(
|
|
||||||
'butterfly',
|
|
||||||
'#^/front/login\.css\.php$#',
|
|
||||||
\Glpi\Http\Firewall::STRATEGY_NO_CHECK
|
|
||||||
);
|
|
||||||
\Glpi\Http\Firewall::addPluginStrategyForLegacyScripts(
|
\Glpi\Http\Firewall::addPluginStrategyForLegacyScripts(
|
||||||
'butterfly',
|
'butterfly',
|
||||||
'#^/front/internal\.css\.php$#',
|
'#^/front/internal\.css\.php$#',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue