Skip to content

Commit

Permalink
MDL-25973 add missing charset
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jan 14, 2011
1 parent 5a7f931 commit 8a7703c
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion admin/dbtransfer/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function dbtransfer_export_xml_database($description, $mdb) {

session_get_instance()->write_close(); // release session

header('Content-Type: application/xhtml+xml');
header('Content-Type: application/xhtml+xml; charset=utf-8');
header('Content-Disposition: attachment; filename=database.xml');
header('Expires: 0');
header('Cache-Control: must-revalidate,post-check=0,pre-check=0');
Expand Down
2 changes: 1 addition & 1 deletion admin/xmldb/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
echo $OUTPUT->footer();
break;
case ACTION_GENERATE_XML:
header('Content-type: application/xhtml+xml');
header('Content-type: application/xhtml+xml; charset=utf-8');
echo $xmldb_action->getOutput();
break;
}
Expand Down
2 changes: 1 addition & 1 deletion calendar/export_execute.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,6 @@
header('Accept-Ranges: none'); // Comment out if PDFs do not work...
header('Content-disposition: attachment; filename='.$filename);
header('Content-length: '.strlen($serialized));
header('Content-type: text/calendar');
header('Content-type: text/calendar; charset=utf-8');

echo $serialized;
2 changes: 1 addition & 1 deletion filter/algebra/algebradebug.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function refineTeX($texexp) {
}

