Changeset 301


Ignore:
Timestamp:
Jan 24, 2008 4:30:46 AM (16 years ago)
Author:
quinn
Message:

Added minor functinoality to Upload. Fixed (?) XML serialier config in PEdit.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tags/2.0.2/lib/Upload.inc.php

    r298 r301  
    279279                    'extension' => $this->getFilenameExtension($file_name),
    280280                    'original_index' => $i,
     281                    'original_name' => $files['name'][$i],
    281282                );
    282283                continue;
     
    298299     * @access  public
    299300     * @param   string  $file_name  A name of a file.
     301     * @param   bool    $use_glob   Set true to use glob to find the filename (using $file_name as a pattern)
    300302     * @return  bool                Success of operation.
    301303     */
    302     function deleteFile($file_name)
     304    function deleteFile($file_name, $use_glob=false)
    303305    {
    304306        // Ensure we have a upload directory.
     
    308310        }
    309311
    310         $file_path_name = $this->getParam('upload_path') . '/' . $file_name;
     312        $file_path_name = $this->getParam('upload_path') . '/' . ($use_glob ? $this->getFilenameGlob($file_name) : $file_name);
    311313
    312314        if (!is_file($file_path_name)) {
  • trunk/lib/PEdit.inc.php

    r300 r301  
    8787            XML_SERIALIZER_OPTION_LINEBREAKS => '',
    8888            XML_SERIALIZER_OPTION_RETURN_RESULT => true,
    89             XML_SERIALIZER_OPTION_MODE => XML_SERIALIZER_MODE_SIMPLEXML,
    9089            XML_SERIALIZER_OPTION_TYPEHINTS => true,
    9190        ));
  • trunk/lib/Upload.inc.php

    r286 r301  
    303303                    'extension' => $file_extension,
    304304                    'original_index' => $i,
     305                    'original_name' => $files['name'][$i],
    305306                );
    306307            } else {
     
    325326     * @access  public
    326327     * @param   string  $file_name  A name of a file.
     328     * @param   bool    $use_glob   Set true to use glob to find the filename (using $file_name as a pattern)
    327329     * @return  bool                Success of operation.
    328330     */
    329     function deleteFile($file_name)
     331    function deleteFile($file_name, $use_glob=false)
    330332    {
    331333        $app =& App::getInstance();
     
    337339        }
    338340
    339         $file_path_name = $this->getParam('upload_path') . '/' . $file_name;
     341        $file_path_name = $this->getParam('upload_path') . '/' . ($use_glob ? $this->getFilenameGlob($file_name) : $file_name);
    340342
    341343        if (!is_file($file_path_name)) {
     
    344346        } else if (unlink($file_path_name)) {
    345347            $app->logMsg(sprintf('Deleted file: %s', $file_path_name), LOG_INFO, __FILE__, __LINE__);
     348            return true;
    346349        } else {
    347350            $this->_raiseMsg(sprintf(_("The file %s could not be deleted."), $file_name), MSG_ERR, __FILE__, __LINE__);
Note: See TracChangeset for help on using the changeset viewer.