|
|
Joined: Sep 2003
Posts: 488
Code Monkey
|
|
Code Monkey
Joined: Sep 2003
Posts: 488 |
Mod Name / Version: Display Attachment Filename + Filesize Description: This mod will display the filename of an attachment as part of the attachment link (minus the attachment number) and display its filesize in kilobytes. Its primary purpose is to allow your visitors to know which type of file they will be downloading beforehand, as well as know how large it is (in case they are on dial-up and have no interest in downloading something excessively large). (I'm not sure whether this mod works in other versions besides 6.3) DEMO ==== http://www.mameworld.info/ubbthreads/sho...5b43dab728d49f4 Working Under: UBB.Threads 6.3 Mod Status: Finished Any pre-requisites: Author(s): Twisty Date: 03/25/04 Credits: Files Altered: showthreaded.php showflat.php New Files: Database Altered: no Info/Instructions: 1) In showthreaded.php... CHANGE THIS: if ($File) { <br /> $File = rawurlencode($File); <br /> if (!$downloads) {$downloads = 0; } <br /> $filelink = "<a href=\"{$config['phpurl']}/download.php?Number=$Number\">{$ubbt_lang['FILE_ATTACH']}</a> ($downloads {$ubbt_lang['DOWNLOADS']})<br />"; <br /> } TO THIS: if (($File) && (strlen($File) < 100)){ <br /> $File = rawurlencode($File); <br /> $Filecut = eregi_replace("^([0-9]+)-","",$File); <br /> $Filecut = eregi_replace("%20"," ",$Filecut); <br /> $Filecut = eregi_replace("%5C%27","'",$Filecut); <br /> $Filecut = eregi_replace("%21","!",$Filecut); <br /> $Filecut = eregi_replace("%40","@",$Filecut); <br /> $Filecut = eregi_replace("%23","#",$Filecut); <br /> $Filecut = eregi_replace("%24","$",$Filecut); <br /> $Filecut = eregi_replace("%25","%",$Filecut); <br /> $Filecut = eregi_replace("%5E","^",$Filecut); <br /> $Filecut = eregi_replace("%26","&",$Filecut); <br /> $Filecut = eregi_replace("%28","(",$Filecut); <br /> $Filecut = eregi_replace("%29",")",$Filecut); <br /> $Filecut = eregi_replace("%5B","[",$Filecut); <br /> $Filecut = eregi_replace("%5D","]",$Filecut); <br /> $Filecut = eregi_replace("%7B","{",$Filecut); <br /> $Filecut = eregi_replace("%7D","}",$Filecut); <br /> $Filecut = eregi_replace("%60","`",$Filecut); <br /> $Filecut = eregi_replace("%2B","+",$Filecut); <br /> $Filecut = eregi_replace("%3D","=",$Filecut); <br /> $Filecut = eregi_replace("%7E","~",$Filecut); <br /> $Filecut = eregi_replace("%3B",";",$Filecut); <br /> $Filecut = eregi_replace("%A3","£",$Filecut); <br /> $Filecut = eregi_replace("%80","€",$Filecut); <br /> $Filecut = eregi_replace("%A5","¥",$Filecut); <br /> $Filecut = eregi_replace("%A7","§",$Filecut); <br /> $Filecut = eregi_replace("%A2","¢",$Filecut); <br /> $Filecut = eregi_replace("%2C",",",$Filecut); <br /> $attachpath="{$config['files']}/$File"; <br /> $attachpath= eregi_replace("%20"," ",$attachpath); <br /> $attachpath= eregi_replace("%5C%27","\'",$attachpath); <br /> $attachpath= eregi_replace("%21","!",$attachpath); <br /> $attachpath= eregi_replace("%40","@",$attachpath); <br /> $attachpath= eregi_replace("%23","#",$attachpath); <br /> $attachpath= eregi_replace("%24","$",$attachpath); <br /> $attachpath= eregi_replace("%25","%",$attachpath); <br /> $attachpath= eregi_replace("%5E","^",$attachpath); <br /> $attachpath= eregi_replace("%26","&",$attachpath); <br /> $attachpath= eregi_replace("%28","(",$attachpath); <br /> $attachpath= eregi_replace("%29",")",$attachpath); <br /> $attachpath= eregi_replace("%5B","[",$attachpath); <br /> $attachpath= eregi_replace("%5D","]",$attachpath); <br /> $attachpath= eregi_replace("%7B","{",$attachpath); <br /> $attachpath= eregi_replace("%7D","}",$attachpath); <br /> $attachpath= eregi_replace("%60","`",$attachpath); <br /> $attachpath= eregi_replace("%2B","+",$attachpath); <br /> $attachpath= eregi_replace("%3D","=",$attachpath); <br /> $attachpath= eregi_replace("%7E","~",$attachpath); <br /> $attachpath= eregi_replace("%3B",";",$attachpath); <br /> $attachpath= eregi_replace("%A3","£",$attachpath); <br /> $attachpath= eregi_replace("%80","€",$attachpath); <br /> $attachpath= eregi_replace("%A5","¥",$attachpath); <br /> $attachpath= eregi_replace("%A7","§",$attachpath); <br /> $attachpath= eregi_replace("%A2","¢",$attachpath); <br /> $attachpath= eregi_replace("%2C",",",$attachpath); <br /> $attachfilesize = filesize($attachpath); <br /> $kbattachfilesize = $attachfilesize/1024; <br /> $finalattachfilesize = round($kbattachfilesize); <br /> if (!$downloads) {$downloads = 0; } <br /> $filelink = "<a href=\"{$config['phpurl']}/download.php?Number=$Number\">{$ubbt_lang['FILE_ATTACH']}: $Filecut</a> $finalattachfilesize KB ($downloads {$ubbt_lang['DOWNLOADS']})"; <br /> } 2) In showflat.php... CHANGE THIS: if ($File) { <br /> $File = rawurlencode($File); <br /> if (!$downloads) { $downloads = "0"; } <br /> $postrow[$i]['filelink'] = "<a href=\"{$config['phpurl']}/download.php?Number=$Number\">{$ubbt_lang['FILE_ATTACH']}</a> ($downloads {$ubbt_lang['DOWNLOADS']})"; <br /> } TO THIS: if (($File) && (strlen($File) < 100)){ <br /> $File = rawurlencode($File); <br /> $Filecut = eregi_replace("^([0-9]+)-","",$File); <br /> $Filecut = eregi_replace("%20"," ",$Filecut); <br /> $Filecut = eregi_replace("%5C%27","'",$Filecut); <br /> $Filecut = eregi_replace("%21","!",$Filecut); <br /> $Filecut = eregi_replace("%40","@",$Filecut); <br /> $Filecut = eregi_replace("%23","#",$Filecut); <br /> $Filecut = eregi_replace("%24","$",$Filecut); <br /> $Filecut = eregi_replace("%25","%",$Filecut); <br /> $Filecut = eregi_replace("%5E","^",$Filecut); <br /> $Filecut = eregi_replace("%26","&",$Filecut); <br /> $Filecut = eregi_replace("%28","(",$Filecut); <br /> $Filecut = eregi_replace("%29",")",$Filecut); <br /> $Filecut = eregi_replace("%5B","[",$Filecut); <br /> $Filecut = eregi_replace("%5D","]",$Filecut); <br /> $Filecut = eregi_replace("%7B","{",$Filecut); <br /> $Filecut = eregi_replace("%7D","}",$Filecut); <br /> $Filecut = eregi_replace("%60","`",$Filecut); <br /> $Filecut = eregi_replace("%2B","+",$Filecut); <br /> $Filecut = eregi_replace("%3D","=",$Filecut); <br /> $Filecut = eregi_replace("%7E","~",$Filecut); <br /> $Filecut = eregi_replace("%3B",";",$Filecut); <br /> $Filecut = eregi_replace("%A3","£",$Filecut); <br /> $Filecut = eregi_replace("%80","€",$Filecut); <br /> $Filecut = eregi_replace("%A5","¥",$Filecut); <br /> $Filecut = eregi_replace("%A7","§",$Filecut); <br /> $Filecut = eregi_replace("%A2","¢",$Filecut); <br /> $Filecut = eregi_replace("%2C",",",$Filecut); <br /> $attachpath="{$config['files']}/$File"; <br /> $attachpath= eregi_replace("%20"," ",$attachpath); <br /> $attachpath= eregi_replace("%5C%27","\'",$attachpath); <br /> $attachpath= eregi_replace("%21","!",$attachpath); <br /> $attachpath= eregi_replace("%40","@",$attachpath); <br /> $attachpath= eregi_replace("%23","#",$attachpath); <br /> $attachpath= eregi_replace("%24","$",$attachpath); <br /> $attachpath= eregi_replace("%25","%",$attachpath); <br /> $attachpath= eregi_replace("%5E","^",$attachpath); <br /> $attachpath= eregi_replace("%26","&",$attachpath); <br /> $attachpath= eregi_replace("%28","(",$attachpath); <br /> $attachpath= eregi_replace("%29",")",$attachpath); <br /> $attachpath= eregi_replace("%5B","[",$attachpath); <br /> $attachpath= eregi_replace("%5D","]",$attachpath); <br /> $attachpath= eregi_replace("%7B","{",$attachpath); <br /> $attachpath= eregi_replace("%7D","}",$attachpath); <br /> $attachpath= eregi_replace("%60","`",$attachpath); <br /> $attachpath= eregi_replace("%2B","+",$attachpath); <br /> $attachpath= eregi_replace("%3D","=",$attachpath); <br /> $attachpath= eregi_replace("%7E","~",$attachpath); <br /> $attachpath= eregi_replace("%3B",";",$attachpath); <br /> $attachpath= eregi_replace("%A3","£",$attachpath); <br /> $attachpath= eregi_replace("%80","€",$attachpath); <br /> $attachpath= eregi_replace("%A5","¥",$attachpath); <br /> $attachpath= eregi_replace("%A7","§",$attachpath); <br /> $attachpath= eregi_replace("%A2","¢",$attachpath); <br /> $attachpath= eregi_replace("%2C",",",$attachpath); <br /> $attachfilesize = filesize($attachpath); <br /> $kbattachfilesize = $attachfilesize/1024; <br /> $finalattachfilesize = round($kbattachfilesize); <br /> if (!$downloads) {$downloads = 0; } <br /> $postrow[$i]['filelink'] = "<a href=\"{$config['phpurl']}/download.php?Number=$Number\">{$ubbt_lang['FILE_ATTACH']}: $Filecut</a> $finalattachfilesize KB ($downloads {$ubbt_lang['DOWNLOADS']})"; <br /> } :-) Disclaimer: Please backup every file that you intend to modify. If the modification modifies the database, it's a good idea to backup your database before doing so. Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 5,834
Joined: January 2000
|
|
|
Forums63
Topics37,583
Posts293,955
Members13,824
| |
Most Online151,614 Nov 14th, 2025
|
|
Currently Online 704
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 16
|
|
|
|