Exemplo n.º 1
0
 * @author    Jerome Mouneyrac
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require '../../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/local/hub/lib.php';
require_once $CFG->dirroot . "/local/hub/admin/forms.php";
admin_externalpage_setup('hubstolensecret');
$hub = new local_hub();
$renderer = $PAGE->get_renderer('local_hub');
$stolen = optional_param('stolen', 0, PARAM_INT);
if ($stolen and sesskey()) {
    $confirm = optional_param('confirm', 0, PARAM_INT);
    if ($confirm) {
        //mark the token as stolen
        $hub->marksecretstolen($stolen);
        //delete site and web service token
        $hub->delete_site($stolen);
        $confirmmsg = $OUTPUT->notification(get_string('secretblocked', 'local_hub'), 'notifysuccess');
    } else {
        $hackedsite = $hub->get_site($stolen);
        echo $OUTPUT->header();
        echo $OUTPUT->heading(get_string('stolensecret', 'local_hub'));
        echo $renderer->stolensecret_confirmation($hackedsite);
        echo $OUTPUT->footer();
        die;
    }
}
$mform = new hub_search_stolen_secret();
if ($data = $mform->get_data()) {
    $sites = array();