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->user->lang['INFORMATION'],
109
				'MESSAGE_TEXT'		=> $this->user->lang['DIR_COMMENT_DELETE_OK'],
110
				'COMMENT_ID'		=> $comment_id,
111
				'TOTAL_COMMENTS'	=> $this->user->lang('DIR_NB_COMMS', $nb_comments),
112
			));
113
		}
114
	}
115
}
116

core/link.php 1 location

@@ 244-261 (lines=18) @@
241
			), $link_id);
242
		}
243
244
		if ($this->request->is_ajax())
245
		{
246
			$sql = 'SELECT cat_links
247
				FROM ' . DIR_CAT_TABLE . '
248
				WHERE cat_id = ' . (int) $cat_id;
249
			$result = $this->db->sql_query($sql);
250
			$data = $this->db->sql_fetchrow($result);
251
252
			$json_response = new \phpbb\json_response;
253
			$json_response->send(array(
254
				'success' => true,
255
256
				'MESSAGE_TITLE'	=> $this->user->lang['INFORMATION'],
257
				'MESSAGE_TEXT'	=> $this->user->lang['DIR_DELETE_OK'],
258
				'LINK_ID'		=> $link_id,
259
				'TOTAL_LINKS'	=> $this->user->lang('DIR_NB_LINKS', (int) $data['cat_links']),
260
			));
261
		}
262
	}
263
264
	/**