mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
escape qrencode arguments in multibyte-safe way
This commit is contained in:
@@ -332,3 +332,17 @@ function cache($key, $callback)
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
// insspired by
|
||||
// http://markushedlund.com/dev/php-escapeshellarg-with-unicodeutf-8-support
|
||||
function mb_escapeshellarg($arg)
|
||||
{
|
||||
$isWindows = strtolower(substr(PHP_OS, 0, 3)) === 'win';
|
||||
if ($isWindows) {
|
||||
$escaped_arg = str_replace(array('"', '%'), '', $arg);
|
||||
} else {
|
||||
$escaped_arg = str_replace("'", "'\\''", $arg);
|
||||
}
|
||||
return "\"$escaped_arg\"";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user