Skip to content

Commit

Permalink
Merge pull request #2 from ramartins02/bug-fix
Browse files Browse the repository at this point in the history
Minor bug fixes
  • Loading branch information
ramartins02 authored Nov 24, 2023
2 parents 436327d + 95403df commit 340e514
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Pages/Ajax/ReservationEmailPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function GetReferenceNumber()

public function GetEmailAddresses()
{
$email = $this->GetForm('email');
$email = implode(',',$this->GetForm('email'));
return preg_split('/, ?/', $email);
}
}
2 changes: 1 addition & 1 deletion Pages/Reservation/ExistingReservationPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function SetAdditionalResources($additionalResourceIds)

public function SetTitle($title)
{
$this->Set('ReservationTitle', $title);
$this->Set('ReservationTitle', htmlspecialchars($title));
}

public function SetDescription($description)
Expand Down
2 changes: 1 addition & 1 deletion Presenters/Authentication/ExternalAuthLoginPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private function processUserData($username,$email,$firstName,$lastName){
$this->page->ShowError(array(Resources::GetInstance()->GetString('InvalidEmailDomain')));
return;
}
if($this->registration->UserExists($email,$email)){
if($this->registration->UserExists($username,$email)){
$this->authentication->Login($email, new WebLoginContext(new LoginData()));
LoginRedirector::Redirect($this->page);
}
Expand Down
9 changes: 7 additions & 2 deletions Presenters/LoginPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,13 @@ public function GetFacebookUrl(){
$helper = $facebook_Client->getRedirectLoginHelper();

$permissions = ['email', 'public_profile']; // Add other permissions as needed

$FacebookUrl = $helper->getLoginUrl( //??should it use getReAuthenticationUrl??

//The FacebookRedirectLoginHelper makes use of sessions to store a CSRF value.
//You need to make sure you have sessions enabled before invoking the getLoginUrl() method.
if (!session_id()) {
session_start();
}
$FacebookUrl = $helper->getLoginUrl(
Configuration::Instance()->GetSectionKey(ConfigSection::AUTHENTICATION, ConfigKeys::FACEBOOK_REDIRECT_URI),
$permissions
);
Expand Down
2 changes: 1 addition & 1 deletion Presenters/Reservation/ReservationSavePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function BuildReservation()
$repeatOptions = $roFactory->CreateFromComposite($this->page, $this->userSession->Timezone);
$duration = $this->GetReservationDuration();

$reservationSeries = ReservationSeries::Create($userId, $resource, $title, $description, $duration, $repeatOptions, $this->userSession);
$reservationSeries = ReservationSeries::Create($userId, $resource, htmlspecialchars_decode($title), htmlspecialchars_decode($description), $duration, $repeatOptions, $this->userSession);

$resourceIds = $this->page->GetResources();
foreach ($resourceIds as $resourceId) {
Expand Down
4 changes: 2 additions & 2 deletions Presenters/Reservation/ReservationUpdatePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public function BuildReservation()
$existingSeries->Update(
$this->page->GetUserId(),
$resource,
$this->page->GetTitle(),
$this->page->GetDescription(),
htmlspecialchars_decode($this->page->GetTitle()),
htmlspecialchars_decode($this->page->GetDescription()),
$this->userSession
);

Expand Down
4 changes: 3 additions & 1 deletion Web/facebook-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
//Need to ask facebook token directly in the redirect_uri (?) -> Can't redirect to external auth page and then ask (???)
if (isset($_GET['code'])) {
//Init the Facebook SDK
session_start();
if (!session_id()) {
session_start();
}
$facebook_Client = new Facebook\Facebook([
'app_id' => Configuration::Instance()->GetSectionKey(ConfigSection::AUTHENTICATION, ConfigKeys::FACEBOOK_CLIENT_ID),
'app_secret' => Configuration::Instance()->GetSectionKey(ConfigSection::AUTHENTICATION, ConfigKeys::FACEBOOK_CLIENT_SECRET),
Expand Down
6 changes: 3 additions & 3 deletions config/config.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@
/**
* Microsoft login configuration
*/
$conf['settings']['authentication']['office.client.id'] = '';
$conf['settings']['authentication']['office.client.secret'] = '';
$conf['settings']['authentication']['office.redirect.uri'] = '/Web/microsoft-auth.php';
$conf['settings']['authentication']['microsoft.client.id'] = '';
$conf['settings']['authentication']['microsoft.client.secret'] = '';
$conf['settings']['authentication']['microsoft.redirect.uri'] = '/Web/microsoft-auth.php';
/**
* Fcebook login configuration
*/
Expand Down
8 changes: 4 additions & 4 deletions lib/external/SimpleImage/SimpleImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,21 @@ function getHeight()
function resizeToHeight($height)
{
$ratio = $height / $this->getHeight();
$width = $this->getWidth() * $ratio;
$width = (int)($this->getWidth() * $ratio);
$this->resize($width, $height);
}

function resizeToWidth($width)
{
$ratio = $width / $this->getWidth();
$height = $this->getheight() * $ratio;
$height = (int)($this->getheight() * $ratio);
$this->resize($width, $height);
}

function scale($scale)
{
$width = $this->getWidth() * $scale / 100;
$height = $this->getheight() * $scale / 100;
$width = (int)($this->getWidth() * $scale / 100);
$height = (int)($this->getheight() * $scale / 100);
$this->resize($width, $height);
}

Expand Down

0 comments on commit 340e514

Please sign in to comment.