summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klier <chi@chimeric.de>2008-02-27 23:16:31 +0100
committerMichael Klier <chi@chimeric.de>2008-02-27 23:16:31 +0100
commitde86255546da549b16fa2a5f17f592831b6a1931 (patch)
tree1eef6bf20a0ffe17b74e17f282be9c9bd62ecae6
parentde33a58fdd96b6045efeacde90848dc9fb57c1aa (diff)
downloadrpg-de86255546da549b16fa2a5f17f592831b6a1931.tar.gz
rpg-de86255546da549b16fa2a5f17f592831b6a1931.tar.bz2
introducing io_mktmpdir()
darcs-hash:20080227221631-23886-1ce689e9616b6dd5d2cc55613b86ddff4e1808be.gz
-rw-r--r--inc/io.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/inc/io.php b/inc/io.php
index 405786cc2..eb9366c25 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -439,6 +439,26 @@ function io_mkdir_ftp($dir){
}
/**
+ * Creates a unique temporary directory and returns
+ * its path.
+ *
+ * @author Michael Klier <chi@chimeric.de>
+ */
+function io_mktmpdir() {
+ global $conf;
+
+ $base = $conf['savedir'].'/tmp/';
+ $dir = md5(uniqid(rand(), true));
+ $tmpdir = $base.$dir;
+
+ if(io_mkdir_p($tmpdir)) {
+ return($tmpdir);
+ } else {
+ return false;
+ }
+}
+
+/**
* downloads a file from the net and saves it
*
* if $useAttachment is false,