Compare commits

..

15 Commits

Author SHA1 Message Date
Terranom674
5772a59b55 Bump version to 0.9.7.15 2026-08-19 22:58:34 +02:00
Terranom674
84762154d6 Return JSON for Piwigo AJAX image loader 2026-08-19 22:58:17 +02:00
Terranom674
1580c235a8 Fix Piwigo AJAX loader response for WebDAV derivatives 2026-08-19 22:57:56 +02:00
Terranom674
4aac5ca4a2 Merge pull request #36 from Terranom674/fix/09714-cache-permissions
0.9.7.14: WebDAV-Cache-Rechte reparieren
2026-08-19 22:48:56 +02:00
Terranom674
ab1f20beef 0.9.7.14: Einmalige Cache-Rechtereparatur 2026-08-19 22:48:00 +02:00
Terranom674
f94a001006 Version 0.9.7.14 2026-08-19 22:47:45 +02:00
Terranom674
3f64895f8e 0.9.7.14: Connector-Cache-Rechte normalisieren 2026-08-19 22:47:20 +02:00
Terranom674
48f1eacce7 Merge pull request #35 from Terranom674/fix/09713-watermark-album-overview
0.9.7.13: Wasserzeichen in Albumübersicht nach Albumregel
2026-08-19 22:43:07 +02:00
Terranom674
7c8c7ab98a Purge stale watermark cache once on 0.9.7.13 2026-08-19 22:42:24 +02:00
Terranom674
ade38ff2d1 Clear watermark cache after profile changes 2026-08-19 22:42:01 +02:00
Terranom674
6a013fe875 Clear watermark cache after album rule changes 2026-08-19 22:41:36 +02:00
Terranom674
c71112d94e Invalidate watermark cache on rule changes 2026-08-19 22:41:20 +02:00
Terranom674
7d97e1b515 Register album overview watermark context 2026-08-19 22:39:08 +02:00
Terranom674
47afbc7f43 Fix watermark context for album overview covers 2026-08-19 22:38:54 +02:00
Terranom674
706639a57e Merge pull request #34 from Terranom674/fix/09712-ondemand-missing-preview
0.9.7.12: On-Demand-Altbilder nicht mehr auf 404 hängen lassen
2026-08-19 22:36:50 +02:00
9 changed files with 253 additions and 12 deletions

View File

