Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/17151] Make settings forms use macros #6533

Merged
merged 17 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions phpBB/adm/style/acp_bots.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ <h3>{L_WARNING}</h3>
</dl>
<dl>
<dt><label for="bot_style">{L_BOT_STYLE}{L_COLON}</label><br /><span>{L_BOT_STYLE_EXPLAIN}</span></dt>
<dd><select id="bot_style" name="bot_style">{S_STYLE_OPTIONS}</select></dd>
<dd>
{{ FormsSelect(S_STYLE_OPTIONS) }}
</dd>
</dl>
<dl>
<dt><label for="{{ LANG_OPTIONS.id }}">{L_BOT_LANG}{L_COLON}</label><br /><span>{L_BOT_LANG_EXPLAIN}</span></dt>
Expand All @@ -37,7 +39,9 @@ <h3>{L_WARNING}</h3>
</dl>
<dl>
<dt><label for="bot_active">{L_BOT_ACTIVE}{L_COLON}</label></dt>
<dd><select id="bot_active" name="bot_active">{S_ACTIVE_OPTIONS}</select></dd>
<dd>
{{ FormsSelect(S_ACTIVE_OPTIONS) }}
</dd>
</dl>
<dl>
<dt><label for="bot_agent">{L_BOT_AGENT}{L_COLON}</label><br /><span>{L_BOT_AGENT_EXPLAIN}</span></dt>
Expand Down
4 changes: 3 additions & 1 deletion phpBB/adm/style/acp_users_prefs.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
</dl>
<dl>
<dt><label for="style">{L_BOARD_STYLE}{L_COLON}</label></dt>
<dd><select id="style" name="style">{S_STYLE_OPTIONS}</select></dd>
<dd>
{{ FormsSelect(S_STYLE_OPTIONS) }}
</dd>
</dl>
<!-- INCLUDE timezone_option.html -->
<dl>
Expand Down
27 changes: 3 additions & 24 deletions phpBB/includes/acp/acp_attachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ function main($id, $mode)
'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'max_attachments' => array('lang' => 'MAX_ATTACHMENTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => false),
'max_attachments_pm' => array('lang' => 'MAX_ATTACHMENTS_PM', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => false),
'display_order' => array('lang' => 'DISPLAY_ORDER', 'validate' => 'bool', 'type' => 'custom', 'method' => 'display_order', 'explain' => true),
'display_order' => array('lang' => 'DISPLAY_ORDER', 'validate' => 'bool', 'type' => 'radio', 'function' => 'phpbb_build_radio', 'params' => ['{CONFIG_VALUE}', '{KEY}', ['DESCENDING', 'ASCENDING']], 'explain' => true),
'attachment_quota' => array('lang' => 'ATTACH_QUOTA', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
'max_filesize' => array('lang' => 'ATTACH_MAX_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
'max_filesize_pm' => array('lang' => 'ATTACH_MAX_PM_FILESIZE','validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
'secure_downloads' => array('lang' => 'SECURE_DOWNLOADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'secure_allow_deny' => array('lang' => 'SECURE_ALLOW_DENY', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_allow_deny', 'explain' => true),
'secure_allow_deny' => array('lang' => 'SECURE_ALLOW_DENY', 'validate' => 'int', 'type' => 'radio', 'function' => 'phpbb_build_radio', 'params' => ['{CONFIG_VALUE}', '{KEY}', [1 => 'ORDER_ALLOW_DENY', 0 => 'ORDER_DENY_ALLOW']], 'explain' => true),
'secure_allow_empty_referer' => array('lang' => 'SECURE_EMPTY_REFERRER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'check_attachment_content' => array('lang' => 'CHECK_CONTENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),

Expand Down Expand Up @@ -331,7 +331,7 @@ function main($id, $mode)
$l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}

$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
$content = phpbb_build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content))
{
continue;
Expand Down Expand Up @@ -1718,16 +1718,6 @@ function perform_site_list()
}
}

/**
* Write display_order config field
*/
function display_order($value, $key = '')
{
$radio_ary = array(0 => 'DESCENDING', 1 => 'ASCENDING');

return h_radio('config[display_order]', $radio_ary, $value, $key);
}

/**
* Adjust all three max_filesize config vars for display
*/
Expand Down Expand Up @@ -1756,15 +1746,4 @@ function max_filesize($value, $key = '')
]
];
}

/**
* Write secure_allow_deny config field
*/
function select_allow_deny($value, $key = '')
{
$radio_ary = array(1 => 'ORDER_ALLOW_DENY', 0 => 'ORDER_DENY_ALLOW');

return h_radio('config[' . $key . ']', $radio_ary, $value, $key);
}

}