|
|
@@ -1,30 +1,42 @@
|
|
|
<?php
|
|
|
- $args = ( $_SERVER['REQUEST_METHOD'] == 'POST' ? $_POST : $_GET );
|
|
|
+
|
|
|
+ // Setup includes to work right. Much of this is duped in Config.inc, but gotta get this info to include it, so..
|
|
|
$user_info = posix_getpwuid(posix_geteuid());
|
|
|
- // Probably the 'sanest' default I could think of when you have no homedir
|
|
|
$dir = ( $user_info['dir'] ? $user_info['dir'] : '/var/www/' );
|
|
|
$basedir = ( file_exists( $dir . "/.tCMS_basedir") ? file_get_contents("$dir/.tCMS_basedir") : "$dir/.tCMS" );
|
|
|
+ set_include_path(get_include_path() . PATH_SEPARATOR . "$basedir/lib");
|
|
|
+ require_once "tCMS/Config.inc";
|
|
|
+
|
|
|
+ // Get the config, set the theme (also set the basedir so we don't have to fetch it again).
|
|
|
+ $conf_obj->set_base_dir($basedir);
|
|
|
+ $conf_obj = new Config;
|
|
|
+ $config = $conf_obj->get();
|
|
|
+ $theme = ( !array_key_exists( 'theme', $config ) || empty($config['theme']) ? 'default' : $config['theme'] );
|
|
|
+ $themedir = "$basedir/templates/$theme";
|
|
|
+
|
|
|
+ // Begin dispatch
|
|
|
+ $args = ( $_SERVER['REQUEST_METHOD'] == 'POST' ? $_POST : $_GET );
|
|
|
if( !empty($args['app']) && $args['app'] == 'login' ) {
|
|
|
- include("login.inc");
|
|
|
+ include "$themedir/admin/login.inc";
|
|
|
die();
|
|
|
} elseif( !empty($args['app']) && $args['app'] == 'logout' ) {
|
|
|
- include("logout.inc");
|
|
|
+ include "$themedir/admin/logout.inc";
|
|
|
die();
|
|
|
} else {
|
|
|
- include_once("$basedir/lib/auth.inc");
|
|
|
- $auth = new auth;
|
|
|
+ require_once "tCMS/Auth.inc";
|
|
|
+ $auth = new Auth;
|
|
|
$auth->ensure_auth();
|
|
|
}
|
|
|
if( empty($args['app']) || $args['app'] == 'config' ) {
|
|
|
- $kontent = "settings.inc";
|
|
|
+ $kontent = "$themedir/admin/settings.inc";
|
|
|
} elseif ($args['app'] == 'blog') {
|
|
|
- $kontent = "bengine.inc";
|
|
|
+ $kontent = "$themedir/admin/bengine.inc";
|
|
|
} elseif ($args['app'] == 'microblog') {
|
|
|
- $kontent = "mbengine.inc";
|
|
|
+ $kontent = "$themedir/admin/mbengine.inc";
|
|
|
} elseif ($args['app'] == 'users' ) {
|
|
|
- $kontent = "users.inc";
|
|
|
+ $kontent = "$themedir/admin/users.inc";
|
|
|
} else {
|
|
|
- $kontent = "settings.inc";
|
|
|
+ $kontent = "$themedir/admin/settings.inc";
|
|
|
}
|
|
|
?>
|
|
|
<!doctype html>
|
|
|
@@ -33,20 +45,17 @@
|
|
|
<meta charset="utf-8" />
|
|
|
<meta name="description" content="tCMS Control Panel"/>
|
|
|
<meta name="viewport" content="width=device-width">
|
|
|
- <link rel="stylesheet" type="text/css" href="../../css/structure.css" />
|
|
|
- <link rel="stylesheet" type="text/css" href="../../css/screen.css" media="screen" />
|
|
|
- <link rel="stylesheet" type="text/css" href="../../css/print.css" media="print" />
|
|
|
<?php
|
|
|
- if(file_exists('../../css/custom/avatars.css')) {
|
|
|
- echo '<link rel="stylesheet" type="text/css" href="../../css/custom/avatars.css" />';
|
|
|
- } else {
|
|
|
- echo '<link rel="stylesheet" type="text/css" href="../../css/avatars.css" />';
|
|
|
- }
|
|
|
+ $links = '<link rel="stylesheet" type="text/css" href="../../themed/' . $theme . '/css/structure.css" />';
|
|
|
+ $links += '<link rel="stylesheet" type="text/css" href="../../themed/' . $theme . '/css/screen.css" media="screen" />';
|
|
|
+ $links += '<link rel="stylesheet" type="text/css" href="../../themed/' . $theme . '/css/print.css" media="print" />';
|
|
|
+ $links += '<link rel="icon" type="image/vnd.microsoft.icon" href="../../themed/' . $theme . '/img/icon/favicon.ico" />';
|
|
|
+ echo $links;
|
|
|
+
|
|
|
+ // TODO inject avatars these via style tags based on config
|
|
|
?>
|
|
|
- <link rel="icon" type="image/vnd.microsoft.icon" href="../../img/icon/favicon.ico" />
|
|
|
<title>tCMS Admin</title>
|
|
|
<?php
|
|
|
- $config = @json_decode(@file_get_contents("$basedir/config/main.json"),true);
|
|
|
?>
|
|
|
</head>
|
|
|
<body>
|