Skip to content

Commit

Permalink
MDL-42072 badges: Fix output and headers in badges ajax scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuliya Bozhko committed Oct 1, 2013
1 parent c777836 commit 021501f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions badges/ajax.php
Expand Up @@ -41,6 +41,8 @@
$outcome = new stdClass();
$outcome->code = $result;
$outcome->response = get_string('error:backpacknotavailable', 'badges') . $OUTPUT->help_icon('backpackavailability', 'badges');

echo $OUTPUT->header();
echo json_encode($outcome);

die();
5 changes: 3 additions & 2 deletions badges/assertion.php
Expand Up @@ -24,6 +24,8 @@
* @author Yuliya Bozhko <yuliya.bozhko@totaralms.com>
*/

define('AJAX_SCRIPT', true);

require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->libdir . '/badgeslib.php');

Expand All @@ -35,6 +37,5 @@

$badge = badges_get_issued_badge_info($hash);

header('Content-type: application/json; charset=utf-8');

echo $OUTPUT->header();
echo json_encode($badge);
1 change: 1 addition & 0 deletions badges/backpackconnect.php
Expand Up @@ -34,6 +34,7 @@
require_login();
$PAGE->set_url('/badges/backpackconnect.php');
$PAGE->set_context(context_system::instance());
echo $OUTPUT->header();

// Use PHP input filtering as there is no PARAM type for
// the type of cleaning that is required (ASCII chars 32-127 only).
Expand Down

0 comments on commit 021501f

Please sign in to comment.