Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion www/bases-examples_Linux/lang/pt/opac.tab
Original file line number Diff line number Diff line change
Expand Up @@ -623,4 +623,17 @@ cfg_footer_copyright=Rodapé Inferior (Copyright)
cfg_footer_copyright_desc=Texto de Copyright:
cfg_style_linear_placeholder=Ou cole seu CSS/Gradiente aqui...
cfg_style_css=CSS Personalizado / Injeção de Código
cfg_style_css_desc=Adicione estilos CSS extras para sobrescrever o tema padrão. Não use a tag < style >, apenas o código CSS.
cfg_style_css_desc=Adicione estilos CSS extras para sobrescrever o tema padrão. Não use a tag < style >, apenas o código CSS.
january=Janeiro
february=Fevereiro
march=Março
april=Abril
may=Maio
june=Junho
july=Julho
august=Agosto
september=Setembro
october=Outubro
november=Novembro
december=Dezembro
front_ip_not_allowed=Acesso restrito: Seu IP ($client_ip) não tem permissão para esta base.
15 changes: 14 additions & 1 deletion www/bases-examples_Windows/lang/pt/opac.tab
Original file line number Diff line number Diff line change
Expand Up @@ -623,4 +623,17 @@ cfg_footer_copyright=Rodapé Inferior (Copyright)
cfg_footer_copyright_desc=Texto de Copyright:
cfg_style_linear_placeholder=Ou cole seu CSS/Gradiente aqui...
cfg_style_css=CSS Personalizado / Injeção de Código
cfg_style_css_desc=Adicione estilos CSS extras para sobrescrever o tema padrão. Não use a tag < style >, apenas o código CSS.
cfg_style_css_desc=Adicione estilos CSS extras para sobrescrever o tema padrão. Não use a tag < style >, apenas o código CSS.
january=Janeiro
february=Fevereiro
march=Março
april=Abril
may=Maio
june=Junho
july=Julho
august=Agosto
september=Setembro
october=Outubro
november=Novembro
december=Dezembro
front_ip_not_allowed=Acesso restrito: Seu IP ($client_ip) não tem permissão para esta base.
2 changes: 1 addition & 1 deletion www/htdocs/assets/css/leaflet.css
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ svg.leaflet-image-layer.leaflet-interactive path {

/* Default icon URLs */
.leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
background-image: url(images/marker-icon.png);
background-image: url(../images/marker-icon.png);
}


Expand Down
Binary file added www/htdocs/assets/images/marker-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 19 additions & 13 deletions www/htdocs/central/config_opac.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,30 @@
}

// =========================================================================
// BLOCK 5: LANGUAGE DETECTION
// BLOCK 5: LANGUAGE DETECTION (CORRIGIDO)
// =========================================================================

// --- CRITICAL PROTECTION: Do not change language if you are in Central ---
if (!$is_central_context) {
$lang_config = $lang; // Recupera o padrão do config.php

$lang_config = $lang; // Store default language from config.php

if (isset($_SESSION["permiso"]) && isset($_SESSION["lang"])) {
$lang = $_SESSION["lang"];
} elseif (isset($_REQUEST["lang"]) && $_REQUEST["lang"] != "") {
// 1. PRIORIDADE MÁXIMA: Mudança explícita via URL/Formulário
if (isset($_REQUEST["lang"]) && $_REQUEST["lang"] != "") {
$lang = $_REQUEST["lang"];
$_SESSION["opac_lang"] = $lang;
} elseif (isset($_SESSION["opac_lang"])) {
$_SESSION["lang"] = $lang; // Atualiza sessão padrão
$_SESSION["opac_lang"] = $lang; // Atualiza sessão específica do OPAC
}
// 2. SEGUNDA PRIORIDADE: Sessão já estabelecida
elseif (isset($_SESSION["opac_lang"])) {
$lang = $_SESSION["opac_lang"];
} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
} elseif (isset($_SESSION["lang"])) {
$lang = $_SESSION["lang"];
}
// 3. TERCEIRA PRIORIDADE: Idioma do Navegador
elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
} else {
}
// 4. FALLBACK: Configuração do sistema
else {
$lang = $lang_config;
}

Expand All @@ -164,11 +170,11 @@
if (file_exists($CentralPath . "/lang/admin.php")) include($CentralPath . "/lang/admin.php");