@@ -27,6 +27,72 @@ function bratonien_tools_runtime_category_id()
return 0; return 0;
} }
function bratonien_tools_watermark_album_cover_category($src_image, $category_id=null)
{
static $map = null;
if ($map === null)
{
$map = new SplObjectStorage();
}
if (!is_object($src_image))
{
return 0;
}
if ($category_id !== null)
{
$category_id = (int)$category_id;
if ($category_id > 0)
{
$map[$src_image] = $category_id;
}
return $category_id;
}
return $map->contains($src_image) ? (int)$map[$src_image] : 0;
}
function bratonien_tools_watermark_prepare_album_overview($thumbnails)
{
if (!is_array($thumbnails))
{
return $thumbnails;
}
foreach ($thumbnails as &$thumbnail)
{
$category_id = (int)($thumbnail['id'] ?? $thumbnail['ID'] ?? 0);
if ($category_id < 1 || empty($thumbnail['representative']['src_image']) || !is_object($thumbnail['representative']['src_image']))
{
continue;
}
// Ein Repraesentantenbild kann fuer mehrere Alben verwendet werden. Piwigo
// reicht in der Albumuebersicht aber nur das SrcImage an get_derivative_url
// weiter. Deshalb bekommt jedes Album-Cover eine eigene SrcImage-Instanz,
// damit seine konkrete Albumregel erhalten bleibt.
$src_image = clone $thumbnail['representative']['src_image'];
$thumbnail['representative']['src_image'] = $src_image;
bratonien_tools_watermark_album_cover_category($src_image, $category_id);
}
unset($thumbnail);
return $thumbnails;
}
function bratonien_tools_runtime_derivative_category_id($src_image)
{
$category_id = bratonien_tools_runtime_category_id();
if ($category_id > 0)
{
return $category_id;
}
return bratonien_tools_watermark_album_cover_category($src_image);
}
function bratonien_tools_runtime_effective_rule($category_id) function bratonien_tools_runtime_effective_rule($category_id)
{ {
static $categories = null; static $categories = null;
@@ -230,7 +296,7 @@ function bratonien_tools_filter_derivative_url($url, $params, $src_image, $rel_u
return $url; return $url;
} }
$rule = bratonien_tools_runtime_effective_rule(bratonien_tools_runtime_category_id()); $rule = bratonien_tools_runtime_effective_rule(bratonien_tools_runtime_derivative_category_id($src_image));
if ($rule['mode'] !== 'profile' || empty($rule['profile_id'])) if ($rule['mode'] !== 'profile' || empty($rule['profile_id']))
{ {
return $url; return $url;

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
Plugin Name: Bratonien Tools Plugin Name: Bratonien Tools
Version: 0.9.7.12 Version: 0.9.7.15
Description: Erweiterbare Administrationswerkzeuge fuer die Bratonien-Piwigo-Installation. Description: Erweiterbare Administrationswerkzeuge fuer die Bratonien-Piwigo-Installation.
Plugin URI: https://github.com/Terranom674/Piwigo_Bratonien_Tools Plugin URI: https://github.com/Terranom674/Piwigo_Bratonien_Tools
Author: Bratonien Author: Bratonien
@@ -28,11 +28,13 @@ require_once(BRATONIEN_TOOLS_PATH . 'include/nc_productive_ws.inc.php');
require_once(BRATONIEN_TOOLS_PATH . 'include/nc_connector_scheduler.inc.php'); require_once(BRATONIEN_TOOLS_PATH . 'include/nc_connector_scheduler.inc.php');
add_event_handler('get_admin_plugin_menu_links', 'bratonien_tools_admin_menu'); add_event_handler('get_admin_plugin_menu_links', 'bratonien_tools_admin_menu');
add_event_handler('loc_end_index_category_thumbnails', 'bratonien_tools_watermark_prepare_album_overview');
add_event_handler('get_derivative_url', 'bratonien_tools_filter_derivative_url', EVENT_HANDLER_PRIORITY_NEUTRAL, 4); add_event_handler('get_derivative_url', 'bratonien_tools_filter_derivative_url', EVENT_HANDLER_PRIORITY_NEUTRAL, 4);
add_event_handler('get_src_image_url', 'bratonien_tools_filter_webdav_src_url', EVENT_HANDLER_PRIORITY_NEUTRAL + 50, 2); add_event_handler('get_src_image_url', 'bratonien_tools_filter_webdav_src_url', EVENT_HANDLER_PRIORITY_NEUTRAL + 50, 2);
add_event_handler('get_derivative_url', 'bratonien_tools_filter_webdav_gallery_derivative_url', EVENT_HANDLER_PRIORITY_NEUTRAL + 50, 4); add_event_handler('get_derivative_url', 'bratonien_tools_filter_webdav_gallery_derivative_url', EVENT_HANDLER_PRIORITY_NEUTRAL + 50, 4);
add_event_handler('loc_end_element_set_global', 'bratonien_tools_batch_titles_register_action'); add_event_handler('loc_end_element_set_global', 'bratonien_tools_batch_titles_register_action');
add_event_handler('element_set_global_action', 'bratonien_tools_batch_titles_apply', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); add_event_handler('element_set_global_action', 'bratonien_tools_batch_titles_apply', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
add_event_handler('init', 'bratonien_tools_watermark_cache_upgrade', EVENT_HANDLER_PRIORITY_NEUTRAL - 40);
add_event_handler('init', 'bratonien_tools_prepare_connector_private_import', EVENT_HANDLER_PRIORITY_NEUTRAL - 30); add_event_handler('init', 'bratonien_tools_prepare_connector_private_import', EVENT_HANDLER_PRIORITY_NEUTRAL - 30);
add_event_handler('init', 'bratonien_tools_prepare_private_album_permissions', EVENT_HANDLER_PRIORITY_NEUTRAL - 20); add_event_handler('init', 'bratonien_tools_prepare_private_album_permissions', EVENT_HANDLER_PRIORITY_NEUTRAL - 20);
add_event_handler('init', 'bratonien_tools_preserve_private_album_access', EVENT_HANDLER_PRIORITY_NEUTRAL - 10); add_event_handler('init', 'bratonien_tools_preserve_private_album_access', EVENT_HANDLER_PRIORITY_NEUTRAL - 10);

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeuo pipefail set -Eeuo pipefail
umask 0002
CONFIG_FILE="${PIWIGO_CONFIG:-}" CONFIG_FILE="${PIWIGO_CONFIG:-}"
[[ -n "$CONFIG_FILE" && -r "$CONFIG_FILE" ]] || { echo "WebDAV-Konfiguration fehlt: ${CONFIG_FILE:-<leer>}" >&2; exit 1; } [[ -n "$CONFIG_FILE" && -r "$CONFIG_FILE" ]] || { echo "WebDAV-Konfiguration fehlt: ${CONFIG_FILE:-<leer>}" >&2; exit 1; }
@@ -22,6 +23,38 @@ exec 9>"$LOCK_FILE"
flock -n 9 || exit 0 flock -n 9 || exit 0
PREVIEW_CACHE="$PIWIGO_ROOT/_data/bratonien-tools/nc-webdav-preview/connection-$CONNECTION_ID" PREVIEW_CACHE="$PIWIGO_ROOT/_data/bratonien-tools/nc-webdav-preview/connection-$CONNECTION_ID"
SOURCE_CACHE="$PIWIGO_ROOT/_data/bratonien-tools/nc-webdav-gallery/connection-$CONNECTION_ID"
DERIVATIVE_CACHE="$PIWIGO_ROOT/_data/i/_data/bratonien-tools/nc-webdav-gallery/connection-$CONNECTION_ID"
PIWIGO_DATA="$PIWIGO_ROOT/_data"
normalize_connector_cache_permissions() {
[[ -d "$PIWIGO_DATA" ]] || return 0
local data_uid data_gid current_uid path
data_uid="$(stat -c '%u' "$PIWIGO_DATA")"
data_gid="$(stat -c '%g' "$PIWIGO_DATA")"
current_uid="$(id -u)"
for path in "$SOURCE_CACHE" "$PREVIEW_CACHE" "$DERIVATIVE_CACHE"; do
[[ -e "$path" ]] || continue
if [[ "$current_uid" -eq 0 ]]; then
chown -R "$data_uid:$data_gid" -- "$path"
fi
if ! find "$path" -type d -exec chmod 2775 {} + 2>/dev/null; then
echo "Hinweis: Verzeichnisrechte konnten ohne Root-Rechte nicht vollständig repariert werden: $path" >&2
fi
if ! find "$path" -type f -exec chmod 0664 {} + 2>/dev/null; then
echo "Hinweis: Dateirechte konnten ohne Root-Rechte nicht vollständig repariert werden: $path" >&2
fi
done
}
# Altbestände aus früheren root/systemd-Läufen werden repariert, sobald dieser
# Lauf mit ausreichenden Rechten ausgeführt wird. Bei normalen Webserver-Läufen
# werden zumindest alle eigenen Dateien gruppenschreibbar gehalten.
normalize_connector_cache_permissions
php "$SCRIPT_DIR/lib/precache-webdav-previews.php" \ php "$SCRIPT_DIR/lib/precache-webdav-previews.php" \
--mapping="$WEBDAV_MAPPING_FILE" \ --mapping="$WEBDAV_MAPPING_FILE" \
@@ -33,3 +66,5 @@ php "$SCRIPT_DIR/lib/precache-webdav-previews.php" \
php "$SCRIPT_DIR/lib/build-webdav-derivatives.php" \ php "$SCRIPT_DIR/lib/build-webdav-derivatives.php" \
--piwigo-root="$PIWIGO_ROOT" \ --piwigo-root="$PIWIGO_ROOT" \
--connection-id="$CONNECTION_ID" --connection-id="$CONNECTION_ID"
normalize_connector_cache_permissions

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -Eeuo pipefail
PIWIGO_ROOT="${1:-/var/www/piwigo}"
PIWIGO_ROOT="${PIWIGO_ROOT%/}"
DATA_DIR="$PIWIGO_ROOT/_data"
[[ -d "$DATA_DIR" ]] || { echo "Piwigo-_data wurde nicht gefunden: $DATA_DIR" >&2; exit 1; }
[[ "$(id -u)" -eq 0 ]] || { echo "Die Reparatur muss als root ausgeführt werden." >&2; exit 1; }
DATA_UID="$(stat -c '%u' "$DATA_DIR")"
DATA_GID="$(stat -c '%g' "$DATA_DIR")"
PATHS=(
"$DATA_DIR/bratonien-tools/nc-webdav-gallery"
"$DATA_DIR/bratonien-tools/nc-webdav-preview"
"$DATA_DIR/i/_data/bratonien-tools/nc-webdav-gallery"
"$DATA_DIR/i/bratonien-watermark"
)
found=0
for path in "${PATHS[@]}"; do
[[ -e "$path" ]] || continue
found=1
echo "Repariere: $path"
chown -R "$DATA_UID:$DATA_GID" -- "$path"
find "$path" -type d -exec chmod 2775 {} +
find "$path" -type f -exec chmod 0664 {} +
done
if [[ "$found" -eq 0 ]]; then
echo "Keine Bratonien-Cache-Verzeichnisse gefunden."
exit 0
fi
echo "Bratonien-Cache-Rechte wurden an $DATA_DIR angeglichen (UID $DATA_UID, GID $DATA_GID)."

View File

@@ -61,6 +61,7 @@ function bratonien_tools_save_album_rule()
))); )));
} }
bratonien_tools_clear_watermark_cache();
return array('message'=>'Albumregel gespeichert.'); return array('message'=>'Albumregel gespeichert.');
} }
@@ -97,9 +98,6 @@ function bratonien_tools_resolve_album_rule($category_id, array $categories, arr
$root = $by_id[$category_id] ?? null; $root = $by_id[$category_id] ?? null;
$is_private = $root && isset($root['status']) && $root['status'] === 'private'; $is_private = $root && isset($root['status']) && $root['status'] === 'private';
// Privat ist eine Vererbungsgrenze. Eine direkt auf diesem privaten Album
// gesetzte Regel bleibt moeglich, aber Regeln oeffentlicher Eltern duerfen
// nicht in ein privates Album hineinvererbt werden.
if ($is_private) if ($is_private)
{ {
if (isset($rules[$category_id])) if (isset($rules[$category_id]))

View File

@@ -128,6 +128,7 @@ function bratonien_tools_save_watermark_profile()
mass_inserts($table, array_keys($data), array($data)); mass_inserts($table, array_keys($data), array($data));
} }
bratonien_tools_clear_watermark_cache();
return array('message'=>'Wasserzeichenprofil gespeichert.'); return array('message'=>'Wasserzeichenprofil gespeichert.');
} }
@@ -158,6 +159,7 @@ function bratonien_tools_delete_watermark_profile()
} }
pwg_query('DELETE FROM '.bratonien_tools_table('watermark_profiles').' WHERE id='.$id); pwg_query('DELETE FROM '.bratonien_tools_table('watermark_profiles').' WHERE id='.$id);
bratonien_tools_clear_watermark_cache();
return array('message'=>'Wasserzeichenprofil geloescht.'); return array('message'=>'Wasserzeichenprofil geloescht.');
} }
@@ -174,6 +176,7 @@ function bratonien_tools_duplicate_watermark_profile()
$profile['name'] .= ' (Kopie)'; $profile['name'] .= ' (Kopie)';
$profile['created'] = date('Y-m-d H:i:s'); $profile['created'] = date('Y-m-d H:i:s');
mass_inserts(bratonien_tools_table('watermark_profiles'), array_keys($profile), array($profile)); mass_inserts(bratonien_tools_table('watermark_profiles'), array_keys($profile), array($profile));
bratonien_tools_clear_watermark_cache();
return array('message'=>'Wasserzeichenprofil dupliziert.'); return array('message'=>'Wasserzeichenprofil dupliziert.');
} }

