Вид attachment dle




Версия DLE: 9.X+

Автор доработки: Assada

Автор идеи: tumoxa [MD Team]



Установка

Находим:
Code
  
  while ( $row = $db->get_row() ) {
   
  $size = formatsize( @filesize( ROOT_DIR . '/uploads/files/' . $row['onserver'] ) );
  $row['name'] = explode( "/", $row['name'] );
  $row['name'] = end( $row['name'] );

  $find_1[] = '[attachment=' . $row['id'] . ']';
  $find_2[] = "#\[attachment={$row['id']}:(.+?)\]#i";

  if ( ! $user_group[$member_id['user_group']]['allow_files'] ) {

  $replace_1[] = "<span class=\"attachment\">{$lang['att_denied']}</span>";
  $replace_2[] = "<span class=\"attachment\">{$lang['att_denied']}</span>";

  } elseif( $config['files_count'] == 'yes' ) {

  $replace_1[] = "<span class=\"attachment\"><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >{$row['name']}</a> [{$size}] ({$lang['att_dcount']} {$row['dcount']})</span>";
  $replace_2[] = "<span class=\"attachment\"><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >\\1</a> [{$size}] ({$lang['att_dcount']} {$row['dcount']})</span>";

  } else {

  $replace_1[] = "<span class=\"attachment\"><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >{$row['name']}</a> [{$size}]</span>";
  $replace_2[] = "<span class=\"attachment\"><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >\\1</a> [{$size}]</span>";

  }

  }


Заменяем на:
Code

while ( $row = $db->get_row() ) {
  $filego = ROOT_DIR . '/uploads/files/' . $row['onserver'];
  $size = formatsize( @filesize( $filego ) );
  $md5 = md5_file($filego );
  $sha1 = sha1_file($filego );
  $crc32 = crc32($filego );
  $row['name'] = explode( "/", $row['name'] );
  $row['name'] = end( $row['name'] );

  $path_info = pathinfo($filego);
  $format = $path_info['extension'];
   
  switch($format)
  {
  default: $icon = '{THEME}/dleimages/filetypes/blank.png'; break;
  case 'doc': case 'docx': $icon = '{THEME}/dleimages/filetypes/word.png'; break;
  case 'bmp': $icon = '{THEME}/dleimages/filetypes/bmp.png'; break;  
  case 'jpg': case 'jpeg': $icon = '{THEME}/dleimages/filetypes/jpg.png'; break;  
  case 'swf': $icon = '{THEME}/dleimages/filetypes/swf.png'; break;  
  case 'png': $icon = '{THEME}/dleimages/filetypes/png.png'; break;  
  case 'gif': $icon = '{THEME}/dleimages/filetypes/gif.png'; break;  
  case 'psd': $icon = '{THEME}/dleimages/filetypes/photoshop.png'; break;  
  case 'mp3': case 'wav': case 'ogg': $icon = '{THEME}/dleimages/filetypes/music.png'; break;  
  case 'avi': case 'flv': case 'wmv': $icon = '{THEME}/dleimages/filetypes/video.png'; break;  
  case 'pdf': $icon = '{THEME}/dleimages/filetypes/finerider.png'; break;
  case 'exe': $icon = '{THEME}/dleimages/filetypes/exe.png'; break;  
  case 'txt': $icon = '{THEME}/dleimages/filetypes/txt.png'; break;  
  case 'phps': case 'php': $icon = '{THEME}/dleimages/filetypes/php.png'; break;  
  case 'html': case 'htm': $icon = '{THEME}/dleimages/filetypes/code.png'; break;
  case 'rar': case 'zip': case '7z': $icon = '{THEME}/dleimages/filetypes/rar.png'; break;
  }  
   
  $find_1[] = '[attachment=' . $row['id'] . ']';
  $find_2[] = "#[attachment={$row['id']}:(.+?)]#i";

  if ( ! $user_group[$member_id['user_group']]['allow_files'] ) {

  $replace_1[] = "<span class=\"attachment\">{$lang['att_denied']}</span>";
  $replace_2[] = "<span class=\"attachment\">{$lang['att_denied']}</span>";

  } elseif( $config['files_count'] == 'yes' ) {

  $replace_1[] = "<span class=\"attachment\"><img src=\"$icon\" alt=\"$format\" title=\"$format\" align=\"middle\"/> <a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >{$row['name']}</a> [{$size}] ({$lang['att_dcount']} {$row['dcount']})
[<b>MD5:</b> {$md5}]
[<b>SHA1:</b> {$sha1}]
[<b>CRC32:</b> {$crc32}]</span>";
  $replace_2[] = "<span class=\"attachment\"><img src=\"$icon\" alt=\"$format\" title=\"$format\" align=\"middle\"/> <a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >1</a> [{$size}]({$lang['att_dcount']} {$row['dcount']})
[<b>MD5:</b> {$md5}]
[<b>SHA1:</b> {$sha1}]
[<b>CRC32:</b> {$crc32}]</span>";

  } else {

  $replace_1[] = "<span class=\"attachment\"><img src=\"$icon\" alt=\"$format\" title=\"$format\" align=\"middle\"/> <a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >{$row['name']}</a> [{$size}]
[<b>MD5:</b> {$md5}]
[<b>SHA1:</b> {$sha1}]
[<b>CRC32:</b> {$crc32}]</span>";
  $replace_2[] = "<span class=\"attachment\"><img src=\"$icon\" alt=\"$format\" title=\"$format\" align=\"middle\"/> <a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >1</a> [{$size}]
[<b>MD5:</b> {$md5}]
[<b>SHA1:</b> {$sha1}]
[<b>CRC32:</b> {$crc32}]</span>";

  }

  }


Загружаем содержимое архива в папку с шаблоном (в архиве все по папка разложено, нужно только себе в шаблон залить, должно получиться так: /templates/ШАБЛОН/dleimages/filetypes)


  Категория: DLE-хаки | Добавил: AID | Дата: 07.05.2012
Скачать Вид attachment dle с сервера
1606_-webuilder.info.rar Размер: 13.3 Kb (cкачиваний: 95)
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Хостинг от uCoz