Skip to content

[Beautification] Re-themed ENTIRE Project #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d5ea7af
create Useful PHP.php
MuhsinunC Jan 3, 2017
7f1003d
add config.inc.php to .gitignore
MuhsinunC Jan 3, 2017
7e31095
test
MuhsinunC Jan 3, 2017
76fa2b1
reset file
MuhsinunC Jan 3, 2017
313a5d2
testing for errors
MuhsinunC Jan 3, 2017
9fddfc0
testing .gitignore
MuhsinunC Jan 3, 2017
3771f03
testing .gitignore
MuhsinunC Jan 3, 2017
1f2efea
fix .gitignore
MuhsinunC Jan 3, 2017
263b511
still trying to fix .gitignore
MuhsinunC Jan 3, 2017
1394764
still trying to fix .gitignore
MuhsinunC Jan 3, 2017
8e87fe8
fix .gitignore
MuhsinunC Jan 3, 2017
497ff64
add vendor/ to repo
MuhsinunC Jan 3, 2017
c50defa
add custom files
MuhsinunC Jan 3, 2017
c659cf9
add custom navbar
MuhsinunC Jan 3, 2017
48f3fef
Change look of index.php & remove remnant of old navbar
MuhsinunC Jan 3, 2017
5c62990
theme ban & mute pages
MuhsinunC Jan 3, 2017
4cca0b0
theme kicks page
MuhsinunC Jan 3, 2017
c1a2b92
theme comments page & add vendor directory & files
MuhsinunC Jan 3, 2017
c67cd24
trying to add ability to go to ?p=themes
MuhsinunC Jan 3, 2017
19c1cd7
more theming
MuhsinunC Jan 4, 2017
429d811
fixed spacing
MuhsinunC Jan 4, 2017
e7ede50
add more useful PHP scripts as well as finish theming for admin page
MuhsinunC Jan 4, 2017
1d2d563
fix weird margins & theme account management page
MuhsinunC Jan 4, 2017
0abba42
theme administrateprofile.php
MuhsinunC Jan 4, 2017
34ff699
theme player profile page
MuhsinunC Jan 4, 2017
b835799
made theme switcher but then decided not to add it in order to help k…
MuhsinunC Jan 4, 2017
913ef8b
once again, removing all my theme changing work
MuhsinunC Jan 4, 2017
55a8a32
change all heads to helm heads
MuhsinunC Jan 4, 2017
d4ab34c
fix capitalization error
MuhsinunC Jan 5, 2017
305a7bc
remove unneeded post requests for CSS versions
MuhsinunC Jan 5, 2017
cf1ed0c
add NamelessMC addon
MuhsinunC Jan 5, 2017
64b130e
put all files into web directory
MuhsinunC Feb 6, 2017
99365b8
undo moving files into web directory for technical issues
MuhsinunC Feb 6, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.idea
vendor/
.idea
1 change: 1 addition & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Options -Indexes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/*
* Made by Partydragen
* http://partydragen.com/
*
* Modified by Samerton
* https://worldscapemc.co.uk
*
* Modified by MuhsinunC
* http://muhsinunc.ml/
*
* License: MIT
*/

// Initialise the BAT Web Interface addon
// We've already checked to see if it's enabled

require('addons/Bungee Admin Tools Web Interface/language.php');

// Enabled, add links to navbar

//$footer_nav_array['batinfractions'] = $bat_language['bat_icon'] . $bat_language['bat'];
16 changes: 16 additions & 0 deletions NamelessMC Addon/Bungee Admin Tools Web Interface/language.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/*
* Made by Partydragen
* http://partydragen.com/
*
* Modified by Samerton
* https://worldscapemc.co.uk
*
*/

// Language file for "CoreProtect2_Web_Interface" addon

$bat_language = array(
'bat' => 'Core Protect 2',
'bat_icon' => '', // Icon to display before the text in the navbar
);
102 changes: 102 additions & 0 deletions NamelessMC Addon/Bungee Admin Tools Web Interface/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
/*
* Made by Partydragen
* http://partydragen.com/
*
* and Samerton
* http://worldscapemc.co.uk
*
* and MuhsinunC
* http://muhsinunc.ml/
*
* License: MIT
*/

// Settings for the BAT Web Interface addon

// Ensure user is logged in, and is admin
if($user->isLoggedIn()){
if($user->canViewACP($user->data()->id)){
if($user->isAdmLoggedIn()){
// Can view
} else {
Redirect::to('/admin');
die();
}
} else {
Redirect::to('/');
die();
}
} else {
Redirect::to('/');
die();
}

// Display information first
?>
<h3>Addon: Bungee Admin Tools Web Interface</h3>
Authors: <a href="http://muhsinunc.ml/">MuhsinunC</a>, <a href="https://github.com/alphartdev/BAT-WebInterface">AlphartDev</a>, <a href="http://partydragen.com/">Partydragen</a>, and <a href="http://worldscapemc.co.uk">Samerton</a><br />
Version: 1.0.0<br />
Description: Adds an online browser to explore Bungee Admin Tools Infractions<br />

