function baseAccountAnswer(&$session, $user)
{
    $session->trace(TC_Gui1, 'baseAccountAnswer');
    $message = '';
    $code = encryptPassword($session, $_POST['account_user'], $_POST['account_code']);
    $locked = dbSqlString($session, !empty($_POST['account_locked']));
    if (!empty($_POST['account_startpageoffer'])) {
        $_POST['account_startpage'] = $_POST['account_startpageoffer'];
    }
    if (isset($_POST['account_new'])) {
        if ($_POST['account_user2'] == '') {
            $message = '+++ Kein Benutzername angegeben';
        } elseif (dbGetValueByClause($session, T_User, 'count(*)', 'name=' + dbSqlString($session, $_POST['account_user'])) > 0) {
            $message = '+++ Name schon vorhanden: ' + $_POST['account_user2'];
        } else {
            $uid = dbUserAdd($session, $_POST['account_user2'], $code, dbSqlString($session, false), $_POST['account_theme'], $_POST['account_width'], $_POST['account_height'], $_POST['account_maxhits'], $_POST['account_startpage'], $_POST['account_email']);
            modUserStoreData($session, true, $uid);
            $message = 'Benutzer ' . $_POST['account_user2'] . ' wurde angelegt. ID: ' . $uid;
        }
    } elseif (isset($_POST['account_change'])) {
        if (!empty($_POST['account_code']) && $_POST['account_code'] != $_POST['account_code2']) {
            $message = '+++ Passwort stimmt mit Wiederholung nicht überein';
        } elseif (!($uid = dbUserId($session, $_POST['account_user'])) || empty($uid)) {
            $message = '+++ unbekannter Benutzer: ' . $_POST['account_name'];
        } elseif (($message = modUserCheckData($session, true, $uid)) != null) {
        } else {
            if (empty($_POST['account_theme'])) {
                $_POST['account_theme'] = Theme_Standard;
            }
            $what = 'locked=' . $locked . ',';
            if (!empty($_POST['account_code'])) {
                $what .= 'code=' . dbSqlString($session, $code) . ",";
            }
            $what .= 'theme=' . $_POST['account_theme'] . ',width=' . (0 + $_POST['account_width']) . ',height=' . (0 + $_POST['account_height']) . ',maxhits=' . (0 + $_POST['account_maxhits']) . ',startpage=' . dbSqlString($session, $_POST['account_startpage']) . ',email=' . dbSqlString($session, $_POST['account_email']) . ',';
            dbUpdate($session, T_User, $uid, $what);
            modUserStoreData($session, false, $uid);
            $message = 'Daten für ' . $_POST['account_user'] . ' (' . $uid . ') wurden geändert';
        }
    } elseif ($_POST['account_other']) {
        if (empty($_POST['account_user2'])) {
            $message = '+++ kein Benutzername angegeben';
        } elseif (!dbUserId($session, $_POST['account_user2'])) {
            $message = '+++ Unbekannter Benutzer: ' . $_POST['account_user2'];
        }
    } else {
        $message = 'keine Änderung';
    }
    baseAccount($session, $message);
}
示例#2
0
function baseAccountAnswer(&$session, $user)
{
    global $account_user, $account_code, $account_code2, $account_email, $account_rights, $account_locked, $account_new, $account_change, $account_name, $account_other, $account_user2, $account_theme, $account_width, $account_height, $account_maxhits, $account_startpage, $account_startpageoffer;
    $session->trace(TC_Gui1, 'baseAccountAnswer');
    $message = '';
    $code = encryptPassword($session, $account_user, $account_code);
    $locked = dbSqlString($session, !empty($account_locked));
    if (!empty($account_startpageoffer)) {
        $account_startpage = $account_startpageoffer;
    }
    if (isset($account_new)) {
        if ($account_user2 == '') {
            $message = '+++ Kein Benutzername angegeben';
        } elseif (dbGetValueByClause($session, T_User, 'count(*)', 'name=' + dbSqlString($session, $account_user)) > 0) {
            $message = '+++ Name schon vorhanden: ' + $account_user2;
        } else {
            $uid = dbUserAdd($session, $account_user2, $code, $session->fUserRights, dbSqlString($session, false), $account_theme, $account_width, $account_height, $account_maxhits, $account_startpage, $account_email);
            modUserStoreData($session, true, $uid);
            $message = "Benutzer {$account_user2} wurde angelegt. ID: " . $uid;
        }
    } elseif (isset($account_change)) {
        if (!empty($account_code) && $account_code != $account_code2) {
            $message = '+++ Passwort stimmt mit Wiederholung nicht überein';
        } elseif (!($uid = dbUserId($session, $account_user)) || empty($uid)) {
            $message = '+++ unbekannter Benutzer: ' . $account_name;
        } elseif (($message = modUserCheckData($session, true, $uid)) != null) {
        } else {
            if (empty($account_theme)) {
                $account_theme = Theme_Standard;
            }
            $what = 'rights=' . dbSqlString($session, $account_rights) . ',locked=' . $locked . ',';
            if (!empty($account_code)) {
                $what .= 'code=' . dbSqlString($session, $code) . ",";
            }
            $what .= "theme={$account_theme},width={$account_width}," . 'height=' . (0 + $account_height) . ',maxhits=' . (0 + $account_maxhits) . ',startpage=' . dbSqlString($session, $account_startpage) . ',email=' . dbSqlString($session, $account_email) . ',';
            dbUpdate($session, T_User, $uid, $what);
            modUserStoreData($session, false, $uid);
            $message = 'Daten für ' . $account_user . ' (' . $uid . ') wurden geändert';
        }
    } elseif ($account_other) {
        if (empty($account_user2)) {
            $message = '+++ kein Benutzername angegeben';
        } elseif (!dbUserId($session, $account_user2)) {
            $message = '+++ Unbekannter Benutzer: ' . $account_user2;
        }
    } else {
        $message = 'keine Änderung';
    }
    baseAccount($session, $message);
}