have_perm('root')) { throw new AccessDeniedException(); } } public function index_action($page = 1) { $this->entries_per_page = Request::int('entries_per_page', 20); $images = []; foreach (scandir($GLOBALS['DYNAMIC_CONTENT_PATH'] . '/user') as $file) { if (mb_strpos($file, '_normal.png') !== FALSE && $file !== 'nobody_normal.png') { $images[] = [ 'time' => @filemtime($GLOBALS['DYNAMIC_CONTENT_PATH'] . '/user/'.$file), 'file' => $file, 'user_id' => mb_substr($file, 0, mb_strrpos($file, '_'))]; } } usort($images, function($b, $a) { return $a['time'] - $b['time']; }); $this->entries = sizeof($images); $this->page = $page; $this->images = array_slice($images, $this->entries_per_page * ($page - 1), $this->entries_per_page); } }