Ignore:
Timestamp:
Aug 30, 2012, 9:20:00 PM (12 years ago)
Author:
rvelices
Message:

bug 2725: Piwigo isn't compatible with suPHP + better handling of watermark upload errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/configuration_watermark_process.inc.php

    r17302 r17675  
    4444  {
    4545    $upload_dir = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'watermarks';
     46    if (mkgetdir($upload_dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR))
     47    {
     48      $new_name = get_filename_wo_extension($_FILES['watermarkImage']['name']).'.png';
     49      $file_path = $upload_dir.'/'.$new_name;
    4650
    47     include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
    48     prepare_directory($upload_dir);
    49 
    50     $new_name = get_filename_wo_extension($_FILES['watermarkImage']['name']).'.png';
    51     $file_path = $upload_dir.'/'.$new_name;
    52 
    53     move_uploaded_file($_FILES['watermarkImage']['tmp_name'], $file_path);
    54 
    55     $pwatermark['file'] = substr($file_path, strlen(PHPWG_ROOT_PATH));
     51      if (move_uploaded_file($_FILES['watermarkImage']['tmp_name'], $file_path))
     52      {
     53        $pwatermark['file'] = substr($file_path, strlen(PHPWG_ROOT_PATH));
     54      }
     55      else
     56      {
     57        $page['errors'][] = $errors['watermarkImage'] = "$file_path " .l10n('no write access');
     58      }
     59    }
     60    else
     61    {
     62      $page['errors'][] = $errors['watermarkImage'] = sprintf( l10n('Add write access to the "%s" directory'), $upload_dir);
     63    }
    5664  }
    5765}
Note: See TracChangeset for help on using the changeset viewer.