Browse Source

Migrate to Gitea

pjc 5 years ago
parent
commit
7402ab5245

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

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

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

1
 <?php
1
 <?php
2
+
2
 /**
3
 /**
3
  * Torrent class that contains some convenient functions related to torrent meta data
4
  * Torrent class that contains some convenient functions related to torrent meta data
4
  */
5
  */
92
         if (empty($this->Dec)) {
93
         if (empty($this->Dec)) {
93
             return false;
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
         if (empty($this->Dec)) {
125
         if (empty($this->Dec)) {
125
             return false;
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
             return false;
129
             return false;
129
         }
130
         }
130
         $this->Dec['info']['source'] = $Sources[0];
131
         $this->Dec['info']['source'] = $Sources[0];

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

1
 <?php
1
 <?php
2
+
2
 /*******************************************************************************
3
 /*******************************************************************************
3
 |~~~~ Gazelle bencode parser                         ~~~~|
4
 |~~~~ Gazelle bencode parser                         ~~~~|
4
 --------------------------------------------------------------------------------
5
 --------------------------------------------------------------------------------
158
 
159
 
159
             if ($Type === 'e') { // End of list
160
             if ($Type === 'e') { // End of list
160
                 $this->Pos += 1;
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
                 return;
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
             $this->decode($Type, $Key);
168
             $this->decode($Type, $Key);
168
             ++$Key;
169
             ++$Key;
169
         }
170
         }
193
         while ($this->Pos<$Length) {
194
         while ($this->Pos<$Length) {
194
             if ($this->Str[$this->Pos] === 'e') { // End of dictionary
195
             if ($this->Str[$this->Pos] === 'e') { // End of dictionary
195
                 $this->Pos += 1;
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
                 return;
198
                 return;
198
             }
199
             }
199
 
200
 
219
             // $Type now indicates what type of element we're dealing with
220
             // $Type now indicates what type of element we're dealing with
220
             // It's either an integer (string), 'i' (an integer), 'l' (a list), 'd' (a dictionary), or 'e' (end of dictionary/list)
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
             $this->decode($Type, $Key);
225
             $this->decode($Type, $Key);
225
         }
226
         }
226
         return true;
227
         return true;
227
     }
228
     }
228
 }
229
 }
229
 
230
 
230
-
231
 class TORRENT extends BENCODE_DICT
231
 class TORRENT extends BENCODE_DICT
232
 {
232
 {
233
     public function dump()
233
     public function dump()
328
             return true; // Torrent is private
328
             return true; // Torrent is private
329
         } else {
329
         } else {
330
             // Torrent is not private!
330
             // Torrent is not private!
331
-            // add private tracker flag and sort info dictionary
331
+            // Add private tracker flag and sort info dictionary
332
             $this->Val['info']->Val['private'] = 1;
332
             $this->Val['info']->Val['private'] = 1;
333
             ksort($this->Val['info']->Val);
333
             ksort($this->Val['info']->Val);
334
             return false;
334
             return false;

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

262
         $Tor->set_announce_url($AnnounceURL);
262
         $Tor->set_announce_url($AnnounceURL);
263
         unset($Tor->Val['announce-list']);
263
         unset($Tor->Val['announce-list']);
264
 
264
 
265
+        # Announce list
265
         if (!empty($AnnounceList)) {
266
         if (!empty($AnnounceList)) {
266
             $Tor->set_announce_list($AnnounceList);
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
         #unset($Tor->Val['url-list']);
275
         #unset($Tor->Val['url-list']);
270
         unset($Tor->Val['libtorrent_resume']);
276
         unset($Tor->Val['libtorrent_resume']);
271
         return $Tor->enc();
277
         return $Tor->enc();

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


Loading…
Cancel
Save