mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-03 07:04:07 +01:00
Merge branch 'v3.1'
This commit is contained in:
@@ -5,10 +5,8 @@ language: php
|
||||
sudo: false
|
||||
|
||||
php:
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- '7.2'
|
||||
- '7.3'
|
||||
- '7.4'
|
||||
|
||||
branches:
|
||||
only:
|
||||
@@ -24,7 +22,7 @@ before_script:
|
||||
- composer self-update
|
||||
- composer install --prefer-source --no-interaction --dev
|
||||
|
||||
script: ./vendor/bin/phpunit -c ./tests/phpunit.xml --testsuite Core
|
||||
script: XDEBUG_MODE=coverage ./vendor/bin/phpunit -c ./tests/phpunit.xml --testsuite Core
|
||||
|
||||
after_script:
|
||||
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then mv ./tests/_output/coverage-clover.xml clover.xml && ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT -t clover; fi
|
||||
|
||||
BIN
app/locales/ja_JP/LC_MESSAGES/messages.mo
Normal file
BIN
app/locales/ja_JP/LC_MESSAGES/messages.mo
Normal file
Binary file not shown.
7680
app/locales/ja_JP/LC_MESSAGES/messages.po
Normal file
7680
app/locales/ja_JP/LC_MESSAGES/messages.po
Normal file
File diff suppressed because it is too large
Load Diff
@@ -49,6 +49,12 @@ final class InstallController extends ControllerBase
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
if ($this->configData->isInstalled()) {
|
||||
$this->router->response()
|
||||
->redirect('index.php?r=login');
|
||||
return;
|
||||
}
|
||||
|
||||
$layoutHelper = $this->dic->get(LayoutHelper::class);
|
||||
$layoutHelper->getPublicLayout('index', 'install');
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"require": {
|
||||
"roave/security-advisories": "dev-master",
|
||||
"php": "~7.0 || ~7.1 || ~7.2 || ~7.3",
|
||||
"php": "~7.3 || ~7.4",
|
||||
"defuse/php-encryption": "~2.1",
|
||||
"phpmailer/phpmailer": "~6.0",
|
||||
"ademarre/binary-to-text-php": "dev-master",
|
||||
|
||||
2091
composer.lock
generated
2091
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -290,7 +290,7 @@ final class Bootstrap
|
||||
|
||||
if (!self::$checkPhpVersion) {
|
||||
throw new InitializationException(
|
||||
sprintf(__('Required PHP version >= %s <= %s'), '7.0', '7.3'),
|
||||
sprintf(__('Required PHP version >= %s <= %s'), '7.3', '7.4'),
|
||||
InitializationException::ERROR,
|
||||
__u('Please update the PHP version to run sysPass')
|
||||
);
|
||||
|
||||
@@ -79,7 +79,8 @@ final class Language
|
||||
'pt_BR' => 'Português',
|
||||
'it_IT' => 'Italiano',
|
||||
'da' => 'Dansk',
|
||||
'fo' => 'Føroyskt mál'
|
||||
'fo' => 'Føroyskt mál',
|
||||
'ja_JP' => '日本語',
|
||||
];
|
||||
/**
|
||||
* @var ConfigData
|
||||
@@ -237,4 +238,4 @@ final class Language
|
||||
{
|
||||
return file_exists(LOCALES_PATH . DIRECTORY_SEPARATOR . $lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ defined('APP_ROOT') || die();
|
||||
*/
|
||||
final class FileBackupService extends Service
|
||||
{
|
||||
private const BACKUP_EXCLUDE_REGEX = '#^(?!.*(backup|cache|temp|vendor|tests))(.*)$#i';
|
||||
|
||||
/**
|
||||
* @var ConfigData
|
||||
*/
|
||||
@@ -359,7 +361,8 @@ final class FileBackupService extends Service
|
||||
);
|
||||
|
||||
$archive = new ArchiveHandler($this->backupFileApp, $this->extensionChecker);
|
||||
$archive->compressDirectory(APP_ROOT, '#^(?!(.*backup))(.*)$#i');
|
||||
|
||||
$archive->compressDirectory(APP_ROOT, self::BACKUP_EXCLUDE_REGEX);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ final class Installer extends Service
|
||||
/**
|
||||
* sysPass' version and build number
|
||||
*/
|
||||
const VERSION = [3, 1, 2];
|
||||
const VERSION = [3, 1, 3];
|
||||
const VERSION_TEXT = '3.1';
|
||||
const BUILD = 20030701;
|
||||
const BUILD = 20122001;
|
||||
|
||||
/**
|
||||
* @var DatabaseSetupInterface
|
||||
|
||||
@@ -163,14 +163,26 @@ final class MySQL implements DatabaseSetupInterface
|
||||
logger('Creating DB user');
|
||||
|
||||
try {
|
||||
$query = 'CREATE USER %s@`%s` IDENTIFIED BY %s';
|
||||
$query = 'CREATE USER %s@%s IDENTIFIED BY %s';
|
||||
|
||||
$dbc = $this->mysqlHandler->getConnectionSimple();
|
||||
|
||||
$dbc->exec(sprintf($query, $dbc->quote($user), $this->installData->getDbAuthHost(), $dbc->quote($pass)));
|
||||
$dbc->exec(
|
||||
sprintf($query,
|
||||
$dbc->quote($user),
|
||||
$dbc->quote($this->installData->getDbAuthHost()),
|
||||
$dbc->quote($pass))
|
||||
);
|
||||
|
||||
if ($this->installData->getDbAuthHost() !== $this->installData->getDbAuthHostDns()) {
|
||||
$dbc->exec(sprintf($query, $dbc->quote($user), $this->installData->getDbAuthHostDns(), $dbc->quote($pass)));
|
||||
if (!empty($this->installData->getDbAuthHostDns())
|
||||
&& $this->installData->getDbAuthHost() !== $this->installData->getDbAuthHostDns()
|
||||
) {
|
||||
$dbc->exec(
|
||||
sprintf($query,
|
||||
$dbc->quote($user),
|
||||
$this->installData->getDbAuthHostDns(),
|
||||
$dbc->quote($pass))
|
||||
);
|
||||
}
|
||||
|
||||
$dbc->exec('FLUSH PRIVILEGES');
|
||||
@@ -207,7 +219,10 @@ final class MySQL implements DatabaseSetupInterface
|
||||
try {
|
||||
$dbc = $this->mysqlHandler->getConnectionSimple();
|
||||
|
||||
$dbc->exec('CREATE SCHEMA `' . $this->installData->getDbName() . '` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci');
|
||||
$dbc->exec(sprintf(
|
||||
'CREATE SCHEMA `%s` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci',
|
||||
$this->installData->getDbName()
|
||||
));
|
||||
} catch (PDOException $e) {
|
||||
throw new SPException(
|
||||
sprintf(__('Error while creating the DB (\'%s\')'), $e->getMessage()),
|
||||
@@ -219,12 +234,24 @@ final class MySQL implements DatabaseSetupInterface
|
||||
}
|
||||
|
||||
try {
|
||||
$query = 'GRANT ALL PRIVILEGES ON `%s`.* TO %s@`%s`';
|
||||
$query = 'GRANT ALL PRIVILEGES ON `%s`.* TO %s@%s';
|
||||
|
||||
$dbc->exec(sprintf($query, $this->installData->getDbName(), $dbc->quote($this->configData->getDbUser()), $this->installData->getDbAuthHost()));
|
||||
$dbc->exec(sprintf(
|
||||
$query,
|
||||
$this->installData->getDbName(),
|
||||
$dbc->quote($this->configData->getDbUser()),
|
||||
$dbc->quote($this->installData->getDbAuthHost()))
|
||||
);
|
||||
|
||||
if ($this->installData->getDbAuthHost() !== $this->installData->getDbAuthHostDns()) {
|
||||
$dbc->exec(sprintf($query, $this->installData->getDbName(), $dbc->quote($this->configData->getDbUser()), $this->installData->getDbAuthHostDns()));
|
||||
if (!empty($this->installData->getDbAuthHostDns())
|
||||
&& $this->installData->getDbAuthHost() !== $this->installData->getDbAuthHostDns()
|
||||
) {
|
||||
$dbc->exec(sprintf(
|
||||
$query,
|
||||
$this->installData->getDbName(),
|
||||
$dbc->quote($this->configData->getDbUser()),
|
||||
$dbc->quote($this->installData->getDbAuthHostDns()))
|
||||
);
|
||||
}
|
||||
|
||||
$dbc->exec('FLUSH PRIVILEGES');
|
||||
@@ -245,7 +272,7 @@ final class MySQL implements DatabaseSetupInterface
|
||||
try {
|
||||
// Commprobar si existe al seleccionarla
|
||||
$this->mysqlHandler->getConnectionSimple()
|
||||
->exec('USE `' . $this->installData->getDbName() . '`');
|
||||
->exec(sprintf('USE `%s`', $this->installData->getDbName()));
|
||||
} catch (PDOException $e) {
|
||||
throw new SPException(
|
||||
__u('The database does not exist'),
|
||||
@@ -283,11 +310,22 @@ final class MySQL implements DatabaseSetupInterface
|
||||
$dbc->exec('DROP TABLE IF EXISTS `' . $this->installData->getDbName() . '`.`' . $table . '`');
|
||||
}
|
||||
} else {
|
||||
$dbc->exec('DROP DATABASE IF EXISTS `' . $this->installData->getDbName() . '`');
|
||||
$dbc->exec('DROP USER ' . $dbc->quote($this->configData->getDbUser()) . '@`' . $this->installData->getDbAuthHost() . '`');
|
||||
$dbc->exec(sprintf(
|
||||
'DROP DATABASE IF EXISTS `%s`',
|
||||
$this->installData->getDbName()
|
||||
));
|
||||
$dbc->exec(sprintf(
|
||||
'DROP USER %s@%s',
|
||||
$dbc->quote($this->configData->getDbUser()),
|
||||
$dbc->quote($this->installData->getDbAuthHost())
|
||||
));
|
||||
|
||||
if ($this->installData->getDbAuthHost() !== $this->installData->getDbAuthHostDns()) {
|
||||
$dbc->exec('DROP USER ' . $dbc->quote($this->configData->getDbUser()) . '@`' . $this->installData->getDbAuthHostDns() . '`');
|
||||
$dbc->exec(sprintf(
|
||||
'DROP USER %s@%s',
|
||||
$dbc->quote($this->configData->getDbUser()),
|
||||
$dbc->quote($this->installData->getDbAuthHostDns())
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +341,7 @@ final class MySQL implements DatabaseSetupInterface
|
||||
$dbc = $this->mysqlHandler->getConnectionSimple();
|
||||
|
||||
// Usar la base de datos de sysPass
|
||||
$dbc->exec('USE `' . $this->installData->getDbName() . '`');
|
||||
$dbc->exec(sprintf('USE `%s`', $this->installData->getDbName()));
|
||||
} catch (PDOException $e) {
|
||||
throw new SPException(
|
||||
sprintf(__('Error while selecting \'%s\' database (%s)'), $this->installData->getDbName(), $e->getMessage()),
|
||||
|
||||
@@ -48,7 +48,7 @@ final class Checks
|
||||
*/
|
||||
public static function checkPhpVersion()
|
||||
{
|
||||
return version_compare(PHP_VERSION, '7.0', '>=')
|
||||
&& version_compare(PHP_VERSION, '7.4', '<');
|
||||
return version_compare(PHP_VERSION, '7.3', '>=')
|
||||
&& version_compare(PHP_VERSION, '7.5', '<');
|
||||
}
|
||||
}
|
||||
|
||||
64
lib/SP/Util/Link.php
Normal file
64
lib/SP/Util/Link.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2020, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace SP\Util;
|
||||
|
||||
|
||||
use SP\Bootstrap;
|
||||
use SP\Config\ConfigData;
|
||||
use SP\Core\Acl\Acl;
|
||||
use SP\Http\Uri;
|
||||
|
||||
/**
|
||||
* Class Link
|
||||
*
|
||||
* @package SP\Util
|
||||
*/
|
||||
final class Link
|
||||
{
|
||||
/**
|
||||
* @param int $itemId
|
||||
* @param int $actionId
|
||||
* @param ConfigData $configData
|
||||
*
|
||||
* @param bool $useUI
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDeepLink(int $itemId, int $actionId, ConfigData $configData, bool $useUI = false)
|
||||
{
|
||||
$route = Acl::getActionRoute($actionId) . '/' . $itemId;
|
||||
|
||||
if ($useUI) {
|
||||
$baseUrl = ($configData->getApplicationUrl() ?: Bootstrap::$WEBURI) . '/index.php';
|
||||
} else {
|
||||
$baseUrl = ($configData->getApplicationUrl() ?: Bootstrap::$WEBURI) . Bootstrap::$SUBURI;
|
||||
}
|
||||
|
||||
$uri = new Uri($baseUrl);
|
||||
$uri->addParam('r', $route);
|
||||
|
||||
return $uri->getUriSigned($configData->getPasswordSalt());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
DB_HOST=$(docker inspect syspass-db-test --format {{.NetworkSettings.Networks.bridge.IPAddress}})
|
||||
DB_HOST=$(docker inspect ${DB_CONTAINER} --format {{.NetworkSettings.Networks.bridge.IPAddress}})
|
||||
|
||||
if [[ -z "${DB_HOST}" ]]; then
|
||||
echo "Unknown host"
|
||||
|
||||
Reference in New Issue
Block a user