// Final language validation
// Verifica se a pasta do idioma existe, senão volta para o padrão ou inglês
if (!is_dir($db_path . "opac_conf/" . $lang)) {
$lang = "en";
$lang = (is_dir($db_path . "opac_conf/pt")) ? "pt" : "en";
}
}
// -----------------------------------------------------------------

// =========================================================================
// BLOCK 6: VISUAL AND FUNCTIONAL SETTINGS
Expand Down
14 changes: 13 additions & 1 deletion www/htdocs/central/lang/00/opac.tab
Original file line number Diff line number Diff line change
Expand Up @@ -619,4 +619,16 @@ cfg_footer_copyright=Footer (Copyright)
cfg_footer_copyright_desc=Copyright Text:
cfg_style_linear_placeholder=Or paste your CSS/Gradient here...
cfg_style_css=Custom CSS / Code Injection
cfg_style_css_desc=Add extra CSS styles to override the default theme. Do not use the < style > tag, only CSS code.
cfg_style_css_desc=Add extra CSS styles to override the default theme. Do not use the < style > tag, only CSS code.
january=January
february=February
march=March
april=April
may=May
june=June
july=July
august=August
september=September
october=October
november=November
december=December
26 changes: 21 additions & 5 deletions www/htdocs/central/settings/opac/view_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,28 @@ function geoLocalizacao($ip)
$ips_unicos = [];

