mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
guest visit setting
This commit is contained in:
@@ -156,7 +156,10 @@ elseif ($action == 'savesettings_smtp') // save smtp
|
||||
elseif ($action == 'savesettings_security') // save security
|
||||
{
|
||||
stdhead($lang_settings['head_save_security_settings']);
|
||||
$validConfig = array('securelogin', 'securetracker', 'https_announce_url','iv','maxip','maxloginattempts','changeemail','cheaterdet','nodetect');
|
||||
$validConfig = array(
|
||||
'securelogin', 'securetracker', 'https_announce_url','iv','maxip','maxloginattempts','changeemail','cheaterdet','nodetect',
|
||||
'guest_visit_type', 'guest_visit_value_static_page', 'guest_visit_value_custom_content', 'guest_visit_value_redirect',
|
||||
);
|
||||
GetVar($validConfig);
|
||||
$SECURITY = [];
|
||||
foreach($validConfig as $config) {
|
||||
@@ -284,7 +287,8 @@ elseif ($action == 'securitysettings') //security settings
|
||||
$SECURITY = get_setting('security');
|
||||
stdhead($lang_settings['head_security_settings']);
|
||||
print ($notice);
|
||||
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_security'>");
|
||||
print("<tbody>");
|
||||
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."' name='securitysettings_form'><input type='hidden' name='action' value='savesettings_security'>");
|
||||
tr($lang_settings['row_enable_ssl'],"<input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "yes" ? " checked" : "") . " value='yes'> ".$lang_settings['text_yes']. " <input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "no" ? " checked" : "") . " value='no'> ".$lang_settings['text_no']. " <input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "op" ? " checked" : "") . " value='op'> ".$lang_settings['text_optional']."<br />".$lang_settings['text_ssl_note'], 1);
|
||||
tr($lang_settings['row_enable_ssl_tracker'],"<input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "yes" ? " checked" : "") . " value='yes'> ".$lang_settings['text_yes']. " <input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "no" ? " checked" : "") . " value='no'> ".$lang_settings['text_no']. " <input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "op" ? " checked" : "") . " value='op'> ".$lang_settings['text_optional']."<br />".$lang_settings['text_ssl_note'], 1);
|
||||
tr($lang_settings['row_https_announce_url'],"<input type='text' style=\"width: 300px\" name=https_announce_url value='".($SECURITY["https_announce_url"] ? $SECURITY["https_announce_url"] : "")."'> ".$lang_settings['text_https_announce_url_note'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
|
||||
@@ -294,63 +298,30 @@ elseif ($action == 'securitysettings') //security settings
|
||||
tr($lang_settings['row_max_ips'],"<input type='text' style=\"width: 300px\" name=maxip value='" . ($SECURITY["maxip"] ? $SECURITY["maxip"] : "1")."'> ".$lang_settings['text_max_ips_note'], 1);
|
||||
tr($lang_settings['row_max_login_attemps'],"<input type='text' style=\"width: 300px\" name=maxloginattempts value='" . ($SECURITY["maxloginattempts"] ? $SECURITY["maxloginattempts"] : "7")."'> ".$lang_settings['text_max_login_attemps_note'], 1);
|
||||
|
||||
$guestVisitRadios = [
|
||||
[
|
||||
'label' => '正常',
|
||||
'value' => 'normal',
|
||||
],
|
||||
[
|
||||
'label' => '展示指定页面',
|
||||
'value' => 'static-page',
|
||||
'target' => [
|
||||
'type' => 'select',
|
||||
'label' => '指定页面路径',
|
||||
'options' => glob(ROOT_PATH . 'resources/static-pages/*'),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '展示自定义内容',
|
||||
'value' => 'custom-content',
|
||||
'target' => [
|
||||
'type' => 'textarea',
|
||||
'label' => '自定义内容',
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '重定向到指定 URL',
|
||||
'value' => 'redirect',
|
||||
'target' => [
|
||||
'type' => 'input',
|
||||
'label' => '指定 URL',
|
||||
],
|
||||
],
|
||||
];
|
||||
$guestVisitHtmlArr = [];
|
||||
$guestVisitTargetHtmlArr = [];
|
||||
foreach($guestVisitRadios as $value) {
|
||||
$guestVisitHtmlArr[] = sprintf(
|
||||
'<label><input type="radio" name="guest_visit_type" value="%s" onclick="">%s</label>',
|
||||
$value['value'], $value['label']
|
||||
);
|
||||
if (!empty($value['target']['type'])) {
|
||||
$targetType = $value['target']['type'];
|
||||
if ($targetType == 'input') {
|
||||
$input = sprintf('<input type="text" name="guest_visit_value_%s" value="" style="width: 300px" />', $value['value']);
|
||||
$guestVisitTargetHtmlArr[] = tr($value['target']['label'], $input, 1, '', true);
|
||||
} elseif ($targetType == 'textarea') {
|
||||
|
||||
} elseif ($targetType == 'select') {
|
||||
$select = sprintf('<select name="guest_visit_value_%s">', $value['value']);
|
||||
foreach ($value['target']['options'] as $option) {
|
||||
$select .= sprintf('<option value="%s">%s</option>', basename($option), basename($option));
|
||||
}
|
||||
$select .= '</select>';
|
||||
$guestVisitTargetHtmlArr[] = tr($value['target']['label'], $select, 1, '', true);
|
||||
}
|
||||
}
|
||||
$guestVisitTypeRadio = '<label><input type="radio" name="guest_visit_type" value="normal"' . ($SECURITY['guest_visit_type'] == 'normal' ? ' checked' : '') . ' onclick="document.getElementById(\'tbody_static_page\').style.display=\'none\';document.getElementById(\'tbody_custom_content\').style.display=\'none\';document.getElementById(\'tbody_redirect\').style.display=\'none\';">' . $lang_settings['text_guest_visit_type_normal'] . '</label>';
|
||||
$guestVisitTypeRadio .= '<br/><label><input type="radio" name="guest_visit_type" value="static_page"' . ($SECURITY['guest_visit_type'] == 'static_page' ? ' checked' : '') . ' onclick="document.getElementById(\'tbody_static_page\').style.display=\'table-row-group\';document.getElementById(\'tbody_custom_content\').style.display=\'none\';document.getElementById(\'tbody_redirect\').style.display=\'none\';">' . $lang_settings['text_guest_visit_type_static_page'] . '</label>';
|
||||
$guestVisitTypeRadio .= '<br/><label><input type="radio" name="guest_visit_type" value="custom_content"' . ($SECURITY['guest_visit_type'] == 'custom_content' ? ' checked' : '') . ' onclick="document.getElementById(\'tbody_static_page\').style.display=\'none\';document.getElementById(\'tbody_custom_content\').style.display=\'table-row-group\';document.getElementById(\'tbody_redirect\').style.display=\'none\';">' . $lang_settings['text_guest_visit_type_custom_content'] . '</label>';
|
||||
$guestVisitTypeRadio .= '<br/><label><input type="radio" name="guest_visit_type" value="redirect"' . ($SECURITY['guest_visit_type'] == 'redirect' ? ' checked' : '') . ' onclick="document.getElementById(\'tbody_static_page\').style.display=\'none\';document.getElementById(\'tbody_custom_content\').style.display=\'none\';document.getElementById(\'tbody_redirect\').style.display=\'table-row-group\';">' . $lang_settings['text_guest_visit_type_redirect'] . '</label>';
|
||||
tr($lang_settings['row_guest_visit_type'], $guestVisitTypeRadio, 1);
|
||||
print '</tbody><tbody id="tbody_static_page" style="display: ' . ($SECURITY['guest_visit_type'] == 'static_page' ? 'table-row-group' : 'none') . '">';
|
||||
$guestVisitStaticPageSelect = '<select name="guest_visit_value_static_page">';
|
||||
foreach (glob(ROOT_PATH . 'resources/static-pages/*') as $page) {
|
||||
$pageName = basename($page);
|
||||
$guestVisitStaticPageSelect.= sprintf('<option value="%s"%s>%s</option>', $pageName, $SECURITY['guest_visit_value_static_page'] == $pageName ? ' selected' : '', $pageName);
|
||||
}
|
||||
tr("游客访问", implode('<br/>', $guestVisitHtmlArr), 1);
|
||||
print implode('', $guestVisitTargetHtmlArr);
|
||||
$guestVisitStaticPageSelect .= '</select> ' . $lang_settings['text_guest_visit_value_static_page'];
|
||||
tr($lang_settings['row_guest_visit_value_static_page'], $guestVisitStaticPageSelect, 1);
|
||||
|
||||
print '</tbody><tbody id="tbody_custom_content" style="display: ' . ($SECURITY['guest_visit_type'] == 'custom_content' ? 'table-row-group' : 'none') . '">';
|
||||
print '<tr><td class="rowhead nowrap" valign="top" align="right">' . $lang_settings['row_guest_visit_value_custom_content'] . '</td><td>';
|
||||
textbbcode('securitysettings_form', 'guest_visit_value_custom_content', $SECURITY['guest_visit_value_custom_content'] ?? '');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</tbody><tbody id="tbody_redirect" style="display: ' . ($SECURITY['guest_visit_type'] == 'redirect' ? 'table-row-group' : 'none') . '">';
|
||||
$input = sprintf('<input type="text" name="guest_visit_value_redirect" value="%s" style="width: 300px;" />', $SECURITY['guest_visit_value_redirect'] ?? '');
|
||||
tr($lang_settings['row_guest_visit_value_redirect'], $input, 1);
|
||||
print '</tbody>';
|
||||
|
||||
|
||||
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
|
||||
print ("</form>");
|
||||
|
||||
Reference in New Issue
Block a user