本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::sysLog方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::sysLog方法的具体用法?PHP GeneralUtility::sysLog怎么用?PHP GeneralUtility::sysLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::sysLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Default action.
*
* @return array
* @throws \RuntimeException
*/
public function main()
{
$this->init();
$allowedIps = GeneralUtility::trimExplode(',', $this->config['allowedIps'], true);
if ($this->config['debug']) {
GeneralUtility::sysLog('Connection from ' . GeneralUtility::getIndpEnv('REMOTE_ADDR'), self::$extKey);
}
if ($this->config['mode'] !== 'M' || count($allowedIps) && !in_array(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $allowedIps)) {
$this->denyAccess();
}
// Initialize TCA (method handles if not already initialized)
if (version_compare(TYPO3_version, '7.6', '>=')) {
\TYPO3\CMS\Frontend\Utility\EidUtility::initTCA();
}
$this->initTSFE();
if (!empty($this->config['synchronizeDeletedAccounts']) && $this->config['synchronizeDeletedAccounts']) {
$additionalFields = ', deleted';
$additionalWhere = '';
} else {
$additionalFields = '';
$additionalWhere = ' AND deleted=0';
}
$administrators = $this->getDatabaseConnection()->exec_SELECTgetRows('username, admin, disable, realName, email, TSconfig, starttime, endtime, lang, tx_openid_openid' . $additionalFields, 'be_users', 'admin=1 AND tx_openid_openid<>\'\'' . $additionalWhere);
if (count($administrators)) {
$key = $this->config['preSharedKey'];
$data = json_encode($administrators);
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $data, MCRYPT_MODE_CBC, md5(md5($key)));
$encrypted = base64_encode($encrypted);
return $encrypted;
} else {
throw new \RuntimeException('No administrators found', 1327586994);
}
}
示例2: execute
/**
* This is the main method that is called when a task is executed
* It MUST be implemented by all classes inheriting from this one
* Note that there is no error handling, errors and failures are expected
* to be handled and logged by the client implementations.
* Should return true on successful execution, false on error.
*
* @return boolean Returns true on successful execution, false on error
*/
public function execute()
{
$success = false;
$this->init();
/** @var \TYPO3\CMS\Core\Registry $registry */
$registry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
$syncLock = $registry->get(static::$package, 'synchronisationLock');
$content = GeneralUtility::getUrl($this->config['masterUrl']);
if ($content && ($syncLock === 0 || $syncLock < time())) {
$lockUntil = time() - $this->config['updateInterval'] + self::LOCK_INTERVAL;
$registry->set(static::$package, 'synchronisationLock', $lockUntil);
$response = json_decode($content, true);
if ($response['success']) {
$key = $this->config['preSharedKey'];
$encrypted = $response['data'];
$data = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "");
$records = json_decode($data, true);
if (count($records)) {
$this->synchronizeUsers($records);
$success = true;
} else {
GeneralUtility::sysLog('No users to be synchronized', self::$extKey, 3);
}
} else {
GeneralUtility::sysLog($response['errors'][0], self::$extKey, 3);
}
$registry->set(static::$package, 'synchronisationLock', 0);
}
return $success;
}
示例3: writeLogEntries
/**
* Writes exception to different logs
*
* @param Exception $exception The exception
* @param string $context The context where the exception was thrown, WEB or CLI
* @return void
* @see t3lib_div::sysLog(), t3lib_div::devLog()
*/
protected function writeLogEntries(\Exception $exception, $context)
{
$filePathAndName = $exception->getFile();
$exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
$logTitle = 'Core: Exception handler (' . $context . ')';
$logMessage = 'Uncaught TYPO3 Exception: ' . $exceptionCodeNumber . $exception->getMessage() . ' | ' . get_class($exception) . ' thrown in file ' . $filePathAndName . ' in line ' . $exception->getLine();
if ($context === 'WEB') {
$logMessage .= '. Requested URL: ' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
}
$backtrace = $exception->getTrace();
// Write error message to the configured syslogs
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($logMessage, $logTitle, \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_FATAL);
// When database credentials are wrong, the exception is probably
// caused by this. Therefor we cannot do any database operation,
// otherwise this will lead into recurring exceptions.
try {
// In case an error occurs before a database connection exists, try
// to connect to the DB to be able to write the devlog/sys_log entry
if (isset($GLOBALS['TYPO3_DB']) && is_object($GLOBALS['TYPO3_DB']) && empty($GLOBALS['TYPO3_DB']->link)) {
$GLOBALS['TYPO3_DB']->connectDB();
}
// Write error message to devlog
// see: $TYPO3_CONF_VARS['SYS']['enable_exceptionDLOG']
if (TYPO3_EXCEPTION_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($logMessage, $logTitle, 3, array('TYPO3_MODE' => TYPO3_MODE, 'backtrace' => $backtrace));
}
// Write error message to sys_log table
$this->writeLog($logTitle . ': ' . $logMessage);
} catch (\Exception $exception) {
}
}
示例4: writeLogEntries
/**
* Writes exception to different logs
*
* @param \Exception|\Throwable $exception The exception(PHP 5.x) or throwable(PHP >= 7.0) object.
* @param string $context The context where the exception was thrown, WEB or CLI
* @return void
* @see \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(), \TYPO3\CMS\Core\Utility\GeneralUtility::devLog()
* @TODO #72293 This will change to \Throwable only if we are >= PHP7.0 only
*/
protected function writeLogEntries($exception, $context)
{
// Do not write any logs for this message to avoid filling up tables or files with illegal requests
if ($exception->getCode() === 1396795884) {
return;
}
$filePathAndName = $exception->getFile();
$exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
$logTitle = 'Core: Exception handler (' . $context . ')';
$logMessage = 'Uncaught TYPO3 Exception: ' . $exceptionCodeNumber . $exception->getMessage() . ' | ' . get_class($exception) . ' thrown in file ' . $filePathAndName . ' in line ' . $exception->getLine();
if ($context === 'WEB') {
$logMessage .= '. Requested URL: ' . GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
}
$backtrace = $exception->getTrace();
// Write error message to the configured syslogs
GeneralUtility::sysLog($logMessage, $logTitle, GeneralUtility::SYSLOG_SEVERITY_FATAL);
// When database credentials are wrong, the exception is probably
// caused by this. Therefor we cannot do any database operation,
// otherwise this will lead into recurring exceptions.
try {
// Write error message to devlog
// see: $TYPO3_CONF_VARS['SYS']['enable_exceptionDLOG']
if (TYPO3_EXCEPTION_DLOG) {
GeneralUtility::devLog($logMessage, $logTitle, 3, array('TYPO3_MODE' => TYPO3_MODE, 'backtrace' => $backtrace));
}
// Write error message to sys_log table
$this->writeLog($logTitle . ': ' . $logMessage);
} catch (\Exception $exception) {
}
}
示例5: acquireLock
/**
* Lock the process
*
* @param \EssentialDots\ExtbaseHijax\Lock\Lock $lockObj
* @param $key String to identify the lock in the system
* @param bool $exclusive Exclusive lock (shared if FALSE)
* @return bool Returns TRUE if the lock could be obtained, FALSE otherwise
*/
public function acquireLock(&$lockObj, $key, $exclusive = TRUE)
{
try {
if (!is_object($lockObj)) {
/* @var $lockObj \EssentialDots\ExtbaseHijax\Lock\Lock */
$lockObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('EssentialDots\\ExtbaseHijax\\Lock\\Lock', $key);
}
if (array_key_exists($key, $this->lockKeyType) && $this->lockKeyType[$key] !== $exclusive) {
error_log('The same key cannot be used for shared and exclusive locks atm. Key: ' . $key);
return FALSE;
}
$this->lockKeyType[$key] = $exclusive;
$this->lockObjectsKeys[spl_object_hash($lockObj)] = $key;
if (array_key_exists($key, $this->existingLocksCount) && $this->existingLocksCount[$key] > 0) {
$this->existingLocksCount[$key]++;
return true;
} else {
$this->existingLocksCount[$key] = 1;
}
$success = FALSE;
if (strlen($key)) {
$success = $lockObj->acquire($exclusive);
if ($success) {
$lockObj->sysLog('Acquired lock');
}
}
} catch (\Exception $e) {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog('Locking: Failed to acquire lock: ' . $e->getMessage(), 'cms', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
$success = FALSE;
// If locking fails, return with FALSE and continue without locking
}
return $success;
}
示例6: render
/**
* Renders Lorem Ipsum paragraphs. If $lipsum is provided it
* will be used as source text. If not provided as an argument
* or as inline argument, $lipsum is fetched from TypoScript settings.
*
* @param string $lipsum String of paragraphs file path or EXT:myext/path/to/file
* @return string
*/
public function render($lipsum = null)
{
if (strlen($lipsum) === 0) {
$lipsum = $this->lipsum;
}
if (strlen($lipsum) < 255 && !preg_match('/[^a-z0-9_\\.\\:\\/]/i', $lipsum) || 0 === strpos($lipsum, 'EXT:')) {
// argument is most likely a file reference.
$sourceFile = GeneralUtility::getFileAbsFileName($lipsum);
if (file_exists($sourceFile)) {
$lipsum = file_get_contents($sourceFile);
} else {
GeneralUtility::sysLog('Vhs LipsumViewHelper was asked to load Lorem Ipsum from a file which does not exist. ' . 'The file was: ' . $sourceFile, 'vhs', GeneralUtility::SYSLOG_SEVERITY_WARNING);
$lipsum = $this->lipsum;
}
}
$lipsum = preg_replace('/[\\r\\n]{1,}/i', "\n", $lipsum);
$paragraphs = explode("\n", $lipsum);
$paragraphs = array_slice($paragraphs, 0, intval($this->arguments['paragraphs']));
foreach ($paragraphs as $index => $paragraph) {
$length = $this->arguments['wordsPerParagraph'] + rand(0 - intval($this->arguments['skew']), intval($this->arguments['skew']));
$words = explode(' ', $paragraph);
$paragraphs[$index] = implode(' ', array_slice($words, 0, $length));
}
$lipsum = implode("\n", $paragraphs);
if ($this->arguments['html']) {
$tsParserPath = $this->arguments['parseFuncTSPath'] ? '< ' . $this->arguments['parseFuncTSPath'] : null;
$lipsum = $this->contentObject->parseFunc($lipsum, [], $tsParserPath);
}
return $lipsum;
}
示例7: handleError
/**
* Handles an error.
* If the error is registered as exceptionalError it will by converted into an exception, to be handled
* by the configured exceptionhandler. Additionally the error message is written to the configured logs.
* If TYPO3_MODE is 'BE' the error message is also added to the flashMessageQueue, in FE the error message
* is displayed in the admin panel (as TsLog message)
*
* @param int $errorLevel The error level - one of the E_* constants
* @param string $errorMessage The error message
* @param string $errorFile Name of the file the error occurred in
* @param int $errorLine Line number where the error occurred
* @return bool
* @throws Exception with the data passed to this method if the error is registered as exceptionalError
* @throws \Exception with the data passed to this method if the error is registered as exceptionalError
*/
public function handleError($errorLevel, $errorMessage, $errorFile, $errorLine)
{
// Don't do anything if error_reporting is disabled by an @ sign
if (error_reporting() === 0) {
return true;
}
$errorLevels = array(E_WARNING => 'Warning', E_NOTICE => 'Notice', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error', E_DEPRECATED => 'Runtime Deprecation Notice');
$message = 'PHP ' . $errorLevels[$errorLevel] . ': ' . $errorMessage . ' in ' . $errorFile . ' line ' . $errorLine;
if ($errorLevel & $this->exceptionalErrors) {
throw new Exception($message, 1);
} else {
switch ($errorLevel) {
case E_USER_ERROR:
case E_RECOVERABLE_ERROR:
$severity = 2;
break;
case E_USER_WARNING:
case E_WARNING:
$severity = 1;
break;
default:
$severity = 0;
}
$logTitle = 'Core: Error handler (' . TYPO3_MODE . ')';
$message = $logTitle . ': ' . $message;
GeneralUtility::sysLog($message, 'core', $severity + 1);
return true;
}
}
示例8: dispatchAction
/**
* the only action the extbase dispatcher knows of
*
* @return null
*/
public function dispatchAction()
{
if (!$this->controllerName) {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('There was no controller name set for class %s.', get_class($this)), 'cz_simple_cal', 2);
return '';
}
if (!isset($this->settings[$this->controllerName]) || !is_array($this->settings[$this->controllerName]) || !isset($this->settings[$this->controllerName]['allowedActions'])) {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('There were no allowedActions set on pageId %d, so there was nothing to display for the calendar.', $GLOBALS['TSFE']->id), 'cz_simple_cal', 2);
return '';
}
$actions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->settings[$this->controllerName]['allowedActions'], true);
reset($actions);
$this->forward(current($actions));
}
示例9: writeLogEntries
/**
* Writes exception to different logs
*
* @param \Exception|\Throwable $exception The exception(PHP 5.x) or throwable(PHP >= 7.0) object.
* @param string $context The context where the exception was thrown, WEB or CLI
* @return void
* @see \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(), \TYPO3\CMS\Core\Utility\GeneralUtility::devLog()
*/
protected function writeLogEntries($exception, $context)
{
// Do not write any logs for this message to avoid filling up tables or files with illegal requests
if ($exception->getCode() === 1396795884) {
return;
}
$filePathAndName = $exception->getFile();
$exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
$logTitle = 'Core: Exception handler (' . $context . ')';
$logMessage = 'Uncaught TYPO3 Exception: ' . $exceptionCodeNumber . $exception->getMessage() . ' | ' . get_class($exception) . ' thrown in file ' . $filePathAndName . ' in line ' . $exception->getLine();
if ($context === self::CONTEXT_WEB) {
$logMessage .= '. Requested URL: ' . GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
}
// Write error message to the configured syslogs
GeneralUtility::sysLog($logMessage, $logTitle, GeneralUtility::SYSLOG_SEVERITY_FATAL);
}
示例10: flushMemoryQueue
/**
* Flushs the memory queue.
*
* @return void
*/
protected function flushMemoryQueue()
{
if ($this->memorySpool !== null) {
$mailer = $this->getMailer();
$transport = $mailer->getTransport();
if ($transport instanceof \R3H6\MailSpool\Mail\SpoolTransport) {
$failedRecipients = array();
try {
$sent = $this->memorySpool->flushQueue($transport->getRealTransport(), $failedRecipients);
if (!$sent) {
throw new \RuntimeException('No e-mail has been sent', 1476304931);
}
} catch (\Exception $exception) {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($exception->getMessage(), 'mail_spool', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
}
}
}
}
示例11: mail
/**
* Proxy for the PHP mail() function. Adds possibility to hook in and send the mails in a different way.
* The hook can be used by adding function to the configuration array:
* $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery']
*
* @param string $to Email address to send to.
* @param string $subject Subject line, non-encoded. (see PHP function mail())
* @param string $messageBody Message content, non-encoded. (see PHP function mail())
* @param string $additionalHeaders Additional headers for the mail (see PHP function mail())
* @param string $additionalParameters Additional flags for the sending mail tool (see PHP function mail())
* @return boolean Indicates whether the mail has been sent or not
* @see PHP function mail() []
* @link http://www.php.net/manual/en/function.mail.php
* @deprecated since 6.1, will be removed two versions later - Use \TYPO3\CMS\Core\Mail\Mailer instead
*/
public static function mail($to, $subject, $messageBody, $additionalHeaders = NULL, $additionalParameters = NULL)
{
GeneralUtility::logDeprecatedFunction();
$success = TRUE;
// If the mail does not have a From: header, fall back to the default in TYPO3_CONF_VARS.
if (!preg_match('/^From:/im', $additionalHeaders) && $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']) {
if (!is_null($additionalHeaders) && substr($additionalHeaders, -1) != LF) {
$additionalHeaders .= LF;
}
if ($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName']) {
$additionalHeaders .= 'From: "' . $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'] . '" <' . $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'] . '>';
} else {
$additionalHeaders .= 'From: ' . $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'];
}
}
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'])) {
$parameters = array('to' => $to, 'subject' => $subject, 'messageBody' => $messageBody, 'additionalHeaders' => $additionalHeaders, 'additionalParameters' => $additionalParameters);
$fakeThis = FALSE;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'] as $hookSubscriber) {
$hookSubscriberContainsArrow = strpos($hookSubscriber, '->');
if ($hookSubscriberContainsArrow !== FALSE) {
throw new \RuntimeException($hookSubscriber . ' is an invalid hook implementation. Please consider using an implementation of TYPO3\\CMS\\Core\\Mail\\MailerAdapter.', 1322287600);
} else {
$mailerAdapter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($hookSubscriber);
if ($mailerAdapter instanceof \TYPO3\CMS\Core\Mail\MailerAdapterInterface) {
$success = $success && $mailerAdapter->mail($to, $subject, $messageBody, $additionalHeaders, $additionalParameters, $fakeThis);
} else {
throw new \RuntimeException($hookSubscriber . ' is not an implementation of TYPO3\\CMS\\Core\\Mail\\MailerAdapter,
but must implement that interface to be used in the substituteMailDelivery hook.', 1294062286);
}
}
}
} else {
if (is_null($additionalParameters)) {
$success = @mail($to, $subject, $messageBody, $additionalHeaders);
} else {
$success = @mail($to, $subject, $messageBody, $additionalHeaders, $additionalParameters);
}
}
if (!$success) {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog('Mail to "' . $to . '" could not be sent (Subject: "' . $subject . '").', 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
}
return $success;
}
示例12: validateReturnUrl
/**
* Returns a valid and XSS cleaned url for redirect, checked against configuration "allowedRedirectHosts"
*
* @param string $url
* @return string cleaned referer or empty string if not valid
*/
public function validateReturnUrl($url)
{
$url = strval($url);
if ($url === '') {
return '';
}
$decodedUrl = rawurldecode($url);
$sanitizedUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::removeXSS($decodedUrl);
if ($decodedUrl !== $sanitizedUrl || preg_match('#["<>\\\\]+#', $url)) {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('service-URLValidator-xssAttackDetected', 'cicregister'), $url), 'cicregister', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
return '';
}
// Validate the URL:
if ($this->canRedirectToUrl($url)) {
return $url;
}
// URL is not allowed
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('service-URLValidator-noValidRedirectUrl', 'cicregister'), $url), 'felogin', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
return '';
}
示例13: acquireLock
/**
* Lock the process
*
* @param $lockObj
* @param $key String to identify the lock in the system
* @param bool $exclusive Exclusive lock (shared if FALSE)
* @return bool Returns TRUE if the lock could be obtained, FALSE otherwise
*/
protected function acquireLock(&$lockObj, $key, $exclusive = TRUE)
{
try {
if (!is_object($lockObj)) {
/* @var $lockObj \EssentialDots\ExtbaseHijax\Lock\Lock */
$lockObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('EssentialDots\\ExtbaseHijax\\Lock\\Lock', $key);
}
$success = FALSE;
if (strlen($key)) {
$success = $lockObj->acquire($exclusive);
if ($success) {
$lockObj->sysLog('Acquired lock');
}
}
} catch (\Exception $e) {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog('Locking: Failed to acquire lock: ' . $e->getMessage(), 'cms', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
$success = FALSE;
// If locking fails, return with FALSE and continue without locking
}
return $success;
}
示例14: getUser
/**
* Find a user (eg. look up the user record in database when a login is sent)
*
* @return mixed User array or FALSE
* @todo Define visibility
*/
public function getUser()
{
$user = FALSE;
if ($this->login['status'] == 'login') {
if ($this->login['uident']) {
$user = $this->fetchUserRecord($this->login['uname']);
if (!is_array($user)) {
// Failed login attempt (no username found)
$this->writelog(255, 3, 3, 2, 'Login-attempt from %s (%s), username \'%s\' not found!!', array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']));
// Logout written to log
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), username \'%s\' not found!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
} else {
if ($this->writeDevLog) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('User found: ' . \TYPO3\CMS\Core\Utility\GeneralUtility::arrayToLogString($user, array($this->db_user['userid_column'], $this->db_user['username_column'])), 'TYPO3\\CMS\\Sv\\AuthenticationService');
}
}
} else {
// Failed Login attempt (no password given)
$this->writelog(255, 3, 3, 2, 'Login-attempt from %s (%s) for username \'%s\' with an empty password!', array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']));
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), for username \'%s\' with an empty password!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
}
}
return $user;
}
示例15: getCookieDomain
/**
* Gets the domain to be used on setting cookies.
* The information is taken from the value in $GLOBALS['TYPO3_CONF_VARS']['SYS']['cookieDomain'].
*
* @return string The domain to be used on setting cookies
* @see AbstractUserAuthentication::getCookieDomain
*/
protected static function getCookieDomain()
{
$result = '';
$cookieDomain = $GLOBALS['TYPO3_CONF_VARS']['SYS']['cookieDomain'];
// If a specific cookie domain is defined for a given TYPO3_MODE,
// use that domain
if (!empty($GLOBALS['TYPO3_CONF_VARS']['FE']['cookieDomain'])) {
$cookieDomain = $GLOBALS['TYPO3_CONF_VARS']['FE']['cookieDomain'];
}
if ($cookieDomain) {
if ($cookieDomain[0] == '/') {
$match = [];
$matchCnt = preg_match($cookieDomain, GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'), $match);
if ($matchCnt === false) {
GeneralUtility::sysLog('The regular expression for the cookie domain (' . $cookieDomain . ') contains errors. The session is not shared across sub-domains.', 'Core', GeneralUtility::SYSLOG_SEVERITY_ERROR);
} elseif ($matchCnt) {
$result = $match[0];
}
} else {
$result = $cookieDomain;
}
}
return $result;
}