mirror of
https://github.com/itflow-org/itflow
synced 2026-11-22 04:17:24 +00:00
QoL 45: intval and floatval in place of int and float casts and a string cast in place of strval, redirect in place of raw Location headers wherever functions.php is loaded, redirect fallback escapes the URL with json_encode and escapeHtml, escapeHtml for the last htmlspecialchars on a page, and the plain-HTTP cookie notice through flashAlert
This commit is contained in:
@@ -124,9 +124,9 @@ $sql_api_perms = mysqli_query($mysqli,
|
||||
"SELECT client_id, permission_type FROM user_client_permissions WHERE user_id = $session_user_id");
|
||||
while ($sql_api_perms && $prow = mysqli_fetch_assoc($sql_api_perms)) {
|
||||
if ($prow['permission_type'] === 'deny') {
|
||||
$client_deny_array[] = (int) $prow['client_id'];
|
||||
$client_deny_array[] = intval($prow['client_id']);
|
||||
} else {
|
||||
$client_access_array[] = (int) $prow['client_id'];
|
||||
$client_access_array[] = intval($prow['client_id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ if ($client_ok) {
|
||||
$invoice = billingRow('invoice', $invoice_id, false);
|
||||
$reference = billingNumber('invoice', $invoice);
|
||||
$return_arr['invoice_reference'] = $reference;
|
||||
$return_arr['amount'] = (float) $invoice['invoice_amount'];
|
||||
$return_arr['amount'] = floatval($invoice['invoice_amount']);
|
||||
$return_arr['url'] = billingGuestUrl('invoice', $invoice);
|
||||
|
||||
$reference = escapeSql($reference);
|
||||
|
||||
@@ -70,7 +70,7 @@ if ($invoice) {
|
||||
$reference = $payment_set['reference'] ?? '';
|
||||
|
||||
$refuse = '';
|
||||
if ((int) round($amount * 100) > (int) round($state['balance'] * 100)) {
|
||||
if (intval(round($amount * 100)) > intval(round($state['balance'] * 100))) {
|
||||
$refuse = 'amount is more than is owed on ' . $reference_text . ' - ' . billingMoney($state['balance'], $currency) . '.';
|
||||
} elseif (!isset(paymentAccounts()[$account_id])) {
|
||||
$refuse = 'account_id is needed - the account it went into. There is no default payment account (Admin > Settings > Invoices and billing).';
|
||||
|
||||
@@ -55,7 +55,7 @@ if ($payment_row) {
|
||||
// No more than the invoice's total with its other payments
|
||||
$others = invoicePaid($invoice_id) - floatval($payment_row['payment_amount']);
|
||||
$room = round(floatval($payment_row['invoice_amount']) - $others, 2);
|
||||
if ((int) round($amount * 100) > (int) round($room * 100)) {
|
||||
if (intval(round($amount * 100)) > intval(round($room * 100))) {
|
||||
http_response_code(400);
|
||||
$return_arr['success'] = "False";
|
||||
$return_arr['message'] = "amount is more than $reference_text has left to pay with its other payments - " . billingMoney(max(0, $room), $payment_row['invoice_currency_code']) . '.';
|
||||
|
||||
@@ -92,7 +92,7 @@ if ($client_ok) {
|
||||
$quote = billingRow('quote', $quote_id, false);
|
||||
$reference = billingNumber('quote', $quote);
|
||||
$return_arr['quote_reference'] = $reference;
|
||||
$return_arr['amount'] = (float) $quote['quote_amount'];
|
||||
$return_arr['amount'] = floatval($quote['quote_amount']);
|
||||
$return_arr['url'] = billingGuestUrl('quote', $quote);
|
||||
|
||||
$reference = escapeSql($reference);
|
||||
|
||||
@@ -51,7 +51,7 @@ $insert_id = $recurring_invoice_id;
|
||||
$recurring = billingRow('recurring', $recurring_invoice_id, false);
|
||||
$reference = billingNumber('recurring', $recurring);
|
||||
$return_arr['recurring_invoice_reference'] = $reference;
|
||||
$return_arr['amount'] = (float) $recurring['recurring_invoice_amount'];
|
||||
$return_arr['amount'] = floatval($recurring['recurring_invoice_amount']);
|
||||
|
||||
logAudit("Recurring Invoice", "Create", escapeSql("Created recurring invoice $reference - " . $recurring['recurring_invoice_scope'] . " via API ($api_key_name)"), $client_id, $recurring_invoice_id);
|
||||
logAudit("API", "Success", escapeSql("Created recurring invoice $reference via API ($api_key_name)"), $client_id);
|
||||
@@ -72,7 +72,7 @@ if (intval($_POST['invoice_now'] ?? 0) === 1) {
|
||||
$return_arr['invoice'] = [
|
||||
'invoice_id' => $invoice_id,
|
||||
'reference' => billingNumber('invoice', $invoice),
|
||||
'amount' => (float) $invoice['invoice_amount'],
|
||||
'amount' => floatval($invoice['invoice_amount']),
|
||||
'currency' => (string) $invoice['invoice_currency_code'],
|
||||
'due' => (string) $invoice['invoice_due'],
|
||||
'status' => (string) $invoice['invoice_status'],
|
||||
|
||||
Reference in New Issue
Block a user