r20150929.1

Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
flash 2015-09-29 19:26:24 +02:00
parent 7842a2f515
commit f30f03ba59
11 changed files with 191 additions and 10572 deletions

View file

@ -2984,6 +2984,7 @@
{
"type": "FIX",
"change": "Fixed user avatar going all over the place on mobile.",
"user": "Flashwave"
}
]

View file

@ -10,47 +10,87 @@
{% endif %}
{{ block('meta') }}
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/broomcloset.css" />
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" />
{{ block('css') }}
<!-- JS -->
<script type="text/javascript" src="{{ sakura.contentPath }}/libraries/jquery.js"></script>
<script type="text/javascript" src="{{ sakura.resources }}/js/bootstrap.js"></script>
<script type="text/javascript" charset="utf-8" src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" charset="utf-8" src="{{ sakura.resources }}/js/bootstrap.js"></script>
{{ block('js') }}
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="logo">
<a href="/manage/">Broom Closet</a> /
<a href="/manage/{{ page.activepage }}/">{{ page.pages[page.activepage].desc }}</a> /
<a href="/manage/{{ page.activepage }}/{{ page.activesub }}/">{{ page.pages[page.activepage].subs[page.activesub].desc }}</a>
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ urls.format('MANAGE_INDEX') }}">The Broomcloset</a>
</div>
<div class="nav">
<div class="menu" id="siteNav">
<div style="color: {{ user.colour }};">{{ user.data.username }}</div>
<a href="/">Return to Site Index</a>
<a href="/logout?mode=logout&amp;time={{ php.time }}&amp;session={{ php.sessionid }}&amp;redirect=/">Logout</a>
</div>
<div class="menu" id="pageNav">
<div>Navigation</div>
{% for short,page in page.pages %}
<a href="/manage/{{ short }}/">{{ page.desc }}</a>
{% endfor %}
</div>
<div class="menu" id="subNav">
<div>{{ page.pages[page.activepage].desc }}</div>
{% for short,sub in page.pages[page.activepage].subs %}
<a href="/manage/{{ page.activepage }}/{{ short }}/">{{ sub.desc }}</a>
{% endfor %}
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-left">
<li><a href="{{ urls.format('MANAGE_INDEX') }}">Dashboard</a></li>
<li><a href="{{ urls.format('MANAGE_CAT', ['reports']) }}">Reports</a></li>
<li><a href="{{ urls.format('MANAGE_CAT', ['infopages']) }}">Info pages</a></li>
<li><a href="{{ urls.format('MANAGE_CAT', ['system']) }}">System information</a></li>
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Users <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{{ urls.format('MANAGE_MODE', ['users', 'manage']) }}">Manage users</a></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['users', 'ranks']) }}">Manage ranks</a></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['users', 'groups']) }}">Manage groups</a></li>
<li role="separator" class="divider"></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['users', 'warnings']) }}">Warnings</a></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['users', 'bans']) }}">Bans</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Forums <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{{ urls.format('MANAGE_MODE', ['forums', 'manage']) }}">Manage forums</a></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['forums', 'moderate']) }}">Moderate forums</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Permissions <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{{ urls.format('MANAGE_MODE', ['permissions', 'global']) }}">Global permissions</a></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['permissions', 'forums']) }}">Forum permissions</a></li>
</ul>
</li>
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Logs <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{{ urls.format('MANAGE_MODE', ['logs', 'all']) }}">Full log</a></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['logs', 'management']) }}">Management logs</a></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['logs', 'errors']) }}">Error logs</a></li>
<li><a href="{{ urls.format('MANAGE_MODE', ['logs', 'user']) }}">User logs</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="color: {{ user.colour }};">{{ user.data.username }} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{{ urls.format('USER_PROFILE', [user.data.id]) }}">View Profile</a></li>
<li><a href="{{ urls.format('SETTINGS_INDEX') }}">Site settings</a></li>
<li role="separator" class="divider"></li>
<li><a href="{{ urls.format('SITE_HOME') }}">Back to site</a></li>
<li><a href="{{ urls.format('USER_LOGOUT', [php.time, php.sessionid, urls.format('SITE_HOME')]) }}">Logout</a></li>
</ul>
</li>
<li><a href="{{ urls.format('CHANGELOG') }}#r{{ sakura.versionInfo.version }}" style="color: {{ sakura.versionInfo.colour }};" title="{{ sakura.versionInfo.label }} {{ sakura.versionInfo.stable ? 'Stable' : 'Development' }}">Sakura r{{ sakura.versionInfo.version }}</a></li>
</ul>
</div>
</div>
</nav>
<div id="contentwrapper">
<div class="container-fluid">
{{ block('content') }}
</div>
<div class="footer">
<div style="color: {{ sakura.versionInfo.colour }};">Sakura b{{ sakura.versionInfo.version }} ({{ sakura.versionInfo.label }}/{{ sakura.versionInfo.stable ? 'Stable' : 'Development' }})</div>
</div>
</body>
</html>

View file

@ -0,0 +1,10 @@
{% extends 'global/master.tpl' %}
{% block title %}Restricted{% endblock %}
{% block content %}
<div class="main">
<h1 class="page-header">Restricted</h1>
<p class="lead">You are not allowed to manage this site.</p>
</div>
{% endblock %}

View file

