<?php
/*
 * Copyright (c) 2004-2009 Luiz Otavio O Souza <loos.br@gmail.com>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

/* 
 * $Id: user.php 112 2009-03-15 17:30:28Z loos-br $
 */


    // As linhas abaixo eliminam mensagens de erro nos logs do php.
    (isset($_REQUEST['viewby'])) ? $viewby=$_REQUEST['viewby'] : $viewby="STATUS";
    (isset($_REQUEST['list'])) ? $list=$_REQUEST['list'] : $list="FL";
    // by Eric Anderson Qua Ago 22 10:57:35 BRT 2007

    require('default.array.status.inc.php');
    require('header.inc.php');
    require('mysql.inc.php');
    require('lists.inc.php');

    if ($_REQUEST['email']) {
	$sql  = "SELECT * FROM contacts WHERE email = '".$_REQUEST['email']."' ";
    }

    $rs = mysql_query($sql, $mysql) or die('fail to run query');

    require("js.inc.php");

?>
<script language="JavaScript">
<!--

    function noop() {
	return;
    }

    function expand(id, plus) {
        var itm = null;
	var html = null;

        if (document.getElementById) {
            itm = document.getElementById(id);
	    html = document.getElementById(plus);
        } else if (document.all){
            itm = document.all[id];
	    html = document.all[plus];
        } else if (document.layers){
            itm = document.layers[id];
        }
        
        if (!itm) {
            // do nothing
        }
        else if (itm.style) {
            if (itm.style.display == 'none') { itm.style.display = ''; html.innerHTML = '+'; }
            else { itm.style.display = 'none'; html.innerHTML = '-'; }
        }
        else { itm.visibility = 'show'; html.innerHTML = '+'; }
    }

//-->
</script>
<body bgcolor="#FFFFFF">

<form action="user.php" method="GET" name="form">
<div align="center"><div align=center style="width: 400px; border-color: gray; border-style: solid; border-width: 1;">
    
 <a href="user.php?email=<?php echo $_REQUEST['email'] ?>&viewby=STATUS">Classificar por status</a> |
 <a href="user.php?email=<?php echo $_REQUEST['email'] ?>&viewby=GROUP">Classificar por grupos</a>
 <br><br>
<?php
    if (!$viewby || $viewby == "STATUS") {
?>
 <a href="user.php?email=<?php echo $_REQUEST['email'] ?>&list=FL">Listar contatos</a> |
 <a href="user.php?email=<?php echo $_REQUEST['email'] ?>&list=<?php echo $LISTS_AL; ?>">Listar contatos liberados</a> |
 <a href="user.php?email=<?php echo $_REQUEST['email'] ?>&list=<?php echo $LISTS_BL; ?>">Listar contatos bloqueados</a>
 <br><br>
<?php
    }
?>
 <a href="index.php">Voltar</a>
 <br><br>
</div></div>
<br>
<?php
    flush();
    switch ($viewby) {
	case "GROUP":
	    require('group.inc.php');
	    break;
	default:
	    switch ($list) {
		case "$LISTS_BL":
		    lists($LISTS_BL, "Contatos bloqueados");
		    break;
		case "$LISTS_AL":
		    lists($LISTS_AL, "Contatos liberados");
		    break;
		default:
		    require('fl.inc.php');
		    break;
	    }
    }
?>
 <br><br>
</form>

</body>
</html>
<?php
    mysql_close($mysql);
?>
