Plugin Directory

Changeset 2629581


Ignore:
Timestamp:
11/15/2021 06:42:22 AM (4 years ago)
Author:
alphanetbd
Message:

fixed sanitization issue in settings page

Location:
alpha-sms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • alpha-sms/tags/1.0.0/admin/partials/alpha_sms-admin-display_settings.php

    r2627862 r2629581  
    7777
    7878            if ($response && $response->error === 0) {
    79                 $balance = "<strong>Balance:</strong> BDT " . number_format((float)$response->data->balance, 2, '.',
    80                         '');
     79                $balance = $response->data->balance;
    8180            } elseif ($response && $response->error === 405) {
    82                 $balance = "<strong class='text-danger'>Authentication Failed. Please enter a valid API Key.</strong>";
     81                $balance = 'Authentication Failed. Please enter a valid API Key.';
    8382            } else {
    84                 $balance = "<strong class='text-danger'>Unknown Error, failed to fetch balance.</strong>";
     83                $balance = 'Unknown Error, failed to fetch balance.';
    8584            }
    8685        } else {
    87             $balance = "<strong>Don't have an account? <a href='https://alpha.net.bd/SMS/SignUp/'>Register Now</a> (Free SMS Credit after Sign-up).</strong>";
     86            $balance = "empty";
    8887        }
    8988
     
    129128                <td>
    130129                     <span id="<?php echo esc_attr( $this->plugin_name . '-balance' ); ?>">
    131                          <?php echo esc_html__( $balance ) ?></span>
     130                         <?php if ($balance === 'empty') : ?>
     131                            <strong>Don't have an account? <a href='https://alpha.net.bd/SMS/SignUp/'>Register Now</a> (Free SMS Credit after Sign-up).</strong>
     132                         <?php elseif (is_numeric($balance)) : ?>
     133                             <strong>Balance:</strong> BDT <?php echo esc_html( number_format((float)$balance, 2, '.', ',') ) ?>
     134                         <?php else : ?>
     135                             <strong class="text-danger"><?php echo esc_html($balance); ?></strong>
     136                         <?php endif; ?>
     137                     </span>
    132138                </td>
    133139            </tr>
  • alpha-sms/trunk/admin/partials/alpha_sms-admin-display_settings.php

    r2627862 r2629581  
    7777
    7878            if ($response && $response->error === 0) {
    79                 $balance = "<strong>Balance:</strong> BDT " . number_format((float)$response->data->balance, 2, '.',
    80                         '');
     79                $balance = $response->data->balance;
    8180            } elseif ($response && $response->error === 405) {
    82                 $balance = "<strong class='text-danger'>Authentication Failed. Please enter a valid API Key.</strong>";
     81                $balance = 'Authentication Failed. Please enter a valid API Key.';
    8382            } else {
    84                 $balance = "<strong class='text-danger'>Unknown Error, failed to fetch balance.</strong>";
     83                $balance = 'Unknown Error, failed to fetch balance.';
    8584            }
    8685        } else {
    87             $balance = "<strong>Don't have an account? <a href='https://alpha.net.bd/SMS/SignUp/'>Register Now</a> (Free SMS Credit after Sign-up).</strong>";
     86            $balance = "empty";
    8887        }
    8988
     
    129128                <td>
    130129                     <span id="<?php echo esc_attr( $this->plugin_name . '-balance' ); ?>">
    131                          <?php echo esc_html__( $balance ) ?></span>
     130                         <?php if ($balance === 'empty') : ?>
     131                            <strong>Don't have an account? <a href='https://alpha.net.bd/SMS/SignUp/'>Register Now</a> (Free SMS Credit after Sign-up).</strong>
     132                         <?php elseif (is_numeric($balance)) : ?>
     133                             <strong>Balance:</strong> BDT <?php echo esc_html( number_format((float)$balance, 2, '.', ',') ) ?>
     134                         <?php else : ?>
     135                             <strong class="text-danger"><?php echo esc_html($balance); ?></strong>
     136                         <?php endif; ?>
     137                     </span>
    132138                </td>
    133139            </tr>
Note: See TracChangeset for help on using the changeset viewer.