403Webshell
Server IP : 185.252.147.100  /  Your IP : 216.73.216.196
Web Server : nginx/1.27.3
System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
User : mitr ( 1000)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/html/kanboard/app/Controller/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/html/kanboard/app/Controller/UserCreationController.php
<?php

namespace Kanboard\Controller;

use Kanboard\Core\Security\Role;
use Kanboard\Notification\MailNotification;
use Kanboard\Notification\WebNotification;

/**
 * Class UserCreationController
 *
 * @package Kanboard\Controller
 * @author  Frederic Guillot
 */
class UserCreationController extends BaseController
{
    /**
     * Display a form to create a new user
     *
     * @access public
     * @param array $values
     * @param array $errors
     */
    public function show(array $values = array(), array $errors = array())
    {
        $this->response->html($this->template->render('user_creation/show', array(
            'themes' => $this->themeModel->getThemes(),
            'timezones' => $this->timezoneModel->getTimezones(true),
            'languages' => $this->languageModel->getLanguages(true),
            'roles' => $this->role->getApplicationRoles(),
            'projects' => $this->projectModel->getList(),
            'errors' => $errors,
            'values' => $values + array('role' => Role::APP_USER),
        )));
    }

    /**
     * Validate and save a new user
     *
     * @access public
     */
    public function save()
    {
        $values = $this->request->getValues();
        list($valid, $errors) = $this->userValidator->validateCreation($values);

        if ($valid) {
            $this->createUser($values);
        } else {
            $this->show($values, $errors);
        }
    }

    /**
     * Create user
     *
     * @param array $values
     */
    protected function createUser(array $values)
    {
        $project_id = empty($values['project_id']) ? 0 : $values['project_id'];
        unset($values['project_id']);

        $user_id = $this->userModel->create($values);

        if ($user_id !== false) {
            if ($project_id !== 0) {
                $this->projectUserRoleModel->addUser($project_id, $user_id, Role::PROJECT_MEMBER);
            }

            if ($this->configModel->get('notifications_enabled', 0) == 1) {
                $this->userNotificationTypeModel->saveSelectedTypes($user_id, [MailNotification::TYPE, WebNotification::TYPE]);
            } elseif (! empty($values['notifications_enabled'])) {
                $this->userNotificationTypeModel->saveSelectedTypes($user_id, [MailNotification::TYPE]);
            }

            $this->flash->success(t('User created successfully.'));
            $this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user_id)));
        } else {
            $this->flash->failure(t('Unable to create your user.'));
            $this->response->redirect($this->helper->url->to('UserListController', 'show'));
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit