Subversion Repositories php_utils

Compare Revisions

Regard whitespace Rev 76 → Rev 77

/trunk/VtsLDAPUtils.class.php
2,8 → 2,8
 
/*
* VtsLDAPUtils - Simple LDAP helper functions
* Copyright 2021 Daniel Marschall, ViaThinkSoft
* Revision: 2021-06-11
* Copyright 2021 - 2023 Daniel Marschall, ViaThinkSoft
* Revision: 2023-04-09
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
22,7 → 22,7
 
protected $conn = null;
 
private static function _L($str, ...$sprintfArgs) {
private static function _L(string $str, ...$sprintfArgs): string {
if (function_exists('_L')) {
return _L($str, $sprintfArgs);
} else if (function_exists('my_vsprintf')) {
113,7 → 113,7
$data = ldap_get_entries($this->conn, $result);
$ldap_userinfo = array();
 
if ($data['count'] == 0) return false;
if ($data['count'] == 0) return false; /* @phpstan-ignore-line */
$ldap_userinfo = $data[0];
 
// empty($ldap_userinfo) can happen if the user did not log-in using their correct userPrincipalName (e.g. "username@domainname" instead of "username@domainname.local")
/trunk/git_utils.inc.php
2,8 → 2,8
 
/*
* PHP git functions
* Copyright 2021 Daniel Marschall, ViaThinkSoft
* Revision 2021-12-29
* Copyright 2021 - 2023 Daniel Marschall, ViaThinkSoft
* Revision 2023-04-09
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
76,8 → 76,7
try {
return git_read_object($commit_object,
$objects_dir.'/pack/'.$basename.'.idx',
$objects_dir.'/pack/'.$basename.'.pack',
false
$objects_dir.'/pack/'.$basename.'.pack'
);
} catch (Exception $e) {
$last_exception = $e;
101,9 → 100,9
 
// Read version
fseek($fp, 0);
$unpacked = unpack('N', fread($fp, 4)); // vorzeichenloser Long-Typ (immer 32 Bit, Byte-Folge Big-Endian)
if ($unpacked[1] === 0xFF744F63) {
$version = unpack('N', fread($fp, 4))[1]; // vorzeichenloser Long-Typ (immer 32 Bit, Byte-Folge Big-Endian)
$unpacked = unpack('H8', fread($fp, 4)); // H8 = 8x "Hex string, high nibble first"
if ($unpacked[1] === bin2hex("\377tOc")) {
$version = unpack('N', fread($fp, 4))[1]; // N = "unsigned long (always 32 bit, big endian byte order)"
$fanout_offset = 8;
if ($version != 2) throw new Exception("Version $version unknown");
} else {
214,15 → 213,16
 
// Read delta base type
if ($type == 6/*OBJ_OFS_DELTA*/) {
// "a negative relative offset from the delta object's position in the pack
// if this is an OBJ_OFS_DELTA object"
$delta_info = unpack('C*', fread($fp,4))[1]; // TODO?!
// "a negative relative offset from the delta object's position in the pack if this is an OBJ_OFS_DELTA object"
$delta_info = unpack('C*', fread($fp,4))[1];
if ($debug) echo "Delta negative offset: $delta_info\n";
throw new Exception("OBJ_OFS_DELTA is currently not implemented"); // TODO! Implement OBJ_OFS_DELTA!
}
if ($type == 7/*OBJ_REF_DELTA*/) {
// "base object name if OBJ_REF_DELTA"
$delta_info = bin2hex(fread($fp,20))[1]; // TODO?!
$delta_info = bin2hex(fread($fp,20));
if ($debug) echo "Delta base object name: $delta_info\n";
throw new Exception("OBJ_REF_DELTA is currently not implemented"); // TODO! Implement OBJ_REF_DELTA!
}
 
// Read compressed data