diff --git a/app/Http/Controllers/ClosetController.php b/app/Http/Controllers/ClosetController.php index 2e21c490..05649483 100644 --- a/app/Http/Controllers/ClosetController.php +++ b/app/Http/Controllers/ClosetController.php @@ -77,7 +77,7 @@ class ClosetController extends Controller 'name' => 'required|no_special_chars' ]); - if (app('user.current')->getScore() < option('score_per_closet_item', null, false)) { + if (app('user.current')->getScore() < option('score_per_closet_item')) { return json(trans('user.closet.add.lack-score'), 7); } diff --git a/app/Services/OptionForm.php b/app/Services/OptionForm.php index d1133af2..2e78c2b1 100644 --- a/app/Services/OptionForm.php +++ b/app/Services/OptionForm.php @@ -250,7 +250,7 @@ class OptionForm continue; } - if (($data = Arr::get($_POST, $item->id)) != option($item->id, null, false)) { + if (($data = Arr::get($_POST, $item->id)) != option($item->id)) { Option::set($item->id, $data); } } @@ -547,7 +547,7 @@ class OptionFormGroup extends OptionFormItem foreach ($this->items as $item) { if ($item['id'] && is_null($item['value'])) { - $item['value'] = option($item['id'], null, false); + $item['value'] = option($item['id']); } $rendered[] = view('vendor.option-form.'.$item['type'])->with([ diff --git a/app/Services/Repositories/OptionRepository.php b/app/Services/Repositories/OptionRepository.php index 623fb8d3..8b4336b9 100644 --- a/app/Services/Repositories/OptionRepository.php +++ b/app/Services/Repositories/OptionRepository.php @@ -35,7 +35,7 @@ class OptionRepository extends Repository * @param bool $bool convert '0', '1' to bool value * @return mixed */ - public function get($key, $default = null, $bool = true) + public function get($key, $default = null) { if (!$this->has($key) && Arr::has(config('options'), $key)) { $this->set($key, config("options.$key")); @@ -43,15 +43,13 @@ class OptionRepository extends Repository $value = Arr::get($this->items, $key, $default); - if (!$bool) return $value; - switch (strtolower($value)) { case 'true': - case '1': + case '(true)': return true; case 'false': - case '0': + case '(false)': return false; case 'null': diff --git a/app/helpers.php b/app/helpers.php index 650d2835..5c0092b7 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -252,7 +252,7 @@ if (! function_exists('option')) { * @param mixed $default * @return mixed */ - function option($key = null, $default = null, $bool = true) + function option($key = null, $default = null) { $options = app('options'); @@ -264,10 +264,10 @@ if (! function_exists('option')) { foreach ($key as $innerKey => $innerValue) { $options->set($innerKey, $innerValue); } - return $options->save(); + return; } - return $options->get($key, $default, $bool); + return $options->get($key, $default); } } diff --git a/config/options.php b/config/options.php index ce334a3d..f1c34b0d 100644 --- a/config/options.php +++ b/config/options.php @@ -3,41 +3,41 @@ * @Author: printempw * @Date: 2016-07-29 11:53:11 * @Last Modified by: printempw - * @Last Modified time: 2016-12-31 23:14:51 + * @Last Modified time: 2016-12-31 23:34:17 */ return [ 'site_url' => '', 'site_name' => 'Blessing Skin Server', 'site_description' => 'Open-source PHP Minecraft Skin Hosting Service', - 'user_can_register' => '1', + 'user_can_register' => 'true', 'regs_per_ip' => '3', - 'api_type' => '0', + 'api_type' => 'false', 'announcement' => 'Welcome to Blessing Skin Server {version}!', 'color_scheme' => 'skin-blue', 'home_pic_url' => './resources/assets/images/bg.jpg', 'custom_css' => '', 'custom_js' => '', - 'allow_chinese_playername' => '1', + 'allow_chinese_playername' => 'true', 'comment_script' => '', 'user_initial_score' => '1000', 'sign_gap_time' => '24', 'sign_score' => '10,100', - 'score_per_storage' => '1', + 'score_per_storage' => 'true', 'private_score_per_storage' => '10', - 'return_score' => '1', + 'return_score' => 'true', 'score_per_player' => '100', - 'sign_after_zero' => '0', + 'sign_after_zero' => 'false', 'version' => '', - 'check_update' => '1', + 'check_update' => 'true', 'update_source' => 'https://work.prinzeugen.net/update.json', 'copyright_text' => 'Copyright © 2016 {site_name}. All rights reserved.', - 'auto_del_invalid_texture' => '0', - 'return_200_when_notfound' => '0', + 'auto_del_invalid_texture' => 'false', + 'return_200_when_notfound' => 'false', 'cache_expire_time' => '31536000', 'max_upload_file_size' => '1024', - 'force_ssl' => '0', - 'auto_detect_asset_url' => '1', + 'force_ssl' => 'false', + 'auto_detect_asset_url' => 'true', 'plugins_enabled' => '', 'copyright_prefer' => '0', 'score_per_closet_item' => '0',