OSDN Git Service

BugTrack2/122: tempnam() fails when open_basedir is specified in php.ini
authorteanan <teanan>
Thu, 12 Jan 2006 01:01:35 +0000 (10:01 +0900)
committerteanan <teanan>
Thu, 12 Jan 2006 01:01:35 +0000 (10:01 +0900)
lib/file.php
plugin/dump.inc.php

index 1b54abf..557cc08 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: file.php,v 1.45 2006/01/09 10:32:35 henoheno Exp $
+// $Id: file.php,v 1.46 2006/01/12 01:00:51 teanan Exp $
 // Copyright (C)
 //   2002-2005 PukiWiki Developers Team
 //   2001-2002 Originally written by yu-ji
@@ -422,7 +422,7 @@ function get_readings()
                                if(! file_exists($pagereading_chasen_path))
                                        die_message('ChaSen not found: ' . $pagereading_chasen_path);
 
-                               $tmpfname = tempnam(CACHE_DIR, 'PageReading');
+                               $tmpfname = tempnam(realpath(CACHE_DIR), 'PageReading');
                                $fp = fopen($tmpfname, 'w') or
                                        die_message('Cannot write temporary file "' . $tmpfname . '".' . "\n");
                                foreach ($readings as $page => $reading) {
@@ -458,7 +458,7 @@ function get_readings()
                                if(! file_exists($pagereading_kakasi_path))
                                        die_message('KAKASI not found: ' . $pagereading_kakasi_path);
 
-                               $tmpfname = tempnam(CACHE_DIR, 'PageReading');
+                               $tmpfname = tempnam(realpath(CACHE_DIR), 'PageReading');
                                $fp       = fopen($tmpfname, 'w') or
                                        die_message('Cannot write temporary file "' . $tmpfname . '".' . "\n");
                                foreach ($readings as $page => $reading) {
index 4a9e719..c5c683a 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: dump.inc.php,v 1.36 2005/03/27 12:16:50 henoheno Exp $
+// $Id: dump.inc.php,v 1.37 2006/01/12 01:01:35 teanan Exp $
 //
 // Remote dump / restore plugin
 // Originated as tarfile.inc.php by teanan / Interfair Laboratory 2004.
@@ -152,7 +152,7 @@ function plugin_dump_upload()
                die_message('Max file size exceeded: ' . PLUGIN_DUMP_MAX_FILESIZE . 'KB');
 
        // Create a temporary tar file
-       $uploadfile = tempnam(CACHE_DIR, 'tarlib_uploaded_');
+       $uploadfile = tempnam(realpath(CACHE_DIR), 'tarlib_uploaded_');
        $tar = new tarlib();
        if(! move_uploaded_file($_FILES['upload_file']['tmp_name'], $uploadfile) ||
           ! $tar->open($uploadfile, $arc_kind)) {
@@ -341,7 +341,7 @@ class tarlib
        ////////////////////////////////////////////////////////////
        function create($tempdir, $kind = 'tgz')
        {
-               $tempnam = tempnam($tempdir, 'tarlib_create_');
+               $tempnam = tempnam(realpath($tempdir), 'tarlib_create_');
                if ($tempnam === FALSE) return FALSE;
 
                if ($kind == 'tgz') {