示例#1
0
文件: api.php 项目: wAmpIre/netmon
 private function networklist()
 {
     if ($this->get_request_method() == "GET") {
         $this->_request['user_id'] = !isset($this->_request['user_id']) ? false : $this->_request['user_id'];
         $this->_request['ipv'] = !isset($this->_request['ipv']) ? false : $this->_request['ipv'];
         $networklist = new Networklist((int) $this->_request['user_id'], (int) $this->_request['ipv'], $this->_request['offset'], $this->_request['limit'], $this->_request['sort_by'], $this->_request['order']);
         $domxmldata = $networklist->getDomXMLElement($this->domxml);
         $this->response($this->finishxml($domxmldata), 200);
     } else {
         $this->error_code = 2;
         $this->error_message = "The Networklist could not be created, your request seems to be malformed.";
         $this->response($this->finishxml(), 400);
     }
 }
示例#2
0
文件: ip.php 项目: wAmpIre/netmon
<?php

require_once 'runtime.php';
require_once ROOT_DIR . '/lib/core/Ip.class.php';
require_once ROOT_DIR . '/lib/core/Networklist.class.php';
require_once ROOT_DIR . '/lib/core/Networkinterface.class.php';
require_once ROOT_DIR . '/lib/core/Router.class.php';
if ($_GET['section'] == 'add') {
    $networkinterface = new Networkinterface((int) $_GET['interface_id']);
    $networkinterface->fetch();
    if (permission::checkIfUserIsOwnerOrPermitted(PERM_ROOT, $networkinterface->getRouter()->getUserId())) {
        $smarty->assign('message', Message::getMessage());
        $smarty->assign('networkinterface', $networkinterface);
        $networklist = new Networklist();
        $smarty->assign('networklist', $networklist->getNetworklist());
        $router = new Router((int) $_GET['router_id']);
        $router->fetch();
        $smarty->assign('router', $router);
        $smarty->display("header.tpl.html");
        $smarty->display("ip_add.tpl.html");
        $smarty->display("footer.tpl.html");
    } else {
        Permission::denyAccess(PERM_ROOT, $networkinterface->getRouter()->getUserId());
    }
} elseif ($_GET['section'] == 'insert_add') {
    $networkinterface = new Networkinterface((int) $_GET['interface_id']);
    $networkinterface->fetch();
    if (permission::checkIfUserIsOwnerOrPermitted(PERM_ROOT, $networkinterface->getRouter()->getUserId())) {
        $ip = new Ip(false, (int) $_GET['interface_id'], (int) $_POST['network_id'], $_POST['ip']);
        if ($ip->store()) {
            $message[] = array('Die IP ' . $_POST['ip'] . ' wurde angelegt.', 1);