Exemplo n.º 1
0
            }
        } else {
            $args->currentUser = $_SESSION['currentUser'];
            logAuditEvent(TLS("audit_login_succeeded", $args->login, $_SERVER['REMOTE_ADDR']), "LOGIN", $args->currentUser->dbID, "users");
            if ($args->action == 'ajaxlogin') {
                echo json_encode(array('success' => true));
            } else {
                redirect($_SESSION['basehref'] . "index.php" . ($args->preqURI ? "?reqURI=" . urlencode($args->preqURI) : ""));
            }
        }
        break;
    case 'ajaxcheck':
        doSessionStart();
        unset($_SESSION['basehref']);
        setPaths();
        $validSession = checkSessionValid($db, false);
        // Send a json reply, include localized strings for use in js to display a login form.
        echo json_encode(array('validSession' => $validSession, 'username_label' => lang_get('login_name'), 'password_label' => lang_get('password'), 'login_label' => lang_get('btn_login')));
        break;
    case 'loginform':
        $doRender = true;
        break;
}
// BUGID 0003129
if ($doRender) {
    $logPeriodToDelete = config_get('removeEventsOlderThan');
    $g_tlLogger->deleteEventsFor(null, strtotime("-{$logPeriodToDelete} days UTC"));
    $smarty = new TLSmarty();
    $smarty->assign('gui', $gui);
    $smarty->display($templateCfg->default_template);
}
Exemplo n.º 2
0
/**
 * 
 *
 */
function processAjaxCheck(&$dbHandler)
{
    // Send a json reply, include localized strings for use in js to display a login form.
    doSessionStart(true);
    echo json_encode(array('validSession' => checkSessionValid($dbHandler, false), 'username_label' => lang_get('login_name'), 'password_label' => lang_get('password'), 'login_label' => lang_get('btn_login'), 'timeout_info' => lang_get('timeout_info')));
}
Exemplo n.º 3
0
/**
 * General GUI page initialization procedure
 * - init session
 * - init database
 * - check rights
 * - initialize project data (if requested)
 * 
 * @param integer $db DB connection identifier
 * @param boolean $initProject (optional) Set true if adjustment of Product or
 * 		Test Plan is required; default is FALSE
 * @param boolean $bDontCheckSession (optional) Set to true if no session should be
 * 		 started
 */
function testlinkInitPage(&$db, $initProject = FALSE, $bDontCheckSession = false, $userRightsCheckFunction = null)
{
    doSessionStart();
    setPaths();
    set_dt_formats();
    doDBConnect($db);
    static $pageStatistics = null;
    if (!$pageStatistics && config_get('log_level') == 'EXTENDED') {
        $pageStatistics = new tlPageStatistics($db);
    }
    if (!$bDontCheckSession) {
        checkSessionValid($db);
    }
    if ($userRightsCheckFunction) {
        checkUserRightsFor($db, $userRightsCheckFunction);
    }
    // adjust Product and Test Plan to $_SESSION
    if ($initProject) {
        initProject($db, $_REQUEST);
    }
    // used to disable the attachment feature if there are problems with repository path
    /** @TODO this check should not be done anytime but on login and using */
    global $g_repositoryType;
    global $g_attachments;
    global $g_repositoryPath;
    $g_attachments->disabled_msg = "";
    if ($g_repositoryType == TL_REPOSITORY_TYPE_FS) {
        $ret = checkForRepositoryDir($g_repositoryPath);
        if (!$ret['status_ok']) {
            $g_attachments->enabled = FALSE;
            $g_attachments->disabled_msg = $ret['msg'];
        }
    }
}
        $featureMgr =& $tplanMgr;
        break;
}
if ($args->featureID && $args->doUpdate && $featureMgr) {
    if (checkRightsForUpdate($db, $args->user, $args->testprojectID, $args->featureType, $args->featureID)) {
        doUpdate($db, $args, $featureMgr);
        if ($gui->user_feedback == '') {
            $gui->user_feedback = $gui->roles_updated;
        }
    }
}
// --------------------------------------------------------------------------
// Important:
// Must be done here after having done update, to get current information
$gui->users = tlUser::getAll($db, "WHERE active=1", null, null, tlUser::TLOBJ_O_GET_DETAIL_MINIMUM);
checkSessionValid($db);
$args->user = $_SESSION['currentUser'];
// --------------------------------------------------------------------------
switch ($assignRolesFor) {
    case 'testproject':
        $info = getTestProjectEffectiveRoles($db, $tprojectMgr, $args, $gui->users);
        list($gui->userFeatureRoles, $gui->features, $gui->featureID) = $info;
        $target->testprojectID = $gui->featureID;
        break;
    case 'testplan':
        $info = getTestPlanEffectiveRoles($db, $tplanMgr, $tprojectMgr, $args, $gui->users);
        if (is_null($info)) {
            $gui->user_feedback = lang_get('no_test_plans_available');
        }
        list($gui->userFeatureRoles, $gui->features, $gui->featureID) = $info;
        break;
Exemplo n.º 5
0
function dashboardInit()
{
    # connect to the datbase
    doDBConnect() or die("Could not connect to DB");
    ini_set('session.gc_maxlifetime', 7200);
    ini_set('session.gc_probability', 1);
    ini_set('session.gc_divisor', 1);
    ini_set('session.bug_compat_42', 0);
    ini_set('session.bug_compat_warn', 0);
    session_save_path("/var/lib/php5/");
    session_get_cookie_params();
    session_start();
    setPaths();
    checkSessionValid();
}
Exemplo n.º 6
0
/**
 * General GUI page initialization procedure
 * - init session
 * - init database
 * 
 * @param integer $db DB connection identifier
 * @param boolean $checkSession (optional) 
 */
function testlinkInitPage(&$db, $checkSession = true)
{
    doSessionStart();
    setPaths();
    set_dt_formats();
    doDBConnect($db);
    static $pageStatistics = null;
    if (!$pageStatistics && config_get('log_level') == 'EXTENDED') {
        $pageStatistics = new tlPageStatistics($db);
    }
    if ($checkSession) {
        checkSessionValid($db);
    }
}