]> git.joonet.de Git - adminer.git/commitdiff
Replace pow() by bit operations
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 4 Jul 2007 16:47:59 +0000 (16:47 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 4 Jul 2007 16:47:59 +0000 (16:47 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@25 7c3ca157-0c34-0410-bff1-cbf682f78f5c

edit.inc.php

index 246d3a18d12de2724b37ebaf31c9ea93a5c7711a..161a419b23067fa28bb5620377bade87ae613acc 100644 (file)
@@ -86,12 +86,12 @@ 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>';
        } else { //! numbers, date, binary
-                       echo '<input name="fields[' . $name . ']" value="' . htmlspecialchars($value) . '"' . (strlen($field["length"]) ? " maxlength='$field[length]'" : ($types[$field["type"]] ? " maxlength='" . $types[$field["type"]] . "'" : '')) . ' />';
+               echo '<input name="fields[' . $name . ']" value="' . htmlspecialchars($value) . '"' . (strlen($field["length"]) ? " maxlength='$field[length]'" : ($types[$field["type"]] ? " maxlength='" . $types[$field["type"]] . "'" : '')) . ' />';
        }
        if ($field["null"] && preg_match('~char|text|set~', $field["type"])) {
                echo '<input type="checkbox" name="null[' . $name . ']" value="1" id="null-' . $name . '"' . (isset($value) ? '' : ' checked="checked"') . ' /><label for="null-' . $name . '">' . lang('NULL') . '</label>';