mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-09 06:00:31 +08:00
use true/false instead of 1/0 in options
This commit is contained in:
parent
91d528d311
commit
4ae6d868bb
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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([
|
||||
|
@ -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':
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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' => '<strong>Copyright © 2016 <a href="{site_url}">{site_name}</a>.</strong> 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',
|
||||
|
Loading…
Reference in New Issue
Block a user