Данный материал предоставлен сайтом ProWebber.cc исключительно в ознакомительных целях. Администрация не несет ответственности за его содержимое.
Скачать бесплатно Вид attachment.
Скачать бесплатно Вид attachment.
Версия DLE: 9.X+
Автор доработки: Assada
Автор идеи: tumoxa [MD Team]
Установка:
Находим:
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>";
}
}
Заменяем на:
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']}) <br /> [<b>MD5:</b> {$md5}] <br /> [<b>SHA1:</b> {$sha1}] <br /> [<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']}) <br /> [<b>MD5:</b> {$md5}] <br /> [<b>SHA1:</b> {$sha1}] <br /> [<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}] <br /> [<b>MD5:</b> {$md5}] <br /> [<b>SHA1:</b> {$sha1}] <br /> [<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}] <br /> [<b>MD5:</b> {$md5}] <br /> [<b>SHA1:</b> {$sha1}] <br /> [<b>CRC32:</b> {$crc32}]</span>";
}
}
Загружаем содержимое архива:
в папку с шаблоном (в архиве все по папка разложено, нужно только себе в шаблон залить, должно получиться так: /templates/ШАБЛОН/dleimages/filetypes)
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>";
}
}
Заменяем на:
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']}) <br /> [<b>MD5:</b> {$md5}] <br /> [<b>SHA1:</b> {$sha1}] <br /> [<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']}) <br /> [<b>MD5:</b> {$md5}] <br /> [<b>SHA1:</b> {$sha1}] <br /> [<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}] <br /> [<b>MD5:</b> {$md5}] <br /> [<b>SHA1:</b> {$sha1}] <br /> [<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}] <br /> [<b>MD5:</b> {$md5}] <br /> [<b>SHA1:</b> {$sha1}] <br /> [<b>CRC32:</b> {$crc32}]</span>";
}
}
Загружаем содержимое архива:
images.rar [13.33 Kb] (cкачиваний: 153)
MD5: ba9226ee2f797358d0295f1e58066257
MD5: ba9226ee2f797358d0295f1e58066257
в папку с шаблоном (в архиве все по папка разложено, нужно только себе в шаблон залить, должно получиться так: /templates/ШАБЛОН/dleimages/filetypes)
Предыдущая Следующая