View File

@@ -4,6 +4,59 @@ if (!defined('PHPWG_ROOT_PATH'))
die('Hacking attempt!'); die('Hacking attempt!');
} }
function bratonien_tools_watermark_cache_dir()
{
return PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR.'bratonien-watermark';
}
function bratonien_tools_remove_tree($path)
{
$path = rtrim((string)$path, DIRECTORY_SEPARATOR);
if ($path === '' || !file_exists($path)) return;
if (is_file($path) || is_link($path))
{
@unlink($path);
return;
}
foreach (scandir($path) ?: array() as $entry)
{
if ($entry === '.' || $entry === '..') continue;
bratonien_tools_remove_tree($path.DIRECTORY_SEPARATOR.$entry);
}
@rmdir($path);
}
function bratonien_tools_clear_watermark_cache()
{
$dir = bratonien_tools_watermark_cache_dir();
$derivative_root = realpath(PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR);
$parent = realpath(dirname($dir));
if ($derivative_root === false || $parent === false || $parent !== $derivative_root)
{
throw new RuntimeException('Wasserzeichen-Cachepfad ist ungueltig.');
}
if (is_dir($dir))
{
bratonien_tools_remove_tree($dir);
}
}
function bratonien_tools_watermark_cache_upgrade()
{
$version = '0.9.7.13';
if ((string)conf_get_param('bratonien_watermark_cache_version', '') === $version)
{
return;
}
bratonien_tools_clear_watermark_cache();
conf_update_param('bratonien_watermark_cache_version', $version);
}
function bratonien_tools_get_watermark_defaults() function bratonien_tools_get_watermark_defaults()
{ {
$defaults = conf_get_param('bratonien_watermark_defaults', null); $defaults = conf_get_param('bratonien_watermark_defaults', null);
@@ -40,6 +93,7 @@ function bratonien_tools_save_watermark_defaults()
); );
conf_update_param('bratonien_watermark_defaults', json_encode($config)); conf_update_param('bratonien_watermark_defaults', json_encode($config));
bratonien_tools_clear_watermark_cache();
return array('message'=>'Globale Wasserzeichenregeln gespeichert.'); return array('message'=>'Globale Wasserzeichenregeln gespeichert.');
} }

