Ignore:
Timestamp:
May 24, 2015 3:01:42 PM (9 years ago)
Author:
anonymous
Message:

First set of changes towards 2.2.0. Improved functinoality with integration in wordpress; bugs fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Upload.inc.php

    r519 r523  
    8080
    8181        if (isset($params) && is_array($params)) {
    82 
    8382            // Enforce valid upload_path parameter.
    8483            if (isset($params['upload_path'])) {
    85                 $upload_path = realpath($params['upload_path']);
    8684                // Source must be directory.
    87                 if (!is_dir($upload_path)) {
    88                     $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $upload_path), LOG_NOTICE, __FILE__, __LINE__);
    89                     if (version_compare(PHP_VERSION, '5.0.0', '>=')) {
    90                         // Recursive.
    91                         mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true);
     85                if (!is_dir($params['upload_path'])) {
     86                    $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $params['upload_path']), LOG_NOTICE, __FILE__, __LINE__);
     87                    mkdir($params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true);
     88                    if (is_dir($params['upload_path'])) {
     89                        $app->logMsg(sprintf('Created upload directory: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    9290                    } else {
    93                         mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'));
    94                     }
    95                     if (!is_dir($upload_path)) {
    96                         $app->logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    97                         trigger_error(sprintf('Upload directory invalid: %s', $params['upload_path']), E_USER_ERROR);
     91                        $app->logMsg(sprintf('Upload directory not found: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
     92                        trigger_error(sprintf('Upload directory not found: %s', $params['upload_path']), E_USER_ERROR);
    9893                    }
    9994                }
    10095                // Source must be writable.
    101                 if (!is_writable($upload_path)) {
     96                if (!is_writable($params['upload_path'])) {
    10297                    $app->logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    10398                    trigger_error(sprintf('Upload directory not writable: %s', $params['upload_path']), E_USER_ERROR);
     
    189184            if ('' == trim($files['name'][$i])) {
    190185                // User may not have attached a file.
     186                $app->logMsg(sprintf('Skipping file %s with empty name', $i), LOG_DEBUG, __FILE__, __LINE__);
    191187                continue;
    192188            }
Note: See TracChangeset for help on using the changeset viewer.