function get_date($date, $method, $norelative = 0, $full_relative = 0) { global $INSTALLER09; static $offset_set = 0; static $today_time = 0; static $yesterday_time = 0; $time_options = array('JOINED' => $INSTALLER09['time_joined'], 'SHORT' => $INSTALLER09['time_short'], 'LONG' => $INSTALLER09['time_long'], 'TINY' => $INSTALLER09['time_tiny'] ? $INSTALLER09['time_tiny'] : 'j M Y - G:i', 'DATE' => $INSTALLER09['time_date'] ? $INSTALLER09['time_date'] : 'j M Y'); if (!$date) { return '--'; } if (empty($method)) { $method = 'LONG'; } if ($offset_set == 0) { $GLOBALS['offset'] = get_time_offset(); if ($INSTALLER09['time_use_relative']) { $today_time = gmdate('d,m,Y', TIME_NOW + $GLOBALS['offset']); $yesterday_time = gmdate('d,m,Y', TIME_NOW - 86400 + $GLOBALS['offset']); } $offset_set = 1; } if ($INSTALLER09['time_use_relative'] == 3) { $full_relative = 1; } if ($full_relative and $norelative != 1) { $diff = TIME_NOW - $date; if ($diff < 3600) { if ($diff < 120) { return '< 1 minute ago'; } else { return sprintf('%s minutes ago', intval($diff / 60)); } } else { if ($diff < 7200) { return '< 1 hour ago'; } else { if ($diff < 86400) { return sprintf('%s hours ago', intval($diff / 3600)); } else { if ($diff < 172800) { return '< 1 day ago'; } else { if ($diff < 604800) { return sprintf('%s days ago', intval($diff / 86400)); } else { if ($diff < 1209600) { return '< 1 week ago'; } else { if ($diff < 3024000) { return sprintf('%s weeks ago', intval($diff / 604900)); } else { return gmdate($time_options[$method], $date + $GLOBALS['offset']); } } } } } } } } else { if ($INSTALLER09['time_use_relative'] and $norelative != 1) { $this_time = gmdate('d,m,Y', $date + $GLOBALS['offset']); if ($INSTALLER09['time_use_relative'] == 2) { $diff = TIME_NOW - $date; if ($diff < 3600) { if ($diff < 120) { return '< 1 minute ago'; } else { return sprintf('%s minutes ago', intval($diff / 60)); } } } if ($this_time == $today_time) { return str_replace('{--}', 'Today', gmdate($INSTALLER09['time_use_relative_format'], $date + $GLOBALS['offset'])); } else { if ($this_time == $yesterday_time) { return str_replace('{--}', 'Yesterday', gmdate($INSTALLER09['time_use_relative_format'], $date + $GLOBALS['offset'])); } else { return gmdate($time_options[$method], $date + $GLOBALS['offset']); } } } else { return gmdate($time_options[$method], $date + $GLOBALS['offset']); } } }
http_response_code(404); die('<h1>404 Not Found</h1>No secret is available for that account.'); } header('Content-Type: text/plain'); echo SteamTotp::getAuthCode($secrets['shared_secret'], get_time_offset()); exit(0); } if (preg_match('#^/key/([^/]+)/([^/]+)$#', $_SERVER['PATH_INFO'], $matches)) { $secrets = get_secrets($matches[1]); if (!$secrets || empty($secrets['identity_secret'])) { http_response_code(404); die('<h1>404 Not Found</h1>No secret is available for that account.'); } $time = filter_input(INPUT_GET, 't', FILTER_VALIDATE_INT); if (!$time) { $time = time() + get_time_offset(); } header('Content-Type: application/json'); echo json_encode(['time' => $time, 'key' => SteamTotp::getConfirmationKey($secrets['identity_secret'], $time, $matches[2])]); exit(0); } http_response_code(404); die('<h1>404 Not Found</h1>'); // functions function get_secrets($username) { global $secrets_dir; if (!preg_match('#/$#', $secrets_dir)) { $secrets_dir .= '/'; } $file = @file_get_contents($secrets_dir . $username . '.json');