From 04fc4e08cbc5c651130a283fd532d70c646c2e75 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 19 Nov 2005 00:11:11 +0000 Subject: --- framework/Exceptions/TErrorHandler.php | 4 +- framework/Exceptions/TException.php | 8 ++-- framework/Exceptions/messages.en | 76 ---------------------------------- framework/Exceptions/messages.txt | 76 ++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 81 deletions(-) delete mode 100644 framework/Exceptions/messages.en create mode 100644 framework/Exceptions/messages.txt (limited to 'framework/Exceptions') diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index fe756e32..efcbe831 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -94,7 +94,7 @@ class TErrorHandler extends TComponent implements IModule $base=$this->_templatePath.'/'.self::ERROR_FILE_NAME; $lang=array_shift(explode('-',array_shift(Prado::getUserLanguages()))); if(!empty($lang) && !ctype_alpha($lang)) - die('No hack attempt please.'); + $lang=''; if(is_file("$base$statusCode-$lang.tpl")) $errorFile="$base$statusCode-$lang.tpl"; else if(is_file("$base$statusCode.tpl")) @@ -177,7 +177,7 @@ class TErrorHandler extends TComponent implements IModule ); $lang=array_shift(explode('-',array_shift(Prado::getUserLanguages()))); if(!empty($lang) && !ctype_alpha($lang)) - die('No hack attempt please.'); + $lang=''; $exceptionFile=dirname(__FILE__).'/'.self::EXCEPTION_FILE_NAME.'-'.$lang.'.tpl'; if(!is_file($exceptionFile)) $exceptionFile=dirname(__FILE__).'/'.self::EXCEPTION_FILE_NAME.'.tpl'; diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php index a90c14dd..d920f373 100644 --- a/framework/Exceptions/TException.php +++ b/framework/Exceptions/TException.php @@ -51,10 +51,12 @@ class TException extends Exception protected function translateErrorMessage($key) { - $languages=Prado::getUserLanguages(); - $msgFile=dirname(__FILE__).'/messages.'.$languages[0]; + $lang=array_shift(explode('-',array_shift(Prado::getUserLanguages()))); + if(!empty($lang) && !ctype_alpha($lang)) + $lang=''; + $msgFile=dirname(__FILE__).'/messages-'.$lang.'.txt'; if(!is_file($msgFile)) - $msgFile=dirname(__FILE__).'/messages.en'; + $msgFile=dirname(__FILE__).'/messages.txt'; if(($entries=@file($msgFile))===false) return $key; else diff --git a/framework/Exceptions/messages.en b/framework/Exceptions/messages.en deleted file mode 100644 index 688901c2..00000000 --- a/framework/Exceptions/messages.en +++ /dev/null @@ -1,76 +0,0 @@ -component_property_undefined = Component property '%s.%s' is not defined. -component_property_readonly = Component property '%s.%s' is read-only. -component_event_undefined = Component event '%s.%s' is not defined. -component_eventhandler_invalid = Component event '%s.%s' is attached with an invalid event handler. -component_expression_invalid = Component '%s' is evaluating an invalid expression '%s' : %s. -component_statements_invalid = Component '%s' is evaluating invalid PHP statements '%s' : %s. - -propertyvalue_enumvalue_invalid = Value '%s' is a not valid enumeration value (%s). - -application_configfile_inexistent = Application configuration file '%s' does not exist. -application_module_existing = Application module '%s' cannot be registered twice. -application_service_invalid = Service '%s' must implement IService interface. -application_service_unknown = Requested service '%s' is not defined. - -appconfig_aliaspath_invalid = Application configuration uses an invalid file path "%s". -appconfig_aliasid_required = Application configuration element must have an "id" attribute. -appconfig_using_invalid = Application configuration element must have a "namespace" attribute. -appconfig_moduleid_required = Application configuration element must have an "id" attribute. -appconfig_moduletype_required = Application configuration must have a "type" attribute. -appconfig_serviceid_required = Application configuration element must have an "id" attribute. -appconfig_servicetype_required = Application configuration must have a "type" attribute. -appconfig_parameterid_required = Application configuration element must have an "id" attribute. - -uri_format_invalid = '%s' is not a valid URI. - -httpresponse_bufferoutput_unchangeable = THttpResponse.BufferOutput cannot be modified after THttpResponse is initialized. -httpresponse_file_inexistent = THttpResponse cannot send file '%s'. The file does not exist. - -httpsession_sessionid_unchangeable = THttpSession.SessionID cannot be modified after the session is started. -httpsession_sessionname_unchangeable = THttpSession.SessionName cannot be modified after the session is started. -httpsession_sessionname_invalid = THttpSession.SessionName must contain alphanumeric characters only. -httpsession_savepath_unchangeable = THttpSession.SavePath cannot be modified after the session is started. -httpsession_savepath_invalid = THttpSession.SavePath '%s' is invalid. -httpsession_storage_unchangeable = THttpSession.Storage cannot be modified after the session is started. -httpsession_cookiemode_unchangeable = THttpSession.CookieMode cannot be modified after the session is started. -httpsession_autostart_unchangeable = THttpSession.AutoStart cannot be modified after the session module is initialized. -httpsession_gcprobability_unchangeable = THttpSession.GCProbability cannot be modified after the session is started. -httpsession_gcprobability_invalid = THttpSession.GCProbability must be an integer between 0 and 100. -httpsession_transid_unchangeable = THttpSession.UseTransparentSessionID cannot be modified after the session is started. -httpsession_maxlifetime_unchangeable = THttpSession.Timeout cannot be modified after the session is started. - -assetmanager_basepath_invalid = TAssetManager.BasePath '%s' is invalid. Make sure the directory exists and is writable by the Web server process. -assetmanager_basepath_unchangeable = TAssetManager.BasePath cannot be modified after the module is initialized. -assetmanager_baseurl_unchangeable = TAssetManager.BaseUrl cannot be modified after the module is initialized. - -pageservice_page_unknown = Page not found: %s - - -body_contents_not_allowed = %s: body contents are not allowed. -control_id_not_unique = Control ID '%s' is not unique for control type '%s'. -control_not_found = Unable to find a control with ID '%s'. -control_not_in_form = Control '%s' is not enclosed within a server form. -data_not_iterable = Data is not iterable. An array or an object implementing Traversable is required. -event_not_defined = %s: event is not defined. -expecting_closing_tag = Line %d: expecting closing tag %s. -index_out_of_range = Index '%s' is out of range. -invalid_accesskey = %s.AccessKey: only one character is allowed. -invalid_control_id = Invalid control ID '%s' for control type '%s'. -invalid_enum_value = Invalid value '%s' for enumeration type (%s) -invalid_event_handler = Invalid event handler '%s' for event '%s'. -invalid_expression = Invalid expression '%s': %s. -invalid_statements = Invalid statements '%s': %s. -invalid_subproperty = Invalid sub-property '%s'. -invalid_style_value = %s.Style: only string is allowed. -multiple_form_not_allowed = Multiple server forms are not allowed. -must_be_component = %s must extend from TComponent. -no_comments_in_property = Line %d: comments are not allowed in property values. -property_not_defined = %s: property is not defined. -property_read_only = %s: property is read-only. -skinid_set_after_applied = %s: SkinID cannot be set after the skin is applied. -skinid_set_after_preinit = %s: SkinID cannot be set after PreInit stage. -stylesheet_applied = %s: StyleSheet skin is already applied. -enabletheming_after_preinit = %s: EnableTheme cannot be set after PreInit stage. -nonunique_template_directive = Line %d: at most one template directive is allowed. -unexpected_closing_tag = Line %d: unexpected closing tag %s. -unexpected_matching = Unexpected matching: %s. Please report this problem to PRADO developer team. diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt new file mode 100644 index 00000000..688901c2 --- /dev/null +++ b/framework/Exceptions/messages.txt @@ -0,0 +1,76 @@ +component_property_undefined = Component property '%s.%s' is not defined. +component_property_readonly = Component property '%s.%s' is read-only. +component_event_undefined = Component event '%s.%s' is not defined. +component_eventhandler_invalid = Component event '%s.%s' is attached with an invalid event handler. +component_expression_invalid = Component '%s' is evaluating an invalid expression '%s' : %s. +component_statements_invalid = Component '%s' is evaluating invalid PHP statements '%s' : %s. + +propertyvalue_enumvalue_invalid = Value '%s' is a not valid enumeration value (%s). + +application_configfile_inexistent = Application configuration file '%s' does not exist. +application_module_existing = Application module '%s' cannot be registered twice. +application_service_invalid = Service '%s' must implement IService interface. +application_service_unknown = Requested service '%s' is not defined. + +appconfig_aliaspath_invalid = Application configuration uses an invalid file path "%s". +appconfig_aliasid_required = Application configuration element must have an "id" attribute. +appconfig_using_invalid = Application configuration element must have a "namespace" attribute. +appconfig_moduleid_required = Application configuration element must have an "id" attribute. +appconfig_moduletype_required = Application configuration must have a "type" attribute. +appconfig_serviceid_required = Application configuration element must have an "id" attribute. +appconfig_servicetype_required = Application configuration must have a "type" attribute. +appconfig_parameterid_required = Application configuration element must have an "id" attribute. + +uri_format_invalid = '%s' is not a valid URI. + +httpresponse_bufferoutput_unchangeable = THttpResponse.BufferOutput cannot be modified after THttpResponse is initialized. +httpresponse_file_inexistent = THttpResponse cannot send file '%s'. The file does not exist. + +httpsession_sessionid_unchangeable = THttpSession.SessionID cannot be modified after the session is started. +httpsession_sessionname_unchangeable = THttpSession.SessionName cannot be modified after the session is started. +httpsession_sessionname_invalid = THttpSession.SessionName must contain alphanumeric characters only. +httpsession_savepath_unchangeable = THttpSession.SavePath cannot be modified after the session is started. +httpsession_savepath_invalid = THttpSession.SavePath '%s' is invalid. +httpsession_storage_unchangeable = THttpSession.Storage cannot be modified after the session is started. +httpsession_cookiemode_unchangeable = THttpSession.CookieMode cannot be modified after the session is started. +httpsession_autostart_unchangeable = THttpSession.AutoStart cannot be modified after the session module is initialized. +httpsession_gcprobability_unchangeable = THttpSession.GCProbability cannot be modified after the session is started. +httpsession_gcprobability_invalid = THttpSession.GCProbability must be an integer between 0 and 100. +httpsession_transid_unchangeable = THttpSession.UseTransparentSessionID cannot be modified after the session is started. +httpsession_maxlifetime_unchangeable = THttpSession.Timeout cannot be modified after the session is started. + +assetmanager_basepath_invalid = TAssetManager.BasePath '%s' is invalid. Make sure the directory exists and is writable by the Web server process. +assetmanager_basepath_unchangeable = TAssetManager.BasePath cannot be modified after the module is initialized. +assetmanager_baseurl_unchangeable = TAssetManager.BaseUrl cannot be modified after the module is initialized. + +pageservice_page_unknown = Page not found: %s + + +body_contents_not_allowed = %s: body contents are not allowed. +control_id_not_unique = Control ID '%s' is not unique for control type '%s'. +control_not_found = Unable to find a control with ID '%s'. +control_not_in_form = Control '%s' is not enclosed within a server form. +data_not_iterable = Data is not iterable. An array or an object implementing Traversable is required. +event_not_defined = %s: event is not defined. +expecting_closing_tag = Line %d: expecting closing tag %s. +index_out_of_range = Index '%s' is out of range. +invalid_accesskey = %s.AccessKey: only one character is allowed. +invalid_control_id = Invalid control ID '%s' for control type '%s'. +invalid_enum_value = Invalid value '%s' for enumeration type (%s) +invalid_event_handler = Invalid event handler '%s' for event '%s'. +invalid_expression = Invalid expression '%s': %s. +invalid_statements = Invalid statements '%s': %s. +invalid_subproperty = Invalid sub-property '%s'. +invalid_style_value = %s.Style: only string is allowed. +multiple_form_not_allowed = Multiple server forms are not allowed. +must_be_component = %s must extend from TComponent. +no_comments_in_property = Line %d: comments are not allowed in property values. +property_not_defined = %s: property is not defined. +property_read_only = %s: property is read-only. +skinid_set_after_applied = %s: SkinID cannot be set after the skin is applied. +skinid_set_after_preinit = %s: SkinID cannot be set after PreInit stage. +stylesheet_applied = %s: StyleSheet skin is already applied. +enabletheming_after_preinit = %s: EnableTheme cannot be set after PreInit stage. +nonunique_template_directive = Line %d: at most one template directive is allowed. +unexpected_closing_tag = Line %d: unexpected closing tag %s. +unexpected_matching = Unexpected matching: %s. Please report this problem to PRADO developer team. -- cgit v1.2.3