mirror of
https://github.com/Terranom674/Piwigo_Bratonien_Tools.git
synced 2026-09-19 12:54:31 +00:00
Resolve watermark endpoint from active plugin directory
This commit is contained in:
@@ -20,12 +20,14 @@ if ($query === '')
|
||||
}
|
||||
|
||||
$piwigo_root = realpath(dirname(__DIR__, 4));
|
||||
if ($piwigo_root === false)
|
||||
$plugin_root = realpath(dirname(__DIR__, 2));
|
||||
if ($piwigo_root === false || $plugin_root === false || !is_file($plugin_root.'/watermark.php'))
|
||||
{
|
||||
fwrite(STDERR, "Piwigo-Root wurde nicht gefunden.\n");
|
||||
fwrite(STDERR, "Piwigo-Root oder Bratonien-Wasserzeichenmodul wurde nicht gefunden.\n");
|
||||
exit(3);
|
||||
}
|
||||
|
||||
$plugin_id = basename($plugin_root);
|
||||
parse_str($query, $_GET);
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['SERVER_ADDR'] = '127.0.0.1';
|
||||
@@ -33,12 +35,12 @@ $_SERVER['SERVER_NAME'] = 'localhost';
|
||||
$_SERVER['HTTP_HOST'] = 'localhost';
|
||||
$_SERVER['SERVER_PORT'] = '80';
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_SERVER['REQUEST_URI'] = '/plugins/bratonien_tools/watermark.php?'.$query;
|
||||
$_SERVER['SCRIPT_NAME'] = '/plugins/bratonien_tools/watermark.php';
|
||||
$_SERVER['REQUEST_URI'] = '/plugins/'.$plugin_id.'/watermark.php?'.$query;
|
||||
$_SERVER['SCRIPT_NAME'] = '/plugins/'.$plugin_id.'/watermark.php';
|
||||
$_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'];
|
||||
$_SERVER['QUERY_STRING'] = $query;
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Bratonien-Presentation-Refresh/0.9.7.1.41';
|
||||
$_SERVER['HTTPS'] = 'off';
|
||||
|
||||
chdir($piwigo_root);
|
||||
include $piwigo_root.'/plugins/bratonien_tools/watermark.php';
|
||||
include $plugin_root.'/watermark.php';
|
||||
|
||||
Reference in New Issue
Block a user