namespace Friendica\Module;
use Friendica\BaseModule;
-use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\OpenWebAuthToken;
$verified = HTTPSignature::verifyMagic($contact['pubkey']);
if ($verified && $verified['header_signed'] && $verified['header_valid']) {
- Logger::debug('OWA header', ['addr' => $contact['addr'], 'data' => $verified]);
+ $this->logger->debug('OWA header', ['addr' => $contact['addr'], 'data' => $verified]);
$ret['success'] = true;
$token = Strings::getRandomHex(32);
openssl_public_encrypt($token, $result, $contact['pubkey']);
$ret['encrypted_token'] = Strings::base64UrlEncode($result);
} else {
- Logger::info('OWA fail', ['id' => $contact['id'], 'addr' => $contact['addr'], 'url' => $contact['url']]);
+ $this->logger->info('OWA fail', ['id' => $contact['id'], 'addr' => $contact['addr'], 'url' => $contact['url']]);
}
} else {
- Logger::info('Contact not found', ['handle' => $handle]);
+ $this->logger->info('Contact not found', ['handle' => $handle]);
}
}
}
namespace Friendica\Module;
use Friendica\Contact\Header;
-use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\DI;
}
if (empty($id)) {
- Logger::notice('No picture id was detected', ['parameters' => $this->parameters, 'query' => DI::args()->getQueryString()]);
+ $this->logger->notice('No picture id was detected', ['parameters' => $this->parameters, 'query' => DI::args()->getQueryString()]);
throw new HTTPException\NotFoundException(DI::l10n()->t('The Photo is not available.'));
}
- $photo = self::getPhotoById($id, $this->parameters['type'], $customsize ?: Proxy::PIXEL_SMALL);
+ $photo = $this->getPhotoById($id, $this->parameters['type'], $customsize ?: Proxy::PIXEL_SMALL);
} else {
$photoid = pathinfo($this->parameters['name'], PATHINFO_FILENAME);
$scale = 0;
$data = microtime(true) - $stamp;
if (empty($imgdata)) {
- Logger::warning('Invalid photo', ['id' => $photo['id']]);
+ $this->logger->warning('Invalid photo', ['id' => $photo['id']]);
if (in_array($photo['backend-class'], [ExternalResource::NAME])) {
$reference = json_decode($photo['backend-ref'], true);
$error = DI::l10n()->t('Invalid external resource with url %s.', $reference['url']);
$rest = $total - ($fetch + $data + $checksum + $output);
if (!is_null($scale) && ($scale < 4)) {
- Logger::debug('Performance:', [
+ $this->logger->debug('Performance:', [
'scale' => $scale, 'resource' => $photo['resource-id'],
'total' => number_format($total, 3), 'fetch' => number_format($fetch, 3),
'data' => number_format($data, 3), 'checksum' => number_format($checksum, 3),
* @param int $customsize Custom size (?)
* @return array|bool Array on success, false on error
*/
- private static function getPhotoById(int $id, string $type, int $customsize)
+ private function getPhotoById(int $id, string $type, int $customsize)
{
switch ($type) {
case 'preview':
if ($update) {
$curlResult = DI::httpClient()->head($url, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::IMAGE, HttpClientOptions::REQUEST => HttpClientRequest::CONTENTTYPE]);
$update = !$curlResult->isSuccess() && ($curlResult->getReturnCode() == 404);
- Logger::debug('Got return code for avatar', ['return code' => $curlResult->getReturnCode(), 'cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
+ $this->logger->debug('Got return code for avatar', ['return code' => $curlResult->getReturnCode(), 'cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
}
if ($update) {
try {
UpdateContact::add(Worker::PRIORITY_LOW, $id);
- Logger::info('Invalid file, contact update initiated', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
+ $this->logger->info('Invalid file, contact update initiated', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
} catch (\InvalidArgumentException $e) {
- Logger::notice($e->getMessage(), ['id' => $id, 'contact' => $contact]);
+ $this->logger->notice($e->getMessage(), ['id' => $id, 'contact' => $contact]);
}
} else {
- Logger::info('Invalid file', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
+ $this->logger->info('Invalid file', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
}
}
if (!empty($mimetext) && ($mime[0] != 'image') && ($mimetext != 'application/octet-stream')) {
- Logger::info('Unexpected Content-Type', ['mime' => $mimetext, 'url' => $url]);
+ $this->logger->info('Unexpected Content-Type', ['mime' => $mimetext, 'url' => $url]);
$mimetext = '';
}
if (!empty($mimetext)) {
- Logger::debug('Expected Content-Type', ['mime' => $mimetext, 'url' => $url]);
+ $this->logger->debug('Expected Content-Type', ['mime' => $mimetext, 'url' => $url]);
}
}
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
-use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Core\Worker;
if ($max_dailies) {
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
if ($count >= $max_dailies) {
- Logger::notice('max daily registrations exceeded.');
+ $this->logger->notice('max daily registrations exceeded.');
DI::sysmsg()->addNotice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
return '';
}
// Is there text in the tar pit?
if (!empty($arr['email'])) {
- Logger::info('Tar pit', $arr);
+ $this->logger->info('Tar pit', $arr);
DI::sysmsg()->addNotice(DI::l10n()->t('You have entered too much information.'));
DI::baseUrl()->redirect('register/');
}
}
if ($arr['email'] != $arr['repeat']) {
- Logger::info('Mail mismatch', $arr);
+ $this->logger->info('Mail mismatch', $arr);
DI::sysmsg()->addNotice(DI::l10n()->t('Please enter the identical mail address in the second field.'));
$regdata = ['email' => $arr['email'], 'nickname' => $arr['nickname'], 'username' => $arr['username']];
DI::baseUrl()->redirect('register?' . http_build_query($regdata));