<?php
  ///////////////////////////////////////////////////
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang."/".$lang.".php")) {include "../lang/".$lang."/".$lang.".php";}
     else {include "../lang/ru/ru.php";}

  $title = $TEXT['menu-btn14'];

  require_once "../config_a.php";
  require_once "../utils/functions.php";
  require_once "../utils/top_adm.php";

  if($result2['administrator'] == 0) {puterror($result2['skin'],$TEXT['error-loginform2']); require_once "../utils/bottom_adm.php"; exit();}
?>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="90%">
<tr align="right">
    <td><img align="bottom" alt="<?php echo $TEXT['add-new']; ?>" src="../skins/<?php echo $result2['skin']; ?>/add.png" /><a class="bold_it" href="addform.php" title="<?php echo $TEXT['add-new-tit']; ?>"><?php echo $TEXT['add-new']; ?></a></td>
</tr>
</table>
<table align="center" border="1" cellpadding="3" cellspacing="0" width="90%">
<?php
     $query = "SELECT `cl_id`, `col_tbl_name`, `by_data`, `by_count` FROM `tbl_clear`";
     $result = mysqli_query($dbcnx,$query);
     if(!$result) {puterror($result2['skin'],$TEXT['error-tbl8']); require_once "../utils/bottom_adm.php"; exit();}
       if(mysqli_num_rows($result)>0)
         {
           echo "<thead><tr class='tableheadercat'>
            <td>".$TEXT['analiz-tab']."</td>
            <td>".$TEXT['param_days']."</td>
            <td>".$TEXT['size-count2']."</td>
            <td colspan=2>".$TEXT['tbl-action']."</td>
                 </tr></thead><tbody id='tab'>";
             while($result_tables = mysqli_fetch_array($result,MYSQLI_ASSOC))
              {
              $delete_pic = "<img alt='delete' src='../skins/".$result2['skin']."/delete.png' />";
              $edit_pic = "<img alt='edit' src='../skins/".$result2['skin']."/edit.png' />";
              $edit = $edit_pic."&nbsp;<a href=editform.php?cl_id=".$result_tables['cl_id']." title='".$TEXT['edit-tit']."'>".$TEXT['edit-new']."</a>";
              $delete = $delete_pic."&nbsp;<a href=delete.php?cl_id=".$result_tables['cl_id']." title='".$TEXT['delete-tit']."'>".$TEXT['delete-new']."</a>";

              if($result_tables['by_data'] == 0) {$by_data = "<img alt='unlock' src='../skins/".$result2['skin']."/unlock.png' />";}
               else {$by_data = $result_tables['by_data'];}

              if($result_tables['by_count'] == 0) {$by_count = "<img alt='unlock' src='../skins/".$result2['skin']."/unlock.png' />";}
               else {$by_count = $result_tables['by_count'];}

              if($result_tables['col_tbl_name'] == "tbl_logs") {$col_tbl_name = $TEXT['menu-btn5'];}
           ?>
             <tr>
              <td><?php echo $col_tbl_name; ?></td>
              <td align="center"><?php echo $by_data; ?></td>
              <td align="center"><?php echo $by_count; ?></td>
              <td align="center"><?php echo $edit; ?></td>
              <td align="center"><?php echo $delete; ?></td>
             </tr>
           <?php
             }
         }
?>
</tbody>
</table>
<?php
  require_once "../utils/bottom_adm.php";
?>