Exemplo n.º 1
0
// Shutdown function
register_shutdown_function(array("CApp", "checkPeace"));
if (!@CSQLDataSource::get("std")) {
    CApp::goOffline("db-access");
}
CMbPerformance::mark("init");
require __DIR__ . "/includes/session.php";
CMbPerformance::mark("session");
// Start chrono (after session_start as it may be locked by another request)
CApp::$chrono = new Chronometer();
CApp::$chrono->main = true;
CApp::$chrono->start();
$do_login = false;
// Load default preferences if not logged in
if (!CAppUI::$instance->user_id) {
    CAppUI::loadPrefs();
    try {
        CApp::notify("UserAuthentication", true);
    } catch (CUserAuthenticationFailure $e) {
        CApp::rip();
    } catch (CUserAuthenticationSuccess $e) {
        CAppUI::$auth_info = $e;
        $do_login = true;
    }
}
// Update session lifetime
CSessionHandler::setUserDefinedLifetime();
/*
try {
  include __DIR__."/classes/CAuth.class.php";
  //CAuth::login();
Exemplo n.º 2
0
<?php

require_once 'base.php';
require_once W2P_BASE_DIR . '/includes/config.php';
require_once W2P_BASE_DIR . '/includes/main_functions.php';
require_once W2P_BASE_DIR . '/includes/db_adodb.php';
require_once W2P_BASE_DIR . '/classes/ui.class.php';
$AppUI = new CAppUI();
$token = w2PgetParam($_GET, 'token', '');
$format = w2PgetParam($_GET, 'format', 'ical');
$userId = CUser::getUserIdByToken($token);
$AppUI->loadPrefs($userId);
$AppUI->user_id = $userId;
$AppUI->setUserLocale();
@(include_once W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/locales.php');
include_once W2P_BASE_DIR . '/locales/core.php';
switch ($format) {
    //TODO: We only output in vCal, are there others we need to consider?
    case 'vcal':
    default:
        $format = 'vcal';
        header('Content-Type: text/calendar');
        header('Content-disposition: attachment; filename="calendar.ics"');
        break;
}
if ($userId > 0) {
    $moduleList = $AppUI->getLoadableModuleList();
    $myTimezoneName = date('e');
    $calendarHeader = "BEGIN:VCALENDAR\nPRODID:-//web2project//EN\nVERSION:2.0\nCALSCALE:GREGORIAN\nMETHOD:PUBLISH\nX-WR-TIMEZONE:{$myTimezoneName}\n";
    $calendarFooter = "END:VCALENDAR";
    //TODO: get the users' timezone for display processes