X-Git-Url: https://git.cweiske.de/shpub.git/blobdiff_plain/af315313a912ec99a2539bc79df68f502fdd8000..f60fce4bd4a0cba54b686f64bc5a83eb580356f4:/src/shpub/Config.php diff --git a/src/shpub/Config.php b/src/shpub/Config.php index 352ab99..2ca7d9a 100644 --- a/src/shpub/Config.php +++ b/src/shpub/Config.php @@ -12,6 +12,8 @@ class Config */ public $host; + public $debug = false; + protected function getConfigFilePath() { if (!isset($_SERVER['HOME'])) { @@ -65,7 +67,8 @@ class Config if ($hostVal == '') { continue; } - $str .= $hostProp . '=' . $hostVal . "\n"; + $str .= $hostProp + . '=' . static::quoteIniValue($hostVal) . "\n"; } } $cfgFilePath = $this->getConfigFilePath(); @@ -85,7 +88,7 @@ class Config } foreach ($this->hosts as $key => $host) { if ($host->default) { - return $host; + return $key; } } @@ -105,5 +108,18 @@ class Config } return null; } + + public static function quoteIniValue($val) + { + if (strpos($val, '=') === false) { + return $val; + } + return '"' . $val . '"'; + } + + public function setDebug($debug) + { + $this->debug = $debug; + } } ?>