mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
misc: Some minor improvements (#1855)
* misc: Some minor improvements * Update config.php * Update Env.php * Update Env.php * Update tr_seed_bonus.php
This commit is contained in:
parent
056bf046c1
commit
3cc880eeb8
3 changed files with 5 additions and 12 deletions
|
@ -426,7 +426,7 @@ $bb_cfg['invites_system'] = [
|
||||||
// Syntax: 'invite_code' => 'validity_period'
|
// Syntax: 'invite_code' => 'validity_period'
|
||||||
// The 'validity_period' value is based on strtotime() function: https://www.php.net/manual/en/function.strtotime.php
|
// The 'validity_period' value is based on strtotime() function: https://www.php.net/manual/en/function.strtotime.php
|
||||||
// You can also create a permanent invite, set 'permanent' value for 'validity_period'
|
// You can also create a permanent invite, set 'permanent' value for 'validity_period'
|
||||||
// Invite link example: site_url/profile.php?mode=register&invite=new_year
|
// Invite link example: site_url/profile.php?mode=register&invite=new_year2023
|
||||||
'new_year2023' => '2022-12-31 00:00:01',
|
'new_year2023' => '2022-12-31 00:00:01',
|
||||||
'340c4bb6ea2d284c13e085b60b990a8a' => '12 April 1961',
|
'340c4bb6ea2d284c13e085b60b990a8a' => '12 April 1961',
|
||||||
'tp_birthday' => '2005-04-04',
|
'tp_birthday' => '2005-04-04',
|
||||||
|
|
|
@ -35,19 +35,12 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
|
||||||
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
|
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
|
||||||
$seed_release = unserialize($bb_cfg['seed_bonus_release']);
|
$seed_release = unserialize($bb_cfg['seed_bonus_release']);
|
||||||
|
|
||||||
$sql = "SELECT last_run
|
|
||||||
FROM " . BB_CRON . "
|
|
||||||
WHERE cron_script = '" . basename(__FILE__) . "'
|
|
||||||
LIMIT 1";
|
|
||||||
$cron_runs = DB()->fetch_row($sql);
|
|
||||||
$cron_job_last_run = (TIMENOW - strtotime($cron_runs['last_run']));
|
|
||||||
|
|
||||||
foreach ($seed_bonus as $i => $points) {
|
foreach ($seed_bonus as $i => $points) {
|
||||||
if (!$points || !$seed_release[$i]) {
|
if (!$points || !$seed_release[$i]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_points = ($cron_job_last_run < 3600) ? round((float)$points * ($cron_job_last_run / 3600), 2) : 0;
|
$user_points = ((float)$points / 4);
|
||||||
$release = (int)$seed_release[$i];
|
$release = (int)$seed_release[$i];
|
||||||
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
|
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Env
|
||||||
/**
|
/**
|
||||||
* Get the environment repository instance.
|
* Get the environment repository instance.
|
||||||
*
|
*
|
||||||
* @return RepositoryInterface
|
* @return RepositoryInterface|null
|
||||||
*/
|
*/
|
||||||
public static function getRepository(): ?RepositoryInterface
|
public static function getRepository(): ?RepositoryInterface
|
||||||
{
|
{
|
||||||
|
@ -83,10 +83,10 @@ class Env
|
||||||
* Gets the value of an environment variable.
|
* Gets the value of an environment variable.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $default
|
* @param mixed|null $default
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function get(string $key, $default = null)
|
public static function get(string $key, mixed $default = null): mixed
|
||||||
{
|
{
|
||||||
return Option::fromValue(static::getRepository()->get($key))
|
return Option::fromValue(static::getRepository()->get($key))
|
||||||
->map(function ($value) {
|
->map(function ($value) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue