/** 
	@brief Entry point for the setup program
*/
function main()
{
    header('Content-Type: text/plain');
    if (ReadGETInt('really_sure', 0)) {
        DoSetup();
    } else {
        die(GetLocalizedString('setup-confirm'));
    }
}
示例#2
0
function LoginAPI($databasename, $user, $password)
{
    global $PathPrefix;
    // For included files
    include '../config.php';
    // Include now for the error code values.
    include '../includes/UserLogin.php';
    /* Login checking and setup */
    $RetCode = array();
    // Return result.
    if (!isset($_SESSION['DatabaseName']) or $_SESSION['DatabaseName'] == '') {
        // Establish the database connection for this session.
        $_SESSION['DatabaseName'] = $databasename;
        /* Drag in the code to connect to the DB, and some other
         * functions.  If the connection is established, the
         * variable $db will be set as the DB connection id.
         * NOTE:  This is needed here, as the api_session.inc file
         * does NOT include this if there is no database name set.
         */
        include '../includes/ConnectDB.inc';
        //  Need to ensure we have a connection.
        if (!isset($db)) {
            $RetCode[0] = NoAuthorisation;
            $RetCode[1] = UL_CONFIGERR;
            return $RetCode;
        }
        $_SESSION['db'] = $db;
        // Set in above include
    }
    $rc = userLogin($user, $password, $_SESSION['db']);
    switch ($rc) {
        case UL_OK:
            $RetCode[0] = 0;
            // All is well
            DoSetup();
            // Additional setting up
            break;
        case UL_NOTVALID:
        case UL_BLOCKED:
        case UL_CONFIGERR:
        case UL_SHOWLOGIN:
            //  Following not in use at 18 Nov 09.
        //  Following not in use at 18 Nov 09.
        case UL_MAINTENANCE:
            /*  Just return an error for now */
            $RetCode[0] = NoAuthorisation;
            $RetCode[1] = $rc;
            break;
    }
    return $RetCode;
}