|
|
@ -976,6 +976,16 @@ class rcube_utils
|
|
|
|
public static function get_opt($aliases = array())
|
|
|
|
public static function get_opt($aliases = array())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$args = array();
|
|
|
|
$args = array();
|
|
|
|
|
|
|
|
$bool = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// find boolean (no value) options
|
|
|
|
|
|
|
|
foreach ($aliases as $key => $alias) {
|
|
|
|
|
|
|
|
if ($pos = strpos($alias, ':')) {
|
|
|
|
|
|
|
|
$aliases[$key] = substr($alias, 0, $pos);
|
|
|
|
|
|
|
|
$bool[] = $key;
|
|
|
|
|
|
|
|
$bool[] = $aliases[$key];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for ($i=1; $i < count($_SERVER['argv']); $i++) {
|
|
|
|
for ($i=1; $i < count($_SERVER['argv']); $i++) {
|
|
|
|
$arg = $_SERVER['argv'][$i];
|
|
|
|
$arg = $_SERVER['argv'][$i];
|
|
|
@ -985,10 +995,14 @@ class rcube_utils
|
|
|
|
if ($arg[0] == '-') {
|
|
|
|
if ($arg[0] == '-') {
|
|
|
|
$key = preg_replace('/^-+/', '', $arg);
|
|
|
|
$key = preg_replace('/^-+/', '', $arg);
|
|
|
|
$sp = strpos($arg, '=');
|
|
|
|
$sp = strpos($arg, '=');
|
|
|
|
|
|
|
|
|
|
|
|
if ($sp > 0) {
|
|
|
|
if ($sp > 0) {
|
|
|
|
$key = substr($key, 0, $sp - 2);
|
|
|
|
$key = substr($key, 0, $sp - 2);
|
|
|
|
$value = substr($arg, $sp+1);
|
|
|
|
$value = substr($arg, $sp+1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (in_array($key, $bool)) {
|
|
|
|
|
|
|
|
$value = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') {
|
|
|
|
else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') {
|
|
|
|
$value = $_SERVER['argv'][++$i];
|
|
|
|
$value = $_SERVER['argv'][++$i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|