Code Duplication    Length = 18-19 lines in 2 locations

core/comment.php 1 location

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

core/link.php 1 location

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