Compare commits
29 Commits
6d5d6e18f5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9436fe7c60 | |||
| b84ca3e4e4 | |||
| 79a944c0e3 | |||
| a1e314b00c | |||
| e169c19bd0 | |||
| d43842790a | |||
|
|
5d3bfbc491 | ||
| 72fe3d8335 | |||
| 3c461d4570 | |||
|
|
07678cacd4 | ||
| 625c246ba9 | |||
| 8aaf241075 | |||
| 68e726fae3 | |||
|
|
1dc3c4a557 | ||
|
|
cffcb3ea64 | ||
|
|
a8e21ef76c | ||
|
|
f868d991b1 | ||
|
|
a8e4ddb2e0 | ||
|
|
8ac143be27 | ||
|
|
f0399c9c9d | ||
| 6aee52c717 | |||
| 7e5d7d1d3c | |||
| a4e71a8992 | |||
|
|
0cde20881a | ||
|
|
31983b6803 | ||
|
|
1689989bd4 | ||
|
|
7d31e98713 | ||
|
|
50e9338059 | ||
|
|
6d0f7fb392 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
|||||||
inc/check_status
|
bin/check_status
|
||||||
|
|||||||
16
Makefile
Normal file
16
Makefile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
BINARY_NAME=check_status
|
||||||
|
GO_PRG=check_status.go
|
||||||
|
BIN_DIR=./bin
|
||||||
|
GO=/usr/local/go/bin/go
|
||||||
|
|
||||||
|
all: build test
|
||||||
|
|
||||||
|
build:
|
||||||
|
${GO} build -o ${BIN_DIR}/${BINARY_NAME} ${GO_PRG}
|
||||||
|
|
||||||
|
test:
|
||||||
|
${GO} test -v ${GO_PRG}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
${GO} clean
|
||||||
|
rm ${BIN_DIR}/${BINARY_NAME}
|
||||||
73
README.md
73
README.md
@@ -1,7 +1,7 @@
|
|||||||
# RemoteSupport
|
# RemoteSupport
|
||||||
GLPI Plugin for direct VNC connection inside ticket
|
GLPI Plugin for direct VNC connection from browser inside computer from server and update status of online computers, it checks computer with go program in glpi cron and with fusion inventory agent...
|
||||||
|
|
||||||
This Plugin add a simple button inside tickets:
|
This Plugin add a simple button inside computer:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -10,35 +10,60 @@ If user is correctly connected to one or more computer it will launch a VNC conn
|
|||||||
|
|
||||||
- Prerequisites
|
- Prerequisites
|
||||||
1) VNC Must be installed in the destination PC
|
1) VNC Must be installed in the destination PC
|
||||||
2) PC Name must me correct and resolved inside your DNS Server
|
2) Fusion inventory must be installed on server with GLPI
|
||||||
3) Add a script in your pc and add a node inside regedit
|
3) Agent must be installed on remote PC
|
||||||
|
4) Easy noVNC must be installed on server with GLPI
|
||||||
|
|
||||||
|
|
||||||
1) write a script (you will find inside resources) like this (let's assume in c:\startVNC.bat)
|
clone it and build binnary with make, edit Makefile in remotesupport plugin and build with make
|
||||||
> SET S=%1
|
|
||||||
>
|
|
||||||
> SET S=%S:~7,-2%
|
|
||||||
>
|
|
||||||
> call "C:\Program Files\TightVNC\tvnviewer.exe" %S%
|
|
||||||
>
|
|
||||||
> quit 0
|
|
||||||
|
|
||||||
2) Open regedit and add
|
Create systemd unit file:
|
||||||
Windows Registry Editor Version 5.00
|
|
||||||
```
|
```
|
||||||
[HKEY_CLASSES_ROOT\vnc]
|
[Unit]
|
||||||
@="URL:vnc Protocol"
|
Description=Easy NoVNC
|
||||||
"URL Protocol"=""
|
|
||||||
|
|
||||||
[HKEY_CLASSES_ROOT\vnc\shell]
|
[Service]
|
||||||
|
ExecStart=/usr/local/bin/easy-novnc -a :8888 -H -P
|
||||||
|
|
||||||
[HKEY_CLASSES_ROOT\vnc\shell\open]
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
[HKEY_CLASSES_ROOT\vnc\shell\open\command]
|
|
||||||
@="\"c:\\startVNC.bat\" \"%1\""
|
|
||||||
```
|
```
|
||||||
3) Download and install the plugin as usual
|
|
||||||
|
It will listen on 8888 port on local host.
|
||||||
|
|
||||||
|
|
||||||
TODO: a lot of documentation
|
Secure connection to server if you want, some ports are hardcoded in current status of plugin
|
||||||
|
```
|
||||||
|
<IfModule mod_ssl.c>
|
||||||
|
<VirtualHost *:443>
|
||||||
|
RewriteEngine On
|
||||||
|
ProxyPreserveHost On
|
||||||
|
ProxyRequests Off
|
||||||
|
|
||||||
|
# allow for upgrading to websockets
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
||||||
|
RewriteRule /(.*) ws://localhost:8888/$1 [P,L]
|
||||||
|
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
|
||||||
|
RewriteRule /glpi/(.*) http://localhost/glpi/$1 [P,L]
|
||||||
|
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
|
||||||
|
RewriteRule /(.*) http://localhost:8888/$1 [P,L]
|
||||||
|
|
||||||
|
ProxyPass "/" "http://localhost:8888/"
|
||||||
|
ProxyPassReverse "/" "http://localhost:8888/"
|
||||||
|
|
||||||
|
ProxyPass "/glpi/" "http://localhost/glpi/"
|
||||||
|
ProxyPassReverse "/glpi/" "http://localhost/glpi/"
|
||||||
|
|
||||||
|
ProxyPass "/vnc" "ws://localhost:8888/vnc"
|
||||||
|
ProxyPassReverse "/vnc" "ws://localhost:8888/vnc
|
||||||
|
|
||||||
|
|
||||||
|
ServerName server.name.lan
|
||||||
|
|
||||||
|
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||||
|
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
|
||||||
|
|
||||||
|
</VirtualHost>
|
||||||
|
</IfModule>
|
||||||
|
```
|
||||||
|
|||||||
4
bin/README.md
Normal file
4
bin/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Go program for remotesupport plugin
|
||||||
|
|
||||||
|
- binnary program for checking states of hosts
|
||||||
|
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"net/http"
|
"strconv"
|
||||||
"time"
|
"net/http"
|
||||||
|
"time"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
)
|
)
|
||||||
@@ -19,16 +20,13 @@ type result struct {
|
|||||||
|
|
||||||
type check struct {
|
type check struct {
|
||||||
// defining struct variables
|
// defining struct variables
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
Computers_id int `json:"computers_id"`
|
Computers_id int `json:"computers_id"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// boundedParallelGet sends requests in parallel but only up to a certain
|
|
||||||
// limit, and furthermore it's only parallel up to the amount of CPUs but
|
|
||||||
// is always concurrent up to the concurrency limit
|
|
||||||
func boundedParallelGet(Checks []check, concurrencyLimit int) []check {
|
func boundedParallelGet(Checks []check, concurrencyLimit int) []check {
|
||||||
|
|
||||||
// this buffered channel will block at the concurrency limit
|
// this buffered channel will block at the concurrency limit
|
||||||
@@ -59,13 +57,11 @@ func boundedParallelGet(Checks []check, concurrencyLimit int) []check {
|
|||||||
// along with the index so we can sort them later along with
|
// along with the index so we can sort them later along with
|
||||||
// any error that might have occoured
|
// any error that might have occoured
|
||||||
//fmt.Println(chck.Url)
|
//fmt.Println(chck.Url)
|
||||||
|
|
||||||
client := http.Client{
|
client := http.Client{
|
||||||
Timeout: 7 * time.Second,
|
Timeout: 7 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := client.Get(chck.Url)
|
res, err := client.Get(chck.Url)
|
||||||
|
|
||||||
status = 404
|
status = 404
|
||||||
if err == nil {
|
if err == nil {
|
||||||
status = res.StatusCode
|
status = res.StatusCode
|
||||||
@@ -109,36 +105,27 @@ func boundedParallelGet(Checks []check, concurrencyLimit int) []check {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// we'll use the init function to set up the benchmark
|
|
||||||
// by making a slice of 100 URLs to send requets to
|
|
||||||
var urls []string
|
|
||||||
var checks []check
|
var checks []check
|
||||||
var m = make(map[int]*check)
|
var m = make(map[int]*check)
|
||||||
func init() {
|
func init() {
|
||||||
|
|
||||||
bytes, _ := ioutil.ReadAll(os.Stdin)
|
bytes, _ := ioutil.ReadAll(os.Stdin)
|
||||||
json.Unmarshal(bytes , &checks)
|
json.Unmarshal(bytes , &checks)
|
||||||
for i := range checks {
|
for i := range checks {
|
||||||
m[checks[i].Id] = &checks[i]
|
m[checks[i].Id] = &checks[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// the main function sets up an anonymous benchmark func
|
|
||||||
// that will time how long it takes to get all the URLs
|
|
||||||
// at the specified concurrency level
|
|
||||||
//
|
|
||||||
// and you should see something like the following printed
|
|
||||||
// depending on how fast your computer and internet is
|
|
||||||
//
|
|
||||||
// 5 bounded parallel requests: 100/100 in 5.533223255
|
|
||||||
// 10 bounded parallel requests: 100/100 in 2.5115351219
|
|
||||||
// 25 bounded parallel requests: 100/100 in 1.189462884
|
|
||||||
// 50 bounded parallel requests: 100/100 in 1.17430002
|
|
||||||
// 75 bounded parallel requests: 100/100 in 1.001383863
|
|
||||||
// 100 bounded parallel requests: 100/100 in 1.3769354
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
// str_debug := os.Getenv("debug")
|
||||||
|
str_threads := os.Getenv("threads")
|
||||||
|
|
||||||
|
threads, _ := strconv.Atoi(str_threads)
|
||||||
|
// debug, _ := strconv.ParseBool(str_debug)
|
||||||
|
|
||||||
//startTime := time.Now()
|
//startTime := time.Now()
|
||||||
results := boundedParallelGet(checks, 100)
|
results := boundedParallelGet(checks, threads)
|
||||||
//seconds := time.Since(startTime).Seconds()
|
//seconds := time.Since(startTime).Seconds()
|
||||||
//tmplate := "requests: %d/%d in %v"
|
//tmplate := "requests: %d/%d in %v"
|
||||||
|
|
||||||
169
hook.php
169
hook.php
@@ -1,63 +1,136 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
Remote Spport (VNC)
|
Remote Spport (VNC)
|
||||||
Copyright (C) 2021 by Alessandro Carloni
|
Copyright (C) 2021 by Alessandro Carloni
|
||||||
https://github.com/Kaya84/RemoteSupport
|
https://github.com/Kaya84/RemoteSupport
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
LICENSE
|
LICENSE
|
||||||
This file is part of Camera Input.
|
This file is part of Camera Input.
|
||||||
Camera Input is free software; you can redistribute it and/or modify
|
Camera Input is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
Camera Input is distributed in the hope that it will be useful,
|
Camera Input is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Camera Input. If not, see <http://www.gnu.org/licenses/>.
|
along with Camera Input. If not, see <http://www.gnu.org/licenses/>.
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function plugin_remotesupport_install(){
|
function plugin_remotesupport_install()
|
||||||
return true;
|
{
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$config = new Config();
|
||||||
|
$config->setConfigurationValues('plugin:Remotesupport',
|
||||||
|
['run_mode' => 'None',
|
||||||
|
'threads' => 100,
|
||||||
|
'show_in_tickets' => true,
|
||||||
|
'show_in_computers' => true,
|
||||||
|
'easy_novnc' => true,
|
||||||
|
'fusion' => true]
|
||||||
|
);
|
||||||
|
|
||||||
|
Toolbox::logInFile("remotesupport", "Installing plugin");
|
||||||
|
$state_online = [
|
||||||
|
'name' => 'Online',
|
||||||
|
'entities_id' => 0,
|
||||||
|
'is_recursive' => 0,
|
||||||
|
'comment' => '',
|
||||||
|
'states_id' => 0,
|
||||||
|
'completename' => 'Online',
|
||||||
|
'level' => 1,
|
||||||
|
'ancestors_cache' => '[]',
|
||||||
|
'sons_cache' => 'NULL',
|
||||||
|
'is_visible_computer' => 1,
|
||||||
|
'is_visible_monitor' => 0,
|
||||||
|
'is_visible_networkequipment' => 0,
|
||||||
|
'is_visible_peripheral' => 0,
|
||||||
|
'is_visible_phone' => 0,
|
||||||
|
'is_visible_printer' => 0,
|
||||||
|
'is_visible_softwareversion' => 0,
|
||||||
|
'is_visible_softwarelicense' => 0,
|
||||||
|
'is_visible_line' => 0,
|
||||||
|
'is_visible_certificate' => 0,
|
||||||
|
'is_visible_rack' => 0,
|
||||||
|
'is_visible_passivedcequipment' => 0,
|
||||||
|
'is_visible_enclosure' => 0,
|
||||||
|
'is_visible_pdu' => 0,
|
||||||
|
'is_visible_cluster' => 0,
|
||||||
|
'is_visible_contract' => 0,
|
||||||
|
'is_visible_appliance' => 0];
|
||||||
|
|
||||||
|
$ret = $DB->insert(
|
||||||
|
'glpi_states', $state_online
|
||||||
|
);
|
||||||
|
|
||||||
|
$state_offline = $state_online;
|
||||||
|
$state_offline["name"] = 'Offline';
|
||||||
|
$state_offline["completename"] = 'Offline';
|
||||||
|
|
||||||
|
$ret = $DB->insert(
|
||||||
|
'glpi_states', $state_offline
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_remotesupport_uninstall(){
|
function plugin_remotesupport_uninstall()
|
||||||
return true;
|
{
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
Toolbox::logInFile("remotsupport", "Uninstalling plugin");
|
||||||
|
CronTask::Unregister('remotesupport');
|
||||||
|
|
||||||
|
$req = $DB->request('glpi_states', ['FIELDS' => ['glpi_states' => ['id', 'name']]], ['OR' => ['name' => 'Online', 'name' => 'Offline']]);
|
||||||
|
|
||||||
|
$ret = $req->next();
|
||||||
|
$states_ids[$ret['name']] = $ret['id'];
|
||||||
|
$ret = $req->next();
|
||||||
|
$states_ids[$ret['name']] = $ret['id'];
|
||||||
|
|
||||||
|
$DB->query('UPDATE glpi_computers SET states_id=NULL WHERE id=' . $states_ids["Offline"]);
|
||||||
|
$DB->query('UPDATE glpi_computers SET states_id=NULL WHERE id=' . $states_ids["Online"]);
|
||||||
|
$DB->query('DELETE FROM glpi_states WHERE id=' . $states_ids["Offline"]);
|
||||||
|
$DB->query('DELETE FROM glpi_states WHERE id=' . $states_ids["Online"]);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_remotesupport_postinit() {
|
function plugin_remotesupport_postinit()
|
||||||
global $CFG_GLPI, $DB;
|
{
|
||||||
|
global $CFG_GLPI, $DB;
|
||||||
|
$config = Config::getConfigurationValues('plugin:Remotesupport');
|
||||||
|
|
||||||
if(isset($_GET['id']) && $_GET['id'] != 0 && isset($_GET['_itemtype']) && $_GET['_itemtype'] == "Ticket"){
|
if (isset($_GET['id']) && $_GET['id'] != 0 && isset($_GET['_itemtype']) && $_GET['_itemtype'] == "Ticket" && $config["show_in_tickets"]) {
|
||||||
$id = $_GET['id'];
|
$id = $_GET['id'];
|
||||||
|
|
||||||
//mysql> select * from glpi_tickets_users where tickets_id = 2 and type = 1;
|
//mysql> select * from glpi_tickets_users where tickets_id = 2 and type = 1;
|
||||||
|
|
||||||
$req = $DB->request(['FROM' => 'glpi_tickets_users', 'WHERE' => ['tickets_id' => $id, 'type' => 1]]);
|
$req = $DB->request(['FROM' => 'glpi_tickets_users', 'WHERE' => ['tickets_id' => $id, 'type' => 1]]);
|
||||||
//NB: Estraggo unicamente il primo richiedente
|
//NB: Estraggo unicamente il primo richiedente
|
||||||
$row = $req->next();
|
$row = $req->next();
|
||||||
$requester = $row['users_id'];
|
$requester = $row['users_id'];
|
||||||
// select id, name, users_id from glpi_computers where users_id = 178;
|
// select id, name, users_id from glpi_computers where users_id = 178;
|
||||||
|
|
||||||
if ($row['users_id'] != 0) {
|
if ($row['users_id'] != 0) {
|
||||||
$req2 = $DB->request(['FROM' => 'glpi_computers', 'WHERE' => ['users_id' => $requester, 'is_deleted' => 0]]);
|
$req2 = $DB->request(['FROM' => 'glpi_computers', 'WHERE' => ['users_id' => $requester, 'is_deleted' => 0]]);
|
||||||
$url = "";
|
$url = "";
|
||||||
|
|
||||||
while ($row2 = $req2->next()){
|
while ($row2 = $req2->next()) {
|
||||||
//$url .= "<li class=\"document\" onclick=\"location.href='vnc://" . $row2['name'] ."'\"$
|
//$url .= "<li class=\"document\" onclick=\"location.href='vnc://" . $row2['name'] ."'\"$
|
||||||
$url .= "<li class=\"document\" onclick=\"location.href='vnc://" . $row2['name'] ."'\"><i class=\"fa fa-laptop-medical\"></i>" . $row2['name'] . "</li>";
|
$url .= "<li class=\"document\" onclick=\"location.href='vnc://" . $row2['name'] . "'\"><i class=\"fa fa-laptop-medical\"></i>" . $row2['name'] . "</li>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($url != ""){
|
if ($url != "") {
|
||||||
echo "<div><ul class=\"timeline_choices\"><h2>Remote support : </h2>";
|
echo "<div><ul class=\"timeline_choices\"><h2>Remote support : </h2>";
|
||||||
echo $url;
|
echo $url;
|
||||||
echo "</ul></div>";
|
echo "</ul></div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
1
inc/.gitigonre
Normal file
1
inc/.gitigonre
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bin/check_status
|
||||||
112
inc/config.class.php
Normal file
112
inc/config.class.php
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @version $Id$
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
Copyright (C) 2003-2011 by the INDEPNET Development Team.
|
||||||
|
http://indepnet.net/ http://glpi-project.org
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
LICENSE
|
||||||
|
This file is part of GLPI.
|
||||||
|
GLPI is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
GLPI is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class PluginRemotesupportConfig extends CommonDBTM {
|
||||||
|
|
||||||
|
static protected $notable = true;
|
||||||
|
|
||||||
|
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||||
|
|
||||||
|
if (!$withtemplate) {
|
||||||
|
if ($item->getType() == 'Config') {
|
||||||
|
return __('Remote Support plugin');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
static function configUpdate($input) {
|
||||||
|
$input['configuration'] = 1 - $input['configuration'];
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFormRemotesupport() {
|
||||||
|
global $CFG_GLPI;
|
||||||
|
|
||||||
|
if (!Session::haveRight("config", UPDATE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$my_config = Config::getConfigurationValues('plugin:Remotesupport');
|
||||||
|
|
||||||
|
echo "<form name='form' action=\"".Toolbox::getItemTypeFormURL('Config')."\" method='post'>";
|
||||||
|
echo "<div class='center' id='tabsbody'>";
|
||||||
|
echo "<table class='tab_cadre_fixe'>";
|
||||||
|
echo "<input type='hidden' name='config_class' value='".__CLASS__."'>";
|
||||||
|
echo "<input type='hidden' name='config_context' value='plugin:Remotesupport'>";
|
||||||
|
echo "<tr><th colspan='4'>" . __('Remote support setup') . "</th></tr>";
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td >" . __('Run Mode:') . "</td>";
|
||||||
|
echo "<td>";
|
||||||
|
Dropdown::showFromArray('run_mode', array('None' => __('None'),'Serial'=>__('Serial'),'Parallel' => __('Parallel')), array('value' => $my_config['run_mode']));
|
||||||
|
echo "</td>";
|
||||||
|
echo "<td >" . __('EasyNoVNC Installed:') . "</td>";
|
||||||
|
echo "<td>";
|
||||||
|
Dropdown::showYesNo("easy_novnc", $my_config['easy_novnc']);
|
||||||
|
echo "</td></tr>";
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td >" . __('Show in Computers:') . "</td>";
|
||||||
|
echo "<td>";
|
||||||
|
Dropdown::showYesNo("show_in_computers", $my_config['show_in_computers']);
|
||||||
|
echo "</td>";
|
||||||
|
echo "<td >" . __('Show in Tickets:') . "</td>";
|
||||||
|
echo "<td>";
|
||||||
|
Dropdown::showYesNo("show_in_tickets", $my_config['show_in_tickets']);
|
||||||
|
echo "</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td >" . __('Threads:') . "</td>";
|
||||||
|
echo "<td>";
|
||||||
|
Dropdown::showNumber("threads",
|
||||||
|
[
|
||||||
|
'value' => 100,
|
||||||
|
'min' => 1,
|
||||||
|
'max' => 100
|
||||||
|
]);
|
||||||
|
echo "</td>";
|
||||||
|
echo "<td >" . __('Fusion inventory:') . "</td>";
|
||||||
|
echo "<td>";
|
||||||
|
Dropdown::showYesNo("fusion", $my_config['fusion']);
|
||||||
|
echo "</td>";
|
||||||
|
|
||||||
|
echo "</tr>";
|
||||||
|
|
||||||
|
echo "<tr class='tab_bg_2'>";
|
||||||
|
echo "<td colspan='4' class='center'>";
|
||||||
|
echo "<input type='submit' name='update' class='submit' value=\""._sx('button', 'Save')."\">";
|
||||||
|
echo "</td></tr>";
|
||||||
|
|
||||||
|
echo "</table></div>";
|
||||||
|
Html::closeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||||
|
|
||||||
|
if ($item->getType() == 'Config') {
|
||||||
|
$config = new self();
|
||||||
|
$config->showFormRemotesupport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,79 +1,45 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
include "../../../inc/includes.php";
|
||||||
------------------------------------------------------------------------
|
|
||||||
FusionInventory
|
|
||||||
Copyright (C) 2010-2011 by the FusionInventory Development Team.
|
|
||||||
|
|
||||||
http://www.fusioninventory.org/ http://forge.fusioninventory.org/
|
declare (ticks = 1);
|
||||||
------------------------------------------------------------------------
|
|
||||||
|
|
||||||
LICENSE
|
global $DB, $agents;
|
||||||
|
|
||||||
This file is part of FusionInventory project.
|
$check_arr = [];
|
||||||
|
$comps = [];
|
||||||
|
|
||||||
FusionInventory is free software: you can redistribute it and/or modify
|
$rs_path = Plugin::getPhpDir('remotesupport');
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
FusionInventory is distributed in the hope that it will be useful,
|
$pfConfig = new PluginFusioninventoryConfig();
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
$port = $pfConfig->getValue('agent_port');
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
|
||||||
along with FusionInventory. If not, see <http://www.gnu.org/licenses/>.
|
foreach (getAllDataFromTable(PluginFusioninventoryAgent::getTable()) as $a) {
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
$check = [];
|
||||||
|
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($a["computers_id"]);
|
||||||
|
|
||||||
@package FusionInventory
|
$check["url"] = "http://" . $a_computerextend["remote_addr"] . ":" . $port . "/status";
|
||||||
@author Walid Nouh
|
$check["id"] = $a["id"];
|
||||||
@co-author
|
$check["computers_id"] = $a["computers_id"];
|
||||||
@copyright Copyright (c) 2010-2011 FusionInventory team
|
$check["status"] = "unknown";
|
||||||
@license AGPL License 3.0 or (at your option) any later version
|
|
||||||
http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
|
||||||
@link http://www.fusioninventory.org/
|
|
||||||
@link http://forge.fusioninventory.org/projects/fusioninventory-for-glpi/
|
|
||||||
@since 2010
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
$check_arr[] = $check;
|
||||||
*/
|
$comps[$a["computers_id"]] = $check;
|
||||||
|
//print_r($agent->getAgentStatusURLs());
|
||||||
include ("../../../inc/includes.php");
|
|
||||||
|
|
||||||
declare(ticks=1);
|
|
||||||
|
|
||||||
|
|
||||||
global $DB,$agents;
|
|
||||||
|
|
||||||
$check_arr = [];
|
|
||||||
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
|
|
||||||
foreach (getAllDataFromTable(PluginFusioninventoryAgent::getTable()) as $a) {
|
|
||||||
|
|
||||||
$check = [];
|
|
||||||
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($a["computers_id"]);
|
|
||||||
|
|
||||||
$check["url"] = "http://".$a_computerextend["remote_addr"].":62354/status";
|
|
||||||
$check["id"] = $a["id"];
|
|
||||||
$check["computers_id"] = $a["computers_id"];
|
|
||||||
$check["status"] = "unknown";
|
|
||||||
|
|
||||||
$check_arr[] = $check;
|
|
||||||
//print_r($agent->getAgentStatusURLs());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$descriptorspec = array(
|
$descriptorspec = array(
|
||||||
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
|
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
|
||||||
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
|
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
|
||||||
2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
|
2 => array("file", "/tmp/error-output.txt", "a"), // stderr is a file to write to
|
||||||
);
|
);
|
||||||
|
|
||||||
$cwd = '/tmp';
|
$cwd = '/tmp';
|
||||||
$env = array('debug' => 'false');
|
$env = array('debug' => 'false', 'threads' => 100);
|
||||||
|
|
||||||
$process = proc_open(__DIR__.'/bench_urls', $descriptorspec, $pipes, $cwd, $env);
|
$process = proc_open($rs_path . '/bin/check_status', $descriptorspec, $pipes, $cwd, $env);
|
||||||
|
|
||||||
if (is_resource($process)) {
|
if (is_resource($process)) {
|
||||||
// $pipes now looks like this:
|
// $pipes now looks like this:
|
||||||
@@ -94,25 +60,29 @@ if (is_resource($process)) {
|
|||||||
echo "command returned $return_value\n";
|
echo "command returned $return_value\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->update("glpi_computers", [
|
$req = $DB->request('glpi_states', ['FIELDS' => ['glpi_states' => ['id', 'name']]], ['OR' => ['name' => 'Online', 'name' => 'Offline']]);
|
||||||
'states_id' => NULL ] ,
|
|
||||||
[ '1' => '1' ]
|
|
||||||
);
|
|
||||||
|
|
||||||
|
$ret = $req->next();
|
||||||
|
$states_ids[$ret['name']] = $ret['id'];
|
||||||
|
$ret = $req->next();
|
||||||
|
$states_ids[$ret['name']] = $ret['id'];
|
||||||
|
print_r($states_ids);
|
||||||
|
|
||||||
|
$DB->update("glpi_computers", [
|
||||||
|
'states_id' => $states_ids["Offline"] ] ,
|
||||||
|
[ '1' => '1' ]
|
||||||
|
);
|
||||||
|
|
||||||
|
$ids = [];
|
||||||
foreach ($checked as $s) {
|
foreach ($checked as $s) {
|
||||||
echo $s->computers_id." ";
|
echo $s->computers_id."\n";
|
||||||
|
$ids[] = $s->computers_id;
|
||||||
$comp = new Computer();
|
|
||||||
$comp->getFromDB($s->computers_id);
|
|
||||||
$comp->fields["states_id"] = 2;
|
|
||||||
$DB->update("glpi_computers", [
|
|
||||||
'states_id' => $comp->fields["states_id"] ],
|
|
||||||
[ 'id' => $s->computers_id ]
|
|
||||||
);
|
|
||||||
echo $comp->fields["contact"]."\n";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// print_r($a_computerextend);
|
$DB->update("glpi_computers", [
|
||||||
|
'states_id' => $states_ids["Online"] ],
|
||||||
|
[ 'id' => $ids ]
|
||||||
|
);
|
||||||
|
|
||||||
|
// print_r($a_computerextend);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
@@ -1,89 +1,222 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('GLPI_ROOT')) {
|
if (!defined('GLPI_ROOT')) {
|
||||||
die("Sorry. You can't access directly to this file");
|
die("Sorry. You can't access directly to this file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PluginRemotesupportRemotesupport extends CommonDBTM
|
||||||
|
{
|
||||||
|
public static function showInfo($item)
|
||||||
|
{
|
||||||
|
|
||||||
|
$config = Config::getConfigurationValues('plugin:Remotesupport');
|
||||||
|
|
||||||
class PluginRemotesupportRemotesupport extends CommonDBTM {
|
if ($config["show_in_computers"] == false) {
|
||||||
static function showInfo($item) {
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$fi_path = Plugin::getWebDir('fusioninventory');
|
$statusids = self::getStatusArray();
|
||||||
|
|
||||||
// Manage locks pictures
|
if ($config["fusion"] == true && $config["easy_novnc"] == true) {
|
||||||
PluginFusioninventoryLock::showLockIcon('Computer');
|
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
|
||||||
|
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($item->getID());
|
||||||
|
if (empty($a_computerextend)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
|
$href = "https://" . $_SERVER['SERVER_NAME'] . "/vnc.html?path=vnc%2F" . $a_computerextend['remote_addr'] . "&autoconnect=true&resize=scale&reconnect=true&show_dot=true";
|
||||||
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($item->getID());
|
$name = $a_computerextend['remote_addr'];
|
||||||
if (empty($a_computerextend)) {
|
} else {
|
||||||
return true;
|
$href = "vnc://" . $item->fields["name"];
|
||||||
}
|
$name = $item->fields["name"];
|
||||||
|
}
|
||||||
|
echo '<table class="tab_glpi" width="100%">';
|
||||||
|
echo '<tr>';
|
||||||
|
echo '<th>' . __('Remote Support') . '</th>';
|
||||||
|
echo '</tr>';
|
||||||
|
echo '<tr class="tab_bg_1">';
|
||||||
|
echo '<td>';
|
||||||
|
|
||||||
echo '<table class="tab_glpi" width="100%">';
|
$style = $statusids[$item->getID()] == "Offline" ? "style=\"background-color: red\"" : "";
|
||||||
echo '<tr>';
|
$url = "<a target=\"_blank\" href=\"" . $href . "\"><li class=\"document\" ". $style ."><i class=\"fa fa-laptop-medical\"></i>" . $name . "</li></a>";
|
||||||
echo '<th>'.__('Remote Support').'</th>';
|
|
||||||
echo '</tr>';
|
|
||||||
echo '<tr class="tab_bg_1">';
|
|
||||||
echo '<td>';
|
|
||||||
|
|
||||||
$url = "<a target=\"_blank\" href=\"https://" . $_SERVER['SERVER_ADDR']. "/vnc.html?path=vnc%2F". $a_computerextend['remote_addr'] ."&autoconnect=true&resize=scale&reconnect=true&show_dot=true\"><li class=\"document\"><i class=\"fa fa-laptop-medical\"></i>" . $a_computerextend['remote_addr'] . "</li></a>";
|
if ($url != "") {
|
||||||
|
|
||||||
if ($url != ""){
|
|
||||||
echo "<div><ul class=\"timeline_choices\"><h2>VNC connect : </h2>";
|
echo "<div><ul class=\"timeline_choices\"><h2>VNC connect : </h2>";
|
||||||
echo $url;
|
echo $url;
|
||||||
echo "</ul></div>";
|
echo "</ul></div>";
|
||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getStatesIds()
|
||||||
|
{
|
||||||
|
global $DB;
|
||||||
|
|
||||||
static function cronRemotesupport($task) {
|
$states_ids = [];
|
||||||
global $DB;
|
|
||||||
|
|
||||||
Toolbox::logInFile("remotsupport","Starting search of agents\n");
|
$req = $DB->request('glpi_states', ['FIELDS' => ['glpi_states' => ['id', 'name']]], ['OR' => ['name' => 'Online', 'name' => 'Offline']]);
|
||||||
|
|
||||||
$agents = [];
|
$ret = $req->next();
|
||||||
$data_set = [];
|
$states_ids[$ret['name']] = $ret['id'];
|
||||||
|
$ret = $req->next();
|
||||||
|
$states_ids[$ret['name']] = $ret['id'];
|
||||||
|
|
||||||
foreach (getAllDataFromTable(PluginFusioninventoryAgent::getTable()) as $a) {
|
return $states_ids;
|
||||||
|
}
|
||||||
|
|
||||||
$data_set[] = $a["id"];
|
public static function getContactArray()
|
||||||
$agents[$a["id"]] = $a;
|
{
|
||||||
}
|
global $DB;
|
||||||
|
|
||||||
|
$req = $DB->request('glpi_computers', ['FIELDS' => ['glpi_computers' => ['id', 'contact']]]);
|
||||||
|
|
||||||
foreach ($data_set as $id) {
|
$contactids = [];
|
||||||
$agent = new PluginFusioninventoryAgent;
|
while ($ret = $req->next()) {
|
||||||
$agent->getFromDB((int)$id);
|
$contactids[$ret["id"]] = $ret["contact"];
|
||||||
$st = $agent->getStatus();
|
}
|
||||||
|
|
||||||
if ($st["message"] != "noanswer")
|
return $contactids;
|
||||||
Toolbox::logInFile("remotsupport",print_r($agents[$id],true));
|
}
|
||||||
|
|
||||||
$comp = new Computer();
|
public static function getStatusArray()
|
||||||
$comp->getFromDB($agents[$id]["computers_id"]);
|
{
|
||||||
if ($st["message"] == "noanswer")
|
global $DB;
|
||||||
$comp->fields["states_id"] = NULL;
|
|
||||||
else
|
|
||||||
$comp->fields["states_id"] = 2;
|
|
||||||
$DB->update("glpi_computers", [
|
|
||||||
'states_id' => $comp->fields["states_id"] ],
|
|
||||||
[ 'id' => $agents[$id]["computers_id"] ]
|
|
||||||
);
|
|
||||||
$comp->fields["contact"]."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$st = self::getStatesIds();
|
||||||
|
|
||||||
|
$req = $DB->request('glpi_computers', ['FIELDS' => ['glpi_computers' => ['id', 'states_id']]]);
|
||||||
|
|
||||||
return true;
|
$statusids = [];
|
||||||
}
|
while ($ret = $req->next()) {
|
||||||
|
$statusids[$ret["id"]] = $ret["states_id"] == $st["Offline"] ? "Offline" : "Online";
|
||||||
|
}
|
||||||
|
|
||||||
static function cronInfo($name) {
|
return $statusids;
|
||||||
return [
|
}
|
||||||
'description' => "Agent search remotesupport"];
|
|
||||||
}
|
public static function cronRemotesupport($task)
|
||||||
|
{
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$config = Config::getConfigurationValues('plugin:Remotesupport');
|
||||||
|
|
||||||
|
if ($config["fusion"] == false || $config["run_mode"] == "None") {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Toolbox::logInFile("remotesupport", "Starting search of agents\n");
|
||||||
|
|
||||||
|
if ($config["run_mode"] == "Parallel") {
|
||||||
|
$pfConfig = new PluginFusioninventoryConfig();
|
||||||
|
$port = $pfConfig->getValue('agent_port');
|
||||||
|
$rs_path = Plugin::getPhpDir('remotesupport');
|
||||||
|
|
||||||
|
$check_arr = [];
|
||||||
|
$comps = [];
|
||||||
|
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
|
||||||
|
foreach (getAllDataFromTable(PluginFusioninventoryAgent::getTable()) as $a) {
|
||||||
|
|
||||||
|
$check = [];
|
||||||
|
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($a["computers_id"]);
|
||||||
|
|
||||||
|
$check["url"] = "http://" . $a_computerextend["remote_addr"] . ":" . $port . "/status";
|
||||||
|
$check["id"] = $a["id"];
|
||||||
|
$check["computers_id"] = $a["computers_id"];
|
||||||
|
$check["status"] = "unknown";
|
||||||
|
|
||||||
|
$check_arr[] = $check;
|
||||||
|
$comps[$a["computers_id"]] = $check;
|
||||||
|
//print_r($agent->getAgentStatusURLs());
|
||||||
|
}
|
||||||
|
|
||||||
|
$descriptorspec = array(
|
||||||
|
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
|
||||||
|
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
|
||||||
|
2 => array("file", "/tmp/error-output.txt", "a"), // stderr is a file to write to
|
||||||
|
);
|
||||||
|
|
||||||
|
$cwd = '/tmp';
|
||||||
|
$env = array('debug' => 'false', 'threads' => $config["threads"]);
|
||||||
|
|
||||||
|
$process = proc_open($rs_path . '/bin/check_status', $descriptorspec, $pipes, $cwd, $env);
|
||||||
|
|
||||||
|
if (is_resource($process)) {
|
||||||
|
// $pipes now looks like this:
|
||||||
|
// 0 => writeable handle connected to child stdin
|
||||||
|
// 1 => readable handle connected to child stdout
|
||||||
|
// Any error output will be appended to /tmp/error-output.txt
|
||||||
|
|
||||||
|
fwrite($pipes[0], json_encode($check_arr));
|
||||||
|
fclose($pipes[0]);
|
||||||
|
|
||||||
|
$checked = json_decode(stream_get_contents($pipes[1]));
|
||||||
|
fclose($pipes[1]);
|
||||||
|
|
||||||
|
// It is important that you close any pipes before calling
|
||||||
|
// proc_close in order to avoid a deadlock
|
||||||
|
$return_value = proc_close($process);
|
||||||
|
|
||||||
|
Toolbox::logInFile("remotesupport", "command returned $return_value\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$agents = [];
|
||||||
|
$data_set = [];
|
||||||
|
$checked = [];
|
||||||
|
|
||||||
|
foreach (getAllDataFromTable(PluginFusioninventoryAgent::getTable()) as $a) {
|
||||||
|
|
||||||
|
$data_set[] = $a["id"];
|
||||||
|
$agents[$a["id"]] = $a;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($data_set as $id) {
|
||||||
|
$agent = new PluginFusioninventoryAgent;
|
||||||
|
$agent->getFromDB((int) $id);
|
||||||
|
$st = $agent->getStatus();
|
||||||
|
|
||||||
|
if ($st["message"] != "noanswer") {
|
||||||
|
$check = new stdClass();
|
||||||
|
$check->computers_id = $agents[$id]["computers_id"];
|
||||||
|
$checked[] = $check;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$stids = self::getStatesIds();
|
||||||
|
|
||||||
|
$DB->update("glpi_computers", [
|
||||||
|
'states_id' => $stids["Offline"]],
|
||||||
|
['1' => '1']
|
||||||
|
);
|
||||||
|
|
||||||
|
$ids = [];
|
||||||
|
$cids = self::getContactArray();
|
||||||
|
|
||||||
|
foreach ($checked as $s) {
|
||||||
|
|
||||||
|
$comp = new Computer();
|
||||||
|
$comp->getFromDB($s->computers_id);
|
||||||
|
Toolbox::logInFile("remotesupport", $s->computers_id . " " . $cids[$s->computers_id] . "\n");
|
||||||
|
$ids[] = $s->computers_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$DB->update("glpi_computers", [
|
||||||
|
'states_id' => $stids["Online"]],
|
||||||
|
['id' => $ids]
|
||||||
|
);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function cronInfo($name)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'description' => __('Agent search remotesupport')];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
</authors>
|
</authors>
|
||||||
<versions>
|
<versions>
|
||||||
<version>
|
<version>
|
||||||
<num>0.0.1</num>
|
<num>0.0.2</num>
|
||||||
<compatibility>~9.5.0</compatibility>
|
<compatibility>~9.5.0</compatibility>
|
||||||
</version>
|
</version>
|
||||||
</versions>
|
</versions>
|
||||||
|
|||||||
98
setup.php
98
setup.php
@@ -1,25 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
Remote Spport (VNC)
|
Remote Spport (VNC)
|
||||||
Copyright (C) 2021 by Alessandro Carloni
|
Copyright (C) 2021 by Alessandro Carloni
|
||||||
https://github.com/Kaya84/RemoteSupport
|
https://github.com/Kaya84/RemoteSupport
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
LICENSE
|
LICENSE
|
||||||
This file is part of Camera Input.
|
This file is part of Camera Input.
|
||||||
Camera Input is free software; you can redistribute it and/or modify
|
Camera Input is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
Camera Input is distributed in the hope that it will be useful,
|
Camera Input is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Camera Input. If not, see <http://www.gnu.org/licenses/>.
|
along with Camera Input. If not, see <http://www.gnu.org/licenses/>.
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('PLUGIN_REMOTESUPPORT_VERSION', '0.0.1');
|
define('PLUGIN_REMOTESUPPORT_VERSION', '0.0.1');
|
||||||
define('PLUGIN_REMOTESUPPORT_MIN_GLPI', '9.5.0');
|
define('PLUGIN_REMOTESUPPORT_MIN_GLPI', '9.5.0');
|
||||||
@@ -28,48 +28,40 @@ define("PLUGIN_REMOTESUPPORT_DIR", GLPI_ROOT . "/plugins/remotesupport");
|
|||||||
|
|
||||||
function plugin_init_remotesupport()
|
function plugin_init_remotesupport()
|
||||||
{
|
{
|
||||||
global $PLUGIN_HOOKS;
|
global $PLUGIN_HOOKS;
|
||||||
$PLUGIN_HOOKS['csrf_compliant']['remotesupport'] = true;
|
$PLUGIN_HOOKS['csrf_compliant']['remotesupport'] = true;
|
||||||
|
|
||||||
if (Plugin::isPluginActive('remotesupport')) {
|
if (Plugin::isPluginActive('remotesupport')) {
|
||||||
|
|
||||||
// $PLUGIN_HOOKS['add_javascript']['remotesupport'][] = 'js/support.js';
|
$PLUGIN_HOOKS['autoinventory_information']['remotesupport'] = array(
|
||||||
|
'Computer' => array('PluginRemotesupportRemotesupport', 'showInfo'),
|
||||||
|
);
|
||||||
|
|
||||||
$PLUGIN_HOOKS['autoinventory_information']['remotesupport'] = array(
|
Plugin::registerClass('PluginRemotesupportConfig', ['addtabon' => 'Config']);
|
||||||
'Computer' => array('PluginRemotesupportRemotesupport', 'showInfo')
|
|
||||||
);
|
|
||||||
|
|
||||||
CronTask::Register('PluginRemotesupportRemotesupport', 'remotesupport', 300,
|
CronTask::Register('PluginRemotesupportRemotesupport', 'remotesupport', 300,
|
||||||
['mode'=>2, 'allowmode'=>3, 'logs_lifetime'=>30,
|
['mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30,
|
||||||
'comment'=> 'Remotesupport crontab search agents']);
|
'comment' => 'Remotesupport crontab search agents']);
|
||||||
|
|
||||||
|
$PLUGIN_HOOKS['menu']['remotesupport'] = true;
|
||||||
|
$PLUGIN_HOOKS['post_init']['remotesupport'] = 'plugin_remotesupport_postinit';
|
||||||
|
|
||||||
// Add Config Page
|
}
|
||||||
// Plugin::registerClass('PluginRemotesupportConfig', ['addtabon' => 'Config']);
|
|
||||||
|
|
||||||
// $PLUGIN_HOOKS["menu_toadd"]['remotesupport'] = ['tools' => 'PluginRemotesupportMenu'];
|
|
||||||
// $PLUGIN_HOOKS['config_page']['remotesupport'] = 'front/index.php';
|
|
||||||
$PLUGIN_HOOKS['menu']['remotesupport'] = true;
|
|
||||||
$PLUGIN_HOOKS['post_init']['remotesupport'] = 'plugin_remotesupport_postinit';
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_version_remotesupport()
|
function plugin_version_remotesupport()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => __('Remote Support Input', 'remotesupport'),
|
'name' => __('Remote Support Input', 'remotesupport'),
|
||||||
'version' => PLUGIN_REMOTESUPPORT_VERSION,
|
'version' => PLUGIN_REMOTESUPPORT_VERSION,
|
||||||
'author' => 'Alessandro Carloni',
|
'author' => 'Alessandro Carloni',
|
||||||
'license' => 'GPLv2',
|
'license' => 'GPLv2',
|
||||||
'homepage' =>'https://github.com/Kaya84/',
|
'homepage' => 'https://github.com/Kaya84/',
|
||||||
'requirements' => [
|
'requirements' => [
|
||||||
'glpi' => [
|
'glpi' => [
|
||||||
'min' => PLUGIN_REMOTESUPPORT_MIN_GLPI,
|
'min' => PLUGIN_REMOTESUPPORT_MIN_GLPI,
|
||||||
'max' => PLUGIN_REMOTESUPPORT_MAX_GLPI
|
'max' => PLUGIN_REMOTESUPPORT_MAX_GLPI,
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user