Code Duplication    Length = 18-19 lines in 2 locations

core/comment.php 1 location

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

core/link.php 1 location

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