Plugin Directory

Changeset 3463786


Ignore:
Timestamp:
02/17/2026 07:39:21 PM (3 weeks ago)
Author:
ashanjay
Message:

2.2.2 (2026-2-17)

FIXED: new entry form focus on title field on load
FIXED: saving entry loading all again
FIXED: save button styles
FIXED: action=lp_form_submit vulnerability
UPDATED: Button styles
UPDATED: Today box styles

Location:
lifepress
Files:
74 added
7 edited

Legend:

Unmodified
Added
Removed
  • lifepress/trunk/README.txt

    r3429289 r3463786  
    44Author URI: https://ashanjay.com
    55Requires at least: 6.0
    6 Tested up to: 6.9
    7 Stable tag: 2.2.1
     6Tested up to: 6.9.1
     7Stable tag: 2.2.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5555
    5656This view is ideal for those who prefer to plan, reflect, and reset in harmony with nature’s cycles rather than purely linear time.
     57**[Learn how to use Moon Cycles](https://ashanjay.com/before-clocks-ruled-us-a-life-aligned-with-moon-sun-cycles/)** in your life.
    5758
    5859== 🗄️ Data Metrics (New in 2.2) ==
     
    132133
    133134== Changelog ==
     135= 2.2.2 (2026-2-17) =
     136FIXED: new entry form focus on title field on load
     137FIXED: saving entry loading all again
     138FIXED: save button styles
     139FIXED: action=lp_form_submit vulnerability
     140UPDATED: Button styles
     141UPDATED: Today box styles
     142
    134143= 2.2.1 (2025-12-29) =
    135144FIXED: Normal calendar to other calendar view not working
  • lifepress/trunk/assets/admin.css

    r3428394 r3463786  
    187187    .lp_loading.lp_lightbox_in:before{top: 0;left: 0; border-radius: 20px;}
    188188
     189
    189190/* Lightbox */
    190191        #lp_lightboxes{ position: fixed;width: 100%;z-index: 900000; top:0; }
  • lifepress/trunk/assets/global.css

    r3429289 r3463786  
    5151        cursor: pointer;
    5252        text-transform: uppercase;
    53         padding: 7px 20px;
    54         display: inline-block;
     53        padding: 10px 20px;
     54        display: inline-flex;
     55        align-items: center;
    5556        border-radius: 20px;
    5657        background-color: #fff;
    5758        color: var(--lp_color_1);
     59        font-family: var(--lp_font_1);
    5860        font-size: 13px;
    5961        font-weight: bold;
    6062        margin-right: 5px;
    6163        text-decoration: none;
    62     }
     64        border:none; box-shadow: none;
     65    }
     66    .lp_btn:focus, .lp_nobtn:focus{outline:none; box-shadow: 0rem 0rem 0rem .063rem #FFFFFF, 0rem 0rem 0rem .188rem #000000;}
    6367    .lp_btn:hover{opacity: 0.8}
    6468    .lp_btn.blue{background-color: var(--lp_color_blue); color:#fff;}
     
    7175    .lp_btn.lp_svg{display: inline-flex; align-items: center; padding: 0; background-color: transparent;}
    7276    .lp_btn.lp_svg svg{margin:0!important; padding: 5px 10px 5px 5px;}
     77    .lp_btn.bold{
     78        font-size: 14px;
     79        padding: 15px 30px;
     80        border-radius: 10px;max-height: 44px;
     81    }
     82    .lp_nobtn{box-shadow: none; border:none; outline: none;}
    7383
    7484    .lp_trans{
     
    588598        transform:translateX(-100%);
    589599    }
     600
     601   
     602    .lp_loading_spinner {
     603        display: inline-block;
     604        width: 18px;
     605        height: 18px;
     606        border: 3px solid #fff;
     607        border-top: 3px solid transparent;
     608        border-radius: 50%;
     609        animation: spin 1s linear infinite;
     610        margin-right: 10px;
     611        vertical-align: middle;
     612    }
     613    .lp_loading_spinner.d{
     614        border: 3px solid #0073aa;
     615        border-top: 3px solid transparent;
     616    }
     617
     618    @keyframes spin {
     619        0% { transform: rotate(0deg); }
     620        100% { transform: rotate(360deg); }
     621    }
    590622/* tooltip */
    591623    .lp_elms{    position: absolute; z-index: 48392749832;pointer-events: none;}
     
    660692        border-radius: 10px;
    661693        padding: 10px;
    662         flex: 1;
    663694    }
    664695
     
    931962    .lp_moon_view .day.new{    background-color: #f8f8f8;}
    932963    .lp_moon_view .day.newMonth{    border-left: 3px solid var(--lp_color_blue);}
     964    .lp_moon_view .day.today{       box-shadow: inset 0px 0px 2px;}
    933965
    934966/* list view */
  • lifepress/trunk/assets/script.js

    r3429289 r3463786  
    44 */
    55jQuery(document).ready(function($){
    6 
    76
    87
     
    975974            })
    976975           
    977             .on('click','.lp_toggles',function(){
     976            .on('click','.lp_toggles',function(e){
     977                e.preventDefault();
    978978                var item = $(this).data('t');
    979979
     
    993993                }
    994994            })
    995             .on('click','.lp_toggles_dn',function(){
     995            .on('click','.lp_toggles_dn',function(e){
     996                e.preventDefault();
    996997                item = $(this).data('t');
    997998                BODY.find('.'+ item).toggleClass('dn');
     
    10991100            });
    11001101
     1102            setTimeout(() => { BODY.find('.lp_entry_title').focus();} ,500);
    11011103            $('.lp_form_details').trumbowyg({
    11021104                btns: [
     
    14471449
    14481450        // save
    1449         BODY.on('click','.form_submit',function(){
    1450             form = $(this).closest('form');
    1451             LB = $(this).closest('.lp_one_lightbox');
     1451        BODY.on('click','.form_submit',function(e){
     1452            e.preventDefault();
     1453
     1454            const $btn = $(this);
     1455            const form = $(this).closest('form');
     1456            const LB = $(this).closest('.lp_one_lightbox');
    14521457           
     1458            $btn.html( `<span class="lp_loading_spinner"></span> Saving...`).prop('disabled', true);
    14531459
    14541460            var form_submit_type = $(this).hasClass('save_draft') ? 'save_draft':'submit';
     
    14581464            var item_type = form.find('input[name=item_type]').val();
    14591465
     1466
    14601467            form.ajaxSubmit({
    1461                 beforeSend: function(){         LB.addClass('lp_loading');      },
     1468                beforeSend: function(){         
     1469                    //LB.addClass('lp_loading');       
     1470                },
    14621471                type: 'POST',url:lp_ajax.ajaxurl,dataType:'json',
    1463                 success:function(data){                    
     1472                success:function(data){                 
    14641473                    if(data.status == 'good'){                     
    14651474
  • lifepress/trunk/includes/class-ajax.php

    r3429289 r3463786  
    295295            $post = $HELP->recursive_sanitize_array_fields($_POST);
    296296
    297             $item_type = $post['item_type'];
    298             $tag_data = array();
     297            $item_type = isset($post['item_type']) ? trim($post['item_type']) : '';
     298            $tag_data = [];
     299            $entry_id = isset($post['entry_id']) ? absint($post['entry_id']) : 0;
     300            $tag_id   = isset($post['tag_id'])   ? absint($post['tag_id'])   : 0;
     301
     302            // verify item type pass
     303            if (!in_array($item_type, ['entry', 'tag'], true)) {
     304                wp_send_json_error([
     305                    'error_msg'   => 'Invalid item_type',
     306                    'notice_msg'  => 'Invalid request',
     307                    'notice_type' => 'bad'
     308                ]);
     309            }
    299310
    300311            // ENTRY
    301312            if( $item_type == 'entry'){
    302313
     314                // Check if user is logged in
     315                if ( ! is_user_logged_in() ) {
     316                    wp_send_json(array(
     317                        'status'=>'bad',
     318                        'error_msg'=>__('You must be logged in to perform this action', 'lp'),
     319                        'notice_msg'=>__('Unauthorized access'),
     320                        'notice_type'=>'bad',
     321                    ));
     322                    wp_die();
     323                }
     324
     325
    303326                // EDIT
    304                 if(isset($post['entry_id']) && !empty($post['entry_id'])){
    305                     $entry_id = (int)$post['entry_id'];
     327                if( $entry_id > 0 ){
     328                   
     329                    // Check permission to edit this specific post
     330                    if ( ! current_user_can('edit_post', $entry_id) ) {
     331                        wp_send_json(array(
     332                            'status'=>'bad',
     333                            'error_msg'=>__('You do not have permission to edit this entry', 'lp'),
     334                            'notice_msg'=>__('Permission denied'),
     335                            'notice_type'=>'bad',
     336                        ));
     337                        wp_die();
     338                    }
    306339
    307340                    $date = explode('-', $post['date'] );
     
    320353                    );
    321354                    $result = wp_update_post($entry);
     355
     356                    if (is_wp_error($result)) {
     357                        error_log("LifePress form_submit wp_update_post failed: " . $result->get_error_message());
     358                        wp_send_json([
     359                            'status'     => 'bad',
     360                            'notice_msg' => __('Could not update entry. Please try again.', 'lp'),
     361                            'notice_type'=> 'bad'
     362                        ]);
     363                        wp_die();
     364                    }
    322365
    323366                    if($result){
     
    357400                // NEW
    358401                }else{
     402                    // Check permission to create/publish new posts of this type
     403                    $post_type_object = get_post_type_object('lp_entry');
     404                    if ( ! current_user_can($post_type_object->cap->publish_posts) ) {
     405                        wp_send_json(array(
     406                            'status'=>'bad',
     407                            'error_msg'=>__('You do not have permission to create new entries', 'lp'),
     408                            'notice_msg'=>__('Permission denied'),
     409                            'notice_type'=>'bad',
     410                        ));
     411                        wp_die();
     412                    }
     413
    359414                    $ENT = new LIFEPRESS_Entries();
    360415
     
    365420                    $D->setDate($date[0], $date[1], $date[2]);
    366421                    $D->setTime(0,0,1);
     422                    $post_status = current_user_can('publish_posts') ? 'publish' : 'draft';
    367423
    368424                    $entry_id = $ENT->create_new(array(
     
    370426                        'post_title'=> (isset($post['title'])?
    371427                            $post['title']: __('Entry on').' '.  $post['date'] ),
    372                         'post_status'=>'publish',
     428                        'post_status'=> $post_status,
    373429                        'post_content'=> (isset($post['details'])?  $post['details'] :''),
    374430                        'date'=> $D->format('Y-m-d H:i:s'),
     
    385441                        // save image
    386442                        if( !empty( $_FILES ) && 'POST' == $_SERVER['REQUEST_METHOD']  ){
    387                             $this->save_featured_image($entry_id, 'lp_entry_img');
     443                            if (current_user_can('upload_files')) {
     444                                $this->save_featured_image($entry_id, 'lp_entry_img');
     445                            }
    388446                        }
    389447
     
    422480                }
    423481
    424             }else{ // tag type
     482            }
     483
     484            // tag type
     485            if ($item_type === 'tag' && $tag_id > 0) {
     486                // Check if user is logged in
     487                if ( ! is_user_logged_in() ) {
     488                    wp_send_json(array(
     489                        'status'=>'bad',
     490                        'error_msg'=>__('You must be logged in to perform this action', 'lp'),
     491                        'notice_msg'=>__('Unauthorized access'),
     492                        'notice_type'=>'bad',
     493                    ));
     494                    wp_die();
     495                }
    425496
    426497                if( !isset($post['tag_id'])){
     
    433504
    434505                $ETD = new LIFEPRESS_Type_Data();
    435                 $term_id = $post['tag_id'];
    436                 $ETD->set_id($term_id);
     506                $ETD->set_id($tag_id);
    437507
    438508                $exists  = $ETD->tag_exists();
     
    443513                        'notice_msg'=>__('Tag does not exists'),
    444514                        'notice_type'=>'bad',
    445                         ));wp_die();
     515                    ));wp_die();
    446516
    447517                // exists
    448518                }else{
     519                    if ( ! current_user_can('manage_categories') ) {
     520                        wp_send_json(array(
     521                            'status'=>'bad',
     522                            'error_msg'=>__('You do not have permission to edit tags', 'lp'),
     523                            'notice_msg'=>__('Permission denied'),
     524                            'notice_type'=>'bad',
     525                        ));
     526                        wp_die();
     527                    }
    449528
    450529                    $C = isset($post['c'])? $post['c']:'808080';                   
     
    459538                        'notice_msg'=>__('Successfully updated tag'),
    460539                            'notice_type'=>'good',
    461                         ));wp_die();
     540                    ));
     541                    wp_die();
    462542                }
    463543
  • lifepress/trunk/lifepress.php

    r3429289 r3463786  
    55 * Description: You are the creator of events in your life. Record and track progress in your life.
    66 * Author: Ashan Jay
    7  * Version: 2.2.1
     7 * Version: 2.2.2
    88 * Requires at least: 6.0
    9  * Tested up to: 6.9
     9 * Tested up to: 6.9.1
    1010 * Author URI: http://www.ashanjay.com/
    1111 *
     
    2020class LIFEPRESS{
    2121   
    22     public $version='2.2.1
     22    public $version='2.2.2
    2323    ';
    2424    public $name = 'LifePress';
  • lifepress/trunk/templates/class-template_parts.php

    r3428394 r3463786  
    345345                        </span>
    346346                    </div>
    347                     <p class="data_row padt10"><span class='lp_btn form_submit orange'><?php _e('Submit');?></span></p>
     347                    <p class="data_row padt10"><span class='lp_btn bold form_submit lp_trans blue'><?php _e('Submit');?></span></p>
    348348                </form>
    349349                <?php
     
    432432                    </p>
    433433                   
    434                     <p class='data_row no_icon'><input type="text" placeholder='<?php _e('Add title','lp')?>' name='title' value='{{fields.title}}'/></p>
     434                    <p class='data_row no_icon'><input class='lp_entry_title' tab-index='3' type="text" placeholder='<?php _e('Add title','lp')?>' name='title' value='{{fields.title}}'/></p>
    435435                   
    436436                    <div class='data_row details marb10 lp_toggabalables'>
     
    438438                            <i class="fas fa-align-left"></i>
    439439                        </span>
    440                         <span class='lp_form_field_label lp_toggles lp_clickable lp_hidable' data-t='lp_editor_box'><?php _e('Add description','lp');?></span>
     440                        <button class='lp_form_field_label lp_btn lp_nobtn lp_toggles lp_clickable lp_hidable' data-t='lp_editor_box'><i class='fa fa-plus' style="margin:0 5px 0 0;"></i> <?php _e('Add description','lp');?></button>
    441441                       
    442442                        <div class='lp_editor_box ' style='display:{{#if fields.details}}block{{else}}none{{/if}}'>
    443                             <textarea class='lp_form_details' name='details'>{{fields.details}}</textarea>
     443                            <textarea tab-index='4' class='lp_form_details' name='details'>{{fields.details}}</textarea>
    444444                        </div>
    445445                    </div>
     
    449449                        <i class="fas fa-image"></i>
    450450                        <p class='w100'>
    451                             <span class='lp_btn blue lp_select_image'><?php _e('Select Image','lp');?></span>
     451                            <button class='lp_btn blue lp_select_image'><?php _e('Select Image','lp');?></button>
    452452                            <input class='lp_select_image_input' style='opacity:0;display:none' type="file" name="lp_entry_img"/>
    453453                            <?php echo wp_nonce_field( 'my_image_upload', 'my_image_upload_nonce' );?>
     
    474474                   
    475475                    <p class="data_row no_icon padt30" style="justify-content: flex-start;">
    476                         <span class='lp_btn orange form_submit'><?php _e('Submit','lp');?></span>
    477                         <span class='lp_btn grey form_submit save_draft'><?php _e('Save Draft','lp');?></span>
     476                        <button class='lp_btn bold blue lp_trans form_submit'><?php _e('Submit','lp');?></button>
     477                        <button class='lp_btn bold grey form_submit save_draft'><?php _e('Save Draft','lp');?></button>
    478478                    </p>
    479479                </form>
Note: See TracChangeset for help on using the changeset viewer.