<?php
/*
* Author: Dark Neo
* Copyright: © 2011 Soportemybb
* Website:  http://www.soportemybb.com
* Version: 1.9
* MyBB: 1.8.x
*/

if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Llamamos a los enganches necesarios para el plugin
$plugins->add_hook("postbit", "hideip_clear");
$plugins->add_hook("postbit_prev", "hideip_clear");
$plugins->add_hook("postbit_pm", "hideip_clear");
$plugins->add_hook("postbit_announcement", "hideip_clear");
$plugins->add_hook("parse_message", "hideip_code");
$plugins->add_hook("newreply_do_newreply_end", "hideip_code_ajax");
$plugins->add_hook("parse_quoted_message", "hideip_quote");
$plugins->add_hook("editpost_start", "hideip_edit");
$plugins->add_hook("xmlhttp", "hideip_qedit");

// Informacion del Plugin
function hideip_info()
{

	global $mybb, $db, $lang;

    $lang->load("hideip");
	$hideip_settings_link = '';

	$query = $db->simple_select('settinggroups', '*', "name='hideip_settings'");

	if (count($db->fetch_array($query)))
	{
		$hideip_settings_link = '(<a href="index.php?module=config&action=change&search=hideip_settings" style="color:#035488; background: url(../images/usercp/options.gif) no-repeat 0px 18px; padding: 18px; text-decoration: none;">'.$db->escape_string($lang->hideip_configure).'</a>)';
	}

    return array(
        "name"          =>  $db->escape_string($lang->hideip_name),
        "title"         =>  $db->escape_string($lang->hideip_title),
        "description"   =>  $db->escape_string($lang->hideip_descrip) . "  " . $hideip_settings_link,
        "website"       => "http://www.soportemybb.com",
        "author"        => "Dark Neo",
        "authorsite"    => "http://darkneo.skn1.com",
        "version"       => "1.9",
        "guid"          => "2a556973bb6272ee420110b64573f58c",
        "compatibility" => "18*",
    );
}

