mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-25 00:50:29 +00:00
use special multibyte shell escaping to support unicode ssid names with qr code
This commit is contained in:
parent
3969db61b0
commit
45a50edc41
2 changed files with 13 additions and 1 deletions
|
@ -42,7 +42,7 @@ $ssid = qr_encode($ssid);
|
|||
$password = qr_encode($password);
|
||||
|
||||
$data = "WIFI:S:$ssid;T:$type;P:$password;$hidden;";
|
||||
$command = "qrencode -t svg -m 0 -o - " . escapeshellarg($data);
|
||||
$command = "qrencode -t svg -m 0 -o - " . mb_escapeshellarg($data);
|
||||
$svg = shell_exec($command);
|
||||
|
||||
$config_mtime = filemtime(RASPI_HOSTAPD_CONFIG);
|
||||
|
|
|
@ -518,6 +518,18 @@ function cache($key, $callback)
|
|||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
return '"' . str_replace(array('"', '%'), '', $arg) . '"';
|
||||
} else {
|
||||
return "'" . str_replace("'", "'\\''", $arg) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
function dnsServers()
|
||||
{
|
||||
$data = json_decode(file_get_contents("./config/dns-servers.json"));
|
||||
|
|
Loading…
Reference in a new issue