Code Duplication    Length = 18-18 lines in 2 locations

mail/inc/class.mail_ui.inc.php 2 locations

@@ 510-527 (lines=18) @@
507
				//error_log(__METHOD__.__LINE__. " time used: ".$zendtime);
508
				$content[self::$nm_index]['selectedFolder'] = $this->mail_bo->profileID.self::$delimiter.(!empty($this->mail_bo->sessionData['mailbox'])?$this->mail_bo->sessionData['mailbox']:'INBOX');
509
				// since we are connected,(and selected the folder) we check for capabilities SUPPORTS_KEYWORDS to eventually add the keyword filters
510
				if ( $this->mail_bo->icServer->hasCapability('SUPPORTS_KEYWORDS'))
511
				{
512
					$this->statusTypes = array_merge($this->statusTypes,array(
513
						'keyword1'	=> 'important',//lang('important'),
514
						'keyword2'	=> 'job',	//lang('job'),
515
						'keyword3'	=> 'personal',//lang('personal'),
516
						'keyword4'	=> 'to do',	//lang('to do'),
517
						'keyword5'	=> 'later',	//lang('later'),
518
					));
519
				}
520
				else
521
				{
522
					$keywords = array('keyword1','keyword2','keyword3','keyword4','keyword5');
523
					foreach($keywords as &$k)
524
					{
525
						if (array_key_exists($k,$this->statusTypes)) unset($this->statusTypes[$k]);
526
					}
527
				}
528
529
				if (!isset($content[self::$nm_index]['foldertree'])) $content[self::$nm_index]['foldertree'] = $this->mail_bo->profileID.self::$delimiter.'INBOX';
530
				if (!isset($content[self::$nm_index]['selectedFolder'])) $content[self::$nm_index]['selectedFolder'] = $this->mail_bo->profileID.self::$delimiter.'INBOX';
@@ 4263-4280 (lines=18) @@
4260
			unset($this->searchTypes['quick']);
4261
			unset($this->searchTypes['quickwithcc']);
4262
		}
4263
		if ( $this->mail_bo->icServer->hasCapability('SUPPORTS_KEYWORDS'))
4264
		{
4265
			$this->statusTypes = array_merge($this->statusTypes,array(
4266
				'keyword1'	=> 'important',//lang('important'),
4267
				'keyword2'	=> 'job',	//lang('job'),
4268
				'keyword3'	=> 'personal',//lang('personal'),
4269
				'keyword4'	=> 'to do',	//lang('to do'),
4270
				'keyword5'	=> 'later',	//lang('later'),
4271
			));
4272
		}
4273
		else
4274
		{
4275
			$keywords = array('keyword1','keyword2','keyword3','keyword4','keyword5');
4276
			foreach($keywords as &$k)
4277
			{
4278
				if (array_key_exists($k,$this->statusTypes)) unset($this->statusTypes[$k]);
4279
			}
4280
		}
4281
4282
		$response = Api\Json\Response::get();
4283
		$response->call('app.mail.mail_refreshCatIdOptions',$this->searchTypes);