Beispiel #1
0
 public function action_delete()
 {
     if (Modul::hasAccess('user_delete') == false) {
         return '<div class="notice error">Sie haben keinen Zugriff</div>';
     }
     Routing::getInstance()->appendRender($this, "action_default");
     $query = $GLOBALS['pdo']->prepare("DELETE FROM users WHERE userID= :userID");
     $query->bindValue(':userID', $_GET['user'], PDO::PARAM_INT);
     $query->execute();
     return "<div class='notice success'>Benutzer wurde gelöscht</div>";
 }
Beispiel #2
0
 public function post_save()
 {
     if (isset($_SESSION['user']) == false) {
         return '<div class="error notice">Sie haben keinen Zugriff</div>';
     }
     $query = $GLOBALS['pdo']->prepare("UPDATE users SET name=:name, email=:email WHERE userID = :id");
     $query->bindValue(':email', $_POST['email'], PDO::PARAM_STR);
     $query->bindValue(':name', $_POST['name'], PDO::PARAM_STR);
     $query->bindValue(':id', $_SESSION['user']->id, PDO::PARAM_INT);
     $query->execute();
     Routing::getInstance()->appendRender($this, "action_default");
     return '<div class="success notice">Neue Daten gespeichert.</div>';
 }
Beispiel #3
0
 public function post_save()
 {
     if (Modul::hasAccess('system') == false) {
         return '<div class="notice error">Sie haben keinen Zugriff</div>';
     }
     Routing::getInstance()->appendRender($this, "action_default");
     $query = $GLOBALS['pdo']->prepare("UPDATE config SET `value`= :value WHERE `key`= :key");
     $query->bindParam(':value', $value, PDO::PARAM_STR);
     $query->bindParam(':key', $key, PDO::PARAM_STR);
     foreach ($_POST as $key => $value) {
         if (isset($GLOBALS['config'][$key])) {
             $query->execute();
             $GLOBALS['config'][$key] = $value;
         }
     }
     return "<div class='notice success'>Einstellungen gespeichert</div>";
 }
Beispiel #4
0
 public function action_stop()
 {
     Routing::getInstance()->appendRender($this, "action_default");
     $vm = new QemuVm($_GET['vmID']);
     if ($vm->isOwner()) {
         if ($vm->status == QemuMonitor::RUNNING) {
             try {
                 $vm->connect();
             } catch (Exception $e) {
                 $vm->setStatus(QemuMonitor::SHUTDOWN);
                 return "<div class='notice warning'>Die VM scheint bereits aus zu sein.</div>";
             }
             if (!isset($e)) {
                 $vm->shutdown();
                 return "<div class='notice success'>Die VM wird ausgeschaltet.</div>";
             }
         } else {
             return "<div class='notice warning'>Die VM scheint bereits aus zu sein.</div>";
         }
     } else {
         return "<div class='notice error'>Sie besitzen nicht die Rechte die VM zu stoppen</div>";
     }
 }
?>
                    <?php 
if (Security::getUser()) {
    ?>
                        <li>
                            <a href="<?php 
    echo Routing::getInstance()->getBaseUrl();
    ?>
/auth/logout">Logout</a>
                        </li>
                    <?php 
} else {
    ?>
                        <li>
                            <a href="<?php 
    echo Routing::getInstance()->getBaseUrl();
    ?>
/auth/login">Login</a>
                        </li>
                    <?php 
}
?>
                </ul>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span2">
                    <ul class="nav nav-list">
                        <li class="nav-header">Main Menu</li>
                        <li>
Beispiel #6
0
<?php

class Downloads extends Modul
{
    public function getHeader()
    {
        return "<h1>Downloads</h1>";
    }
    public function action_default()
    {
        $tmp2 = new RainTPL();
        return $tmp2->draw('downloads', true);
    }
}
Routing::getInstance()->addRouteByAction(new Downloads(), 'downloads', 'default');
Beispiel #7
0
<?php

include './config.php';
include './classes/Helper.class.php';
$GLOBALS['site'] = "start";
if (isset($_GET['site']) && is_string($_GET['site'])) {
    $name = basename(preg_replace('/[^(\\x20-\\x7F)]*/', '', $_GET['site']));
    if (file_exists('./module/' . $name . '.php')) {
        $GLOBALS['site'] = $name;
    }
}
Helper::loadClasses();
$GLOBALS['template'] = new raintpl();
raintpl::configure('tpl_dir', './templates/');
raintpl::configure('cache_dir', './cache/templates/');
include './module/' . $GLOBALS['site'] . '.php';
$content = Routing::getInstance()->render();
$GLOBALS['template']->assign('content', $content);
include './boxes/login.php';
include './boxes/status.php';
include './boxes/navigation.php';
include './boxes/ping.php';
$GLOBALS['template']->assign('box_news', file_get_contents('boxes/news.php'));
if (isset($GLOBALS['just_content']) && $GLOBALS['just_content'] == true) {
    $GLOBALS['template']->draw("index_just_content");
} else {
    $GLOBALS['template']->draw("index");
}
Beispiel #8
0
<?php

