This repository has been archived by the owner on Jan 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
350 changed files
with
39,108 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Disable directory browsing | ||
Options -Indexes | ||
|
||
<IfModule mod_rewrite.c> | ||
RewriteEngine On | ||
|
||
# AdminCP is... well... admin! Do not rewrite it! | ||
RewriteRule ^(admin|install)($|/) - [L] | ||
|
||
# /logout is not a controller, just a shortcut to Login::Logout() | ||
RewriteRule ^(logout)$ index.php?c=login&act=logout | ||
|
||
# Controller, Actions and IDs | ||
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?c=$1 [QSA] | ||
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)$ index.php?c=$1&id=$2 [QSA] | ||
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z_]+)$ index.php?c=$1&act=$2 [QSA] | ||
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z_]+)/([0-9]+)$ index.php?c=$1&act=$2&id=$3 [QSA] | ||
|
||
# Thread: SEO friendly URLs | ||
RewriteRule ^(thread)/([0-9]+)-([a-zA-Z0-9\-]+)$ index.php?c=$1&id=$2 [QSA] | ||
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<rule name="rule 1C" stopProcessing="true"> | ||
<match url="^(admin|install)($|/)" /> | ||
<action type="Rewrite" url="/-" /> | ||
</rule> | ||
<rule name="rule 2C"> | ||
<match url="^(logout)$" /> | ||
<action type="Rewrite" url="/index.php?c=login&act=logout" /> | ||
</rule> | ||
<rule name="rule 3C"> | ||
<match url="^([a-zA-Z0-9_-]+)$" /> | ||
<action type="Rewrite" url="/index.php?c={R:1}" appendQueryString="true" /> | ||
</rule> | ||
<rule name="rule 4C"> | ||
<match url="^([a-zA-Z0-9_-]+)/([0-9]+)$" /> | ||
<action type="Rewrite" url="/index.php?c={R:1}&id={R:2}" appendQueryString="true" /> | ||
</rule> | ||
<rule name="rule 5C"> | ||
<match url="^([a-zA-Z0-9_-]+)/([a-zA-Z_]+)$" /> | ||
<action type="Rewrite" url="/index.php?c={R:1}&act={R:2}" appendQueryString="true" /> | ||
</rule> | ||
<rule name="rule 6C"> | ||
<match url="^([a-zA-Z0-9_-]+)/([a-zA-Z_]+)/([0-9]+)$" /> | ||
<action type="Rewrite" url="/index.php?c={R:1}&act={R:2}&id={R:3}" appendQueryString="true" /> | ||
</rule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/** | ||
* Klasemate | ||
* ------------------------------------------------------- | ||
* Created by Laurensius Jeffrey Chandra | ||
* http://klasemate.arcestia.id | ||
* | ||
* File: admin.js | ||
* License: GPLv2 | ||
* Copyright: (c) 2016 - Klasemate | ||
*/ | ||
|
||
/* global $, CodeMirror */ | ||
|
||
|
||
$(document).ready(function() { | ||
/** | ||
* THEMES: CodeMirror when editing CSS files | ||
*/ | ||
try { | ||
var textarea = document.getElementById("css"); | ||
var textareaCodeMirror = CodeMirror.fromTextArea(textarea, { | ||
lineNumbers: true | ||
}); | ||
} catch(e) { | ||
console.log(e); | ||
} | ||
|
||
/** | ||
* Automatic confirmation message when using "data-confirm" attribute | ||
*/ | ||
(function() { | ||
$('a[data-confirm]').on('click', function(event) { | ||
if(!confirm($(this).data("confirm"))) { | ||
event.preventDefault(); | ||
} | ||
}) | ||
}).call(this); | ||
}); | ||
|
||
/** | ||
* Check for updates | ||
*/ | ||
function checkUpdates() { | ||
$.ajax("https://api.github.com/repos/arcestiaishere/klasemate/releases/latest", { | ||
dataType: 'json', | ||
beforeSend: function() { | ||
console.info("Checking for updates..."); | ||
$('.loader').show(); | ||
} | ||
}) | ||
.done(function(data) { | ||
if(data) { | ||
if(versionCompare(data.tag_name.slice(1), $('#current-version').val()) == 1) { | ||
$('.update-message.done span').html(data.tag_name); | ||
$('.update-message.done').show(); | ||
} | ||
else { | ||
$('.update-message.no-updates').show(); | ||
} | ||
} | ||
}) | ||
.fail(function() { | ||
$('.update-message.fail').show(); | ||
}) | ||
.always(function() { | ||
$('.loader').hide(); | ||
}); | ||
}; | ||
|
||
/** | ||
* Delete report on Dashboard View | ||
*/ | ||
function DeleteReport(id, thread) { | ||
if(confirm("Are you sure you want to delete the report ID #" + id + "?\nThis action is permanent and cannot be undone.")) { | ||
location.href = "process.php?do=deletereport&report=" + id + "&thread=" + thread; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
|
||
/** | ||
* Count remaining characters | ||
*/ | ||
function counter(limit) { | ||
var field = document.getElementById('short_desc'); | ||
var counter = document.getElementById('short_desc_stats'); | ||
|
||
var char_number = limit - field.value.length; | ||
|
||
counter.innerHTML = char_number + " characters remaining"; | ||
} | ||
|
||
/** | ||
* Simply compares two string version values. | ||
* | ||
* Example: | ||
* versionCompare('1.1', '1.2') => -1 | ||
* versionCompare('1.1', '1.1') => 0 | ||
* versionCompare('1.2', '1.1') => 1 | ||
* versionCompare('2.23.3', '2.22.3') => 1 | ||
* | ||
* Returns: | ||
* -1 = left is LOWER than right | ||
* 0 = they are equal | ||
* 1 = left is GREATER = right is LOWER | ||
* And FALSE if one of input versions are not valid | ||
*/ | ||
function versionCompare(left, right) { | ||
if (typeof left + typeof right != 'stringstring') { | ||
return 0; | ||
} | ||
|
||
var a = left.split('.'); | ||
var b = right.split('.'); | ||
var len = Math.max(a.length, b.length); | ||
|
||
for (var i = 0; i < len; i++) { | ||
if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) { | ||
return 1; | ||
} else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) { | ||
return -1; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/** | ||
* Select custom rules when creating a new room | ||
*/ | ||
function CustomRulesSelect() { | ||
var checkbox = document.getElementById('rules_visible'); | ||
var rules_title = document.getElementById('rules_title'); | ||
var rules_text = document.getElementById('rules_text'); | ||
|
||
if(checkbox.checked) { | ||
rules_title.disabled = false; | ||
rules_text.disabled = false; | ||
} | ||
if(checkbox.checked == false) { | ||
rules_title.disabled = true; | ||
rules_text.disabled = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
## --------------------------------------------------- | ||
# Klasemate | ||
## --------------------------------------------------- | ||
# Developed by Laurensius Jeffrey Chandra | ||
# File: auth.php | ||
# License: GPLv2 | ||
# Copyright: (c) 2016 - Klasemate | ||
## --------------------------------------------------- | ||
|
||
// Include files... | ||
|
||
require_once("../config.php"); | ||
require_once("../kernel/Text.php"); | ||
require_once("../kernel/Http.php"); | ||
require_once("../kernel/Database.php"); | ||
|
||
// Load MySQL driver and connect | ||
|
||
$Db = new Database(); | ||
$Db->Connect($config); | ||
|
||
// Get security hash key | ||
$Db->Query("SELECT * FROM c_config c WHERE field = 'security_salt_hash' OR field = 'security_salt_key';"); | ||
$_salt = $Db->FetchToArray(); | ||
|
||
$salt = array( | ||
"hash" => $_salt[0]['value'], | ||
"key" => $_salt[1]['value'] | ||
); | ||
|
||
// Get form information | ||
|
||
if(Http::Request("username") && Http::Request("password")) { | ||
$username = Http::Request("username"); | ||
$password = Text::Encrypt(Http::Request("password"), $salt); | ||
} | ||
|
||
// Check if user exists | ||
|
||
$Db->Query("SELECT m_id, username, usergroup FROM c_members WHERE username = '{$username}' AND password = '{$password}';"); | ||
|
||
if($Db->Rows() != 1) { | ||
header("Location: index.php?error=1"); | ||
exit; | ||
} | ||
else { | ||
$info = $Db->Fetch(); | ||
|
||
if($info['usergroup'] != 1) { | ||
header("Location: index.php?error=4"); | ||
exit; | ||
} | ||
|
||
session_start(); | ||
$_SESSION['admin_m_id'] = $info['m_id']; | ||
$_SESSION['admin_username'] = $info['username']; | ||
$_SESSION['admin_time'] = time(); | ||
|
||
header("Location: main.php"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Klasemate | ||
* ------------------------------------------------------- | ||
* Created by Laurensius Jeffrey Chandra | ||
* http://klasemate.arcestia.id | ||
* | ||
* File: diagnostics.js | ||
* License: GPLv2 | ||
* Copyright: (c) 2016 - Klasemate | ||
*/ | ||
|
||
|
||
$(document).ready(function($) { | ||
// Failure tests and error messages | ||
var tests = [ | ||
{ name: 'config-exists', error: 'Have you deleted this file? Upload it again.' }, | ||
{ name: 'config-has-data', error: 'Maybe your config.php file is not writtable.' }, | ||
{ name: 'db-connect', error: 'The data you informed during installation are not valid. Try to reinstall.' }, | ||
{ name: 'db-database', error: 'The database server exists, but the database name doesn\'t match. Try to reinstall.' }, | ||
{ name: 'db-tables', error: 'The database server exists, there are missing tables. Delete all remaining tables (if any) and try to reinstall.' }, | ||
{ name: 'env-apache', error: 'Unfortunately Klasemate is compatible with Apache server only.' }, | ||
{ name: 'env-php', error: 'You\'re running an outdated version of PHP. You need at least PHP 5.3 or higher.' }, | ||
{ name: 'env-mysql', error: 'You\'re running an outdated version of MySQL. You need at least MySQL v5.5 or higher.' }, | ||
{ name: 'env-mod-rewrite', error: 'You MUST enable \'mod_rewrite\' in order to run Klasemate.' } | ||
]; | ||
|
||
// Iterate tests | ||
function run(step) { | ||
console.log('Running ' + step + ' of ' + tests.length); | ||
$.ajax("run.php?task=" + tests[step].name, { | ||
method: 'get', | ||
dataType: 'json' | ||
}) | ||
.done(function(data) { | ||
showResults(tests[step].name, tests[step].error, data.status); | ||
if(step == tests.length - 1) { | ||
$('#everything-ok').fadeIn(); | ||
} else { | ||
if(data.status) { | ||
step++; | ||
run(step); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
// Mark SPAN tag as success or failure | ||
function showResults(step, errorMessage, result) { | ||
if(result) { | ||
$('span#' + step).addClass('yes').html('Passed.'); | ||
} | ||
else { | ||
$('span#' + step).addClass('no').html(errorMessage); | ||
} | ||
} | ||
|
||
// Ok, let's go! | ||
run(0); | ||
}); |
Oops, something went wrong.