foreach ($linhas as $linha) {
$dados = explode("\t", trim($linha));
if (count($dados) >= 3) {
$linha = trim($linha);
if (empty($linha)) continue;

// DETECÇÃO DE FORMATO
if (strpos($linha, '|') !== false) {
// Novo formato: 2026-03-10 04:05:40|189.30.231.236|"Economic"
$dados = explode('|', $linha);
$datahora = trim($dados[0] ?? "");
$ip = trim($dados[1] ?? "");
// Remove aspas do termo se existirem
$termo = strtolower(trim($dados[2] ?? "", " \t\n\r\0\x0B\""));
} else {
// Formato antigo: separado por tabulação (\t)
$dados = explode("\t", $linha);
if (count($dados) < 3) continue; // Pula linhas malformadas
$datahora = $dados[0];
$ip = $dados[1];
$termo = strtolower(trim($dados[2]));
$ip = $dados[1];
$termo = strtolower(trim($dados[2]));
}

// A partir daqui, a lógica de geolocalização e contagem permanece a mesma
if ($ip != "") {
if (!isset($ips_unicos[$ip])) {
$geo = geoLocalizacao($ip);
$ips_unicos[$ip] = $geo ?: ['local' => 'Desconhecido', 'lat' => null, 'lon' => null];
Expand Down Expand Up @@ -141,7 +157,7 @@ function geoLocalizacao($ip)
$date_part = end($parts);
@list($ano, $mes) = explode('-', $date_part);

$meses = ["", "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
$meses = ["", $msgstr['january'], $msgstr['february'], $msgstr['march'], $msgstr['april'], $msgstr['may'], $msgstr['june'], $msgstr['july'], $msgstr['august'], $msgstr['september'], $msgstr['october'], $msgstr['november'], $msgstr['december']];
$display_text = isset($meses[(int)$mes]) ? $meses[(int)$mes] . " / " . $ano : basename($file);
?>
<option value="<?php echo htmlspecialchars($file); ?>" <?php echo ($file == $arquivo_selecionado) ? 'selected' : ''; ?>>
Expand Down
18 changes: 18 additions & 0 deletions www/htdocs/opac/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,22 @@ button.termo {
.facet-scroll-list::-webkit-scrollbar-thumb {
background-color: #888;
border-radius: 10px;
}


/* Quando em tela cheia, garante que o canvas use todo o monitor e mantenha a proporção */
.protected-canvas:fullscreen {
width: 100vw !important;
height: 100vh !important;
max-width: none !important; /* Isso mata o img-fluid do Bootstrap no fullscreen */
object-fit: contain !important;
background-color: #000;
}

.protected-canvas:-webkit-full-screen {
width: 100vw !important;
height: 100vh !important;
max-width: none !important;
object-fit: contain !important;
background-color: #000;
}
107 changes: 74 additions & 33 deletions www/htdocs/opac/assets/js/canvas.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,83 @@
window.addEventListener('DOMContentLoaded', () => {
const canvases = document.querySelectorAll('.protected-canvas');

canvases.forEach(canvas => {
const desenharImagem = (canvas) => {
const src = canvas.dataset.src;
if (!src) return;

const ctx = canvas.getContext('2d');
const img = new Image();
img.crossOrigin = "anonymous";
img.src = src;

img.onerror = () => console.error("Erro ao carregar:", src);

img.onload = () => {
const maxWidth = 600;
const scale = Math.min(1, maxWidth / img.width);
const width = img.width * scale;
const height = img.height * scale;

canvas.width = width;
canvas.height = height;

ctx.drawImage(img, 0, 0, width, height);

// Marca d'água
const watermark = document.title; // Troque pelo nome desejado
const fontSize = Math.floor(width / 15);
ctx.font = `${fontSize}px Arial`;
ctx.fillStyle = "rgba(255, 255, 255, 0.4)";
ctx.textAlign = "center";
ctx.textBaseline = "middle";

ctx.save();
ctx.translate(width / 2, height / 2);
ctx.rotate(-Math.PI / 4); // 45 graus
ctx.fillText(watermark, 0, 0);
ctx.restore();
// Define a resolução interna limite (1920px) para não travar a RAM do navegador
const MAX_WIDTH = 1920;
const scale = Math.min(1, MAX_WIDTH / img.width);

const internalWidth = img.width * scale;
const internalHeight = img.height * scale;

// O SEGREDO: Dá ao canvas a mesma resolução real da imagem
canvas.width = internalWidth;
canvas.height = internalHeight;

// Desenha a imagem na resolução alta
ctx.drawImage(img, 0, 0, internalWidth, internalHeight);

// Desenha a marca d'água proporcional a essa resolução
const fontSize = Math.floor(internalWidth / 15);
ctx.font = `bold ${fontSize}px Arial`;
ctx.fillStyle = "rgba(255, 255, 255, 0.3)";
ctx.textAlign = "center";
ctx.save();
ctx.translate(internalWidth / 2, internalHeight / 2);
ctx.rotate(-Math.PI / 4);
ctx.fillText("ACERVO PROTEGIDO", 0, 0);
ctx.restore();

canvas.setAttribute('data-processed', 'true');
};

canvas.addEventListener("contextmenu", e => {
e.preventDefault();
alert("Imagem protegida.");
img.src = src;

// Bloqueia clique direito
canvas.addEventListener("contextmenu", e => e.preventDefault());

// Configura o botão de Fullscreen
const btn = canvas.parentElement.querySelector('.btn-fullscreen-canvas') ||
canvas.closest('div').querySelector('.btn-fullscreen-canvas');

if (btn && !btn.hasAttribute('data-click-bound')) {
btn.addEventListener('click', () => {
if (canvas.requestFullscreen) canvas.requestFullscreen();
else if (canvas.webkitRequestFullscreen) canvas.webkitRequestFullscreen();
});
btn.setAttribute('data-click-bound', 'true'); // Evita duplicar cliques
}
};

// Observador de Visibilidade (Lazy Load para imagens do Looping e Modal)
const visibilidadeObserver = new IntersectionObserver((entradas, obs) => {
entradas.forEach(entrada => {
if (entrada.isIntersecting) {
desenharImagem(entrada.target);
obs.unobserve(entrada.target); // Para de vigiar depois que desenhou
}
});
});
});
}, { threshold: 0.01 });

// Busca os canvas novos na tela
const procurarCanvas = () => {
document.querySelectorAll('.protected-canvas:not([data-observing="true"])').forEach(canvas => {
canvas.setAttribute('data-observing', 'true');
visibilidadeObserver.observe(canvas);
});
};

// Inicia a vigilância
const iniciar = () => {
if (!document.body) { setTimeout(iniciar, 10); return; }
procurarCanvas();
new MutationObserver(procurarCanvas).observe(document.body, { childList: true, subtree: true });
};

iniciar();
2 changes: 0 additions & 2 deletions www/htdocs/opac/assets/js/script_b.js
Original file line number Diff line number Diff line change
Expand Up @@ -1153,8 +1153,6 @@ function processarTermosLivres() {
}


// Localize e substitua esta função em opac/assets/js/script_b.js

function processarTermosLivres() {
// Pega os elementos do formulário
const form = document.getElementById('facetasForm');
Expand Down
Loading