{% extends "PackagistWebBundle::layout.html.twig" %}

{% set showSearchDesc = 'hide' %}

{% block head_additions %}<meta name="robots" content="noindex, nofollow">{% endblock %}

{% block title %}{{ 'packages.security_advisory_title'|trans }} - {{ name }} - {{ parent() }}{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-xs-12 package">
            <div class="package-header">
                <h2 class="title">
                    <a href="{{ path("view_package", {name: name}) }}">{{ name }}</a>
                    {{ 'packages.security_advisories'|trans }}
                    {% if version is defined %}
                        for {{ version }}
                    {% endif %}
                    <small>({{ count }})</small>
                </h2>
            </div>
        </div>
    </div>

    <section class="row">
        <section class="col-md-12">
            {% if securityAdvisories|length %}
                <ul class="packages list-unstyled">
                    {% for advisory in securityAdvisories %}
                        <li class="row">
                            <div class="col-xs-12 package-item">
                                <div class="row">
                                    <div class="col-sm-8 col-lg-9">
                                        <h4 class="font-bold">
                                            <a href="{{ advisory.link }}">{{ advisory.title }}</a>
                                        </h4>
                                        {% if advisory.cve %}
                                            <p>
                                                <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name={{ advisory.cve }}">{{ advisory.cve }}</a>
                                            </p>
                                        {% endif %}
                                        <p>Affected version: {{ advisory.affectedVersions }}</p>
                                    </div>
                                    <div class="col-sm-4 col-lg-3">
                                        <p>Reported by:<br/>{{ advisory.source }}</p>
                                    </div>
                                </div>
                            </div>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <div class="alert alert-danger">
                    <p>{{ 'listing.no_security_advisories'|trans }}</p>
                </div>
            {% endif %}
        </section>
    </section>
{% endblock %}
