Plugin Directory

Changeset 3246045


Ignore:
Timestamp:
02/24/2025 09:50:20 PM (13 months ago)
Author:
3skel
Message:

1.0.19 Improved file deletion control

Location:
hypertransfer/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • hypertransfer/trunk/assets/admin.php

    r3244423 r3246045  
    174174                $fileSize = intval($value['size']);
    175175                $current_user_mail = sanitize_text_field($value['usermail']);
    176             }
    177            
    178 
    179             if (delete_option("hypertransferItem_".$option)) {
    180             //echo 'Opzione eliminata con successo!';
    181            
    182             $dir_to_delete = dirname($file_path);
    183            
    184             if (is_dir($dir_to_delete)) {
    185                 HPTR_deleteDirectory($dir_to_delete);
    186                 echo '<div class="updated"><p>Files and records deleted successfully.</p></div>';
    187                 wp_add_inline_script('HyperTransferScript','location.reload(); ');// Forza il refresh della pagina
    188                 echo '</div>';
    189             }
    190            
     176               
     177                $dir_to_delete = dirname($file_path);
     178                if (HPTR_deleteDirectory($dir_to_delete)) {
     179                    if (delete_option("hypertransferItem_".$option)){
     180                        echo "OK"; // item e file eliminati con successo
     181                    }else{
     182                        echo "File not deleted";
     183                    }
     184                }else{
     185                    echo "Item not deleted";
     186                }
     187
    191188            } else {
    192                 echo 'The option does not exist or has been removed.';
     189                echo 'Item not present, try reinstalling the plugin';
    193190            }
    194191        wp_die(); // Termina l'esecuzione
    195192        }
    196193       
    197 } else {
    198 
    199   wp_die('Nonce isn\'t valid');
    200 
    201 }
    202    
    203    
    204 
    205 
    206 }
    207 add_action('wp_ajax_delete_option_by_value', 'HPTR_delete_handle_option_by_value');
     194    } else {
     195
     196      wp_die('Nonce isn\'t valid');
     197
     198    }
     199   
     200}
     201add_action('wp_ajax_HPTR_delete_option_by_value', 'HPTR_delete_handle_option_by_value');   
    208202
    209203
     
    313307
    314308function HPTR_deleteDirectory($dir) {
    315    
    316     if ($dir=="" || $dir==null){
     309    // aumentata la sicurezza grazie alla ricerca della stringa della cartella "HyperTransferFile"
     310    if ($dir=="" || $dir==null || !str_contains($dir, '/HyperTransferFile/')){
    317311        return false;
    318312    }
     313   
    319314    // Usa l'API WP_Filesystem
    320315    global $wp_filesystem;
     
    326321    }
    327322
    328     // Verifica che la directory esista
     323    // Verifica che la directory esista e appartenga a hypertransfer
    329324    if ($wp_filesystem->is_dir($dir)) {
    330325        // Elimina tutti i file e sottodirectory
  • hypertransfer/trunk/assets/hypertransfer.js

    r3240947 r3246045  
    254254
    255255
    256 ////////////////////////
     256
    257257
    258258    // Funzione per fermare l'upload
     
    340340            formData.append('file_path', path);
    341341            formData.append('_wpnonce', nonce);
    342             formData.append('action', 'delete_option_by_value');
     342            formData.append('action', 'HPTR_delete_option_by_value');
    343343           
    344344            var xhr = new XMLHttpRequest();
     
    348348
    349349            xhr.onload = function() {
    350                   if (xhr.status != 200) { // analizza lo status HTTP della risposta
    351                     alert(`Error ${xhr.status}: ${xhr.statusText}`); // ad esempio 404: Not Found
    352                   } else { // mostra il risultato
    353                     //alert(`${xhr.response}`); // response contiene la risposta del server
    354                     location.reload(); // Forza il refresh della pagina</script>';
    355                   }
     350                if (xhr.status != 200) { // analizza lo status HTTP della risposta
     351                        alert(`Error ${xhr.status}: ${xhr.statusText}`); // ad esempio 404: Not Found
     352                }else{ // mostra il risultato
     353                    if (`${xhr.response}` =='OK'){
     354                        location.reload(); // Forza il refresh della pagina
     355                    }else{
     356                        alert(`${xhr.response}`); // response contiene la risposta del server
     357                    }
     358                }
    356359            };
    357360            xhr.onerror = function() {
     
    359362            };
    360363        }else{
     364            //alert('annullato');
     365            // non è stato dato il consenso
    361366        };
    362367    }else{
  • hypertransfer/trunk/hypertransfer.php

    r3244423 r3246045  
    55 * License:           GPL v2 or later
    66 * Description:       This plugin is used for the rapid and easy transfer of files, stored on your web space, via links. Valid alternative to file transfer sites, with the advantage of having no transfer deadline, the files are stored on your private web space and customers will be able to visit the website via the download page.
    7  * Version:           1.0.18
     7 * Version:           1.0.19
    88 * Requires at least: 6.3
    99 * Requires PHP:      7.4
     
    2222
    2323// Definisce la directory e variabili globali
    24 define('HYPERTRANSFER_THIS_VERSION', '1.0.18'); // *** Aggiornare come sopra *** //
     24define('HYPERTRANSFER_THIS_VERSION', '1.0.19'); // *** Aggiornare come sopra *** //
    2525define('HYPERTRANSFER_UPLOAD_DIR', wp_upload_dir()['basedir'] . '/HyperTransferFile/');
    2626define('HYPERTRANSFER_UPLOAD_URL', wp_upload_dir()['baseurl'] . '/HyperTransferFile/');
     
    4040function HPTR_assets() {
    4141   
    42     wp_register_script( 'HyperTransferScript', plugin_dir_url(__FILE__) .'assets/hypertransfer.js', array( 'jquery' ), '1.0.0', true);
    43     wp_register_style( 'HyperTransferStyle', plugin_dir_url(__FILE__) .'assets/hypertransfer.css', array(), '1.0.0' );
     42    wp_register_script( 'HyperTransferScript', plugin_dir_url(__FILE__) .'assets/hypertransfer.js', array( 'jquery' ), '1.0.19', true);
     43    wp_register_style( 'HyperTransferStyle', plugin_dir_url(__FILE__) .'assets/hypertransfer.css', array(), '1.0.19' );
    4444   
    4545    wp_enqueue_style( 'HyperTransferStyle');
     
    182182                    'idfile' => $unique_id ,
    183183                    'path' => ($PathFileZippato),
    184                     'date' => gmdate("d-m-Y H:i:s"),
     184                    'date' => gmdate("d-m-Y H:i"),
    185185                    'downloaded' => 0,
    186186                    'direct' => $Direct,
  • hypertransfer/trunk/readme.txt

    r3244423 r3246045  
    33Tags: file, transfer, sender, share, wp transfer
    44Tested up to: 6.7
    5 Stable tag: 1.0.18
     5Stable tag: 1.0.19
    66Requires PHP: 7.4
    77License: GPLv2
     
    1111== Description ==
    1212 
    13 This lightweight plugin is used for the rapid transfer of files, stored on your web space, via link. Valid alternative to file transfer sites, with the advantage of having no transfer deadline, the files are stored on your private web space and customers will be able to visit the website via the download page.
     13This lightweight plugin enables fast file transfers via direct links, using your own web space. It serves as a reliable alternative to traditional file transfer services, with the added benefit of no expiration on transfers. Files remain securely stored on your private web space, allowing clients to access them anytime through a dedicated download page.
    1414 
    1515= Special Features =
     
    2121= Localization =
    2222* English (default)
    23 
    2423 
    2524[A plugin from 3skel.it](https://www.3skel.it)
     
    6968Fix page 404 if no key is defined in the "hypertransfer" url
    7069Logo images are no longer uploaded to the media gallery
    71  
     70
     71= 1.0.19 =
     72Improved file deletion control.
     73
    7274== Language ==
    7375 
     
    7880 
    7981== Credits ==
    80 * Davide Trinagli, Lorenzo Cassulo, Myself :)
     82* Davide Trinagli, Lorenzo Cassulo, Alessandro Massi, Myself :)
Note: See TracChangeset for help on using the changeset viewer.