source: admin/WebConsole/nada.php

qndtest
Last change on this file was 3283bc7, checked in by Irina Gómez <irinagomez@…>, 5 years ago

#858: The tip of the day is shown only when entering the web console. change in style: align image center and maximum width for text.

  • Property mode set to 100644
File size: 12.9 KB
Line 
1<?php
2/**
3 * @file    nada.php
4 * @brief   Muestra el marco derecho "por defecto" cuando no se ejecuta un comando.
5 * @version 1.1.1 - Se incluyen consejos del día la primera vez que se entra.
6 * @date    2019-09-06
7 */
8
9include_once("./includes/ctrlacc.php");
10include_once("./idiomas/php/".$idioma."/nada_".$idioma.".php");
11
12// ################### Consejo del día ################# //
13// Sólo lo muestro al entrar en la consola
14$consejo = '';
15if (basename($_SERVER['HTTP_REFERER']) == "frames.php") {
16    // Elijo el consejo de hoy aleatoriamente.
17    $numTip=rand(0,count($TipOfDay)-1);
18    $tipMessage=$TipOfDay[$numTip];
19    $tipImage=is_file("images/tipOfDay_$numTip.png") ? '<img src="images/tipOfDay_'.$numTip.'.png">' : '';
20
21    $consejo = ' <div>'."\n".
22               '    <p align=center class=cabeceras><img  border=0 nod="aulas-1" value="Sala Virtual" style="cursor:pointer" src="images/iconos/logocirculos.png" >&nbsp;&nbsp;'.$TbMsg["TIP"].'</p>'."\n".
23               '    <div class="consejo">'."\n".
24               '        <p class="subcabeceras help_menu">'.$tipMessage.'</p>'."\n".
25               '        <div>'.$tipImage.'</div>'."\n".
26               '    </div>'."\n".
27               ' </div>'."\n";
28}
29
30// ##########################################################################################################
31// ###############  PARA SABER QUE IP TIENE EL DISPOSITIVO QUE ESTA UTILIZANDO OPENGNSYS  ###################
32// ##########################################################################################################
33//Para saber la IP con Proxy o sin el
34
35function getRemoteInfo () {
36   $proxy="";
37   if (isSet($_SERVER)) {
38       if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
39           $IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
40           $proxy  = $_SERVER["REMOTE_ADDR"];
41       } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
42           $IP = $_SERVER["HTTP_CLIENT_IP"];
43       } else {
44           $IP = $_SERVER["REMOTE_ADDR"];
45       }
46   } else {
47       if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
48           $IP = getenv( 'HTTP_X_FORWARDED_FOR' );
49           $proxy = getenv( 'REMOTE_ADDR' );
50       } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
51           $IP = getenv( 'HTTP_CLIENT_IP' );
52       } else {
53           $IP = getenv( 'REMOTE_ADDR' );
54       }
55   }
56   if (strstr($IP, ',')) {
57       $ips = explode(',', $IP);
58       $IP = $ips[0];
59   }
60   $RemoteInfo[0]=$IP;
61   $RemoteInfo[1]=@GetHostByAddr($IP);
62   $RemoteInfo[2]=$proxy;
63
64        return $RemoteInfo[0];
65}
66
67/////////////////////////////////////////////////////////////////////////////////////////////////////////////
68
69// ##########################################################################################################
70// ###############  PARA SABER QUE TIPO DISPOSITIVO ESTA UTILIZANDO OPENGNSYS  ##############################
71// ##########################################################################################################
72$device="";
73$device = strtolower($_SERVER['HTTP_USER_AGENT']);
74if(stripos($device,'iphone') == TRUE ){$device="iphone";$tipodevice="Iphone / Ipad";$ipreal=getRemoteInfo();$_SESSION["ipdevice"]=$ipreal;}
75elseif  (stripos($device,'ipad') == TRUE) {$device="ipad";$tipodevice="Ipad / Iphone";$ipreal=getRemoteInfo();$_SESSION["ipdevice"]=$ipreal;}
76elseif (stripos($device,'android') == TRUE) {$device="android";$tipodevice="Movil / Tablet";$ipreal=getRemoteInfo();$_SESSION["ipdevice"]=$ipreal;}
77elseif (stripos($device,'linux') == TRUE) {$device="linux";$tipodevice="Linux";$ipreal=getRemoteInfo();$_SESSION["ipdevice"]=$ipreal;}
78elseif (stripos($device,'macintosh') == TRUE) {$device="macintosh";$tipodevice="Macintosh";$ipreal=getRemoteInfo();$_SESSION["ipdevice"]=$ipreal;}
79else{$device="0";$tipodevice="PC";}
80/////////////////////////////////////////////////////////////////////////////////////////////////////////////
81
82// ##########################################################################################################
83// ################################  PARA SABER QUE SISTEMA DEL DISPOSITIVO  ################################
84// ##########################################################################################################
85$sistem="";
86$buscasistem=strtolower($_SERVER['HTTP_USER_AGENT']);
87//////////////////////////////////////////////////////////////////////////////////////////////////////////////
88//      SISTEMAS WINDOWS //
89//////////////////////////////////////////////////////////////////////////////////////////////////////////////
90if(stripos($buscasistem,'windows nt 10.0') == TRUE ){$sistem="Windows 10";} 
91if(stripos($buscasistem,'windows nt 6.2') == TRUE ){$sistem="Windows 8";} 
92if(stripos($buscasistem,'windows nt 6.1') == TRUE ){$sistem="Windows 7";}
93if(stripos($buscasistem,'windows nt 6.0') == TRUE ){$sistem="Windows Vista/Server 2008";} 
94if(stripos($buscasistem,'windows nt 5.2') == TRUE ){$sistem="Windows Server 2003";} 
95if(stripos($buscasistem,'windows nt 5.1') == TRUE ){$sistem="Windows XP";} 
96if(stripos($buscasistem,'windows nt 5.0') == TRUE ){$sistem="Windows 2000";} 
97
98//////////////////////////////////////////////////////////////////////////////////////////////////////////////
99//      SISTEMAS APPLE //
100//////////////////////////////////////////////////////////////////////////////////////////////////////////////
101if(stripos($buscasistem,'ipad') == TRUE ){$sistem="iOS";}
102if(stripos($buscasistem,'iphone') == TRUE ){$sistem="iOS";}
103if ($device == "macintosh" ){$sistem="Mac OSX";}
104
105//////////////////////////////////////////////////////////////////////////////////////////////////////////////
106//      SISTEMAS LINUX //
107//////////////////////////////////////////////////////////////////////////////////////////////////////////////
108if(stripos($buscasistem,'ubuntu') == TRUE ){$sistem="Ubuntu";}
109if(stripos($buscasistem,'red hat') == TRUE ){$sistem="Red Hat";}
110if(stripos($buscasistem,'centos') == TRUE ){$sistem="CentOS";}
111if(stripos($buscasistem,'suse') == TRUE ){$sistem="openSUSE";}
112if(stripos($buscasistem,'mandriva') == TRUE ){$sistem="Mandriva";}
113
114//////////////////////////////////////////////////////////////////////////////////////////////////////////////
115//      SISTEMAS ANDROID //
116//////////////////////////////////////////////////////////////////////////////////////////////////////////////
117if(stripos($buscasistem,'android') == TRUE ){$sistem="Android";}
118
119/////////////////////////////////////////////////////////////////////////////////////////////////////////////
120// ##########################################################################################################
121// ##########################  PARA SABER QUE VERSION DEL SISTEMA DEL DISPOSITIVO  ##########################
122// ##########################################################################################################
123$buscaversistem=strtolower($_SERVER['HTTP_USER_AGENT']);
124
125//////////////////////////////////////////////////////////////////////////////////////////////////////////////
126//      VERSION WINDOWS //
127//////////////////////////////////////////////////////////////////////////////////////////////////////////////
128if(stripos($buscaversistem,'windows nt') == TRUE ){$versistem="-";}
129//////////////////////////////////////////////////////////////////////////////////////////////////////////////
130
131//////////////////////////////////////////////////////////////////////////////////////////////////////////////
132//      VERSION APPLE //
133//////////////////////////////////////////////////////////////////////////////////////////////////////////////
134if(stripos($buscaversistem,'os x') == TRUE ){
135$buscaversistemapple=$_SERVER['HTTP_USER_AGENT'];
136$buscaversistemapple=str_replace("OS","OS:",$buscaversistemapple);
137$buscaversistemapple=str_replace("like",":like",$buscaversistemapple);
138$buscaversistemapple=explode(":",$buscaversistemapple);
139$versistem=$buscaversistemapple[1];}
140
141/////////////////////////////////////////////////////////////////////////////////////////////////////////////
142
143//////////////////////////////////////////////////////////////////////////////////////////////////////////////
144//      VERSION LINUX //
145//////////////////////////////////////////////////////////////////////////////////////////////////////////////
146if(stripos($buscaversistem,'linux') == TRUE ){$versistem="-";}
147
148//////////////////////////////////////////////////////////////////////////////////////////////////////////////
149//      VERSION ANDROID //
150//////////////////////////////////////////////////////////////////////////////////////////////////////////////
151if(stripos($buscaversistem,'android') == TRUE ){
152$buscaversistemandroid=str_replace(")",";",$buscaversistem);
153$buscaversistemandroid=explode(";",$buscaversistemandroid);
154$versistem=$buscaversistemandroid[2];
155}
156/////////////////////////////////////////////////////////////////////////////////////////////////////////////
157// ##########################################################################################################
158// ##########################  PARA SABER QUE NAVEGADOR DEL SISTEMA DEL DISPOSITIVO  ########################
159// ##########################################################################################################
160$buscanav=strtolower($_SERVER['HTTP_USER_AGENT']);
161if(stripos($buscanav,'firefox') == TRUE ){$nav="Firefox";}
162if(stripos($buscanav,'safari') == TRUE ){$nav="Safari";}
163if(stripos($buscanav,'msie') == TRUE ){$nav="Internet Explorer";}
164if(stripos($buscanav,'chrome') == TRUE ){$nav="Google Chrome";}
165if(stripos($buscanav,'opera') == TRUE ){$nav="Opera";}
166if(stripos($buscanav,'qtembedded') == TRUE ){$nav="OpenGnsys Browser";}
167//////////////////////////////////////////////////////////////////////////////////////////////////////////////
168
169/////////////////////////////////////////////////////////////////////////////////////////////////////////////
170// ##########################################################################################################
171// ##########################  PARA SABER VERSION DEL NAVEGADOR DEL DISPOSITIVO  ############################
172// ##########################################################################################################
173$buscavernav=explode("/", strtolower($_SERVER['HTTP_USER_AGENT']));
174$vernav=end($buscavernav);
175
176//////////////////////////////////////////////////////////////////////////////////////////////////////////////
177
178
179if ($device == "ipad" || $device == "iphone" || $device == "android" )
180{
181$data = json_decode(@file_get_contents(__DIR__ . '/../doc/VERSION.json'));
182if (empty($data->project)) {
183    $version = "OpenGnsys";
184} else {
185    $version = @$data->project.' ' . @$data->version.' '
186             . (isset($data->codename) ? '('.$data->codename.') ' : '') . @$data->release;
187}
188?>
189<html>
190<head>
191  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
192  <link rel="stylesheet" type="text/css" href="./estilos.css">
193</head>
194<body>
195
196<table width="100%" border="0">
197  <tr>
198    <td colspan="3" align="center">&nbsp;</td>
199  </tr>
200  <tr>
201    <td colspan="3" align="center"><SPAN align=center class=cabeceras><font size="4"><?php echo $TbMsg[0] ;?></font></SPAN></td>
202  </tr>
203  <tr>
204    <td colspan="3" align="center"><SPAN align=center class=cabeceras><font size="4"><?php echo $version; ?></font></SPAN></td>
205  </tr>
206  <tr>
207    <td colspan="3" align="center">&nbsp;</td>
208  </tr>
209  <tr>
210    <td width="23%">&nbsp;</td>
211    <td width="28%"><SPAN align=center class=subcabeceras><font size="3"><?php echo $TbMsg[1] ;?></font></SPAN></td>
212    <td width="49%"><SPAN align=center class=sobrecabeceras><font size="3"><?php echo $_SESSION['ipdevice']; ?></font></SPAN></td>
213  </tr>
214  <tr>
215    <td>&nbsp;</td>
216    <td><SPAN align=center class=subcabeceras><font size="3"><?php echo $TbMsg[2] ;?></font></SPAN></td>
217    <td><SPAN align=center class=sobrecabeceras><font size="3"><?php echo $tipodevice; ?></font></SPAN></td>
218  </tr>
219  <tr>
220    <td>&nbsp;</td>
221    <td><SPAN align=center class=subcabeceras><font size="3"><?php echo $TbMsg[3] ;?></font></SPAN></td>
222    <td><SPAN align=center class=sobrecabeceras><font size="3"><?php echo $sistem; ?></font></SPAN></td>
223  </tr>
224  <tr>
225    <td>&nbsp;</td>
226    <td><SPAN align=center class=subcabeceras><font size="3"><?php echo $TbMsg[4] ;?></font></SPAN></td>
227    <td><SPAN align=center class=sobrecabeceras><font size="3"><?php echo $versistem; ?></font></SPAN></td>
228  </tr>
229  <tr>
230    <td>&nbsp;</td>
231    <td><SPAN align=center class=subcabeceras><font size="3"><?php echo $TbMsg[5] ;?></font></SPAN></td>
232    <td><SPAN align=center class=sobrecabeceras><font size="3"><?php echo $nav; ?></font></SPAN></td>
233  </tr>
234  <tr>
235    <td>&nbsp;</td>
236    <td><SPAN align=center class=subcabeceras><font size="3"><?php echo $TbMsg[6] ;?></font></SPAN></td>
237    <td><SPAN align=center class=sobrecabeceras><font size="3"><?php echo $vernav; ?></font></SPAN></td>
238  </tr>
239  <tr>
240    <td>&nbsp;</td>
241    <td>&nbsp;</td>
242    <td>&nbsp;</td>
243  </tr>
244</table>
245
246
247</body>
248</html>
249
250<?php } else { ?>
251
252<html>
253<head>
254  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
255  <link rel="stylesheet" type="text/css" href="./estilos.css">
256</head>
257<body>
258   <?php  echo $consejo; ?>
259</body>
260</html>
261
262<?php } ?>
263
Note: See TracBrowser for help on using the repository browser.