예제 #1
0
파일: mainfile.php 프로젝트: npds/npds_dune
function fab_block($title, $member, $content, $Xcache)
{
    global $SuperCache, $CACHE_TIMINGS;
    // Multi-Langue
    $title = aff_langue($title);
    // Bloc caché
    $hidden = false;
    if (substr($content, 0, 7) == "hidden#") {
        $content = str_replace("hidden#", '', $content);
        $hidden = true;
    }
    // Si on cherche à charger un JS qui a déjà été chargé par pages.php alors on ne le charge pas ...
    global $pages_js;
    if ($pages_js != '') {
        preg_match('#src="([^"]*)#', $content, $jssrc);
        if (is_array($pages_js)) {
            foreach ($pages_js as $jsvalue) {
                if (array_key_exists('1', $jssrc)) {
                    if ($jsvalue == $jssrc[1]) {
                        $content = '';
                        break;
                    }
                }
            }
        } else {
            if (array_key_exists('1', $jssrc)) {
                if ($pages_js == $jssrc[1]) {
                    $content = "";
                }
            }
        }
    }
    $content = aff_langue($content);
    if ($SuperCache and $Xcache != 0) {
        $cache_clef = md5($content);
        $CACHE_TIMINGS[$cache_clef] = $Xcache;
        $cache_obj = new cacheManager();
        $cache_obj->startCachingBlock($cache_clef);
    } else {
        $cache_obj = new SuperCacheEmpty();
    }
    if ($cache_obj->genereting_output == 1 or $cache_obj->genereting_output == -1 or !$SuperCache or $Xcache == 0) {
        global $user, $admin;
        // For including CLASS AND URI in Block
        global $B_class_title, $B_class_content;
        $B_class_title = "";
        $B_class_content = "";
        $R_uri = "";
        if (stristr($content, "class-") or stristr($content, "uri")) {
            $tmp = explode("\n", $content);
            $content = "";
            while (list($id, $class) = each($tmp)) {
                $temp = explode("#", $class);
                if ($temp[0] == "class-title") {
                    $B_class_title = str_replace("\r", "", $temp[1]);
                } else {
                    if ($temp[0] == "class-content") {
                        $B_class_content = str_replace("\r", "", $temp[1]);
                    } else {
                        if ($temp[0] == "uri") {
                            $R_uri = str_replace("\r", "", $temp[1]);
                        } else {
                            if ($content != "") {
                                $content .= "\n ";
                            }
                            $content .= str_replace("\r", "", $class);
                        }
                    }
                }
            }
        }
        // For BLOC URIs
        if ($R_uri) {
            global $REQUEST_URI;
            $page_ref = basename($REQUEST_URI);
            $tab_uri = explode(" ", $R_uri);
            $R_content = false;
            $tab_pref = parse_url($page_ref);
            $racine_page = $tab_pref['path'];
            $tab_pref = explode("&", $tab_pref['query']);
            while (list(, $RR_uri) = each($tab_uri)) {
                $tab_puri = parse_url($RR_uri);
                $racine_uri = $tab_puri['path'];
                if ($racine_page == $racine_uri) {
                    $tab_puri = explode("&", $tab_puri['query']);
                    while (list($idx, $RRR_uri) = each($tab_puri)) {
                        if (substr($RRR_uri, -1) == "*") {
                            // si le token contient *
                            if (substr($RRR_uri, 0, strpos($RRR_uri, "=")) == substr($tab_pref[$idx], 0, strpos($tab_pref[$idx], "="))) {
                                $R_content = true;
                            }
                        } else {
                            // sinon
                            if ($RRR_uri != $tab_pref[$idx]) {
                                $R_content = false;
                            } else {
                                $R_content = true;
                            }
                        }
                    }
                }
            }
            if (!$R_content) {
                $content = '';
            }
        }
        // For Javascript in Block
        if (!stristr($content, "javascript")) {
            $content = nl2br($content);
        }
        // For including externale file in block / the return MUST BE in $content
        if (stristr($content, "include#")) {
            $Xcontent = false;
            // You can now, include AND cast a fonction with params in the same bloc !
            if (stristr($content, "function#")) {
                $content = str_replace("<br />", "", $content);
                $content = str_replace("<BR />", "", $content);
                $content = str_replace("<BR>", "", $content);
                $pos = strpos($content, "function#");
                $Xcontent = substr(trim($content), $pos);
                $content = substr(trim($content), 8, $pos - 10);
            } else {
                $content = substr(trim($content), 8);
            }
            include_once $content;
            if ($Xcontent) {
                $content = $Xcontent;
            }
        }
        if (!empty($content)) {
            if ($member == 1 and isset($user)) {
                if (!block_fonction($title, $content)) {
                    if (!$hidden) {
                        themesidebox($title, $content);
                    } else {
                        echo $content;
                    }
                }
            } elseif ($member == 0) {
                if (!block_fonction($title, $content)) {
                    if (!$hidden) {
                        themesidebox($title, $content);
                    } else {
                        echo $content;
                    }
                }
            } elseif ($member > 1 and isset($user)) {
                $tab_groupe = valid_group($user);
                if (groupe_autorisation($member, $tab_groupe)) {
                    if (!block_fonction($title, $content)) {
                        if (!$hidden) {
                            themesidebox($title, $content);
                        } else {
                            echo $content;
                        }
                    }
                }
            } elseif ($member == -1 and !isset($user)) {
                if (!block_fonction($title, $content)) {
                    if (!$hidden) {
                        themesidebox($title, $content);
                    } else {
                        echo $content;
                    }
                }
            } elseif ($member == -127 and isset($admin) and $admin) {
                if (!block_fonction($title, $content)) {
                    if (!$hidden) {
                        themesidebox($title, $content);
                    } else {
                        echo $content;
                    }
                }
            }
        }
        if ($SuperCache and $Xcache != 0) {
            $cache_obj->endCachingBlock($cache_clef);
        }
    }
}
예제 #2
0
파일: wspad.php 프로젝트: npds/npds_dune
}
if (strstr($ModPath, '..') || strstr($ModStart, '..') || stristr($ModPath, 'script') || stristr($ModPath, 'cookie') || stristr($ModPath, 'iframe') || stristr($ModPath, 'applet') || stristr($ModPath, 'object') || stristr($ModPath, 'meta') || stristr($ModStart, 'script') || stristr($ModStart, 'cookie') || stristr($ModStart, 'iframe') || stristr($ModStart, 'applet') || stristr($ModStart, 'object') || stristr($ModStart, 'meta')) {
    die;
}
global $title, $language, $NPDS_Prefix, $user, $admin;
// For More security
if (file_exists("modules/{$ModPath}/pages.php")) {
    include "modules/{$ModPath}/pages.php";
}
include_once "modules/{$ModPath}/lang/{$language}.php";
include_once "modules/{$ModPath}/config.php";
// limite l'utilisation aux membres et admin
settype($member, 'integer');
if ($user or $admin) {
    $tab_groupe = valid_group($user);
    if (groupe_autorisation($member, $tab_groupe)) {
        $groupe = $member;
        $auteur = $cookie[1];
    } else {
        if ($pad_membre) {
            $groupe = 1;
            $auteur = $cookie[1];
        } elseif ($admin) {
            $groupe = -127;
            $auteur = $aid;
        } else {
            header("location: index.php");
        }
    }
} else {
    header("location: index.php");