/[corp_html]/inc/Smarty.local.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /inc/Smarty.local.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by dpavlin, Thu Apr 12 20:36:28 2001 UTC revision 1.7 by dpavlin, Wed Jun 13 20:32:12 2001 UTC
# Line 112  function smarty_func_html_checkboxes() Line 112  function smarty_func_html_checkboxes()
112  function smarty_mod_filesize($file,$dir,$unit="")  function smarty_mod_filesize($file,$dir,$unit="")
113  {  {
114          $path=dirname($GLOBALS[SCRIPT_FILENAME])."/$dir/$file";          $path=dirname($GLOBALS[SCRIPT_FILENAME])."/$dir/$file";
115            $ext=explode(".",$file);
116            $ext=strtoupper(array_pop($ext));
117    
118          if ($size=filesize($path)) {          if ($size=filesize($path)) {
119                  switch ($unit) {                  switch ($unit) {
120                          case 'Mb':                          case 'Mb':
121                          case 'mb':                          case 'mb':
122                                  return sprintf("%2.1f Mb",$size/(1024*1024));                                  return sprintf("%s, %2.1f Mb",$ext,$size/(1024*1024));
123                          case 'Kb':                          case 'Kb':
124                          case 'kb':                          case 'kb':
125                                  return sprintf("%2.1f Mb",$size/1024);                                  return sprintf("%s, %2.1f Mb",$ext,$size/1024);
126                          case 'auto':                          case 'auto':
127                                  $size=$size/1024; # Kb                                  $size=$size/1024; # Kb
128                                  if ($size > 1024) {                                  if ($size > 1024) {
129                                          return sprintf("%2.1f Mb",$size/1024);                                          return sprintf("%s, %2.1f Mb",$ext,$size/1024);
130                                  } else {                                  } else {
131                                          return sprintf("%2.1f Kb",$size);                                          return sprintf("%s, %2.1f Kb",$ext,$size);
132                                  }                                  }
133                                                                                    
134                  }                  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.26