Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
wfpl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
metaform calls email() correctly, and uses reply_to field
[wfpl.git]
/
db.php
diff --git
a/db.php
b/db.php
index
23c56b5
..
0a1369f
100644
(file)
--- a/
db.php
+++ b/
db.php
@@
-111,7
+111,6
@@
function db_printf($str) {
# This function does the work, but takes the parameters in an array
function _db_printf($str, $args) {
# This function does the work, but takes the parameters in an array
function _db_printf($str, $args) {
- $args = array_reverse($args); # because array_pop() takes from the end
$out = '';
while($str) {
$pos = strpos($str, '%');
$out = '';
while($str) {
$pos = strpos($str, '%');
@@
-129,11
+128,11
@@
function _db_printf($str, $args) {
$str = substr($str, $pos + 2);
if($chr == '"') {
$str = substr($str, $pos + 2);
if($chr == '"') {
- $out .= '"' . enc_sql(array_pop($args)) . '"';
+ $out .= '"' . enc_sql(array_shift($args)) . '"';
} elseif($chr == 's') {
} elseif($chr == 's') {
- $out .= enc_sql(array_pop($args));
+ $out .= enc_sql(array_shift($args));
} elseif($chr == 'i') {
} elseif($chr == 'i') {
- $int = format_int(array_pop($args));
+ $int = format_int(array_shift($args));
if($int == '') $int = '0';
$out .= $int;
} else {
if($int == '') $int = '0';
$out .= $int;
} else {
@@
-213,7
+212,9
@@
function db_get_value($table, $columns, $where = '') {
}
function db_count($table, $where = '') {
}
function db_count($table, $where = '') {
- return db_get_value($table, 'count(*)', $where);
+ $args = func_get_args();
+ array_splice($args, 1, 0, array('count(*)'));
+ return call_user_func_array('db_get_value', $args);
}
# call either of these ways:
}
# call either of these ways: