Browse Source

Cease use of deprecated functions

spaghetti 7 years ago
parent
commit
49cc8814b9

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

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

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

@@ -183,7 +183,9 @@ class Tags {
183 183
       ORDER BY BadTag');
184 184
       $TagAliases = G::$DB->to_array(false, MYSQLI_ASSOC, false);
185 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 189
       // Clean up the array for smaller cache size
188 190
       foreach ($TagAliases as &$TagAlias) {
189 191
         foreach (array_keys($TagAlias) as $Key) {

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

@@ -213,8 +213,9 @@ class Text {
213 213
     $Str = preg_replace('/(?<!'.$URLPrefix.')http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str);
214 214
     $Str = preg_replace('/\[embed\]\[inlineurl\]/', '[embed]', $Str);
215 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 220
     if (self::$TOC) {
220 221
       $Str = preg_replace('/(\={5})([^=].*)\1/i', '[headline=4]$2[/headline]', $Str);

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

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

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

@@ -42,7 +42,7 @@ if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
42 42
   $RevisionID = false;
43 43
 }
44 44
 if ($Data) {
45
-  list($K, list($Name, $Image, $Body)) = each($Data);
45
+  list($Name, $Image, $Body) = current($Data);
46 46
 } else {
47 47
   if ($RevisionID) {
48 48
   /*

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

@@ -23,7 +23,7 @@ if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
23 23
 }
24 24
 
25 25
 if ($Data) {
26
-  list($K, list($Name, $Image, $Body)) = each($Data);
26
+  list($Name, $Image, $Body) = current($Data);
27 27
 } else {
28 28
   if ($RevisionID) {
29 29
     $sql = "
@@ -296,7 +296,8 @@ foreach ($TorrentList as $Group) {
296 296
 <?
297 297
     }
298 298
   } else {
299
-    list($TorrentID, $Torrent) = each($Torrents);
299
+    $TorrentID = key($Torrents);
300
+    $Torrent = current($Torrents);
300 301
     if (!$TorrentID) { continue; }
301 302
 
302 303
     $TorrentTags = new Tags($TagList, false);

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

@@ -172,7 +172,8 @@ foreach ($GroupIDs as $GroupID) {
172 172
   } else {
173 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 178
     $DisplayName = Artists::display_artists(Artists::get_artist($GroupID));
178 179
 

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

@@ -182,7 +182,8 @@ foreach ($GroupIDs as $GroupID) {
182 182
   } else {
183 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 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,7 +133,7 @@ while (list($ID, $CategoryID, $Sort, $Name, $Description, $MinClassRead, $MinCla
133 133
       <td>
134 134
         <select name="categoryid">
135 135
 <?  reset($ForumCats);
136
-  while (list($CurCat, $CatName) = each($ForumCats)) { ?>
136
+  foreach($ForumCats as $CurCat => $CatName) { ?>
137 137
           <option value="<?=$CurCat?>"<? if ($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
138 138
 <?  } ?>
139 139
         </select>

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

@@ -630,7 +630,8 @@ $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGr
630 630
   } else {
631 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 636
     $Reported = false;
636 637
     $Reports = Torrents::get_reports($TorrentID);

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

@@ -17,7 +17,8 @@ $OrderBys = array(
17 17
 if (empty($_GET['order_by']) || !isset($OrderBys[$_GET['order_by']])) {
18 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 23
 if (!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') {
23 24
   $OrderWay = 'ASC';

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

@@ -164,7 +164,8 @@ if (!$NumResults) {
164 164
       } else {
165 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 170
         $DisplayName = "<a class=\"torrent_title\" href=\"torrents.php?id=$GroupID\" ";
170 171
         if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {

Loading…
Cancel
Save