Reformatted error(), moved commaize()
This commit is contained in:
parent
455f0c2602
commit
5805de70b4
|
@ -14,8 +14,21 @@
|
||||||
return round($size, 2).$units[$i];
|
return round($size, 2).$units[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function commaize($n) {
|
||||||
|
$n = strval($n);
|
||||||
|
return (intval($n) < 1000) ? $n : commaize(substr($n, 0, -3)) . ',' . substr($n, -3);
|
||||||
|
}
|
||||||
|
|
||||||
function error($message) {
|
function error($message) {
|
||||||
die(Element('page.html', Array('index' => ROOT, 'title'=>'Error', 'subtitle'=>'An error has occured.', 'body'=>"<center><h2>$message</h2></center><p style=\"text-align:center;\"><a href=\"" . ROOT . FILE_INDEX . "\">Go back</a>.</p>")));
|
die(Element('page.html', Array(
|
||||||
|
'index'=>ROOT,
|
||||||
|
'title'=>'Error',
|
||||||
|
'subtitle'=>'An error has occured.',
|
||||||
|
'body'=>"<center>" .
|
||||||
|
"<h2>$message</h2>" .
|
||||||
|
"<p><a href=\"" . ROOT . FILE_INDEX . "\">Go back</a>.</p>" .
|
||||||
|
"</center>"
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
class Post {
|
class Post {
|
||||||
|
@ -181,3 +194,4 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,6 @@
|
||||||
array_values($replaces), $str);
|
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() {
|
function sql_open() {
|
||||||
global $sql;
|
global $sql;
|
||||||
$sql = @mysql_connect(MY_SERVER, MY_USER, MY_PASSWORD) or error('Database error.');
|
$sql = @mysql_connect(MY_SERVER, MY_USER, MY_PASSWORD) or error('Database error.');
|
||||||
|
@ -517,3 +512,4 @@
|
||||||
return chr($n & 255).chr(($n >> 8) & 255);
|
return chr($n & 255).chr(($n >> 8) & 255);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue