<?php 
##############################################################
##In-portal													##
##############################################################
##					      In-portal							##
##					Intechnic Corporation					##
##			   All Rights Reserved, 1998-2002				##
##															##	
##	No portion of this code may be copied, reproduced or	##	
##	   otherwise redistributed without proper written		##
##	  consent of Intechnic Corporation.  Violation will		##
##	   result in revocation of the license and support		##
##	 privileges along maximum prosecution allowed by law.	##
##############################################################

// new startup: begin
define('REL_PATH', 'admin/users');
$relation_level = count( explode('/', REL_PATH) );
define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
require_once FULL_PATH.'/kernel/startup.php';
// new startup: end

require_once ($pathtoroot.$admin."/include/elements.php"); 
require_once ($pathtoroot."kernel/admin/include/navmenu.php"); 
//require_once ($pathtolocal."admin/include/navmenu.php"); 
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");

$section = "in-portal:banlist_apply";

$UsersPerLoad =30;

$ado = &GetADODBConnection();
    $UserIndex = (int)$_GET["UserIndex"];
    if($UserIndex==0)
    {
       $table = $objUsers->SourceTable;        
       $NumUsers = TableCount($table,"",0);
    }
    else
    {
        $NumUsers = $_GET["NumUsers"];
        $table = $objUsers->SourceTable;
    }

    $title = prompt_language("la_prompt_applyingbanlist");
    
    if($UserIndex <= $NumUsers)
    {
    	$title .= " $UserIndex / $NumUsers ".prompt_language("la_Text_complete");
    }
    else 
		$title .= " $NumUsers / $NumUsers ".prompt_language("la_Text_complete");

    
	$sql = "SELECT * FROM $table LIMIT $UserIndex,$UsersPerLoad";
    //echo $sql."<br>\n";
    $objUsers->Query_Item($sql);
    
    foreach($objUsers->Items as $u)
    {                 
    	$BrokenRule = $u->CheckBanned();
        if($BrokenRule)
        	$u->Deny(1); // 1 - IsBanned mark in db, 0 - No such mark
            
    }
    
int_header(NULL,NULL,$title);
?>
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<?php int_subsection_title(""); ?>
<?php
  if($NumUsers==0)
  {  
      $percent=100;
  }
  else
  {
     $percent = (int)(($UserIndex/$NumUsers) * 100);
  }
		if ($percent == 0)
		{
			echo "<TR>";
			echo "<TD BGCOLOR=\"#FFFFFF\" width=\"100%\" >$percent";
			echo "%</td></TR>";
		}
		else if ($percent < 60)
		{
			echo "<TR><TD BGCOLOR=\"#4682B2\" width=\"".$percent."%\" >";
			$row2 = 100-$percent;
			echo "</td> <TD BGCOLOR=\"#FFFFFF\" width=\"".$row2."%\" > $percent";
			echo "%</td></TR>";
		}
		elseif ($percent == 100)
		{
		   echo "<TR><TD BGCOLOR=\"#4682B2\" align=\"right\" width=\"100%\" ><FONT COLOR=\"#FFFFFF\">$percent%</FONT></td>";
		}
		else
		{
			echo "<TR><TD BGCOLOR=\"#4682B2\" align=\"right\" width=\"".$percent."%\" ><FONT COLOR=\"#FFFFFF\">$percent%</FONT>";
			$row2 = 100-$percent;
			echo "</td> <TD BGCOLOR=\"#FFFFFF\" width=\"".$row2."%\" ></td></TR>";
		}
        flush(); 
?>
</TABLE>
<?php
        if($UserIndex >= $NumUsers)
        {        
          $target = $adminURL."/users/user_list.php?env=".BuildEnv()."&ResetPage=1";
        }
        else
        {
        	if (($NumUsers - $UserIndex) < $UsersPerLoad)
        		$next = $UserIndex + ($NumUsers - $UserIndex);
        	else
          		$next = $UserIndex + $UsersPerLoad;
          	
          $target = $_SERVER["PHP_SELF"]."?env=".BuildEnv()."&UserIndex=".$next."&NumUsers=$NumUsers";
        }
        //print "<A HREF=\"$target\">$target</A>";
		print "<script language=\"javascript\">" ;
		print "setTimeout(\"document.location='$target';\",40);";
		print " </script>";                  
?>
<?php int_footer(); ?>