Projet

Général

Profil

publicLet.inc.php

Philippe Roy, 18/03/2013 09:20

Télécharger (2,81 ko)

 
1
<?php
2
/*
3
 * Copyright 2007-2011 Charles du Jeu <contact (at) cdujeu.me>
4
 * This file is part of AjaXplorer.
5
 *
6
 * AjaXplorer is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * AjaXplorer is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License
17
 * along with AjaXplorer.  If not, see <http://www.gnu.org/licenses/>.
18
 *
19
 * The latest code can be found at <http://www.ajaxplorer.info/>.
20
 *
21
 * Description : Specific inclusion to run publiclet scripts
22
 */
23
require_once("base.conf.php");
24

    
25
$pServ = AJXP_PluginsService::getInstance();
26
ConfService::init();
27
$confPlugin = ConfService::getInstance()->confPluginSoftLoad($pServ);
28
$pServ->loadPluginsRegistry(AJXP_INSTALL_PATH."/plugins", $confPlugin);
29
ConfService::start();
30
$authDriver = ConfService::getAuthDriverImpl();
31
$confDriver = ConfService::getConfStorageImpl();
32
require_once($confDriver->getUserClassFileName());
33

    
34
// -------------------------------------------------------
35
// FIXME : on impose authentification CAS
36
// -------------------------------------------------------
37
session_name("AjaXplorer");
38
session_start();
39

    
40
if(AuthService::usersEnabled())
41
{
42
    $httpVars = array_merge($_GET, $_POST);
43

    
44
    AuthService::logUser(null, null);
45
    // Check that current user can access current repository, try to switch otherwise.
46
    $loggedUser = AuthService::getLoggedUser();
47
    if($loggedUser == null)
48
    {
49
        // Try prelogging user if the session expired but the logging data is in fact still present
50
        // For example, for basic_http auth.
51
        AuthService::preLogUser((isSet($httpVars["remote_session"])?$httpVars["remote_session"]:""));
52
        $loggedUser = AuthService::getLoggedUser();
53
        if($loggedUser == null) $requireAuth = true;
54
    }
55
    if($loggedUser != null)
56
    {
57
           $res = ConfService::switchUserToActiveRepository($loggedUser, (isSet($httpVars["tmp_repository_id"])?$httpVars["tmp_repository_id"]:"-1"));
58
           if(!$res){
59
               AuthService::disconnect();
60
               $requireAuth = true;
61
           }
62
    }
63

    
64
}else{
65
    AJXP_Logger::debug(ConfService::getCurrentRootDirIndex());
66
}
67

    
68
// -------------------------------------------------------
69

    
70
require_once(AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/action.share/class.ShareCenter.php");
71

    
72
$fakes = '
73
// Non working exception class
74
class AJXP_Exception extends Exception
75
{
76
    public function AJXP_Exception($msg) { echo "$msg"; exit(); }
77
}';
78

    
79
eval($fakes);
80

    
81
?>