Ejemplo n.º 1
0
function read_tree($dossier, $raz = 1)
{
    if (($dir = opendir($dossier)) === false) {
        return;
    }
    if ($dossier[strlen($dossier) - 1] == "/") {
        $dossier = substr($dossier, 0, strlen($dossier) - 1);
    }
    if ($raz == "1") {
        $_SESSION['arbo'] = array();
    }
    while ($name = readdir($dir)) {
        if ($name === '.' or $name === '..' or $name === 'Thumbs.db') {
            continue;
        }
        $full_name = $dossier . "/" . $name;
        if (is_dir($full_name)) {
            //	echo(strtoupper("<hr><b>$full_name</b><br>"));
            $_SESSION['arbo'][$full_name] = array();
            read_tree($full_name, 0);
        } else {
            //	if(!is_array($arbo[$dossier])) { $arbo[$dossier]=array();echo("eeeeeeeeeeeeeeeee"); echoa($arbo);}
            //		echo(" - $dossier > $name<br>");
            $_SESSION['arbo'][$dossier][] = $name;
        }
    }
    closedir($dir);
    ksort($_SESSION['arbo']);
    return $_SESSION['arbo'];
}
Ejemplo n.º 2
0
            continue;
        }
        $chemin_sous_dossier = $dossier;
        $perms_dossier = get_permissions($chemin_sous_dossier);
        if ($perms_dossier != $thisSite->DROITS_DOSSIER_ECRITURE) {
            $res = chmod($dossier, octdec($thisSite->DROITS_DOSSIER_ECRITURE));
            $infos .= "<div class='erreur'>Les droits du sous dossier " . strtoupper($chemin_sous_dossier) . " ont &eacute;t&eacute; modifi&eacute;s en " . $thisSite->DROITS_DOSSIER_ECRITURE . " ({$res})</div>" . $sep;
        }
        //echo("<hr>$dossier : $perms_dossier<br>");
    }
}
if ($_SERVER[HTTP_HOST] != $thisSite->LOCALHOST) {
    //Vérification des droits
    $perms_DOS_CLIENT_FILES = get_permissions($chemin_DOS_CLIENT_FILES);
    $erreur_perms = 0;
    $arbo = read_tree($chemin_DOS_CLIENT_FILES, 1);
    foreach ($arbo as $dossier => $fichiers) {
        $dossier = $dossier . "/";
        $chemin_sous_dossier = $dossier;
        $perms_dossier = get_permissions($chemin_sous_dossier);
        if ($perms_dossier != $thisSite->DROITS_DOSSIER_ECRITURE) {
            $infos .= "<div class='erreur'>ATTENTION: Les droits du dossier " . strtoupper($chemin_sous_dossier) . " sont à " . $perms_dossier . " alors qu'ils devraient être à " . $thisSite->DROITS_DOSSIER_ECRITURE . "</div>";
            $erreur_perms = 1;
        }
    }
    $chemin_sous_dossier = $racine_smarty . "smarty/templates_c/";
    $perms_dossier = get_permissions($chemin_sous_dossier);
    if ($perms_dossier != $thisSite->DROITS_DOSSIER_ECRITURE) {
        $infos .= "<div class='erreur'><br>ATTENTION: Les droits du dossier " . strtoupper($chemin_sous_dossier) . " sont à " . $perms_dossier . " alors qu'ils devraient être à " . $thisSite->DROITS_DOSSIER_ECRITURE . "</div>";
        $erreur_perms = 1;
    }
function get_user_tree(&$user_data)
{
    global $tree;
    if (empty($tree)) {
        read_tree();
    }
    // read the user auth if requiered
    if (empty($tree['auth'])) {
        $tree['auth'] = array();
        $wauth = auth(AUTH_ALL, AUTH_LIST_ALL, $user_data);
        if (!empty($wauth)) {
            reset($wauth);
            while (list($key, $data) = each($wauth)) {
                $tree['auth'][POST_FORUM_URL . $key] = $data;
            }
        }
        // enhanced each level
        set_tree_user_auth();
    }
    return;
}
Ejemplo n.º 4
0
function reorder_tree()
{
    global $tree, $db;
    // read the tree
    read_tree(true);
    // update with new order
    $order = 0;
    for ($i = 0; $i < count($tree['data']); $i++) {
        if (!empty($tree['id'][$i])) {
            $order += 10;
            if ($tree['type'][$i] == POST_FORUM_URL) {
                $sql = "UPDATE " . FORUMS_TABLE . "\n                            SET forum_order = {$order}\n                            WHERE forum_id = " . intval($tree['id'][$i]);
            } else {
                $sql = "UPDATE " . CATEGORIES_TABLE . "\n                            SET cat_order = {$order}\n                            WHERE cat_id = " . intval($tree['id'][$i]);
            }
            if (!$db->sql_query($sql)) {
                message_die(GENERAL_ERROR, 'Couldn\'t reorder forums/categories table', '', __LINE__, __FILE__, $sql);
            }
        }
    }
    // re-read the tree
    create_tree();
}
Ejemplo n.º 5
0
function reorder_tree()
{
    global $tree, $db;
    // Make sure forums cache is empty...
    empty_cache_folders(FORUMS_CACHE_FOLDER);
    empty_cache_folders(TOPICS_CACHE_FOLDER);
    // Read the tree
    read_tree(true);
    // Update with new order
    $order = 0;
    for ($i = 0; $i < sizeof($tree['data']); $i++) {
        if (!empty($tree['id'][$i])) {
            $order += 10;
            $sql = "UPDATE " . FORUMS_TABLE . "\n\t\t\t\t\t\tSET forum_order = " . $order . "\n\t\t\t\t\t\tWHERE forum_id = " . intval($tree['id'][$i]);
            $db->sql_query($sql);
        }
    }
    convert_forum_order();
    // Make sure forums cache is empty again...
    empty_cache_folders(FORUMS_CACHE_FOLDER);
    empty_cache_folders(TOPICS_CACHE_FOLDER);
    // Re-cache the tree
    cache_tree(true);
    board_stats();
}