Xen Orchestra

Sign in or create your account | Project List | Help

Xen Orchestra Git Source Tree

Root/htdocs/users.php

1<?php
2/**
3 * This file is a part of Xen Orchesrta.
4 *
5 * Xen Orchestra is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * Xen Orchestra is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Xen Orchestra. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package Xen Orchestra
19 * @license http://www.gnu.org/licenses/gpl-3.0-standalone.html GPLv3
20 **/
21
22require_once dirname (__FILE__) . '/../libs/prepend.php';
23?>
24<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
25  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
26<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
27<head>
28    <title>Xen Orchestra</title>
29
30    <script type="text/javascript" src="scripts/prototype.js"></script>
31    <script type="text/javascript" src="scripts/windows_js_1.3/javascripts/window.js"></script>
32    <script type="text/javascript" src="scripts/windows_js_1.3/javascripts/tooltip.js"></script>
33    <script type="text/javascript" src="scripts/scriptaculous.js"></script>
34    <script type="text/javascript" src="scripts/livepipe.js"></script>
35
36    <script type="text/javascript" src="scripts/md5.js"></script>
37
38    <script type="text/javascript" src="scripts/xo.js"></script>
39    <script type="text/javascript" src="scripts/xorender.js"></script>
40    <script type="text/javascript">
41    //<![CDATA[
42        document.observe('dom:loaded', function ()
43        {
44            init_static();
45        });
46    //]]>
47    </script>
48
49    <link rel="stylesheet" media="screen" type="text/css" href="styles/stylewhite.css" />
50    <link rel="stylesheet" media="screen" type="text/css" href="styles/alphacube.css" />
51    <link rel="stylesheet" media="screen" type="text/css" href="styles/spread.css" />
52    <link rel="stylesheet" media="screen" type="text/css" href="styles/default.css" />
53</head>
54
55<body>
56    <h1>
57        <a href=".">XenOrchestra</a>
58    </h1>
59
60    <ul class="menu1">
61        <li><a href="index.php"><b><img src="img/house.png" alt=""/>Home</b></a></li>
62        <li><a href="index.php"><b><img src="img/server.png" alt=""/>servers</b></a></li>
63        <li><a href="configuration.php"><b><img src="img/conf.png" alt=""/>Configuration</b></a></li>
64        <li><a href="index.php"><b><img src="img/vm.png" alt=""/>VM management</b></a></li>
65        <li><a href="users.php"><b><img src="img/user.png" alt=""/>User management</b></a></li>
66    <div id="login"></div></ul>
67    <div id="main">
68
69<?php
70
71$u = Model::get_current_user();
72
73if (!Database::is_enabled())
74{
75    echo '<p>/!\ The database is disabled : you cant manage users without enable database /!\</p>';
76    exit;
77}
78
79if ($u->name !== 'admin')
80{
81    echo '<p>You are a NOT an admin user, you can\'t do operations on users. Please login with an admin account.</p>';
82}
83else
84{
85    echo '<p>Here forms with CRUD operations on users. /!\ Work in progress /!\</p>';
86}
87
88
89/*
90if (!isset($_GET['a']))
91{
92    $msg = dom0s_json();
93    $msg->user = Model::get_current_user()->name;
94    echo $msg->user;
95
96    exit;
97}
98$msg = new MessengerJSON(true);
99
100if ($_GET['a'] === 'login')
101{
102    if (!isset($_GET['name']) || (($name = $_GET['name']) === ''))
103    {
104        $msg->error('Invalid name');
105        exit;
106    }
107
108    if (!Database::is_enabled())
109    {
110        $msg->error('The database is disabled');
111        exit;
112    }
113
114    $password = isset($_GET['password']) ? $_GET['password'] : '';
115    $u = Model::register_current_user($name, $password, true);
116    if ($u === false)
117    {
118        $msg->error('Incorrect username or password');
119    }
120    else
121    {
122        $msg->user = $u->name;
123    }
124}
125elseif ($_GET['a'] === 'logout')
126{
127    Model::unregister_current_user();
128
129    assert(Model::get_current_user()->name === 'guest');
130
131    $msg->user = 'guest';
132}*/
133?>
134
135    </div>
136</body>
137</html>
138

Archive Download this file