예제 #1
0
        /// <summary>
        /// Gets or sets a value of a legacy configuration option.
        /// </summary>
        static PhpValue GetSet(IPhpConfigurationService config, string option, PhpValue value, IniAction action)
        {
            var local = config.Get <MsSqlConfiguration>();

            switch (option)
            {
            // local:

            case "mssql.connect_timeout":
                return((PhpValue)StandardPhpOptions.GetSet(ref local.ConnectTimeout, 5, value, action));

            case "mssql.timeout":
                return((PhpValue)StandardPhpOptions.GetSet(ref local.Timeout, 60, value, action));

            case "mssql.batchsize":
                return((PhpValue)StandardPhpOptions.GetSet(ref local.BatchSize, 0, value, action));

            // global:

            case "mssql.max_links":
                Debug.Assert(action == IniAction.Get);
                return((PhpValue)StandardPhpOptions.GetSet(ref local.MaxConnections, 0, PhpValue.Null, action));

            case "mssql.secure_connection":
                Debug.Assert(action == IniAction.Get);
                return((PhpValue)StandardPhpOptions.GetSet(ref local.NTAuthentication, false, PhpValue.Null, action));
            }

            Debug.Fail("Option '" + option + "' is supported but not implemented.");
            return(PhpValue.Null);
        }
예제 #2
0
            /// <summary>
            /// Gets or sets a value of a legacy configuration option.
            /// </summary>
            private static PhpValue GetSet(Context ctx, IPhpConfigurationService config, string option, PhpValue value, IniAction action)
            {
                var local = config.Get <MbConfig>();

                if (local == null)
                {
                    return(PhpValue.Null);
                }

                switch (option)
                {
                //mbstring.language   "neutral"   PHP_INI_ALL Available since PHP 4.3.0.PHP_INI_PERDIR in PHP <= 5.2.6
                //mbstring.detect_order NULL    PHP_INI_ALL Available since PHP 4.0.6.
                //mbstring.http_input "pass"  PHP_INI_ALL Available since PHP 4.0.6.Deprecated in PHP 5.6.0.
                //mbstring.http_output    "pass"  PHP_INI_ALL Available since PHP 4.0.6.Deprecated in PHP 5.6.0.
                //mbstring.script_encoding    NULL PHP_INI_ALL Available since PHP 4.3.0.Removed in PHP 5.4.0.Use zend.script_encoding instead.
                //mbstring.substitute_character NULL    PHP_INI_ALL Available since PHP 4.0.6.

                case "mbstring.func_overload":
                    // "0" PHP_INI_SYSTEM PHP_INI_PERDIR from PHP 4.3 to 5.2.6, otherwise PHP_INI_SYSTEM. Available since PHP 4.2.0.Deprecated in PHP 7.2.0.
                    return((PhpValue)0);

                //mbstring.encoding_translation   "0" PHP_INI_PERDIR Available since PHP 4.3.0.
                //mbstring.strict_detection   "0" PHP_INI_ALL Available since PHP 5.1.2.
                //mbstring.internal_encoding  NULL PHP_INI_ALL Available since PHP 4.0.6.Deprecated in PHP 5.6.0.

                default:
                    break;
                }

                Debug.Fail("Option '" + option + "' is not currently supported.");
                return(PhpValue.Null);
            }
예제 #3
0
        /// <summary>
        /// Gets, sets, or restores a value of a legacy configuration option.
        /// </summary>
        static PhpValue GetSet(Context ctx, IPhpConfigurationService config, string option, PhpValue value, IniAction action)
        {
            var local = config.Get <MySqlConfiguration>();

            switch (option)
            {
            // local:

            case "mysql.connect_timeout": return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.ConnectTimeout, 0, value, action));

            case "mysql.default_port": return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.Port, 3306, value, action));

            case "mysql.default_host": return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.Server, null, value, action));

            case "mysql.default_user": return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.User, "root", value, action));

            case "mysql.default_password": return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.Password, "", value, action));

            case "mysql.default_command_timeout": return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.DefaultCommandTimeout, -1, value, action));

            case "mysql.connection_string": return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.ConnectionString, null, value, action));

            // global:

            case "mysql.max_links":
                Debug.Assert(action == IniAction.Get);
                return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.MaxConnections, -1, value, action));

            case "mysql.max_pool_size":
                return((PhpValue)Pchp.Library.StandardPhpOptions.GetSet(ref local.MaxPoolSize, 100, value, action));
            }

            Debug.Fail("Option '" + option + "' is supported but not implemented.");
            return(PhpValue.Null);
        }