View File

@@ -20,6 +20,20 @@ function bratonien_tools_webdav_derivative_abort($status, $message)
exit; exit;
} }
function bratonien_tools_webdav_derivative_ajax_response($url)
{
http_response_code(200);
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store, max-age=0');
echo json_encode(array('url'=>(string)$url), JSON_UNESCAPED_SLASHES);
exit;
}
function bratonien_tools_webdav_derivative_binary_url($image_id, $type)
{
return get_root_url().'plugins/'.BRATONIEN_TOOLS_ID.'/webdav-derivative.php?id='.(int)$image_id.'&type='.rawurlencode((string)$type);
}
function bratonien_tools_webdav_derivative_fallback($image_id) function bratonien_tools_webdav_derivative_fallback($image_id)
{ {
$url = bratonien_tools_webdav_image_url((int)$image_id, false); $url = bratonien_tools_webdav_image_url((int)$image_id, false);
@@ -28,6 +42,11 @@ function bratonien_tools_webdav_derivative_fallback($image_id)
bratonien_tools_webdav_derivative_abort(404, 'WebDAV-Bildquelle ist nicht verfuegbar.'); bratonien_tools_webdav_derivative_abort(404, 'WebDAV-Bildquelle ist nicht verfuegbar.');
} }
if (isset($_GET['ajaxload']) && (string)$_GET['ajaxload'] === 'true')
{
bratonien_tools_webdav_derivative_ajax_response($url);
}
header('Cache-Control: no-store'); header('Cache-Control: no-store');
header('Location: '.$url, true, 302); header('Location: '.$url, true, 302);
exit; exit;
@@ -74,17 +93,12 @@ if (!$info)
$preview = bratonien_tools_webdav_preview_path($info); $preview = bratonien_tools_webdav_preview_path($info);
if (!$preview || !is_file($preview) || !is_readable($preview)) if (!$preview || !is_file($preview) || !is_readable($preview))
{ {
// Altbestand kann noch keinen vorbereiteten Preview-Cache besitzen. Der
// fokussierte Fotorama-Request darf dann nicht mit 404 enden, weil Fotorama
// den fehlgeschlagenen Frame sonst nicht erneut laedt. Stattdessen wird nur
// fuer dieses angeforderte Bild auf die echte WebDAV-Quelle ausgewichen.
bratonien_tools_webdav_derivative_fallback($image_id); bratonien_tools_webdav_derivative_fallback($image_id);
} }
$derivative = new DerivativeImage($params, $src); $derivative = new DerivativeImage($params, $src);
if ($derivative->same_as_source()) if ($derivative->same_as_source())
{ {
// Niemals die lokale Connector-Platzhalterquelle ausliefern.
bratonien_tools_webdav_derivative_fallback($image_id); bratonien_tools_webdav_derivative_fallback($image_id);
} }
@@ -115,6 +129,17 @@ if (!bratonien_tools_webdav_derivative_matches_preview($target, $params, $image_
bratonien_tools_webdav_derivative_fallback($image_id); bratonien_tools_webdav_derivative_fallback($image_id);
} }
// Piwigos thumbnails.loader.js fordert nicht gecachte Derivate mit
// ?ajaxload=true an und erwartet JSON {"url":"..."}. Erst diese URL wird
// danach als echtes Bild geladen. Binärdaten an dieser Stelle führen direkt
// zum Piwigo-Fehlersymbol.
if (isset($_GET['ajaxload']) && (string)$_GET['ajaxload'] === 'true')
{
bratonien_tools_webdav_derivative_ajax_response(
bratonien_tools_webdav_derivative_binary_url($image_id, $type)
);
}
$size = @filesize($target); $size = @filesize($target);
$mtime = @filemtime($target) ?: time(); $mtime = @filemtime($target) ?: time();
$etag = sha1($target.'|'.$mtime.'|'.($size ?: 0)); $etag = sha1($target.'|'.$mtime.'|'.($size ?: 0));

