Subversion Repositories ALCASAR

Rev

Rev 1478 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1478 Rev 1805
Line 1... Line 1...
1
<?php 
1
<?php
2
/***************************************************************************
2
/***************************************************************************
3
 *   Copyright (C) 2006 by phpSysInfo - A PHP System Information Script    *
3
 *   Copyright (C) 2006 by phpSysInfo - A PHP System Information Script    *
4
 *   http://phpsysinfo.sourceforge.net/                                    *
4
 *   http://phpsysinfo.sourceforge.net/                                    *
5
 *   addons by 3abtux & Rexy for ALCASAR                                   *
5
 *   addons by 3abtux & Rexy for ALCASAR                                   *
6
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   This program is free software; you can redistribute it and/or modify  *
Line 17... Line 17...
17
 *   along with this program; if not, write to the                         *
17
 *   along with this program; if not, write to the                         *
18
 *   Free Software Foundation, Inc.,                                       *
18
 *   Free Software Foundation, Inc.,                                       *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20
 ***************************************************************************/
20
 ***************************************************************************/
21
 
21
 
22
// $Id: portail.php 1478 2014-11-04 22:28:12Z richard $
22
// $Id: portail.php 1805 2016-03-10 11:53:23Z clement.siccardi $
23
 
23
 
24
// xml_utilisateur()
24
// xml_utilisateur()
25
 
25
 
26
function request ($texte) {
26
function request ($texte) {
27
		$strResult = 0;
27
		$strResult = 0;
Line 29... Line 29...
29
		$host = "localhost";
29
		$host = "localhost";
30
		$DB_USER = "radius";
30
		$DB_USER = "radius";
31
		$DB_RADIUS = "radius";
31
		$DB_RADIUS = "radius";
32
		$radiuspwd = "J7YI65SW";
32
		$radiuspwd = "J7YI65SW";
33
		// Connexion au serveur
33
		// Connexion au serveur
34
		mysql_connect($host, $DB_USER,$radiuspwd) or die("erreur de connexion au serveur");
34
		$mysqli = new mysqli($host, $DB_USER, $radiuspwd, $DB_RADIUS);
35
		mysql_select_db($DB_RADIUS) or die("erreur de connexion a la base de donnees");
-
 
36
		// Creation et envoi de la requete
-
 
37
		if ($texte == 'user') {$query = "SELECT UserName FROM userinfo";}
35
		if ($texte == 'user') {$query = "SELECT UserName FROM userinfo";}
38
		else { $query = "SELECT GroupName FROM radusergroup GROUP BY GroupName";}
36
		else { $query = "SELECT GroupName FROM radusergroup GROUP BY GroupName";}
39
		$result = mysql_query($query);
37
		$result = $mysqli->query($query);
40
		// Recuperation des resultats
38
		// Recuperation des resultats
41
		$strResult = mysql_num_rows($result);
39
		$strResult = $result->num_rows;
42
		// Deconnexion de la base de donnees
40
		// Deconnexion de la base de donnees
43
		 mysql_close();
41
		$mysqli->close();
44
		return $strResult;
42
		return $strResult;
45
  }
43
 }
-
 
44
 
