public static function removeDirectoryAllFiles($directory) { foreach (glob("{$directory}/*") as $file) { if (is_dir($file)) { File::removeDirectoryAllFiles($file); } else { unlink($file); } } rmdir($directory); }
$update = true; } } } else { if (isset($_GET["BraID"]) && isset($_GET["control"])) { $control->setValue($_GET["control"]); $Brand = Brand::getBrand($_GET["BraID"]); if ($Brand != null) { if ($control == Controls::Update) { echo "<script> \$(function () { \$(window).load(function(){ \$('#modalBra').modal( { backdrop: 'static', keyboard: false }, 'show');}); });</script>"; } else { if ($control == Controls::Delete) { $Brand->delete(); $path = '../assets/images/logoBrands/' . $Brand->getBraID(); if (file_exists($path)) { File::removeDirectoryAllFiles($path); } $delete = true; } } } else { require_once '../helper/Utils.php'; $url = "brands.php"; Utils::Redirect($url); } } } ?> <div class="page-header"> <div class="pull-right">