/[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.2 by dpavlin, Mon Mar 12 23:41:29 2001 UTC revision 1.4 by dpavlin, Sun Mar 18 18:18:14 2001 UTC
# Line 104  function smarty_func_html_checkboxes() Line 104  function smarty_func_html_checkboxes()
104                  return $html_result;                  return $html_result;
105  }  }
106    
107    // $filename|filesize:"dir":"unit"
108    //
109    // dir -- path to file (or "")
110    // unit -- Mb|Kb|auto
111    
112    function smarty_mod_filesize($file,$dir,$unit="")
113    {
114            $path=dirname($GLOBALS[SCRIPT_FILENAME])."/$dir/$file";
115    
116            if ($size=filesize($path)) {
117                    switch ($unit) {
118                            case 'Mb':
119                            case 'mb':
120                                    return sprintf("%2.1f Mb",$size/(1024*1024));
121                            case 'Kb':
122                            case 'kb':
123                                    return sprintf("%2.1f Mb",$size/1024);
124                            case 'auto':
125                                    $size=$size/1024; # Kb
126                                    if ($size > 1024) {
127                                            return sprintf("%2.1f Mb",$size/1024);
128                                    } else {
129                                            return sprintf("%2.1f Kb",$size);
130                                    }
131                                            
132                    }
133                    return $size;
134            }
135    }
136    
137  ?>  ?>
138    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.26