コード例 #1
0
ファイル: index.php プロジェクト: skaligotla/kplaylist
function save_useroptions($uid)
{
    global $u_id, $deflanguage;
    $state = 0;
    $kpu = new kpuser();
    $kpu->setallowed(array('extm3u', 'plinline', 'hotrows', 'searchrows', 'detailrows', 'lang', 'archer', 'lamerate', 'theme', 'email', 'u_pass', 'pltype', 'textcut', 'dircolumn'));
    if ($kpu->load($uid)) {
        if (frm_isset('changepass') && strlen(frm_get('password')) > 0) {
            if (frm_isset('curpassword')) {
                if (db_guinfo('u_pass') == md5(frm_get('curpassword'))) {
                    $state = 2;
                    $kpu->set('u_pass', md5(frm_get('password')));
                } else {
                    $state = 3;
                }
            }
        }
        $kpu->set('extm3u', 0);
        $kpu->set('plinline', 0);
        foreach ($_POST as $name => $value) {
            $kpu->set($name, $value, true);
        }
        $kpu->update();
    }
    if ($uid == $u_id) {
        loadvalidated($uid, true);
        $deflanguage = db_guinfo('lang');
    }
    return $state;
}