Browse Source

Migrate to Gitea

pjc 5 years ago
parent
commit
7402ab5245

+ 6
- 0
_packages/web-seeds/classes/torrent.class.php View File

@@ -0,0 +1,6 @@
1
+<?php
2
+
3
+# Line 320
4
+// Remove web-seeds
5
+#unset($this->Val['url-list']);
6
+# Line 321

+ 4
- 3
classes/bencodedecode.class.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 /**
3 4
  * The decode class is simple and straightforward. The only thing to
4 5
  * note is that empty dictionaries are represented by boolean trues
@@ -92,7 +93,7 @@ class BencodeDecode extends Bencode
92 93
       case 'i':
93 94
         $this->Pos++;
94 95
         $Value = substr($this->Data, $this->Pos, strpos($this->Data, 'e', $this->Pos) - $this->Pos);
95
-        if (!ctype_digit($Value) && !($Value[0] == '-' && ctype_digit(substr($Value, 1)))) {
96
+        if (!ctype_digit($Value) && !($Value[0] === '-' && ctype_digit(substr($Value, 1)))) {
96 97
             return $this->error();
97 98
         }
98 99
         $this->Pos += strlen($Value) + 1;
@@ -101,7 +102,7 @@ class BencodeDecode extends Bencode
101 102
       case 'l':
102 103
         $Value = [];
103 104
         $this->Pos++;
104
-        while ($this->Data[$this->Pos] != 'e') {
105
+        while ($this->Data[$this->Pos] !== 'e') {
105 106
             if ($this->Pos >= $this->Length) {
106 107
                 return $this->error();
107 108
             }
@@ -113,7 +114,7 @@ class BencodeDecode extends Bencode
113 114
       case 'd':
114 115
         $Value = [];
115 116
         $this->Pos++;
116
-        while ($this->Data[$this->Pos] != 'e') {
117
+        while ($this->Data[$this->Pos] !== 'e') {
117 118
             $Length = substr($this->Data, $this->Pos, strpos($this->Data, ':', $this->Pos) - $this->Pos);
118 119
             if (!ctype_digit($Length)) {
119 120
                 return $this->error();

+ 3
- 2
classes/bencodetorrent.class.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 /**
3 4
  * Torrent class that contains some convenient functions related to torrent meta data
4 5
  */
@@ -92,7 +93,7 @@ class BencodeTorrent extends BencodeDecode
92 93
         if (empty($this->Dec)) {
93 94
             return false;
94 95
         }
95
-        return isset($this->Dec['info']['private']) && Int64::get($this->Dec['info']['private']) == 1;
96
+        return isset($this->Dec['info']['private']) && Int64::get($this->Dec['info']['private']) === 1;
96 97
     }
97 98
     
98 99
     /**
@@ -124,7 +125,7 @@ class BencodeTorrent extends BencodeDecode
124 125
         if (empty($this->Dec)) {
125 126
             return false;
126 127
         }
127
-        if (isset($this->Dec['info']['source']) && ($this->Dec['info']['source'] == $Sources[0] || $this->Dec['info']['source'] == $Sources[1])) {
128
+        if (isset($this->Dec['info']['source']) && ($this->Dec['info']['source'] === $Sources[0] || $this->Dec['info']['source'] === $Sources[1])) {
128 129
             return false;
129 130
         }
130 131
         $this->Dec['info']['source'] = $Sources[0];

+ 8
- 8
classes/torrent.class.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 /*******************************************************************************
3 4
 |~~~~ Gazelle bencode parser                         ~~~~|
4 5
 --------------------------------------------------------------------------------
@@ -158,12 +159,12 @@ class BENCODE_LIST extends BENCODE2
158 159
 
159 160
             if ($Type === 'e') { // End of list
160 161
                 $this->Pos += 1;
161
-                unset($this->Str); // Since we're finished parsing the string, we don't need to store it anymore. Benchmarked - this makes the parser run way faster.
162
+                unset($this->Str); // Since we're finished parsing the string, we don't need to store it anymore. Benchmarked - this makes the parser run way faster
162 163
                 return;
163 164
             }
164 165
 
165
-            // Decode the bencoded element.
166
-            // This function changes $this->Pos and $this->Val, so you don't have to.
166
+            // Decode the bencoded element
167
+            // This function changes $this->Pos and $this->Val, so you don't have to
167 168
             $this->decode($Type, $Key);
168 169
             ++$Key;
169 170
         }
@@ -193,7 +194,7 @@ class BENCODE_DICT extends BENCODE2
193 194
         while ($this->Pos<$Length) {
194 195
             if ($this->Str[$this->Pos] === 'e') { // End of dictionary
195 196
                 $this->Pos += 1;
196
-                unset($this->Str); // Since we're finished parsing the string, we don't need to store it anymore. Benchmarked - this makes the parser run way faster.
197
+                unset($this->Str); // Since we're finished parsing the string, we don't need to store it anymore. Benchmarked - this makes the parser run way faster
197 198
                 return;
198 199
             }
199 200
 
@@ -219,15 +220,14 @@ class BENCODE_DICT extends BENCODE2
219 220
             // $Type now indicates what type of element we're dealing with
220 221
             // It's either an integer (string), 'i' (an integer), 'l' (a list), 'd' (a dictionary), or 'e' (end of dictionary/list)
221 222
 
222
-            // Decode the bencoded element.
223
-            // This function changes $this->Pos and $this->Val, so you don't have to.
223
+            // Decode the bencoded element
224
+            // This function changes $this->Pos and $this->Val, so you don't have to
224 225
             $this->decode($Type, $Key);
225 226
         }
226 227
         return true;
227 228
     }
228 229
 }
229 230
 
230
-
231 231
 class TORRENT extends BENCODE_DICT
232 232
 {
233 233
     public function dump()
@@ -328,7 +328,7 @@ class TORRENT extends BENCODE_DICT
328 328
             return true; // Torrent is private
329 329
         } else {
330 330
             // Torrent is not private!
331
-            // add private tracker flag and sort info dictionary
331
+            // Add private tracker flag and sort info dictionary
332 332
             $this->Val['info']->Val['private'] = 1;
333 333
             ksort($this->Val['info']->Val);
334 334
             return false;

+ 6
- 0
classes/torrentsdl.class.php View File

@@ -262,10 +262,16 @@ class TorrentsDL
262 262
         $Tor->set_announce_url($AnnounceURL);
263 263
         unset($Tor->Val['announce-list']);
264 264
 
265
+        # Announce list
265 266
         if (!empty($AnnounceList)) {
266 267
             $Tor->set_announce_list($AnnounceList);
267 268
         }
268 269
 
270
+        # Web seeds
271
+        if (!empty($WebSeeds)) {
272
+            $Tor->add_web_seeds($WebSeeds);
273
+        }
274
+        
269 275
         #unset($Tor->Val['url-list']);
270 276
         unset($Tor->Val['libtorrent_resume']);
271 277
         return $Tor->enc();

+ 3
- 2
static/functions/jquery.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save