Ignore:
Timestamp:
Aug 14, 2014 8:29:47 AM (10 years ago)
Author:
anonymous
Message:

Small bugs fixed while doing SBImedia

File:
1 edited

Legend:

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

    r484 r485  
    8282            // Enforce valid upload_path parameter.
    8383            if (isset($params['upload_path'])) {
    84                 $params['upload_path'] = realpath($params['upload_path']);
     84                $upload_path = realpath($params['upload_path']);
    8585                // Source must be directory.
    86                 if (!is_dir($params['upload_path'])) {
    87                     $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $params['upload_path']), LOG_NOTICE, __FILE__, __LINE__);
     86                if (!is_dir($upload_path)) {
     87                    $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $upload_path), LOG_NOTICE, __FILE__, __LINE__);
    8888                    if (version_compare(PHP_VERSION, '5.0.0', '>=')) {
    8989                        // Recursive.
    90                         mkdir($params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true);
     90                        mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true);
    9191                    } else {
    92                         mkdir($params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'));
     92                        mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'));
    9393                    }
    94                     if (!is_dir($params['upload_path'])) {
     94                    if (!is_dir($upload_path)) {
    9595                        $app->logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    9696                        trigger_error(sprintf('Upload directory invalid: %s', $params['upload_path']), E_USER_ERROR);
     
    9898                }
    9999                // Source must be writable.
    100                 if (!is_writable($params['upload_path'])) {
     100                if (!is_writable($upload_path)) {
    101101                    $app->logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    102102                    trigger_error(sprintf('Upload directory not writable: %s', $params['upload_path']), E_USER_ERROR);
     
    197197                    if (is_array($custom_file_name) && sizeof($custom_file_name) == 1) {
    198198                        // Is an array, but just one value. Pull it out.
    199                         $custom_file_name = current($custom_file_name);
     199                        $file_name = current($custom_file_name);
    200200                        $this->_raiseMsg(sprintf(_("The file %s has been renamed to %s."), $files['name'][$i], $file_name), MSG_NOTICE, __FILE__, __LINE__);
    201201                        $app->logMsg(sprintf('Using custom file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     
    520520        $app =& App::getInstance();
    521521
    522         if ($this->getParam('display_messages') === true || (is_int($this->getParam('display_messages')) && $this->getParam('display_messages') & $type > 0)) {
     522        if ($this->getParam('display_messages') === true || (is_int($this->getParam('display_messages')) && ($this->getParam('display_messages') & $type) > 0)) {
    523523            $app->raiseMsg($message, $type, $file, $line);
    524524        }
Note: See TracChangeset for help on using the changeset viewer.