]> source.dussan.org Git - nextcloud-server.git/commitdiff
donĀ“t hardcode /tmp
authorFrank Karlitschek <frank@owncloud.org>
Wed, 30 May 2012 12:14:32 +0000 (14:14 +0200)
committerFrank Karlitschek <frank@owncloud.org>
Wed, 30 May 2012 12:14:32 +0000 (14:14 +0200)
apps/contacts/ajax/currentphoto.php
apps/contacts/ajax/oc_photo.php
apps/contacts/ajax/savecrop.php
apps/contacts/ajax/uploadimport.php
apps/contacts/ajax/uploadphoto.php
lib/helper.php
lib/migrate.php

index d8afa060b1eaab4326e585feab450abd352320b3..d0654b17d64487b5a1c9e1bf9ad5736771848d81 100644 (file)
@@ -40,7 +40,7 @@ if (!isset($_GET['id'])) {
        bailOut(OC_Contacts_App::$l10n->t('No contact ID was submitted.'));
 }
 
-$tmpfname = tempnam("/tmp", "occOrig");
+$tmpfname = tempnam(get_temp_dir(), "occOrig");
 $contact = OC_Contacts_App::getContactVCard($_GET['id']);
 $image = new OC_Image();
 if(!$image) {
index 085d2710f5fe2aa8d425d9e825657c9e5f24c032..184217f2b72f015ee72939f03afd2ecfce114403 100644 (file)
@@ -42,7 +42,7 @@ if(!isset($_GET['path'])) {
 }
 
 $localpath = OC_Filesystem::getLocalFile($_GET['path']);
-$tmpfname = tempnam("/tmp", "occOrig");
+$tmpfname = tempnam(get_temp_dir(), "occOrig");
 
 if(!file_exists($localpath)) {
        bailOut(OC_Contacts_App::$l10n->t('File doesn\'t exist:').$localpath);
index cd4703071255264ac64de650a25b255dc66c550a..fe9e5c5b99190ade5f0d59f84f8f2bfed96a7a50 100644 (file)
@@ -71,7 +71,7 @@ if(file_exists($tmp_path)) {
                OCP\Util::writeLog('contacts','savecrop.php, x: '.$x1.' y: '.$y1.' w: '.$w.' h: '.$h, OCP\Util::DEBUG);
                if($image->crop($x1, $y1, $w, $h)) {
                        if(($image->width() <= 200 && $image->height() <= 200) || $image->resize(200)) {
-                               $tmpfname = tempnam("/tmp", "occCropped"); // create a new file because of caching issues.
+                               $tmpfname = tempnam(get_temp_dir(), "occCropped"); // create a new file because of caching issues.
                                if($image->save($tmpfname)) {
                                        unlink($tmp_path);
                                        $card = OC_Contacts_App::getContactVCard($id);
index f4a13e0a4bb016ecbf0ea0af867a64aff118b013..b11f380fa8a885322bf0d766db2dd1842b72128f 100644 (file)
@@ -67,7 +67,7 @@ if($error !== UPLOAD_ERR_OK) {
 }
 $file=$_FILES['importfile'];
 
-$tmpfname = tempnam("/tmp", "occOrig");
+$tmpfname = tempnam(get_temp_dir(), "occOrig");
 if(file_exists($file['tmp_name'])) {
        if($view->file_put_contents('/'.$tmpfile, file_get_contents($file['tmp_name']))) {
                debug($fn.' uploaded');
index 99015e2d50241f46f5761008d5b4df4375805984..dca8ede6d601d4ee70ea0247930fcc9e83dd1231 100644 (file)
@@ -46,7 +46,7 @@ if ($fn) {
                exit();
        }
        $id = $_GET['id'];
-       $tmpfname = tempnam('/tmp', 'occOrig');
+       $tmpfname = tempnam(get_temp_dir(), 'occOrig');
        file_put_contents($tmpfname, file_get_contents('php://input'));
        debug($tmpfname.' uploaded');
        $image = new OC_Image();
@@ -93,7 +93,7 @@ if($error !== UPLOAD_ERR_OK) {
 }
 $file=$_FILES['imagefile'];
 
-$tmpfname = tempnam("/tmp", "occOrig");
+$tmpfname = tempnam(get_temp_dir(), "occOrig");
 if(file_exists($file['tmp_name'])) {
        $image = new OC_Image();
        if($image->loadFromFile($file['tmp_name'])) {
index e3d292737a445c56f9acebaf4245bbae065cad05..537465b15ac67c1826318101f8e7e9b9b14f8d9e 100644 (file)
@@ -514,7 +514,7 @@ class OC_Helper {
         * remove all files created by self::tmpFile
         */
        public static function cleanTmp(){
-               $leftoversFile='/tmp/oc-not-deleted';
+               $leftoversFile=get_temp_dir().'/oc-not-deleted';
                if(file_exists($leftoversFile)){
                        $leftovers=file($leftoversFile);
                        foreach($leftovers as $file) {
index 8fb949d66e1b9f044b03d94124d36af9834ddeaf..f9cab915d04bd055648eceefce72fcaff126ecc9 100644 (file)
@@ -146,7 +146,7 @@ class OC_Migrate{
                        case 'instance':
                                self::$content = new OC_Migration_Content( self::$zip );
                                // Creates a zip that is compatable with the import function
-                               $dbfile = tempnam( "/tmp", "owncloud_export_data_" );
+                               $dbfile = tempnam( get_temp_dir(), "owncloud_export_data_" );
                                OC_DB::getDbStructure( $dbfile, 'MDB2_SCHEMA_DUMP_ALL');
 
                                // Now add in *dbname* and *dbprefix*