Subversion Repositories ALCASAR

Rev

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

Rev 2251 Rev 2385
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 2251 2017-05-22 22:15:22Z tom.houdayer $
22
// $Id: portail.php 2385 2017-08-22 16:36:16Z tom.houdayer $
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 53... Line 53...
53
	$_text .= "  </Portail>\n";
53
	$_text .= "  </Portail>\n";
54
 
54
 
55
	return $_text;
55
	return $_text;
56
}
56
}
57
// Fonction de test de connectivité internet
57
// Fonction de test de connectivité internet
58
function internetTest($INSTALLEDVERSION){
58
function internetTest() {
59
        $host = "www.google.com";  # Google Test
59
	$host  = 'www.google.com';
60
        $host2 = "svn.alcasar.net";
60
	$host2 = 'www.alcasar.net';
61
        $port = "80";
61
	$port = 80;
62
        //var $num;     //non utilisé
-
 
63
        //var $error;   //non utilisé
-
 
-
 
62
 
64
	$sock = fsockopen($host, $port, $num, $error, 2);
63
	$sock = fsockopen($host, $port, $errno, $errstr, 2);
65
	if (!$sock){
64
	if (!$sock) {
66
		return false; # Internet access is down
65
		return false;
67
		}
66
	}
68
	else 	{
-
 
69
		fclose($sock);
67
	fclose($sock);
-
 
68
 
70
		$sock = fsockopen($host2, $port, $num, $error, 2);
69
	$sock = fsockopen($host2, $port, $errno, $errstr, 2);
71
		if ($sock){
70
	if (!$sock) {
72
                	fputs($sock,"GET http://$host2/images/M_images/weblink-$INSTALLEDVERSION.png HTTP/1.0\n\n");
71
		return false;
-
 
72
	}
73
			fclose($sock); }
73
	fclose($sock);
-
 
74
 
74
		return true;
75
	return true;
75
		}
-
 
76
}
76
}
77
// Fonction de test du filtrage
77
// Fonction de test du filtrage
78
function filtrageTest($file, $search_regex){
78
function filtrageTest($file, $search_regex){
79
	$pointeur = fopen($file,"r");
79
	$pointeur = fopen($file,"r");
80
	$result = false;
80
	$result = false;
Line 119... Line 119...
119
	$INSTALLEDVERSION = $conf['VERSION'];
119
	$INSTALLEDVERSION = $conf['VERSION'];
120
	$VERSIONBL = date ("F d Y", filemtime ('/etc/dansguardian/lists/blacklists/README'));
120
	$VERSIONBL = date ("F d Y", filemtime ('/etc/dansguardian/lists/blacklists/README'));
121
	$nbr_user = request ('user');
121
	$nbr_user = request ('user');
122
	$nbr_grp  = request ('group');
122
	$nbr_grp  = request ('group');
123
	$nbr_user_online = exec ("sudo /usr/sbin/chilli_query list | cut -d\" \" -f5 | grep \"1\" | wc -l");
123
	$nbr_user_online = exec ("sudo /usr/sbin/chilli_query list | cut -d\" \" -f5 | grep \"1\" | wc -l");
124
	if ((filtrageTest("/var/www/html/index.php","/network_pb = false/")) && (internetTest($INSTALLEDVERSION))){
124
	if ((filtrageTest("/var/www/html/index.php","/network_pb = false/")) && (internetTest())) {
125
		$internet_status =  "<img src='/images/state_ok.gif'>".$text['enable'];
125
		$internet_status =  "<img src='/images/state_ok.gif'>".$text['enable'];
126
		$version = dns_get_record("version.alcasar.net",DNS_TXT);
126
		$version = dns_get_record("version.alcasar.net",DNS_TXT);
127
		$AVAILABLEDVERSION = $version[0]['txt'];
127
		$AVAILABLEDVERSION = $version[0]['txt'];
128
	} else {
128
	} else {
129
		$internet_status =  "<img src='/images/state_error.gif'>".$text['disable'];
129
		$internet_status =  "<img src='/images/state_error.gif'>".$text['disable'];