Esempio n. 1
0
 FbX::SetFeedbackLocation('lightbox.Manage.php', 'page_id=' . $page_id);
 try {
     // Only if current user has the rights
     if ($perm->is_level_okay('manageModLightbox', $_SESSION['ccms_userLevel'])) {
         if (empty($_POST['albumID'])) {
             throw new FbX($ccms['lang']['system']['error_selection']);
         } else {
             $total = count($_POST['albumID']);
             $i = 0;
             foreach ($_POST['albumID'] as $key => $value) {
                 $key = filterParam4Number($key);
                 $value = filterParam4Filename($value);
                 if (!empty($key) && !empty($value)) {
                     $dest = BASE_PATH . '/media/albums/' . $value;
                     if (is_dir($dest)) {
                         if (recrmdir($dest)) {
                             $i++;
                         }
                     }
                 }
             }
             if ($total == $i) {
                 header('Location: ' . makeAbsoluteURI('lightbox.Manage.php?page_id=' . $page_id . '&status=notice&msg=' . rawurlencode($ccms['lang']['backend']['fullremoved'])));
                 exit;
             } else {
                 throw new FbX($ccms['lang']['system']['error_delete']);
             }
         }
     } else {
         throw new FbX($ccms['lang']['auth']['featnotallowed']);
     }
Esempio n. 2
0
/**
 * Recursively delete a directory tree.
 */
function recrmdir($dir)
{
    $count = 0;
    if (is_dir($dir)) {
        $objects = scandir($dir);
        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (is_dir($dir . "/" . $object)) {
                    $count += recrmdir($dir . "/" . $object);
                } else {
                    @unlink($dir . "/" . $object);
                    $count++;
                }
            }
        }
        reset($objects);
        @rmdir($dir);
        $count++;
    }
    return $count;
}