diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/models/mfile.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/application/models/mfile.php b/application/models/mfile.php index 203e2e101..c2b423dbe 100644 --- a/application/models/mfile.php +++ b/application/models/mfile.php @@ -18,9 +18,17 @@ class Mfile extends CI_Model { // Returns an unused ID function new_id() { + static $id_blacklist = NULL; + $id = random_alphanum(3,6); - if ($this->id_exists($id) || $id == 'file' || $id == 'user') { + if ($id_blacklist == NULL) { + $id_blacklist = scandir(FCPATH); + $id_blacklist[] = "file"; + $id_blacklist[] = "user"; + } + + if ($this->id_exists($id) || in_array($id, $id_blacklist)) { return $this->new_id(); } else { return $id; |