152 lines
4.0 KiB
PHP
152 lines
4.0 KiB
PHP
<?php
|
|
/**
|
|
* @version $Id: admin_init.php 10381 2008-06-01 03:35:53Z pasamio $
|
|
* @package Easyshop
|
|
* @copyright Copyright (C) 2005 - 2010 TA-EDV
|
|
* @license proprietary
|
|
* @author Richard Kammermayer <rk@ta-edv.de>
|
|
* Easyshop is a web shop system
|
|
*/
|
|
|
|
// PRODUCTION MODE - Keine Warnings im Admin!
|
|
ini_set('display_errors', 0);
|
|
ini_set('display_startup_errors', 0);
|
|
error_reporting(0);
|
|
|
|
// including libs
|
|
include_once './libs/smarty/libs/Smarty.class.php';
|
|
include_once './modules/admin_layout.class.php';
|
|
include_once './core/manufacturer.class.php';
|
|
|
|
$layout_object = new admin_layout();
|
|
$layout_object->start($base_object);
|
|
|
|
Registry::set('layout_object', $layout_object);
|
|
|
|
// configuration settings
|
|
$layout_object->assign('system_configuration', $base_object->config->shopConfiguration);
|
|
|
|
// start session
|
|
@session_start();
|
|
|
|
// login
|
|
if (isset($_POST['shopLogin'])) {
|
|
$logindata = $_POST['shopLogin'];
|
|
$request = $base_object->customer->login($logindata['user'],$logindata['pass']);
|
|
}
|
|
// logout
|
|
if (isset($_GET['logout'])) {
|
|
$base_object->customer->logout();
|
|
}
|
|
|
|
if ($base_object->customer->auth() == 2 || !empty($_FILES)) {
|
|
|
|
// get default domain config user language
|
|
include_once './core/language.class.php';
|
|
$language_object = new Language($base_object);
|
|
$languages = $language_object->get_all_objects();
|
|
$layout_object->assign('content_languages', $languages);
|
|
|
|
// translation text
|
|
$base_object->i18n->get_shopadmin_text($base_object->customer->get_config_item('admin_language'));
|
|
$layout_object->assign('translation_text', $base_object->i18n->shopadmin_translation);
|
|
|
|
// gat admin permissions
|
|
$admin_role_data = array();
|
|
if ($base_object->customer->admin_role_id) {
|
|
$base_object->admin_role->id = $base_object->customer->admin_role_id;
|
|
$admin_role_data = $base_object->admin_role->get_data();
|
|
}
|
|
|
|
// get admin menu data
|
|
$menudata = $layout_object->get_admin_menu($admin_role_data);
|
|
$layout_object->assign('menudata', $menudata);
|
|
|
|
// if logged in
|
|
$maincontent = '';
|
|
|
|
if (empty($_GET['admin_modul'])) {
|
|
$admin_module = 'admin_dashboard';
|
|
} else {
|
|
$admin_module = $_GET['admin_modul'];
|
|
}
|
|
|
|
// date
|
|
$actual_date = array(
|
|
'weekday' => date('l'),
|
|
'date' => date("Y-m-d")
|
|
);
|
|
$actual_date['date'] = $base_object->i18n->convert_date($actual_date['date']);
|
|
$layout_object->assign('actual_date',$actual_date);
|
|
|
|
// header stats
|
|
include_once './core/stats.class.php';
|
|
$header_stats = Stats::get_stats();
|
|
$layout_object->assign('header_stats',$header_stats);
|
|
|
|
// customer data
|
|
$layout_object->assign('admin_user', $base_object->customer);
|
|
|
|
// load modules
|
|
if (isset($admin_module) && $admin_module) {
|
|
$module_file = 'modules/'.$admin_module.'.php';
|
|
|
|
if(file_exists($module_file)) {
|
|
include_once $module_file;
|
|
|
|
$modul_object = new $admin_module($base_object, $layout_object);
|
|
|
|
$maincontent = $modul_object->run();
|
|
} else {
|
|
$maincontent = $layout_object->fetch('404.tpl');
|
|
}
|
|
}
|
|
|
|
|
|
$layout_object->assign('maincontent', $maincontent);
|
|
$layout_object->assign('URL', MAIN_URL);
|
|
|
|
if (isset($_GET['m_active'])) {
|
|
$_SESSION['easyshop']['m_active'] = $_GET['m_active'];
|
|
}
|
|
elseif (isset($_SESSION['easyshop']['m_active'])) {
|
|
$_GET['m_active'] = $_SESSION['easyshop']['m_active'];
|
|
}
|
|
else {
|
|
$_GET['m_active'] = 0;
|
|
}
|
|
$layout_object->assign('menu_active', $_GET['m_active']);
|
|
|
|
$mod = false;
|
|
|
|
if(isset($_GET['mod'])) {
|
|
$mod = $_GET['mod'];
|
|
} elseif(isset($_POST['mod'])) {
|
|
$mod = $_POST['mod'];
|
|
}
|
|
|
|
if($mod && ($mod == 'ajax')) {
|
|
$site = $layout_object->fetch('ajax.tpl');
|
|
} elseif($mod && ($mod == 'set_data')) {
|
|
$site = $layout_object->fetch('ajax.tpl');
|
|
} elseif($mod && ($mod == 'json')) {
|
|
// no layout for this
|
|
} elseif($admin_module == 'admin2000') {
|
|
// Admin2000 runs standalone with its own HTML structure
|
|
// No legacy main.tpl wrapper needed
|
|
$site = $maincontent;
|
|
} else {
|
|
$site = $layout_object->fetch('main.tpl');
|
|
}
|
|
|
|
echo $site;
|
|
|
|
} else {
|
|
// if not logged in
|
|
// show admin login
|
|
echo $layout_object->fetch('admin_login.tpl');
|
|
//header("Location: " . MAIN_URL);
|
|
}
|
|
|
|
?>
|