summaryrefslogtreecommitdiffstats
path: root/modules/main.inc.php
blob: 31aef55e566d02a4e350949756971dc9ada77c8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

User::load();

function render_module()
{
	// Render::setTitle('abc');
	
	if (!User::isLoggedIn()) {
		Render::addTemplate('page-main-guest');
		return;
	}
	// Logged in here
	$ipxe = true;
	$file = CONFIG_IPXE_DIR . '/last-ip';
	if (file_exists($file)) {
		$last = file_get_contents($file);
		exec('/bin/ip a', $ips);
		foreach ($ips as $ip) {
			if (preg_match("#inet $last/\d+.*scope#", $ip)) $ipxe = false;
		}
	}
	Render::addTemplate('page-main', array('user' => User::getName(), 'ipxe' => $ipxe));
}