Code Duplication    Length = 18-19 lines in 2 locations

core/comment.php 1 location

@@ 92-110 (lines=19) @@
89
90
		$this->db->sql_transaction('commit');
91
92
		if ($request->is_ajax())
93
		{
94
			$sql = 'SELECT COUNT(comment_id) AS nb_comments
95
				FROM ' . $this->comments_table . '
96
				WHERE comment_link_id = ' . (int) $link_id;
97
			$result = $this->db->sql_query($sql);
98
			$nb_comments = (int) $this->db->sql_fetchfield('nb_comments');
99
			$this->db->sql_freeresult($result);
100
101
			$json_response = new \phpbb\json_response;
102
			$json_response->send(array(
103
				'success' => true,
104
105
				'MESSAGE_TITLE'		=> $this->language->lang('INFORMATION'),
106
				'MESSAGE_TEXT'		=> $this->language->lang('DIR_COMMENT_DELETE_OK'),
107
				'COMMENT_ID'		=> $comment_id,
108
				'TOTAL_COMMENTS'	=> $this->language->lang('DIR_NB_COMMS', $nb_comments),
109
			));
110
		}
111
	}
112
}
113

core/link.php 1 location

@@ 259-276 (lines=18) @@
256
			), $link_id);
257
		}
258
259
		if ($this->request->is_ajax())
260
		{
261
			$sql = 'SELECT cat_links
262
				FROM ' . $this->categories_table . '
263
				WHERE cat_id = ' . (int) $cat_id;
264
			$result = $this->db->sql_query($sql);
265
			$data = $this->db->sql_fetchrow($result);
266
267
			$json_response = new \phpbb\json_response;
268
			$json_response->send(array(
269
				'success' => true,
270
271
				'MESSAGE_TITLE'	=> $this->language->lang('INFORMATION'),
272
				'MESSAGE_TEXT'	=> $this->language->lang('DIR_DELETE_OK'),
273
				'LINK_ID'		=> $link_id,
274
				'TOTAL_LINKS'	=> $this->language->lang('DIR_NB_LINKS', (int) $data['cat_links']),
275
			));
276
		}
277
	}
278
279
	/**