Plugin Directory

Changeset 3286600


Ignore:
Timestamp:
05/03/2025 12:41:17 AM (11 months ago)
Author:
codebangers
Message:

fixing security issues

Location:
aio-time-clock-lite/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • aio-time-clock-lite/trunk/aio-settings.php

    r2856326 r3286600  
    11<div class="wrap aio_admin_wrapper">
     2    <?php session_start(); ?>
     3    <?php
     4    $token = isset($_SESSION['timeclock_manage_token']) ? $_SESSION['timeclock_manage_token'] : null;
     5    if (!isset($token)) {
     6        //echo "setting session";
     7        // generate token and persist for later verification
     8        // - in practice use openssl_random_pseudo_bytes() or similar instead of uniqid()
     9        $token = md5(uniqid());
     10        $_SESSION['timeclock_manage_token']= $token;
     11        session_write_close();
     12    }
     13    else{
     14        //echo $token;
     15    }
     16    ?>
    217    <?php $logo = plugins_url('/images/logo.png', __FILE__); ?>
    318    <a href="https://codebangers.com" target="_blank"><img src="<?php echo esc_url($logo); ?>" style="width:15%;"></a>
     
    4055    </h2>
    4156    <!--Handle the Tabs-->
    42     <?php if ($tab == "general_settings") {
     57    <?php
     58    if ($tab == "general_settings") {
    4359        if (get_option('permalink_structure')) {
    4460            //echo 'Permalinks enabled';
     
    5167            <?php
    5268        }
     69       
    5370        if (isset($job)){
    54             if ($job == "create_timeclock_page") {
    55                 $tc_page = $this->aio_check_tc_shortcode_lite();
    56                 if ($tc_page == null) {
    57                     $my_post = array(
    58                         'post_type' => 'page',
    59                         'post_title' => 'Time Clock',
    60                         'post_status' => 'publish',
    61                         'post_content' => '[show_aio_time_clock_lite]',
    62                         'comment_status' => 'closed',
    63                         'post_author' => $current_user->ID
    64                     );
    65                     // Insert the post into the database
    66                     $new_post_id = wp_insert_post($my_post);
    67                 }
    68                 ?>
    69                 <div id="setting-error-settings_updated" class="updated settings-error aio-tc-alert">
    70                     <?php
    71                     if ($new_post_id != null) {
    72                         echo esc_attr_x('TimeClock Page Created Sucessfully', 'aio-time-clock-lite'); ?>
    73                         <a href="<?php echo esc_url(get_permalink($new_post_id)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search"></i><?php echo esc_attr_x('View Page', 'aio-time-clock-lite'); ?></a>
    74                     <?php } else {
    75                         echo esc_attr_x('Something went wrong.  Timeclock was not created successfully', 'aio-time-clock-lite');
    76                         if ($tc_page != null) {
    77                             echo esc_attr_x('You already have a TimeClock page created', 'aio-time-clock-lite'); ?>
    78                             <a href="<?php echo esc_url(get_permalink($tc_page)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search"></i><?php echo esc_attr_x('View Page', 'aio-time-clock-lite'); ?></a>
    79                             <?php
    80                         }
     71            if ($token && $_SESSION['timeclock_manage_token'] === $token) {
     72                if ($job == "create_timeclock_page") {
     73                    $tc_page = $this->aio_check_tc_shortcode_lite();
     74                    if ($tc_page == null) {
     75                        $my_post = array(
     76                            'post_type' => 'page',
     77                            'post_title' => 'Time Clock',
     78                            'post_status' => 'publish',
     79                            'post_content' => '[show_aio_time_clock_lite]',
     80                            'comment_status' => 'closed',
     81                            'post_author' => $current_user->ID
     82                        );
     83                        // Insert the post into the database
     84                        $new_post_id = wp_insert_post($my_post);
    8185                    }
    8286                    ?>
    83                 </div>
    84                 <?php
    85             }
    86             if ($job == "create_eprofile_page") {
    87                 $eprofile_page = $this->check_eprofile_shortcode_lite();
    88                 if ($eprofile_page == null) {
    89                     $my_post = array(
    90                         'post_type' => 'page',
    91                         'post_title' => 'Employee Profile',
    92                         'post_status' => 'publish',
    93                         'post_content' => '[show_aio_employee_profile_lite]',
    94                         'comment_status' => 'closed',
    95                         'post_author' => 1
    96                     );
    97                     // Insert the post into the database
    98                     $new_eprofile_id = wp_insert_post($my_post);
     87                    <div id="setting-error-settings_updated" class="updated settings-error aio-tc-alert">
     88                        <?php
     89                        if ($new_post_id != null) {
     90                            echo esc_attr_x('TimeClock Page Created Sucessfully', 'aio-time-clock-lite'); ?>
     91                            <a href="<?php echo esc_url(get_permalink($new_post_id)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search vmiddle"></i><?php echo esc_attr_x('View Page', 'aio-time-clock-lite'); ?></a>
     92                        <?php } else {
     93                            echo esc_attr_x('Something went wrong.  Timeclock was not created successfully', 'aio-time-clock-lite');
     94                            if ($tc_page != null) {
     95                                echo esc_attr_x('You already have a TimeClock page created', 'aio-time-clock-lite'); ?>
     96                                &nbsp;<a href="<?php echo esc_url(get_permalink($tc_page)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search vmiddle"></i><?php echo esc_attr_x('View Page', 'aio-time-clock-lite'); ?></a>
     97                                <?php
     98                            }
     99                        }
     100                        ?>
     101                    </div>
     102                    <?php
    99103                }
    100                 ?>
    101                 <div id="setting-error-settings_updated" class="updated settings-error aio-tc-alert">
    102                     <?php
    103                     if ($new_eprofile_id != null) {
    104                         echo esc_attr_x('Employee Profile Page Created Sucessfully', 'aio-time-clock-lite'); ?>
    105                         <a href="<?php echo esc_url(get_permalink($new_eprofile_id)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search"></i> <?php echo esc_attr_x('View Profile', 'aio-time-clock-lite'); ?></a>
    106                         <?php
    107                     } else {
    108                         echo esc_attr_x('Something went wrong.  Employee Profile Page was not created successfully', 'aio-time-clock-lite');
    109                         if ($eprofile_page != null) {
    110                             echo esc_attr_x('You already have a Employee Profile page created', 'aio-time-clock-lite'); ?>
    111                             <a href="<?php echo esc_url(get_permalink($eprofile_page)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search"></i> <?php echo esc_attr_x('View Profile', 'aio-time-clock-lite'); ?></a>
    112                             <?php
    113                         }
     104                if ($job == "create_eprofile_page") {
     105                    $eprofile_page = $this->check_eprofile_shortcode_lite();
     106                    if ($eprofile_page == null) {
     107                        $my_post = array(
     108                            'post_type' => 'page',
     109                            'post_title' => 'Employee Profile',
     110                            'post_status' => 'publish',
     111                            'post_content' => '[show_aio_employee_profile_lite]',
     112                            'comment_status' => 'closed',
     113                            'post_author' => 1
     114                        );
     115                        // Insert the post into the database
     116                        $new_eprofile_id = wp_insert_post($my_post);
    114117                    }
    115118                    ?>
    116                 </div>
    117                 <?php
     119                    <div id="setting-error-settings_updated" class="updated settings-error aio-tc-alert">
     120                        <?php
     121                        if ($new_eprofile_id != null) {
     122                            echo esc_attr_x('Employee Profile Page Created Sucessfully', 'aio-time-clock-lite'); ?>
     123                            <a href="<?php echo esc_url(get_permalink($new_eprofile_id)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search vmiddle"></i> <?php echo esc_attr_x('View Profile', 'aio-time-clock-lite'); ?></a>
     124                            <?php
     125                        } else {
     126                            echo esc_attr_x('Something went wrong.  Employee Profile Page was not created successfully', 'aio-time-clock-lite');
     127                            if ($eprofile_page != null) {
     128                                echo esc_attr_x('You already have a Employee Profile page created', 'aio-time-clock-lite'); ?>
     129                                <a href="<?php echo esc_url(get_permalink($eprofile_page)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search vmiddle"></i> <?php echo esc_attr_x('View Profile', 'aio-time-clock-lite'); ?></a>
     130                                <?php
     131                            }
     132                        }
     133                        ?>
     134                    </div>
     135                    <?php
     136                }
     137                session_write_close();
     138            }   
     139            else{
     140                session_write_close();
     141                die(__("You are not authorized to perform this action", "aio-time-clock"));
    118142            }
    119143        }
     
    151175                        $tc_page = $this->aio_check_tc_shortcode_lite();
    152176                        if ($tc_page != null) { ?>
    153                             <a href="<?php echo esc_url(get_permalink($tc_page)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search"></i> <?php echo esc_attr_x('View Page', 'aio-time-clock-lite'); ?></a>
    154                             <a href="/wp-admin/post.php?post=<?php echo esc_attr($tc_page); ?>&action=edit" class="button small_button" target="_blank"><i class="dashicons dashicons-edit"></i><?php echo esc_attr_x('Edit Page', 'aio-time-clock-lite'); ?></a>
     177                            <a href="<?php echo esc_url(get_permalink($tc_page)); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search vmiddle"></i> <?php echo esc_attr_x('View Page', 'aio-time-clock-lite'); ?></a>
     178                            <a href="/wp-admin/post.php?post=<?php echo esc_attr($tc_page); ?>&action=edit" class="button small_button" target="_blank"><i class="dashicons dashicons-edit vmiddle"></i><?php echo esc_attr_x('Edit Page', 'aio-time-clock-lite'); ?></a>
    155179                        <?php } else { ?>
    156                             <?php echo esc_attr_x('Time Clock page not found. Would you like to create one', 'aio-time-clock-lite'); ?>?<a href="<?php echo esc_url(admin_url('?page=aio-tc-lite&tab=general_settings&job=create_timeclock_page')); ?>" class="button small_button"><span class="dashicons dashicons-plus vmiddle"></span></a>
     180                            <?php echo esc_attr_x('Time Clock page not found. Would you like to create one', 'aio-time-clock-lite'); ?>?&nbsp;<a href="<?php echo esc_url(admin_url('?page=aio-tc-lite&tab=general_settings&job=create_timeclock_page&t=' . $token)); ?>" class="button small_button"><span class="dashicons dashicons-plus vmiddle"></span></a>
    157181                            <?php
    158182                        }
     
    169193                        $eprofile_page = $this->check_eprofile_shortcode_lite();
    170194                        if ($eprofile_page != null) { ?>
    171                             <a href="<?php echo esc_url(get_permalink(intval($eprofile_page))); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search"></i> <?php echo esc_attr_x('View Page', 'aio-time-clock-lite'); ?></a>
    172                             <a href="/wp-admin/post.php?post=<?php echo intval($eprofile_page); ?>&action=edit" class="button small_button" target="_blank"><i class="dashicons dashicons-edit"></i> <?php echo esc_attr_x('Edit Page', 'aio-time-clock-lite'); ?></a>
     195                            <a href="<?php echo esc_url(get_permalink(intval($eprofile_page))); ?>" class="button small_button" target="_blank"><i class="dashicons dashicons-search vmiddle"></i> <?php echo esc_attr_x('View Page', 'aio-time-clock-lite'); ?></a>
     196                            <a href="/wp-admin/post.php?post=<?php echo intval($eprofile_page); ?>&action=edit" class="button small_button" target="_blank"><i class="dashicons dashicons-edit vmiddle"></i> <?php echo esc_attr_x('Edit Page', 'aio-time-clock-lite'); ?></a>
    173197                        <?php
    174198                        } else {
    175199                            ?>
    176                             <?php echo esc_attr_x('Employee Profile page not found. Would you like to create one', 'aio-time-clock-lite'); ?>? <a href="<?php echo esc_url(admin_url('?page=aio-tc-lite&tab=general_settings&job=create_eprofile_page')); ?>" class="button small_button"><span class="dashicons dashicons-plus vmiddle"></span></a>                   
     200                            <?php echo esc_attr_x('Employee Profile page not found. Would you like to create one', 'aio-time-clock-lite'); ?>? ?&nbsp;<a href="<?php echo esc_url(admin_url('?page=aio-tc-lite&tab=general_settings&job=create_eprofile_page&t=' . $token)); ?>" class="button small_button"><span class="dashicons dashicons-plus vmiddle"></span></a>                   
    177201                            <?php
    178202                        }
  • aio-time-clock-lite/trunk/aio-time-clock-lite-actions.php

    r3223707 r3286600  
    7272    public function getVersion()
    7373    {
    74         return "1.3.324";
     74        return "1.3.325";
    7575    }
    7676
  • aio-time-clock-lite/trunk/aio-time-clock-lite.php

    r3223707 r3286600  
    66 * Author:      Codebangers
    77 * Author URI:  https://codebangers.com
    8  * Version:     1.3.324
     8 * Version:     1.3.325
    99 */
    1010class AIO_Time_Clock_Plugin_Lite
  • aio-time-clock-lite/trunk/readme.txt

    r3223707 r3286600  
    338338
    3393391. Testing with Wordpress 6.7.1
     340
     3412025-5-2 - Version 1.3.325
     342
     3431. Fixed security issues
Note: See TracChangeset for help on using the changeset viewer.