function networkingform_submit(Pieform $form, $values) { $reply = ''; if ($form->get_submitvalue() === 'deletekey') { global $SESSION; $openssl = OpenSslRepo::singleton(); $openssl->get_keypair(true); $SESSION->add_info_msg(get_string('keydeleted', 'admin')); // Using cancel here as a hack to get it to redirect so it shows the new keys $form->reply(PIEFORM_CANCEL, array('location' => get_config('wwwroot') . 'admin/site/networking.php')); } if (get_config('enablenetworking') != $values['enablenetworking']) { if (!set_config('enablenetworking', $values['enablenetworking'])) { networkingform_fail($form); } else { if (empty($values['enablenetworking'])) { $reply .= get_string('networkingdisabled', 'admin'); } else { $reply .= get_string('networkingenabled', 'admin'); } } } if (get_config('promiscuousmode') != $values['promiscuousmode']) { if (!set_config('promiscuousmode', $values['promiscuousmode'])) { networkingform_fail($form); } else { if (empty($values['promiscuousmode'])) { $reply .= get_string('promiscuousmodedisabled', 'admin'); } else { $reply .= get_string('promiscuousmodeenabled', 'admin'); } } } $form->reply(PIEFORM_OK, array('message' => $reply == '' ? get_string('networkingunchanged', 'admin') : $reply, 'goto' => '/admin/site/networking.php')); }
function networkingform_submit(Pieform $form, $values) { $reply = ''; if (get_config('enablenetworking') != $values['enablenetworking']) { if (!set_config('enablenetworking', $values['enablenetworking'])) { networkingform_fail($form); } else { if (empty($values['enablenetworking'])) { $reply .= get_string('networkingdisabled', 'admin'); } else { $reply .= get_string('networkingenabled', 'admin'); } } } if (get_config('promiscuousmode') != $values['promiscuousmode']) { if (!set_config('promiscuousmode', $values['promiscuousmode'])) { networkingform_fail($form); } else { if (empty($values['promiscuousmode'])) { $reply .= get_string('promiscuousmodedisabled', 'admin'); } else { $reply .= get_string('promiscuousmodeenabled', 'admin'); } } } $form->reply(PIEFORM_OK, array('message' => $reply == '' ? get_string('networkingunchanged', 'admin') : $reply, 'goto' => '/admin/site/networking.php')); }