Exemple #1
0
function admin()
{
    $qb = ses('qb');
    $qda = ses('qda');
    $qdu = ses('qdu');
    $USE = ses('USE');
    $auth = ses('auth');
    $admin = $_GET['admin'] ? $_SESSION['admin'] = $_GET['admin'] : $_SESSION['admin'];
    if ($_GET['set']) {
        $_SESSION['set'] = $_GET['set'];
    }
    if ($USE != "") {
        $hubname = rse("hub", $qdu . ' WHERE name="' . $qb . '"');
        if (!$hubname) {
            $hubname = $qb;
        }
        list($autologok, $userhub) = sql('name,hub', 'qdu', 'r', 'ip="' . hostname() . '"');
    }
    $rep = "params";
    //verif_user
    if ($USE != $qb && $USE != "" && $userhub) {
        $hub = lka('/' . $USE, $USE);
    } elseif ($USE != $qb && $USE != "" && $autologok != $USE && $autologok) {
        $alert .= lkc('txtx', '/?log=on', 'autolog') . ' ';
    } elseif ($USE == $qb && !$userhub && prmb(11) >= 4) {
        $alert .= lkc("txtred", "/?log=create_hub", "create_hub!");
    } elseif ($USE == "") {
        $reta = lkc('txtx', htac('module') . 'Home', $qb) . br() . br() . loged($USE, $_SESSION['iq'], "", 7) . br();
    }
    //admin_menu
    $aff = adminauthes();
    if ($admin == "=") {
        $_SESSION['set'] = $_GET['set'] = $USE ? "Global" : "User";
    }
    //defaults
    if ($aff[$_GET['set']]) {
        $admin = key($aff[$_GET['set']]);
    }
    $_SESSION['admin'] = $admin;
    $goto = '/?admin=' . $admin;
    //if(!$userhub){unset($aff['User']['mail']); unset($aff['User']['password']);}
    //auto_select_category
    foreach ($aff as $k => $v) {
        if ($v[$admin]) {
            $_SESSION['set'] = $k;
            $curauth = $v[$admin];
        }
        $raf = array_merge_b($raf, array_keys($v));
    }
    if ($curauth === false) {
        $curauth = 7;
    }
    //login
    if ($USE) {
        $w .= lkc('popw', htac('module') . 'Home', pictxt('home', $hubname)) . ' ';
        $w .= btn("popbt", pictxt('user', $USE . ' ' . asciinb($auth)) . ' (' . nameofauthes($auth) . ')');
    }
    //fastmenu
    $fmn = array('console', 'params', 'restrictions', 'apps', 'css', 'finder', 'templates', 'connectors', 'plugin', 'msql', 'tools', 'pictos', 'stats', 'update');
    foreach ($raf as $v) {
        if (in_array($v, $fmn)) {
            $tit .= lkc(active($admin, $v), htac('admin') . $v, pictit(mimes_types($v), $v)) . ' ';
        }
    }
    $reta .= divc('right', $w . $alert);
    $tit .= lkc('txtit', htac('admin') . $admin, $admin) . ' ';
    if ($admin != "=") {
        $reta .= div('', $tit);
    }
    if ($auth >= 7 && $admin == 'update') {
        $ret = adm_update();
    }
    if ($auth >= $curauth && $curauth) {
        switch ($admin) {
            //global
            case 'console':
                $ret = adm_console($auth);
                break;
            case 'apps':
                require_once 'adminx.php';
                $ret = adm_apps($_GET['set'], '', $_GET['dig']);
                break;
            case 'messages':
                if ($qb == $USE or $auth >= $curauth) {
                    $ret = adm_messages();
                } else {
                    $ret = contact(nms(84), 'txtcadr');
                }
                break;
            case 'hubs':
                $ret = adm_hubs($auth);
                break;
            case 'nodes':
                $ret = adm_nodes($auth, $goto);
                break;
            case 'stats':
                list($p, $o) = explode('/', $_GET['set']);
                $ret = plugin('stats', $p, $o);
                break;
            case 'newsletter':
                $ret = adm_newsletter($_GET['send']);
                break;
            case 'disk':
                $ret = plugin('disk', '', '');
                break;
            case 'share':
                $ret = plugin('share', '', '');
                break;
            case 'tickets':
                $ret = plugin('tickets', '', '');
                break;
            case 'faq':
                $r = msql_read('system', 'program_faq', '');
                $ret = nl2br(stripslashes(make_divtable($r, 1)));
                break;
        }
        //articles
        if ($_SESSION['set'] == 'Articles') {
            switch ($admin) {
                case 'create':
                    $ret = f_inp('', '');
                    break;
                case 'categories':
                    $ret = catarts();
                    break;
                case 'trackbacks':
                    req('mod,art');
                    $ret = trkarts('');
                    break;
                default:
                    $ret = adminarts();
                    break;
            }
        }
        switch ($admin) {
            case 'chat':
                require_once 'art.php';
                $ret = output_trk(read_idy('microchat', 'DESC'));
                break;
            case 'shop':
                $ret = helps('shop_class');
                break;
            case 'book':
                $ret = lkc('txtblc', '/plug/book.php', 'book');
                break;
        }
        //configs
        switch ($admin) {
            case 'restrictions':
                $ret = adm_restrictions();
                break;
            case 'params':
                $ret = adm_params($curauth, rep);
                break;
            case 'avatar':
                if ($USE) {
                    $ret = adm_avatar(0);
                }
                break;
            case 'mail':
                if ($_POST['amail']) {
                    if ($USE == $qb) {
                        $_SESSION['qbin']['adminmail'] = $_POST['amail'];
                    }
                    update('qdu', 'mail', $_POST['amail'], 'name', $USE);
                }
                $ml = rse('mail', $qdu . ' WHERE name = "' . $USE . '"');
                if ($ml) {
                    $valu = input2('text', 'amail', $ml . '" size="35" maxlength="50') . ' ' . input2('submit', 'Submit', 'modif_mail', '');
                }
                $ret = form($goto, $valu);
                break;
            case 'password':
                $ret = set_password($USE);
                break;
            case 'banner':
                $ret = set_ban();
                break;
            case 'descript':
                $ret = editbrain($admin);
                break;
            case 'google':
                $ret = editbrain($admin);
                break;
            case 'members':
                $ret = adm_members_a($auth, $goto);
                break;
            case 'authes':
                $titles = array('fonction', 'auth');
                if (auth(6)) {
                    $ret = msqlink('system', 'admin_authes') . br();
                }
                foreach ($aff as $k => $v) {
                    $datas = '';
                    arsort($v);
                    foreach ($v as $ka => $va) {
                        $datas[$ka] = array($va);
                    }
                    $outre[$k] = make_tables($titles, $datas, 'txtblc', '');
                }
                $ret .= make_tabs($outre, 'at');
                break;
        }
        //constructors
        switch ($admin) {
            case 'css':
                $ret = adm_editcss();
                break;
            case 'fonts':
                $ret = edit_fonts();
                break;
            case 'connectors':
                $ret = data_brain('connectors') . br() . br();
                $ret .= lkc('txtblc', $goto . '&help==', 'connectors_infos') . br();
                if ($_GET['help']) {
                    $ret .= conn_help() . br();
                }
                break;
            case 'modules':
                $ret = data_brain('modules') . br() . br() . adm_mod_hlp($goto);
                break;
            case 'templates':
                $ret = data_brain('template');
                break;
            case 'plugin':
                $ret = adm_plugin();
                break;
            case 'msql':
                $ret = adm_msql();
                break;
            case 'dev':
                $ret = plugin('dev', '', '');
                break;
            case 'editags':
                req('meta');
                $ret = admin_tags(get('set'));
                break;
            case 'finder':
                $ret = call_finder($qb, 'disk');
                break;
            case 'backup':
                $ret = adm_backup($qb, $auth, $goto, $rep);
                break;
            case 'update_notes':
                $ret .= adm_update_notes('', 1);
                break;
            case 'plug':
                $ret .= adm_edit_plug();
                break;
        }
        if ($admin && !$ret && $auth >= $curauth) {
            //editbrain
            $ret = plugin($admin, $_GET['p'], $_GET['o']);
        }
    } else {
        switch ($admin) {
            case 'members':
                $ret = adm_members_b();
                break;
        }
    }
    #render
    if ($_SESSION['admin'] && !$_GET['callj']) {
        $head = $reta . br();
    } else {
        $head = bal('h2', lka('/admin/' . $_SESSION['admin'], $_SESSION['admin'])) . br();
    }
    return $head . $ret;
}
Exemple #2
0
function navs($op)
{
    if ($op == "ascii") {
        $r = msql_read('system', "edition_chars", "", 1);
        foreach ($r as $k => $v) {
            $ret .= ljb('', "insert", $v, $v) . ' ';
        }
        $ret .= lj('txtx', 'popup_plup___ascii', 'table');
    } elseif ($op == "pictos") {
        $r = msql_read('system', 'edition_pictos', '', 1);
        foreach ($r as $k => $v) {
            $ret .= ljb('', 'insert', '[' . $k . '§16:picto]', picto($k)) . ' ';
        }
    } elseif ($op == "uc") {
        $r = msql_read('', $_SESSION['qb'] . '_connectors', "", 1);
        if ($r) {
            $ret .= btn('txtx', $_SESSION['qb'] . ':') . ' ';
            foreach ($r as $k => $v) {
                $ret .= ljb('', "insert_mbd", '[\',\'\',\':' . $k . ']', $k) . ' ';
            }
        }
        $r = msql_read("", 'public_connectors', "", 1);
        if ($r) {
            $ret .= br() . btn('txtx', 'public:') . ' ';
            foreach ($r as $k => $v) {
                $ret .= ljb('', "insert_mbd", '[\',\'\',\':' . $k . ']', $k) . ' ';
            }
        }
        $ret = divs('min-width:440px;', $ret);
    } elseif ($op == "codeline") {
        $bt = '';
        $r = msql_read('system', 'connectors_codeline', "", 1);
        ksort($r);
        $rb = msql_read("lang", 'connectors_codeline', "", 1);
        if ($r) {
            foreach ($r as $k => $v) {
                $ret .= ljb('" title="' . $rb[$k], "insert", '[' . $v . ':' . $k . ']', $k) . ' ';
            }
        }
    } elseif ($op == "backup") {
        $id = $_SESSION["read"];
        $nod = $_SESSION['qb'] . '_backup_' . $id;
        $nodb = ajx($nod, '');
        if ($id) {
            $r = msql_read('', $nod, '', 1);
            if ($r) {
                foreach ($r as $k => $v) {
                    $rb[$k] = array('txarea_restore___users_' . $nodb . '_' . $k, 'bckp_backup___' . $nodb . '_' . $k . '_', 'bckp_backup___' . $nodb . '_del_' . $k);
                }
            }
            //txtarea
            if ($rb) {
                foreach ($rb as $k => $v) {
                    $ret .= lj('', $v[0], 'restore' . $k) . lj('', $v[1], 'backup' . $k) . lj('', $v[2], 'delete' . $k) . br();
                }
            }
            $ret .= lj('popbt', 'bckp_backup___' . $nodb . '_' . ($k + 1), 'new') . ' ';
            //txtarea
            $ret .= lj('popbt', 'txarea_filters___revert', 'revert') . ' ';
        }
        if ($ret) {
            $ret = divb('|bckp', $ret);
        } else {
            'availale only while editing';
        }
    } elseif ($op == 'disk') {
        $ret = call_finder(ses('qb'), 'disk///disk/conn//mini');
    } elseif ($op == 'icons') {
        $ret = call_finder('', 'disk///icon/conn//mini');
    } else {
        $ret = conn_props_b($op);
    }
    return divs('min-width:300px;', $ret);
}