예제 #1
0
    $smarty->assign("rtl", language_is_rtl($lang));
    $smarty->display(get_template_path('headers.tpl'));
    $smarty->assign("version", FD_VERSION);
    $smarty->display(get_template_path('login.tpl'));
    exit;
}
/*****************************************************************************
 *                               M   A   I   N                               *
 *****************************************************************************/
/* Set error handler to own one, initialize time calculation
   and start session. */
session::start();
session::set('errorsAlreadyPosted', array());
/* Destroy old session if exists.
   Else you will get your old session back, if you not logged out correctly. */
if (is_array(session::get_all()) && count(session::get_all())) {
    session::destroy();
    session::start();
}
$username = "";
/* Reset errors */
session::set('errors', "");
session::set('errorsAlreadyPosted', "");
session::set('LastError', "");
/* Check if we need to run setup */
if (!file_exists(CONFIG_DIR . "/" . CONFIG_FILE)) {
    header("location:setup.php");
    exit;
}
/* Reset errors */
session::set('errors', "");
예제 #2
0
require_once "variables.inc";
/* Set header */
header("Content-type: text/html; charset=UTF-8");
/* Set the text domain as 'fusiondirectory' */
$domain = 'fusiondirectory';
bindtextdomain($domain, LOCALE_DIR);
textdomain($domain);
/* Remember everything we did after the last click */
session::start();
session::set('errorsAlreadyPosted', array());
session::global_set('runtime_cache', array());
session::set('limit_exceeded', FALSE);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    @DEBUG(DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, "_POST");
}
@DEBUG(DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, session::get_all(), "_SESSION");
/* Logged in? Simple security check */
if (!session::global_is_set('connected')) {
    new log('security', 'login', '', array(), 'main.php called without session - logging out');
    header('Location: index.php?message=nosession');
    exit;
}
/* Check for uniqe ip address */
$ui = session::global_get('ui');
if ($_SERVER['REMOTE_ADDR'] != $ui->ip) {
    new log('security', 'login', '', array(), 'main.php called with session which has a changed IP address.');
    header('Location: index.php?signout=1&message=newip');
    exit;
}
$config = session::global_get('config');
/* If SSL is forced, just forward to the SSL enabled site */
예제 #3
0
 public static function route($config, $re_route)
 {
     $router_vars = self::get_router_vars($config);
     if (count($router_vars) > 1) {
         if (utils::key_exists(array($router_vars['controller']), $re_route)) {
             if (in_array($router_vars['action'], $re_route[$router_vars['controller']])) {
                 $router_vars['controller'] = $router_vars['action'];
                 $router_vars['action'] = !empty($router_vars['fnc_args']) ? $router_vars['fnc_args'][0] : $config['action'];
                 if (count($router_vars['fnc_args']) > 1) {
                     array_shift($router_vars['fnc_args']);
                 } else {
                     $router_vars['fnc_args'] = array();
                 }
             }
         }
     }
     if ($router_vars['controller'] == "base") {
         $router_vars['controller'] = $config['class'];
     }
     if (!file_exists(APP . 'controllers' . DS . $router_vars['controller'] . '.php')) {
         throw new NotFoundException();
     }
     require_once APP . 'controllers' . DS . $router_vars['controller'] . '.php';
     if (!class_exists($router_vars['controller'])) {
         throw new NotFoundException();
     }
     $instance = new $router_vars['controller']();
     if (!method_exists($instance, $router_vars['action'])) {
         throw new NotFoundException();
     }
     $instance->{$router_vars}['action']($router_vars['fnc_args'], $router_vars['gets']);
     if (DEBUG) {
         debug::set("router", "router", $router_vars);
         debug::set("session", "session", session::get_all());
         debug::show();
     }
 }