<br>

<div class="panel panel-default margin-fix">
<div class="panel-heading">
<h3 class="panel-title">Installation</h3>
</div>
<div class="panel-body">
<h4>Setup</h4>
<ul>
<li>Visit <code>yourwebsite.com/batinfractions/__install</code></li>
<li>Follow the instructions given</li>
<li>Enjoy! <3 :O :D</li>
</ul>
</div>
</div>

<div class="panel panel-default margin-fix">
<div class="panel-heading">
<h3 class="panel-title">To Bungee Admin Tools Web Interface Theme</h3>
</div>
<div class="panel-body">
<p>It's actually quite simple to change the theme (by default it's set to Yeti)! It was very hard for me to implement the themes into the web interface, but I made it EXTREMELY easy for u! :D <3</p>
<p>To change the theme, all you have to do is:</p>
<ul>
<li>Navigate to <code>"/batinfractions/application/views/_template/"</code> and open <code>"header.php"</code></li>
<li>Scroll down to the area commented as <code>"CUSTOM THEME HERE!!!"</code></li>
<li>Change all three lines where it says <code>"Yeti,"</code> since that's the theme I'm currently using, to <strong>ANY</strong> theme that's already installed to your NamelessMC setup! :O :D</li>
<li>If you're unsure of which themes are installed, navigate to your AdminCP, then on the left you'll see a tab called <code>"Style"</code>. Click it and it'll list all of your currently installed themes! :O :D Enjoy! :D</li>
</ul>
</div>
</div>

<div class="panel panel-default margin-fix">
<div class="panel-heading">
<h3 class="panel-title">To Change Link Location</h3>
</div>
<div class="panel-body">
<p>Unfortunately, I couldn't get the location selector module to work. I tried, believe me. If u know how to get it to work, PLEASE show me how! D:</p>
<p>Open <code>"/addons/Bungee Admin Tools Web Interface/initialisation.php"</code> and paste in the code snippets below or put none to hide the link (The link is hidden by default & the footer code is commented out as an example for you).</p>
<ul>
<li>To place it in the header use this code: <div class="well">$navbar_array[] = array('batinfractions' => $bat_language['bat_icon'] . $bat_language['bat']);</div></li>
<li>To place it in the header's "more" dropdown menu, use this code: <div class="well">$nav_more_dropdown[$bat_language['bat_icon'] . $bat_language['bat']] = '/batinfractions';</div></li>
<li>To place it in the footer use this code: <div class="well">$footer_nav_array['batinfractions'] = $bat_language['bat_icon'] . $bat_language['bat'];</div></li>
<li>To have it not show up at all, just don't put anything. :P ;)</li>
</ul>
</div>
</div>

<div class="panel panel-default margin-fix">
<div class="panel-heading">
<h3 class="panel-title">Other Info</h3>
</div>
<div class="panel-body">
<h4>To Do:</h4>
<ul>
<li>Add Link Location Selector</li>
<li>Add MySQL Auto Theme Switcher (Links up with currently selected theme on NamelessMC website)</li>
</ul>
<li><a href="https://github.com/alphartdev/BAT-WebInterface">Original GitHub Repository</a></li>
</div>
</div>
14 changes: 0 additions & 14 deletions README.md

This file was deleted.

26 changes: 26 additions & 0 deletions Useful PHP.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Helpful PHP:

Get username: <?php echo $this->getUsername();?>

Check if user is admin: <?php if($this->isSU()){?> INPUT CONTENT FOR ADMIN EYES ONLY HERE Then end admin content with: <?php }?>
OR instead of ending ALL content, you can use this: <?php }else{?> instead of this <?php }?> , input content for non-admins, and THEN put <?php }?> to end ALL content.
This is helpful to stop an error saying that, wait a minute, this isn't an admin... HALP!

Sign Out: <a href="#" onclick="logout();">Sign Out</a>

Accounts Button: <?php if($this->isSU()){?><li><a href="index.php?p=admin&action=manageaccounts">Accounts</a></li><?php }?>

Check Page Name And If It's Equal To x Then Do Something:
<?php if(get_class($this) == "home"){echo "active";}?>
Reads the ?p=PAGENAME

Get network name content from messages.php: <?php echo Message::network;?>

Put "danger-bat" if player is checked to be currently banned: <?php echo $ban['state'] ? "danger-bat" : "";?>

Put "danger-bat" if player is checked to be currently muted: <?php echo $mute['state'] ? "danger-bat" : "";?>

