Bug fixes

This commit is contained in:
Dennis Eichhorn 2017-02-11 22:29:23 +01:00
parent 2f37afb7d6
commit 448f623b4d
5 changed files with 13 additions and 11 deletions

View File

@ -70,17 +70,17 @@ class Auth
/**
* Authenticates user.
*
* @return mixed
* @return int
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function authenticate()
public function authenticate() : int
{
$uid = $this->session->get('UID');
if ($uid === null) {
$uid = false;
if (empty($uid)) {
return 0;
}
return $uid;

View File

@ -59,7 +59,7 @@ class L11nManager
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function __construct(LoggerInterface $logger)
public function __construct(LoggerInterface $logger = null)
{
$this->logger = $logger;
}
@ -179,9 +179,11 @@ class L11nManager
$this->loadLanguage($code, $module, $class::getLocalization($code, $theme));
if (!isset($this->language[$code][$module][$translation])) {
$this->logger->warning(FileLogger::MSG_FULL, [
'message' => 'Undefined translation for \'' . $code . '/' . $module . '/' . $translation . '\'.',
]);
if(isset($this->logger)) {
$this->logger->warning(FileLogger::MSG_FULL, [
'message' => 'Undefined translation for \'' . $code . '/' . $module . '/' . $translation . '\'.',
]);
}
return 'ERROR';
}

View File

@ -311,7 +311,7 @@ class FileLogger implements LoggerInterface
private function write(string $message) /* : void */
{
$this->createFile();
if(!is_readable($this->path)) {
if(!is_writable($this->path)) {
return;
}

View File

@ -350,7 +350,7 @@ class File extends FileAbstract implements FileInterface
Directory::create(dirname($path), 0644, true);
}
if(!is_writable($path)) {
if(!is_writable(dirname($path))) {
return false;
}

View File

@ -82,7 +82,7 @@ class LZW implements CompressionInterface
}
$w = chr($compressed[0]);
$result = $w;
$result = $dictionary[$compressed[0]];
$count = count($compressed);
for ($i = 1; $i < $count; $i++) {