Plugin Directory

Changeset 3034410 for categorify


Ignore:
Timestamp:
02/12/2024 08:40:58 AM (14 months ago)
Author:
frenify
Message:

readme.txt

Location:
categorify
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • categorify/trunk/assets/js/core.js

    r2998641 r3034410  
    256256                IDs: IDs,
    257257                folderID: folderID,
     258                security: self.nonce,
    258259            };
    259260           
     
    364365            var requestData = {
    365366                action: 'categorifyAjaxGetTermsByMedia',
    366                 nonce: self.nonce,
     367                security: self.nonce,
    367368                ID: mediaID,
    368369            };
     
    414415                mediaID: mediaID,
    415416                folderID: folderID,
     417                security: self.nonce,
    416418            };
    417419           
     
    681683                current: current,
    682684                parent: newParent,
     685                security: self.nonce,
    683686            };
    684687
     
    716719            var requestData = {
    717720                action: 'categorifyAjaxUpdateFolderPosition',
    718                 data: data
     721                data: data,
     722                security: self.nonce,
    719723            };
    720724           
     
    14331437                e.stopPropagation();
    14341438               
    1435                 console.log('aliya');
    14361439               
    14371440                var renamedLi   = jQuery('ul.cc_categorify_category_list li.rename');
     
    15211524                    categoryName: categoryName,
    15221525                    parent: parent,
     1526                    security: self.nonce,
    15231527                };
    15241528
     
    15521556                categoryID: ID,
    15531557                categoryTitle: title,
     1558                security: self.nonce,
    15541559            };
    15551560
     
    16541659                action: 'categorifyAjaxClearCategory',
    16551660                categoryID: categoryID,
     1661                security: self.nonce,
    16561662            };
    16571663
     
    17211727                action: 'categorifyAjaxDeleteCategory',
    17221728                categoryID: categoryID,
     1729                security: self.nonce,
    17231730            };
    17241731
  • categorify/trunk/assets/js/filter.js

    r2612898 r3034410  
    135135                IDs: IDs,
    136136                folderID: folderID,
     137                security: self.nonce,
    137138            };
    138139
     
    191192            var requestData = {
    192193                action: 'categorifyAjaxGetTermsByMedia',
    193                 nonce: self.nonce,
     194                security: self.nonce,
    194195                ID: mediaID,
    195196            };
     
    239240                mediaID: mediaID,
    240241                folderID: folderID,
     242                security: self.nonce,
     243               
    241244            };
    242245           
  • categorify/trunk/assets/js/upload.js

    r2611301 r3034410  
    247247                    attachmentID: attachmentID,
    248248                    action: 'categorifyAjaxCheckDeletingMedia',
    249                     ajaxNonce: categorifyConfig.nonce
     249                    security: categorifyConfig.nonce,
    250250                };
    251251               
  • categorify/trunk/categorify.php

    r2998641 r3034410  
    55 * Plugin URI:  https://frenify.com/project/categorify/
    66 * Description: Organize your WordPress media files in categories via drag and drop.
    7  * Version:     1.0.7.4
     7 * Version:     1.0.7.5
    88 * Author:      Frenify
    99 * Author URI:  https://frenify.com/
     
    7373    define( 'CATEGORIFY_PLUGIN_NAME', 'Categorify' );
    7474    define( 'CATEGORIFY_PLUGIN_URL', plugin_dir_url( CATEGORIFY__FILE__ ) );
    75     define( 'CATEGORIFY_PLUGIN_VERSION', '1.0.7.4' );
     75    define( 'CATEGORIFY_PLUGIN_VERSION', '1.0.7.5' );
    7676    function categorify_plugins_loaded()
    7777    {
  • categorify/trunk/freemius/includes/class-freemius.php

    r2997435 r3034410  
    13581358
    13591359        function _run_garbage_collector() {
    1360             // @todo - Remove this check once the garbage collector is ready to be out of beta.
    1361             if ( true !== fs_get_optional_constant( 'WP_FS__ENABLE_GARBAGE_COLLECTOR', false ) ) {
     1360            if ( true !== fs_get_optional_constant( 'WP_FS__ENABLE_GARBAGE_COLLECTOR', true ) ) {
    13621361                return;
    13631362            }
  • categorify/trunk/freemius/includes/class-fs-garbage-collector.php

    r2998026 r3034410  
    282282
    283283            foreach ( $users as $user_id => $user ) {
    284                 if ( ! isset( $user_has_install[ $user_id ] ) ) {
     284                if ( ! isset( $user_has_install_map[ $user_id ] ) ) {
    285285                    unset( $users[ $user_id ] );
    286286
  • categorify/trunk/freemius/start.php

    r2997435 r3034410  
    1616     * @var string
    1717     */
    18     $this_sdk_version = '2.6.0';
     18    $this_sdk_version = '2.6.2';
    1919
    2020    #region SDK Selection Logic --------------------------------------------------------------------
     
    4747    $file_path    = fs_normalize_path( __FILE__ );
    4848    $fs_root_path = dirname( $file_path );
     49
     50    // @todo: Remove this code after a few months when WP 6.3 usage is low enough.
     51    global $wp_version;
    4952
    5053    if (
     
    5457         * @see theme-previews.php:wp_get_theme_preview_path()
    5558         *
    56          * @todo If this behavior is fixed in the core, we will remove this workaround.
     59         * @todo This behavior is already fixed in the core (WP 6.3.2+), and this code can be removed after a few months when WP 6.3 usage is low enough.
    5760         * @since WP 6.3.0
    5861         */
     62        version_compare( $wp_version, '6.3', '>=' ) &&
     63        version_compare( $wp_version, '6.3.1', '<=' ) &&
    5964        (
    6065            'site-editor.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ||
  • categorify/trunk/inc/sidebar.php

    r2998038 r3034410  
    5050            'wp_kses_allowed_html',
    5151            array( $this, 'categorify_allowed_html' ),
    52             11,
     52            20,
    5353            2
    5454        );
     
    7777            $allowed = array(
    7878                'input'  => array_merge( $common_attributes, array(
    79                 'type'         => array(),
    80                 'name'         => array(),
    81                 'value'        => array(),
    82                 'placeholder'  => array(),
    83                 'autocomplete' => array(),
     79                    'type'         => array(),
     80                    'name'         => array(),
     81                    'value'        => array(),
     82                    'placeholder'  => array(),
     83                    'autocomplete' => array(),
    8484            ) ),
    8585                'select' => array_merge( $common_attributes, array(
    86                 'class' => array(),
     86                    'class' => array(),
    8787            ) ),
    8888                'option' => array(
    89                 'value' => array(),
     89                    'value' => array(),
    9090            ),
    9191                'img'    => array_merge( $common_attributes, array(
    92                 'src'    => true,
    93                 'alt'    => true,
    94                 'title'  => true,
    95                 'width'  => true,
    96                 'height' => true,
     92                    'src'    => true,
     93                    'alt'    => true,
     94                    'title'  => true,
     95                    'width'  => true,
     96                    'height' => true,
    9797            ) ),
    9898                'ul'     => $common_attributes,
     
    103103                'svg'    => $common_attributes,
    104104                'h3'     => $common_attributes,
     105                'p'     => $common_attributes,
    105106            );
    106107        }
     
    172173        wp_register_script( 'inline-script-handle-header', '' );
    173174        wp_enqueue_script( 'inline-script-handle-header' );
    174         wp_add_inline_script( 'inline-script-handle-header', '/* <![CDATA[ */ var categorifyFolders = [{"folderID":"all","folderName":"' . esc_html( $allFilesText ) . '"}, {"folderID":"-1","folderName":"' . esc_html( $uncategorizedText ) . '"},' . wp_kses_post( substr( $attachmentTerms, 2 ) ) . ']; /* ]]> */' );
     175        wp_add_inline_script( 'inline-script-handle-header', '/* <![CDATA[ */ var categorifyFolders = [{"folderID":"all","folderName":"' . esc_html( $allFilesText ) . '"}, {"folderID":"-1","folderName":"' . esc_html( $uncategorizedText ) . '"},' . wp_kses( substr( $attachmentTerms, 2 ), 'post' ) . ']; /* ]]> */' );
    175176        wp_enqueue_script( 'jquery-ui-draggable' );
    176177        wp_enqueue_script( 'jquery-ui-droppable' );
     
    228229            'plugin'                     => CATEGORIFY_PLUGIN_NAME,
    229230            'pluginURL'                  => CATEGORIFY_URL,
    230             'nonce'                      => wp_create_nonce( 'ajax-nonce' ),
     231            'nonce'                      => wp_create_nonce( 'categorify-security' ),
    231232            'uploadURL'                  => admin_url( 'upload.php' ),
    232233            'ajaxUrl'                    => admin_url( 'admin-ajax.php' ),
     
    258259            'pluginURL'   => CATEGORIFY_URL,
    259260            'ajaxUrl'     => admin_url( 'admin-ajax.php' ),
    260             'nonce'       => wp_create_nonce( 'ajax-nonce' ),
     261            'nonce'       => wp_create_nonce( 'categorify-security' ),
    261262            'moveOneFile' => esc_html__( 'Move 1 file', CATEGORIFY_TEXT_DOMAIN ),
    262263            'move'        => esc_html__( 'Move', CATEGORIFY_TEXT_DOMAIN ),
     
    271272        ] );
    272273        wp_localize_script( 'categorify-upload', 'categorifyConfig', [
    273             'nonce' => wp_create_nonce( 'ajax-nonce' ),
     274            'nonce' => wp_create_nonce( 'categorify-security' ),
    274275        ] );
    275276        wp_enqueue_script( 'iaoalert' );
     
    329330        $output .= $this->splitter();
    330331        $output .= '</div>';
    331         echo  wp_kses_post( $output ) ;
     332        echo  wp_kses( $output, 'post' ) ;
    332333    }
    333334   
     
    357358        $output .= '</p>';
    358359        // echo result
    359         echo  wp_kses_post( $output ) ;
     360        echo  wp_kses( $output, 'post' ) ;
     361    }
     362
     363    public function checkUserRole() {
     364        $user_id = get_current_user_id();
     365        if ($user_id) {
     366            $user_info = get_userdata($user_id); // Get user data
     367            // Check if the user has the 'administrator' role
     368            if (in_array('administrator', $user_info->roles)) {
     369                return true; // User is an administrator
     370            } else {
     371                return false; // User is not an administrator
     372            }
     373        } else {
     374            return false; // User ID not found
     375        }
    360376    }
    361377   
    362378    public function categorifyAjaxAddCategory()
    363379    {
     380
     381        check_ajax_referer( 'categorify-security', 'security' );
     382
     383        // Check user role
     384        $action = $this->checkUserRole();
     385
     386        // Stop execution if user is not an administrator
     387        if (!$action) {
     388            wp_die('You do not have permission to perform this action.');
     389        }
     390
    364391        $categoryName = sanitize_text_field( $_POST["categoryName"] );
    365392        $parent = sanitize_text_field( $_POST["parent"] );
     
    386413    public function categorifyAjaxDeleteCategory()
    387414    {
     415        check_ajax_referer( 'categorify-security', 'security' );
     416
     417        // Check user role
     418        $action = $this->checkUserRole();
     419
     420        // Stop execution if user is not an administrator
     421        if (!$action) {
     422            wp_die('You do not have permission to perform this action.');
     423        }
     424
    388425        $categoryID = sanitize_text_field( $_POST["categoryID"] );
    389426        $selectedTerm = get_term( $categoryID, CATEGORIFY_TAXONOMY );
     
    407444    {
    408445        global  $wpdb ;
     446        check_ajax_referer( 'categorify-security', 'security' );
     447
     448        // Check user role
     449        $action = $this->checkUserRole();
     450
     451        // Stop execution if user is not an administrator
     452        if (!$action) {
     453            wp_die('You do not have permission to perform this action.');
     454        }
    409455        $categoryID = sanitize_text_field( $_POST["categoryID"] );
    410456        $selectedTerm = get_term( $categoryID, CATEGORIFY_TAXONOMY );
     
    426472    public function categorifyAjaxRenameCategory()
    427473    {
     474        check_ajax_referer( 'categorify-security', 'security' );
     475
     476        // Check user role
     477        $action = $this->checkUserRole();
     478
     479        // Stop execution if user is not an administrator
     480        if (!$action) {
     481            wp_die('You do not have permission to perform this action.');
     482        }
    428483        $categoryID = sanitize_text_field( $_POST["categoryID"] );
    429484        $categoryTitle = sanitize_text_field( $_POST["categoryTitle"] );
     
    482537    public function categorifyAjaxMoveMultipleMedia()
    483538    {
     539
     540        check_ajax_referer( 'categorify-security', 'security' );
     541
     542        // Check user role
     543        $action = $this->checkUserRole();
     544
     545        // Stop execution if user is not an administrator
     546        if (!$action) {
     547            wp_die('You do not have permission to perform this action.');
     548        }
     549
    484550        $IDs = $this->recursive_sanitize_text_field( $_POST['IDs'] );
    485551        $folderID = sanitize_text_field( $_POST['folderID'] );
     
    514580    public function categorifyAjaxGetTermsByMedia()
    515581    {
     582        check_ajax_referer( 'categorify-security', 'security' );
     583
     584        // Check user role
     585        $action = $this->checkUserRole();
     586
     587        // Stop execution if user is not an administrator
     588        if (!$action) {
     589            wp_die('You do not have permission to perform this action.');
     590        }
     591
    516592        $error = 'no';
    517         $nonce = sanitize_text_field( $_POST['nonce'] );
     593        $nonce = sanitize_text_field( $_POST['security'] );
    518594        $terms = array();
    519         if ( !wp_verify_nonce( $nonce, 'ajax-nonce' ) ) {
     595        if ( !wp_verify_nonce( $nonce, 'categorify-security' ) ) {
    520596            $error = 'yes';
    521597        }
     
    538614    public function categorifyAjaxMoveSingleMedia()
    539615    {
     616
     617        check_ajax_referer( 'categorify-security', 'security' );
     618
     619        // Check user role
     620        $action = $this->checkUserRole();
     621
     622        // Stop execution if user is not an administrator
     623        if (!$action) {
     624            wp_die('You do not have permission to perform this action.');
     625        }
     626
    540627        $error = 'no';
    541628       
     
    601688    public function categorifyAjaxUpdateFolderPosition()
    602689    {
     690        check_ajax_referer( 'categorify-security', 'security' );
     691
     692        // Check user role
     693        $action = $this->checkUserRole();
     694
     695        // Stop execution if user is not an administrator
     696        if (!$action) {
     697            wp_die('You do not have permission to perform this action.');
     698        }
    603699        $results = sanitize_text_field( $_POST["data"] );
    604700        $results = explode( '#', $results );
     
    612708    public function categorifyAjaxMoveCategory()
    613709    {
     710       
     711        check_ajax_referer( 'categorify-security', 'security' );
     712
     713        // Check user role
     714        $action = $this->checkUserRole();
     715
     716        // Stop execution if user is not an administrator
     717        if (!$action) {
     718            wp_die('You do not have permission to perform this action.');
     719        }
     720
    614721        $current = sanitize_text_field( $_POST["current"] );
    615722        $parent = sanitize_text_field( $_POST["parent"] );
     
    731838    public function categorifyAjaxCheckDeletingMedia()
    732839    {
     840
     841        check_ajax_referer( 'categorify-security', 'security' );
     842
     843        // Check user role
     844        $action = $this->checkUserRole();
     845
     846        // Stop execution if user is not an administrator
     847        if (!$action) {
     848            wp_die('You do not have permission to perform this action.');
     849        }
     850
    733851        $attachmentID = '';
    734852        $error = 'no';
    735853        $terms = array();
    736         $ajaxNonce = sanitize_text_field( $_POST['ajaxNonce'] );
    737         if ( !wp_verify_nonce( $ajaxNonce, 'ajax-nonce' ) ) {
     854        $ajaxNonce = sanitize_text_field( $_POST['security'] );
     855        if ( !wp_verify_nonce( $ajaxNonce, 'categorify-security' ) ) {
    738856            $error = 'yes';
    739857        }
  • categorify/trunk/readme.txt

    r2998641 r3034410  
    66Tags: media library folders, media library categories, media library folder, media library category, media folders, media category, subfolders, file manager, directories, folder, folders, organize
    77Requires at least: 6.0.0
    8 Tested up to: 6.4.1
    9 Stable tag: 1.0.7.4
     8Tested up to: 6.4.2
     9Stable tag: 1.0.7.5
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5959== Changelog ==
    6060
     61= Version 1.0.7.5 - Feb 12, 2024 =
     62- Fixed: Security Issues
     63- Fixed: Html output issues.
     64
    6165= Version 1.0.7.4 - Nov 20, 2023 =
    6266- Fixed: Minor Issues
Note: See TracChangeset for help on using the changeset viewer.