بوسیله این ماژول، هنگامی که فایلی آپلود میکنید و در قسمت ارسال مطلب قرار میدهید، با توجه به نوع فرمت آن فایل، آیکون مخصوص آن فرمت نیز کنار لینک دانلود فایل آپلود شده به نمایش گذاشته میشود.
دانلود
آموزش نصب
۱. ابتدا فایل engine\modules\functions.php با ویرایشگر باز کرده، کد زیر را جستجو کنید:
۲. کد زیر را به جای کد بالا قرار دهید:
۳. فولدر 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>";
}
}
$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() ) {
$size = formatsize( @filesize( ROOT_DIR . '/uploads/files/' . $row['onserver'] ) );
$row['name'] = explode( "/", $row['name'] );
$row['name'] = end( $row['name'] );
$path_info = pathinfo(ROOT_DIR . '/uploads/files/' . $row['onserver']);
$format = $path_info['extension'];
switch($format)
{
default: $icon = '{THEME}/filetypes/blank.png'; break;
case 'doc': $icon = '{THEME}/filetypes/word.png'; break;
case 'bmp': $icon = '{THEME}/filetypes/word.png'; break;
case 'jpg': $icon = '{THEME}/filetypes/jpg.png'; break;
case 'jpeg': $icon = '{THEME}/filetypes/jpg.png'; break;
case 'png': $icon = '{THEME}/filetypes/png.png'; break;
case 'gif': $icon = '{THEME}/filetypes/gif.png'; break;
case 'psd': $icon = '{THEME}/filetypes/photoshop.png'; break;
case 'mp3': case 'wav': case 'ogg': $icon = '{THEME}/filetypes/music.png'; break;
case 'avi': case 'flv': case 'wmv': $icon = '{THEME}/filetypes/music.png'; break;
case 'pdf': $icon = '{THEME}/filetypes/finerider.png'; break;
case 'exe': $icon = '{THEME}/filetypes/exe.png'; break;
case 'txt': $icon = '{THEME}/filetypes/txt.png'; break;
case 'phps': $icon = '{THEME}/filetypes/php.png'; break;
case 'html': case 'htm': $icon = '{THEME}/filetypes/code.png'; break;
case 'rar': case 'zip': case '7z': $icon = '{THEME}/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\" align=
\"middle\"/><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\"><img src=\"$icon\" alt=\"$format\" align=
\"middle\"/><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\"><img src=\"$icon\" alt=\"$format\" align=
\"middle\"/><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >{$row['name']}</a>
[{$size}]</span>";
$replace_2[] = "<span class=\"attachment\"><img src=\"$icon\" alt=\"$format\" align=
\"middle\"/><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >\\1</a> [{$size}]
</span>";
}
}
$size = formatsize( @filesize( ROOT_DIR . '/uploads/files/' . $row['onserver'] ) );
$row['name'] = explode( "/", $row['name'] );
$row['name'] = end( $row['name'] );
$path_info = pathinfo(ROOT_DIR . '/uploads/files/' . $row['onserver']);
$format = $path_info['extension'];
switch($format)
{
default: $icon = '{THEME}/filetypes/blank.png'; break;
case 'doc': $icon = '{THEME}/filetypes/word.png'; break;
case 'bmp': $icon = '{THEME}/filetypes/word.png'; break;
case 'jpg': $icon = '{THEME}/filetypes/jpg.png'; break;
case 'jpeg': $icon = '{THEME}/filetypes/jpg.png'; break;
case 'png': $icon = '{THEME}/filetypes/png.png'; break;
case 'gif': $icon = '{THEME}/filetypes/gif.png'; break;
case 'psd': $icon = '{THEME}/filetypes/photoshop.png'; break;
case 'mp3': case 'wav': case 'ogg': $icon = '{THEME}/filetypes/music.png'; break;
case 'avi': case 'flv': case 'wmv': $icon = '{THEME}/filetypes/music.png'; break;
case 'pdf': $icon = '{THEME}/filetypes/finerider.png'; break;
case 'exe': $icon = '{THEME}/filetypes/exe.png'; break;
case 'txt': $icon = '{THEME}/filetypes/txt.png'; break;
case 'phps': $icon = '{THEME}/filetypes/php.png'; break;
case 'html': case 'htm': $icon = '{THEME}/filetypes/code.png'; break;
case 'rar': case 'zip': case '7z': $icon = '{THEME}/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\" align=
\"middle\"/><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\"><img src=\"$icon\" alt=\"$format\" align=
\"middle\"/><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\"><img src=\"$icon\" alt=\"$format\" align=
\"middle\"/><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >{$row['name']}</a>
[{$size}]</span>";
$replace_2[] = "<span class=\"attachment\"><img src=\"$icon\" alt=\"$format\" align=
\"middle\"/><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >\\1</a> [{$size}]
</span>";
}
}
۳. فولدر filetypes را که دانلود کرده اید را در پوشه قالب خود آپلود کنید.