コード例 #1
0
ファイル: general.php プロジェクト: eosc/EosC-2.3
function rdel($path, $deldir = true)
{
    // $path est le chemin relatif au fichier php
    // $deldir (paramètre optionel, par défaut à vrai) permet de dire si vous souhaitez supprimer le répertoire (vrai) ou le vider uniquement (faux)
    // on vérifie d'abord que le nom du repertoire contient "/" à la fin, sinon on le lui rajoute
    if ($path[strlen($path) - 1] != "/") {
        $path .= "/";
    }
    if (is_dir($path)) {
        $d = opendir($path);
        while ($f = readdir($d)) {
            if ($f != "." && $f != "..") {
                $rf = $path . $f;
                // chemin relatif au fichier php
                if (is_dir($rf)) {
                    // si c'est un répertoire on appel récursivement la fonction
                    rdel($rf);
                } else {
                    // sinon on efface le fichier
                    unlink($rf);
                }
            }
        }
        closedir($d);
        if ($deldir) {
            // si $deldir est vrai on efface le répertoire
            rmdir($path);
        }
    } else {
        unlink($path);
    }
}
コード例 #2
0
ファイル: xsell.php プロジェクト: digideskio/oscmax2
        // insert reciprocable x-sell products EOF
        if ($_POST['option']) {
            $products_options = $_POST['option'];
            $xsell_id = $_POST['product'];
            $xsell_id2 = array_unique($xsell_id);
            $xsell_id3 = array_values($xsell_id2);
            for ($i = 0; $i < sizeof($products_options); $i++) {
                tep_db_query('update ' . TABLE_PRODUCTS_XSELL . ' set sort_order = "' . $products_options[$i] . '" where xsell_id = "' . $xsell_id3[$i] . '"');
            }
            // end for
        }
        // end if ($_POST['option'])
        // Cache
        $cachedir = DIR_FS_CACHE_XSELL . $_GET['add_related_product_ID'];
        if (is_dir($cachedir)) {
            rdel($cachedir);
        }
        // end if
        // tep_redirect(tep_href_link(FILENAME_XSELL_PRODUCTS));
        $messageStack->add(SORT_CROSS_SELL_SUCCESS, 'success');
        break;
}
// end switch($_GET['action'])
?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>