diff --git a/modules/leaderboard/edit.php b/modules/leaderboard/edit.php index bd3debf..9fc9207 100644 --- a/modules/leaderboard/edit.php +++ b/modules/leaderboard/edit.php @@ -1,14 +1,30 @@ $leaderboards[$_GET['uid']]); + } + catch (Exception $e) + { + exit($e->getMessage()); + } } } diff --git a/modules/user/authenticate.php b/modules/user/authenticate.php index 6c6363a..c1b8f1b 100644 --- a/modules/user/authenticate.php +++ b/modules/user/authenticate.php @@ -26,9 +26,8 @@ class user_authenticate extends AnonymousModule if ($user['password'] == crypt($_POST['password'], $user['password'])) { setcookie('__auth', base64_encode($uid . '|' . $user['auth']), time() + Time::YEAR, '/'); + return array('status' => 'success', 'url' => '/leaderboards'); } - - return array('status' => 'success', 'url' => '/leaderboards'); } return array('error' => 'Invalid email address or password.'); diff --git a/public/js/jerky.min.js b/public/js/jerky.min.js index f043716..9d108b5 100644 --- a/public/js/jerky.min.js +++ b/public/js/jerky.min.js @@ -1,6 +1,6 @@ $(function(){jQuery().validate&&$("form").validate();$(".ajax [type=submit]").on("click",function(){if("readonly"!=$(this).attr("readonly")){var a=$(this).parents("form").get();$(".alert[generated], label.error",a).remove();if("undefined"==typeof $(a).valid||!0==$(a).valid()){if(void 0==typeof $(a).data("readonly")||!1!=$(a).data("readonly"))$("button, input, textarea",a).attr("readonly","readonly"),document.body.style.cursor="wait",$(this).hide(),$(this).after("");var c=""== $(a).attr("method")?"GET":$(a).attr("method"),d=$(a).attr("action");if(""==d)injectMessage(a,"Form element lacks action attribute","error"),$("button, input, textarea",a).removeAttr("readonly"),document.body.style.cursor="default",$("progress",a).remove(),$('[type="submit"]',a).show();else{var f=$(a).serialize(),e=void 0!=typeof $(a).data("readonly")&&!1==$(a).data("readonly");if(e){if(void 0!=typeof $(a).data("preprocessor"))window[$(a).data("preprocessor")]();$("input[type=text]",a).val("");$("select", -a).val("");$("textarea",a).val("");void 0!=typeof $(a).data("focus")&&$($(a).data("focus")).focus()}$.ajax({type:c,url:d,data:f,dataType:"json",success:function(b){"undefined"!=typeof b.success?(b.status="success",b.message=b.success):"undefined"!=typeof b.error&&(b.status="error",b.message=b.error);if("success"!=b.status&&"undefined"!=typeof b.message)injectMessage(a,b.message,"error");else if("success"==b.status){if(("undefined"==typeof b.retain||!1==b.retain)&&!e)$("input[type=text]",a).val(""), +a).val("");$("textarea",a).val("");void 0!=typeof $(a).data("focus")&&$($(a).data("focus")).focus()}$.ajax({type:c,url:d,data:f,dataType:"json",success:function(b,c,d){"undefined"!=typeof b.success?(b.status="success",b.message=b.success):"undefined"!=typeof b.error&&(b.status="error",b.message=b.error);if("success"!=b.status&&"undefined"!=typeof b.message)injectMessage(a,b.message,"error");else if("success"==b.status){if(("undefined"==typeof b.retain||!1==b.retain)&&!e)$("input[type=text]",a).val(""), $("input[type=email]",a).val(""),$("select",a).val(""),$("textarea",a).val("");"undefined"!=typeof b.message&&injectMessage(a,b.message,"success");"undefined"!=typeof b.url&&(parent.location.href=b.url)}if("undefined"!=typeof b.callback)window[b.callback](b);$("button, input, textarea",a).removeAttr("readonly");document.body.style.cursor="default";$("progress",a).remove();$('[type="submit"]',a).show()},error:function(b,c,d){injectMessage(a,d,"error");$("button, input, textarea",a).removeAttr("readonly"); document.body.style.cursor="default";$("progress",a).remove();$('[type="submit"]',a).show()}})}}else return!1}});$("form.ajax").submit(function(){return!1});$("table tr:even td").addClass("even");$("table tr:odd td").addClass("odd")}); function injectMessage(a,c,d,f){"undefined"==typeof d&&(d="error");var e="alert-"+Date.now();c='";$(".alert[generated]",a).remove();$(a).hasClass("box")||$(a).parent(".two-column")?$('[type="submit"]',a).before(c):$(a).prepend(c);e="#"+e;"undefined"!=typeof f&&$(e,a).delay(f).remove();return $(e,a)}function autoTab(a){$(a).val().length>=$(a).attr("maxlength")&&$(a).next().focus()} diff --git a/templates/api.phtml b/templates/api.phtml index c94b09b..e0ae256 100644 --- a/templates/api.phtml +++ b/templates/api.phtml @@ -35,6 +35,13 @@ if ($this->module['api_key'])

{endpoint}?key={key} where {endpoint} is the call being made and {key} is your API key.

+

Results

+ +

The API only returns a JSON formatted string and utilizes both HTTP status codes as well as a response_code variable in the results. On error, there will also be a error variable that will contain additional information about the error that was encountered.

+ +

Pretty Print

+ +

To help with readability of the returned JSON we offer the pretty parameter which will force the JSON output to be prettified. Simply add &pretty=true after your key to use this parameter.

Endpoints