function concat_get_path($uri)
{
    if (!strlen($uri)) {
        concat_http_status_exit(400);
    }
    if (false !== strpos($uri, '..') || false !== strpos($uri, "")) {
        concat_http_status_exit(400);
    }
    return CONCAT_FILES_ROOT . ('/' != $uri[0] ? '/' : '') . $uri;
}
예제 #2
0
/**
 * Get the path to a URI
 *
 * @since 0.1.0
 *
 * @param  string $uri
 * @return string
 */
function concat_get_uri_path($uri = '')
{
    // Bail if empty URI
    if (!strlen($uri)) {
        concat_http_status_exit(400);
    }
    // Bail if malformed or directory
    if (false !== strpos($uri, '..') || false !== strpos($uri, "")) {
        concat_http_status_exit(400);
    }
    // Is there a chunk in the middle?
    $chunk = '/' !== $uri[0] ? '/' : '';
    // Return path
    return CONCAT_FILES_ROOT . $chunk . $uri;
}