Example #1
0
/** 
 * Checks username and password, and return an array with
 * the userid (uid) and potentially an error (err).
 *
 * @param string $user
 * @param string $pass
 * @return array
 */
function pivot_get_userid($user, $pass)
{
    global $Cfg, $Users;
    if (!$Cfg['xmlrpc']) {
        debug("XML-RPC is disabled. Method call from " . $_SERVER['REMOTE_ADDR'] . " ignored.");
        return array('uid' => -1, 'err' => "XML-RPC is disabled.");
    }
    if ($Cfg['fl_' . $_SERVER['REMOTE_ADDR']] >= 10 && $Cfg['bn_' . $_SERVER['REMOTE_ADDR']] - time() < 60 * 60 * 12) {
        if (!isset($Cfg['bn_' . $_SERVER['REMOTE_ADDR']])) {
            $Cfg['bn_' . $_SERVER['REMOTE_ADDR']] = time();
        }
        SaveSettings();
        debug("IP is banned. Method call from " . $_SERVER['REMOTE_ADDR'] . " ignored.");
        return array('uid' => -1, 'err' => "IP is banned.");
    }
    if ($Users[$user]['pass'] == md5($pass)) {
        debug("User {$user} approved");
        return array('uid' => $user);
    } else {
        // add one to the failed login attempts.
        if (strlen($user) > 0) {
            $Cfg['fl_' . $_SERVER['REMOTE_ADDR']]++;
            SaveSettings();
        }
        debug("Wrong password/username ({$user})");
        return array('uid' => -1, 'err' => "Your password/username is incorrect.");
    }
}
Example #2
0
function Do_Farm_Work_Plots($plots, $action = "harvest")
{
    global $vCnt63000;
    list(, , , , , , , , , , $fuel) = explode(';', fBGetDataStore('playerinfo'));
    if (@strlen($vCnt63000) == 0) {
        $vCnt63000 = 63000;
    }
    $px_Setopts = LoadSavedSettings();
    if (!@$px_Setopts['bot_speed'] || @$px_Setopts['bot_speed'] < 1) {
        $px_Setopts['bot_speed'] = 1;
    }
    if (@$px_Setopts['bot_speed'] > PARSER_MAX_SPEED) {
        $px_Setopts['bot_speed'] = PARSER_MAX_SPEED;
    }
    $vMaxEquip = 16;
    if (@(!$fuel) || @$fuel < 0) {
        $fuel = 0;
    }
    if ($fuel == 0 && $action == 'tractor') {
        return;
    }
    if ($fuel == 0) {
        Do_Farm_Work($plots, $action);
        return;
    }
    while (count($plots) > 0) {
        $amf = new AMFObject("");
        $amf->_bodys[0] = new MessageBody();
        $amf->_bodys[0]->targetURI = 'FlashService.dispatchBatch';
        $amf->_bodys[0]->responseURI = '/1/onStatus';
        $amf->_bodys[0]->responseIndex = '/1';
        $amf->_bodys[0]->_value[0] = GetAMFHeaders();
        $amf->_bodys[0]->_value[2] = 0;
        $vCntSpeed = 0;
        while (count($plots) > 0 && $vCntSpeed < $px_Setopts['bot_speed'] && $fuel > 0) {
            $amf->_bodys[0]->_value[1][$vCntSpeed]['sequence'] = GetSequense();
            $amf->_bodys[0]->_value[1][$vCntSpeed]['functionName'] = "EquipmentWorldService.onUseEquipment";
            if ($action == 'tractor') {
                $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][0] = 'plow';
            } else {
                $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][0] = $action;
            }
            $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][1]['id'] = -1;
            if ($action == 'harvest') {
                $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][1]['key'] = 'V1:32';
            }
            # fully expanded harvester
            if ($action == 'tractor' || $action == 'plow') {
                $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][1]['key'] = 'T1:32';
            }
            # fully expanded tractor
            if ($action == 'place') {
                $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][1]['key'] = 'S1:32';
            }
            # fully expanded seeder
            $vCntEquip = 0;
            $vSeed = '';
            $vLastSeed = '';
            while (count($plots) > 0 && $vCntEquip < $vMaxEquip && $fuel > 0) {
                $vPlot = array_pop($plots);
                if ($action == 'place') {
                    $vSeed = $vPlot['itemName'];
                    if ($vLastSeed == '') {
                        $vLastSeed = $vSeed;
                    } elseif ($vLastSeed != $vSeed) {
                        array_push($plots, $vPlot);
                        break;
                    }
                }
                if (@(!$plotsstring)) {
                    $plotsstring = $vPlot['itemName'] . " " . GetPlotName($vPlot);
                } else {
                    $plotsstring = $plotsstring . ", " . $vPlot['itemName'] . " " . GetPlotName($vPlot);
                }
                if (@(!$OKstring)) {
                    $OKstring = $action . " " . $vPlot['itemName'] . " on plot " . GetPlotName($vPlot);
                } else {
                    $OKstring = $OKstring . "\r\n" . $action . " " . $vPlot['itemName'] . " on plot " . GetPlotName($vPlot);
                }
                $fuel--;
                if ($action == 'tractor') {
                    $vCnt63000++;
                    $vPlot['id'] = $vCnt63000;
                    $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][2][$vCntEquip] = $vPlot;
                } else {
                    $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][2][$vCntEquip]['id'] = $vPlot['id'];
                }
                $vCntEquip++;
            }
            if ($action == 'tractor' || $action == 'harvest' || $action == 'plow') {
                $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][3] = 'plowed';
            }
            if ($action == 'place') {
                $amf->_bodys[0]->_value[1][$vCntSpeed]['params'][3] = $vSeed;
            }
            $vCntSpeed++;
        }
        AddLog2($action . " " . $plotsstring);
        $res = RequestAMF($amf);
        AddLog2("result {$res}");
        unset($amf->_bodys[0]->_value[1]);
        if ($res === 'OK') {
            AddLog($OKstring);
            $need_reload = true;
        } else {
            if ($res) {
                AddLog("Error: {$res} on " . $OKstring);
                if (intval($res) == 29 || strpos($res, 'BAD AMF') !== false) {
                    // Server sequence was reset
                    DoInit();
                }
            }
        }
        unset($plotsstring, $OKstring);
    }
    $px_Setopts = LoadSavedSettings();
    if ($action == 'plow' || $action == 'tractor') {
        $px_Setopts['fuel_plow'] = $fuel;
    }
    if ($action == 'place') {
        $px_Setopts['fuel_place'] = $fuel;
    }
    if ($action == 'harvest') {
        $px_Setopts['fuel_harvest'] = $fuel;
    }
    SaveSettings($px_Setopts);
}
Example #3
0
include_once 'ressources/class.ldap.inc';
include_once 'ressources/class.users.menus.inc';
include_once 'ressources/class.artica.inc';
include_once 'ressources/class.user.inc';
include_once 'ressources/class.mimedefang.inc';
include_once 'ressources/class.ini.inc';
if (isset($_GET["script"])) {
    script();
    exit;
}
if (isset($_GET["step"])) {
    step();
    exit;
}
if (isset($_GET["SaveSettings"])) {
    SaveSettings();
    exit;
}
if (isset($_GET["Cancel"])) {
    Cancel();
    exit;
}
function Cancel()
{
    $sock = new sockets();
    $sock->SET_INFO("SmtpWizardFinish", 1);
}
function page_0()
{
    $html = "\n\t<p class=caption>{wizard_smtp_intro}</p>";
    echo BuildPage('{welcome_first_wizard}', $html);
Example #4
0
function CreateDefaultSettings()
{
    $dset = array();
    $dset['version'] = FB_SETTINGS_VER;
    $dset['e_gzip'] = 1;
    $dset['farm_server'] = 0;
    $dset['bot_speed'] = 8;
    $dset['not_plugin'] = '';
    $dset['lonlyanimals'] = 1;
    $dset['acceptneighborhelp'] = 1;
    SaveSettings($dset);
    return $dset;
}
Example #5
0
/**
 * This function is always called. It checks if:
 * - A user just logged in
 * - A user is logged in, or
 * - A 'persistent login' cookie is set
 *
 * If either of these is true, a new session is started, or an old session is revived.
 * If it's not right, the user is booted to the login screen.
 *
 * @see Login(), NewSession(), ReviveSession()
 *
 */
function CheckLogin()
{
    global $Users, $Pivot_Vars, $Cfg, $Paths;
    // User is banned..
    if (isset($Cfg['bn_' . $_SERVER['REMOTE_ADDR']])) {
        Login(1, 1, "User is banned");
    }
    // added to not check for referers if no session id is given..
    if (!isset($Pivot_Vars['session'])) {
        $uri = 'http://' . $Pivot_Vars['HTTP_HOST'] . $Pivot_Vars['SCRIPT_NAME'];
        if (strpos($Pivot_Vars['HTTP_REFERER'], $uri) != 0) {
            $Pivot_Vars['user'] = '';
            Login(0, 2, "No session active.");
        }
    }
    // If we selected logout from the menu..
    if (isset($Pivot_Vars['func']) && $Pivot_Vars['func'] == 'login' && isset($Pivot_Vars['do']) && $Pivot_Vars['do'] == 'logout') {
        setcookie('user', '', -9999, $Paths['cookie_url']);
        setcookie('pass', '', -9999, $Paths['cookie_url']);
        setcookie('mode', 'nothing', -9999, $Paths['cookie_url']);
        unset($Users[$Cfg['tempsessions'][$Pivot_Vars['session']][0]]['session']);
        unset($Cfg['tempsessions'][$Pivot_Vars['session']]);
        SaveSettings();
        login(0, 3, "User logged off");
    }
    // if the user has cookies set, but no session is active yet..
    if (isset($_COOKIE['user']) && isset($_COOKIE['hash']) && $_COOKIE['mode'] == 'stayloggedin' && (!isset($Pivot_Vars['session']) || $Pivot_Vars['session'] == "")) {
        debug("attempted ReviveSession..");
        // Try to revive an old Session..
        ReviveSession();
    } else {
        if ($Pivot_Vars['func'] == 'login' || $Pivot_Vars['do'] == 'login') {
            // if we've just logged in, reset the cookies, if necesary and start a new session..
            debug("attempted login..");
            if ($Users[$Pivot_Vars['user']]['pass'] == md5($Pivot_Vars['pass']) && $Users[$Pivot_Vars['user']]['userlevel'] > 0) {
                NewSession($Pivot_Vars['user']);
            } else {
                // add one to the failed login attempts.
                if (strlen($Pivot_Vars['user']) > 0) {
                    $Cfg['fl_' . $_SERVER['REMOTE_ADDR']]++;
                }
                Login(1, 4, "Incorrect username or password");
            }
        } else {
            // when running normally, the session stuff is updated.
            $Pivot_Vars['user'] = $Cfg['tempsessions'][$Pivot_Vars['session']][0];
            $ip = substr($_SERVER['REMOTE_ADDR'], 0, strrpos($_SERVER['REMOTE_ADDR'], "."));
            // calculated locally: user's pass + current session + ip we got from user
            $hash1 = md5(md5($Users[$Pivot_Vars['user']]['pass'] . $Pivot_Vars['session']) . $ip);
            // stored hash
            $hash2 = $Cfg['tempsessions'][$Pivot_Vars['session']][1];
            // we check if the two hash matches with the one that was stored
            if ($hash1 != $hash2) {
                // if this is the case, something's not ok, so go back to login..
                Login(0, 0, "No hacking, please");
            }
        }
    }
    // If by this point no session is set, we will show the login screen..
    if (strlen($Pivot_Vars['session']) == 0) {
        Login(0, 8, "Please log on. (if you keep getting this message, delete the cookies for this site)");
    }
    // Update the timer, so we can keep the user logged in.
    if ($Cfg['tempsessions'][$Pivot_Vars['session']][2] - time() <= $Cfg['session_length'] / 4) {
        $Cfg['tempsessions'][$Pivot_Vars['session']][2] = $Cfg['tempsessions'][$Pivot_Vars['session']][2] + $Cfg['session_length'];
    }
}
Example #6
0
 * I AM SORRY FOR MY BAD CODING STYLE :(
 * YOUR CONTRIBUTION WILL BE A GREAT GIFT FOR PLAYSCRIPT
 * LICENSE: OPEN-SOURCE
 * PROJECT HOMEPAGE: http://playscript.prijm.com
 * YOU CAN RICH ME(INITIAL DEVELOPER) AT http://twitter.com/rakibtg FEEL FREE TO TWEET OR MESSAGE YOUR QUERY
 * PLEASE SHARE <PlayScript/> IN YOUR SOCIAL MEDIA
 * <PlayScript/> IS AN OPEN-SOURCE BROWSER BASED APP
 * THANKYOU, HAVE A NICE DAY
 * © 2015 prijm.com
 *
 */
require_once "includes/php/header_files.php";
if ($_POST['functionName'] === "SaveSettings") {
    $saved = GetGeneralSettings();
    if (!isset($_POST['theme'])) {
        $theme = $saved->theme;
    } else {
        $theme = $_POST['theme'];
    }
    if (!isset($_POST['fontsize'])) {
        $fontsize = $saved->fontsize;
    } else {
        $fontsize = $_POST['fontsize'];
    }
    if (!isset($_POST['language'])) {
        $language = $saved->language;
    } else {
        $language = $_POST['language'];
    }
    SaveSettings($theme, $fontsize, $language);
}
    $MenuSection = "settings";
    $ProgPath[0]['Name'] = $Lang['MSettings'];
    $ProgPath[0]['Url'] = getURL("settings", "CpId={$CpId}", "admin");
} else {
    $MenuSection = "admin";
    $ProgPath[0]['Name'] = $Lang['Administr'];
    $ProgPath[0]['Url'] = getURL("admin", "", "admin");
}
$PageTitle .= $Lang['Title'];
$ProgPath[1]['Name'] = $Lang['Title'];
$ProgPath[1]['Url'] = getURL("stat_config", "CpId={$CpId}", "admin");
/////////////////////////////////////////////
///////// call any process functions
if (!$nsUser->DEMO) {
    if (ValidArr($SaveSet)) {
        SaveSettings($SaveSet);
    }
}
/////////////////////////////////////////////
///////// display section here
include $nsTemplate->Inc();
/////////////////////////////////////////////
///////// process functions here
function SaveSettings($SaveSet)
{
    global $Db, $Logs, $Lang, $CpId, $nsProduct;
    $KeepPath = '2';
    $KeepNoRef = '2';
    foreach ($SaveSet as $CP => $Arr) {
        foreach ($Arr as $SiteId => $SubArr) {
            extract($SubArr);
$PageTitle = $Lang['Title'];
$nsLang->TplInc("inc/user_welcome");
$ProgPath[0]['Name'] = $Lang['Administr'];
$ProgPath[0]['Url'] = getURL("admin", "", "admin");
$ProgPath[1]['Name'] = $Lang['Title'];
$ProgPath[1]['Url'] = getURL("misc_config", "", "admin");
$MenuSection = "admin";
$Query = "SELECT * FROM " . PFX . "_tracker_config WHERE COMPANY_ID=0 AND SITE_ID=0";
$Settings = $Db->Select($Query);
$P3P = GetParam("P3P", "STRVAL");
$P3P_REF = GetParam("P3P_REF", "STRVAL");
/////////////////////////////////////////////
///////// call any process functions
if (!$nsUser->DEMO) {
    if (ValidArr($EditArr)) {
        SaveSettings($EditArr);
    }
}
/////////////////////////////////////////////
///////// display section here
$SkinsArr = array();
$Path = SELF . "/skins";
clearstatcache();
$Dir = @opendir($Path);
while ($Row = @readdir($Dir)) {
    if ($Row == "." || $Row == ".." || $Row == "CVS") {
        continue;
    }
    if (is_file($Row)) {
        continue;
    }
Example #9
0
/**
 * Store the new user and display all users again
 */
function new_user_save()
{
    global $Pivot_Vars, $Cfg, $Users;
    // check against unauthorised direct access.
    check_csrf();
    $userfields = get_userfields(1);
    if (CheckInput($Pivot_Vars['username'], 2, 0) == 1) {
        $userfields[0][2] = lang('userinfo', 'username_too_short');
        $Piverr++;
    } elseif (CheckInput($Pivot_Vars['username'], 2, 0) == 0) {
        $userfields[0][2] = lang('userinfo', 'username_not_valid');
        $Piverr++;
    }
    if (isset($Users[$Pivot_Vars['username']])) {
        $userfields[0][2] = lang('userinfo', 'username_in_use');
        $Piverr++;
    }
    if (ltrim(rtrim(strtolower($Pivot_Vars['pass1']))) != ltrim(rtrim(strtolower($Pivot_Vars['pass2'])))) {
        $userfields[2][2] = lang('userinfo', 'pass_dont_match');
        $Piverr++;
    }
    if (CheckInput($Pivot_Vars['pass1'], 4, 0) == 1) {
        $userfields[1][2] = lang('userinfo', 'pass_too_short');
        $Piverr++;
    }
    if ($Piverr > 0) {
        $userfields[0][4] = $Pivot_Vars['username'];
        $userfields[3][6] = $Pivot_Vars['userlevel'];
        new_user(1, $userfields);
    } else {
        if ($Pivot_Vars['userlevel'] == 3 && $Pivot_Vars['confirmed'] != 1) {
            $vars = array('username', $Pivot_Vars['username'], 'pass1', $Pivot_Vars['pass1'], 'pass2', $Pivot_Vars['pass2'], 'email', $Pivot_Vars['email'], 'userlevel', $Pivot_Vars['userlevel']);
            ConfirmPage(lang('userinfo', 'c_admin_title'), $vars, sprintf(lang('userinfo', 'c_admin_message'), $Pivot_Vars['username']));
        } elseif ($Pivot_Vars['userlevel'] < 3 || $Pivot_Vars['confirmed'] == 1) {
            $Users[$Pivot_Vars['username']]['pass'] = md5($Pivot_Vars['pass1']);
            $Users[$Pivot_Vars['username']]['email'] = $Pivot_Vars['email'];
            $Users[$Pivot_Vars['username']]['userlevel'] = $Pivot_Vars['userlevel'];
            $Users[$Pivot_Vars['username']]['language'] = $Pivot_Vars['language'];
            $Users[$Pivot_Vars['username']]['wysiwyg'] = $Pivot_Vars['wysiwyg'];
            $Users[$Pivot_Vars['username']]['username'] = $Pivot_Vars['username'];
            $Users[$Pivot_Vars['username']]['nick'] = $Pivot_Vars['username'];
            $Users[$Pivot_Vars['username']]['view'] = $Pivot_Vars['view'];
            $Cfg['users'] .= '|' . $Pivot_Vars['username'];
            // set the categories.,
            $cats = cfg_cats();
            foreach ($cats as $category) {
                $allowed_users = explode("|", $Cfg['cat-' . $category['name']]);
                if (isset($Pivot_Vars['allowed'][urlencode($category['name'])])) {
                    // add the user (and ensure it's only added once) ..
                    $allowed_users[] = $Pivot_Vars['username'];
                    $allowed_users = array_unique($allowed_users);
                } else {
                    // remove the user (in case the same name have been used and
                    // assigned to this category before)
                    if (in_array($Pivot_Vars['username'], $allowed_users)) {
                        foreach ($allowed_users as $key => $user) {
                            if ($user == $Pivot_Vars['username']) {
                                unset($allowed_users[$key]);
                            }
                        }
                    }
                }
                $Cfg['cat-' . $category['name']] = implode("|", $allowed_users);
            }
            SaveSettings();
            see_users();
        }
    }
}
Example #10
0
                        }
                    }
                }
            }
        }
    }
    $changed_settings = true;
    if (isset($_POST['del_account']) && is_array($_POST['acct_list'])) {
        $del_accts = @$_POST['acct_list'];
        foreach ($del_accts as $acct) {
            $uSQL = 'DELETE FROM userids WHERE userid = ' . $acct . ';';
            $_SESSION['vDataStoreDB']->exec($uSQL);
        }
    }
    if ($changed_settings) {
        SaveSettings($px_Setopts);
    }
    //header("Location: index.php?userId=" . $_SESSION['userId']);
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/fBSettings.css" />
<style type="text/css">
body {

	background-color: #FFFFFF;

}
</style>
</head>
Example #11
0
<?php
session_start();
	include_once('ressources/class.templates.inc');
	include_once('ressources/class.main_cf.inc');
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.artica.inc');
	include_once('ressources/class.user.inc');
	include_once('ressources/class.mimedefang.inc');
	include_once('ressources/class.ini.inc');	

