diff --git a/mojotrollz/page/autoload.inc b/mojotrollz/page/autoload.inc index 15c5816..a7a7ef3 100644 --- a/mojotrollz/page/autoload.inc +++ b/mojotrollz/page/autoload.inc @@ -4,4 +4,5 @@ require_once dirname(__FILE__).'/default_page/autoload.inc'; require_once dirname(__FILE__).'/default_start/autoload.inc'; require_once dirname(__FILE__).'/default_impressum/autoload.inc'; require_once dirname(__FILE__).'/default_login/autoload.inc'; -require_once dirname(__FILE__).'/default_serverlist/autoload.inc'; \ No newline at end of file +require_once dirname(__FILE__).'/default_serverlist/autoload.inc'; +require_once dirname(__FILE__).'/default_beta/autoload.inc'; \ No newline at end of file diff --git a/mojotrollz/page/default_beta/autoload.inc b/mojotrollz/page/default_beta/autoload.inc new file mode 100644 index 0000000..8fd92c5 --- /dev/null +++ b/mojotrollz/page/default_beta/autoload.inc @@ -0,0 +1,2 @@ +key=$key;} + public function html(){ + if(\SQL\BETA_CHECK_CODE::Q1(array($this->key))['count'] == 0){ + $vars = \SYSTEM\PAGE\text::tag('mojotrollz'); + $vars['invalid_key'] = $this->key ? '
Your key is invalid or already in use!
' : ''; + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PPAGE(),'default_beta/tpl/beta.tpl'), $vars); + } + $vars = \SYSTEM\PAGE\text::tag('basic'); + $vars['key'] = $this->key; + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PPAGE(),'default_beta/tpl/beta_register.tpl'), $vars); + } + public static function js(){ + return array( \SYSTEM\WEBPATH(new PPAGE(),'default_beta/js/default_beta.js'), + \LIB\lib_jqbootstrapvalidation::js());} +} \ No newline at end of file diff --git a/mojotrollz/page/default_beta/js/default_beta.js b/mojotrollz/page/default_beta/js/default_beta.js new file mode 100644 index 0000000..812db92 --- /dev/null +++ b/mojotrollz/page/default_beta/js/default_beta.js @@ -0,0 +1,31 @@ +function init_beta(){ + $("#btn_beta").click(function(){ + system.load('beta;key.'+$('#input_beta_key').val()); + }); + + //jqBootstrapValidation + $("#register_user_form input").not("[type=submit]").jqBootstrapValidation({ + preventSubmit: true, + submitError: function (form, event, errors) {}, + submitSuccess: function($form, event){ + var username = document.getElementById('register_username').value; + var email = document.getElementById('register_email').value; + var password = document.getElementById('user_register_password2').value; + + $.ajax({ + dataType: "json", + url: './api.php?call=beta&action=register&username='+username+'&password='+$.sha1(password)+'&email='+email, + data: null, + success: function (dataCreate) { + if(dataCreate === 1){ // reload -> user will be loged in + location.reload(); + }else{ // show errors + alert('Not successfull: '+dataCreate); + } + } + }); + + event.preventDefault(); + } + }); +} \ No newline at end of file diff --git a/mojotrollz/page/default_beta/tpl/beta.tpl b/mojotrollz/page/default_beta/tpl/beta.tpl new file mode 100644 index 0000000..6403da5 --- /dev/null +++ b/mojotrollz/page/default_beta/tpl/beta.tpl @@ -0,0 +1,26 @@ +Your Beta Key is: ${key}
+