예제 #1
0
    $platform = 'windows';
} else {
    $platform = 'unrecognized';
}
// redirect in case deprecated browser
if ($browser == "msie" && $baseversion < 8 || $browser == "safari" && $baseversion < 4 || $browser == "chrome" && $baseversion < 10 || $browser == "opera" && $baseversion < 10 || $browser == "firefox" && $baseversion < 3 || $browser == "unrecognized") {
    http_redirect($this->base . 'deprecated_browser');
}
$action = $this->request->parameters['action'];
if ($action == 'passwordreset') {
    $userToken = sRequest()->parameters['token'];
    if ($userId = sUserMgr()->getUserIdByToken($userToken)) {
        $user = new User($userId);
        $smarty->assign('passwordreset', true);
        $smarty->assign('passwordreset_token', $userToken);
        if (sRequest()->parameters['newuser'] == '1') {
            $smarty->assign('newuser', true);
        }
    }
}
$windowcfgxml = simplexml_load_string($smarty->fetch('file:' . getrealpath($this->approot) . "/ui/html/windows/windows.xml"));
$smarty->assign("windowconfig", json_encode($windowcfgxml));
$smarty->assign('itext_js', $itext_js);
$smarty->assign('lang', $lang);
$user = new User(sUserMgr()->getCurrentUserID());
$userinfo = $user->get();
$backendAllowed = $user->checkPermission('RBACKEND');
if (!$backendAllowed) {
    $this->session->setPSessionVar('username', '');
    $this->session->setPSessionVar('password', '');
    $this->session->setPSessionVar('isvalidated', false);
예제 #2
0
function calcPageDir($dataCount, $defaultSortCol, $defaultSortOrder = 'ASC')
{
    $pageDirPage = (int) sRequest()->parameters['pagedir_page'];
    $pageDirPerPage = sRequest()->parameters['pagedir_perpage'];
    $pageDirOrderBy = sRequest()->parameters['pagedir_orderby'];
    $pageDirOrderDir = (int) sRequest()->parameters['pagedir_orderdir'];
    $pageDirFrom = (int) sRequest()->parameters['pagedir_from'];
    if (!$pageDirFrom) {
        $pageDirFrom = 1;
    }
    if ($pageDirPerPage == 'ALL') {
        $pageDirPerPage = -1;
    } else {
        if (!$pageDirPerPage) {
            $pageDirPerPage = (int) sConfig()->getVar('CONFIG/PAGEDIR/DEFAULT_PER_PAGE');
        } else {
            $pageDirPerPage = (int) $pageDirPerPage;
        }
    }
    $pageDirMaxPages = 1;
    if (!$pageDirPage) {
        $pageDirPage = 1;
    }
    if ($pageDirPerPage > 0) {
        $pageDirMaxPages = ceil($dataCount / $pageDirPerPage);
    }
    if ($pageDirMaxPages < 1) {
        $pageDirMaxPages = 1;
    }
    if ($pageDirPage > $pageDirMaxPages) {
        $pageDirPage = $pageDirMaxPages;
        $pageDirFrom = $pageDirPage * $pageDirPerPage - ($pageDirPerPage - 1);
    }
    if (!$pageDirOrderBy) {
        $pageDirOrderBy = $defaultSortCol;
    }
    if (!$pageDirOrderDir) {
        $pageDirOrderDir = $defaultSortOrder;
    } else {
        if ($pageDirOrderDir == 1) {
            $pageDirOrderDir = "ASC";
        } else {
            $pageDirOrderDir = "DESC";
        }
    }
    if ($pageDirPerPage > 0) {
        $pageDirLimit = $pageDirFrom - 1 . ',' . $pageDirPerPage;
    }
    sKoala()->queueScript('$K.yg_pageDirUpdate(\'' . sRequest()->parameters['win_no'] . '\', ' . $pageDirPage . ', ' . $pageDirPerPage . ', ' . $pageDirMaxPages . ', \'' . $pageDirOrderBy . '\', \'' . $pageDirOrderDir . '\', ' . $pageDirFrom . ', \'' . $pageDirLimit . '\');');
    if ($pageDirPerPage == -1) {
        $itext = sItext();
        $pageDirPerPage = $itext['TXT_PAGEDIR_SHOWALL_SHORT'] != '' ? $itext['TXT_PAGEDIR_SHOWALL_SHORT'] : '$TXT_PAGEDIR_SHOWALL_SHORT';
    }
    sSmarty()->assign('pageDirPage', $pageDirPage);
    sSmarty()->assign('pageDirPerPage', $pageDirPerPage);
    sSmarty()->assign('pageDirMaxPages', $pageDirMaxPages);
    return array('pageDirOrderBy' => $pageDirOrderBy, 'pageDirOrderDir' => $pageDirOrderDir, 'pageDirLimit' => $pageDirLimit, 'pageDirMaxPages' => $pageDirMaxPages);
}