if(isset($_GET["script"])){script();exit;}
if(isset($_GET["step"])){step();exit;}
if(isset($_GET["SaveSettings"])){SaveSettings();exit;}
if(isset($_GET["Cancel"])){Cancel();exit;}



function Cancel(){
	$sock=new sockets();
	$sock->SET_INFO("SmtpWizardFinish",1);		
	
}


function page_0(){
	$html="
	<p class=caption>{wizard_smtp_intro}</p>";
	echo BuildPage('{welcome_first_wizard}',$html);
	
}
Example #12
0
/**
 * Saves the user settings.
 *
 * @param int $admin
 */
function libsave_change_user($admin = 0)
{
    global $Pivot_Vars, $Users, $Cfg, $Paths;
    // Sanitize passed variables to prevent people from inserting characters that
    // could be interpreted as dividers.
    foreach ($Pivot_Vars as $key => $val) {
        $Pivot_Vars[$key] = preg_replace("/[!|\n]/i", "", $Pivot_Vars[$key]);
    }
    $userfields = get_userfields($admin);
    $ufields = GetUserFields();
    if ($admin == 1) {
        $theuser = $Pivot_Vars['username'];
    } else {
        $theuser = $Pivot_Vars['user'];
    }
    if ($Pivot_Vars['delete_user'] == 1 && $Users[$Pivot_Vars['user']]['userlevel'] >= 3) {
        if ($Pivot_Vars['confirmed'] == 1) {
            //delete him from the config file, nothing else.
            $tmp_arr = explode("|", $Cfg['users']);
            foreach ($tmp_arr as $candidate) {
                if ($candidate != $Pivot_Vars['username']) {
                    $tmp_arr2[] = $candidate;
                }
            }
            $Cfg['users'] = implode("|", $tmp_arr2);
            unset($Users[$Pivot_Vars['username']]);
            unset($Cfg['user-' . $Pivot_Vars['username']]);
            see_users();
        } else {
            $vars = array('username', $Pivot_Vars['username'], 'delete_user', 1);
            ConfirmPage(lang('ufield_main', 'del_title'), $vars, sprintf(lang('config', 'delete_user_confirm'), $Pivot_Vars['username']));
        }
    } else {
        foreach ($ufields as $keyname => $intarr) {
            // Skipping fields that we aren't allowed to change
            if ($admin != 1 && $Users[$theuser]['userlevel'] < $ufields[$keyname]['minlevel']) {
                continue;
            }
            array_push($userfields, array($keyname, $ufields[$keyname]['disp'], '', $ufields[$keyname]['type'], $Users[$theuser][$keyname], $ufields[$keyname]['size'], $maxl));
            if ($ufields[$keyname]['filter'] != '' && strlen($Pivot_Vars[$keyname]) > 0) {
                $tfunk = 'is' . $ufields[$keyname]['filter'];
                if (!$tfunk($Pivot_Vars[$keyname])) {
                    $userfields[count($userfields) - 1][2] = 'hey, that input doesn\'t go along with the filter in place';
                    $Piverr++;
                }
            }
        }
        $arraycount = Count($userfields);
        if (strlen($Pivot_Vars['pass1']) + strlen($Pivot_Vars['pass2']) >= 1) {
            if (trim($Pivot_Vars['pass1']) != trim($Pivot_Vars['pass2'])) {
                $userfields[2][2] = lang('userinfo', 'pass_dont_match');
                $Piverr++;
            }
            if (strlen($Pivot_Vars['pass1']) < 4) {
                $userfields[1][2] = lang('userinfo', 'pass_too_short');
                $Piverr++;
            }
            if ($Pivot_Vars['pass1'] == $Pivot_Vars['username']) {
                $userfields[1][2] = lang('userinfo', 'pass_equal_name');
                $Piverr++;
            }
        }
        if ($Piverr == 0) {
            // make sure the superadmin doesn't demote himsef/herself..
            if ($Users[$theuser]['userlevel'] == 4) {
                $Pivot_Vars['userlevel'] = 4;
            }
            // get confirmation if user gets admin rights
            if ($Pivot_Vars['userlevel'] == 3 && $Users[$theuser]['userlevel'] < 3 && $Pivot_Vars['confirmed'] != 1) {
                $vars = array();
                $arraycount = Count($userfields);
                for ($i = 0; $i < $arraycount; $i++) {
                    array_push($vars, $userfields[$i][0], $Pivot_Vars[$userfields[$i][0]]);
                }
                ConfirmPage(lang('userinfo', 'c_admin_title'), $vars, sprintf(lang('userinfo', 'c_admin_message'), $theuser));
            } else {
                //it's all good.
                if (strlen($Pivot_Vars['pass1']) >= 6) {
                    $Users[$theuser]['pass'] = md5($Pivot_Vars['pass1']);
                    if ($_COOKIE['mode'] == 'stayloggedin' && $Pivot_Vars['user'] == $theuser) {
                        setcookie('pass', md5($Pivot_Vars['pass1']), time() + $Cfg['cookie_length'], $Paths['cookie_url']);
                    }
                    //change the session key too..
                    $Cfg['tempsessions'][$Pivot_Vars['session']][1] = md5($Pivot_Vars['pass1']);
                }
                for ($i = 0; $i < $arraycount; $i++) {
                    if ($userfields[$i][0] != 'heading' && $userfields[$i][0] != 'pass1' && $userfields[$i][0] != 'pass2') {
                        $Users[$theuser][$userfields[$i][0]] = $Pivot_Vars[$userfields[$i][0]];
                    }
                }
                // set the categories..
                if ($Users[$Pivot_Vars['user']]['userlevel'] > 2) {
                    foreach (explode("|", $Cfg['cats']) as $category) {
                        $allowed_users = explode("|", $Cfg['cat-' . $category]);
                        if (isset($Pivot_Vars['allowed'][urlencode($category)])) {
                            // add the user..
                            if (!in_array($theuser, $allowed_users)) {
                                $allowed_users[] = $theuser;
                            }
                        } else {
                            // remove the user..
                            if (in_array($theuser, $allowed_users)) {
                                foreach ($allowed_users as $key => $user) {
                                    if ($user == $theuser) {
                                        unset($allowed_users[$key]);
                                    }
                                }
                            }
                        }
                        $Cfg['cat-' . $category] = implode("|", $allowed_users);
                    }
                }
                /**
                 * Rather crude check to prevent corrupting the file:
                 * if $Users[$theuser]['username'] is empty, we refuse to save.
                 */
                if ($Users[$theuser]['username'] != "") {
                    debug("changes saved for " . $theuser);
                    SaveSettings();
                } else {
                    // not right..
                    debug("Changes not saved..");
                }
                //so we can reload the languages and such
                if ($admin == 1) {
                    redirect('index.php?session=' . $Pivot_Vars['session'] . '&amp;menu=admin&amp;func=admin&do=seeusers');
                    die;
                } else {
                    redirect('index.php?session=' . $Pivot_Vars['session'] . '&amp;menu=userinfo&amp;func=u_settings');
                    die;
                }
            }
        } else {
            //reshow the spage
            $Pivot_Vars['edituser'] = $Pivot_Vars['username'];
            //regroup the old settings.
            for ($i = 0; $i < $arraycount; $i++) {
                if ($userfields[$i][3] == 0) {
                    $userfields[$i][4] = $Pivot_Vars[$userfields[$i][0]];
                } elseif ($userfields[$i][3] == 3) {
                    $userfields[$i][6] = $Pivot_Vars[$userfields[$i][0]];
                }
            }
        }
        if ($Users[$theuser]['userlevel'] > 3) {
            //ARGHH!!!!!!
            $unf[0] = $userfields[4][6];
            $unf[1] = 'disabled';
            unset($userfields[4][6]);
            $userfields[4][6] = $unf;
        }
        if ($admin == 1) {
            change_user(1, $userfields);
        } else {
            u_settings_screen(1, $userfields);
        }
    }
    PutUserInfo();
}
Example #13
0
if($usersmenus->AsArticaAdministrator==false){header('location:users.index.php');exit;}


