|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00026 define('NO_OUTPUT_BUFFERING', true); 00027 00028 require('../../config.php'); 00029 require_once($CFG->dirroot.'/report/security/locallib.php'); 00030 require_once($CFG->libdir.'/adminlib.php'); 00031 00032 require_login(); 00033 00034 $issue = optional_param('issue', '', PARAM_ALPHANUMEXT); // show detailed info about one issue only 00035 00036 $issues = report_security_get_issue_list(); 00037 00038 // test if issue valid string 00039 if (array_search($issue, $issues, true) === false) { 00040 $issue = ''; 00041 } 00042 00043 // we may need a bit more memory and this may take a long time to process 00044 raise_memory_limit(MEMORY_EXTRA); 00045 @set_time_limit(0); 00046 00047 // Print the header. 00048 admin_externalpage_setup('reportsecurity', '', null, '', array('pagelayout'=>'report')); 00049 echo $OUTPUT->header(); 00050 00051 echo $OUTPUT->heading(get_string('pluginname', 'report_security')); 00052 00053 echo '<div id="timewarning">'.get_string('timewarning', 'report_security').'</div>'; 00054 00055 $strok = '<span class="statusok">'.get_string('statusok', 'report_security').'</span>'; 00056 $strinfo = '<span class="statusinfo">'.get_string('statusinfo', 'report_security').'</span>'; 00057 $strwarning = '<span class="statuswarning">'.get_string('statuswarning', 'report_security').'</span>'; 00058 $strserious = '<span class="statusserious">'.get_string('statusserious', 'report_security').'</span>'; 00059 $strcritical = '<span class="statuscritical">'.get_string('statuscritical', 'report_security').'</span>'; 00060 00061 $strissue = get_string('issue', 'report_security'); 00062 $strstatus = get_string('status', 'report_security'); 00063 $strdesc = get_string('description', 'report_security'); 00064 $strconfig = get_string('configuration', 'report_security'); 00065 00066 $statusarr = array(REPORT_SECURITY_OK => $strok, 00067 REPORT_SECURITY_INFO => $strinfo, 00068 REPORT_SECURITY_WARNING => $strwarning, 00069 REPORT_SECURITY_SERIOUS => $strserious, 00070 REPORT_SECURITY_CRITICAL => $strcritical); 00071 00072 $url = "$CFG->wwwroot/report/security/index.php"; 00073 00074 if ($issue and ($result = $issue(true))) { 00075 report_security_hide_timearning(); 00076 00077 $table = new html_table(); 00078 $table->head = array($strissue, $strstatus, $strdesc, $strconfig); 00079 $table->size = array('30%', '10%', '50%', '10%' ); 00080 $table->align = array('left', 'left', 'left', 'left'); 00081 $table->attributes = array('class'=>'scurityreporttable generaltable'); 00082 $table->data = array(); 00083 00084 // print detail of one issue only 00085 $row = array(); 00086 $row[0] = report_security_doc_link($issue, $result->name); 00087 $row[1] = $statusarr[$result->status]; 00088 $row[2] = $result->info; 00089 $row[3] = is_null($result->link) ? ' ' : $result->link; 00090 00091 $PAGE->set_docs_path('report/security/' . $issue); 00092 00093 $table->data[] = $row; 00094 00095 echo html_writer::table($table); 00096 00097 echo $OUTPUT->box($result->details, 'generalbox boxwidthnormal boxaligncenter'); // TODO: add proper css 00098 00099 echo $OUTPUT->continue_button($url); 00100 00101 } else { 00102 report_security_hide_timearning(); 00103 00104 $table = new html_table(); 00105 $table->head = array($strissue, $strstatus, $strdesc); 00106 $table->size = array('30%', '10%', '60%' ); 00107 $table->align = array('left', 'left', 'left'); 00108 $table->attributes = array('class'=>'scurityreporttable generaltable'); 00109 $table->data = array(); 00110 00111 foreach ($issues as $issue) { 00112 $result = $issue(false); 00113 if (!$result) { 00114 // ignore this test 00115 continue; 00116 } 00117 $row = array(); 00118 $row[0] = "<a href='$url?issue=$result->issue'>$result->name</a>"; 00119 $row[1] = $statusarr[$result->status]; 00120 $row[2] = $result->info; 00121 00122 $table->data[] = $row; 00123 } 00124 echo html_writer::table($table); 00125 } 00126 00127 echo $OUTPUT->footer();