/**
 * Sucht innerhalb des $REX['ADDON']['page'] Array rekursiv nach der page
 * $needle
 *
 * Gibt bei erfolgreicher Suche den Namen des Addons zurück, indem die page
 * gefuden wurde, sonst false
 */
function rex_search_addon_page($needle, $haystack = null)
{
    global $REX;
    if ($haystack === null) {
        $haystack = $REX['ADDON']['page'];
    }
    foreach ($haystack as $key => $value) {
        if (is_array($value)) {
            $found = rex_search_addon_page($needle, $value);
        } else {
            $found = $needle == $value;
        }
        if ($found !== false) {
            return $key;
        }
    }
    return false;
}
Esempio n. 2
0
     $LOGIN = FALSE;
     $page = 'login';
 } else {
     // login ok
     if ($REX_ULOGIN != "") {
         // redirect to startpage, after successfull login
         header('Location: index.php?page=' . $REX['START_PAGE']);
         exit;
     }
     $LOGIN = TRUE;
     $REX_USER = $REX_LOGIN->USER;
     $page = strtolower(rex_request('page', 'string', $REX['START_PAGE']));
     // --- addon page check
     if (isset($REX['ADDON']['page']) && is_array($REX['ADDON']['page'])) {
         include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_addons.inc.php';
         $as = rex_search_addon_page($page);
         if ($as !== false) {
             // --- addon gefunden
             $perm = $REX['ADDON']['perm'][$as];
             $hasPerm = $perm == '' || $REX_USER->hasPerm($perm) || $REX_USER->hasPerm('admin[]');
             // Suche zuerst nach einem Addon, dass so heisst wie die aktuelle page
             // z.b addons/structure/pages/index.inc.php
             $addon_page = $REX['INCLUDE_PATH'] . '/addons/' . $page . '/pages/index.inc.php';
             if (file_exists($addon_page) && $hasPerm && OOAddon::isAvailable($page)) {
                 $withheader = false;
                 $REX['PAGEPATH'] = $addon_page;
                 if (isset($REX['ADDON']['name'][$page])) {
                     $page_name = $REX['ADDON']['name'][$page];
                 }
             } else {
                 // Kein Addon gefunden, also suchen wir nach einem Addon,