예제 #4
0
            /// <summary>
            /// Gets or sets a value of a legacy configuration option.
            /// </summary>
            private static PhpValue GetSet(Context ctx, IPhpConfigurationService config, string option, PhpValue value, IniAction action)
            {
                var local = config.Get <Config>();

                if (local == null)
                {
                    return(PhpValue.False);
                }

                return(option switch
                {
                    "highlight.comment" => StandardPhpOptions.GetSet(ref local.comment, null, value, action),
                    "highlight.default" => StandardPhpOptions.GetSet(ref local.@default, null, value, action),
                    "highlight.keyword" => StandardPhpOptions.GetSet(ref local.keyword, null, value, action),
                    "highlight.string" => StandardPhpOptions.GetSet(ref local.@string, null, value, action),
                    "highlight.html" => StandardPhpOptions.GetSet(ref local.html, null, value, action),

                    _ => throw new ArgumentOutOfRangeException(nameof(option)),
                });
예제 #5
0
파일: iconv.cs 프로젝트: kendallb/peachpie
            /// <summary>
            /// Gets or sets a value of a legacy configuration option.
            /// </summary>
            private static PhpValue GetSet(Context ctx, IPhpConfigurationService config, string option, PhpValue value, IniAction action)
            {
                var local = config.Get <IconvConfig>();

                if (local == null)
                {
                    return(PhpValue.False);
                }

                switch (option)
                {
                case "iconv.input_encoding":
                    return(StandardPhpOptions.GetSet(ref local.InputEncoding, "ISO-8859-1", value, action));

                case "iconv.internal_encoding":
                    return(StandardPhpOptions.GetSet(ref local.InternalEncoding, "ISO-8859-1", value, action));

                case "iconv.output_encoding":
                    return(StandardPhpOptions.GetSet(ref local.OutputEncoding, "ISO-8859-1", value, action));
                }

                return(PhpValue.False);
            }
예제 #6
0
            /// <summary>
            /// Gets or sets a value of a legacy configuration option.
            /// </summary>
            private static PhpValue GetSet(Context ctx, IPhpConfigurationService config, string option, PhpValue value, IniAction action)
            {
                var local = config.Get <IconvConfig>();

                if (local == null)
                {
                    return(PhpValue.Null);
                }

                switch (option)
                {
                case "iconv.input_encoding":
                    return((PhpValue)StandardPhpOptions.GetSet(ref local.InputEncoding, "ISO-8859-1", value, action));

                case "iconv.internal_encoding":
                    return((PhpValue)StandardPhpOptions.GetSet(ref local.InternalEncoding, "ISO-8859-1", value, action));

                case "iconv.output_encoding":
                    return((PhpValue)StandardPhpOptions.GetSet(ref local.OutputEncoding, "ISO-8859-1", value, action));
                }

                Debug.Fail("Option '" + option + "' is not currently supported.");
                return(PhpValue.Null);
            }
예제 #7
0
파일: BCMath.cs 프로젝트: adaniy/peachpie
        static PhpValue GetSetOption(Context ctx, IPhpConfigurationService config, string option, PhpValue value, IniAction action)
        {
            var local = config.Get <BCMathConfig>();

            if (local == null)
            {
                return(PhpValue.Null);
            }

            if (string.Equals(option, BCMathOptions.Scale))
            {
                var oldvalue = local.Scale;
                if (action == IniAction.Set)
                {
                    local.Scale = Math.Max(0, (int)value);
                }
                return(oldvalue);
            }
            else
            {
                Debug.Fail("Option '" + option + "' is not currently supported.");
                return(PhpValue.Null);
            }
        }
예제 #8
0
 static PhpValue GsrSession(Context ctx, IPhpConfigurationService config, string option, PhpValue value, IniAction action)
 {
     return(config.Get <SessionConfiguration>().Gsr(ctx, config, option, value, action));
 }
예제 #9
0
 static SessionConfiguration GetSessionConfiguration(this IPhpConfigurationService config)
 {
     return((SessionConfiguration)config.Get <IPhpSessionConfiguration>());
 }
예제 #10
0
 TOptions IPhpConfigurationService.Get <TOptions>() => _globalconfiguration.Get <TOptions>();