Skip to content

Commit b63d427

Browse files
committed
Minor: Format code
1 parent a3e5a03 commit b63d427

File tree

9 files changed

+69
-69
lines changed

9 files changed

+69
-69
lines changed

main/admin/user_update_import.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function _updateUsers(
9090
$resetPassword = false,
9191
$sendEmail = false,
9292
$askNewPassword = false
93-
){
93+
) {
9494
$usergroup = new UserGroup();
9595
$extraFieldValue = new ExtraFieldValue('user');
9696
if (is_array($users)) {

main/attendance/attendance_sheet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ function UpdateTableHeaders() {
522522
// if calendar is blocked by admin is it not displayed here.
523523
if ($isBlocked) {
524524
continue;
525-
}
526-
if (!empty($_REQUEST['filter']) && is_numeric($_REQUEST['filter']) && $_REQUEST['filter'] != $presence['calendar_id']) {
525+
}
526+
if (!empty($_REQUEST['filter']) && is_numeric($_REQUEST['filter']) && $_REQUEST['filter'] != $presence['calendar_id']) {
527527
continue;
528528
}
529529
$signature = $attendance->getSignature($user_id, $presence['calendar_id']);

main/attendance/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@
279279
$renderer->setHeight(256);
280280
$renderer->setWidth(256);
281281
$writer = new \BaconQrCode\Writer($renderer);
282-
$filter="";
282+
$filter = "";
283283
if (!empty($_REQUEST['filter'])) {
284-
$filter='&filter='.$_REQUEST['filter'];
284+
$filter = '&filter='.$_REQUEST['filter'];
285285
}
286286
$attendanceSheetLink = api_get_path(WEB_CODE_PATH).'attendance/index.php?'.api_get_cidreq().'&action=attendance_sheet_list_no_edit&attendance_id='.$attendance_id.$filter;
287287
$filename = "attendanceqrcode".uniqid().".png";
@@ -292,7 +292,7 @@
292292
true
293293
);
294294
}
295-
$writer->writeFile($attendanceSheetLink,api_get_path(SYS_UPLOAD_PATH).'attendance/'.$filename);
295+
$writer->writeFile($attendanceSheetLink, api_get_path(SYS_UPLOAD_PATH).'attendance/'.$filename);
296296
echo '<img src="'.api_get_path(WEB_UPLOAD_PATH).'attendance/'.$filename.'" alt="AttendanceQR">';
297297
exit;
298298
case 'attendance_list':

main/auth/profile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ function show_image(image,width,height) {
690690
[
691691
'item_id' => $user->getId(),
692692
'variable' => 'password_updated_at',
693-
'value' => $date
693+
'value' => $date,
694694
]
695695
);
696696
}

main/auth/reset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
[
103103
'item_id' => $user->getId(),
104104
'variable' => 'password_updated_at',
105-
'value' => $date
105+
'value' => $date,
106106
]
107107
);
108108
}

main/cron/update_ldap_users.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
$ldapbind = @ldap_bind($ds, $extldap_config['admin_dn'], $ldap_pass);
3030
if ($ldapbind === false) {
3131
echo 'EXTLDAP ERROR : cannot connect with admin login/password';
32+
3233
return false;
3334
}
3435

main/inc/lib/document.lib.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5843,7 +5843,7 @@ public static function build_edit_icons($document_data, $id, $is_template, $is_r
58435843
}
58445844

