@@ -25,16 +25,16 @@ public function update_options()
2525 'base_url ' => Utils::trim (Input::post ('form_base_url ' )),
2626 'default_timezone ' => floatval (Input::post ('form_default_timezone ' )),
2727 'default_dst ' => Input::post ('form_default_dst ' ) != '1 ' ? '0 ' : '1 ' ,
28- 'default_lang ' => Utils::trim (Input::post ('form_default_lang ' )),
29- 'default_style ' => Utils::trim (Input::post ('form_default_style ' )),
30- 'time_format ' => Utils::trim (Input::post ('form_time_format ' )),
31- 'date_format ' => Utils::trim (Input::post ('form_date_format ' )),
28+ // 'default_lang' => Utils::trim(Input::post('form_default_lang')),
29+ // 'default_style' => Utils::trim(Input::post('form_default_style')),
30+ // 'time_format' => Utils::trim(Input::post('form_time_format')),
31+ // 'date_format' => Utils::trim(Input::post('form_date_format')),
3232 'timeout_visit ' => (intval (Input::post ('form_timeout_visit ' )) > 0 ) ? intval (Input::post ('form_timeout_visit ' )) : 1 ,
3333 'timeout_online ' => (intval (Input::post ('form_timeout_online ' )) > 0 ) ? intval (Input::post ('form_timeout_online ' )) : 1 ,
3434 'show_version ' => Input::post ('form_show_version ' ) != '1 ' ? '0 ' : '1 ' ,
3535 'show_user_info ' => Input::post ('form_show_user_info ' ) != '1 ' ? '0 ' : '1 ' ,
3636 'show_post_count ' => Input::post ('form_show_post_count ' ) != '1 ' ? '0 ' : '1 ' ,
37- 'smilies ' => Input::post ('form_smilies ' ) != '1 ' ? '0 ' : '1 ' ,
37+ // 'smilies' => Input::post('form_smilies') != '1' ? '0' : '1',
3838 'smilies_sig ' => Input::post ('form_smilies_sig ' ) != '1 ' ? '0 ' : '1 ' ,
3939 'make_links ' => Input::post ('form_make_links ' ) != '1 ' ? '0 ' : '1 ' ,
4040 'topic_review ' => (intval (Input::post ('form_topic_review ' )) >= 0 ) ? intval (Input::post ('form_topic_review ' )) : 0 ,
@@ -78,7 +78,17 @@ public function update_options()
7878 'maintenance_message ' => Utils::trim (Input::post ('form_maintenance_message ' )),
7979 );
8080
81+ $ prefs = array (
82+ 'language ' => Utils::trim (Input::post ('form_default_lang ' )),
83+ 'style ' => Utils::trim (Input::post ('form_default_style ' )),
84+ 'time_format ' => Utils::trim (Input::post ('form_time_format ' )),
85+ 'date_format ' => Utils::trim (Input::post ('form_date_format ' )),
86+ 'smilies ' => Input::post ('form_smilies ' ) != '1 ' ? '0 ' : '1 ' ,
87+
88+ );
89+
8190 $ form = Container::get ('hooks ' )->fire ('model.admin.options.update_options.form ' , $ form );
91+ $ prefs = Container::get ('hooks ' )->fire ('model.admin.options.update_options.prefs ' , $ prefs );
8292
8393 if ($ form ['board_title ' ] == '' ) {
8494 throw new Error (__ ('Must enter title message ' ), 400 );
@@ -99,21 +109,21 @@ public function update_options()
99109 }
100110
101111 $ languages = \FeatherBB \Core \Lister::getLangs ();
102- if (!in_array ($ form [ ' default_lang ' ], $ languages )) {
112+ if (!in_array ($ prefs [ ' language ' ], $ languages )) {
103113 throw new Error (__ ('Bad request ' ), 404 );
104114 }
105115
106116 $ styles = \FeatherBB \Core \Lister::getStyles ();
107- if (!in_array ($ form [ ' default_style ' ], $ styles )) {
117+ if (!in_array ($ prefs [ ' style ' ], $ styles )) {
108118 throw new Error (__ ('Bad request ' ), 404 );
109119 }
110120
111- if ($ form ['time_format ' ] == '' ) {
112- $ form ['time_format ' ] = 'H:i:s ' ;
121+ if ($ prefs ['time_format ' ] == '' ) {
122+ $ prefs ['time_format ' ] = 'H:i:s ' ;
113123 }
114124
115- if ($ form ['date_format ' ] == '' ) {
116- $ form ['date_format ' ] = 'Y-m-d ' ;
125+ if ($ prefs ['date_format ' ] == '' ) {
126+ $ prefs ['date_format ' ] = 'Y-m-d ' ;
117127 }
118128
119129 if (!Container::get ('email ' )->is_valid_email ($ form ['admin_email ' ])) {
@@ -208,8 +218,10 @@ public function update_options()
208218 }
209219 }
210220
221+ Container::get ('prefs ' )->set ($ prefs );
222+
211223 // Regenerate the config cache
212- Container::get ('cache ' )->store ('config ' , Cache::get_config ());
224+ Container::get ('cache ' )->store ('config ' , array_merge ( Cache::get_config (), Cache:: get_preferences () ));
213225
214226 return Router::redirect (Router::pathFor ('adminOptions ' ), __ ('Options updated redirect ' ));
215227 }
@@ -222,7 +234,7 @@ public function get_styles()
222234 $ output = '' ;
223235
224236 foreach ($ styles as $ temp ) {
225- if (ForumSettings::get ('o_default_style ' ) == $ temp ) {
237+ if (ForumSettings::get ('style ' ) == $ temp ) {
226238 $ output .= "\t\t\t\t\t\t\t\t\t\t\t" .'<option value=" ' .$ temp .'" selected="selected"> ' .str_replace ('_ ' , ' ' , $ temp ).'</option> ' ."\n" ;
227239 } else {
228240 $ output .= "\t\t\t\t\t\t\t\t\t\t\t" .'<option value=" ' .$ temp .'"> ' .str_replace ('_ ' , ' ' , $ temp ).'</option> ' ."\n" ;
@@ -241,7 +253,7 @@ public function get_langs()
241253 $ output = '' ;
242254
243255 foreach ($ langs as $ temp ) {
244- if (ForumSettings::get ('o_default_lang ' ) == $ temp ) {
256+ if (ForumSettings::get ('language ' ) == $ temp ) {
245257 $ output .= "\t\t\t\t\t\t\t\t\t\t\t" .'<option value=" ' .$ temp .'" selected="selected"> ' .str_replace ('_ ' , ' ' , $ temp ).'</option> ' ."\n" ;
246258 } else {
247259 $ output .= "\t\t\t\t\t\t\t\t\t\t\t" .'<option value=" ' .$ temp .'"> ' .str_replace ('_ ' , ' ' , $ temp ).'</option> ' ."\n" ;
0 commit comments