|
|
@@ -835,13 +835,13 @@ function nzbgetConnect()
|
|
|
{
|
|
|
if ($GLOBALS['homepageNzbgetEnabled'] && !empty($GLOBALS['nzbgetURL']) && qualifyRequest($GLOBALS['homepageNzbgetAuth'])) {
|
|
|
$url = qualifyURL($GLOBALS['nzbgetURL']);
|
|
|
- if (!empty($GLOBALS['nzbgetUsername']) && !empty($GLOBALS['nzbgetPassword'])) {
|
|
|
- $url = $url . '/' . $GLOBALS['nzbgetUsername'] . ':' . decrypt($GLOBALS['nzbgetPassword']) . '/jsonrpc/listgroups';
|
|
|
- } else {
|
|
|
- $url = $url . '/jsonrpc/listgroups';
|
|
|
- }
|
|
|
+ $url = $url . '/jsonrpc/listgroups';
|
|
|
try {
|
|
|
$options = (localURL($url)) ? array('verify' => false) : array();
|
|
|
+ if($GLOBALS['nzbgetUsername'] !== '' && decrypt($GLOBALS['nzbgetPassword']) !== ''){
|
|
|
+ $credentials = array('auth' => new Requests_Auth_Digest(array($GLOBALS['nzbgetUsername'], decrypt($GLOBALS['nzbgetPassword']))));
|
|
|
+ $options = array_merge($options, $credentials);
|
|
|
+ }
|
|
|
$response = Requests::get($url, array(), $options);
|
|
|
if ($response->success) {
|
|
|
$api['content']['queueItems'] = json_decode($response->body, true);
|
|
|
@@ -850,13 +850,13 @@ function nzbgetConnect()
|
|
|
writeLog('error', 'NZBGet Connect Function - Error: ' . $e->getMessage(), 'SYSTEM');
|
|
|
};
|
|
|
$url = qualifyURL($GLOBALS['nzbgetURL']);
|
|
|
- if (!empty($GLOBALS['nzbgetUsername']) && !empty($GLOBALS['nzbgetPassword'])) {
|
|
|
- $url = $url . '/' . $GLOBALS['nzbgetUsername'] . ':' . decrypt($GLOBALS['nzbgetPassword']) . '/jsonrpc/history';
|
|
|
- } else {
|
|
|
- $url = $url . '/jsonrpc/history';
|
|
|
- }
|
|
|
+ $url = $url . '/jsonrpc/history';
|
|
|
try {
|
|
|
$options = (localURL($url)) ? array('verify' => false) : array();
|
|
|
+ if($GLOBALS['nzbgetUsername'] !== '' && decrypt($GLOBALS['nzbgetPassword']) !== ''){
|
|
|
+ $credentials = array('auth' => new Requests_Auth_Digest(array($GLOBALS['nzbgetUsername'], decrypt($GLOBALS['nzbgetPassword']))));
|
|
|
+ $options = array_merge($options, $credentials);
|
|
|
+ }
|
|
|
$response = Requests::get($url, array(), $options);
|
|
|
if ($response->success) {
|
|
|
$api['content']['historyItems'] = json_decode($response->body, true);
|
|
|
@@ -2623,13 +2623,13 @@ function testAPIConnection($array)
|
|
|
case 'nzbget':
|
|
|
if (!empty($GLOBALS['nzbgetURL'])) {
|
|
|
$url = qualifyURL($GLOBALS['nzbgetURL']);
|
|
|
- if (!empty($GLOBALS['nzbgetUsername']) && !empty($GLOBALS['nzbgetPassword'])) {
|
|
|
- $url = $url . '/' . $GLOBALS['nzbgetUsername'] . ':' . decrypt($GLOBALS['nzbgetPassword']) . '/jsonrpc/listgroups';
|
|
|
- } else {
|
|
|
- $url = $url . '/jsonrpc/listgroups';
|
|
|
- }
|
|
|
+ $url = $url . '/jsonrpc/listgroups';
|
|
|
try {
|
|
|
$options = (localURL($url)) ? array('verify' => false) : array();
|
|
|
+ if($GLOBALS['nzbgetUsername'] !== '' && decrypt($GLOBALS['nzbgetPassword']) !== ''){
|
|
|
+ $credentials = array('auth' => new Requests_Auth_Digest(array($GLOBALS['nzbgetUsername'], decrypt($GLOBALS['nzbgetPassword']))));
|
|
|
+ $options = array_merge($options, $credentials);
|
|
|
+ }
|
|
|
$response = Requests::get($url, array(), $options);
|
|
|
if ($response->success) {
|
|
|
return true;
|