| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Member Avatar & Status [MAS]. An extension for the phpBB Forum Software package. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @copyright (c) 2018-2020, Dark❶ [dark1] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license GNU General Public License, version 2 (GPL-2.0-only) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | namespace dark1\memberavatarstatus\controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * @ignore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use phpbb\language\language; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use phpbb\log\log; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use phpbb\request\request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use phpbb\template\template; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use phpbb\user; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use phpbb\config\config; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use dark1\memberavatarstatus\core\avatar; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * Member Avatar & Status [MAS] ACP controller Friendlist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | class acp_friendlist extends acp_base | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 	/** @var \phpbb\config\config */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	protected $config; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	/** @var \dark1\memberavatarstatus\core\avatar*/ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	protected $avatar; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	 * Constructor. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	 * @param \phpbb\language\language					$language	Language object | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	 * @param \phpbb\log\log							$log		Log object | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	 * @param \phpbb\request\request					$request	Request object | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	 * @param \phpbb\template\template					$template	Template object | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	 * @param \phpbb\user								$user		User object | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	 * @param \phpbb\config\config						$config		Config object | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	 * @param \dark1\memberavatarstatus\core\avatar		$avatar		dark1 avatar | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 	public function __construct(language $language, log $log, request $request, template $template, user $user, config $config, avatar $avatar) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		parent::__construct($language, $log, $request, $template, $user); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 		$this->config	= $config; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		$this->avatar	= $avatar; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	 * Display the options a user can configure for Friendlist Mode. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	 * @access public | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 59 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  | 	public function handle() | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  | 		// Is the form being submitted to us? | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  | 		if ($this->request->is_set_post('submit')) | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  | 			$this->check_form_on_submit(); | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  | 			// Set the options the user configured | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  | 			$this->config->set('dark1_mas_fl_av', $this->request->variable('dark1_mas_fl_av', 0)); | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  | 			$this->config->set('dark1_mas_fl_ol', $this->request->variable('dark1_mas_fl_ol', 0)); | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  | 			$this->config->set('dark1_mas_fl_av_sz', $this->avatar->mas_get_avatar_size($this->request->variable('dark1_mas_fl_av_sz', avatar::AV_DEF_SZ_SML), avatar::AV_DEF_SZ_SML, avatar::AV_MAX_SZ_SML)); | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  | 			$this->success_form_on_submit(); | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  | 		// Set output variables for display in the template | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  | 		$this->template->assign_vars([ | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  | 			'MAS_COLOR_OFFLINE'	=> $this->config['dark1_mas_col_off'], | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  | 			'MAS_COLOR_ONLINE'	=> $this->config['dark1_mas_col_on'], | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  | 			'MAS_FL_AVATAR'		=> $this->config['dark1_mas_fl_av'], | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  | 			'MAS_FL_AV_SIZE'	=> $this->config['dark1_mas_fl_av_sz'], | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  | 			'MAS_FL_ONLINE'		=> $this->config['dark1_mas_fl_ol'], | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  | 			'MAS_NO_AVATAR_IMG'	=> $this->avatar->mas_get_no_avatar_img(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 		]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 85 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 86 |  |  |  |