Invites config re-formatting (#1162)

* Invites config re-formatting

* Update config.php

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-11-23 09:15:06 +07:00 committed by GitHub
commit 33b2042395
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 20 deletions

View file

@ -5,6 +5,7 @@
**Merged pull requests:**
- Invites config re-formatting [\#1162](https://github.com/torrentpier/torrentpier/pull/1162) ([belomaxorka](https://github.com/belomaxorka))
- Use external cookie library to prevent incorrect cookie setting [\#1160](https://github.com/torrentpier/torrentpier/pull/1160), [\#1161](https://github.com/torrentpier/torrentpier/pull/1161) ([belomaxorka](https://github.com/belomaxorka))
- Some improvements in default template [\#1159](https://github.com/torrentpier/torrentpier/pull/1159) ([belomaxorka](https://github.com/belomaxorka))
- Use sent port instead of source [\#1158](https://github.com/torrentpier/torrentpier/pull/1158) ([kovalensky](https://github.com/kovalensky))

View file

@ -378,16 +378,17 @@ $bb_cfg['unique_ip'] = false; // Disallow registration from multiple IP addresse
$bb_cfg['new_user_reg_restricted'] = false; // Disallow registration in below hours
$bb_cfg['new_user_reg_interval'] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]; // Available hours
$bb_cfg['reg_email_activation'] = true; // Demand to activate profile by email confirmation
// Invites
$bb_cfg['invite_only'] = false;
// Invite codes
// Syntax: 'invite_code' => 'validity_period'
// The 'validity_period' value is based on strtotime() function: https://www.php.net/manual/en/function.strtotime.php
// Invite link example: site_url/profile.php?mode=register&invite=new_year
$bb_cfg['invite_codes'] = [
'new_year' => '2022-12-31 00:00:01',
'ein_volk' => '29 July 1936',
'catch_up_overtake' => '1917-10-09'
$bb_cfg['invites_system'] = [
'enabled' => false,
'codes' => [
// Syntax: 'invite_code' => 'validity_period'
// The 'validity_period' value is based on strtotime() function: https://www.php.net/manual/en/function.strtotime.php
// Invite link example: site_url/profile.php?mode=register&invite=new_year
'new_year' => '2022-12-31 00:00:01',
'ein_volk' => '29 July 1936',
'catch_up_overtake' => '1917-10-09'
]
];
$bb_cfg['password_symbols'] = [

View file

@ -203,15 +203,14 @@ foreach ($profile_fields as $field => $can_edit) {
* Invite code (reg)
*/
case 'invite_code':
if ($bb_cfg['invite_only']) {
if ($bb_cfg['invites_system']['enabled']) {
$invite_code = $_POST['invite_code'] ?? '';
if ($submit) {
if (isset($bb_cfg['invite_codes'][$invite_code])) {
if (TIMENOW > strtotime($bb_cfg['invite_codes'][$invite_code])) {
if (isset($bb_cfg['invites_system']['codes'][$invite_code])) {
if (TIMENOW > strtotime($bb_cfg['invites_system']['codes'][$invite_code])) {
$errors[] = $lang['INVITE_EXPIRED'];
}
}
else {
} else {
$errors[] = $lang['INCORRECT_INVITE'];
}
}

View file

@ -95,11 +95,11 @@
<input id="pass_confirm" onBlur="ajax.exec({ action: 'user_register', mode: 'check_pass', pass: $('#pass').val(), pass_confirm: $('#pass_confirm').val() }); return false;" type="<!-- IF SHOW_PASS -->text<!-- ELSE -->password<!-- ENDIF -->" name="cfm_pass" size="35" maxlength="32" value=""/>&nbsp;<span id="check_pass"></span>
</td>
</tr>
<!-- IF $bb_cfg['invite_only'] and not EDIT_PROFILE -->
<tr>
<td class="prof-title">{L_INVITE_CODE}: *</td>
<td><input type="text" name="invite_code" size="35" value="{INVITE_CODE}"/></td>
</tr>
<!-- IF $bb_cfg['invites_system']['enabled'] and not EDIT_PROFILE -->
<tr>
<td class="prof-title">{L_INVITE_CODE}: *</td>
<td><input type="text" name="invite_code" size="35" value="{INVITE_CODE}"/></td>
</tr>
<!-- ENDIF -->
<!-- IF CAPTCHA_HTML -->
<tr>