AJAX form submission and bug in register process
This commit is contained in:
parent
69c0dd651b
commit
cc5010abd4
10 changed files with 385 additions and 93 deletions
|
@ -203,7 +203,7 @@ class Users {
|
||||||
return [0, 'INVALID_MX'];
|
return [0, 'INVALID_MX'];
|
||||||
|
|
||||||
// Set a few variables
|
// Set a few variables
|
||||||
$usernameClean = Main::cleanString($username);
|
$usernameClean = Main::cleanString($username, true);
|
||||||
$password = Hashing::create_hash($password);
|
$password = Hashing::create_hash($password);
|
||||||
$requireActive = Configuration::getConfig('require_activation');
|
$requireActive = Configuration::getConfig('require_activation');
|
||||||
$userRank = $requireActive ? [0] : [1];
|
$userRank = $requireActive ? [0] : [1];
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', '20150417');
|
define('SAKURA_VERSION', '20150420');
|
||||||
|
|
||||||
// Define Sakura Path
|
// Define Sakura Path
|
||||||
define('ROOT', str_replace(basename(__DIR__), '', dirname(__FILE__)));
|
define('ROOT', str_replace(basename(__DIR__), '', dirname(__FILE__)));
|
||||||
|
@ -57,11 +57,17 @@ $renderData = array(
|
||||||
'charset' => Configuration::getConfig('charset'),
|
'charset' => Configuration::getConfig('charset'),
|
||||||
'currentpage' => '//'. $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],
|
'currentpage' => '//'. $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],
|
||||||
'recaptcha_public' => Configuration::getConfig('recaptcha_public'),
|
'recaptcha_public' => Configuration::getConfig('recaptcha_public'),
|
||||||
'resources' => '//'. Configuration::getLocalConfig('urls')['content'] .'/data/'. strtolower(Templates::$_TPL)
|
'recaptcha_enable' => Configuration::getConfig('recaptcha'),
|
||||||
|
'resources' => '//'. Configuration::getLocalConfig('urls')['content'] .'/data/'. strtolower(Templates::$_TPL),
|
||||||
|
'disableregister' => Configuration::getConfig('disable_registration'),
|
||||||
|
'requireregcodes' => Configuration::getConfig('require_registration_code'),
|
||||||
|
'requireactiveate' => Configuration::getConfig('require_activation'),
|
||||||
|
'sitename' => Configuration::getConfig('sitename')
|
||||||
],
|
],
|
||||||
'php' => [
|
'php' => [
|
||||||
'sessionid' => \session_id(),
|
'sessionid' => \session_id(),
|
||||||
'time' => \time()
|
'time' => \time(),
|
||||||
|
'self' => $_SERVER['PHP_SELF']
|
||||||
],
|
],
|
||||||
'user' => [
|
'user' => [
|
||||||
'checklogin' => Users::checkLogin(),
|
'checklogin' => Users::checkLogin(),
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
<div class="news-post-time">
|
<div class="news-post-time">
|
||||||
Posted on {{ newsPost.date|date("D Y-m-d H:i:s T") }} <a class="default" href="/news/{{ newsPost.id }}#disqus_thread">View comments</a>
|
Posted on {{ newsPost.date|date("D Y-m-d H:i:s T") }}{% if page.articleCount > 1 %} <a class="default" href="/news/{{ newsPost.id }}#disqus_thread">View comments</a>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,25 +5,33 @@
|
||||||
<meta charset="{{ sakura.charset }}" />
|
<meta charset="{{ sakura.charset }}" />
|
||||||
<title>{{ page.title }}</title>
|
<title>{{ page.title }}</title>
|
||||||
<meta name="description" content="Any community that gets its laughs by pretending to be idiots will eventually be flooded by actual idiots who mistakenly believe that they're in good company. Welcome to Flashii." />
|
<meta name="description" content="Any community that gets its laughs by pretending to be idiots will eventually be flooded by actual idiots who mistakenly believe that they're in good company. Welcome to Flashii." />
|
||||||
<meta name="keywords" content="Flashii, Media, Flashwave,Circle, Zeniea, MalwareUp, Cybernetics, Saibateku, Community" />
|
<meta name="keywords" content="Flashii, Media, Flashwave, Circle, Zeniea, MalwareUp, Cybernetics, Saibateku, Community" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||||
{% if page.redirect %}
|
{% if page.redirect %}
|
||||||
<meta http-equiv="refresh" content="3; URL={{ page.redirect }}" />
|
<meta http-equiv="refresh" content="3; URL={{ page.redirect }}" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/global.css" />
|
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/global.css?s={{ php.time }}" />
|
||||||
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/yuuno.css" />
|
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/yuuno.css?s={{ php.time }}" />
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
||||||
<!-- JS -->
|
<!-- JS -->
|
||||||
<script type="text/javascript" src="{{ sakura.resources }}/js/yuuno.js"></script>
|
<script type="text/javascript" src="{{ sakura.resources }}/js/yuuno.js?s={{ php.time }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{% if not user.checklogin %}
|
{% if not user.checklogin %}
|
||||||
|
|
||||||
// Setting the shit so clicking the login link doesn't redirect to /login
|
// Setting the shit so clicking the login link doesn't redirect to /login
|
||||||
function initLoginForm() {
|
function initHeaderLoginForm() {
|
||||||
|
|
||||||
|
var headerLoginForm = document.getElementById('headerLoginForm');
|
||||||
var headerLoginLink = document.getElementById('headerLoginLink');
|
var headerLoginLink = document.getElementById('headerLoginLink');
|
||||||
|
var createInput = document.createElement('input');
|
||||||
|
|
||||||
headerLoginLink.setAttribute('href', 'javascript:;');
|
createInput.setAttribute('name', 'ajax');
|
||||||
|
createInput.setAttribute('value', 'true');
|
||||||
|
createInput.setAttribute('type', 'hidden');
|
||||||
|
headerLoginForm.appendChild(createInput);
|
||||||
|
|
||||||
|
headerLoginLink.setAttribute('href', 'javascript:void(0);');
|
||||||
headerLoginLink.setAttribute('onclick', 'toggleLoginForm();');
|
headerLoginLink.setAttribute('onclick', 'toggleLoginForm();');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,16 +45,71 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute initLoginForm() on load
|
{% else %}
|
||||||
window.onload = function(){initLoginForm();};
|
|
||||||
|
// Prepare header logout stuff
|
||||||
|
function initHeaderLoginForm() {
|
||||||
|
|
||||||
|
var headerLogoutLink = document.getElementById('headerLogoutLink');
|
||||||
|
|
||||||
|
headerLogoutLink.setAttribute('href', 'javascript:void(0);');
|
||||||
|
headerLogoutLink.setAttribute('onclick', 'doHeaderLogout();');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function doHeaderLogout() {
|
||||||
|
|
||||||
|
generateForm("headerLogoutForm", {"class":"hidden","method":"post","action":"//{{ sakura.urls.main }}/logout"},{"mode":"logout","ajax":"true","time":"{{ php.time }}","session":"{{ php.sessionid }}","redirect":"{{ sakura.currentpage }}"},"contentwrapper");
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
submitPost("headerLogoutForm", true, "Logging out...")
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
// Space for things that need to happen onload
|
||||||
|
window.onload = function() {
|
||||||
|
|
||||||
|
// Login form under header and ajax logout
|
||||||
|
initHeaderLoginForm();
|
||||||
|
|
||||||
|
{% if php.self == '/authenticate.php' %}
|
||||||
|
// AJAX Form Submission
|
||||||
|
var forms = {
|
||||||
|
"loginForm": 'Logging in...',
|
||||||
|
{% if not sakura.disableregister %}"registerForm": 'Processing registration...',{% endif %}
|
||||||
|
{% if not sakura.requireactive %}"resendForm": 'Attempting to resend activation...',{% endif %}
|
||||||
|
"passwordForm": 'Sending password recovery mail...'
|
||||||
|
};
|
||||||
|
|
||||||
|
for(var i in forms) {
|
||||||
|
var form = document.getElementById(i);
|
||||||
|
var submit = form.querySelector('[type="submit"]');
|
||||||
|
|
||||||
|
// TODO: Make hitting the enter key submit forms
|
||||||
|
//form.setAttribute('onkeypress', '');
|
||||||
|
|
||||||
|
submit.setAttribute('href', 'javascript:void(0);');
|
||||||
|
submit.setAttribute('onclick', 'submitPost(\''+ i +'\', true, \''+ forms[i] +'\');');
|
||||||
|
submit.setAttribute('type', 'button');
|
||||||
|
|
||||||
|
var createInput = document.createElement('input');
|
||||||
|
createInput.setAttribute('name', 'ajax');
|
||||||
|
createInput.setAttribute('value', 'true');
|
||||||
|
createInput.setAttribute('type', 'hidden');
|
||||||
|
form.appendChild(createInput);
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<span id="top"></span>
|
<span id="top"></span>
|
||||||
<div class="header" id="header">
|
<div class="header" id="header">
|
||||||
<a class="logo" href="/"></a>
|
<a class="logo" href="/">{{ sakura.sitename }}</a>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<div class="menu-nav" id="navMenuSite">
|
<div class="menu-nav" id="navMenuSite">
|
||||||
<!-- Navigation menu, displayed on left side of the bar. -->
|
<!-- Navigation menu, displayed on left side of the bar. -->
|
||||||
|
@ -63,7 +126,7 @@
|
||||||
{% if user.checklogin %}
|
{% if user.checklogin %}
|
||||||
<a class="menu-item avatar" href="//{{ sakura.urls.main }}/u/{{ user.data.id }}" title="View and edit your own profile" style="background-image: url('//{{ sakura.urls.main }}/a/{{ user.data.id }}'); width: auto; color: {{ user.rank.colour }}; font-weight: 700;">{{ user.data.username }}</a>
|
<a class="menu-item avatar" href="//{{ sakura.urls.main }}/u/{{ user.data.id }}" title="View and edit your own profile" style="background-image: url('//{{ sakura.urls.main }}/a/{{ user.data.id }}'); width: auto; color: {{ user.rank.colour }}; font-weight: 700;">{{ user.data.username }}</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/settings" title="Change your settings">Settings</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/settings" title="Change your settings">Settings</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/logout?mode=logout&time={{ php.time }}&session={{ php.sessionid }}&redirect={{ sakura.currentpage }}" title="End your login session">Logout</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/logout?mode=logout&time={{ php.time }}&session={{ php.sessionid }}&redirect={{ sakura.currentpage }}" title="End your login session" id="headerLogoutLink">Logout</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="menu-item" id="headerLoginLink" href="//{{ sakura.urls.main }}/login" title="Login to Flashii">Login</a>
|
<a class="menu-item" id="headerLoginLink" href="//{{ sakura.urls.main }}/login" title="Login to Flashii">Login</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/register" title="Create an account">Register</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/register" title="Create an account">Register</a>
|
||||||
|
@ -77,19 +140,17 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="contentwrapper">
|
<div id="contentwrapper">
|
||||||
{% if not user.checklogin %}
|
{% if not user.checklogin %}
|
||||||
<div class="hidden" id="headerLoginForm">
|
<form method="post" action="/authenticate" class="hidden" id="headerLoginForm">
|
||||||
<form method="post" action="/authenticate">
|
<input type="hidden" name="redirect" value="{{ sakura.currentpage }}" />
|
||||||
<input type="hidden" name="redirect" value="{{ sakura.currentpage }}" />
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
<input type="hidden" name="time" value="{{ php.time }}" />
|
<input type="hidden" name="mode" value="login" />
|
||||||
<input type="hidden" name="mode" value="login" />
|
<label for="headerLoginUserName">Username:</label>
|
||||||
<label for="headerLoginUserName">Username:</label>
|
<input type="text" id="headerLoginUserName" name="username" class="inputStyling" placeholder="Username" />
|
||||||
<input type="text" id="headerLoginUserName" name="username" class="inputStyling" placeholder="Username" />
|
<label for="headerLoginPassword">Password:</label>
|
||||||
<label for="headerLoginPassword">Password:</label>
|
<input type="password" id="headerLoginPassword" name="password" class="inputStyling" placeholder="Password" />
|
||||||
<input type="password" id="headerLoginPassword" name="password" class="inputStyling" placeholder="Password" />
|
<input type="checkbox" name="remember" id="headerLoginRemember" />
|
||||||
<input type="checkbox" name="remember" id="headerLoginRemember" />
|
<label for="headerLoginRemember">Remember me</label>
|
||||||
<label for="headerLoginRemember">Remember me</label>
|
<input type="button" onclick="submitPost(this.parentNode.id, true, 'Logging in...');" id="headerLoginButton" name="submit" class="inputStyling small" value="Login" />
|
||||||
<input type="submit" id="headerLoginButton" name="submit" class="inputStyling small" value="Login" />
|
</form>
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
<div class="loginCont">
|
<div class="loginCont">
|
||||||
<div class="loginForm">
|
<div class="loginForm">
|
||||||
<div class="head">
|
<div class="head">
|
||||||
Login to Flashii
|
Login to {{ sakura.sitename }}
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="http://{{ sakura.urls.main }}/authenticate">
|
<form method="post" action="//{{ sakura.urls.main }}/authenticate" id="loginForm">
|
||||||
<input type="hidden" name="redirect" value="{{ auth.redirect }}" />
|
<input type="hidden" name="redirect" value="{{ auth.redirect }}" />
|
||||||
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
<input type="hidden" name="time" value="{{ php.time }}" />
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<div class="head">
|
<div class="head">
|
||||||
Lost Password
|
Lost Password
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="http://{{ sakura.urls.main }}/authenticate">
|
<form method="post" action="//{{ sakura.urls.main }}/authenticate" id="passwordForm">
|
||||||
<input type="hidden" name="mode" value="forgotpassword" />
|
<input type="hidden" name="mode" value="forgotpassword" />
|
||||||
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
<input type="hidden" name="time" value="{{ php.time }}" />
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
|
@ -63,9 +63,10 @@
|
||||||
<div class="registerCont">
|
<div class="registerCont">
|
||||||
<div class="registerForm">
|
<div class="registerForm">
|
||||||
<div class="head">
|
<div class="head">
|
||||||
Register on Flashii
|
Register on {{ sakura.sitename }}
|
||||||
</div>
|
</div>
|
||||||
<form id="registerForm" method="post" action="http://{{ sakura.urls.main }}/authenticate" style="display:{% if auth.blockRegister.do %}none{% else %}block{% endif %};">
|
{% if not sakura.disableregister %}
|
||||||
|
<form id="registerForm" method="post" action="//{{ sakura.urls.main }}/authenticate" style="display:{% if auth.blockRegister.do %}none{% else %}block{% endif %};">
|
||||||
<input type="hidden" name="mode" value="register" />
|
<input type="hidden" name="mode" value="register" />
|
||||||
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
<input type="hidden" name="time" value="{{ php.time }}" />
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
|
@ -93,6 +94,15 @@
|
||||||
<div class="centreAlign">
|
<div class="centreAlign">
|
||||||
<input class="inputStyling" type="password" id="registerConfirmPassword" name="confirmpassword" placeholder="Just to make sure" />
|
<input class="inputStyling" type="password" id="registerConfirmPassword" name="confirmpassword" placeholder="Just to make sure" />
|
||||||
</div>
|
</div>
|
||||||
|
{% if sakura.requireregcodes %}
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="registerCode">Registration Code:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="text" id="registerCode" name="registercode" placeholder="Ask another member for one" />
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if sakura.recaptcha_enable %}
|
||||||
<div class="leftAlign">
|
<div class="leftAlign">
|
||||||
<label for="recaptcha_response_field">Verification:</label>
|
<label for="recaptcha_response_field">Verification:</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -112,6 +122,7 @@
|
||||||
</div>
|
</div>
|
||||||
</noscript>
|
</noscript>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="subLinks centreAlign">
|
<div class="subLinks centreAlign">
|
||||||
<input class="inputStyling" name="tos" type="checkbox" class="ignore-css" id="registerToS" /><label for="registerToS">I agree to the <a class="default" href="/r/terms" target="_blank">Terms of Service</a>.
|
<input class="inputStyling" name="tos" type="checkbox" class="ignore-css" id="registerToS" /><label for="registerToS">I agree to the <a class="default" href="/r/terms" target="_blank">Terms of Service</a>.
|
||||||
</div>
|
</div>
|
||||||
|
@ -133,12 +144,22 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<div class="registerForm" id="registerWarn" style="display: block;">
|
||||||
|
<div class="centreAlign">
|
||||||
|
<div class="fa fa-remove fa-5x" style="display: block; margin: 10px 0 0;"></div>
|
||||||
|
<h1>Registration is disabled.</h1>
|
||||||
|
<p>Please try again later.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="passwordForm">
|
{% if not sakura.requireactive %}
|
||||||
|
<div class="resendForm">
|
||||||
<div class="head">
|
<div class="head">
|
||||||
Resend Activation E-mail
|
Resend Activation E-mail
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="http://{{ sakura.urls.main }}/authenticate">
|
<form method="post" action="//{{ sakura.urls.main }}/authenticate" id="resendForm">
|
||||||
<input type="hidden" name="mode" value="resendactivemail" />
|
<input type="hidden" name="mode" value="resendactivemail" />
|
||||||
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
<input type="hidden" name="time" value="{{ php.time }}" />
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
|
@ -162,6 +183,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="//{{ sakura.urls.content }}/js/ybabstat.js"></script>
|
<script type="text/javascript" src="{{ sakura.resources }}/js/ybabstat.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
|
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
|
||||||
var disqus_shortname = 'flashii';
|
var disqus_shortname = 'flashii';
|
||||||
|
|
|
@ -31,24 +31,27 @@ body {
|
||||||
#contentwrapper {
|
#contentwrapper {
|
||||||
padding-bottom: 220px;
|
padding-bottom: 220px;
|
||||||
}
|
}
|
||||||
@media (max-width: 1033px) {
|
@media (max-width: 642px) {
|
||||||
#contentwrapper {
|
#contentwrapper {
|
||||||
padding-bottom: 230px;
|
padding-bottom: 335px;
|
||||||
}
|
|
||||||
}
|
|
||||||
@media (max-width: 860px) {
|
|
||||||
#contentwrapper {
|
|
||||||
padding-bottom: 375px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media (max-width: 510px) {
|
|
||||||
#contentwrapper {
|
|
||||||
padding-bottom: 380px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media (max-width: 426px) {
|
@media (max-width: 426px) {
|
||||||
#contentwrapper {
|
#contentwrapper {
|
||||||
padding-bottom: 625px;
|
padding-bottom: 450px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 400px) {
|
||||||
|
#contentwrapper {
|
||||||
|
padding-bottom: 450px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 300px) {
|
||||||
|
.footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#contentwrapper {
|
||||||
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,9 +208,6 @@ a.gotop:active {
|
||||||
color: #B06AC4;
|
color: #B06AC4;
|
||||||
transition: color .2s, text-shadow .2s;
|
transition: color .2s, text-shadow .2s;
|
||||||
}
|
}
|
||||||
.header .logo:after {
|
|
||||||
content: "Flashii Dev";
|
|
||||||
}
|
|
||||||
.header .logo:hover {
|
.header .logo:hover {
|
||||||
color: #C17BD5;
|
color: #C17BD5;
|
||||||
text-shadow: 0 0 .1em #C17BD5;
|
text-shadow: 0 0 .1em #C17BD5;
|
||||||
|
@ -217,15 +217,6 @@ a.gotop:active {
|
||||||
text-shadow: 0 0 .1em #A059B3;
|
text-shadow: 0 0 .1em #A059B3;
|
||||||
}
|
}
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
/*.header .logo {
|
|
||||||
background: none;
|
|
||||||
height: auto;
|
|
||||||
width: auto;
|
|
||||||
display: inline-block;
|
|
||||||
text-decoration: none;
|
|
||||||
font: 50px/60px "Segoe UI Light", sans-serif;
|
|
||||||
color: #B06AC4;
|
|
||||||
}*/
|
|
||||||
.header .logo {
|
.header .logo {
|
||||||
font: 100 50px/60px "Segoe UI", sans-serif;
|
font: 100 50px/60px "Segoe UI", sans-serif;
|
||||||
}
|
}
|
||||||
|
@ -396,6 +387,33 @@ a.gotop:active {
|
||||||
border-top: 1px solid #C2AEEE;
|
border-top: 1px solid #C2AEEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* AJAX Busy thing */
|
||||||
|
.ajax-busy {
|
||||||
|
background: rgba(0, 0, 0, .4);
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 5;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.ajax-busy .ajax-inner {
|
||||||
|
line-height: 2em;
|
||||||
|
color: #FFF;
|
||||||
|
background: #222;
|
||||||
|
background: linear-gradient(0deg, rgba(0, 0, 0, .4) 20%, transparent) rgba(0, 0, 0, .8);
|
||||||
|
display: inline-block;
|
||||||
|
margin: 10% auto 0;
|
||||||
|
padding: 10px 20px 15px;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 5px 1em #111;
|
||||||
|
}
|
||||||
|
.ajax-busy .ajax-inner h2 {
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Markdown Section */
|
/* Markdown Section */
|
||||||
.markdown {
|
.markdown {
|
||||||
font: 12px/1.4 "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
|
font: 12px/1.4 "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
|
||||||
|
|
|
@ -146,18 +146,185 @@ function donatePage(id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var RecaptchaOptions = {
|
function removeClass(className) {
|
||||||
theme : 'custom',
|
var objectCont = document.getElementsByClassName(className);
|
||||||
custom_theme_widget: 'recaptcha_widget'
|
|
||||||
};
|
while(objectCont.length > 0)
|
||||||
|
objectCont[0].parentNode.removeChild(objectCont[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeId(id) {
|
||||||
|
var objectCont = document.getElementById(id);
|
||||||
|
|
||||||
|
if(typeof(objectCont) != "undefined" && objectCont !== null)
|
||||||
|
objectCont.parentNode.removeChild(objectCont);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ajaxBusyView(show, message, type) {
|
||||||
|
var busyCont = document.getElementById('ajaxBusy');
|
||||||
|
var busyStat = document.getElementById('ajaxStatus');
|
||||||
|
var busyAnim = document.getElementById('ajaxAnimate');
|
||||||
|
var pageContent = document.getElementById('contentwrapper');
|
||||||
|
|
||||||
|
switch(type) {
|
||||||
|
|
||||||
|
default:
|
||||||
|
case 'busy':
|
||||||
|
var busyAnimIco = 'fa fa-refresh fa-spin fa-4x';
|
||||||
|
break;
|
||||||
|
case 'ok':
|
||||||
|
var busyAnimIco = 'fa fa-check fa-4x';
|
||||||
|
break;
|
||||||
|
case 'fail':
|
||||||
|
var busyAnimIco = 'fa fa-remove fa-4x';
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(show) {
|
||||||
|
if(busyCont == null) {
|
||||||
|
var createBusyCont = document.createElement('div');
|
||||||
|
createBusyCont.className = 'ajax-busy';
|
||||||
|
createBusyCont.setAttribute('id', 'ajaxBusy');
|
||||||
|
|
||||||
|
var createBusyInner = document.createElement('div');
|
||||||
|
createBusyInner.className = 'ajax-inner';
|
||||||
|
createBusyCont.appendChild(createBusyInner);
|
||||||
|
|
||||||
|
var createBusyMsg = document.createElement('h2');
|
||||||
|
createBusyMsg.setAttribute('id', 'ajaxStatus');
|
||||||
|
createBusyInner.appendChild(createBusyMsg);
|
||||||
|
|
||||||
|
var createBusySpin = document.createElement('div');
|
||||||
|
createBusySpin.setAttribute('id', 'ajaxAnimate');
|
||||||
|
createBusyInner.appendChild(createBusySpin);
|
||||||
|
|
||||||
|
pageContent.appendChild(createBusyCont);
|
||||||
|
|
||||||
|
busyCont = document.getElementById('ajaxBusy');
|
||||||
|
busyStat = document.getElementById('ajaxStatus');
|
||||||
|
busyAnim = document.getElementById('ajaxAnimate');
|
||||||
|
}
|
||||||
|
|
||||||
|
busyAnim.className = busyAnimIco;
|
||||||
|
|
||||||
|
if(message == null)
|
||||||
|
busyStat.innerHTML = 'Please wait';
|
||||||
|
else
|
||||||
|
busyStat.innerHTML = message;
|
||||||
|
} else {
|
||||||
|
if(busyCont != null) {
|
||||||
|
var fadeOut = setInterval(function() {
|
||||||
|
if(busyCont.style.opacity == null || busyCont.style.opacity == "")
|
||||||
|
busyCont.style.opacity = 1;
|
||||||
|
|
||||||
|
if(busyCont.style.opacity > 0) {
|
||||||
|
busyCont.style.opacity = busyCont.style.opacity - .1;
|
||||||
|
} else {
|
||||||
|
removeId('ajaxBusy');
|
||||||
|
clearInterval(fadeOut);
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ajaxPost(url, data) {
|
||||||
|
var req = new XMLHttpRequest();
|
||||||
|
req.open("POST", url, false);
|
||||||
|
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||||
|
|
||||||
|
var query = [];
|
||||||
|
for(var i in data)
|
||||||
|
query.push(encodeURIComponent(i) +"="+ encodeURIComponent(data[i]));
|
||||||
|
|
||||||
|
req.send(query.join("&"));
|
||||||
|
|
||||||
|
if(req.status === 200)
|
||||||
|
return req.responseText;
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quickly building a form for god knows what reason
|
||||||
|
function generateForm(formId, formAttr, formData, appendTo) {
|
||||||
|
|
||||||
|
// Create form elements and assign ID
|
||||||
|
var form = document.createElement('form');
|
||||||
|
form.setAttribute('id', formId);
|
||||||
|
|
||||||
|
// Set additional attributes
|
||||||
|
if(formAttr != null) {
|
||||||
|
for(var i in formAttr)
|
||||||
|
form.setAttribute(i, formAttr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate input elements
|
||||||
|
for(var i in formData) {
|
||||||
|
var disposableVar = document.createElement('input');
|
||||||
|
disposableVar.setAttribute('type', 'hidden');
|
||||||
|
disposableVar.setAttribute('name', i);
|
||||||
|
disposableVar.setAttribute('value', formData[i]);
|
||||||
|
form.appendChild(disposableVar);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append to another element if requested
|
||||||
|
if(appendTo != null)
|
||||||
|
document.getElementById(appendTo).appendChild(form);
|
||||||
|
|
||||||
|
// Return the completed form
|
||||||
|
return form;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submitting a form using an AJAX POST request
|
||||||
|
function submitPost(formId, busyView, msg) {
|
||||||
|
|
||||||
|
// If requested display the busy thing
|
||||||
|
if(busyView)
|
||||||
|
ajaxBusyView(true, msg, 'busy');
|
||||||
|
|
||||||
|
// Get form data
|
||||||
|
var form = document.getElementById(formId);
|
||||||
|
|
||||||
|
// Make sure the form id was proper and if not report an error
|
||||||
|
if(form == null) {
|
||||||
|
if(busyView) {
|
||||||
|
ajaxBusyView(true, 'Invalid Form ID, contact the administrator.');
|
||||||
|
setTimeout(function(){ajaxBusyView(false);}, 2000);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make an object for the request parts
|
||||||
|
var requestParts = new Object();
|
||||||
|
|
||||||
|
// Get all children with a name attribute
|
||||||
|
var children = form.querySelectorAll('[name]');
|
||||||
|
|
||||||
|
// Sort children and make them ready for submission
|
||||||
|
for(var i in children) {
|
||||||
|
|
||||||
|
if(typeof children[i] == 'object')
|
||||||
|
requestParts[children[i].name] = ((typeof children[i].type !== "undefined" && children[i].type.toLowerCase() == "checkbox") ? children[i].checked : children[i].value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submit the AJAX request
|
||||||
|
var request = ajaxPost(form.action, requestParts).split('|');
|
||||||
|
|
||||||
|
// If using the busy view thing update the text displayed to the return of the request
|
||||||
|
if(busyView)
|
||||||
|
ajaxBusyView(true, request[1], (request[2] == '1' ? 'ok' : 'fail'));
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
if(busyView)
|
||||||
|
ajaxBusyView(false);
|
||||||
|
|
||||||
|
if(request[2] == '1')
|
||||||
|
window.location = request[3];
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
function switch_text(type) {
|
|
||||||
var responseField = document.getElementById('recaptcha_response_field');
|
|
||||||
|
|
||||||
if(type == "audio")
|
|
||||||
responseField.setAttribute('placeholder', 'Enter the words you hear');
|
|
||||||
else if(type == "image")
|
|
||||||
responseField.setAttribute('placeholder', 'Enter the words above');
|
|
||||||
else
|
|
||||||
responseField.setAttribute('placeholder', 'undefined rolls undefined and gets undefined');
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ RewriteRule ^credits?/?$ credits.php
|
||||||
RewriteRule ^index?/?$ index.php
|
RewriteRule ^index?/?$ index.php
|
||||||
RewriteRule ^login?/?$|logout?/?$|activate?/?$|register?/?$|forgotpassword?/?|authenticate?/?$ authenticate.php
|
RewriteRule ^login?/?$|logout?/?$|activate?/?$|register?/?$|forgotpassword?/?|authenticate?/?$ authenticate.php
|
||||||
RewriteRule ^donate?/?$ donate.php
|
RewriteRule ^donate?/?$ donate.php
|
||||||
RewriteRule ^contact?/?$ contact.php
|
RewriteRule ^contact?/?$ infopage.php?r=contact
|
||||||
|
|
||||||
## Info pages
|
## Info pages
|
||||||
RewriteRule ^r/([a-z]+)$ infopage.php?r=$1
|
RewriteRule ^r/([a-z]+)$ infopage.php?r=$1
|
||||||
|
|
|
@ -10,9 +10,7 @@ namespace Sakura;
|
||||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||||
|
|
||||||
// Page actions
|
// Page actions
|
||||||
if(
|
if(isset($_REQUEST['mode'])) {
|
||||||
isset($_REQUEST['mode'])
|
|
||||||
) {
|
|
||||||
|
|
||||||
// Continue
|
// Continue
|
||||||
$continue = true;
|
$continue = true;
|
||||||
|
@ -21,12 +19,13 @@ if(
|
||||||
if(!isset($_REQUEST['mode']) || $_REQUEST['mode'] != 'activate') {
|
if(!isset($_REQUEST['mode']) || $_REQUEST['mode'] != 'activate') {
|
||||||
|
|
||||||
// Compare time and session so we know the link isn't forged
|
// Compare time and session so we know the link isn't forged
|
||||||
if($_REQUEST['time'] < time() - 1000) {
|
if(!isset($_REQUEST['time']) || $_REQUEST['time'] < time() - 1000) {
|
||||||
|
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Action failed',
|
'title' => 'Action failed',
|
||||||
'redirect' => '/authenticate',
|
'redirect' => '/authenticate',
|
||||||
'message' => 'Timestamps differ too much, please try again.'
|
'message' => 'Timestamps differ too much, please try again.',
|
||||||
|
'success' => 0
|
||||||
];
|
];
|
||||||
|
|
||||||
// Prevent
|
// Prevent
|
||||||
|
@ -40,7 +39,8 @@ if(
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Action failed',
|
'title' => 'Action failed',
|
||||||
'redirect' => '/authenticate',
|
'redirect' => '/authenticate',
|
||||||
'message' => 'Session IDs do not match.'
|
'message' => 'Session IDs do not match.',
|
||||||
|
'success' => 0
|
||||||
];
|
];
|
||||||
|
|
||||||
// Prevent
|
// Prevent
|
||||||
|
@ -70,7 +70,8 @@ if(
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Logout',
|
'title' => 'Logout',
|
||||||
'redirect' => ($logout ? $_REQUEST['redirect'] : '/authenticate'),
|
'redirect' => ($logout ? $_REQUEST['redirect'] : '/authenticate'),
|
||||||
'message' => $logout ? 'You are now logged out.' : 'Logout failed.'
|
'message' => $logout ? 'You are now logged out.' : 'Logout failed.',
|
||||||
|
'success' => $logout ? 1 : 0
|
||||||
];
|
];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -94,7 +95,8 @@ if(
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Activate account',
|
'title' => 'Activate account',
|
||||||
'redirect' => '/authenticate',
|
'redirect' => '/authenticate',
|
||||||
'message' => $messages[$activate[1]]
|
'message' => $messages[$activate[1]],
|
||||||
|
'success' => $activate[0]
|
||||||
];
|
];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -102,6 +104,17 @@ if(
|
||||||
// Resending the activation e-mail
|
// Resending the activation e-mail
|
||||||
case 'resendactivemail':
|
case 'resendactivemail':
|
||||||
|
|
||||||
|
// Attempt send
|
||||||
|
//Users::resendActivationMail($_REQUEST['username'], $_REQUEST['email']);
|
||||||
|
|
||||||
|
// Add page specific things
|
||||||
|
$renderData['page'] = [
|
||||||
|
'title' => 'Resend Activation',
|
||||||
|
'redirect' => '/authenticate',
|
||||||
|
'message' => $messages[$resend[1]],
|
||||||
|
'success' => $resend[0]
|
||||||
|
];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Login processing
|
// Login processing
|
||||||
|
@ -124,7 +137,8 @@ if(
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Login',
|
'title' => 'Login',
|
||||||
'redirect' => ($login[0] ? $_REQUEST['redirect'] : '/authenticate'),
|
'redirect' => ($login[0] ? $_REQUEST['redirect'] : '/authenticate'),
|
||||||
'message' => $messages[$login[1]]
|
'message' => $messages[$login[1]],
|
||||||
|
'success' => $login[0]
|
||||||
];
|
];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -171,9 +185,10 @@ if(
|
||||||
|
|
||||||
// Add page specific things
|
// Add page specific things
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Register on Flashii',
|
'title' => 'Register',
|
||||||
'redirect' => ($register[0] ? '/' : '/authenticate'),
|
'redirect' => ($register[0] ? '/' : '/authenticate'),
|
||||||
'message' => $messages[$register[1]]
|
'message' => $messages[$register[1]],
|
||||||
|
'success' => $register[0]
|
||||||
];
|
];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -185,7 +200,8 @@ if(
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Forgot Password',
|
'title' => 'Forgot Password',
|
||||||
'redirect' => $_SERVER['PHP_SELF'],
|
'redirect' => $_SERVER['PHP_SELF'],
|
||||||
'message' => 'what'
|
'message' => 'what',
|
||||||
|
'success' => 0
|
||||||
];
|
];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -197,9 +213,11 @@ if(
|
||||||
print isset($_REQUEST['ajax']) ?
|
print isset($_REQUEST['ajax']) ?
|
||||||
(
|
(
|
||||||
$renderData['page']['title']
|
$renderData['page']['title']
|
||||||
. ':'
|
. '|'
|
||||||
. $renderData['page']['message']
|
. $renderData['page']['message']
|
||||||
. ':'
|
. '|'
|
||||||
|
. $renderData['page']['success']
|
||||||
|
. '|'
|
||||||
. $renderData['page']['redirect']
|
. $renderData['page']['redirect']
|
||||||
) :
|
) :
|
||||||
Templates::render('errors/information.tpl', $renderData);
|
Templates::render('errors/information.tpl', $renderData);
|
||||||
|
@ -218,7 +236,7 @@ $renderData['auth'] = [
|
||||||
(
|
(
|
||||||
isset($_SERVER['HTTP_REFERER']) ?
|
isset($_SERVER['HTTP_REFERER']) ?
|
||||||
$_SERVER['HTTP_REFERER'] :
|
$_SERVER['HTTP_REFERER'] :
|
||||||
Configuration::getLocalConfig('urls', 'main')
|
'/'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'blockRegister' => [
|
'blockRegister' => [
|
||||||
|
|
Reference in a new issue