use php 7.1 list syntax

This commit is contained in:
flash 2016-12-09 22:51:40 +01:00
parent c3a80ca7f9
commit 9f7416e32b
2 changed files with 7 additions and 8 deletions

View file

@ -38,9 +38,8 @@ class ForumController extends Controller
->get(['topic_id']); ->get(['topic_id']);
$activeTopics = []; $activeTopics = [];
// make this not disgusting while ([$count, $row] = each($activeTopicsIds)) {
while (list($_n, $_t) = each($activeTopicsIds)) { $topic = new Topic($row->topic_id);
$topic = new Topic($_t->topic_id);
$forum = new Forum($topic->forum); $forum = new Forum($topic->forum);
// Check if we have permission to view it // Check if we have permission to view it
@ -48,7 +47,7 @@ class ForumController extends Controller
$fetch = DB::table('posts') $fetch = DB::table('posts')
->groupBy('topic_id') ->groupBy('topic_id')
->orderByRaw('COUNT(*) DESC') ->orderByRaw('COUNT(*) DESC')
->skip(11 + $_n) ->skip(11 + $count)
->take(1) ->take(1)
->get(['topic_id']); ->get(['topic_id']);
@ -69,15 +68,15 @@ class ForumController extends Controller
->get(['post_id']); ->get(['post_id']);
$latestPosts = []; $latestPosts = [];
while (list($_n, $_p) = each($latestPostsIds)) { while ([$count, $row] = each($latestPostsIds)) {
$post = new Post($_p->post_id); $post = new Post($row->post_id);
$forum = new Forum($post->forum); $forum = new Forum($post->forum);
// Check if we have permission to view it // Check if we have permission to view it
if (!$forum->perms->view) { if (!$forum->perms->view) {
$fetch = DB::table('posts') $fetch = DB::table('posts')
->orderBy('post_id', 'desc') ->orderBy('post_id', 'desc')
->skip(11 + $_n) ->skip(11 + $count)
->take(1) ->take(1)
->get(['post_id']); ->get(['post_id']);

View file

@ -103,7 +103,7 @@ class Net
public static function matchCIDR(string $ip, string $range): bool public static function matchCIDR(string $ip, string $range): bool
{ {
// Break the range up in parts // Break the range up in parts
list($net, $mask) = explode('/', $range); [$net, $mask] = explode('/', $range);
// Check IP version // Check IP version
$ipv = self::detectIPVersion($ip); $ipv = self::detectIPVersion($ip);