Exemple #1
0
 /**
  * Builds XHTML to display the control.
  * The main purpose of this overloading is to display a warning when https
  * is not supported by the server
  * @param string $data Unused
  * @param string $query
  * @return string XHTML
  */
 public function output_html($data, $query = '')
 {
     global $CFG, $OUTPUT;
     $html = parent::output_html($data, $query);
     if ((string) $data === $this->yes) {
         require_once $CFG->dirroot . "/lib/filelib.php";
         $curl = new curl();
         $httpswwwroot = str_replace('http:', 'https:', $CFG->wwwroot);
         //force https url
         $curl->head($httpswwwroot . "/login/index.php");
         $info = $curl->get_info();
         if (empty($info['http_code']) or $info['http_code'] >= 400) {
             $html .= $OUTPUT->notification(get_string('nohttpsformobilewarning', 'admin'));
         }
     }
     return $html;
 }