Browse Source

Cease use of deprecated functions

spaghetti 7 years ago
parent
commit
49cc8814b9

+ 2
- 1
classes/debug.class.php View File

654
   <table id="debug_loggedvars" class="debug_table hidden">
654
   <table id="debug_loggedvars" class="debug_table hidden">
655
 <?
655
 <?
656
     foreach ($Vars as $ID => $Var) {
656
     foreach ($Vars as $ID => $Var) {
657
-      list($Key, $Data) = each($Var);
657
+      $Key = key($Var);
658
+      $Data = current($Var);
658
       $Size = count($Data['data']);
659
       $Size = count($Data['data']);
659
 ?>
660
 ?>
660
     <tr>
661
     <tr>

+ 3
- 1
classes/tags.class.php View File

183
       ORDER BY BadTag');
183
       ORDER BY BadTag');
184
       $TagAliases = G::$DB->to_array(false, MYSQLI_ASSOC, false);
184
       $TagAliases = G::$DB->to_array(false, MYSQLI_ASSOC, false);
185
       // Unify tag aliases to be in_this_format as tags not in.this.format
185
       // Unify tag aliases to be in_this_format as tags not in.this.format
186
-      array_walk_recursive($TagAliases, create_function('&$val', '$val = preg_replace("/\./","_", $val);'));
186
+      array_walk_recursive($TagAliases, function(&$val) {
187
+        $val = preg_replace("/\./","_", $val);
188
+      });
187
       // Clean up the array for smaller cache size
189
       // Clean up the array for smaller cache size
188
       foreach ($TagAliases as &$TagAlias) {
190
       foreach ($TagAliases as &$TagAlias) {
189
         foreach (array_keys($TagAlias) as $Key) {
191
         foreach (array_keys($TagAlias) as $Key) {

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

213
     $Str = preg_replace('/(?<!'.$URLPrefix.')http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str);
213
     $Str = preg_replace('/(?<!'.$URLPrefix.')http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str);
214
     $Str = preg_replace('/\[embed\]\[inlineurl\]/', '[embed]', $Str);
214
     $Str = preg_replace('/\[embed\]\[inlineurl\]/', '[embed]', $Str);
215
     // For anonym.to and archive.org links, remove any [inlineurl] in the middle of the link
215
     // For anonym.to and archive.org links, remove any [inlineurl] in the middle of the link
216
-    $callback = create_function('$matches', 'return str_replace("[inlineurl]", "", $matches[0]);');
217
-    $Str = preg_replace_callback('/(?<=\[inlineurl\]|'.$URLPrefix.')(\S*\[inlineurl\]\S*)/m', $callback, $Str);
216
+    $Str = preg_replace_callback('/(?<=\[inlineurl\]|'.$URLPrefix.')(\S*\[inlineurl\]\S*)/m', function($matches) {
217
+      return str_replace("[inlineurl]", "", $matches[0]);
218
+    }, $Str);
218
 
219
 
219
     if (self::$TOC) {
220
     if (self::$TOC) {
220
       $Str = preg_replace('/(\={5})([^=].*)\1/i', '[headline=4]$2[/headline]', $Str);
221
       $Str = preg_replace('/(\={5})([^=].*)\1/i', '[headline=4]$2[/headline]', $Str);

+ 2
- 4
classes/torrent_32bit.class.php View File

143
 class BENCODE_LIST extends BENCODE2 {
143
 class BENCODE_LIST extends BENCODE2 {
144
   function enc() {
144
   function enc() {
145
     $Str = 'l';
145
     $Str = 'l';
146
-    reset($this->Val);
147
-    while (list($Key, $Value) = each($this->Val)) {
146
+    foreach ($this->Val as $Value) {
148
       $Str.=$this->encode($Value);
147
       $Str.=$this->encode($Value);
149
     }
148
     }
150
     return $Str.'e';
149
     return $Str.'e';
177
 class BENCODE_DICT extends BENCODE2 {
176
 class BENCODE_DICT extends BENCODE2 {
178
   function enc() {
177
   function enc() {
179
     $Str = 'd';
178
     $Str = 'd';
180
-    reset($this->Val);
181
-    while (list($Key, $Value) = each($this->Val)) {
179
+    foreach ($this->Val as $Key => $Value) {
182
       $Str.=strlen($Key).':'.$Key.$this->encode($Value);
180
       $Str.=strlen($Key).':'.$Key.$this->encode($Value);
183
     }
181
     }
184
     return $Str.'e';
182
     return $Str.'e';

+ 1
- 1
sections/ajax/artist.php View File

42
   $RevisionID = false;
42
   $RevisionID = false;
43
 }
43
 }
44
 if ($Data) {
44
 if ($Data) {
45
-  list($K, list($Name, $Image, $Body)) = each($Data);
45
+  list($Name, $Image, $Body) = current($Data);
46
 } else {
46
 } else {
47
   if ($RevisionID) {
47
   if ($RevisionID) {
48
   /*
48
   /*

+ 3
- 2
sections/artist/artist.php View File

23
 }
23
 }
24
 
24
 
25
 if ($Data) {
25
 if ($Data) {
26
-  list($K, list($Name, $Image, $Body)) = each($Data);
26
+  list($Name, $Image, $Body) = current($Data);
27
 } else {
27
 } else {
28
   if ($RevisionID) {
28
   if ($RevisionID) {
29
     $sql = "
29
     $sql = "
296
 <?
296
 <?
297
     }
297
     }
298
   } else {
298
   } else {
299
-    list($TorrentID, $Torrent) = each($Torrents);
299
+    $TorrentID = key($Torrents);
300
+    $Torrent = current($Torrents);
300
     if (!$TorrentID) { continue; }
301
     if (!$TorrentID) { continue; }
301
 
302
 
302
     $TorrentTags = new Tags($TagList, false);
303
     $TorrentTags = new Tags($TagList, false);

+ 2
- 1
sections/bookmarks/torrents.php View File

172
   } else {
172
   } else {
173
     // Viewing a type that does not require grouping
173
     // Viewing a type that does not require grouping
174
 
174
 
175
-    list($TorrentID, $Torrent) = each($Torrents);
175
+    $TorrentID = key($Torrents);
176
+    $Torrent = current($Torrents);
176
 
177
 
177
     $DisplayName = Artists::display_artists(Artists::get_artist($GroupID));
178
     $DisplayName = Artists::display_artists(Artists::get_artist($GroupID));
178
 
179
 

+ 2
- 1
sections/collages/torrent_collage.php View File

182
   } else {
182
   } else {
183
     // Viewing a type that does not require grouping
183
     // Viewing a type that does not require grouping
184
 
184
 
185
-    list($TorrentID, $Torrent) = each($Torrents);
185
+    $TorrentID = key($Torrents);
186
+    $Torrent = current($Torrents);
186
 
187
 
187
     //$DisplayName = "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\" dir=\"ltr\">$GroupName</a>";
188
     //$DisplayName = "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\" dir=\"ltr\">$GroupName</a>";
188
 
189
 

+ 1
- 1
sections/tools/managers/forum_list.php View File

133
       <td>
133
       <td>
134
         <select name="categoryid">
134
         <select name="categoryid">
135
 <?  reset($ForumCats);
135
 <?  reset($ForumCats);
136
-  while (list($CurCat, $CatName) = each($ForumCats)) { ?>
136
+  foreach($ForumCats as $CurCat => $CatName) { ?>
137
           <option value="<?=$CurCat?>"<? if ($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
137
           <option value="<?=$CurCat?>"<? if ($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
138
 <?  } ?>
138
 <?  } ?>
139
         </select>
139
         </select>

+ 2
- 1
sections/torrents/browse.php View File

630
   } else {
630
   } else {
631
     // Viewing a type that does not require grouping
631
     // Viewing a type that does not require grouping
632
 
632
 
633
-    list($TorrentID, $Data) = each($Torrents);
633
+    $TorrentID = key($Torrents);
634
+    $Data = current($Torrents);
634
 
635
 
635
     $Reported = false;
636
     $Reported = false;
636
     $Reports = Torrents::get_reports($TorrentID);
637
     $Reports = Torrents::get_reports($TorrentID);

+ 2
- 1
sections/torrents/notify.php View File

17
 if (empty($_GET['order_by']) || !isset($OrderBys[$_GET['order_by']])) {
17
 if (empty($_GET['order_by']) || !isset($OrderBys[$_GET['order_by']])) {
18
   $_GET['order_by'] = 'time';
18
   $_GET['order_by'] = 'time';
19
 }
19
 }
20
-list($OrderTbl, $OrderCol) = each($OrderBys[$_GET['order_by']]);
20
+$OrderTbl = key($OrderBys[$_GET['order_by']]);
21
+$OrderCol = current($OrderBys[$_GET['order_by']]);
21
 
22
 
22
 if (!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') {
23
 if (!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') {
23
   $OrderWay = 'ASC';
24
   $OrderWay = 'ASC';

+ 2
- 1
sections/userhistory/subscribed_collages.php View File

164
       } else {
164
       } else {
165
         // Viewing a type that does not require grouping
165
         // Viewing a type that does not require grouping
166
 
166
 
167
-        list($TorrentID, $Torrent) = each($Torrents);
167
+        $TorrentID = key($Torrents);
168
+        $Torrent = current($Torrents);
168
 
169
 
169
         $DisplayName = "<a class=\"torrent_title\" href=\"torrents.php?id=$GroupID\" ";
170
         $DisplayName = "<a class=\"torrent_title\" href=\"torrents.php?id=$GroupID\" ";
170
         if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
171
         if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {

Loading…
Cancel
Save