/** * Check if the given item is restricted from being shown. * * @param string $where The current file path. * * @return boolean Is item allowed to be displayed? */ public static function isRestricted($where) { // First check if the current user has access to this repository. if (!self::checkPerms($GLOBALS['sourceroot'])) { return true; } if (!isset(self::$restricted)) { $restricted = array(); if (isset($GLOBALS['conf']['restrictions']) && is_array($GLOBALS['conf']['restrictions'])) { $restricted = $GLOBALS['conf']['restrictions']; } foreach ($GLOBALS['sourceroots'] as $key => $val) { if ($GLOBALS['sourceroot'] == $key && isset($val['restrictions']) && is_array($val['restrictions'])) { $restricted = array_merge($restricted, $val['restrictions']); break; } } self::$restricted = $restricted; } if (!empty($restricted)) { for ($i = 0; $i < count($restricted); ++$i) { if (preg_match('|' . str_replace('|', '\\|', $restricted[$i]) . '|', $where)) { return true; } } } return false; }