summaryrefslogblamecommitdiffstats
path: root/modules-available/main/page.inc.php
blob: b0d7d125a54ecd837a4969e0da54dc8c76be286b (plain) (tree)
1
2
3
4
5
6
7
8
9

     
                            
 



                                         
         


                                     
                                          


                                                                                                                 
                               
                 
                                 
                
                                                       

                                                  
                   


                                   
                                                               



                                                                                               


                                       
                                                    
         
 

                                   
                             


                                          
 
<?php

class Page_Main extends Page
{

	protected function doPreprocess()
	{
		User::load();
	}

	protected function doRender()
	{
		if (!User::isLoggedIn()) {
			Render::addTemplate('page-main-guest', array(
				'register' => (Database::queryFirst('SELECT userid FROM user LIMIT 1') === false)
			));
			return;
		}
		// Logged in here
		
		Render::addTemplate('page-main', array(
			'user' => User::getName(),
			'now' => time(),
		));

		// Warnings
		$needSetup = false;
		foreach (Hook::load('main-warning') as $hook) {
			if (Permission::moduleHasPermissions($hook->moduleId)
					&& User::hasPermission('.' . $hook->moduleId . '.*')) {
				include $hook->file;
			}
		}

		// Update warning state
		Property::setNeedsSetup($needSetup);
	}

	protected function doAjax()
	{
		User::load();
		die('Status: DB running');
	}

}