Upload via GUI (267 Dateien)
This commit is contained in:
@@ -1,5 +1,26 @@
|
||||
# Verhindert die Ausführung von hochgeladenen Dateien in diesem Verzeichnis
|
||||
<FilesMatch "\.(php|php3|php4|php5|php7|phtml|phar|pl|py|cgi|asp|aspx|jsp|sh|bash|exe|htaccess|htpasswd|env)$">
|
||||
Require all denied
|
||||
# Hochgeladene Logos: nur Bilder ausliefern, nie Programmcode ausführen
|
||||
<FilesMatch "\.(php|php3|php4|php5|php7|php8|phtml|phar|pl|py|cgi|asp|aspx|jsp|sh|bash|exe|htaccess|htpasswd|env|html?|xhtml|shtml|xml|js|mjs)$">
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
php_flag engine off
|
||||
# "php_flag" nur setzen, wenn PHP als Apache-Modul läuft. Unter FPM/CGI führt die Zeile sonst zu einem Serverfehler (HTTP 500) für jede Datei,
|
||||
# auch für das Logo.
|
||||
<IfModule mod_php.c>
|
||||
php_flag engine off
|
||||
</IfModule>
|
||||
<IfModule mod_php7.c>
|
||||
php_flag engine off
|
||||
</IfModule>
|
||||
<IfModule mod_php8.c>
|
||||
php_flag engine off
|
||||
</IfModule>
|
||||
# Ein SVG-Logo darf im Bild-Tag laufen, aber nicht als eigene Seite Skripte ausführen
|
||||
<IfModule mod_headers.c>
|
||||
Header set X-Content-Type-Options "nosniff"
|
||||
Header set Content-Security-Policy "default-src 'none'; style-src 'unsafe-inline'; sandbox"
|
||||
</IfModule>
|
||||
|
||||
@@ -6,6 +6,93 @@
|
||||
* zusätzlich über sanitize_staff_html() bereinigt – dieses Skript ist nur für Komfort,
|
||||
* keine Sicherheitsgrenze.
|
||||
*/
|
||||
(function () {
|
||||
/**
|
||||
* Bilder im Editor skalieren: Klick auf ein Bild zeigt einen Rahmen mit Anfasser (ziehen mit Maus oder Finger) und Schnellwahl
|
||||
* 25 / 50 / 75 % und Original. Chrome und Edge bieten das bei contenteditable nicht von selbst, Firefox hat eigene Anfasser,
|
||||
* die hier abgeschaltet werden, damit es nur eine Bedienung gibt. Die Breite wird als Attribut und als Stil gesetzt
|
||||
* (E-Mail-Programme wie Outlook beachten das Attribut), die Höhe folgt automatisch.
|
||||
*/
|
||||
window.attachImageResize = function (editable) {
|
||||
if (!editable || editable.dataset.imgResize) return;
|
||||
editable.dataset.imgResize = '1';
|
||||
try { document.execCommand('enableObjectResizing', false, false); } catch (e) { /* nicht überall verfügbar */ }
|
||||
|
||||
let current = null;
|
||||
const box = document.createElement('div');
|
||||
box.style.cssText = 'position:absolute;display:none;z-index:9999;border:2px solid #0f6f6a;box-sizing:border-box;pointer-events:none';
|
||||
const bar = document.createElement('div');
|
||||
bar.style.cssText = 'position:absolute;left:-2px;top:-40px;display:flex;gap:4px;align-items:center;pointer-events:auto;background:#fff;border:1px solid #cbd5e1;border-radius:6px;padding:3px;box-shadow:0 2px 8px rgba(0,0,0,.18);white-space:nowrap';
|
||||
const info = document.createElement('span');
|
||||
info.style.cssText = 'font:12px system-ui,sans-serif;color:#475569;padding:0 6px';
|
||||
const handle = document.createElement('div');
|
||||
handle.title = 'Ziehen zum Skalieren';
|
||||
handle.style.cssText = 'position:absolute;right:-9px;bottom:-9px;width:16px;height:16px;background:#0f6f6a;border:2px solid #fff;border-radius:50%;cursor:nwse-resize;pointer-events:auto;touch-action:none;box-shadow:0 1px 4px rgba(0,0,0,.3)';
|
||||
box.appendChild(bar);
|
||||
box.appendChild(handle);
|
||||
document.body.appendChild(box);
|
||||
|
||||
function changed() { editable.dispatchEvent(new Event('input', { bubbles: true })); }
|
||||
function maxWidth() { return Math.max(40, editable.clientWidth - 24); }
|
||||
function place() {
|
||||
if (!current || !document.body.contains(current)) { hide(); return; }
|
||||
const r = current.getBoundingClientRect();
|
||||
box.style.display = 'block';
|
||||
box.style.left = (r.left + window.scrollX) + 'px';
|
||||
box.style.top = (r.top + window.scrollY) + 'px';
|
||||
box.style.width = r.width + 'px';
|
||||
box.style.height = r.height + 'px';
|
||||
bar.style.top = r.top + window.scrollY > 44 ? '-40px' : (r.height + 8) + 'px'; // am Seitenanfang unter dem Bild statt darüber
|
||||
info.textContent = Math.round(r.width) + ' px';
|
||||
}
|
||||
function hide() { current = null; box.style.display = 'none'; }
|
||||
function setWidth(w) {
|
||||
if (!current) return;
|
||||
w = Math.max(24, Math.min(Math.round(w), maxWidth()));
|
||||
current.style.width = w + 'px';
|
||||
current.style.height = 'auto';
|
||||
current.style.maxWidth = '100%';
|
||||
current.setAttribute('width', String(w));
|
||||
current.removeAttribute('height');
|
||||
place();
|
||||
changed();
|
||||
}
|
||||
|
||||
[['25 %', 0.25], ['50 %', 0.5], ['75 %', 0.75], ['Original', 1]].forEach(function (p) {
|
||||
const b = document.createElement('button');
|
||||
b.type = 'button';
|
||||
b.textContent = p[0];
|
||||
b.style.cssText = 'font:12px system-ui,sans-serif;padding:3px 8px;border:1px solid #cbd5e1;border-radius:4px;background:#f8fafc;cursor:pointer';
|
||||
b.addEventListener('mousedown', function (e) { e.preventDefault(); });
|
||||
b.addEventListener('click', function () { if (current) setWidth((current.naturalWidth || current.width) * p[1]); });
|
||||
bar.appendChild(b);
|
||||
});
|
||||
bar.appendChild(info);
|
||||
|
||||
handle.addEventListener('pointerdown', function (e) {
|
||||
if (!current) return;
|
||||
e.preventDefault();
|
||||
handle.setPointerCapture(e.pointerId);
|
||||
const startX = e.clientX, startW = current.getBoundingClientRect().width;
|
||||
function move(ev) { setWidth(startW + (ev.clientX - startX)); }
|
||||
function up() { handle.removeEventListener('pointermove', move); handle.removeEventListener('pointerup', up); handle.removeEventListener('pointercancel', up); }
|
||||
handle.addEventListener('pointermove', move);
|
||||
handle.addEventListener('pointerup', up);
|
||||
handle.addEventListener('pointercancel', up);
|
||||
});
|
||||
|
||||
editable.addEventListener('click', function (e) {
|
||||
if (e.target && e.target.tagName === 'IMG') { current = e.target; place(); } else { hide(); }
|
||||
});
|
||||
document.addEventListener('mousedown', function (e) {
|
||||
if (current && e.target !== current && !box.contains(e.target)) hide();
|
||||
});
|
||||
editable.addEventListener('keyup', function () { if (current) place(); });
|
||||
editable.addEventListener('scroll', place);
|
||||
window.addEventListener('scroll', place, true);
|
||||
window.addEventListener('resize', place);
|
||||
};
|
||||
})();
|
||||
(function () {
|
||||
function initRichText(textarea) {
|
||||
if (!textarea || textarea.dataset.richtextReady) return;
|
||||
@@ -126,6 +213,7 @@
|
||||
wrap.appendChild(toolbar);
|
||||
wrap.appendChild(editable);
|
||||
wrap.appendChild(textarea);
|
||||
if (window.attachImageResize) window.attachImageResize(editable);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
Reference in New Issue
Block a user