function outputText($texexp) {
header("Content-type: text/html");
header("Content-type: text/html; charset=utf-8");
echo "<html><body><pre>\n";
if ($texexp) {
$texexp = str_replace('<','&lt;',$texexp);
Expand Down
2 changes: 1 addition & 1 deletion filter/tex/texdebug.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@


function outputText($texexp) {
header("Content-type: text/html");
header("Content-type: text/html; charset=utf-8");
echo "<html><body><pre>\n";
if ($texexp) {
$texexp = str_replace('<', '&lt;', $texexp);
Expand Down
10 changes: 5 additions & 5 deletions lib/ajax/getnavbranch.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
$navigation = new global_navigation_for_ajax($PAGE, $branchtype, $branchid);

$linkcategories = false;

if ($instanceid!==null) {
// Get the db record for the block instance
$blockrecord = $DB->get_record('block_instances', array('id'=>$instanceid,'blockname'=>'navigation'));
Expand Down Expand Up @@ -86,17 +86,17 @@
$block->trim($navigation, $trimmode, $trimlength, ceil($trimlength/2));
}
$converter = new navigation_json();

// Find the actuall branch we are looking for
$branch = $navigation->find($branchid, $branchtype);

// Remove links to categories if required.
if (!$linkcategories) {
foreach ($branch->find_all_of_type(navigation_node::TYPE_CATEGORY) as $category) {
$category->action = null;
}
}

// Stop buffering errors at this point
$html = ob_get_contents();
ob_end_clean();
Expand All @@ -116,6 +116,6 @@
// Prepare an XML converter for the branch
$converter->set_expandable($navigation->get_expandable());
// Set XML headers
header('Content-type: text/plain');
header('Content-type: text/plain; charset=utf-8');
// Convert and output the branch as XML
echo $converter->convert($branch);
6 changes: 3 additions & 3 deletions lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function standard_head_html() {
$output .= html_writer::empty_tag('link', array('rel' => 'alternate',
'type' => $type, 'title' => $alt->title, 'href' => $alt->url));
}

if (!empty($CFG->additionalhtmlhead)) {
$output .= "\n".$CFG->additionalhtmlhead;
}
Expand Down Expand Up @@ -2719,9 +2719,9 @@ public function redirect_message($encodedurl, $message, $delay, $debugdisablered
public function header() {
// unfortunately YUI iframe upload does not support application/json
if (!empty($_FILES)) {
@header('Content-type: text/plain');
@header('Content-type: text/plain; charset=utf-8');
} else {
@header('Content-type: application/json');
@header('Content-type: application/json; charset=utf-8');
}

/// Headers to make it not cacheable and json
Expand Down
2 changes: 1 addition & 1 deletion lib/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
// Detect CLI maintenance mode - this is useful when you need to mess with database, such as during upgrades
if (file_exists("$CFG->dataroot/climaintenance.html")) {
if (!CLI_SCRIPT) {
header('Content-type: text/html');
header('Content-type: text/html; charset=utf-8');
/// Headers to make it not cacheable and json
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
Expand Down
2 changes: 1 addition & 1 deletion lib/setuplib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ public static function early_error($message, $moreinfourl, $link, $backtrace, $d
$e->stacktrace = format_backtrace($backtrace, true);
}
}
@header('Content-Type: application/json');
@header('Content-Type: application/json; charset=utf-8');
echo json_encode($e);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion mnet/publickey.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
print_error('mnetdisabled', 'mnet');
}

header("Content-type: text/plain");
header("Content-type: text/plain; charset=utf-8");
$keypair = mnet_get_keypair();
echo $keypair['certificate'];
6 changes: 3 additions & 3 deletions mod/chat/chatd.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ function dispatch_sidekick($handle, $type, $sessionid, $customdata) {
$header .= "Connection: close\n";
$header .= "Date: ".date('r')."\n";
$header .= "Server: Moodle\n";
$header .= "Content-Type: text/html\n";
$header .= "Content-Type: text/html; charset=utf-8\n";
$header .= "Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT\n";
$header .= "Cache-Control: no-cache, must-revalidate\n";
$header .= "Expires: Wed, 4 Oct 1978 09:32:45 GMT\n";
Expand All @@ -383,7 +383,7 @@ function dispatch_sidekick($handle, $type, $sessionid, $customdata) {
$header .= "Connection: close\n";
$header .= "Date: ".date('r')."\n";
$header .= "Server: Moodle\n";
$header .= "Content-Type: text/html\n";
$header .= "Content-Type: text/html; charset=utf-8\n";
$header .= "Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT\n";
$header .= "Cache-Control: no-cache, must-revalidate\n";
$header .= "Expires: Wed, 4 Oct 1978 09:32:45 GMT\n";
Expand Down Expand Up @@ -461,7 +461,7 @@ function dispatch_sidekick($handle, $type, $sessionid, $customdata) {
$header .= "Connection: close\n";
$header .= "Date: ".date('r')."\n";
$header .= "Server: Moodle\n";
$header .= "Content-Type: text/html\n";
$header .= "Content-Type: text/html; charset=utf-8\n";
$header .= "Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT\n";
$header .= "Cache-Control: no-cache, must-revalidate\n";
$header .= "Expires: Wed, 4 Oct 1978 09:32:45 GMT\n";
Expand Down
2 changes: 1 addition & 1 deletion mod/data/css.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT');
header('Cache-control: max_age = '. $lifetime);
header('Pragma: ');
header('Content-type: text/css'); // Correct MIME type
header('Content-type: text/css; charset=utf-8'); // Correct MIME type

echo $data->csstemplate;
}
2 changes: 1 addition & 1 deletion mod/data/js.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT');
header('Cache-control: max_age = '. $lifetime);
header('Pragma: ');
header('Content-type: text/css'); // Correct MIME type
header('Content-type: text/css; charset=utf-8'); // Correct MIME type

echo $data->jstemplate;
}
2 changes: 1 addition & 1 deletion repository/repository_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
$search_text = optional_param('s', '', PARAM_CLEANHTML);
$linkexternal = optional_param('linkexternal', '', PARAM_ALPHA);

@header('Content-type: text/plain');
@header('Content-type: text/plain; charset=utf-8');

// if uploaded file is larger than post_max_size (php.ini) setting, $_POST content will lost
if (empty($_POST) && !empty($action)) {
Expand Down
4 changes: 2 additions & 2 deletions theme/javascript.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function send_cached_js($jspath) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
header('Content-Type: application/javascript');
header('Content-Type: application/javascript; charset=utf-8');
if (!min_enable_zlib_compression()) {
header('Content-Length: '.filesize($jspath));
}
Expand All @@ -110,7 +110,7 @@ function send_uncached_js($js) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + 2) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
header('Content-Type: application/javascript');
header('Content-Type: application/javascript; charset=utf-8');
header('Content-Length: '.strlen($js));

echo $js;
Expand Down
4 changes: 2 additions & 2 deletions theme/styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function send_ie_css($themename, $rev) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
header('Content-Type: text/css');
header('Content-Type: text/css; charset=utf-8');
header('Content-Length: '.strlen($css));

echo $css;
Expand All @@ -147,7 +147,7 @@ function send_cached_css($csspath, $rev) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
header('Content-Type: text/css');
header('Content-Type: text/css; charset=utf-8');
if (!min_enable_zlib_compression()) {
header('Content-Length: '.filesize($csspath));
}
Expand Down
2 changes: 1 addition & 1 deletion theme/styles_debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function send_uncached_css($css) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + THEME_DESIGNER_CACHE_LIFETIME) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
header('Content-Type: text/css');
header('Content-Type: text/css; charset=utf-8');
//header('Content-Length: '.strlen($css));

echo($css);
Expand Down
2 changes: 1 addition & 1 deletion user/selector/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
header('Content-type: text/plain; charset=UTF-8');
$debugmode = true;
} else {
header('Content-type: application/json');
header('Content-type: application/json; charset=utf-8');
$debugmode = false;
}

Expand Down
6 changes: 3 additions & 3 deletions webservice/rest/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function parse_request() {

$this->functionname = isset($_REQUEST['wsfunction']) ? $_REQUEST['wsfunction'] : null;
unset($_REQUEST['wsfunction']);

$this->parameters = $_REQUEST;
}
}
Expand Down Expand Up @@ -108,7 +108,7 @@ protected function send_error($ex=null) {
* @return void
*/
protected function send_headers() {
header('Content-Type: application/xml');
header('Content-Type: application/xml; charset=utf-8');
header('Content-Disposition: inline; filename="response.xml"');
header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
Expand Down Expand Up @@ -142,7 +142,7 @@ protected static function xmlize_result($returns, $desc) {
if (!empty($returns)) {
foreach ($returns as $val) {
$mult .= self::xmlize_result($val, $desc->content);
}
}
}
$mult .= '</MULTIPLE>'."\n";
return $mult;
Expand Down
4 changes: 2 additions & 2 deletions webservice/soap/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function init_zend_server() {
global $CFG;

parent::init_zend_server();

if ($this->authmethod == WEBSERVICE_AUTHMETHOD_USERNAME) {
$username = optional_param('wsusername', '', PARAM_RAW);
$password = optional_param('wspassword', '', PARAM_RAW);
Expand Down Expand Up @@ -129,7 +129,7 @@ protected function send_error($ex=null) {
</SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>';

$this->send_headers();
header('Content-Type: application/xml');
header('Content-Type: application/xml; charset=utf-8');
header('Content-Disposition: inline; filename="response.xml"');

echo $xml;
Expand Down

0 comments on commit 8a7703c

Please sign in to comment.