Пример #1
0
        public object __construct(ScriptContext /*!*/ context, object timezone_name)
        {
            if (timezone_name != null)
            {
                var zoneName = PHP.Core.Convert.ObjectToString(timezone_name);
                this.timezone = PhpTimeZone.GetTimeZone(zoneName);

                if (this.timezone == null)
                {
                    PhpException.Throw(PhpError.Notice, LibResources.GetString("unknown_timezone", zoneName));
                }
            }
            else
            {
                this.timezone = PhpTimeZone.CurrentTimeZone;
            }

            return(null);
        }
Пример #2
0
            public bool Parse(string name, string value, XmlNode node)
            {
                switch (name)
                {
                case "Latitude":
                    Latitude = ConfigUtils.ParseDouble(value, node);
                    break;

                case "Longitude":
                    Longitude = ConfigUtils.ParseDouble(value, node);
                    break;

                case "SunsetZenith":
                    SunsetZenith = ConfigUtils.ParseDouble(value, node);
                    break;

                case "SunriseZenith":
                    SunriseZenith = ConfigUtils.ParseDouble(value, node);
                    break;

                case "TimeZone":
                    if (!string.IsNullOrEmpty(value))
                    {
                        TimeZone = PhpTimeZone.GetTimeZone(value);
                        if (TimeZone == null)
                        {
                            throw new ConfigurationErrorsException(LibResources.GetString("unknown_timezone", value) + ".", node);
                        }
                    }
                    break;

                default:
                    return(false);
                }
                return(true);
            }
Пример #3
0
        /// <summary>
        /// Gets, sets, or restores a value of a legacy configuration option.
        /// </summary>
        private static object GetSetRestore(LocalConfiguration config, string option, object value, IniAction action)
        {
            LibraryConfiguration local    = (LibraryConfiguration)config.GetLibraryConfig(LibraryDescriptor.Singleton);
            LibraryConfiguration @default = DefaultLocal;

            switch (option)
            {
            case "sendmail_from": return(PhpIni.GSR(ref local.Mailer.DefaultFromHeader, @default.Mailer.DefaultFromHeader, value, action));

            case "SMTP": return(PhpIni.GSR(ref local.Mailer.SmtpServer, @default.Mailer.SmtpServer, value, action));

            case "smtp_port": return(PhpIni.GSR(ref local.Mailer.SmtpPort, @default.Mailer.SmtpPort, value, action));

            case "mail.add_x_header": return(PhpIni.GSR(ref local.Mailer.AddXHeader, @default.Mailer.AddXHeader, value, action));

            case "highlight.bg": return(PhpIni.GSR(ref local.Highlighting.Background, @default.Highlighting.Background, value, action));

            case "highlight.comment": return(PhpIni.GSR(ref local.Highlighting.Comment, @default.Highlighting.Comment, value, action));

            case "highlight.default": return(PhpIni.GSR(ref local.Highlighting.Default, @default.Highlighting.Default, value, action));

            case "highlight.html": return(PhpIni.GSR(ref local.Highlighting.Html, @default.Highlighting.Html, value, action));

            case "highlight.keyword": return(PhpIni.GSR(ref local.Highlighting.Keyword, @default.Highlighting.Keyword, value, action));

            case "highlight.string": return(PhpIni.GSR(ref local.Highlighting.String, @default.Highlighting.String, value, action));

            case "session.serialize_handler": return(PhpSession.GsrSerializer(local, @default, value, action));

            case "session.cache_expire": return(PhpSession.GsrCacheExpire(value, action));

            case "session.cache_limiter": return(PhpSession.GsrCacheLimiter(value, action));

            case "session.save_path": return(PhpIni.GSR(ref local.Session.SavePath, @default.Session.SavePath, value, action));

            case "session.gc_maxlifetime": return(PhpIni.GSR(ref local.Session.GcMaxLifetime, @default.Session.GcMaxLifetime, value, action));

            case "session.gc_probability": return(PhpIni.GSR(ref local.Session.GcProbability, @default.Session.GcProbability, value, action));

            case "session.gc_divisor": return(PhpIni.GSR(ref local.Session.GcDivisor, @default.Session.GcDivisor, value, action));

            case "session.cookie_lifetime": return(PhpSession.GsrCookieLifetime(value, action));

            case "session.cookie_path": return(PhpSession.GsrCookiePath(value, action));

            case "session.cookie_domain": return(PhpSession.GsrCookieDomain(value, action));

            case "session.cookie_secure": return(PhpSession.GsrCookieSecure(value, action));

            case "date.default_latitude": return(PhpIni.GSR(ref local.Date.Latitude, @default.Date.Latitude, value, action));

            case "date.default_longitude": return(PhpIni.GSR(ref local.Date.Longitude, @default.Date.Longitude, value, action));

            case "date.sunrise_zenith": return(PhpIni.GSR(ref local.Date.SunriseZenith, @default.Date.SunriseZenith, value, action));

            case "date.sunset_zenith": return(PhpIni.GSR(ref local.Date.SunsetZenith, @default.Date.SunsetZenith, value, action));

            case "date.timezone": return(PhpTimeZone.GsrTimeZone(local, @default, value, action));
            }

            Debug.Fail("Option '" + option + "' is supported but not implemented.");
            return(null);
        }