class Logout extends Modul
{
    public function getHeader()
    {
        return "<h1>Logout</h1>";
    }
    public function action_default()
    {
        if (isset($_SESSION['user'])) {
            unset($_SESSION['user']);
            session_destroy();
        }
        $tmp2 = new RainTPL();
        return $tmp2->draw('logout', true);
    }
}
Routing::getInstance()->addRouteByAction(new Logout(), 'logout', 'default');
Beispiel #9
0
 public function action_clone()
 {
     if (Modul::hasAccess('image_clone') == false) {
         return '<div class="notice error">Sie haben keinen Zugriff</div>';
     }
     Routing::getInstance()->appendRender($this, "action_default");
     $id = $_GET['image'];
     $query = $GLOBALS['pdo']->prepare("SELECT * FROM images WHERE imageID= :imageID");
     $query->bindValue(":imageID", $id, PDO::PARAM_INT);
     $query->execute();
     $data = $query->fetch();
     if ($data['type'] != "usb") {
         if (is_dir($data['path']) == false) {
             $query = $GLOBALS['pdo']->prepare("INSERT INTO images (name,type,shared) VALUES (:name, :type, :shared)");
             $query->bindValue(":name", $data['name'], PDO::PARAM_STR);
             $query->bindValue(":type", $data['type'], PDO::PARAM_STR);
             $query->bindValue(":shared", $data['shared'], PDO::PARAM_INT);
             $do = $query->execute();
             if ($do) {
                 $id = $GLOBALS['pdo']->lastInsertId();
                 $name = explode(".", $data['path'], 2);
                 $newname = $name[0] . "_" . $id . "." . $name[1];
                 $copy = copy($data['path'], $newname);
                 if ($copy) {
                     $query = $GLOBALS['pdo']->prepare("UPDATE images SET path=:path WHERE imageID=:imageID");
                     $query->bindValue(":imageID", $id, PDO::PARAM_INT);
                     $query->bindValue(":path", $newname, PDO::PARAM_STR);
                     $query->execute();
                     $content = '<div class="notice success">Datei erfolgreich geklont</div>';
                 } else {
                     $query = $GLOBALS['pdo']->prepare("DELETE FROM images WHERE imageID=:imageID");
                     $query->bindValue(":imageID", $id, PDO::PARAM_INT);
                     $query->execute();
                     $content = '<div class="notice error">Datei konnte nicht kopiert werden</div>';
                 }
             } else {
                 $content = '<div class="notice error">Fehler</div>';
             }
         } else {
             $content = '<div class="notice error">Ordner können nicht geklont werden.</div>';
         }
     } else {
         $content = '<div class="notice error">USB-Geräte können nicht geklont werden.</div>';
     }
     return $content;
 }
Beispiel #10
0
 public function action_delete()
 {
     if (Modul::hasAccess('vm_edit') == false) {
         return '<div class="notice error">Sie haben keinen Zugriff</div>';
     }
     $id = $_GET['vmID'];
     $query = $GLOBALS['pdo']->prepare("DELETE FROM vm WHERE vmID= :vmID");
     $query->bindValue(':vmID', $id, PDO::PARAM_INT);
     $query->execute();
     Routing::getInstance()->appendRender($this, "action_default");
     return "<div class='notice success'>VM gelöscht.</div><div class='notice'>Images existieren noch</div>";
 }
Beispiel #11
0
            if ($vm->isOwner()) {
                if ($vm->status == QemuMonitor::RUNNING) {
                    $content = ' <!--[if !IE]>-->
					<applet archive="tightvnc-jviewer.jar"
			code="com.glavsoft.viewer.Viewer"
			width="820" height="640">
					<param name="archive" value="tightvnc-jviewer.jar" />
					<param code="com.glavsoft.viewer.Viewer" />

					<param name="Host" value="10.11.12.1" />
					<param name="Port" value="' . $vm->vnc_port . '" />
					<param name="OpenNewWindow" value="no" />
					<param name="Password" value="' . $vm->password . '"> 
					<param name="ShowControls" value="yes" />
					<param name="AllowClipboardTransfer" value="yes" />
					<param name="JpegImageQuality" value="Lossless" />
					</applet>';
                } else {
                    $content = "<div class='notice warning'>Die VM scheint aus zu sein</div>";
                }
            } else {
                $content = "<div class='notice error'>Du hast keinen Zugriff auf diese VM</div>";
            }
        } else {
            $content = "<div class='notice warning'>Du musst eingeloggt sein</div>";
        }
        return $content;
    }
}
Routing::getInstance()->addRouteByAction(new VNC(), 'vnc', 'default');
Beispiel #12
0
<?php

include_once "./config/autoload.php";
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(dirname(__FILE__)) . DS . "\\");
// Contrôleur par défaut
define('DEFAULT_CONTROLLER', 'Accueil');
define('DEFAULT_FUNCTION', 'DefaultAction');
// Contrôleur en cas d'erreur
define('ERROR_CONTROLLER', 'Error');
define('ERROR_FUNCTION', 'Index');
define('DIR_CLASS', __DIR__ . '/application/controllers/');
define('DIR_MODEL', __DIR__ . '/application/models/');
define('DIR_VIEW', __DIR__ . '/application/views/');
define('DEFAULT_LANGUAGE', 'en');
define('DIR_LANGUAGE', __DIR__ . '/public/translations/');
/* ROUTING */
$_routing = Routing::getInstance();
$_routing->route();
//
Beispiel #13
0
<?php

class Start extends Modul
{
    public function getHeader()
    {
        return "<h1>Willkommen</h1>";
    }
    public function action_default()
    {
        $tmp2 = new RainTPL();
        return $tmp2->draw('start', true);
    }
}
Routing::getInstance()->addRouteByAction(new Start(), 'start', 'default');