Code Duplication    Length = 17-17 lines in 2 locations

Sources/Subs-Admin.php 2 locations

@@ 158-174 (lines=17) @@
155
156
	// Load all the files in the Sources directory, except this file and the redirect.
157
	$sources_dir = dir($sourcedir);
158
	while ($entry = $sources_dir->read())
159
	{
160
		if (substr($entry, -4) === '.php' && !is_dir($sourcedir . '/' . $entry) && $entry !== 'index.php')
161
		{
162
			// Read the first 4k from the file.... enough for the header.
163
			$fp = fopen($sourcedir . '/' . $entry, 'rb');
164
			$header = fread($fp, 4096);
165
			fclose($fp);
166
167
			// Look for the version comment in the file header.
168
			if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1)
169
				$version_info['file_versions'][$entry] = $match[1];
170
			// It wasn't found, but the file was... show a '??'.
171
			else
172
				$version_info['file_versions'][$entry] = '??';
173
		}
174
	}
175
	$sources_dir->close();
176
177
	// Load all the files in the tasks directory.
@@ 181-197 (lines=17) @@
178
	if (!empty($versionOptions['include_tasks']))
179
	{
180
		$tasks_dir = dir($tasksdir);
181
		while ($entry = $tasks_dir->read())
182
		{
183
			if (substr($entry, -4) === '.php' && !is_dir($tasksdir . '/' . $entry) && $entry !== 'index.php')
184
			{
185
				// Read the first 4k from the file.... enough for the header.
186
				$fp = fopen($tasksdir . '/' . $entry, 'rb');
187
				$header = fread($fp, 4096);
188
				fclose($fp);
189
190
				// Look for the version comment in the file header.
191
				if (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $header, $match) == 1)
192
					$version_info['tasks_versions'][$entry] = $match[1];
193
				// It wasn't found, but the file was... show a '??'.
194
				else
195
					$version_info['tasks_versions'][$entry] = '??';
196
			}
197
		}
198
		$tasks_dir->close();
199
	}
200