Example #1
0
<?php

include '../lib/MailSo/MailSo.php';
echo '<pre>';
$oLogger = \MailSo\Log\Logger::SingletonInstance()->Add(\MailSo\Log\Drivers\Inline::NewInstance("\r\n", true));
$sEmails = 'User Name1 <*****@*****.**>, User D\'Name2 <*****@*****.**>, "User Name3" <*****@*****.**>';
$oData = \MailSo\Mime\EmailCollection::NewInstance($sEmails);
$oLogger->WriteDump($oData);
 /**
  * @return \MailSo\Log\Logger
  */
 public function Logger()
 {
     if (null === $this->oLogger) {
         $this->oLogger = \MailSo\Log\Logger::SingletonInstance();
         if (!!$this->Config()->Get('logs', 'enable', false)) {
             $sSessionFilter = (string) $this->Config()->Get('logs', 'session_filter', '');
             if (!empty($sSessionFilter)) {
                 $aSessionParts = \explode(':', $sSessionFilter, 2);
                 if (empty($aSessionParts[0]) || empty($aSessionParts[1]) || (string) $aSessionParts[1] !== (string) \RainLoop\Utils::GetCookie($aSessionParts[0], '')) {
                     return $this->oLogger;
                 }
             }
             $iTimeOffset = (int) $this->Config()->Get('logs', 'time_offset', 0);
             $this->oLogger->SetShowSecter(!$this->Config()->Get('logs', 'hide_passwords', true));
             $sLogFileFullPath = \APP_PRIVATE_DATA . 'logs/' . $this->compileLogFileName($this->Config()->Get('logs', 'filename', ''));
             $sLogFileDir = \dirname($sLogFileFullPath);
             if (!@is_dir($sLogFileDir)) {
                 @mkdir($sLogFileDir, 0755, true);
             }
             $this->oLogger->Add(\MailSo\Log\Drivers\File::NewInstance($sLogFileFullPath)->WriteOnErrorOnly($this->Config()->Get('logs', 'write_on_error_only', false))->WriteOnPhpErrorOnly($this->Config()->Get('logs', 'write_on_php_error_only', false))->WriteOnTimeoutOnly($this->Config()->Get('logs', 'write_on_timeout_only', 0))->SetTimeOffset($iTimeOffset));
             if (!$this->Config()->Get('debug', 'enable', false)) {
                 $this->oLogger->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME);
             }
             $this->oLogger->WriteEmptyLine();
             $oHttp = $this->Http();
             $this->oLogger->Write('[DATE:' . \MailSo\Log\Logger::DateHelper('d.m.y', $iTimeOffset) . (0 !== $iTimeOffset ? '][OFFSET:' . (0 < $iTimeOffset ? '+' : '-') . \str_pad((string) \abs($iTimeOffset), 2, '0', STR_PAD_LEFT) : '') . '][RL:' . APP_VERSION . '][PHP:' . PHP_VERSION . '][IP:' . $oHttp->GetClientIp($this->Config()->Get('labs', 'http_client_ip_check_proxy', false)) . '][PID:' . (\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : 'unknown') . '][' . $oHttp->GetServer('SERVER_SOFTWARE', '~') . '][' . (\MailSo\Base\Utils::FunctionExistsAndEnabled('php_sapi_name') ? \php_sapi_name() : '~') . ']');
             $sPdo = \class_exists('PDO') ? \implode(',', \PDO::getAvailableDrivers()) : 'off';
             $sPdo = empty($sPdo) ? '~' : $sPdo;
             $this->oLogger->Write('[' . 'Suhosin:' . (\extension_loaded('suhosin') || @\ini_get('suhosin.get.max_value_length') ? 'on' : 'off') . '][APC:' . (\MailSo\Base\Utils::FunctionExistsAndEnabled('apc_fetch') ? 'on' : 'off') . '][MB:' . (\MailSo\Base\Utils::FunctionExistsAndEnabled('mb_convert_encoding') ? 'on' : 'off') . '][PDO:' . $sPdo . (\RainLoop\Utils::IsOwnCloud() ? '][ownCloud:true' : '') . '][Streams:' . \implode(',', \stream_get_transports()) . ']');
             $this->oLogger->Write('[' . $oHttp->GetMethod() . '] ' . $oHttp->GetScheme() . '://' . $oHttp->GetHost(false, false) . $oHttp->GetServer('REQUEST_URI', ''), \MailSo\Log\Enumerations\Type::NOTE, 'REQUEST');
         }
     }
     return $this->oLogger;
 }
Example #3
0
 /**
  * @return \MailSo\Log\Logger
  */
 public function Logger()
 {
     if (null === $this->oLogger) {
         $this->oLogger = \MailSo\Log\Logger::SingletonInstance();
         if (!!$this->Config()->Get('logs', 'enable', true)) {
             $this->oLogger->SetShowSecter(!$this->Config()->Get('logs', 'hide_passwords', true));
             $sLogFileFullPath = \APP_PRIVATE_DATA . 'logs/' . $this->compileLogFileName();
             $sLogFileDir = \dirname($sLogFileFullPath);
             if (!@is_dir($sLogFileDir)) {
                 @mkdir($sLogFileDir, 0755, true);
             }
             $this->oLogger->Add(\MailSo\Log\Drivers\File::NewInstance($sLogFileFullPath)->WriteOnErrorOnly($this->Config()->Get('logs', 'write_on_error_only', true))->WriteOnTimeoutOnly($this->Config()->Get('logs', 'write_on_timeout_only', 30)));
             if (!$this->Config()->Get('debug', 'enable', false)) {
                 $this->oLogger->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME);
             }
             $this->oLogger->WriteEmptyLine();
             $oHttp = $this->Http();
             $this->oLogger->Write('[DATE:' . \gmdate('d.m.y') . '][RL:' . APP_VERSION . '][PHP:' . PHP_VERSION . '][IP:' . $oHttp->GetClientIp() . '][PID:' . (\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : 'unknown') . '][GUID:' . \MailSo\Log\Logger::Guid() . ']');
             $this->oLogger->Write('[' . $oHttp->GetMethod() . '] ' . $oHttp->GetScheme() . '://' . $oHttp->GetHost(false, false) . $oHttp->GetServer('REQUEST_URI', ''), \MailSo\Log\Enumerations\Type::NOTE, 'REQUEST');
         }
     }
     return $this->oLogger;
 }