// Cuando damos clic en activar, para crear el grupo de opciones y las plantillas para el uso del plugin
function hideip_activate()
{
	// Creando las opciones del plugin 
	global $db, $lang, $cache;
	
    $lang->load("hideip");

//Creamos la hoja de estilo para nuestros botones...
	$query_tid = $db->write_query("SELECT tid FROM ".TABLE_PREFIX."themes");
	$themetid = $db->fetch_array($query_tid);
	//foreach($themetid){
	$style = array(
			'name'         => 'hideip_box.css',
			'tid'          => $themetid['tid'],
			'stylesheet'   => $db->escape_string('.hideip_box{
    color: #9F6000;
    background: #FEEFB3 url(images/closed.png) no-repeat;
	font-family:Verdana, Helvetica, Tahoma;
	text-align: center;
	width: 95%;
	border: 1px solid;
	margin: 10px 12px;
	padding:10px 10px;
	border-radius: 5px;
}

.unhideip_box{
	background: #DFF2BF;
	font-family:Verdana, Helvetica, Tahoma;
	text-align: justify;	
	border: 1px solid #424242;
	margin: 10px 12px;
	padding:10px 10px;
	border-radius: 5px;
}

.hideip_content{
	color:#E0143D;
	font-size:12px;
	font-weight: bold;
}

.hideip_content_small{
	color:#DC143C;
	font-size:9px;
	font-weight: bold;
}

.hideip_content_show{
	color:#414141;
	font-family:Verdana;
	font-size:11px;
}'),
			'lastmodified' => TIME_NOW
		);
		$sid = $db->insert_query('themestylesheets', $style);
		$db->update_query('themestylesheets', array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
		$query = $db->simple_select('themes', 'tid');
		while($theme = $db->fetch_array($query))
		{
			require_once MYBB_ADMIN_DIR.'inc/functions_themes.php';
			update_theme_stylesheet_list($theme['tid']);
		}

	//Cambios en las plantillas...
	require MYBB_ROOT."inc/adminfunctions_templates.php";	
	find_replace_templatesets("printthread", '#'.preg_quote('</style>').'#', '</style>
<link href="{$mybb->settings[\'bburl\']}/archive/hideip_box.css" rel="stylesheet" type="text/css" />');
	find_replace_templatesets("portal_announcement", '#'.preg_quote('{$post[\'attachments\']}').'#', '{$portal[\'attachments\']}');
	
	// Creamos las plantillas necesarias
	$template = array(
		"tid"		=> NULL,
		"title"		=> "hideip_box",
		"template"	=> $db->escape_string("<div class=\"hideip_box\">{\$msg}</div>"),
		"sid"		=> "-1"
	);
	$db->insert_query("templates", $template);
	
	$template = array(
		"tid"		=> NULL,
		"title"		=> "unhideip_box",
		"template"	=> $db->escape_string("<div class=\"unhideip_box\">{\$msg}</div>"),
		"sid"		=> "-1"
	);
	$db->insert_query("templates", $template);
	
	$group = array(
		"name"			=> "hideip_settings",
		"title" 		=> $db->escape_string($lang->hideip_settings_title),
		"description"	=> $db->escape_string($lang->hideip_settings_descrip),
		"disporder"		=> "50",
		"isdefault"		=> "no",
	);

	$db->insert_query("settinggroups", $group);
	$gid = intval($db->insert_id());
	$settings = array(

	array(
		"name"			=> "hideip_enabled",
		"title"			=> $db->escape_string($lang->hideip_power),
		"description"	=> $db->escape_string($lang->hideip_power_descrip . $settings_link),
		"optionscode"	=> "yesno",
		"value"			=> "yes",
		"disporder"		=> 1,
		"gid"			=> $gid,
	),
	array(
		"name"			=> "hideip_link_enabled",
		"title"			=> $db->escape_string($lang->hideip_links),
		"description"	=> $db->escape_string($lang->hideip_links_descrip),
		"optionscode"	=> "yesno",
		"value"			=> "yes",
		"disporder"		=> 2,
		"gid"			=> $gid,
	),
    array(
        "name"			=> "hideip_hide_enabled",
        "title"			=> $db->escape_string($lang->hideip_hide),
        "description"	=> $db->escape_string($lang->hideip_hide_descrip),
        "optionscode"	=> "yesno",
        "value"			=> "yes",
        "disporder"		=> 3,
        "gid"			=> $gid,
    ),
    array(
        "name"			=> "hideip_attach_enabled",
        "title"			=> $db->escape_string($lang->hideip_attachments),
        "description"	=> $db->escape_string($lang->hideip_attachments_descrip),
        "optionscode"	=> "yesno",
        "value"			=> "yes",
        "disporder"		=> 4,
        "gid"			=> $gid,
    ),
    array(
        "name"			=> "hideip_gid_exclude",
        "title"			=> $db->escape_string($lang->hideip_groups),
        "description"	=> $db->escape_string($lang->hideip_groups_descrip),
        "optionscode"	=> "text",
        "value"			=> 4,
        "disporder"		=> 5,
        "gid"			=> $gid,
    ),
    array(
        "name"			=> "hideip_fid_exclude",
        "title"			=> $db->escape_string($lang->hideip_forums),
        "description"	=> $db->escape_string($lang->hideip_forums_descrip),
        "optionscode"	=> "text",
        "value"			=> 0,
        "disporder"		=> 6,
        "gid"			=> $gid,
    )
	);
	foreach($settings as $setting)
	$db->insert_query("settings", $setting);
	rebuildsettings();
}

// Al desactivar el plugin eliminamos las opciones creadas y las plantillas generadas al instalar el plugin
function hideip_deactivate()
{
	global $db, $cache;

    //Eliminamos la hoja de estilo creada...
   	$db->delete_query('themestylesheets', "name='hideip_box.css'");
	$query = $db->simple_select('themes', 'tid');
	while($theme = $db->fetch_array($query))
	{
		require_once MYBB_ADMIN_DIR.'inc/functions_themes.php';
		update_theme_stylesheet_list($theme['tid']);
	}

	//Eliminamos los cambios en las plantillas...
	require '../inc/adminfunctions_templates.php';
	find_replace_templatesets("postbit", '#'.preg_quote('<link href="{$mybb->settings[\'bburl\']}/archive/hideip_box.css" rel="stylesheet" type="text/css" />').'#', '', 0);
	find_replace_templatesets("portal_announcement", '#'.preg_quote('$portal[\'attachments\']').'#', '$post[\'attachments\']', 0);
	
	$db->delete_query("templates","title = 'hideip_box'");
	$db->delete_query("templates","title = 'unhideip_box'");		
	$db->delete_query("settinggroups","name = 'hideip_settings'");
	$db->delete_query("settings","name LIKE 'hideip_%'");
    rebuildsettings();
    return true;
}

// Guarda en cache si el usuario ya ha respondido al tema...
function hideip_count($tid,$uid)
{
	global $db, $thread, $mybb, $hideip_cache, $cache;

	if($tid == '' || $tid == 0)
	{
			$tid = $thread['tid'];
	}

	if(!isset($hideip_cache['posts'][$user['uid']]))
	{
		$hideip_cache = $cache->read('hideip_cache');
		static $posts = 0;
		$query = $db->simple_select("posts","COUNT(pid) AS posts","tid='{$tid}' AND uid = '{$uid}'" );
		$posts = intval($db->fetch_field($query,"posts"));
		$hideip_cache['posts'][$user['uid']] = $posts;
	}
    $posts = $hideip_cache['posts'][$user['uid']];	
	return $posts;
}

//Vamos a validar las opciones de nuestra cuenta, para ver si podemos o no mirar los contenidos...
function hideip_validate($fid)
{
	global $mybb;
	// Verifica los grupos de usuario.
	if($mybb->settings['hideip_gid_exclude'])
	{
		$groups = explode(",", $mybb->settings['hideip_gid_exclude']);
		if(in_array($mybb->user['usergroup'], $groups))
		{
			return false;
		}
	}
	
	// Verifica que la lista de foros sea tomada en el plugin.
	if($mybb->settings['hideip_fid_exclude'])
	{
		$fids = explode(",", $mybb->settings['hideip_fid_exclude']);
		if(in_array($fid, $fids))
		{
			return false;
		}
	}
	return true;
}

// Filtro utilizado para el contenido de los mensajes...
function hideip_filter($msg,$fid,$tid)
{
	global $mybb,$attachcache;
	
    if(!hideip_count($tid,$mybb->user['uid']))
    {
        // Ocultar enlaces
		if($mybb->settings['hideip_link_enabled'])
		{
			$msg = preg_replace("#(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)#is",'',$msg);
		}
        // Ocultar el contenido del MyCode hide
		if($mybb->settings['hideip_hide_enabled'])
		{
			$msg = preg_replace("#\[hide\](.*)\[/hide\]#is",'',$msg);
		}
		//Ocultar adjuntos en el mensaje
   	    if($mybb->settings['hideip_attach_enabled'])
     	{
			$msg = preg_replace("#\[attachment=(.*?)\]#is",'',$msg);
	    }
	}
}

function hideip_code_ajax()
{
	global $mybb,$templates,$thread,$lang,$post,$attachcache, $fid, $tid;
	if($fid == 0 || $fid == ""){$fid = $forum['fid'];}
	$fids = explode(",", $mybb->settings['hideip_fid_exclude']);
	if(in_array($fid, $fids))
	{
		return false;
	}
	
		// Si utilizamos la respuesta rápida - entonces pasamos a esto xD...
		if($mybb->settings['hideip_enabled'] && $mybb->input['ajax'])
		{
            //redirect(get_thread_link($tid, 0, "lastpost"));
			redirect(get_thread_link($tid, 0, ""));
		}
}

// Reemplaza los contenidos que tengan los criterios mostrados - En mi caso la etiqueta hide, las urls y los archivos adjuntos dentro del mensaje.
function hideip_code(&$message)
{
	global $mybb,$templates,$thread,$lang,$post,$session, $announcement, $postrow, $attachcache,$attachments,$forum;

	if(file_exists($lang->path."/".$lang->language."/hideip.lang.php"))
	{
		$lang->load("hideip");
	}
	else{
	echo "You must put lang files propertly";
	}
	
    $fids = explode(",", $mybb->settings['hideip_fid_exclude']);
	$groups = explode(",", $mybb->settings['hideip_gid_exclude']);
	
	$fid = $forum['fid'];
		
     if(THIS_SCRIPT == "portal.php"){
		 $fid = $announcement['fid'];
		 $post['uid'] = $announcement['uid'];
		 $post['pid'] = $announcement['pid'];
		   	/*if($mybb->settings['hideip_attach_enabled'] && is_array($attachcache[$post['pid']]) && $mybb->user['uid'] != $post['uid'])
			{
			$counter = is_array($attachcache[$post['pid']]);
				$id = $announcement['pid'];
				foreach($attachcache[$id] as $aid => $attachment)
				{
				$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
				$attachment['filesize'] = get_friendly_size($attachment['filesize']);
				}
				$counter = $attachment['filename']. $attachment['visible']. $attachment['aid'];
              // $announcement['message'] = preg_replace($attachment['filename'],"",$announcement['message']);
				echo "SI HAY ADJUNTOS: " . $counter;
				if(!hideip_count($mybb->input['tid'],$mybb->user['uid']))
				{
				$portal['attachments'] = $counter;
				echo "NO ESTAS EN LA LISTA";
						// Ocultar adjuntos en los mensajes...
						$msg = "<span class=\"hideip_content\">".$lang->hideip_hide_hidden."</span><br /><span class=\"hideip_content_small\">".$lang->hideip_hide_attach."</span>";
						eval("\$post['attachments'] = \"".$templates->get("postbit_attachments")."\";");
						$message = preg_replace("#\[attachment=(.*?)\]#is",$postbit['attachments'],$message);               
				}
				else{
				$portal['attachments'] = $counter;
				echo "SI ESTAS EN LA LISTA";
				}
			}*/
	 }

     if(THIS_SCRIPT == "printthread.php"){
		 $post['uid'] = $postrow['uid'];
	 }
	 
	 if(THIS_SCRIPT == "syndication.php"){
			if($mybb->settings['hideip_link_enabled'])
			{
				// Ocultamos los enlaces
				$message = preg_replace("#<a[^>]*(http|www)(.*)</a>#siU","",$message);
			}
			if($mybb->settings['hideip_hide_enabled'])
			{
				// Ocultamos el contenido del MyCode hide
                $message = preg_replace("#\[hide\](.*?)\[/hide\]#is","",$message);               
			}
			if($mybb->settings['hideip_attach_enabled'])
			{
			    $attachments = "";	             
			}		
   }
   
     if($mybb->settings['hideip_enabled'] == "0" || in_array($fid, $fids)){
		return false;
	}
			
	    // Solo se efectua cuando vamos a responder al tema.
		if($mybb->user['uid'] == $post['uid'] || in_array($mybb->user['usergroup'], $groups))
		{
		// Se muestra el contenido si has respondido al tema		
        $msg = "<span class=\"hideip_content\">".$lang->hideip_hide_show."</span><br />$1";
    	eval("\$box = \"".$templates->get("unhideip_box",1,0)."\";");		
		$message = preg_replace("#\[hide\](.*?)\[/hide\]#is",$box,$message);
		
        $find = '<a href="';
	    $replace = '<b><a href="';
        $message = str_replace($find, $replace, $message);   
        $find = '</a>';
	    $replace = '</a></b>';
		
        /*$message = str_replace($find, $replace, $message);   
        $find = '<img src="';
        $replace = '<img class="dnimg" src="';*/
		
        $message = str_replace($find, $replace, $message);  			
		}
		//Si no has respondido o no eres el autor de tema, no te mostrara los contenidos elegidos...
		else if(hideip_count($mybb->input['tid'],$mybb->user['uid']))
	    {
			// Se muestra el contenido si has respondido al tema	
            $msg = "<span class=\"hideip_content\">".$lang->hideip_hide_show."</span><br />$1";
			eval("\$box = \"".$templates->get("unhideip_box",1,0)."\";");		
			$message = preg_replace("#\[hide\](.*?)\[/hide\]#is",$box,$message);
			
			$find = '<a href="';
			$replace = '<b><a href="';
			$message = str_replace($find, $replace, $message);   
			$find = '</a>';
			$replace = '</a></b>';		
			$message = str_replace($find, $replace, $message);  			
			$done = true;
		}
		else
		{
			if($mybb->settings['hideip_link_enabled'])
			{
				// Ocultamos los enlaces
		   	    $msg = "<span class=\"hideip_content\">".$lang->hideip_hide_hidden."</span><br /><span class=\"hideip_content_small\">".$lang->hideip_hide_url."</span>";
 				eval("\$box = \"".$templates->get("hideip_box",1,0)."\";");
				$message = preg_replace("#<a[^>]*(http|www)(.*)</a>#siU",$box,$message);
			}
			if($mybb->settings['hideip_hide_enabled'])
			{
				// Ocultamos el contenido del MyCode hide
		   	    $msg = "<span class=\"hideip_content\">".$lang->hideip_hide_hidden."</span><br /><span class=\"hideip_content_small\">".$lang->hideip_hide_text."</span>";
    			eval("\$box = \"".$templates->get("hideip_box",1,0)."\";");
                $message = preg_replace("#\[hide\](.*?)\[/hide\]#is",$box,$message);               
			}
			/*if($mybb->settings['hideip_attach_enabled'])
			{
			    // Ocultar adjuntos en los mensajes...
		   	    $msg = "<span class=\"hideip_content\">".$lang->hideip_hide_hidden."</span><br /><span class=\"hideip_content_small\">".$lang->hideip_hide_attach."</span>";
    			//eval("\$box = \"".$templates->get("hideip_box",1,0)."\";");
                eval("\$post['attachments'] = \"".$templates->get("hideip_box",1,0)."\";");				
                $message = preg_replace("#\[attachment=(.*?)\]#is",$box,$message);               
			}	*/	
		}
}

//Se ejecuta al citar un tema, si ya has respondido podrás citar los contenidos, de otra forma, no puedes citar ninguna url
//ya sea contenida de un video, imagen, etc, ya que por defecto en el parse_quoted, toma los contenidos directamente.

function hideip_quote(&$quoted_post)
{
	global $mybb, $db, $session, $templates,$lang,$thread,$post,$attachcache, $fid, $tid; 

	$fids = explode(",", $mybb->settings['hideip_fid_exclude']);
	$groups = explode(",", $mybb->settings['hideip_gid_exclude']);

	if($mybb->input['action'] == "get_multiquoted"){
		$fid = $quoted_post['fid'];
	}
    
	if($tid == '' || $tid == 0)
	{
		$query = $db->simple_select("posts", "tid", "pid ={$post['pid']}");
		$thread = $db->fetch_array($query);
		$tid = $thread['tid'];	
	}

    if($mybb->settings['hideip_enabled'] == "0" || in_array($fid, $fids))
    {
    return false;
    }	

	// Solo se efectua cuando vamos a responder al tema.
	if ($mybb->user['uid'] != $post['uid'] && hideip_validate($post['fid'])){
		if(hideip_count($mybb->input['tid'],$mybb->user['uid']) || in_array($mybb->user['usergroup'], $groups))
		{
		// Se muestra el contenido si has respondido al tema, o tienes permisos para ello		
        $quoted_post['message'] = $quoted_post['message'];
     	}
		else
		{		
			if($mybb->settings['hideip_hide_enabled'])
			{
				$quoted_post['message'] = preg_replace('#\[hide\](.*?)\[/hide\]#is', "\r", $quoted_post['message']);
			}
			if($mybb->settings['hideip_link_enabled'])
			{ 
			      //Creamos el bucle de engaño, para pasar los enlaces a urls y de ahi luego eliminarlos en la siguiente sentencia xD...
 	              $quoted_post['message'] = preg_replace("#(https?://([-\w\.]+)+(:\d+)?(/([\w/_'-\.]*(\?\S+)?)?)?)#is","[url]$1[/url]",$quoted_post['message']);
				  $quoted_post['message'] = preg_replace('#\[img\]\[url\](.*?)\[/url\]\[/img\]#is', "[img]$1[/img]", $quoted_post['message']);
				  $quoted_post['message'] = preg_replace('#\[video=(.*?)\]\[url\](.*?)\[/video\]\[/url\]#is', "[video=$1]$2$3[/video]", $quoted_post['message']);
				  
    		}			
			$quoted_post['message'] = preg_replace('#\[url\](.*?)\[/url\]#is', "\r", $quoted_post['message']);
			$quoted_post['message'] = preg_replace('#\[url=(.*?)\](.*?)\[/url\]#is', "\r", $quoted_post['message']);
		}
	}

}

//Sucede al hacer una edición completa...
function hideip_edit(){
    global $mybb, $post, $fid, $lang;

	if(file_exists($lang->path."/".$lang->language."/hideip.lang.php"))
	{
		$lang->load("hideip");
	}
	else{
	echo "You must put lang files propertly";
	}

	//Traemos los datos del mensaje en cuestion, para los datos:
	$post = get_post($mybb->input['pid']);
    
    $fids = explode(",", $mybb->settings['hideip_fid_exclude']);
    $formated['username'] = format_name($mybb->user['username'],$mybb->user['usergroup'],$mybb->user['displaygroup']);

	// Creamos un mensaje con una variable asignada para el nombre de usuario preformateado xD.
	// En el idioma podemos incluir mas de una, declarandolas separadas por comas xD.
    //$cant_edit = $lang->sprintf($lang->hideip_cant_edit, $formated['username'], $fid, $post['uid']);
	$cant_edit = $lang->sprintf($lang->hideip_cant_edit, $formated['username']);
	
    if($mybb->settings['hideip_enabled'] == "0" || in_array($fid, $fids))
    {
    return false;
    }

    $groups = explode(",", $mybb->settings['hideip_gid_exclude']);
	if(!in_array($mybb->user['usergroup'], $groups) && THIS_SCRIPT == "editpost.php" || $mybb->user['uid'] != $post['uid'] && THIS_SCRIPT == "editpost.php")
	{
		error($cant_edit, 0);
	}
}

//Sucede al hacer una edición del tema en edición rápida
function hideip_qedit(){
    global $mybb, $post, $thread, $forum, $lang;
	
	if(file_exists($lang->path."/".$lang->language."/hideip.lang.php"))
	{
		$lang->load("hideip");
	}
	else{
	echo "You must put lang files propertly";
	}

	//Traemos los datos del mensaje en cuestion, para los datos:
	$post = get_post($mybb->input['pid']);
	// asociamos el tema con el mensaje.
	$thread = get_thread($post['tid']);
	// validamos el foro en el que estamos.
	$forum = get_forum($thread['fid']);
	$fid = $forum['fid'];
	$tid = $forum['tid'];

	if($mybb->input['action'] == "get_multiquoted"){
		return true;
	}
	
    //error_no_permission();
    $fids = explode(",", $mybb->settings['hideip_fid_exclude']);
    if($mybb->settings['hideip_enabled'] == "0" || in_array($fid, $fids))
    {
		return false;
    }

    $groups = explode(",", $mybb->settings['hideip_gid_exclude']);
	if($mybb->input['action'] == "edit_post" && !in_array($mybb->user['usergroup'], $groups) || $mybb->input['action'] == "edit_post" && $mybb->user['uid'] != $post['uid'])
	{
		xmlhttp_error($lang->hideip_cant_qedit);
	}

}

//Sucede cuando buscamos los adjuntos en los temas para ocultarlos o mostrarlos, dependiendo de los criterios establecidos
function hideip_clear(&$post)
{
	global $mybb,$attachcache,$templates, $lang;
	if(file_exists($lang->path."/".$lang->language."/hideip.lang.php"))
	{
		$lang->load("hideip");
	}
	else{
	echo "You must put lang files propertly";
	}
	if(hideip_validate($post['fid'])){
	global $can_delete, $forumpermissions;
		$can_delete = 0;
		$forumpermissions['candeletethreads'] = 0;
		if($mybb->user['uid'] != $post['uid']){$post['button_quickdelete'] = '';}
		if($mybb->settings['hideip_attach_enabled'] && is_array($attachcache[$post['pid']]) && $mybb->user['uid'] != $post['uid'])
		{
			if(!hideip_count($mybb->input['tid'],$mybb->user['uid']))
			{
					// Ocultar adjuntos en los mensajes...
					$msg = "<span class=\"hideip_content\">".$lang->hideip_hide_hidden."</span><br /><span class=\"hideip_content_small\">".$lang->hideip_hide_attach."</span>";
					eval("\$post['attachments'] = \"".$templates->get("hideip_box",1,0)."\";");
					$message = preg_replace("#\[attachment=(.*?)\]#is",$post['attachments'],$message);               
			}
		}
	}
}

?>
