freenet-router |
Subversion Repositories: |
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";
}
}