function show_similar_codes($reference) { $reference = strtolower($reference); $result = do_query("\n SELECT deposref, uid FROM users WHERE uid > 1\n UNION\n SELECT deposref, uid FROM old_deposrefs\n ORDER BY deposref\n "); while ($row = mysql_fetch_assoc($result)) { $deposref = strtolower($row['deposref']); $scores[$deposref] = round((9 + similar_text($reference, $deposref) - levenshtein($reference, $deposref)) * 100 / 18); $uid[$deposref] = $row['uid']; } arsort($scores); $first = true; foreach ($scores as $deposref => $score) { if ($score >= 50) { if ($first) { $first = false; echo "<p>" . _("Did you mean one of these? Higher percentage = closer match.") . "</p>\n"; echo "<p>" . _("Click an entry to copy it to the form below, then click 'Deposit' again.") . "</p>\n"; echo "<table class='display_data'>\n"; echo "<tr><th>Reference</th><th>Match</th><th>UID</th></tr>\n"; } $formatted = format_deposref($deposref); echo "<tr", " class=\"me\"", " onmouseover=\"style.backgroundColor='#8ae3bf';\"", " onmouseout=\"style.backgroundColor='#7ad3af';\"", " onclick=\"ObjById('reference').value = '{$deposref}';\">"; echo "<td>{$formatted}</td><td>{$score}%</td><td>{$uid[$deposref]}</td></tr>\n"; } } if (!$first) { echo "</table>\n"; } }
function show_bank_account_details($deposref) { $deposref = format_deposref($deposref); if (strpos($deposref, ' ') !== FALSE) { $deposref .= _(" (without spaces)"); } ?> <table class='display_data'> <tr> <td><?php echo _("Account title") . ":"; ?> </td> <td><?php echo DEPOSIT_BANK_ACCOUNT_TITLE; ?> </td> </tr> <tr> <td><?php echo _("Bank") . ":"; ?> </td> <td><?php echo DEPOSIT_BANK_NAME; ?> </td> </tr> <tr> <td><?php echo _("Account number") . ":"; ?> </td> <td><?php echo DEPOSIT_BANK_ACCOUNT_NUMBER; ?> </td> </tr> <tr> <td><?php echo _("BSB") . ":"; ?> </td> <td><?php echo DEPOSIT_BANK_BRANCH_ID; ?> </td> </tr> <tr> <td><?php echo _("Reference") . ":"; ?> </td> <td><?php echo $deposref; ?> </td> </tr> </table> <?php }