Skip to content

Commit

Permalink
Update rarbg.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Chak10 authored Jun 2, 2019
1 parent f8f283c commit c35388d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions rarbg.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ class Torrent_API

/**
* Torrent_API constructor.
* @param string $app_id
* @param string $token_file
* @param $app_id
* @param $token_file
*/
public function __construct(string $app_id = 'generic', string $token_file = "token")
public function __construct($app_id = null, $token_file = null)
{
$this->app_id = $app_id;
$this->token_file = $token_file;
empty($app_id) && !is_string($app_id) ? $this->app_id = $app_id = 'chak10_torrent' : $this->app_id = $app_id;
empty($token_file) && !is_string($token_file) ? $this->token_file = $token_file = "token" : $this->token_file = $token_file;
$dirtoken = dirname($token_file);
if (!empty($dirtoken) && !is_dir($dirtoken)) mkdir($dirtoken, 0764, true);
if (file_exists($token_file) && time() - filemtime($token_file) < 890) {
$TOKEN = json_decode(file_get_contents($token_file));
if ($TOKEN) {
Expand Down

0 comments on commit c35388d

Please sign in to comment.