View File

@@ -19,6 +19,18 @@ function bratonien_tools_webdav_image_abort($status, $message)
exit; exit;
} }
function bratonien_tools_webdav_image_ajax_response($image_id, $preview)
{
$url = get_root_url().'plugins/'.BRATONIEN_TOOLS_ID.'/webdav-image.php?id='.(int)$image_id;
if ($preview) $url .= '&preview=1';
http_response_code(200);
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store, max-age=0');
echo json_encode(array('url'=>$url), JSON_UNESCAPED_SLASHES);
exit;
}
function bratonien_tools_webdav_image_decrypt_secret($blob, $hex_key) function bratonien_tools_webdav_image_decrypt_secret($blob, $hex_key)
{ {
$hex_key = trim((string)$hex_key); $hex_key = trim((string)$hex_key);
@@ -52,7 +64,17 @@ if (!pwg_db_num_rows($access_result)) bratonien_tools_webdav_image_abort(403, 'K
$source = bratonien_tools_webdav_image_source_info($image_id); $source = bratonien_tools_webdav_image_source_info($image_id);
if (!$source) bratonien_tools_webdav_image_abort(404, 'Keine WebDAV-Quelle für dieses Bild gefunden.'); if (!$source) bratonien_tools_webdav_image_abort(404, 'Keine WebDAV-Quelle für dieses Bild gefunden.');
if (!empty($_GET['preview'])) $preview_requested = !empty($_GET['preview']);
// Piwigos Standard-Lader erwartet bei ?ajaxload=true JSON und lädt erst die
// darin enthaltene URL als Bild. Binärdaten in diesem Request werden als
// Ladefehler behandelt und durch errors_small.png ersetzt.
if (isset($_GET['ajaxload']) && (string)$_GET['ajaxload'] === 'true')
{
bratonien_tools_webdav_image_ajax_response($image_id, $preview_requested);
}
if ($preview_requested)
{ {
$preview = bratonien_tools_webdav_preview_path($source); $preview = bratonien_tools_webdav_preview_path($source);
if ($preview) if ($preview)
@@ -121,7 +143,7 @@ $options = array(
CURLOPT_USERPWD => $user.':'.$password, CURLOPT_USERPWD => $user.':'.$password,
CURLOPT_RETURNTRANSFER => false, CURLOPT_RETURNTRANSFER => false,
CURLOPT_FAILONERROR => false, CURLOPT_FAILONERROR => false,
CURLOPT_USERAGENT => 'Bratonien-Tools-WebDAV-Image/0.9.7.1', CURLOPT_USERAGENT => 'Bratonien-Tools-WebDAV-Image/0.9.7.15',
CURLOPT_HEADERFUNCTION => function($ch, $line) CURLOPT_HEADERFUNCTION => function($ch, $line)
{ {
$length = strlen($line); $length = strlen($line);