Parcourir la source

Minor fix to utorrent token function

TehMuffinMoo il y a 4 ans
Parent
commit
f63fbaf46e
1 fichiers modifiés avec 39 ajouts et 37 suppressions
  1. 39 37
      api/homepage/utorrent.php

+ 39 - 37
api/homepage/utorrent.php

@@ -120,16 +120,18 @@ trait uTorrentHomepageItem
 			$dom = new PHPHtmlParser\Dom;
 			$dom->loadStr($response->body);
 			$id = $dom->getElementById('token')->text;
-			$uTorrentConfig = new stdClass();
-			$uTorrentConfig->uTorrentToken = $id;
+			$uTorrentConfig = array (
+				"uTorrentToken" => $id,
+				"uTorrentCookie" => "",
+			);
 			$reflection = new ReflectionClass($response->cookies);
 			$cookie = $reflection->getProperty("cookies");
 			$cookie->setAccessible(true);
 			$cookie = $cookie->getValue($response->cookies);
 			if ($cookie['GUID']) {
-				$uTorrentConfig->uTorrentCookie = $cookie['GUID']->value;
+				$uTorrentConfig['uTorrentCookie'] = $cookie['GUID']->value;
 			}
-			if ($uTorrentConfig->uTorrentToken || $uTorrentConfig->uTorrentCookie) {
+			if ($uTorrentConfig['uTorrentToken'] || $uTorrentConfig['uTorrentCookie']) {
 				$this->updateConfigItems($uTorrentConfig);
 			}
 			
@@ -182,39 +184,39 @@ trait uTorrentHomepageItem
 					} else if ($this->config['uTorrentHideCompleted'] && $Status == "Finished") {
 						// Do Nothing
 					} else {
-                                                $value = array(
-                                                        'Hash' => $keyArr[0],
-                                                        'TorrentStatus' => $keyArr[1],
-                                                        'Name' => $keyArr[2],
-                                                        'Size' => $keyArr[3],
-                                                        'Progress' => $keyArr[4],
-                                                        'Downloaded' => $keyArr[5],
-                                                        'Uploaded' => $keyArr[6],
-                                                        'Ratio' => $keyArr[7],
-                                                        'upSpeed' => $keyArr[8],
-                                                        'downSpeed' => $keyArr[9],
-                                                        'eta' => $keyArr[10],
-                                                        'Labels' => $keyArr[11],
-                                                        'PeersConnected' => $keyArr[12],
-                                                        'PeersInSwarm' => $keyArr[13],
-                                                        'SeedsConnected' => $keyArr[14],
-                                                        'SeedsInSwarm' => $keyArr[15],
-                                                        'Availability' => $keyArr[16],
-                                                        'TorrentQueueOrder' => $keyArr[17],
-                                                        'Remaining' => $keyArr[18],
-                                                        'DownloadUrl' => $keyArr[19],
-                                                        'RssFeedUrl' => $keyArr[20],
-                                                        'Message' => $keyArr[21],
-                                                        'StreamId' => $keyArr[22],
-                                                        'DateAdded' => $keyArr[23],
-                                                        'DateCompleted' => $keyArr[24],
-                                                        'AppUpdateUrl' => $keyArr[25],
-                                                        'RootDownloadPath' => $keyArr[26],
-                                                        'Unknown27' => $keyArr[27],
-                                                        'Unknown28' => $keyArr[28],
-                                                        'Status' => $Status,
-                                                        'Percent' => str_replace(' ', '', $matches['Percentage']),
-                                                );
+						$value = array(
+							'Hash' => $keyArr[0],
+							'TorrentStatus' => $keyArr[1],
+							'Name' => $keyArr[2],
+							'Size' => $keyArr[3],
+							'Progress' => $keyArr[4],
+							'Downloaded' => $keyArr[5],
+							'Uploaded' => $keyArr[6],
+							'Ratio' => $keyArr[7],
+							'upSpeed' => $keyArr[8],
+							'downSpeed' => $keyArr[9],
+							'eta' => $keyArr[10],
+							'Labels' => $keyArr[11],
+							'PeersConnected' => $keyArr[12],
+							'PeersInSwarm' => $keyArr[13],
+							'SeedsConnected' => $keyArr[14],
+							'SeedsInSwarm' => $keyArr[15],
+							'Availability' => $keyArr[16],
+							'TorrentQueueOrder' => $keyArr[17],
+							'Remaining' => $keyArr[18],
+							'DownloadUrl' => $keyArr[19],
+							'RssFeedUrl' => $keyArr[20],
+							'Message' => $keyArr[21],
+							'StreamId' => $keyArr[22],
+							'DateAdded' => $keyArr[23],
+							'DateCompleted' => $keyArr[24],
+							'AppUpdateUrl' => $keyArr[25],
+							'RootDownloadPath' => $keyArr[26],
+							'Unknown27' => $keyArr[27],
+							'Unknown28' => $keyArr[28],
+							'Status' => $Status,
+							'Percent' => str_replace(' ', '', $matches['Percentage']),
+						);
 						array_push($valueArray, $value);
 					}
 				}