<?php

$warnings = [];
$writablePaths = [
    temp_path(),
    themes_path(),
    base_path().'/storage',
    base_path().'/storage/app',
    base_path().'/storage/logs',
    base_path().'/storage/framework',
    base_path().'/storage/cms',
    base_path().'/storage/cms/cache',
    base_path().'/storage/cms/twig',
    base_path().'/storage/cms/combiner',
];
$requiredExtensions = [
    'GD' => extension_loaded('gd'),
    'fileinfo' => extension_loaded('fileinfo'),
    'Zip' => class_exists('ZipArchive'),
    'cURL' => function_exists('curl_init') && defined('CURLOPT_FOLLOWLOCATION'),
    'OpenSSL' => function_exists('openssl_random_pseudo_bytes'),
];

foreach ($writablePaths as $path) {
    if (!is_writable($path))
        $warnings[] = Lang::get('backend::lang.warnings.permissions', ['name' => '<strong>'.$path.'</strong>']);
}
foreach ($requiredExtensions as $extension => $installed) {
    if (!$installed)
        $warnings[] = Lang::get('backend::lang.warnings.extension', ['name' => '<strong>'.$extension.'</strong>']);
}

?>
<?php if (count($warnings)): ?>
    <div class="callout callout-warning">
        <div class="header">
            <i class="icon-warning"></i>
            <h3><?= e(trans('backend::lang.warnings.tips')) ?></h3>
            <p><?= e(trans('backend::lang.warnings.tips_description')) ?></p>
        </div>

        <div class="content">
            <ul>
                <?php foreach ($warnings as $warning): ?>
                    <li><?= $warning ?></li>
                <?php endforeach ?>
            </ul>
        </div>
    </div>
<?php endif ?>