@ -0,0 +1,30 @@
{% extends 'global/master.tpl' %}
{% block title %}Dashboard{% endblock %}
{% block content %}
<div class="main">
<h1 class="page-header">Dashboard <small>A quick overview of everything</small></h1>
<h3>Reports <small>The five newest unsolved reports</small></h3>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Subject</th>
<th>User reported</th>
<th>Reporter</th>
<th>Report time</th>
</tr>
</thead>
<tbody>
<tr>
<td>Faggot exists really</td>
<td>Nippon Nick
</td>
<td>Japan Joe</td>
<td>1969-69-69 69:69:69 JST</td>
</tr>
</tbody>
</table>
<h3>Statistics <small>The site in numbers</small></h3>
</div>
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends 'global/master.tpl' %}
{% block title %}Not found{% endblock %}
{% block content %}
<div class="main">
<h1 class="page-header">404 <small>Page not found</small></h1>
<p class="lead">The page you requested doesn't exist.</p>
</div>
{% endblock %}

View file

@ -0,0 +1,21 @@
{% extends 'global/master.tpl' %}
{% block title %}System Information{% endblock %}
{% block content %}
<div class="main">
<h1 class="page-header">System information <small>Stuff about the server the site runs on</small></h1>
<dl class="dl-horizontal">
<dt>Operating System</dt>
<dd>{{ uname.osn }}</dd>
<dt>Version Info</dt>
<dd>{{ uname.osv }}</dd>
<dt>System Hostname</dt>
<dd>{{ uname.host }}</dd>
<dt>Architecture</dt>
<dd>{{ uname.arch }}</dd>
<dt>Uptime</dt>
<dd>{{ uname.arch }}</dd>
</dl>
</div>
{% endblock %}

View file

@ -1,41 +0,0 @@
{% extends 'global/master.tpl' %}
{% block title %}The Broomcloset{% endblock %}
{% block content %}
<h1>Latest 5 reports</h1>
<table>
<thead>
<tr>
<th>
Subject
</th>
<th>
User reported
</th>
<th>
Reporter
</th>
<th>
Report time
</th>
</tr>
</thead>
<tbody>
<tr>
<th>
Faggot exists really
</th>
<th>
Nippon Nick
</th>
<th>
Japan Joe
</th>
<th>
1969-69-69 69:69:69 JST
</th>
</tr>
</tbody>
</table>
{% endblock %}

View file

@ -85,5 +85,5 @@ RewriteRule ^forum/post/([0-9]+)/(quote|reply)/?$ posting.php?p=$1&quote=$1 [L,Q
# Management
RewriteRule ^manage/?$ manage.php [L,QSA]
RewriteRule ^manage/([a-z\-]+)/?$ manage.php?cat=$1&mode=0 [L,QSA]
RewriteRule ^manage/([a-z\-]+)/?$ manage.php?cat=$1 [L,QSA]
RewriteRule ^manage/([a-z\-]+)/([a-z\-]+)/?$ manage.php?cat=$1&mode=$2 [L,QSA]

View file

@ -0,0 +1,8 @@
/*
* Broomcloset bootstrap extension thing
* By Flashwave <https://flash.moe>
*/
.main {
margin: -40px 10px 0;
}

File diff suppressed because it is too large Load diff

View file

@ -18,163 +18,54 @@ if (!Permissions::check('MANAGE', 'USE_MANAGE', Session::$userId, 1)) {
exit;
}
// Management pages
$managePages = [
'index' => [
'desc' => 'Index',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
// Modes
$modes = [
'dashboard' => [
'index',
],
],
],
'reports' => [
'desc' => 'Reports',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'banning' => [
'desc' => 'Banning',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'warnings' => [
'desc' => 'Warnings',
'subs' => [
'front-thing' => [
'desc' => 'thing',
],
],
],
'user-notes' => [
'desc' => 'User notes',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'action-logs' => [
'desc' => 'Action logs',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'action-logs' => [
'desc' => 'Action logs',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'statistics' => [
'desc' => 'Statistics',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'general-settings' => [
'desc' => 'General Settings',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'users' => [
'desc' => 'Users',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'ranks' => [
'desc' => 'Ranks',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'permissions' => [
'desc' => 'Permissions',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'info-pages' => [
'desc' => 'Info pages',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
],
],
],
'system' => [
'desc' => 'System',
'subs' => [
'front-page' => [
'desc' => 'Front Page',
'index',
],
'error' => [
'index',
],
],
];
// Add page specific things
$renderData['page'] = [
// Select mode
$category = isset($_GET['cat'])
? (
array_key_exists($_GET['cat'], $modes) ?
$_GET['cat'] :
'error'
)
: key($modes);
$mode = isset($_GET['mode'])
? (
in_array($_GET['mode'], $modes[$category]) ?
$_GET['mode'] :
'error'
)
: $modes[$category][0];
'title' => 'Manage Index',
'pages' => $managePages,
'activepage' => $_MANAGE_ACTIVE_PAGE = (
isset($_GET['page']) ?
(
array_key_exists($_GET['page'], $managePages) ?
$_GET['page'] :
key($managePages)
) :
key($managePages)
),
'subs' => $_MANAGE_SUBS = $managePages[$_MANAGE_ACTIVE_PAGE]['subs'],
'activesub' => $_MANAGE_ACTIVE_SUB = (
isset($_GET['sub']) ?
(
array_key_exists($_GET['sub'], $_MANAGE_SUBS) ?
$_GET['sub'] :
key($_MANAGE_SUBS)
) :
key($_MANAGE_SUBS)
),
// Override category if mode is error
if ($mode == 'error') {
$category = 'error';
$mode = key($modes[$category]);
}
];
// Add special variables
switch ($category . '.' . $mode) {
case 'system.index':
$renderData = array_merge($renderData, [
'uname' => [
'osn' => php_uname('s'),
'osv' => php_uname('v'),
'host' => php_uname('n'),
'arch' => php_uname('m'),
],
]);
break;
}
// Print page contents
print Templates::render('pages/' . $_MANAGE_ACTIVE_PAGE . '/' . $_MANAGE_ACTIVE_SUB . '.tpl', $renderData);
print Templates::render('pages/' . $mode . '.' . $category . '.tpl', $renderData);