From 28767f949a8231d808fb68b764eb65f63b03f138 Mon Sep 17 00:00:00 2001 From: nickw Date: Thu, 29 Oct 2009 21:02:21 +0000 Subject: Fully deprecating file matrix use with username. Plugins building the file matrix with the username will still work, but a warning is logged. git-svn-id: http://code.elgg.org/elgg/trunk@3602 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/filestore.php | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index 92e8a760e..455d011d5 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -367,32 +367,13 @@ class ElggDiskFilestore extends ElggFilestore { * @return str */ protected function deprecated_file_matrix($filename) { - $invalid_fs_chars = '*\'\\/"!$%^&*.%(){}[]#~?<>;|¬`@-+='; - - $matrix = ""; - - $name = $filename; - $filename = $this->mb_str_split($filename); - if (!$filename) { - return false; - } - - $len = count($filename); - if ($len>$this->matrix_depth) { - $len = $this->matrix_depth; - } - - for ($n = 0; $n < $len; $n++) { - // Prevent a matrix being formed with unsafe characters - $char = $filename[$n]; - if (strpos($invalid_fs_chars, $char)!==false) { - $char = '_'; - } - - $matrix .= $char . "/"; - } - - return $matrix.$name."/"; + // throw a warning for using deprecated method + $error = 'Deprecated use of ElggDiskFilestore::make_file_matrix. '; + $error .= 'Username passed instead of guid.'; + elgg_log($error, WARNING); + + $user = new ElggUser($filename); + return $this->user_file_matrix($user->guid); } public function getParameters() { -- cgit v1.2.3