<?php /** * Some test for utils.php. */ include '../app/inc/Json2Construct2.php'; $jsonC2 = Json2Construct2::instance($f3); // Method: toC2Dictionary $test->expect(json_decode($jsonC2->toC2Dictionary('[["1"],["2"],["3"]]')) != null, sprintf($msg, 'toC2Dictionary', 'Return value should be a valid JSON')); // Method: toC2Array $test->expect(json_decode($jsonC2->toC2Array(1, 1, 1, '[["1"]')) != null, sprintf($msg, 'toC2Array', 'Return value should be a valid JSON'));
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * A self hosted Open source PHP Leaderboard. Post, fetch and display high scores. * @link http://ukelelestudio.com */ //Permissive mode header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: Access-Control-Allow-Origin'); $f3 = (require 'lib/base.php'); $f3->config('config.ini'); $f3->set('AUTOLOAD', 'app/;app/inc/'); $f3->set('DEBUG', 3); $leaderboard = Leaderboard::instance(); $leaderboardC2 = LeaderboardC2::instance(); $construct2 = Json2Construct2::instance(); $crypt = Cryptme::instance(); $util = Utils::instance(); $f3->set('leaderboard', $leaderboard); $f3->set('leaderboardC2', $leaderboard); $f3->set('construct2', $construct2); $f3->set('cryptme', $crypt); $f3->set('util', $util); $sanidad = Sanidad::instance($f3); $f3->set('sanidad', $sanidad); //Routing $f3->route('GET /addscore/@game/@key/@playername/@score', 'leaderboardC2->addScore'); $f3->route('GET /getlastrank/@game/@playername', 'leaderboardC2->getLastRank'); $f3->route('GET /getbestrank/@game/@playername', 'leaderboardC2->getBestRank'); $f3->route('GET /topscores/@game/@limit', 'leaderboardC2->topScores'); $f3->route('GET /topscores/@game', 'leaderboardC2->topScores');