Commit 32af879f authored by fettesvieh's avatar fettesvieh

moved some files around and implemented first part @ dynamically including...

moved some files around and implemented first part @ dynamically including stylesheets and javascript code
parent e92899d4
......@@ -5,14 +5,13 @@
<title>{$PAGE_TITLE} :: {$TITLE}</title>
<meta name="description" content="{$DESCRIPTION}" />
<meta name="keywords" content="{$KEYWORDS}" />
<script type="text/javascript" src="{$ROOT_DIR}includes/min/?f={$ROOT_DIR}includes/js/jquery.js,{$ROOT_DIR}includes/js/jquery.cookie.js,{$ROOT_DIR}includes/js/jquery.ui.js"></script>
<script type="text/javascript" src="{$DESIGN_PATH}script.js"></script>
<link rel="stylesheet" type="text/css" href="{$ROOT_DIR}includes/min/?f={$DESIGN_PATH}style.css,{$ROOT_DIR}includes/js/base/jquery-ui.css" />
<script type="text/javascript" src="<!-- JAVASCRIPT -->"></script>
<link rel="stylesheet" type="text/css" href="<!-- STYLESHEET -->" />
<link rel="alternate" type="application/rss+xml" href="{uri args="feeds/list/feed_news"}" title="{$PAGE_TITLE} - {lang values="news|news"}" />
<link rel="alternate" type="application/rss+xml" href="{uri args="feeds/list/feed_files"}" title="{$PAGE_TITLE} - {lang values="files|files"}" />
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="{$DESIGN_PATH}ie.css" />
<script type="text/javascript" defer="defer" src="{$ROOT_DIR}includes/js/pngfix.js"></script>
<script type="text/javascript" defer="defer" src="{$DESIGN_PATH}pngfix.js"></script>
<![endif]-->
</head>
......
......@@ -15,6 +15,8 @@
*/
class modules
{
private static $minify = array();
/**
* Überpüft, ob ein Modul überhaupt existiert,
* bzw. der Benutzer auf ein Modul Zugriff hat
......@@ -90,6 +92,11 @@ class modules
}
return -1;
}
public static function minify($mode)
{
$defaults = $mode == 'js' ? 'jquery.js,jquery.cookie.js,jquery.ui.js,script.js' : 'style.css,jquery-ui.css';
return ROOT_DIR . 'includes/min/?b=' . substr(DESIGN_PATH, 1, -1) . '&amp;f=' . $defaults . (!empty(self::$minify[$mode]) ? implode(',', $minify[$mode]) : '');
}
/**
* Gibt ein alphabetisch sortiertes Array mit allen gefundenen
* Modulen des ACP3 mitsamt Modulinformationen aus
......@@ -112,6 +119,41 @@ class modules
}
return $mod_list;
}
/**
* Gibt die Seite aus
*/
public static function outputPage() {
global $auth, $date, $db, $lang, $tpl, $uri;
if (!$auth->isUser() && defined('IN_ADM') && uri($uri->query) != uri('acp/users/login')) {
redirect('acp/users/login');
}
switch (modules::check()) {
// Seite ausgeben
case 1:
require ACP3_ROOT . 'modules/' . $uri->mod . '/' . $uri->page . '.php';
// Evtl. gesetzten Content-Type des Servers überschreiben
header('Content-Type: ' . (defined('CUSTOM_CONTENT_TYPE') ? CUSTOM_CONTENT_TYPE : 'text/html') . '; charset=UTF-8');
$tpl->assign('TITLE', breadcrumb::output(2));
$tpl->assign('BREADCRUMB', breadcrumb::output());
$tpl->assign('CONTENT', !empty($content) ? $content : '');
// Falls ein Modul ein eigenes Layout verwenden möchte, dieses auch zulassen
$output = $tpl->fetch(defined('CUSTOM_LAYOUT') ? CUSTOM_LAYOUT : 'layout.html');
echo str_replace(array('<!-- STYLESHEET -->', '<!-- JAVASCRIPT -->'), array(modules::minify('css'), modules::minify('js')), $output);
break;
// Kein Zugriff auf die Seite
case 0:
redirect('errors/403');
break;
// Seite nicht gefunden
default:
redirect('errors/404');
}
}
/**
* Durchläuft für das angeforderte Modul den <info> Abschnitt in der
* module.xml und gibt die gefundenen Informationen als Array zurück
......@@ -137,6 +179,8 @@ class modules
'name' => isset($mod_info['name']['lang']) && $mod_info['name']['lang'] == 'true' ? $lang->t($module, $module) : $mod_info['name'],
'tables' => !empty($mod_info['tables']) ? explode(',', $mod_info['tables']) : false,
'categories' => isset($mod_info['categories']) ? true : false,
'javascript' => isset($mod_info['javascript']) ? true : false,
'stylesheet' => isset($mod_info['stylesheet']) ? true : false,
'protected' => isset($mod_info['protected']) ? true : false,
);
return $parsed_modules[$module];
......
......@@ -18,7 +18,7 @@ if (!defined('INSTALLED')) {
}
// Wenn der DEBUG Modus aktiv ist, Fehler ausgeben
$reporting_level =defined('DEBUG') && DEBUG ? E_ALL | E_STRICT : 0;
$reporting_level = defined('DEBUG') && DEBUG ? E_ALL | E_STRICT : 0;
error_reporting($reporting_level);
function __autoload($className)
......@@ -30,6 +30,7 @@ function __autoload($className)
define('PHP_SELF', htmlentities($_SERVER['SCRIPT_NAME']));
$php_self = dirname(PHP_SELF);
define('ROOT_DIR', $php_self != '/' ? $php_self . '/' : '/');
define('DESIGN_PATH', ROOT_DIR . 'designs/' . CONFIG_DESIGN . '/');
// Smarty einbinden
define('SMARTY_DIR', ACP3_ROOT . 'includes/smarty/');
......@@ -48,7 +49,7 @@ if (!is_writable($tpl->compile_dir)) {
$tpl->assign('PHP_SELF', PHP_SELF);
$tpl->assign('REQUEST_URI', htmlentities($_SERVER['REQUEST_URI']));
$tpl->assign('ROOT_DIR', ROOT_DIR);
$tpl->assign('DESIGN_PATH', ROOT_DIR . 'designs/' . CONFIG_DESIGN . '/');
$tpl->assign('DESIGN_PATH', DESIGN_PATH);
$tpl->assign('LANG', CONFIG_LANG);
$tpl->assign('PAGE_TITLE', CONFIG_SEO_TITLE);
$tpl->assign('KEYWORDS', CONFIG_SEO_META_KEYWORDS);
......
......@@ -9,28 +9,5 @@
define('ACP3_ROOT', './');
require ACP3_ROOT . 'includes/common.php';
if (!$auth->isUser() && defined('IN_ADM') && $uri->mod != 'users' && $uri->page != 'login') {
redirect('acp/users/login');
}
switch (modules::check()) {
case 1:
include ACP3_ROOT . 'modules/' . $uri->mod . '/' . $uri->page . '.php';
// Evtl. gesetzten Content-Type des Servers überschreiben
header('Content-Type: ' . (defined('CUSTOM_CONTENT_TYPE') ? CUSTOM_CONTENT_TYPE : 'text/html') . '; charset=UTF-8');
$tpl->assign('TITLE', breadcrumb::output(2));
$tpl->assign('BREADCRUMB', breadcrumb::output());
$tpl->assign('CONTENT', !empty($content) ? $content : '');
// Falls ein Modul ein eigenes Layout verwenden möchte, dieses auch zulassen
$tpl->display(defined('CUSTOM_LAYOUT') ? CUSTOM_LAYOUT : 'layout.html');
break;
case 0:
redirect('errors/403');
break;
default:
redirect('errors/404');
}
modules::outputPage();
?>
\ No newline at end of file
......@@ -3,12 +3,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$LANG}" lang="{$LANG}">
<head>
<title>ACP3 {lang values="installation|installation"} :: {$title}</title>
<script type="text/javascript" src="{$ROOT_DIR}../includes/js/jquery.js"></script>
<script type="text/javascript" src="{$ROOT_DIR}../includes/js/jquery.cookie.js"></script>
<script type="text/javascript" src="{$ROOT_DIR}../includes/js/jquery.ui.js"></script>
<script type="text/javascript" src="{$ROOT_DIR}../designs/acp3/jquery.js"></script>
<script type="text/javascript" src="{$ROOT_DIR}../designs/acp3/jquery.cookie.js"></script>
<script type="text/javascript" src="{$ROOT_DIR}../designs/acp3/jquery.ui.js"></script>
<script type="text/javascript" src="{$ROOT_DIR}design/script.js"></script>
<link rel="stylesheet" type="text/css" href="{$ROOT_DIR}design/style.css" />
<link rel="stylesheet" type="text/css" href="{$ROOT_DIR}../includes/js/base/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="{$ROOT_DIR}../designs/acp3/jquery-ui.css" />
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="{$ROOT_DIR}design/ie.css" />
<![endif]-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment