manage is broken
This commit is contained in:
parent
bf7b7bc8b9
commit
edd97209ff
16 changed files with 446 additions and 100 deletions
|
@ -19,7 +19,8 @@
|
|||
"20150427.8",
|
||||
"20150428",
|
||||
"20150429",
|
||||
"20150430"
|
||||
"20150430",
|
||||
"20150501"
|
||||
|
||||
]
|
||||
|
||||
|
@ -846,6 +847,15 @@
|
|||
"change": "Begin work on management panel."
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
"20150501": [
|
||||
|
||||
{
|
||||
"type": "UPD",
|
||||
"change": "Improve error page."
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Sakura;
|
|||
|
||||
class Main {
|
||||
|
||||
public static $_MD; // Markdown class container
|
||||
public static $_IN_MANAGE = false; // Manage thing
|
||||
public static $_MD; // Markdown class container
|
||||
public static $_MANAGE_MODE = false; // Management mode
|
||||
|
||||
// Constructor
|
||||
public static function init($config) {
|
||||
|
@ -29,8 +29,11 @@ class Main {
|
|||
// Create new session
|
||||
Session::init();
|
||||
|
||||
// Check if management mode was requested
|
||||
self::$_MANAGE_MODE = defined('SAKURA_MANAGE');
|
||||
|
||||
// Templating engine
|
||||
Templates::init(Configuration::getConfig('site_style'));
|
||||
Templates::init(self::$_MANAGE_MODE ? Configuration::getConfig('manage_style') : Configuration::getConfig('site_style'));
|
||||
|
||||
// Assign servers file to whois class
|
||||
Whois::setServers(Configuration::getLocalConfig('etc', 'whoisservers'));
|
||||
|
@ -73,7 +76,7 @@ class Main {
|
|||
}
|
||||
|
||||
// Error Handler
|
||||
public static function ErrorHandler($errno, $errstr, $errfile, $errline) {
|
||||
public static function errorHandler($errno, $errstr, $errfile, $errline) {
|
||||
|
||||
// Set some variables to work with including A HUGE fallback hackjob for the templates folder
|
||||
$errstr = str_replace(ROOT, '', $errstr);
|
||||
|
|
12
_sakura/components/Manage.php
Normal file
12
_sakura/components/Manage.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/*
|
||||
* Management Class
|
||||
*/
|
||||
|
||||
namespace Sakura;
|
||||
|
||||
class Manage {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -29,7 +29,7 @@ class Templates {
|
|||
self::$_CFG = self::parseCfg(file_get_contents($confPath));
|
||||
|
||||
// Make sure we're not using a manage template for the main site or the other way around
|
||||
if((self::$_CFG['MANAGE'] && !Main::$_IN_MANAGE) || (!self::$_CFG['MANAGE'] && Main::$_IN_MANAGE))
|
||||
if((bool)self::$_CFG['MANAGE'] != (bool)Main::$_MANAGE_MODE)
|
||||
trigger_error('Incorrect template type', E_USER_ERROR);
|
||||
|
||||
// Start Twig
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Sakura Manage Loader
|
||||
*/
|
||||
|
||||
// Declare namespace
|
||||
namespace Sakura;
|
||||
|
||||
// Require Global loader
|
||||
require_once 'sakura.php';
|
|
@ -8,7 +8,7 @@
|
|||
namespace Sakura;
|
||||
|
||||
// Define Sakura version
|
||||
define('SAKURA_VERSION', '20150430');
|
||||
define('SAKURA_VERSION', '20150501');
|
||||
define('SAKURA_VLABEL', 'Heliotrope');
|
||||
define('SAKURA_VTYPE', 'Development');
|
||||
define('SAKURA_COLOUR', '#DF73FF');
|
||||
|
@ -35,6 +35,7 @@ require_once ROOT .'_sakura/components/Configuration.php';
|
|||
require_once ROOT .'_sakura/components/Templates.php';
|
||||
require_once ROOT .'_sakura/components/Sessions.php';
|
||||
require_once ROOT .'_sakura/components/Users.php';
|
||||
require_once ROOT .'_sakura/components/Manage.php';
|
||||
require_once ROOT .'_sakura/components/Whois.php';
|
||||
require_once ROOT .'_sakura/components/SockChat.php';
|
||||
|
||||
|
@ -48,7 +49,7 @@ else
|
|||
die('<h1>Failed to load database driver.</h1>');
|
||||
|
||||
// Set Error handler
|
||||
set_error_handler(array('Sakura\Main', 'ErrorHandler'));
|
||||
set_error_handler(array('Sakura\Main', 'errorHandler'));
|
||||
|
||||
// Initialise Flashii Class
|
||||
Main::init($sakuraConf);
|
||||
|
@ -57,6 +58,9 @@ Main::init($sakuraConf);
|
|||
$renderData = array(
|
||||
'sakura' => [
|
||||
'version' => SAKURA_VERSION,
|
||||
'vlabel' => SAKURA_VLABEL,
|
||||
'vtype' => SAKURA_VTYPE,
|
||||
'vcolour' => SAKURA_COLOUR,
|
||||
'urls' => Configuration::getLocalConfig('urls'),
|
||||
'charset' => Configuration::getConfig('charset'),
|
||||
'currentpage' => '//'. $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],
|
||||
|
|
7
_sakura/templates/broomcloset/global/footer.tpl
Normal file
7
_sakura/templates/broomcloset/global/footer.tpl
Normal file
|
@ -0,0 +1,7 @@
|
|||
</div>
|
||||
<div class="footer">
|
||||
<div style="color: {{ sakura.vcolour }};">Sakura b{{ sakura.version }} ({{ sakura.vlabel }}/{{ sakura.vtype }})</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
40
_sakura/templates/broomcloset/global/header.tpl
Normal file
40
_sakura/templates/broomcloset/global/header.tpl
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- META -->
|
||||
<meta charset="{{ sakura.charset }}" />
|
||||
<title>{{ page.title }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||
{% if page.redirect %}
|
||||
<meta http-equiv="refresh" content="3; URL={{ page.redirect }}" />
|
||||
{% endif %}
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/global.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/manage.css" />
|
||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
||||
<!-- JS -->
|
||||
<script type="text/javascript" src="{{ sakura.resources }}/js/manage.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<span id="top"></span>
|
||||
<div class="header" id="header">
|
||||
<a class="logo" href="/">
|
||||
Broom Closet{{ page.activepage }} {{ page.activesub }}
|
||||
</a>
|
||||
<div class="nav">
|
||||
{% for short,mode in page.pages %}
|
||||
<div class="menu" id="{{ short }}Nav">
|
||||
<div>{{ mode.desc|raw }}</div>
|
||||
{% for short,page in mode.pages %}
|
||||
<a href="/{{ short }}/">{{ page.title }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="menu" id="subNav">
|
||||
<div>Section title here</div>
|
||||
<a href="#">Front page</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="contentwrapper">
|
3
_sakura/templates/broomcloset/main/index.tpl
Normal file
3
_sakura/templates/broomcloset/main/index.tpl
Normal file
|
@ -0,0 +1,3 @@
|
|||
{% include 'global/header.tpl' %}
|
||||
<a href="#">meow</a>
|
||||
{% include 'global/footer.tpl' %}
|
|
@ -1,78 +1,78 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Flashii Internal Error</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #EEE;
|
||||
color: #000;
|
||||
font: 12px/20px Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: 100;
|
||||
background: #CAA;
|
||||
padding: 8px 5px 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
border: 1px solid #CAA;
|
||||
margin: 10px;
|
||||
background: #FFF;
|
||||
box-shadow: 2px 2px 1em #888;
|
||||
}
|
||||
|
||||
.container .inner {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
.container .inner .error {
|
||||
background: #555;
|
||||
color: #EEE;
|
||||
border-left: 5px solid #C22;
|
||||
padding: 4px 6px 5px;
|
||||
text-shadow: 0px 1px 1px #888;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.container .contact {
|
||||
border-top: 1px solid #CAA;
|
||||
font-size: x-small;
|
||||
padding: 0px 5px 1px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #77E;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:active {
|
||||
color: #E77;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>An Error occurred while executing the script.</h1>
|
||||
<div class="inner">
|
||||
<p>To prevent potential security risks PHP has stopped execution of the script.</p>
|
||||
<p>PHP Reported the following error log:</p>
|
||||
<div class="error">
|
||||
{{ error }}
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="contact">
|
||||
Contact the System Operator at <a href="mailto:me@flash.moe">me@flash.moe</a> or check our <a href="http://status.flashii.net/" target="_blank">Status Page</a> and <a href="http://twitter.com/_flashii" target="_blank">Twitter Account</a> to see if anything is going on.
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Flashii Internal Error</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #EEE;
|
||||
color: #000;
|
||||
font: 12px/20px Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: 100;
|
||||
background: #CAA;
|
||||
padding: 8px 5px 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
border: 1px solid #CAA;
|
||||
margin: 10px;
|
||||
background: #FFF;
|
||||
box-shadow: 2px 2px 1em #888;
|
||||
}
|
||||
|
||||
.container .inner {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
.container .inner .error {
|
||||
background: #555;
|
||||
color: #EEE;
|
||||
border-left: 5px solid #C22;
|
||||
padding: 4px 6px 5px;
|
||||
text-shadow: 0px 1px 1px #888;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.container .contact {
|
||||
border-top: 1px solid #CAA;
|
||||
font-size: x-small;
|
||||
padding: 0px 5px 1px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #77E;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:active {
|
||||
color: #E77;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>An Error occurred while executing the script.</h1>
|
||||
<div class="inner">
|
||||
<p>To prevent potential security risks PHP has stopped execution of the script.</p>
|
||||
<p>PHP Reported the following error log:</p>
|
||||
<div class="error">
|
||||
{{ error }}
|
||||
</div>
|
||||
<p>If you have an account on <a href="https://github.com/" target="_blank">GitHub</a> please go to the <a href="https://github.com/flashii/Sakura/issues" target="_blank">issues section</a> and report the error listed above (do a check to see if it hasn't been reported yet as well).</p>
|
||||
</div>
|
||||
<div class="contact">
|
||||
Contact the System Operator at <a href="mailto:me@flash.moe">me@flash.moe</a> or check our <a href="http://status.flashii.net/" target="_blank">Status Page</a> and <a href="http://twitter.com/_flashii" target="_blank">Twitter Account</a> to see if anything is going on.
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
102
content/data/broomcloset/css/manage.css
Normal file
102
content/data/broomcloset/css/manage.css
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Broom Closet
|
||||
*/
|
||||
@charset "utf-8";
|
||||
|
||||
/* Standard Elements */
|
||||
* {
|
||||
/* Reset margin and padding */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
font: 12px/20px "Segoe UI", sans-serif;
|
||||
background: #EEE;
|
||||
color: #000;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#container {
|
||||
min-height: 100%;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both !important;
|
||||
float: none !important;
|
||||
}
|
||||
.hidden {
|
||||
display: none !important;
|
||||
visibility: hidden !important;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #22E;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: #22E;
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:active {
|
||||
color: #E22;
|
||||
}
|
||||
|
||||
/* Page header */
|
||||
.header {
|
||||
background: #222;
|
||||
color: #FFF;
|
||||
margin-bottom: 10px;
|
||||
box-shadow: 0 0 1em #222;
|
||||
}
|
||||
|
||||
.header > .logo {
|
||||
font-size: 3em;
|
||||
line-height: 1.7em;
|
||||
margin: 0 20px;
|
||||
color: inherit !important;
|
||||
text-decoration: none !important;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.header > .nav {
|
||||
padding: 0 0 10px 10px;
|
||||
font-size: 1.3em;
|
||||
line-height: 1.4em;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.header > .nav > div > * {
|
||||
display: inline-block;
|
||||
}
|
||||
.header > .nav > div > div {
|
||||
min-width: 160px;
|
||||
}
|
||||
.header > .nav > div > a {
|
||||
color: #DDD;
|
||||
text-decoration: none !important;
|
||||
padding: 0px 5px 2px;
|
||||
transition: .2s;
|
||||
}
|
||||
.header > .nav > div > a:hover {
|
||||
background: #333;
|
||||
}
|
||||
.header > .nav > div > a:active {
|
||||
text-shadow: 0 0 1em #F1F1F1;
|
||||
}
|
||||
|
||||
/* Page footer */
|
||||
.footer {
|
||||
background: #222;
|
||||
text-align: center;
|
||||
padding-top: 1px;
|
||||
margin-top: 10px;
|
||||
box-shadow: 0 0 1em #222;
|
||||
}
|
0
content/data/broomcloset/js/manage.js
Normal file
0
content/data/broomcloset/js/manage.js
Normal file
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Flashii.net Style Codename "Yuuno"
|
||||
* Codename "Yuuno"
|
||||
*/
|
||||
@charset "utf-8";
|
||||
|
||||
|
|
|
@ -1 +1,18 @@
|
|||
# Empty .htaccess to make git realise this directory exists
|
||||
# Block access to every file starting with a dot
|
||||
<Files ".*">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
# Set Error documents
|
||||
ErrorDocument 404 /404.php
|
||||
ErrorDocument 403 /404.php
|
||||
ErrorDocument 401 /404.php
|
||||
|
||||
# Rewrite Stuff
|
||||
RewriteEngine on
|
||||
RewriteBase /
|
||||
Options +FollowSymLinks -Indexes
|
||||
|
||||
# Manage pages
|
||||
RewriteRule ^([a-z\-]+)?/?$ index.php?page=$1&sub=0
|
||||
RewriteRule ^([a-z\-]+)/([a-z\-]+)?/?$ index.php?page=$1&sub=$2
|
||||
|
|
13
manage/404.php
Normal file
13
manage/404.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/*
|
||||
* Flashii.net Main Index
|
||||
*/
|
||||
|
||||
// Declare Namespace
|
||||
namespace Sakura;
|
||||
|
||||
// Include components
|
||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||
|
||||
// Print page contents
|
||||
print Templates::render('errors/http404.tpl', $renderData);
|
149
manage/index.php
149
manage/index.php
|
@ -6,8 +6,153 @@
|
|||
// Declare Namespace
|
||||
namespace Sakura;
|
||||
|
||||
// Define that we are in Management mode
|
||||
define('SAKURA_MANAGE', true);
|
||||
|
||||
// Include components
|
||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/manage.php';
|
||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||
|
||||
// Management pages
|
||||
$managePages = [
|
||||
|
||||
// Moderation
|
||||
'mod' => [
|
||||
|
||||
'desc' => '<span style="color: #0C0;">Moderator</span> actions',
|
||||
|
||||
'pages' => [
|
||||
|
||||
'index' => [
|
||||
|
||||
'title' => 'Index',
|
||||
'sub' => [
|
||||
'front-page' => [
|
||||
|
||||
'desc' => 'Front Page'
|
||||
|
||||
]
|
||||
]
|
||||
|
||||
],
|
||||
|
||||
'message-board' => [
|
||||
|
||||
'title' => 'Message Board',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'reports' => [
|
||||
|
||||
'title' => 'Reports',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'banning' => [
|
||||
|
||||
'title' => 'Banning',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'warnings' => [
|
||||
|
||||
'title' => 'Warnings',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'user-notes' => [
|
||||
|
||||
'title' => 'User notes',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'action-logs' => [
|
||||
|
||||
'title' => 'Action Logs',
|
||||
'sub' => []
|
||||
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
],
|
||||
|
||||
// Administrative
|
||||
'adm' => [
|
||||
|
||||
'desc' => '<span style="color: #C00;">Administrator</span> actions',
|
||||
|
||||
'pages' => [
|
||||
|
||||
'statistics' => [
|
||||
|
||||
'title' => 'Statistics',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'general-settings' => [
|
||||
|
||||
'title' => 'General Settings',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'users' => [
|
||||
|
||||
'title' => 'Users',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'ranks' => [
|
||||
|
||||
'title' => 'Ranks',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'permissions' => [
|
||||
|
||||
'title' => 'Permissions',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'customise' => [
|
||||
|
||||
'title' => 'Customise',
|
||||
'sub' => []
|
||||
|
||||
],
|
||||
|
||||
'system' => [
|
||||
|
||||
'title' => 'System',
|
||||
'sub' => []
|
||||
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
// Add page specific things
|
||||
$renderData['page'] = [
|
||||
|
||||
'title' => 'Manage Index',
|
||||
'pages' => $managePages,
|
||||
'activepage' => ,
|
||||
'subs' => ,
|
||||
'activesub' =>
|
||||
|
||||
];
|
||||
|
||||
// Print page contents
|
||||
print Templates::render('login.tpl', $renderData);
|
||||
print Templates::render('main/index.tpl', $renderData);
|
||||
|
|
Reference in a new issue