Code Duplication    Length = 12-12 lines in 2 locations

modules/abstract_module.php 1 location

@@ 67-78 (lines=12) @@
64
	 *
65
	 * @return bool
66
	 */
67
	protected function check_table_for_user($table, $user_id)
68
	{
69
		$sql = 'SELECT COUNT(registration_id) as reg_id 
70
					FROM ' . $table . ' 
71
					WHERE 
72
						user_id = ' . (int) $user_id;
73
		$result = $this->db->sql_query($sql);
74
		$row = $this->db->sql_fetchrow($result);
75
		$this->db->sql_freeresult($result);
76
77
		return $row && $row['reg_id'] > 0;
78
	}
79
}

modules/otp.php 1 location

@@ 122-133 (lines=12) @@
119
	 *
120
	 * @return bool
121
	 */
122
	public function is_usable($user_id)
123
	{
124
		$sql = 'SELECT COUNT(registration_id) as reg_id 
125
					FROM ' . $this->otp_registration_table . ' 
126
					WHERE 
127
						user_id = ' . (int) $user_id;
128
		$result = $this->db->sql_query($sql);
129
		$row = $this->db->sql_fetchrow($result);
130
		$this->db->sql_freeresult($result);
131
132
		return $row && $row['reg_id'] > 0;
133
	}
134
135
	/**
136
	 * Check if the user can potentially use this.