Code Duplication    Length = 16-17 lines in 2 locations

templates/main.tmpl.php 1 location

@@ 260-275 (lines=16) @@
257
	$user_groups = getGroups($userId);
258
	$arr = explode(';', $access);
259
260
	foreach ($arr as $item) {
261
		if (strpos($item, 'group_') === 0) {
262
			$grp = substr($item, 6);
263
			foreach ($user_groups as $user_group) {
264
				if ($user_group === $grp) {
265
					return true;
266
				}
267
			}
268
		}
269
		else if (strpos($item, 'user_') === 0) {
270
			$usr = substr($item, 5);
271
			if ($usr === $userId) {
272
				return true;
273
			}
274
		}
275
	}
276
	return false;
277
}
278
?>

lib/Controller/PageController.php 1 location

@@ 733-749 (lines=17) @@
730
		Util::writeLog('polls', $this->userId, Util::ERROR);
731
		$userGroups = $this->getGroups();
732
		$arr = explode(';', $access);
733
		foreach ($arr as $item) {
734
			if (strpos($item, 'group_') === 0) {
735
				$grp = substr($item, 6);
736
				foreach ($userGroups as $userGroup) {
737
					if ($userGroup === $grp) {
738
						return true;
739
					}
740
				}
741
			} else {
742
				if (strpos($item, 'user_') === 0) {
743
					$usr = substr($item, 5);
744
					if ($usr === $this->userId) {
745
						return true;
746
					}
747
				}
748
			}
749
		}
750
		return false;
751
	}
752
}