<?php

header("Expires: ".gmdate("D, d M Y H:i:s")."GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>

<?php 
/*	develooping flash chat   		                    */
/*	Based in a free flash engine from 	                */
/*	http://www.neo-ego.com	<joost@extrapink.com>       */
/*	Original script by Nicola Delbono <key5@key5.com>	*/
/*	Added time, users management, private messages,     */
/*	ip banning, bad words filter, kicking               */
/*  and more improvements by                            */
/*	juancarlos@develooping.com	                        */
/*	version 1.6.5                                     */
?>

<?php 
error_reporting(7);
require ('required/config.php');

$chat_file_ok = "required/msg.txt";//message file

$users_file = "required/users.txt";//The file where you save users and passwords

if($show_without_time == "no"){//show time?
$substart=0;
}else{
$substart=19;
}

/*	check banning   */
/*	--------------- */

$banned_file = "required/banned_ip.txt";//the file with banned ips
$text_string = join ('', file ($banned_file));
if (ereg("(.)*$password\n",$text_string)){//this user was banned
$text_string = join ('', file ($users_file));
$new_list= str_replace ("$password", " banned", $text_string);
$fcusers = fopen($users_file, "w");
$fwcusers = fwrite($fcusers, $new_list);
fclose($fcusers);
}

$person = str_replace ("\n"," ", $person);
$person = str_replace ("<", " ", $person);
$person = str_replace (">", " ", $person);
$person = trim ($person);
$person = stripslashes ($person);
?>
&output=
<?php 
/*	check the user  */
/*	--------------- */
$text_string = join ('', file ($users_file));
$valid_user=  "valid";
if ((ereg("$person\n kicked\n", $text_string)) or (ereg("$person\n banned\n", $text_string))){
$valid_user = "kicked";
}
if ($valid_user == "kicked"){
if (ereg("$person\n kicked\n", $text_string)){echo urlencode($kicked_user)."\n";}
if (ereg("$person\n banned\n", $text_string)){echo urlencode($banned_user)."\n";}
if (ereg("$person\n $password\n", $text_string)){//is not in the user list
$user_is_not_here=0;
}
else
{
$user_is_not_here=1;
}

if ($user_is_not_here==1){
echo urlencode($banned_user)."\n";
}

}else{
			
/*	limit file size of $chat_file_ok */
/*	-------------------------------- */

$lines = file($chat_file_ok);
$a = count($lines);

if ($a >= $total_lenght){
$u = $a - $review_lenght;
$msg_old="";
for($i = $u; $i <= $a ;$i++){
		$msg_old =  $msg_old.strval($lines[$i]);
	}
$fchat = fopen($chat_file_ok, "w");
$fwchat = fwrite($fchat, $msg_old);
fclose($fchat);
}

/*	write message to $chat_file_ok */
/*	------------------------------ */
		
$msg = str_replace ("\n"," ", $message);
$msg = stripslashes ($msg);

$msg = htmlspecialchars ($msg);


//accepted tags
      $msg = str_replace("&lt;b&gt;","<b>",$msg);
      $msg = str_replace("&lt;B&gt;","<b>",$msg);
      $msg = str_replace("&lt;/b&gt;","</b>",$msg);
      $msg = str_replace("&lt;/B&gt;","</b>",$msg);
      
      $msg = str_replace("&lt;i&gt;","<i>",$msg);
      $msg = str_replace("&lt;I&gt;","<i>",$msg);
      $msg = str_replace("&lt;/i&gt;","</i>",$msg);
      $msg = str_replace("&lt;/I&gt;","</i>",$msg);

//close unclosed tags //
$countb=substr_count($msg, "<b>");
$count_b=substr_count($msg, "</b>");
$counti=substr_count($msg, "<i>");
$count_i=substr_count($msg, "</i>");
function strlastpos($haystack, $needle) {
if (strstr($haystack, $needle)){
return strlen($haystack) - strlen($needle) - strpos(strrev($haystack), strrev($needle));
}else{
return -1;
}
}
$lastb = strlastpos($msg,"<b>");
$lasti = strlastpos($msg,"<i>");

if ($lastb>$lasti){
for($addb = $count_b; $addb < $countb ;$addb++){
if($msg!=""){
$msg .="</b>";
}
}
for($addb = $count_i; $addb < $counti ;$addb++){
if($msg!=""){
$msg .="</i>";
}
}
}
if ($lasti>$lastb){
for($addb = $count_i; $addb < $counti ;$addb++){
if($msg!=""){
$msg .="</i>";
}
}
for($addb = $count_b; $addb < $countb ;$addb++){
if($msg!=""){
$msg .="</b>";
}
}

}
//insert links
function InsertLinks ( $Text )
{
//  First match things beginning with http:// (or other protocols)
   $NotAnchor = '(?<!"|href=|href\s=\s|href=\s|href\s=)';
   $Protocol = '(http|ftp|https):\/\/';
   $Domain = '[\w]+(.[\w]+)';
   $Subdir = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
   $Expr = '/' . $NotAnchor . $Protocol . $Domain . $Subdir . '/i';

   $Result = preg_replace( $Expr, "<a href=\"$0\" title=\"$0\" target=\"_blank\">$0</a>", $Text );

//  Now match things beginning with www.
   $NotAnchor = '(?<!"|href=|href\s=\s|href=\s|href\s=)';
   $NotHTTP = '(?<!:\/\/)';
   $Domain = 'www(.[\w]+)';
   $Subdir = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
   $Expr = '/' . $NotAnchor . $NotHTTP . $Domain . $Subdir . '/i';

   return preg_replace( $Expr, "<a href=\"http://$0\" title=\"http://$0\" target=\"_blank\">$0</a>", $Result );
}

$msg = InsertLinks( $msg );

//replace emoticons
$msg=str_replace (":)","<font face='Devemoticons' size='18' color='#990000'>b</font>", $msg);
$msg=str_replace (":|","<font face='Devemoticons' size='18' color='#990000'>c</font>", $msg);
$msg=str_replace (";)","<font face='Devemoticons' size='18' color='#990000'>d</font>", $msg);
$msg=str_replace (":D","<font face='Devemoticons' size='18' color='#990000'>e</font>", $msg);
$msg=str_replace (":O","<font face='Devemoticons' size='18' color='#990000'>f</font>", $msg);
$msg=str_replace (":o","<font face='Devemoticons' size='18' color='#990000'>f</font>", $msg);
$msg=str_replace (":P","<font face='Devemoticons' size='18' color='#990000'>g</font>", $msg);
$msg=str_replace (":(","<font face='Devemoticons' size='18' color='#990000'>h</font>", $msg);
$msg=str_replace (":S","<font face='Devemoticons' size='18' color='#990000'>i</font>", $msg);
$msg=str_replace ("8)","<font face='Devemoticons' size='18' color='#990000'>j</font>", $msg);
//end replace emoticons

/*	filter bad words */
/*	----------------- */

$number_of_bad_words = count($words_to_filter);
for($i = 0; $i <= $number_of_bad_words ;$i++){
if (strval($words_to_filter[$i])!=""){
$msg = eregi_replace(strval($words_to_filter[$i]),$replace_by,$msg);
}
}

if (ereg ("$private_message_expression", $msg, $regs) and ereg ("\(de $password a", $msg)){  // is a private message
$receiver = strval($regs[1])."\n";
$lines = file($users_file);
$a = count($lines);
$follow = 1;
for($i = 0; $i <= $a ;$i++){
if (strval($lines[$i]) == $receiver){
$add = rtrim(strval($lines[$i+1]));//read the password of receiver
$follow = 0;
}else{
if ($follow==1){
$add = " eztezamarchaoynoezta";// receiver is not in the room
}}
}
$msg .= $add;
}
if ($msg != ""){



$text_to_write = date ("(H:i:s)",time()+$correct_time)." ".$person." : ".$msg."\n";//compound single message
$fchat1 = fopen($chat_file_ok, "a");
$fwchat1 = fwrite($fchat1, "$text_to_write");// message is appended to the msg.txt file
fclose($fchat1);
}

/*	reads the last $chat_lenght lines of $chat_file_ok */
/*	-------------------------------------------------- */

$lines = file($chat_file_ok);
$a = count($lines);
$u = $a - $chat_lenght;

/*	check the text order */
/*	-------------------- */
if ($text_order == "up"){
for($i = $a; $i >= $u ;$i--){

$is_private = 0;
$show_message = 1;
$line_value= strval($lines[$i]);
$string_to_add="";

/*	output to the chat private and general messages */
/*	----------------------------------------------- */

if (ereg($private_message_expression, $line_value, $name) and ereg("\(de (.*) a (.*)$", $line_value, $pass)){// is a private message
	$senderpassword=strval($pass[1]);
	$receiverpassword=strval($pass[2]);
	$receivername=strval($name[1]);
	$is_private = 1;
	$show_message = 0;
	}
	if ($is_private == 1){
	if (($receivername==$person) and ereg("(.)?$password(\n)?", $receiverpassword)){//is the receiver
	$line_value = ereg_replace( "\(de (.*) a (.*)$", "\n", $line_value);
	echo substr(urlencode($line_value),$substart);//show message
	} elseif(ereg("\(..:..:..\) $person :", $line_value) and ereg("(.)?$password", $senderpassword)){//is the sender
	if (ereg("(.)?eztezamarchaoynoezta(\n)?", $receiverpassword)) {$string_to_add = $not_here_string;}
	$line_value = ereg_replace( "\(de (.*) a (.*)$", "$string_to_add\n", $line_value);
	echo substr(urlencode($line_value),$substart);//show message
	}else{
	$u--;
	$show_message = 0;
	} 
	}         
if ($show_message == 1) {// is a general message
if ((ereg($bye_user,$line_value)) or (ereg($enter_string,$line_value))){
echo urlencode ($line_value);//show time only if user enters or exits
}
else{
echo substr(urlencode($line_value),$substart);//show message
}
}
}
}
	else{
	for($i = $u; $i <= $a ;$i++){

$is_private = 0;
$show_message = 1;
$line_value= strval($lines[$i]);
$string_to_add="";

/*	output to the chat private and general messages */
/*	----------------------------------------------- */

if (ereg($private_message_expression, $line_value, $name) and ereg("\(de (.*) a (.*)$", $line_value, $pass)){// is a private message
	$senderpassword=strval($pass[1]);
	$receiverpassword=strval($pass[2]);
	$receivername=strval($name[1]);
	$is_private = 1;
	$show_message = 0;
	}
	if ($is_private == 1){
	if (($receivername==$person) and ereg("(.)?$password(\n)?", $receiverpassword)){//is the receiver
	$line_value = ereg_replace( "\(de (.*) a (.*)$", "\n", $line_value);
	echo substr(urlencode($line_value),$substart);//show message
	} elseif(ereg("\(..:..:..\) $person :", $line_value) and ereg("(.)?$password", $senderpassword)){//is the sender
	if (ereg("(.)?eztezamarchaoynoezta(\n)?", $receiverpassword)) {$string_to_add = $not_here_string;}
	$line_value = ereg_replace( "\(de (.*) a (.*)$", "$string_to_add\n", $line_value);
	echo substr(urlencode($line_value),$substart);//show message
	}else{
	$u--;
	$show_message = 0;
	} 
	}         
if ($show_message == 1) {// is a general message
if ((ereg($bye_user,$line_value)) or (ereg($enter_string,$line_value))){
echo urlencode ($line_value);//show time only if user enters or exits
}
else{
echo substr(urlencode($line_value),$substart);//show message
}
}
}
}
}
echo "&order=";
echo $text_order;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
	<head>
            <title>e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.</title>

                <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="description" content="Buscador de proyectos ETSI" />
<meta name="author" content="Daniel Callejo"/>
<meta name="author" content="Federico L&oacute;pez"/>
<meta name="author" content="Juli&aacute;n P&eacute;rez"/>
<meta name="author" content="Jos&eacute; Mar&iacute;a Vidal Vidal"/>
<base href="/bibing/proyectos/" /><link rel="shortcut icon" href="./favicon.ico" />
<link rel="stylesheet" href="./publico/css/estructura.css" type="text/css" />
<link rel="stylesheet" href="./publico/css/bootstrap.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="./publico/css/enlaces-capas.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/pestanas.css" type="text/css"  /> 
<link rel="stylesheet" href="./publico/css/formularios.css" type="text/css" />
<link rel="stylesheet" href="./publico/css/lightbox.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/autocompleter.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/resultados.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/milista.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/explorador.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/ultimos.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/contactar.css" type="text/css"  />
<!-- <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" /> -->
<script src="./publico/javascript/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="./publico/javascript/bootstrap.js" type="text/javascript"></script>

<script src="./publico/javascript/mootools-1.2.4-core.js" type="text/javascript"></script>
<script src="./publico/javascript/mootools-1-1.2.4.2-more.js" type="text/javascript"></script>
<script src="./publico/javascript/targetbl.js" type="text/javascript"></script>
<script src="./publico/javascript/mensajes.js" type="text/javascript"></script>
<script src="./publico/javascript/form.js" type="text/javascript"></script>
<script src="./publico/javascript/autocompleter/Observer.js" type="text/javascript"></script>
<script src="./publico/javascript/autocompleter/Autocompleter.js" type="text/javascript"></script>
<script src="./publico/javascript/autocompleter/Autocompleter.Request.js" type="text/javascript"></script>
<script src="./publico/javascript/domready.js" type="text/javascript"></script>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-8T1TSNC1QY"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-8T1TSNC1QY');
</script>



<script type="text/javascript">
function seleccionar_todo(){
   for (i=0;i<document.formulario_marcados.elements.length;i++)
      if(document.formulario_marcados.elements[i].type == "checkbox")
         document.formulario_marcados.elements[i].checked=1
}
function deseleccionar_todo(){
   for (i=0;i<document.formulario_marcados.elements.length;i++)
      if(document.formulario_marcados.elements[i].type == "checkbox")
         document.formulario_marcados.elements[i].checked=0
} 
</script>
	</head>
    <body style="min-width: 960px; background-color: #e2e2e2; height: 100%">	
		<a name="arriba"></a>
<div>
<div id="header">
    <table id="Tabla_01" height="105" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <img src="./publico/imagenes/cabecera/banner_new2_01.jpg" width="3" height="105" alt="">
        </td>
        <td>
            <img src="./publico/imagenes/cabecera/banner_new2_02.jpg" width="100" height="105" alt="">
        </td>
        <td width="100%" align="right"  style="min-width: 613px; background-repeat: no-repeat; background-position: top right; font-size: medium; font-weight: bold; color: white;">
            <table width="100%" height="105" border="0">
                <tr>
                    <td style=" vertical-align: top; width: 547px">
                        <!-- <a style="text-decoration: none" href="./"><img src="./publico/imagenes/cabecera/banner_new2_03.jpg"alt=""></a> -->
                        <a style="text-decoration: none" href="/bibing/proyectos/"><img src="./publico/imagenes/cabecera/banner_new2_03.jpg"alt=""></a>
                     </td>
                     <td  background="./publico/imagenes/cabecera/banner_new2_04.jpg" style="background-repeat: no-repeat; background-color: #c6d4e8;"><br><br><br>
                         &nbsp;
                        </td>
                    </tr>
             </table>
        </td>
    </tr>
    <tr style="border-top: 1px solid #ffffff;">
        <td colspan="3" id="menu_sup" style="font-size: small; text-align: right; background-color: #9c1f2f; vertical-align: bottom">
             
					<a href="/bibing/proyectos/" class="enlace " style=" color: #ffffff">Inicio&nbsp;&nbsp;|</a>
					<a href="/bibing/proyectos/acerca/" style=" color: #ffffff" class="enlace ">&nbsp;&nbsp;Acerca de&nbsp;&nbsp;|</a>
					
					<a href="/bibing/proyectos/contactar/" style=" color: #ffffff" class="enlace ">&nbsp;&nbsp;Contactar&nbsp;&nbsp;</a>
			 <!--       <a href="/bibing/proyectos/ayuda/" style=" color: #ffffff" class="enlace  ">&nbsp;&nbsp;Ayuda&nbsp;&nbsp;|</a> -->
					<!-- <form id="idioma" class=""  method="post" action="">
					<div class="inline" style="color: white">
					<input type="submit" class="tipo_letra " style=" color: #ffffff"name="idioma" value="Castellanossss" />&nbsp;&nbsp;
					</div>	
					</form> -->
			        </td>

    </tr>
    </table>
</div>
<br><br>
<div class="colmask rightmenu">
<div class="panel panel-default" style="margin:20px">
            <div class="panel-heading"><h4>DISEÑO DE HERRAMIENTAS PARA PORTAL DE GESTIÓN DE CENTROS DOCENTES</h4><h5 style="color:grey"><span class="glyphicon glyphicon-user""></span> : <b>LEIVA JIMÉNEZ, ANDRÉS</b><br><span class="glyphicon glyphicon-book""></span>  :<b> Ingenier&iacute;a Telecomunicación</b></h5></div><div class="panel-body"><div class="contenido_proyecto"><div class="titulo2_explorador">Contenido del proyecto:</div><div class="ruta"><a href="use/abreproy/11109">Directorio ra&iacute;z</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252F">proyecto</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252Fproyecto%252F">proyecto</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252Fproyecto%252Fchat%252F">chat</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252Fproyecto%252Fchat%252Fchat%252F">chat</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252Fproyecto%252Fchat%252Fchat%252Fchat.php%252F">chat.php</a></div><div class="listing"></div></div></div></div>
</div>
</div>

        
	</body>
 
 
<!-- Inicio Google Analytics -->
<!--
	<script type="text/javascript">
		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
		document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	</script>
	
	<script type="text/javascript">
		try {
		var pageTracker = _gat._getTracker("UA-7789620-1");
		pageTracker._trackPageview();
	} 
		catch(err) {}
	</script>
-->
<!-- Fin Google Analytics -->

</html>

