Skip to content

Commit

Permalink
tweaks to CLI detection
Browse files Browse the repository at this point in the history
  • Loading branch information
justinhunt committed May 9, 2018
1 parent 21b3845 commit dad36a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ function filter_generico_callback(array $link){

//we use this to see if its a web service calling this,
//in which case we return the alternate content
$climode = defined('CLI_SCRIPT') && CLI_SCRIPT;
$is_webservice = false;
if(property_exists($PAGE, 'url')){
if(!$climode){
$is_webservice = strpos($PAGE->url,$CFG->wwwroot .'/webservice/') === 0;
}

Expand Down Expand Up @@ -413,7 +414,7 @@ function filter_generico_callback(array $link){
$require_amd = $conf['template_amd_' . $tempindex] && $CFG->version>=2015051100;

//figure out if this is https or http. We don't want to scare the browser
if(property_exists($PAGE, 'url') && strpos($PAGE->url->out(),'https:')===0){
if(!$climode && strpos($PAGE->url->out(),'https:')===0){
$scheme='https:';
}else{
$scheme='http:';
Expand Down

0 comments on commit dad36a6

Please sign in to comment.