Skip to content

Commit

Permalink
Use url helper in place of $this->serverurl variable
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Sep 18, 2018
1 parent b66bfaa commit bd844ba
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Blacklight/NZBGet.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class NZBGet
*/
public function __construct(&$page)
{
$this->serverurl = $page->serverurl;
$this->serverurl = url('/');
$this->uid = $page->userdata['id'];
$this->api_token = $page->userdata['api_token'];

Expand Down
2 changes: 1 addition & 1 deletion Blacklight/SABnzbd.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function __construct($page)
{
$this->uid = $page->userdata['id'];
$this->api_token = $page->userdata['api_token'];
$this->serverurl = $page->serverurl;
$this->serverurl = url('/');
$this->client = new Client(['verify' => false]);

// Set up properties.
Expand Down
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2018-09-18 DariusIII
* Fix: Use url helper in place of $this->serverurl variable
* Fix: Add missing $this->serverurl declaration in BasePageController
* Chg: Update mayconbordin/l5-fixtures to latest commit
* Chg: Remove debug messages from Binaries class
Expand Down
4 changes: 1 addition & 3 deletions app/Http/Controllers/BasePageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ public function __construct()
}
$this->smarty->error_reporting = E_ALL & ~E_NOTICE;

$this->serverurl = url('/');

$this->smarty->assign('serverroot', url('/'));
}

Expand Down Expand Up @@ -277,7 +275,7 @@ protected function setUserPreferences(): void
}

$content = new Contents();
$this->smarty->assign('menulist', Menu::getMenu($role, $this->serverurl));
$this->smarty->assign('menulist', Menu::getMenu($role, url('/')));
$this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role));
$this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role));
if ($this->userdata !== null) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/FailedReleasesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function show(Request $request)
return response('No NZB found for alternate match!', 404)->withHeaders(['X-DNZB-RCode' => 404, 'X-DNZB-RText' => 'No NZB found for alternate match.']);
}

return response('Success', 200)->withHeaders(['Location' => $this->serverurl.'getnzb?id='.$alt['guid'].'&i='.$uid.'&r='.$rssToken]);
return response('Success', 200)->withHeaders(['Location' => url('/').'/getnzb?id='.$alt['guid'].'&i='.$uid.'&r='.$rssToken]);
}

return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => 400, 'X-DNZB-RText' => 'Bad request, please supply all parameters!']);
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/GetNzbController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public function getNzb(Request $request)
$headers = [
'Content-Type' => 'application/x-nzb',
'Expires' => date('r', now()->addDays(365)->timestamp),
'X-DNZB-Failure' => $this->serverurl.'failed'.'?guid='.$request->input('id').'&userid='.$uid.'&rsstoken='.$rssToken,
'X-DNZB-Failure' => url('/').'/failed'.'?guid='.$request->input('id').'&userid='.$uid.'&rsstoken='.$rssToken,
'X-DNZB-Category' => $relData['category_name'],
'X-DNZB-Details' => $this->serverurl.'details/'.$request->input('id'),
'X-DNZB-Details' => url('/').'/details/'.$request->input('id'),
];

if (! empty($relData['imdbid']) && $relData['imdbid'] > 0) {
Expand All @@ -133,7 +133,7 @@ public function getNzb(Request $request)
}

if ((int) $relData['nfostatus'] === 1) {
$headers += ['X-DNZB-NFO ' => $this->serverurl.'nfo/'.$request->input('id')];
$headers += ['X-DNZB-NFO ' => url('/').'/nfo/'.$request->input('id')];
}

$headers += ['X-DNZB-RCode' => '200',
Expand Down

0 comments on commit bd844ba

Please sign in to comment.