From 4c567e8c895732aef20b09f39fe33b9ded77d29c Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Tue, 25 Dec 2007 22:20:48 +0100 Subject: [PATCH] [svn r14068] Fixed broken user production URL building Moved remove_user_production() inside the UserManager class (somehow it had been left out, which made removal impossible) --- main/inc/lib/usermanager.lib.php | 151 +++++++++++++++---------------- 1 file changed, 75 insertions(+), 76 deletions(-) diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 6993deef9b..9339200dba 100644 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -425,90 +425,89 @@ class UserManager ----------------------------------------------------------- */ -/** - * Returns an XHTML formatted list of productions for a user, or FALSE if he - * doesn't have any. - * - * If there has been a request to remove a production, the function will return - * without building the list unless forced to do so by the optional second - * parameter. This increases performance by avoiding to read through the - * productions on the filesystem before the removal request has been carried - * out because they'll have to be re-read afterwards anyway. - * - * @param $user_id User id - * @param $force Optional parameter to force building after a removal request - * @return A string containing the XHTML code to dipslay the production list, or FALSE - */ -function build_production_list($user_id, $force = false, $showdelete=false) -{ - if (!$force && $_POST['remove_production']) - return true; // postpone reading from the filesystem - - $productions = UserManager::get_user_productions($user_id); - - if (empty($productions)) - return false; - - $production_path = UserManager::get_user_picture_path_by_id($user_id,'web',true); - $production_dir = $production_path['dir']; - $del_image = api_get_path(WEB_CODE_PATH).'img/delete.gif'; - $del_text = get_lang('Delete'); - - $production_list = ''; - - return $production_list; -} - -/** - * Returns an array with the user's productions. - * - * @param $user_id User id - * @return An array containing the user's productions - */ -function get_user_productions($user_id) -{ - $production_path = UserManager::get_user_picture_path_by_id($user_id,'system',true); - $production_repository = $production_path['dir'].$user_id.'/'; - $productions = array(); - - if (is_dir($production_repository)) + + /** + * Returns an array with the user's productions. + * + * @param $user_id User id + * @return An array containing the user's productions + */ + function get_user_productions($user_id) { - $handle = opendir($production_repository); - - while ($file = readdir($handle)) + $production_path = UserManager::get_user_picture_path_by_id($user_id,'system',true); + $production_repository = $production_path['dir'].$user_id.'/'; + $productions = array(); + + if (is_dir($production_repository)) { - if ($file == '.' || $file == '..' || $file == '.htaccess') - continue; // skip current/parent directory and .htaccess - - $productions[] = $file; + $handle = opendir($production_repository); + + while ($file = readdir($handle)) + { + if ($file == '.' || $file == '..' || $file == '.htaccess') + continue; // skip current/parent directory and .htaccess + + $productions[] = $file; + } } + + return $productions; // can be an empty array } - - return $productions; // can be an empty array -} -} - -/** - * Remove a user production. - * - * @param $user_id User id - * @param $production The production to remove - */ -function remove_user_production($user_id, $production) -{ - $production_path = UserManager::get_user_picture_path_by_id($user_id,'system',true); - unlink($production_path['dir'].$user_id.'/'.$production); + /** + * Remove a user production. + * + * @param $user_id User id + * @param $production The production to remove + */ + function remove_user_production($user_id, $production) + { + $production_path = UserManager::get_user_picture_path_by_id($user_id,'system',true); + unlink($production_path['dir'].$user_id.'/'.$production); + } } ?> \ No newline at end of file