Пример #1
0
<?php

require '../private/vendor/autoload.php';
function get_page_action()
{
    if (!empty($_GET['action'])) {
        $action = $_GET['action'];
        $action = basename($action);
    } else {
        $action = "home";
    }
    return $action;
}
function get_page_path($action)
{
    $content_dir = $_SERVER['DOCUMENT_ROOT'] . '/../private/content/';
    $page_path = $content_dir . "/{$action}.php";
    if (file_exists($page_path)) {
        return $page_path;
    } else {
        return "error/404.html";
    }
}
$action = get_page_action();
$path = get_page_path($action);
$TPL;
include $path;
Пример #2
0
 function init()
 {
     global $imap;
     global $conf;
     global $include_path;
     global $phpversion;
     global $conf;
     global $fd;
     if (isset($_POST['rs']) && isset($_POST['rsrnd'])) {
         $this->is_ajax = true;
     }
     if (isset($_GET['anchor'])) {
         $this->page_anchor = $_GET['anchor'];
     }
     if ($phpversion < 5) {
         if ($this->default_timezone) {
             echo 'FATAL: Default Timezone support requires php5';
             die;
         }
     } elseif ($this->random_session_id && $phpversion < 5.1) {
         echo 'FATAL: Random session IDs requires php5 >= 5.1';
         die;
     }
     $this->get_user_agent();
     $this->sub_class_names = get_page_action($_GET, $_POST);
     if ($this->user_agent_class == 'palm' || $this->user_agent_class == 'simple') {
         if (isset($conf['no_simplemode_cookies']) and $conf['no_simplemode_cookies']) {
             $this->use_cookies = false;
         }
     }
     if (isset($_POST) && !empty($_POST) && !$this->is_ajax && !isset($_POST['login'])) {
         if ($this->sub_class_names['post']) {
             require_once $include_path . 'lib' . $fd . 'url_action_classes' . $fd . $this->sub_class_names['url'] . '.php';
             require_once $include_path . 'lib' . $fd . 'post_action_class.php';
             require_once $include_path . 'lib' . $fd . 'post_action_classes' . $fd . $this->sub_class_names['post'] . '.php';
             $post_class_name = 'fw_post_action_' . $this->sub_class_names['post'];
             $this->user_action = hm_new($post_class_name);
         } else {
             if ($this->sub_class_names['url']) {
                 require_once $include_path . 'lib' . $fd . 'url_action_classes' . $fd . $this->sub_class_names['url'] . '.php';
             } else {
                 require_once $include_path . 'lib' . $fd . 'url_action_classes' . $fd . 'misc.php';
             }
             require_once $include_path . 'lib' . $fd . 'post_action_class.php';
             $this->user_action = hm_new('fw_user_action_with_post');
         }
     } else {
         if ($this->sub_class_names['url']) {
             require_once $include_path . 'lib' . $fd . 'url_action_classes' . $fd . $this->sub_class_names['url'] . '.php';
             $this->user_action = hm_new('fw_user_action_page');
         } else {
             require_once $include_path . 'lib' . $fd . 'url_action_classes' . $fd . 'misc.php';
             $this->user_action = hm_new('fw_user_action_page');
         }
     }
     if (isset($conf['enable_database']) && $conf['enable_database']) {
         $this->start_database_connection($conf);
     }
     $this->user_session = hm_new('fw_user_session');
     $this->user_action->site_key = $this->site_key;
     $this->user_session->cookie_name = $this->cookie_name;
     $this->user_session->check_session();
     if (!$this->user_session->logout && !$this->user_session->logged_in && isset($conf['basic_http_auth']) && $conf['basic_http_auth']) {
         $this->user_session->check_basic_auth();
         $this->user_session->check_session();
     }
     $this->user_action->allowed_tag_list = $this->allowed_tag_list;
     $this->user_action->default_lang = $this->default_lang;
     $this->user_action->prep_string_factory();
     $this->str = $this->user_action->get_user_strings();
     if ($this->str == -1) {
         $this->str =& $_SESSION['str'];
     }
     $this->admin = $this->user_session->admin;
     if ($this->user_session->logout) {
         $this->login_action = 3;
     } elseif ($this->user_session->login_attempt) {
         if ($this->user_session->logged_in) {
             $this->just_logged_in = true;
             $this->login_action = 1;
         } else {
             if (empty($this->notices)) {
                 if (isset($imap->connected) && !$imap->connected) {
                     $this->notices[] = $this->str[505];
                 } else {
                     $this->notices[] = $this->str[49];
                 }
             }
             $this->login_action = 2;
         }
     }
     $this->set_timezone();
     if ($this->user_session->logged_in) {
         global $conf;
         get_plugins();
         $this->logged_in = true;
         $this->username = $_SESSION['user_data']['username'];
     }
     $this->user_action->process_user_input($this->str);
     if ($this->user_action->post_action) {
         if (empty($this->user_action->errors)) {
             $this->post_action = 1;
             $this->post_vals = $this->user_action->post;
         } else {
             $this->form_vals = $this->user_action->form_vals;
             $this->post_action = 2;
         }
     }
     $this->get_vals = $this->user_action->get;
     if (!empty($this->user_action->errors)) {
         foreach ($this->user_action->errors as $v) {
             $this->notices[] = $v;
         }
     }
     if ($this->user_session->logout) {
         $this->purge_attachments();
         if (isset($conf['logout_url']) && $conf['logout_url']) {
             header('HTTP/1.1 303 Found');
             header('Location: ' . $conf['logout_url']);
             exit;
         }
         $this->notices[] = $this->str[50];
     }
 }