<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}
if ($acces == 1) {
if($admintest && $adminsecu)  {


 if  (!is_god($admin))  {
    redirect_url("".$admin_file.".php");
    }
if ( $folder == "") {
redirect_url("".$admin_file.".php");
}
if ( ($folder != "Blocks") && ($folder != "Modules") && ($folder != "Configuration")) {
redirect_url("".$admin_file.".php");
}

    $CACHE_CONFIG['data_dir'] = "".$cache."/".$folder."/";
     $jpc = opendir($CACHE_CONFIG['data_dir']);
        while($filename = readdir($jpc)){
           if ($filename === '.' OR $filename === '..' OR $filename === '.htaccess' OR $filename === 'index.html') continue;
              unlink($CACHE_CONFIG['data_dir'].$filename);
        }

    $CACHE_CONFIG['data_dir'] = "".$cache."/".$folder."/admin/";
     $jpc = opendir($CACHE_CONFIG['data_dir']);
        while($filename = readdir($jpc)){
           if ($filename === '.' OR $filename === '..' OR $filename === '.htaccess' OR $filename === 'index.html') continue;
              unlink($CACHE_CONFIG['data_dir'].$filename);
        }

rmdir("".$cache."/".$folder."/admin");


if ( $folder == "Modules") {
	redirect_url("".$admin_file.".php?op=ConfirmEmptyCache&folder=Modules");
} elseif ( $folder == "Blocks") {
	redirect_url("".$admin_file.".php?op=ConfirmEmptyCache&folder=Blocks");
} else {
	redirect_url("".$admin_file.".php?op=cMax");
}

}

} else {
	echo "Access Denied";
}