/** * Process registered shutdown actions. */ function performShutdownActions() { if (isset($this->_shutdownActions)) { foreach ($this->_shutdownActions as $action) { $ret = @call_user_func_array($action[0], $action[1]); if ($this->getDebug() || class_exists('GalleryTestCase')) { /* Ignore errors unless debug is on */ if (is_array($ret) && MyOOS_Utilities::isA($ret[0], 'GalleryStatus')) { $ret = $ret[0]; } else { if (!MyOOS_Utilities::isA($ret, 'GalleryStatus')) { $ret = null; } } if (isset($ret) && $ret) { $this->debug('Error from shutdown action:'); $this->debug_r($action); $this->debug_r($ret); } } } } }
/** * Return true if the path exists and is in the given path list. Make sure to pass paths in the * system charset to this method. * @param string $path * @param string $list the list of legal paths * @return boolean */ function isPathInList($path, $list) { global $gallery; $platform =& $gallery->getPlatform(); $slash = $platform->getDirectorySeparator(); $path = $platform->realpath($path) . $slash; $compare = MyOOS_Utilities::isA($platform, 'WinNtPlatform') ? 'strncasecmp' : 'strncmp'; foreach ($list as $element) { if (($element = $platform->realpath($element)) === false) { continue; } /* * Make sure the compare directory has a trailing slash so that /tmp doesn't * accidentally match /tmpfoo */ if ($element[strlen($element) - 1] != $slash) { $element .= $slash; } if (!$compare($element, $path, strlen($element))) { return true; } } return false; }