jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Application/] [Controllers/] [HomeController.php] - Rev 2

Compare with Previous - Blame - Download


<?php

namespace FreenetRouter\Controllers;

use FreenetRouter\Models\System\System;
use Phem\Environment\EnvironmentManager;

/**
 * @author Jakub PetrŞílka <petrzilka@czweb.net>
 */
class HomeController extends Controller
{
    public function showPage()
    {
        $this->getModel()->put("system", System::getInstance());
    }
    
    public function login($jmeno,$heslo)
    {
        $loginResult = null;
        $output = null;
        $session = EnvironmentManager::getSession();
        
        //exec('sudo web-auth '.$jmeno.' '.$heslo,$output,$loginResult);
        
        if ($jmeno == "root" && $heslo == "voyage") $loginResult = 0;
        
        if ($loginResult === 0)
        {
            $session->setVar("loggedUser", $jmeno);
        } 
        else 
        {
            $session->setVar("loggedUser", null);           
        }
        
        $this->redirectToController = "Home";
        $this->redirectToTask = "showPage";
    }
    
    public function logout()
    {
        $session = EnvironmentManager::getSession();
        $session->setVar("loggedUser", null);           
        
        $this->redirectToController = "Home";
        $this->redirectToTask = "showPage";        
    }    
    
    public function saveConfig()
    {
        $this->redirectToController = "Home";
        $this->redirectToTask = "showPage";        
    }    
    
    public function setWritable($writable)
    {
        System::getInstance()->setWriteEnabled($writable);
        
        $this->redirectToController = "Home";
        $this->redirectToTask = "showPage";        
    }
}

Powered by WebSVN 2.2.1