diff options
| author | Paul Merrill <napalminc@gmail.com> | 2010-11-04 04:30:23 -0700 |
|---|---|---|
| committer | Paul Merrill <napalminc@gmail.com> | 2010-11-04 04:30:23 -0700 |
| commit | 455f0c2602350f229e6f58d624790c3d7448a68b (patch) | |
| tree | 9dcc84e33f757846e37ae896c829e433bed2d4d7 /inc/functions.php | |
| parent | 2eddc7a4ee2a48ca6197c4dba2f8f563a81354aa (diff) | |
Improved large file size error message.
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php index b465488c..e251c054 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1,4 +1,18 @@ <?php + function sprintf3($str, $vars, $delim = '%') { + $replaces = array(); + foreach($vars as $k => $v) { + $replaces[$delim . $k . $delim] = $v; + } + return str_replace(array_keys($replaces), + array_values($replaces), $str); + } + + function commaize($n) { + $n = strval($n); + return (intval($n) < 1000) ? $n : commaize(substr($n, 0, -3)) . ',' . substr($n, -3); + } + function sql_open() { global $sql; $sql = @mysql_connect(MY_SERVER, MY_USER, MY_PASSWORD) or error('Database error.'); @@ -502,4 +516,4 @@ function int_to_word($n) { return chr($n & 255).chr(($n >> 8) & 255); } -?>
\ No newline at end of file +?> |
