@@ -726,6 +726,35 @@ function onSubmit() {
726726 $ app ->tform ->errorMessage .= $ app ->tform ->lng ("invalid_rewrite_rules_txt " ).'<br> ' ;
727727 }
728728 }
729+
730+ // check custom php.ini settings
731+ if (isset ($ this ->dataRecord ['custom_php_ini ' ]) && trim ($ this ->dataRecord ['custom_php_ini ' ]) != '' ) {
732+ $ custom_php_ini_settings = trim ($ this ->dataRecord ['custom_php_ini ' ]);
733+ $ custom_php_ini_settings_are_valid = true ;
734+ // Make sure we only have Unix linebreaks
735+ $ custom_php_ini_settings = str_replace ("\r\n" , "\n" , $ custom_php_ini_settings );
736+ $ custom_php_ini_settings = str_replace ("\r" , "\n" , $ custom_php_ini_settings );
737+ $ custom_php_ini_settings_lines = explode ("\n" , $ custom_php_ini_settings );
738+ if (is_array ($ custom_php_ini_settings_lines ) && !empty ($ custom_php_ini_settings_lines )){
739+ foreach ($ custom_php_ini_settings_lines as $ custom_php_ini_settings_line ){
740+ if (trim ($ custom_php_ini_settings_line ) == '' ) continue ;
741+ if (substr (trim ($ custom_php_ini_settings_line ),0 ,1 ) == '; ' ) continue ;
742+ // empty value
743+ if (preg_match ('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*;*\s*$@ ' , $ custom_php_ini_settings_line )) continue ;
744+ // value inside ""
745+ if (preg_match ('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*".*"\s*;*\s*$@ ' , $ custom_php_ini_settings_line )) continue ;
746+ // value inside ''
747+ if (preg_match ('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s* \'.* \'\s*;*\s*$@ ' , $ custom_php_ini_settings_line )) continue ;
748+ // everything else
749+ if (preg_match ('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*[-a-zA-Z0-9~&=_\@/,.#\s]*\s*;*\s*$@ ' , $ custom_php_ini_settings_line )) continue ;
750+ $ custom_php_ini_settings_are_valid = false ;
751+ break ;
752+ }
753+ }
754+ if (!$ custom_php_ini_settings_are_valid ){
755+ $ app ->tform ->errorMessage .= $ app ->tform ->lng ("invalid_custom_php_ini_settings_txt " ).'<br> ' ;
756+ }
757+ }
729758
730759 parent ::onSubmit ();
731760 }
0 commit comments