58455845
// Specific case to remove action icons for students on files in the Chat conversation history inside a group -refs BT#21165
5846-
if (strpos($document_data['path'],'chat_files') !== false && $document_data['filetype'] === 'file' && api_is_student()) {
5846+
if (strpos($document_data['path'], 'chat_files') !== false && $document_data['filetype'] === 'file' && api_is_student()) {
58475847
$modify_icons = [];
58485848
}
58495849

@@ -7314,7 +7314,7 @@ private static function getButtonEdit($isReadOnly, array $documentData, $extensi
73147314
return Display::url($iconEn, "edit_document.php?$courseParams&id=$document_id");
73157315
}
73167316

7317-
if (in_array($path, self::get_system_folders()) || $documentData['filetype'] === 'folder' && strpos($path,'chat_files') !== false) {
7317+
if (in_array($path, self::get_system_folders()) || $documentData['filetype'] === 'folder' && strpos($path, 'chat_files') !== false) {
73187318
return $iconDis;
73197319
}
73207320

@@ -7375,7 +7375,7 @@ private static function getButtonMove($isReadOnly, array $documentData, $isCerti
73757375
$sessionId = api_get_session_id();
73767376
$courseParams = api_get_cidreq();
73777377

7378-
if ($isCertificateMode || in_array($path, self::get_system_folders()) || $documentData['filetype'] === 'folder' && strpos($path,'chat_files') !== false) {
7378+
if ($isCertificateMode || in_array($path, self::get_system_folders()) || $documentData['filetype'] === 'folder' && strpos($path, 'chat_files') !== false) {
73797379
return $iconDis;
73807380
}
73817381

@@ -7470,7 +7470,7 @@ private static function getButtonDelete(
74707470
return $iconDis;
74717471
}
74727472

7473-
if (in_array($path, self::get_system_folders()) || $documentData['filetype'] === 'folder' && strpos($path,'chat_files') !== false) {
7473+
if (in_array($path, self::get_system_folders()) || $documentData['filetype'] === 'folder' && strpos($path, 'chat_files') !== false) {
74747474
return $iconDis;
74757475
}
74767476

main/inc/lib/statistics.lib.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,13 +1085,12 @@ public static function printActivitiesStats()
10851085
$table->set_header(6, get_lang('IPAddress'));
10861086
$table->set_header(7, get_lang('Date'));
10871087
$content .= $table->return_table();
1088-
10891088
}
10901089

10911090
$content .= '<div class="alert alert-info">'.get_lang('ImportantActivities').' : '.'<br>';
10921091
$prefix = 'LOG_';
10931092
$userDefinedConstants = get_defined_constants(true)['user'];
1094-
$filteredConstants = array_filter($userDefinedConstants, function($constantName) use ($prefix) {
1093+
$filteredConstants = array_filter($userDefinedConstants, function ($constantName) use ($prefix) {
10951094
return strpos($constantName, $prefix) === 0;
10961095
}, ARRAY_FILTER_USE_KEY);
10971096
$constantNames = array_keys($filteredConstants);

main/inc/lib/usermanager.lib.php

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ public static function update_user(
16751675
[
16761676
'item_id' => $user->getId(),
16771677
'variable' => 'password_updated_at',
1678-
'value' => $date
1678+
'value' => $date,
16791679
]
16801680
);
16811681
}
@@ -1803,8 +1803,6 @@ public static function update_user(
18031803
null,
18041804
$creatorEmail
18051805
);
1806-
1807-
18081806
} else {
18091807
$layoutContent = $tplContent->get_template('mail/user_edit_content.tpl');
18101808
$emailBody = $tplContent->fetch($layoutContent);
@@ -7709,7 +7707,7 @@ public static function redirectToResetPassword($userId)
77097707
);
77107708

77117709
if (!empty($askPassword) && isset($askPassword['ask_new_password']) &&
7712-
1 === (int)$askPassword['ask_new_password']
7710+
1 === (int) $askPassword['ask_new_password']
77137711
) {
77147712
$uniqueId = api_get_unique_id();
77157713
$userObj = api_get_user_entity($userId);
@@ -8044,6 +8042,59 @@ public static function getScriptFunctionForActiveFilter(): string
80448042
}';
80458043
}
80468044

8045+
/**
8046+
* Get a list of users with the given e-mail address + their "active" field value (0 or 1).
8047+
*
8048+
* @param string $mail User id
8049+
*
8050+
* @return array List of users e-mails + active field
8051+
*/
8052+
public static function getUsersByMail(string $mail): array
8053+
{
8054+
$resultData = Database::select(
8055+
'id, active',
8056+
Database::get_main_table(TABLE_MAIN_USER),
8057+
[
8058+
'where' => ['email = ?' => $mail],
8059+
],
8060+
'all',
8061+
null
8062+
);
8063+
8064+
if ($resultData === false) {
8065+
return [];
8066+
}
8067+
8068+
return $resultData;
8069+
}
8070+
8071+
/**
8072+
* Get whether we can send an e-mail or not.
8073+
* If the e-mail is not in the database, send the mail.
8074+
* If the e-mail is in the database but none of its occurences is active, don't send.
8075+
*
8076+
* @param string $mail The e-mail address to check
8077+
*
8078+
* @return bool Whether we can send an e-mail or not
8079+
*/
8080+
public function isEmailingAllowed(string $mail): bool
8081+
{
8082+
$list = self::getUsersByMail($mail);
8083+
if (empty($list)) {
8084+
// No e-mail matches, send the mail
8085+
return true;
8086+
}
8087+
$send = false;
8088+
foreach ($list as $id => $user) {
8089+
if ($user['active'] == 1) {
8090+
// as soon as we find at least one active user, send the mail
8091+
return true;
8092+
}
8093+
}
8094+
8095+
return false;
8096+
}
8097+
80478098
/**
80488099
* @return EncoderFactory
80498100
*/
@@ -8137,55 +8188,4 @@ private static function getGravatar(
81378188

81388189
return $url;
81398190
}
8140-
8141-
/**
8142-
* Get a list of users with the given e-mail address + their "active" field value (0 or 1)
8143-
*
8144-
* @param string $mail User id
8145-
*
8146-
* @return array List of users e-mails + active field
8147-
*/
8148-
public static function getUsersByMail(string $mail): array
8149-
{
8150-
$resultData = Database::select(
8151-
'id, active',
8152-
Database::get_main_table(TABLE_MAIN_USER),
8153-
[
8154-
'where' => ['email = ?' => $mail],
8155-
],
8156-
'all',
8157-
null
8158-
);
8159-
8160-
if ($resultData === false) {
8161-
return [];
8162-
}
8163-
8164-
return $resultData;
8165-
}
8166-
8167-
/**
8168-
* Get whether we can send an e-mail or not.
8169-
* If the e-mail is not in the database, send the mail.
8170-
* If the e-mail is in the database but none of its occurences is active, don't send.
8171-
* @param string $mail The e-mail address to check
8172-
* @return bool Whether we can send an e-mail or not
8173-
*/
8174-
public function isEmailingAllowed(string $mail): bool
8175-
{
8176-
$list = self::getUsersByMail($mail);
8177-
if (empty($list)) {
8178-
// No e-mail matches, send the mail
8179-
return true;
8180-
}
8181-
$send = false;
8182-
foreach ($list as $id => $user) {
8183-
if ($user['active'] == 1) {
8184-
// as soon as we find at least one active user, send the mail
8185-
return true;
8186-
}
8187-
}
8188-
8189-
return false;
8190-
}
81918191
}

0 commit comments

Comments
 (0)