<?php
  
FOREACH (ARRAY('config', 'connect', 'users') AS $connect) {
  
  INCLUDE_ONCE ("../../../system/connections/global/$connect.php"); 
  
}

ACCESS('users');

IF (AJAX() == TRUE){
  
  $dir = DB::GET_STRING("SELECT * FROM `SMILES_DIR` WHERE `ID` = '".INTVAL(GET('id'))."' LIMIT 1");
  
  IF (ISSET($dir['ID'])){
    
    ECHO "<div style='background-color: #E2E6E9; padding: 5px;'>";
    ECHO "<b>".TEXT_ABSOLUTE($dir['NAME'])."</b>";
    ECHO "</div>";
    
    $data = DB::GET_STRING_ALL("SELECT * FROM `SMILES` WHERE `ID_DIR` = '".$dir['ID']."' ORDER BY `ID` ASC");
    
    ECHO "<div style='padding: 8px;' class='bb_bar'>";
    
    WHILE ($list = $data->FETCH()){
      
      ECHO ' <span class="bb2" style="border: none;" alt="'.TEXT_ABSOLUTE($list['NAME']).'"><img src="/files/upload/smiles/'.$list['ID'].'.'.$list['EXT'].'" /></span> ';
      
    }
    
    ECHO "</div>";
  
  }ELSE{
    
    ECHO "<div style='background-color: #E2E6E9; padding: 5px;'>";
    ECHO "<b>".LG('Ошибка')."</b>";
    ECHO "</div>";
    
  }
  
}ELSE{
  
  REDIRECT('/index');

}
  
?>