1
0
Fork 0
Manager/app/api/ViewerWelcomePage.php

37 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace Mcp\Api;
use Mcp\OpenSim;
class ViewerWelcomePage extends \Mcp\RequestHandler
{
public function get(): void
{
$images = array();
2023-09-05 08:40:08 +00:00
if ($handle = opendir('./img/viewerWelcomeImages')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
2023-09-05 08:40:08 +00:00
$images[] = "./img/viewerWelcomeImages/".$entry;
}
}
closedir($handle);
}
shuffle($images);
$opensim = new OpenSim($this->app->db());
$this->app->template('viewerWelcomeImages.php')->vars([
'title' => 'Splash',
'grid-name' => $this->app->config('grid')['name'],
'news' => $this->app->config('grid')['main-news']
])->unsafeVar('json-image-array', json_encode($images))
2023-09-05 20:25:08 +00:00
->unsafeVar('image-1', $images[0])->unsafeVar('image-2', $images[1])
->unsafeVar('stats', "Registrierte User: ".$opensim->getUserCount()."<br>Regionen: ".$opensim->getRegionCount()."<br>Aktuell Online: ".($opensim->getOnlineCount()-1))
->render();
}
}