if(isset($_POST["DenyMiniWebFromStandardPort"])){js_web_miniadm_save();exit;}
if(isset($_POST["LighttpdArticaDisableSSLv2"])){js_LighttpdArticaDisableSSLv2_save();exit;}


if(isset($_GET["lighttpd_procs"])){HTTPS_PROCESSES_SAVE();exit;}
if(isset($_GET["LighttpdArticaDisabled"])){LighttpdArticaDisabled();exit;}
if(isset($_POST["ChangeSuperSuser"])){ChangeUserPassword();exit();}
if(isset($_GET["section"])){page_switch();exit;}
if(isset($_GET["GroupBehavior"])){GroupBehavior();exit;}
if(isset($_GET["SaveGroupBehavior"])){SaveGroupBehavior();exit;}
if(isset($_GET["SaveRelayBehavior"])){SaveRelayBehavior();exit;}
if(isset($_GET["RelayBehavior"])){RelayBehavior();exit;}
if(isset($_GET["ARTICA_FILTER_QUEUE_PATH"])){SaveSettings();}
if(isset($_GET["ArticaWebRootURI"])){SaveArticaWebRootURI();exit;}
if(isset($_GET["status"])){main_status();exit;}
if(isset($_GET["ArticaProxyServerEnabled"])){SaveProxySettings();exit;}
if(isset($_GET["ArticaMailAddonsLevel_switch"])){echo SMTP_PERFORMANCES_EXPLAIN($_GET["ArticaMailAddonsLevel_switch"]);exit;}
if(isset($_GET["ArticaMailAddonsLevel_save"])){SMTP_PERFORMANCES_SAVE();exit;}
if(isset($_GET["MysqlMaxEventsLogs"])){SaveSqlSettings();exit();}
if(isset($_GET["http_settings"])){HTTPS_PORT_SAVE();exit;}
if(isset($_GET["advlighttp"])){HTTPS_PROCESSES();exit;}

if(isset($_GET["smtp_notifications"])){SMTP_NOTIFICATIONS_SAVE();exit;}
if(isset($_GET["testnotif"])){SMTP_NOTIFICATIONS_NOTIF();exit;}
if(isset($_GET["smtp-notifs-tab"])){SMTP_NOTIFICATIONS_SWITCH();exit;}
if(isset($_GET["SMTP_NOTIFICATIONS_ADD_CC"])){SMTP_NOTIFICATIONS_ADD_CC();exit;}
if(isset($_GET["SMTP_NOTIFICATIONS_DEL_CC"])){SMTP_NOTIFICATIONS_DEL_CC();exit;}
if(isset($_GET["SMTP_NOTIFICATIONS_LIST_CC"])){echo SMTP_NOTIFICATIONS_CCLIST();exit;}