@@ -456,46 +456,9 @@ protected function prepare_avatar($avatar)
456456 $ avatar = $ matches [1 ][1 ] ?? $ matches [0 ][1 ];
457457 }
458458
459- if (strpos ($ avatar , 'download/file. ' . $ this ->php_ext ))
460- {
461- $ avatar = $ this ->get_uploaded_avatar ($ avatar );
462- }
463-
464459 return preg_replace ("#^ \\{$ this ->path_helper ->get_web_root_path ()}# " , $ this ->get_board_url (), $ avatar , 1 );
465460 }
466461
467- /**
468- * Get the actual path to uploaded avatars
469- *
470- * @param string $file
471- * @return string
472- */
473- protected function get_uploaded_avatar ($ file )
474- {
475- $ prefix = $ this ->config ['avatar_salt ' ] . '_ ' ;
476- $ image_dir = rtrim ($ this ->config ['avatar_path ' ], DIRECTORY_SEPARATOR );
477-
478- // Ensure image_dir is relative
479- $ image_dir = str_replace (['../ ' , '.. \\' , './ ' , '. \\' ], '' , $ image_dir );
480- if ($ image_dir && ($ image_dir [0 ] === '/ ' || $ image_dir [0 ] === '\\' ))
481- {
482- $ image_dir = '' ;
483- }
484-
485- // Extract file extension
486- $ ext = pathinfo ($ file , PATHINFO_EXTENSION );
487-
488- // Extract filename using regex
489- $ filename = '' ;
490- if (preg_match ('/avatar=(.+?)_/ ' , $ file , $ matches ))
491- {
492- $ filename = $ matches [1 ];
493- }
494-
495- // Construct final path
496- return $ filename ? $ this ->path_helper ->get_web_root_path () . $ image_dir . '/ ' . $ prefix . $ filename . '. ' . $ ext : '' ;
497- }
498-
499462 /**
500463 * Returns the board url (and caches it in the function)
501464 */
0 commit comments