Check if user is regular admin: <?php if($this->isAdmin()){//Do stuff} ?>

Check if user is Superuser admin: <?php if($this->isSU()){//Do stuff} ?>
This admin has higher status & more rights than regular admin. This admin can manage regular admin accounts. :O :D
1 change: 0 additions & 1 deletion application/config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
$database = "";
$user = "";
$password = "";
$port="3306"; // 3306 default port for mysql

// Debug settings
$debugMode = false; // Turn on to display all errors
Expand Down
28 changes: 14 additions & 14 deletions application/config/messages.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
class Message{
const network = "MyNetworkName"; // Name which will be displayed on most pages
// Messages : their use is explained in the comment on their right
const noReason = "No reason"; // When there are no reason associated to a punishment
const globalPunishment = "global"; // When the punishment server is the whole network
const noData = "<span class='glyphicon glyphicon-remove'></span>"; // Content to insert when there are no data, e.g when a ban is not over the unbandate is not set
const state_ACTIVE = "<span style='color: red;'>Active</span>"; // When a punishment is active
const state_ENDED = "<span style='color: #7AB317;'>Ended</span>"; // When a punisshment is ended
const commentTypeWarning = "<span style='color: #CC9E61; font-weight: bold;'>Warning</span>"; // When a comment's type is an warning
const commentTypeNote = "<span style='color: #80B3FF;'>Note</span>"; // When a comment's type is an note
const ipHidden = "Address IP hidden";
}
<?php
class Message{
const network = "Test Net"; // Name which will be displayed on most pages

// Messages : their use is explained in the comment on their right
const noReason = "No reason"; // When there are no reason associated to a punishment
const globalPunishment = "global"; // When the punishment server is the whole network
const noData = "<span class='glyphicon glyphicon-remove'></span>"; // Content to insert when there are no data, e.g when a ban is not over the unbandate is not set
const state_ACTIVE = "<span class='label label-danger'>Active</span>"; // When a punishment is active
const state_ENDED = "<span class='label label-success'>Ended</span>"; // When a punishment is ended
const commentTypeWarning = "<span class='label label-warning'>Warning</span>"; // When a comment's type is an warning
const commentTypeNote = "<span class='label label-info'>Note</span>"; // When a comment's type is an note
const ipHidden = "IP address hidden";
}
?>
89 changes: 18 additions & 71 deletions application/controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,81 +52,28 @@ protected function getSortingColumn(){
}
return $sortingColumn;
}

protected function generatePaginationView($currentPage, $totalPages) {

if ($totalPages == 1) {
return "";
protected function generatePaginationView($currentPage, $totalPages){
$display = "<center><ul class='pagination'>";
if($currentPage == 1){
$display .= "<li class='active'><a href='#' onClick='choosePage(1)'>1</a></li>";
}

$display = "<ul class='pagination'>";

$stack = array();

if ($totalPages <= 7) {
// Just display 5 Pagination Buttons
for ($i = 1; $i <= $totalPages; $i++) {
array_push($stack, $i);
}
} else {

$stack = array(1, $totalPages);

if ($currentPage == 1) {
// Add 5 following
for ($i = 1; $i <= 5; $i++){
array_push($stack, ($currentPage+$i));
}
} else if ($currentPage == $totalPages) {
// Add 5 previous
for ($i = 1; $i <= 5; $i++){
array_push($stack, ($currentPage-$i));
}
} else {
array_push($stack, ($currentPage));

$missing1 = 2;
$missing2 = 2;

while (count($stack) < 7) {
for ($i = 1; $i <= $missing1; $i++ ){
$pageToAdd = $currentPage - $i;
if (!in_array($pageToAdd, $stack) && $pageToAdd > 1) {
array_push($stack, $pageToAdd);
} else {
$missing2++;
}
}

for ($i = 1; $i <= $missing2; $i++ ){
$pageToAdd = $currentPage + $i;
if (!in_array($pageToAdd, $stack) && $pageToAdd < $totalPages) {
array_push($stack, $pageToAdd);
} else {
$missing1++;
}
}
}
else{
$display .= "<li><a href='#' onClick='choosePage(1)'>1</a></li>";
if($currentPage == 2){
$display .= "<li class='active'><a href='#' onClick='choosePage(2)'>2</a></li>";
}else{
$display .= "<li><a href='#' onClick='openPageSelector()'>...</a></li>";
$display .= "<li class='active'><a href='#' onClick='choosePage($currentPage)'>$currentPage</a></li>";
}
}

asort($stack);

$lastval = 0;
foreach ($stack as &$val) {
if (($val - 1) != $lastval) {
$display .= "<li class='disabled'><a href=''#‘>...</a></li>";
}

$lastval = $val;
if ($val == $currentPage) {
$display .= "<li class='active'><a href='#' onClick='choosePage($val)'> $val </a></li>";
} else {
$display .= "<li><a href='#' onClick='choosePage($val)'>$val</a></li>";
}
if($currentPage + 1 < $totalPages){
$display .= "<li><a href='#' onClick='openPageSelector()'>...</a></li>";
}
if($currentPage != $totalPages){
$display .= "<li><a href='#' onClick='choosePage($totalPages)'>$totalPages</a></li>";
}

$display .= "</ul>";
$display .= "</ul></center>";
return $display;
}

Expand Down
Loading