public function runUninstall() { $userList = new \fpcm\model\users\userList(); $userId = $userList->getUserIdByUsername('support'); if (!$userId) { return true; } $user = new \fpcm\model\users\author($userId); if ($user->exists()) { return $user->delete(); } return true; }
/** * Logfiles auswerten * @return boolean */ public function processUsers() { if (!isset($this->funcParams[1])) { $this->output('Invalid params, no user id set', true); } $userId = (int) $this->funcParams[1]; $user = new \fpcm\model\users\author($userId); if (!$user->exists()) { $this->output('No user foudn give id ' . $userId, true); } switch ($this->funcParams[0]) { case self::FPCMCLI_PARAM_PASSWD: $this->output('Create new password for user ' . $user->getUsername() . '...'); $success = $user->resetPassword(true); if (!$success['updateOk']) { $this->output('Unable to reset password! Check system logs for further details.', true); } $this->output('Password set to ' . $success['password']); break; case self::FPCMCLI_PARAM_ENABLE: $this->output('Enable user ' . $user->getUsername() . '...'); if ($user->enable()) { $this->output('User successfully enabled!'); } else { $this->output('Failed to enable user!'); } break; case self::FPCMCLI_PARAM_DISBALE: $this->output('Disable user ' . $user->getUsername() . '...'); if ($user->disable()) { $this->output('User successfully disabled!'); } else { $this->output('Failed to disable user!'); } break; case self::FPCMCLI_PARAM_REMOVE: $this->output('Delete user ' . $user->getUsername() . '...'); if ($user->delete()) { $this->output('User deleted!'); } else { $this->output('Failed to delete user!'); } break; default: break; } return true; }
public function request() { if (is_null($this->getRequestVar('userid'))) { $this->redirect('users/list'); } $this->userId = $this->getRequestVar('userid', array(9)); $author = new \fpcm\model\users\author($this->userId); if (!$author->exists()) { $this->view->setNotFound('LOAD_FAILED_USER', 'users/list'); return true; } $checkPageToken = $this->checkPageToken(); if (($this->buttonClicked('userSave') || $this->buttonClicked('resetProfileSettings')) && !$checkPageToken) { $this->view->addErrorMessage('CSRF_INVALID'); } if ($this->buttonClicked('resetProfileSettings') && $checkPageToken) { $author->setUserMeta(array()); $author->disablePasswordSecCheck(); if ($author->update() === false) { $this->view->addErrorMessage('SAVE_FAILED_USER_PROFILE'); } else { $this->view->addNoticeMessage('SAVE_SUCCESS_RESETPROFILE'); $this->view->assign('reloadSite', true); } } if ($this->buttonClicked('userSave') && $checkPageToken) { $author->setUserName($this->getRequestVar('username')); $author->setEmail($this->getRequestVar('email')); $author->setDisplayName($this->getRequestVar('displayname')); $author->setRoll($this->getRequestVar('roll', array(9))); $author->setUserMeta($this->getRequestVar('usermeta')); if ($this->getRequestVar('disabled') !== null) { $author->setDisabled($this->getRequestVar('disabled', array(9))); } $newpass = $this->getRequestVar('password'); $newpass_confirm = $this->getRequestVar('password_confirm'); $save = true; if ($newpass && $newpass_confirm) { if (md5($newpass) == md5($newpass_confirm)) { $author->setPassword($newpass); } else { $save = false; $this->view->addErrorMessage('SAVE_FAILED_PASSWORD_MATCH'); } } else { $author->disablePasswordSecCheck(); } if ($save) { $res = $author->update(); if ($res === false) { $this->view->addErrorMessage('SAVE_FAILED_USER'); } elseif ($res === true) { $this->redirect('users/list', array('edited' => 1)); } elseif ($res === \fpcm\model\users\author::AUTHOR_ERROR_PASSWORDINSECURE) { $this->view->addErrorMessage('SAVE_FAILED_PASSWORD_SECURITY'); } elseif ($res === \fpcm\model\users\author::AUTHOR_ERROR_EXISTS) { $this->view->addErrorMessage('SAVE_FAILED_USER_EXISTS'); } elseif ($res === \fpcm\model\users\author::AUTHOR_ERROR_NOEMAIL) { $this->view->addErrorMessage('SAVE_FAILED_USER_EMAIL'); } } } $this->userEnabled = $author->getDisabled(); $this->view->assign('author', $author); return true; }
public function process() { if (!parent::process()) { return false; } $mode = (int) $this->getRequestVar('mode'); if ($mode == 2) { $this->view->setShowHeader(0); $this->view->setShowFooter(0); } $this->view->setViewJsFiles(array(\fpcm\classes\loader::libGetFileUrl('tinymce4', 'tinymce.min.js'), \fpcm\classes\baseconfig::$jsPath . 'editor_comments.js')); $this->view->addJsVars(array('fpcmTinyMceLang' => $this->config->system_lang, 'fpcmTinyMcePlugins' => 'autolink charmap code image link lists media nonbreaking wordcount fpcm_emoticons autoresize', 'fpcmTinyMceToolbar' => 'fontsizeselect | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist blockquote | link unlink anchor image media emoticons charmap | undo redo removeformat searchreplace fullscreen code', 'fpcmNavigationActiveItemId' => 'itemnav-item-editcomments')); if ($this->comment->getChangeuser() && $this->comment->getChangetime()) { $changeUser = new \fpcm\model\users\author($this->comment->getChangeuser()); $this->view->assign('changeInfo', $this->lang->translate('COMMMENT_LASTCHANGE', array('{{username}}' => $changeUser->exists() ? $changeUser->getDisplayname() : $this->lang->translate('GLOBAL_NOTFOUND'), '{{time}}' => date($this->config->system_dtmask, $this->comment->getChangetime())))); } else { $this->view->assign('changeInfo', $this->lang->translate('GLOBAL_NOCHANGE')); } $this->view->assign('ipWhoisLink', substr($this->comment->getIpaddress(), -1) === '*' ? false : true); $this->view->assign('comment', $this->comment); $this->view->assign('commentsMode', $mode); $this->view->assign('permApprove', $this->approve); $this->view->assign('permPrivate', $this->private); $this->view->render(); }