Replace pow() by bit operations

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@25 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2007-07-04 16:47:59 +00:00
parent 3c47fe8d7f
commit a1ea34db08

View file

@ -86,7 +86,7 @@ foreach ($fields as $name => $field) {
preg_match_all("~'((?:[^']*|'')+)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) {
$id = "$name-" . ($i+1);
echo ' <input type="checkbox" name="fields[' . $name . '][]" id="' . $id . '" value="' . pow(2, $i) . '"' . ($value & pow(2, $i) ? ' checked="checked"' : '') . ' /><label for="' . $id . '">' . htmlspecialchars(str_replace("''", "'", $val)) . '</label>';
echo ' <input type="checkbox" name="fields[' . $name . '][]" id="' . $id . '" value="' . (1 << $i) . '"' . (($value >> $i) & 1 ? ' checked="checked"' : '') . ' /><label for="' . $id . '">' . htmlspecialchars(str_replace("''", "'", $val)) . '</label>';
}
} elseif (strpos($field["type"], "text") !== false) {
echo '<textarea name="fields[' . $name . ']" cols="50" rows="12">' . htmlspecialchars($value) . '</textarea>';