46
function xml_portail () {
45
function xml_portail () {
47
	global $sysinfo;
46
	global $sysinfo;
48
	
47
 
49
	$_text = "  <Portail>\n"
48
	$_text = "  <Portail>\n"
50
//		. "    <Utilisateur>" . htmlspecialchars( request('user'), ENT_QUOTES ) . "</Utilisateur>\n"
49
//		. "    <Utilisateur>" . htmlspecialchars( request('user'), ENT_QUOTES ) . "</Utilisateur>\n"
51
		. "    <Utilisateur>" . "</Utilisateur>\n"
50
		. "    <Utilisateur>" . "</Utilisateur>\n"
52
		. "    <Groupe>" . "</Groupe>\n";
51
		. "    <Groupe>" . "</Groupe>\n";
53
//		. "    <Groupe>" . htmlspecialchars( trim( request('group') ), ENT_QUOTES ) . "</Groupe>\n";
52
//		. "    <Groupe>" . htmlspecialchars( trim( request('group') ), ENT_QUOTES ) . "</Groupe>\n";
54
	$_text .= "  </Portail>\n";
53
	$_text .= "  </Portail>\n";
55
	
54
 
56
	return $_text;
55
	return $_text;
57
} 
56
}
58
// Fonction de test de connectivité internet
57
// Fonction de test de connectivité internet
59
function internetTest($INSTALLEDVERSION){
58
function internetTest($INSTALLEDVERSION){
60
        $host = "www.google.com";  # Google Test
59
        $host = "www.google.com";  # Google Test
61
        $host2 = "svn.alcasar.net";
60
        $host2 = "svn.alcasar.net";
62
        $port = "80";
61
        $port = "80";
Line 64... Line 63...
64
        //var $error;   //non utilisé
63
        //var $error;   //non utilisé
65
	$sock = fsockopen($host, $port, $num, $error, 2);
64
	$sock = fsockopen($host, $port, $num, $error, 2);
66
	if (!$sock){
65
	if (!$sock){
67
		return false; # Internet access is down
66
		return false; # Internet access is down
68
		}
67
		}
69
	else 	{   
68
	else 	{
70
		fclose($sock);
69
		fclose($sock);
71
		$sock = fsockopen($host2, $port, $num, $error, 2);
70
		$sock = fsockopen($host2, $port, $num, $error, 2);
72
		if ($sock){
71
		if ($sock){
73
                	fputs($sock,"GET http://$host2/images/M_images/weblink-$INSTALLEDVERSION.png HTTP/1.0\n\n");
72
                	fputs($sock,"GET http://$host2/images/M_images/weblink-$INSTALLEDVERSION.png HTTP/1.0\n\n");
74
			fclose($sock); }
73
			fclose($sock); }
Line 148... Line 147...
148
		. "    <td valign=\"top\"><font size=\"-1\">" . $text['bl-version'] . "</font></td>\n"
147
		. "    <td valign=\"top\"><font size=\"-1\">" . $text['bl-version'] . "</font></td>\n"
149
		. "    <td><font size=\"-1\">" . $VERSIONBL . "</font></td>\n"
148
		. "    <td><font size=\"-1\">" . $VERSIONBL . "</font></td>\n"
150
		. "  </tr>\n"
149
		. "  </tr>\n"
151
		. "</table>\n";
150
		. "</table>\n";
152
	return $_text;
151
	return $_text;
153
} 
152
}
154
 
153
 
155
function wml_portail () {
154
function wml_portail () {
156
	global $XPath;
155
	global $XPath;
157
	global $text;
156
	global $text;
158
	
157
 
159
	$_text = "<card id=\"vitals\" title=\"" . $text['vitals']  . "\">\n"
158
	$_text = "<card id=\"vitals\" title=\"" . $text['vitals']  . "\">\n"
160
		. "<p>" . $text['hostname'] . ":<br/>\n"
159
		. "<p>" . $text['hostname'] . ":<br/>\n"
161
		. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Hostname" ) . "</p>\n"
160
		. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Hostname" ) . "</p>\n"
162
		. "<p>" . $text['ip'] . ":<br/>\n"
161
		. "<p>" . $text['ip'] . ":<br/>\n"
163
		. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/IPAddr" ) . "</p>\n"
162
		. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/IPAddr" ) . "</p>\n"
Line 168... Line 167...
168
		. "<p>" . $text['users'] . ":<br/>"
167
		. "<p>" . $text['users'] . ":<br/>"
169
		. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Users" ) . "</p>\n"
168
		. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Users" ) . "</p>\n"
170
		. "<p>" . $text['loadavg'] . ":<br/>"
169
		. "<p>" . $text['loadavg'] . ":<br/>"
171
		. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/LoadAvg" ) . "</p>\n"
170
		. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/LoadAvg" ) . "</p>\n"
172
		. "</card>\n";
171
		. "</card>\n";
173
	
172
 
174
	return $_text;
173
	return $_text;
175
}
174
}
176
?>
175
?>