Minor: Format code

pull/4656/head
Angel Fernando Quiroz Campos 3 years ago
parent f8d12645f7
commit b711d610ab
  1. 2
      plugin/oauth2/redirect_info.php
  2. 66
      plugin/oauth2/src/OAuth2.php
  3. 2
      src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php

@ -34,4 +34,4 @@ $content = '<div class="row">
$template = new Template();
$template->assign('content', $content);
$template->display_one_col_template();
$template->display_one_col_template();

@ -337,6 +337,39 @@ class OAuth2 extends Plugin
);
}
public static function isFirstLoginAfterAuthSource(int $userId): bool
{
$em = Database::getManager();
$lastLogin = $em
->getRepository(TrackELogin::class)
->findOneBy(
['loginUserId' => $userId],
['loginDate' => 'DESC']
)
;
if (!$lastLogin) {
return false;
}
$objExtraField = new ExtraField('user');
$field = $objExtraField->getHandlerEntityByFieldVariable(self::EXTRA_FIELD_OAUTH2_ID);
$fieldValue = $em
->getRepository(ExtraFieldValues::class)
->findOneBy(
['itemId' => $userId, 'field' => $field]
)
;
if (!$fieldValue) {
return false;
}
return $fieldValue->getCreatedAt() >= $lastLogin->getLoginDate();
}
/**
* Extends ArrayAccessorTrait::getValueByKey to return a list of values
* $key can contain wild card character *
@ -472,37 +505,4 @@ class OAuth2 extends Plugin
error_log("OAuth2 plugin: $key: $content");
}
}
public static function isFirstLoginAfterAuthSource(int $userId): bool
{
$em = Database::getManager();
$lastLogin = $em
->getRepository(TrackELogin::class)
->findOneBy(
['loginUserId' => $userId],
['loginDate' => 'DESC']
)
;
if (!$lastLogin) {
return false;
}
$objExtraField = new ExtraField('user');
$field = $objExtraField->getHandlerEntityByFieldVariable(self::EXTRA_FIELD_OAUTH2_ID);
$fieldValue = $em
->getRepository(ExtraFieldValues::class)
->findOneBy(
['itemId' => $userId, 'field' => $field]
)
;
if (!$fieldValue) {
return false;
}
return $fieldValue->getCreatedAt() >= $lastLogin->getLoginDate();
}
}

@ -397,7 +397,7 @@ class CourseDriver extends Driver implements DriverInterface
return false;
}
$name= api_replace_dangerous_char($name);
$name = api_replace_dangerous_char($name);
$result = parent::mkdir($path, $name);
if ($result && isset($result['hash'])) {

Loading…
Cancel
Save