Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi Howdy_McGee, I can help you for the first and the last validation errors. You have to edit your functions.php (it is located in your active template directory) then you have to add at the end of the file the following line:

    add_filter( 'wpcf7_support_html5', '__return_false' );

    I still need help to fix the other validation error.

    Thread Starter mcseller

    (@mcseller)

    Please try to explain why the first line of code fails validation with there is no attribute “aria required” error, the next two lines are ok and the last line of code fails validation with there is no attribute “aria required” error and there is no attribute “maxlength” error

      <li><p>Il tuo nome (richiesto<a href="#richiesto"><sup><strong>1</strong></sup></a>)<br/><span class="wpcf7-form-control-wrap your-name"><input type="text" name="your-name" value="" size="30" maxlength="50" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" /></span></p>

    1. <p>La tua email (richiesto<a href="#richiesto"><sup><strong>1</strong></sup></a>)<br/><span class="wpcf7-form-control-wrap your-email"><input type="text" name="your-email" value="" size="30" maxlength="50" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" /></span></p>
    2. <p>Oggetto (richiesto<a href="#richiesto"><sup><strong>1</strong></sup></a>)<br/><span class="wpcf7-form-control-wrap your-subject"><input type="text" name="your-subject" value="" size="30" maxlength="50" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" /></span></p>
    3. <p>Il tuo messaggio (richiesto<a href="#richiesto"><sup><strong>1</strong></sup></a>)<br/><span class="wpcf7-form-control-wrap your-message"><textarea name="your-message" cols="43" rows="10" maxlength="512" class="wpcf7-form-control wpcf7-textarea wpcf7-validates-as-required" aria-required="true"></textarea></span></p>

    Thanks

    Thread Starter mcseller

    (@mcseller)

    sorry, I meant:
    By the way: I added following row on functions.php:
    add_filter( 'wpcf7_support_html5', '__return_false' );

    mcseller

    (@mcseller)

    @ylluminate and @kilmanagh, I have to use this plugin so I’m working on it.

    For now, I can help you on wpdm-server-file-browser.php errors:

    You have to add following line as first line into wpdm_dir_tree function:
    if(!array_key_exists('task',$_GET)) return; /* by M.C. - Add this Line */

    Then you have to add following line as first line into wpdm_file_browser function:
    if(!array_key_exists('task',$_GET)) return; /* by M.C. - Add this Line */

    Hope this will help ??

    mcseller

    (@mcseller)

    This is the patch:

    File “wpdm-categories.php”
    Line 94 – Original Line:
    <b><?php echo $pres.' '.stripslashes($category['title'])?></b>
    Line 94 – Modified Line:
    <b><?php echo $pres.' '.stripslashes($category['title'])?></b> <?php /* by M.C. - Modified - Add stripslashes function before $category['title'] */ ?>

    Line 102 – Original Line:
    <input type="text" style="width: 99%;font-size: 14pt" name="cat[title]" value="<?php echo htmlspecialchars($cat[title]); ?>">
    Line 102 – Modified Line:
    <input type="text" style="width: 99%;font-size: 14pt" name="cat[title]" value="<?php echo stripslashes(htmlspecialchars($cat[title])); ?>"> <?php /* by M.C. - Modified - Add stripslashes function before htmlspecialchars */ ?>
    File “wpdm-list-files.php”
    Line 118 – Original Line:
    "><?php echo $media['title']?> <input style="text-align:center" type="text" onclick="this.select()" size="20" title="Simply Copy and Paste in post contents" value="[wpdm_file id=<?php echo $media['id'];?>]" />

    Line 118 – Modified Line:
    "><?php echo stripslashes($media['title'])?> <input style="text-align:center" type="text" onclick="this.select()" size="20" title="Simply Copy and Paste in post contents" value="[wpdm_file id=<?php echo $media['id'];?>]" />
    <?php /* by M.C. - Modified - Add stripslashes function before $media['title'] */ ?>

    File “wpdm-add-new-file.php”
    Line 40 – Original Line:
    <td><input style="font-size:16pt;width:100%;color:<?php echo $file['title']?'#000':'#ccc'; ?>" onfocus="if(this.value=='Enter title here') {this.value=''; jQuery(this).css('color','#000'); }" onblur="if(this.value==''||this.value=='Enter title here') {this.value='Enter title here'; jQuery(this).css('color','#ccc');}" type="text" value="<?php echo $file['title']?$file['title']:'Enter title here'; ?>" name="file[title]" /></td>
    Line 40 – Modified Line:
    <td><input style="font-size:16pt;width:100%;color:<?php echo $file['title']?'#000':'#ccc'; ?>" onfocus="if(this.value=='Enter title here') {this.value=''; jQuery(this).css('color','#000'); }" onblur="if(this.value==''||this.value=='Enter title here') {this.value='Enter title here'; jQuery(this).css('color','#ccc');}" type="text" value="<?php echo $file['title']?stripslashes(htmlspecialchars($file['title'])):'Enter title here'; ?>" name="file[title]" /></td> <?php /* by M.C. - Modified - Add stripslashes and htmlspecialchars functions before $file['title'] */ ?>

    Line 65 – Original Line:
    <td><input size="10" type="text" style="width: 200px" value="<?php echo $file[link_label]?$file[link_label]:'Download'; ?>" name="file[link_label]" />
    Line 65 – Modified Line:
    <td><input size="10" type="text" style="width: 200px" value="<?php echo $file[link_label]?stripslashes(htmlspecialchars($file[link_label])):'Download'; ?>" name="file[link_label]" /> <?php /* by M.C. - Modified - Add stripslashes and htmlspecialchars functions before $file['link_label'] */ ?>
    File “download-manager.php”
    Line 257 – Original Line:
    echo "<li style='line-height:16px'><input type='checkbox' name='file[category][]' value='$id' $checked />" . $cat[title];
    Line 257 – Modified Line:
    echo "<li style='line-height:16px'><input type='checkbox' name='file[category][]' value='$id' $checked />" . stripslashes($cat[title]); /* by M.C. - Modified - Add stripslashes function before $cat['title'] */
    File “wpdm-server-file-browser.php”
    Line 27 – Original Line:
    echo "<li class=\"directory collapsed\">" . htmlentities($file) . "";
    Line 27 – Modified Line:
    echo "<li class=\"directory collapsed\">" . html_entity_decode($file) . ""; /* by M.C. - Modified - changed functions name to html_entity_decode from htmlentities */

    …that’s all!

    In my previous post I included a link that’s point to a post where I explain the patch.

    mcseller

    (@mcseller)

    Ok, I did it ??

    Take a look at WordPress Download Manager Plugin – Fix “bad” characters encoding

    Hope it will help ??

    mcseller

    (@mcseller)

    Hi goraxan,

    categories are not the onle issue… problem you talked about exists for file title and link label too!

    I’m working on it.

    Thread Starter mcseller

    (@mcseller)

    Hey shauno,

    thanks for your answer ??

    If can help you, here is my hack code in NextGEN Gallery plugin. It works well for me, but I’m sure you can find a better solution. One more think: I just added lines and you can recognize them because all of them begins and ends with “by M.C.” words.

    file: lib/ngg-db.php – function delete_gallery

    function delete_gallery( $id ) {
    global $wpdb;

    /* by M.C. – Added Lines – Delete Custom Fields Too! */
    /* NextGEN Custom Fields Patch */
    if ( function_exists ( ‘nggcf_save_pics’ ) )
    {
    if ( $mcRecords = $wpdb -> get_results ( “SELECT * FROM ” . $wpdb -> nggpictures. ” WHERE galleryid = ” . $this -> id ) )
    {
    foreach ( $mcRecords as $mcRecord )
    $wpdb -> query ( “DELETE FROM ” . $wpdb -> prefix . “nggcf_field_values WHERE ngg_type=1 AND pid = ” . $mcRecord -> pid );
    }
    $wpdb -> query ( “DELETE FROM ” . $wpdb -> prefix . “nggcf_field_values WHERE ngg_type=2 AND pid = ” . $this -> id );
    }
    /* NextGEN Custom Fields Patch */
    /* by M.C. – Added Lines – Delete Custom Fields Too! */

    $wpdb->query( $wpdb->prepare( “DELETE FROM $wpdb->nggpictures WHERE galleryid = %d”, $id) );
    $wpdb->query( $wpdb->prepare( “DELETE FROM $wpdb->nggallery WHERE gid = %d”, $id) );

    wp_cache_delete($id, ‘ngg_gallery’);

    //TODO:Remove all tag relationship
    return true;
    }

    file: lib/ngg-db.php – function delete_image

    function delete_image( $id ) {
    global $wpdb;

    // Delete the image
    $result = $wpdb->query( $wpdb->prepare( “DELETE FROM $wpdb->nggpictures WHERE pid = %d”, $id) );

    // Delete tag references
    wp_delete_object_term_relationships( $id, ‘ngg_tag’);

    // Remove from cache
    wp_cache_delete( $id, ‘ngg_image’);

    /* by M.C. – Added Lines – Delete Custom Fields Too! */
    /* NextGEN Custom Fields Patch */
    if ( function_exists ( ‘nggcf_save_pics’ ) )
    $wpdb -> query ( “DELETE FROM ” . $wpdb -> prefix . “nggcf_field_values WHERE ngg_type=1 AND pid = ” . $id );
    /* NextGEN Custom Fields Patch */
    /* by M.C. – Added Lines – Delete Custom Fields Too! */

    return $result;
    }

    file: admin/functions.php – function copy_images

    function copy_images($pic_ids, $dest_gid) {

    $errors = $messages = ”;

    if (!is_array($pic_ids))
    $pic_ids = array($pic_ids);

    // Get destination gallery
    $destination = nggdb::find_gallery( $dest_gid );
    if ( $destination == null ) {
    nggGallery::show_error(__(‘The destination gallery does not exist’,’nggallery’));
    return;
    }

    // Check for folder permission
    if (!is_writeable(WINABSPATH.$destination->path)) {
    $message = sprintf(__(‘Unable to write to directory %s. Is this directory writable by the server?’, ‘nggallery’), WINABSPATH.$destination->path);
    nggGallery::show_error($message);
    return;
    }

    // Get pictures
    $images = nggdb::find_images_in_list($pic_ids);
    $destination_path = WINABSPATH . $destination->path;

    foreach ($images as $image) {
    // WPMU action
    if ( nggAdmin::check_quota() )
    return;

    $i = 0;
    $tmp_prefix = ”;
    $destination_file_name = $image->filename;
    while (file_exists($destination_path . ‘/’ . $destination_file_name)) {
    $tmp_prefix = ‘copy_’ . ($i++) . ‘_’;
    $destination_file_name = $tmp_prefix . $image->filename;
    }

    $destination_file_path = $destination_path . ‘/’ . $destination_file_name;
    $destination_thumb_file_path = $destination_path . ‘/’ . $image->thumbFolder . $image->thumbPrefix . $destination_file_name;

    // Copy files
    if ( !@copy($image->imagePath, $destination_file_path) ) {
    $errors .= sprintf(__(‘Failed to copy image %1$s to %2$s’,’nggallery’),
    $image->filename, $destination_file_path) . ”;
    continue;
    }

    // Copy the thumbnail if possible
    !@copy($image->thumbPath, $destination_thumb_file_path);

    // Create new database entry for the image
    $new_pid = nggdb::insert_image( $destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude);

    if (!isset($new_pid)) {
    $errors .= sprintf(__(‘Failed to copy database row for picture %s’,’nggallery’), $image->pid) . ”;
    continue;
    }

    // Copy tags
    nggTags::copy_tags($image->pid, $new_pid);

    if ( $tmp_prefix != ” ) {
    $messages .= sprintf(__(‘Image %1$s (%2$s) copied as image %3$s (%4$s) » The file already existed in the destination gallery.’,’nggallery’),
    $image->pid, $image->filename, $new_pid, $destination_file_name) . ”;
    } else {
    $messages .= sprintf(__(‘Image %1$s (%2$s) copied as image %3$s (%4$s)’,’nggallery’),
    $image->pid, $image->filename, $new_pid, $destination_file_name) . ”;
    }

    /* by M.C. – Added Lines – Copy Custom Fields Too! */
    /* NextGEN Custom Fields Patch */
    if ( function_exists ( ‘nggcf_save_pics’ ) )
    {
    global $wpdb;

    if ( $mcRecords = $wpdb -> get_results ( “SELECT * FROM ” . $wpdb -> prefix . “nggcf_field_values WHERE ngg_type=1 AND pid = ” . $image -> pid ) )
    {
    foreach ( $mcRecords as $mcRecord )
    $wpdb -> query ( “INSERT INTO ” . $wpdb->prefix . “nggcf_field_values ( id,pid,fid,field_value,dateadded,ngg_type ) VALUES ( null,’$new_pid’,'” . $mcRecord -> fid . “‘,'” . $wpdb-> escape ( $mcRecord -> field_value ) . “‘, ‘” . date ( “Y-m-d H:i:s”,time () ) . “‘, ‘” . $mcRecord -> ngg_type . “‘)” );
    }
    }
    /* NextGEN Custom Fields Patch */
    /* by M.C. – Added Lines – Copy Custom Fields Too! */

    }

    // Finish by showing errors or success
    if ( $errors == ” ) {
    $link = ‘gid . ‘” >’ . $destination->title . ‘‘;
    $messages .= ‘<hr />’ . sprintf(__(‘Copied %1$s picture(s) to gallery: %2$s .’,’nggallery’), count($images), $link);
    }

    if ( $messages != ” )
    nggGallery::show_message($messages);

    if ( $errors != ” )
    nggGallery::show_error($errors);

    return;
    }

    file: admin/manage.php – function processor

    function processor() {

    global $wpdb, $ngg, $nggdb;

    // Delete a gallery
    if ($this->mode == ‘delete’) {

    check_admin_referer(‘ngg_editgallery’);

    // get the path to the gallery
    $gallerypath = $wpdb->get_var(“SELECT path FROM $wpdb->nggallery WHERE gid = ‘$this->gid’ “);
    if ($gallerypath){

    // delete pictures
    //TODO:Remove also Tag reference, look here for ids instead filename
    $imagelist = $wpdb->get_col(“SELECT filename FROM $wpdb->nggpictures WHERE galleryid = ‘$this->gid’ “);
    if ($ngg->options[‘deleteImg’]) {
    if (is_array($imagelist)) {
    foreach ($imagelist as $filename) {
    @unlink(WINABSPATH . $gallerypath . ‘/thumbs/thumbs_’ . $filename);
    @unlink(WINABSPATH . $gallerypath .’/’. $filename);
    }
    }
    // delete folder
    @rmdir( WINABSPATH . $gallerypath . ‘/thumbs’ );
    @rmdir( WINABSPATH . $gallerypath );
    }
    }

    /* by M.C. – Added Lines – Delete Custom Fields Too! */
    /* NextGEN Custom Fields Patch */
    if ( function_exists ( ‘nggcf_save_pics’ ) )
    {
    if ( $mcRecords = $wpdb -> get_results ( “SELECT * FROM ” . $wpdb -> nggpictures. ” WHERE galleryid = ” . $this -> gid ) )
    {
    foreach ( $mcRecords as $mcRecord )
    $wpdb -> query ( “DELETE FROM ” . $wpdb -> prefix . “nggcf_field_values WHERE ngg_type=1 AND pid = ” . $mcRecord -> pid );
    }
    $wpdb -> query ( “DELETE FROM ” . $wpdb -> prefix . “nggcf_field_values WHERE ngg_type=2 AND pid = ” . $this -> gid );
    }
    /* NextGEN Custom Fields Patch */
    /* by M.C. – Added Lines – Delete Custom Fields Too! */

    $delete_pic = $wpdb->query(“DELETE FROM $wpdb->nggpictures WHERE galleryid = $this->gid”);
    $delete_galllery = $wpdb->query(“DELETE FROM $wpdb->nggallery WHERE gid = $this->gid”);

    if($delete_galllery)
    nggGallery::show_message( _n( ‘Gallery’, ‘Galleries’, 1, ‘nggallery’ ) . ‘ \”.$this->gid.’\’ ‘.__(‘deleted successfully’,’nggallery’));

    $this->mode = ‘main’; // show mainpage
    }

    // Delete a picture
    if ($this->mode == ‘delpic’) {
    //TODO:Remove also Tag reference
    check_admin_referer(‘ngg_delpicture’);
    $image = $nggdb->find_image( $this->pid );
    if ($image) {
    if ($ngg->options[‘deleteImg’]) {
    @unlink($image->imagePath);
    @unlink($image->thumbPath);
    }
    $delete_pic = $wpdb->query(“DELETE FROM $wpdb->nggpictures WHERE pid = $image->pid”);

    /* by M.C. – Added Lines – Delete Custom Fields Too! */
    /* NextGEN Custom Fields Patch */
    if ( $delete_pic )
    {
    if ( function_exists ( ‘nggcf_save_pics’ ) )
    $wpdb -> query ( “DELETE FROM ” . $wpdb -> prefix . “nggcf_field_values WHERE ngg_type=1 AND pid = ” . $image -> pid );
    }
    /* NextGEN Custom Fields Patch */
    /* by M.C. – Added Lines – Delete Custom Fields Too! */

    }
    if($delete_pic)
    nggGallery::show_message( __(‘Picture’,’nggallery’).’ \”.$this->pid.’\’ ‘.__(‘deleted successfully’,’nggallery’) );

    $this->mode = ‘edit’; // show pictures
    }

    // will be called after a ajax operation
    if (isset ($_POST[‘ajax_callback’])) {
    if ($_POST[‘ajax_callback’] == 1)
    nggGallery::show_message(__(‘Operation successful. Please clear your browser cache.’,”nggallery”));
    }

    // show sort order
    if ( isset ($_POST[‘sortGallery’]) )
    $this->mode = ‘sort’;

    if ( isset ($_GET[‘s’]) )
    $this->search_images();

    }

    mcseller

    (@mcseller)

    Hi,

    you have to choose from an image of your gallery. If you don’t want use one of them you can add a new image to the gallery, then click on exclude field of the image and finally choose it from the dropdown list!

    So you have your preview image that will not displayed as a picture of the gallery.

    ??

    P.S.
    Hope you’ll understand my fine English.

Viewing 9 replies - 1 through 9 (of 9 total)