Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // include environment related files
- include_once '../inc/env.inc.php';
- // will return JSON response
- header('Content-type: application/json');
- WEApplication::serviceAvailabilityCheck();
- $secretDev = isset($_POST['secret_dev']) ? $_POST['secret_dev'] : '';
- $pending = isset($_POST['pending']) ? $_POST['pending'] : 0;
- if ($secretDev != _WE_SECRET_DEV_KEY_) {
- die('{"result":"ERROR","code":"1","error":"Incorrect secret key"}');
- }
- // Successful response
- $JSON = '{';
- $JSON .= '"result":"OK",';
- $JSON .= '"shops":[';
- $shops= WEShop::shops(array('pending'=>$pending));
- $i=0;
- foreach ($shops as $shop) {
- if ($i>0) {
- $JSON.=',';
- }
- ++$i;
- $JSON.=$shop->propertiesAsJSON();
- }
- $JSON.='],';
- $JSON .= '"teams":[';
- $teams= WETeam::getTeams();
- $i=0;
- foreach ($teams as $team) {
- if ($i>0) {
- $JSON.=',';
- }
- ++$i;
- $JSON.=$team->propertiesAsJSON();
- }
- $JSON.=']}';
- echo $JSON;
Add Comment
Please, Sign In to add comment