Thomas Bruederli
2014-12-29 bca7dc68e9f73e863e3a65173a8883c99dc09e3a
Fix syntax error and codestyle from recent PR merge
1 files modified
40 ■■■■■ changed files
program/lib/Roundcube/rcube_config.php 40 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_config.php
@@ -102,22 +102,25 @@
     *
     * @return The guess at the type.
     */
    private function guess_type($value) {
    private function guess_type($value)
    {
        $_ = 'string';
        // array requires hint to be passed.
        if (preg_match('/^[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?$/', $value) !== False) {
        if (preg_match('/^[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?$/', $value) !== false) {
            $_ = 'double';
        } else if (preg_match('/^\d+$/', $value) !== False) {
        }
        else if (preg_match('/^\d+$/', $value) !== false) {
            $_ = 'integer';
        } else if (preg_match('/(t(rue)?)|(f(alse)?)/i', $value) !== False) {
        }
        else if (preg_match('/(t(rue)?)|(f(alse)?)/i', $value) !== false) {
            $_ = 'boolean';
        }
        return $_;
    }
    /**
     * @brief Parse environment variable into PHP type.
@@ -129,11 +132,10 @@
     *
     * @return Appropriately typed interpretation of $string.
     */
    private function parse_env($string, $type) {
        console("parse $string into $type");
    private function parse_env($string, $type)
    {
        $_ = $string;
        switch ($type) {
        case 'boolean':
            $_ = (boolean) $_;
@@ -160,7 +162,7 @@
    
        return $_;
    }
    /**
     * @brief Get environment variable value.
@@ -174,12 +176,14 @@
     *
     * @return Value of the environment variable or default if not found.
     */
    private function getenv_default($varname, $default_value, $type = null) {
    private function getenv_default($varname, $default_value, $type = null)
    {
        $_ = getenv($varname);
    
        if ($_ === False) {
        if ($_ === false) {
            $_ = $default_value;
        } else {
        }
        else {
            if (is_null($type)) {
                $type = gettype($default_value);
            }
@@ -377,6 +381,8 @@
            $result = $def;
        }
        $result = $this->getenv_default('ROUNDCUBE_' . strtoupper($name), $result);
        $rcube = rcube::get_instance();
        if ($name == 'timezone') {
@@ -390,8 +396,6 @@
            if ($result && is_string($result))
                $result = explode(',', $result);
        }
        $result = $this->getenv_default('ROUNDCUBE_' . strtoupper($name), $result)
        $plugin = $rcube->plugins->exec_hook('config_get', array(
            'name' => $name, 'default' => $def, 'result' => $result));