View file system/connections/array_to_function.php

File size: 3.94Kb
<?php

/*
----------------------
Настройки пользователя
----------------------
*/
  
$settings_data = db::get_string("SELECT * FROM `USERS_SETTINGS` WHERE `USER_ID` = ? LIMIT 1", [user('ID')]); 
  
function settings($data){
  
  global $settings_data;
  
  if (user('ID') == 0){
    
    return 0;
    
  }else{

    return tabs($settings_data[$data]);
    
  }
  
}

$param = 0;
if (url_request_validate('/admin') == false) { $param = 1; }

/*
-------------------------------------------
Корректировка текстовых иконок Font-Awesome
-------------------------------------------
*/

if ($param == 1 && is_file(ROOT.'/style/version/'.version('DIR').'/includes/m_icons.php')) {
  
  require (ROOT.'/style/version/'.version('DIR').'/includes/m_icons.php');

}else{
  
  function icons($icons, $size = 15, $fw = null){
    
    return "<i style='font-size: ".$size."px; vertical-align: middle' class='fa fa-".$icons." ".$fw."'></i>";
  
  }
  
}

/*
--------------------------------------
Корректировка иконок расширений файлов
--------------------------------------
*/

function file_icons($ext, $color = '#337AB7', $icons = 'file', $type = 'big'){
  
  if ($type == 'big') {
    
    return "<div class='corner-box' style='background: linear-gradient(to left bottom, transparent 50%, rgba(0,0,0,.4) 0) no-repeat 100% 0 / 15px 15px, linear-gradient(-135deg, transparent 10px, ".$color." 0);'><span class='corner-box-icons'>".icons($icons, 15)."</span><span class='corner-box-ext'>".$ext."</span></div>";
    
  }elseif ($type == 'small') {
    
    return "<span style='color: ".$color."'>".icons($icons, 17, 'fa-fw')."</span>";
    
  }

}

/*
--------------------
Стилизованные иконки
--------------------
*/

if ($param == 1){
  
  if (is_file(ROOT.'/style/version/'.version('DIR').'/includes/icons.php')) {
    
    require (ROOT.'/style/version/'.version('DIR').'/includes/icons.php');
  
  }else{
    
    if (is_file(ROOT.'/style/version/'.version('DIR').'/includes/param_icons_mini.php')) {
      
      require (ROOT.'/style/version/'.version('DIR').'/includes/param_icons_mini.php');
    
    }else{
      
      define('PARAM_ICONS_MINI_COLOR', null);
      define('PARAM_ICONS_MINI_BACKGROUND', null);
    
    }
  
    function m_icons($icons, $size, $color = '#6E7B80', $i = 1){
    
      if (str(PARAM_ICONS_MINI_COLOR) > 0 && str(PARAM_ICONS_MINI_BACKGROUND) > 0 && $i == 1) {
      
        $color = PARAM_ICONS_MINI_BACKGROUND;
        $tcolor = PARAM_ICONS_MINI_COLOR;
    
      }else{
      
        $color = $color;
        $tcolor = 'white';
    
      }
    
      return "<span class='icons-circle' style='background-color: ".$color."'; color: ".$tcolor.">".icons($icons, $size)."</span>";
  
    }
  
    if (is_file(ROOT.'/style/version/'.version('DIR').'/includes/param_icons.php')) {
    
      require_once (ROOT.'/style/version/'.version('DIR').'/includes/param_icons.php');
  
    }else{
    
      define('PARAM_ICONS_COLOR', null);
      define('PARAM_ICONS_GH_BACKGROUND', null);
      define('PARAM_ICONS_GW_BACKGROUND', null);
      define('PARAM_COUNT_BACKGROUND', null);
  
    }
  
    function b_icons($icons, $count = null, $size, $GHcolor = '#6E7B80', $GWcolor = '#6E7B80'){
    
      if (str(PARAM_ICONS_COLOR) > 0 && str(PARAM_ICONS_GW_BACKGROUND) > 0 && str(PARAM_ICONS_GH_BACKGROUND) > 0 && str(PARAM_COUNT_BACKGROUND) > 0) {

        $ccolor = PARAM_COUNT_BACKGROUND;
        $tcolor = PARAM_ICONS_COLOR;
        $color = 'linear-gradient(to top left, '.PARAM_ICONS_GH_BACKGROUND.', '.PARAM_ICONS_GW_BACKGROUND.')';
    
      }else{
      
        $color = 'linear-gradient(to top left, '.$GHcolor.', '.$GWcolor.')';
        $tcolor = 'white';
        $ccolor = null;
    
      }
    
      return "<div class='menu-container_icons' style='background: ".$color."; color: ".$tcolor."'><div style='".$ccolor."'>".$count."</div>".icons($icons, $size)."</div>";
    
    }
    
  }
    
}