<?php
/**
 * VFM - veno file manager: /admin-panel/ajax/regen-thumbnails.php
 *
 * Clear /thumbnails/ folder
 *
 * PHP version >= 5.3
 *
 * @category  PHP
 * @package   VenoFileManager
 * @author    Nicola Franchini <support@veno.it>
 * @copyright 2013 Nicola Franchini
 * @license   https://veno.es/shop/help Veno Commercial License
 * @link      http://filemanager.veno.it/
 */
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest') {
    header('HTTP/1.0 403 Forbidden');
    die('Direct access not allowed');
}
require_once dirname(dirname(__DIR__)).'/class/class.setup.php';
require_once dirname(dirname(__DIR__)).'/class/class.utils.php';
require_once dirname(dirname(__DIR__)).'/class/class.gatekeeper.php';

$setUp = new SetUp();
$gateKeeper = new GateKeeper();

if (!$gateKeeper->isSuperAdmin()) {
    die('Permission Denied');
}

foreach (glob(dirname(dirname(__DIR__)).'/_content/thumbs/*.jpg', GLOB_NOSORT) as $deletable) {
    unlink($deletable);
}
echo 'success';
exit;
