Example #1
0
function getCurrentAction()
{
    if (isAction()) {
        return $_SESSION["action"];
    } else {
        return -1;
    }
}
function doUserAction($client)
{
    printMenu();
    if (isAction('home')) {
        printHome();
    }
    if (isAction('showCalendars')) {
        printCalendars($client);
    }
    if (isAction('showThisCalendar')) {
        printCalendarContents($client);
    }
    if (isAction('showThisEvent')) {
        printEventDetails($client);
    }
}
    pagination(countData(false, false, $where));
}
// customs end
if (!isAdmin() and !isManager() and !isGridManager()) {
    return;
}
if (isAdmin() and isset($_GET['regenerate'])) {
    foreach (listData('cats', '1') as $key => $data) {
        updateField('cats', 'cat_slug', prettyslug($data['cat_name']), 'cat_id', $data['cat_id']);
    }
    redirect(0, '/index.php?p=need&subp=1');
}
if (!subpage()) {
    return;
}
if (isAction('salinti') and getParam()) {
    if (isManager() and countData(false, false, "SELECT * FROM needs INNER JOIN needy ON needs.need_needy = needy.user_id WHERE needs.need_id = " . getParam() . " AND needy.user_parent = " . CUSER) == 0) {
        err('Neturite teisės keisti šio poreikio duomenis', 'red');
        return;
    }
    if (isGridManager()) {
        $children = array();
        foreach (listData('users', 'user_acctype = 1 AND user_active = 1 AND user_parent = ' . CUSER) as $child) {
            $children[] = 'needy.user_parent = ' . $child['user_id'];
        }
        $parent = '((' . implode(' OR ', $children) . ') OR needy.user_parent_ta = ' . CUSER . ')';
        if (countData(false, false, "SELECT * FROM needs INNER JOIN needy ON needs.need_needy = needy.user_id WHERE needs.need_id = " . getParam() . " AND " . $parent) == 0) {
            err('Neturite teisės keisti šio poreikio duomenis', 'red');
            return;
        }
    }
    return;
}
if (!subpage()) {
    return;
}
/*
if(isAction('salinti') and getParam()) :
	$row = getRow('needs', 'need_id = '.getParam());
	$act = $row['deleted'];
	$act = !$act;
	updateFieldWhere('needs', 'deleted', $act, 'need_id = '.getParam());

	redirect(0, getCurrentLink());
endif;
*/
if (isAction('atkurti') and getParam()) {
    if (isManager() and countData(false, false, "SELECT * FROM needs INNER JOIN needy ON needs.need_needy = needy.user_id WHERE needs.need_id = " . getParam() . " AND needy.user_parent = " . CUSER) == 0) {
        err('Neturite teisės keisti šio poreikio duomenis', 'red');
        return;
    }
    if (isGridManager()) {
        $children = array();
        foreach (listData('users', 'user_acctype = 1 AND user_active = 1 AND user_parent = ' . CUSER) as $child) {
            $children[] = 'needy.user_parent = ' . $child['user_id'];
        }
        $parent = '((' . implode(' OR ', $children) . ') OR needy.user_parent_ta = ' . CUSER . ')';
        if (countData(false, false, "SELECT * FROM needs INNER JOIN needy ON needs.need_needy = needy.user_id WHERE needs.need_id = " . getParam() . " AND " . $parent) == 0) {
            err('Neturite teisės keisti šio poreikio duomenis', 'red');
            return;
        }
    }
<?php

if ($login->isUserLoggedIn() == false) {
    return;
}
if (!isAdmin() and !isGridManager()) {
    return;
}
if (isAction('deaktyvuoti') and getParam()) {
    if (isGridManager() and countData('users', "user_parent = " . CUSER . " AND user_id = '" . getParam() . "'") == 0) {
        err('Neturite teisės keisti šio vartotojo duomenis', 'red');
        return;
    }
    $row = getRow('users', 'user_id = ' . getParam());
    $act = $row['user_active'];
    $act = !$act;
    updateFieldWhere('users', 'user_active', $act, 'user_id = ' . getParam());
    redirect(0, getCurrentLink());
}
$tablefields = array('user_id', array('converter' => array('user_thumb', 'getThumb')), 'user_name', 'user_fname', 'user_lname', 'user_orgname', 'user_phone', 'user_email', array('converter' => array('user_city', 'getCountry')), 'user_lastlogin', array('converter' => array('user_id', 'getUserEditLink')), array('action' => array('user_id', 'deaktyvuoti', '<i title="Aktyvuoti/deaktyvuoti" class="fa fa-times"></i>', false)), 'null');
$tablehead = array('titles' => array('ID', '', '<span title="Paskyros vardas">P. vardas</span>', 'Vardas', 'Pavardė', 'Organizacija', 'Telefonas', 'El. paštas', 'Savivaldybė', 'Pask. k. prisijungė', '', '', ''), 'columns' => array('right fc-60', 'left fc-30', 'left fc-75', 'left fc-75', 'left fc-100', 'left fc-100', 'left fc-90', 'left', 'left fc-125', 'left fc-dates', 'left fc-16', 'left fc-16', ''));
$parent = isGridManager() ? 'AND user_parent = ' . CUSER : '';
getSort('user_id');
$where = 'SELECT * FROM users WHERE user_acctype=' . subpage() . ' ' . $parent . ' ORDER BY ' . $getsort . $getorder;
$sortby = array(0 => 'user_id', 2 => 'user_name', 3 => 'user_fname', 4 => 'user_lname', 5 => 'user_orgname', 6 => 'user_email', 7 => 'user_phone', 8 => 'user_city', 9 => 'user_lastlogin');
formatTable(listData(false, false, pageNum(), $where), $tablefields, $tablehead, $sortby, true, 'nomargin');
pagination(countData(false, false, $where));
?>

<br><br>
<a href="?p=edituser"><i class="fa fa-asterisk"></i> Sukurti vartotoją</a>
Example #6
0
    $session->addVar("password", md5($loginpwd));
}
if (checkPW($session->getName(), $session->getVar("password")) != 2) {
    senddata("<p><b>Your session is invalid!</b> Please use <a href=\"index.php\">this link</a> to log in into the control panel.</p>");
    exit;
}
$action = "";
if (isset($_REQUEST["action"])) {
    $action = $_REQUEST["action"];
}
switch ($action) {
    case "":
        senddata("", true);
        break;
    default:
        if (!isAction($action)) {
            senddata("", true);
        } else {
            $reqmethod = isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : $HTTP_SERVER_VARS["REQUEST_METHOD"];
            $args = false;
            switch ($regmethod) {
                case "GET":
                    $args = isset($_GET) ? $_GET : $HTTP_GET_VARS;
                    break;
                case "POST":
                    $args = isset($_POST) ? $_POST : $HTTP_POST_VARS;
                    break;
                default:
                    $args = false;
                    break;
            }
foreach ($_SESSION['menu_items'] as $page => $title) {
    if (is_array($title)) {
        foreach ($title as $page1 => $title1) {
            echo '<div style="width:230px;float:left">
				<h2 style="padding:10px 0 2px 0;font-size:14px">
				<label><input type="checkbox" value="1" onchange="if(this.checked) { $(\'.ckb' . $page1 . '\').attr(\'checked\',\'checked\'); } else { $(\'.ckb' . $page1 . '\').removeAttr(\'checked\'); }" /> ' . $title1 . '</label></h2>';
            foreach ($_SESSION['POSIBLEPRIVS'] as $priv1 => $tit1) {
                echo '<label><input type="checkbox" class="ckb' . $page1 . '"' . (isAction($page1, $priv1) ? ' checked="checked"' : '') . ' name="priv_' . $page1 . '___' . $priv1 . '" id="priv_' . $page1 . '___' . $priv1 . '" /> ' . $tit1 . '</label><br />';
            }
            echo '</div>';
        }
    } else {
        echo '<div style="width:230px;float:left">
			<h2 style="padding:10px 0 2px 0;font-size:14px">
			<label><input type="checkbox" value="1" onchange="if(this.checked) { $(\'.ckb' . $page . '\').attr(\'checked\',\'checked\'); } else { $(\'.ckb' . $page . '\').removeAttr(\'checked\'); }" /> ' . $title . '</label></h2>';
        foreach ($_SESSION['POSIBLEPRIVS'] as $priv => $tit) {
            echo '<label><input type="checkbox" class="ckb' . $page . '"' . (isAction($page, $priv) ? ' checked="checked"' : '') . ' name="priv_' . $page . '___' . $priv . '" id="priv_' . $page . '___' . $priv . '" /> ' . $tit . '</label><br />';
        }
        echo '</div>';
    }
}
?>
	<p style="padding:10px 0;clear:both"><input type="submit" class="submit" name="submitPrivs" value="<?php 
echo lang::translate('submit');
?>
" /></p>
	
	</form>
	
</body>
</html>