* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require "modules/base/users/localSidebar.php"; require "graph/header.inc.php"; require "graph/navbar.inc.php"; $uid = $_SESSION["login"]; if (isset($_POST['bssh'])) { $sshkeys = getAllSshKey($uid); $newSshkeys = $_POST['sshuserkeys']; $showSshkeys = $_POST['showusersshkey']; if ($showSshkeys && $newSshkeys != $sshkeys) { updateSshKeys($uid, $newSshkeys); if (!isXMLRPCError()) { new NotifyWidgetSuccess(_T("SSH public keys updated.", "sshlpk")); } } else { if (!$showSshkeys && hasSshKeyObjectClass($uid)) { delSSHKeyObjectClass($uid); if (!isXMLRPCError()) { new NotifyWidgetSuccess(_T("SSH public keys attributes deleted.", "sshlpk")); } } } redirectTo(urlStrRedirect('base/users/sshkeys')); } $p = new PageGenerator(_T("Change your SSH keys", "sshlpk")); $p->setSideMenu($sidemenu);
/** * Function called for changing user attributes * @param $FH FormHandler of the page * @param $mode add or edit mode */ function _sshlpk_changeUser($FH, $mode) { global $result; if ($FH->getPostValue("showsshkey")) { if ($FH->isUpdated('sshkeylist')) { updateSshKeys($FH->getPostValue('uid'), $FH->getValue('sshkeylist')); $result .= _T("SSH public keys updated.", "sshlpk") . "<br />"; } } else { if ($mode == 'edit' && hasSshKeyObjectClass($FH->getPostValue('uid'))) { delSSHKeyObjectClass($FH->getPostValue('uid')); $result .= _T("SSH public keys attributes deleted.", "sshlpk") . "<br />"; } } return 0; }