Plugin Directory

Changeset 3097962

Timestamp:
06/05/2024 12:00:26 PM (2 months ago)
Author:
dextorlobo
Message:

fixed security issues

Location:
custom-dash/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • custom-dash/trunk/custom-dash.php

    r3077824 r3097962  
    99 * Plugin Name:       Custom Dash
    1010 * Description:       This plugin will change the logo on login screen.
    11  * Version:           1.0.2
     11 * Version:           1.0.
    1212 * Author:            Arun Sharma
    1313 * Author URI:        https://www.imarun.me/
     
    2828 * Plugin version constants.
    2929 */
    30 define( 'IASCD_PLUGIN_VERSION', '1.0.2' );
     30define( 'IASCD_PLUGIN_VERSION', '1.0.' );
    3131
    3232include_once __DIR__ . '/vendor/autoload.php';
  • custom-dash/trunk/includes/Admin/IascdSettings.php

    r3077824 r3097962  
    3838    public function iascd_general_settings_init() {
    3939        // Register a new setting for "iascd_general" page.
    40         register_setting( 'iascd_general', 'iascd_general_options' );
     40        register_setting( 'iascd_general', 'iascd_general_options',
     41        array(
     42            'type'              => 'array',
     43            'sanitize_callback' => array( $this, 'iascd_sanitize_fields' )
     44        ) );
    4145   
    4246        // Register a new section in the "iascd_general" page.
     
    139143    public function iascd_general_section_developers_callback( $args ) {
    140144        ?>
    141         <p id="<?php echo esc_attr( $args['id'] ); ?>"><?php esc_html_e( 'Login sreen logo settings', 'iascd_general' ); ?></p>
     145        <p id="<?php echo esc_attr( $args['id'] ); ?>"><?php esc_html_e( 'Login sreen logo settings', 'iascd_general' ); ?></p>
    142146        <?php
    143147    }
     
    151155        // Get the value of the setting we've registered with register_setting()
    152156        $iascd_options = get_option( 'iascd_general_options' );
    153         $iascd_options[ $args['label_for'] ] = ( ! empty( $iascd_options[ $args['label_for'] ] ) ) ? $iascd_options[ $args['label_for'] ] : 'sdvdsg';
     157        $iascd_options[ $args['label_for'] ] = ( ! empty( $iascd_options[ $args['label_for'] ] ) ) ? $iascd_options[ $args['label_for'] ] : '';
    154158        ?>
    155159        <label><input type="radio" class="<?php echo esc_attr( $args['class'] ); ?>" id="<?php echo esc_attr( $args['label_for'] ); ?>" name="iascd_general_options[<?php echo esc_attr( $args['label_for'] ); ?>]" value="text" <?php checked( 'text', $iascd_options[ $args['label_for'] ] ); ?> />Text</label><br />
     
    167171        // Get the value of the setting we've registered with register_setting()
    168172        $iascd_options = get_option( 'iascd_general_options' );
    169         $iascd_options[ $args['label_for'] ] = $iascd_options[ $args['label_for'] ] ?? "";
     173        $iascd_options[ $args['label_for'] ] = ;
    170174        ?>
    171175        <input type='text' class="<?php echo esc_attr( $args['class'] ); ?>" id="<?php echo esc_attr( $args['label_for'] ); ?>" name="iascd_general_options[<?php echo esc_attr( $args['label_for'] ); ?>]" value="<?php echo esc_attr( $iascd_options[ $args['label_for'] ] ) ?>">
     
    182186        // Get the value of the setting we've registered with register_setting()
    183187        $iascd_options = get_option( 'iascd_general_options' );
    184         $iascd_options[ $args['label_for'] ] = $iascd_options[ $args['label_for'] ] ?? "";
     188        $iascd_options[ $args['label_for'] ] = ;
    185189        ?>
    186190        <input type='text' class="<?php echo esc_attr( $args['class'] ); ?>" id="<?php echo esc_attr( $args['label_for'] ); ?>" name="iascd_general_options[<?php echo esc_attr( $args['label_for'] ); ?>]" value="<?php echo esc_attr( $iascd_options[ $args['label_for'] ] ) ?>">
     
    198202        // Get the value of the setting we've registered with register_setting()
    199203        $iascd_options = get_option( 'iascd_general_options' );
    200         $iascd_options[ $args['label_for'] ] = $iascd_options[ $args['label_for'] ] ?? "";
     204        $iascd_options[ $args['label_for'] ] = ;
    201205        ?>
    202206        <input type='text' class="<?php echo esc_attr( $args['class'] ); ?>" id="<?php echo esc_attr( $args['label_for'] ); ?>" name="iascd_general_options[<?php echo esc_attr( $args['label_for'] ); ?>]" value="<?php echo esc_attr( $iascd_options[ $args['label_for'] ] ) ?>">
     
    213217        // Get the value of the setting we've registered with register_setting()
    214218        $iascd_options = get_option( 'iascd_general_options' );
    215         $iascd_options[ $args['label_for'] ] = $iascd_options[ $args['label_for'] ] ?? "";
     219        $iascd_options[ $args['label_for'] ] = ;
    216220        ?>
    217221        <input type='text' class="<?php echo esc_attr( $args['class'] ); ?>" id="<?php echo esc_attr( $args['label_for'] ); ?>" name="iascd_general_options[<?php echo esc_attr( $args['label_for'] ); ?>]" value="<?php echo esc_attr( $iascd_options[ $args['label_for'] ] ) ?>">
     
    228232        // Get the value of the setting we've registered with register_setting()
    229233        $iascd_options = get_option( 'iascd_general_options' );
    230         $iascd_options[ $args['label_for'] ] = $iascd_options[ $args['label_for'] ] ?? "";
     234        $iascd_options[ $args['label_for'] ] = ;
    231235        ?>
    232236        <input type='text' class="<?php echo esc_attr( $args['class'] ); ?>" id="<?php echo esc_attr( $args['label_for'] ); ?>" name="iascd_general_options[<?php echo esc_attr( $args['label_for'] ); ?>]" value="<?php echo esc_attr( $iascd_options[ $args['label_for'] ] ) ?>">
     
    257261            return;
    258262        }
    259    
     263   
    260264        // show error/update messages
    261265        settings_errors( 'iascd_general_messages' );
     
    278282    }
    279283
    280     public function iascd_settings_link($links) {
     284    public function iascd_settings_link() {
    281285        $settings_link = '<a href="options-general.php?page=iascd_general">Settings</a>';
    282286        array_unshift( $links, $settings_link );
     
    284288        return $links;
    285289    }
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
    286334}
  • custom-dash/trunk/includes/IascdPlugin.php

    r3077824 r3097962  
    8181    public function iascd_login_logo_css_cb() {
    8282        $iascd_options                = get_option( 'iascd_general_options' );
    83         $this->iascd_text_or_logo     = ( isset( $iascd_options['iascd_general_text_or_logo'] ) && ! empty( $iascd_options['iascd_general_text_or_logo'] ) ) ? $iascd_options['iascd_general_text_or_logo'] : '';
    84         $this->iascd_logo_text        = ( isset( $iascd_options['iascd_general_text_logo'] ) && ! empty( $iascd_options['iascd_general_text_logo'] ) ) ? $iascd_options['iascd_general_text_logo'] : '';
    85         $this->iascd_logo_url         = ( isset( $iascd_options['iascd_general_login_logo'] ) && ! empty( $iascd_options['iascd_general_login_logo'] ) ) ? $iascd_options['iascd_general_login_logo'] : '';
    86         $this->iascd_logo_height      = ( isset( $iascd_options['iascd_general_logo_height'] ) && ! empty( $iascd_options['iascd_general_logo_height'] ) ) ? $iascd_options['iascd_general_logo_height'] . 'px' : '84px';
    87         $this->iascd_logo_width       = ( isset( $iascd_options['iascd_general_logo_width'] ) && ! empty( $iascd_options['iascd_general_logo_width'] ) ) ? $iascd_options['iascd_general_logo_width'] . 'px' : '84px';
    88         $this->iascd_login_header_url = ( isset( $iascd_options['iascd_general_login_header_url'] ) && ! empty( $iascd_options['iascd_general_login_header_url'] ) ) ? $iascd_options['iascd_general_login_header_url'] : '';
     83        $this->iascd_text_or_logo     = ( isset( $iascd_options['iascd_general_text_or_logo'] ) && ! empty( $iascd_options['iascd_general_text_or_logo'] ) ) ? : '';
     84        $this->iascd_logo_text        = ( isset( $iascd_options['iascd_general_text_logo'] ) && ! empty( $iascd_options['iascd_general_text_logo'] ) ) ? : '';
     85        $this->iascd_logo_url         = ( isset( $iascd_options['iascd_general_login_logo'] ) && ! empty( $iascd_options['iascd_general_login_logo'] ) ) ? : '';
     86        $this->iascd_logo_height      = ( isset( $iascd_options['iascd_general_logo_height'] ) && ! empty( $iascd_options['iascd_general_logo_height'] ) ) ? . 'px' : '84px';
     87        $this->iascd_logo_width       = ( isset( $iascd_options['iascd_general_logo_width'] ) && ! empty( $iascd_options['iascd_general_logo_width'] ) ) ? . 'px' : '84px';
     88        $this->iascd_login_header_url = ( isset( $iascd_options['iascd_general_login_header_url'] ) && ! empty( $iascd_options['iascd_general_login_header_url'] ) ) ? : '';
    8989
    9090        if ( empty( $this->iascd_text_or_logo ) ) {
     
    104104        if ( ! empty( $this->iascd_logo_url ) ) {
    105105            echo '<style type="text/css"> h1 a {
    106                 background-image:url( ' . esc_attr( $this->iascd_logo_url ) . ' ) !important;
     106                background-image:url( ' . esc_( $this->iascd_logo_url ) . ' ) !important;
    107107                height:' . esc_attr( $this->iascd_logo_height ) . ' !important;
    108108                width:' . esc_attr( $this->iascd_logo_width ) . ' !important;
Note: See TracChangeset for help on using the changeset viewer.