Code Duplication    Length = 28-28 lines in 2 locations

sources/subs/Topic.subs.php 1 location

@@ 1098-1125 (lines=28) @@
1095
 * @param int $id_topic
1096
 * @param bool $on
1097
 */
1098
function setTopicNotification($id_member, $id_topic, $on = false)
1099
{
1100
	$db = database();
1101
1102
	if ($on)
1103
	{
1104
		// Attempt to turn notifications on.
1105
		$db->insert('ignore',
1106
			'{db_prefix}log_notify',
1107
			array('id_member' => 'int', 'id_topic' => 'int'),
1108
			array($id_member, $id_topic),
1109
			array('id_member', 'id_topic')
1110
		);
1111
	}
1112
	else
1113
	{
1114
		// Just turn notifications off.
1115
		$db->query('', '
1116
			DELETE FROM {db_prefix}log_notify
1117
			WHERE id_member = {int:current_member}
1118
				AND id_topic = {int:current_topic}',
1119
			array(
1120
				'current_member' => $id_member,
1121
				'current_topic' => $id_topic,
1122
			)
1123
		);
1124
	}
1125
}
1126
1127
/**
1128
 * Get the previous topic from where we are.

sources/subs/Boards.subs.php 1 location

@@ 1226-1253 (lines=28) @@
1223
 * @param int $id_board
1224
 * @param bool $on = false
1225
 */
1226
function setBoardNotification($id_member, $id_board, $on = false)
1227
{
1228
	$db = database();
1229
1230
	if ($on)
1231
	{
1232
		// Turn notification on.  (note this just blows smoke if it's already on.)
1233
		$db->insert('ignore',
1234
			'{db_prefix}log_notify',
1235
			array('id_member' => 'int', 'id_board' => 'int'),
1236
			array($id_member, $id_board),
1237
			array('id_member', 'id_board')
1238
		);
1239
	}
1240
	else
1241
	{
1242
		// Turn notification off for this board.
1243
		$db->query('', '
1244
			DELETE FROM {db_prefix}log_notify
1245
			WHERE id_member = {int:current_member}
1246
				AND id_board = {int:current_board}',
1247
			array(
1248
				'current_board' => $id_board,
1249
				'current_member' => $id_member,
1250
			)
1251
		);
1252
	}
1253
}
1254
1255
/**
1256
 * Reset sent status for board notifications.