PHP Censor fixes

This commit is contained in:
Dmitry Khomutov 2016-12-29 12:43:02 +07:00
commit b1d5c9cec2
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
15 changed files with 164 additions and 161 deletions

View file

@ -7,11 +7,11 @@
* @link https://www.phptesting.org/
*/
namespace PHPCI\Command;
namespace PHPCensor\Command;
use PHPCI\Service\UserService;
use PHPCI\Helper\Lang;
use PHPCI\Store\UserStore;
use PHPCensor\Helper\Lang;
use PHPCensor\Service\UserService;
use PHPCensor\Store\UserStore;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -43,7 +43,7 @@ class RegisterLdapUserCommand extends Command
protected function configure()
{
$this
->setName('phpci:register-ldap-user')
->setName('php-censor:register-ldap-user')
->setDescription(Lang::get('register_ldap_user'));
}

View file

@ -7,11 +7,11 @@
* @link https://www.phptesting.org/
*/
namespace PHPCI\Command;
namespace PHPCensor\Command;
use PHPCI\Service\UserService;
use PHPCI\Helper\Lang;
use PHPCI\Store\UserStore;
use PHPCensor\Helper\Lang;
use PHPCensor\Service\UserService;
use PHPCensor\Store\UserStore;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -42,7 +42,7 @@ class RegisterUserCommand extends Command
protected function configure()
{
$this
->setName('phpci:register-user')
->setName('php-censor:register-user')
->setDescription(Lang::get('register_user'));
}

View file

@ -14,6 +14,8 @@ use b8;
use PHPCensor\Helper\Email;
use PHPCensor\Helper\Lang;
use PHPCensor\Controller;
use PHPCensor\Security\Authentication\Service;
use PHPCensor\Store\UserStore;
/**
* Session Controller - Handles user login / logout.
@ -25,12 +27,12 @@ use PHPCensor\Controller;
class SessionController extends Controller
{
/**
* @var \PHPCensor\Store\UserStore
* @var UserStore
*/
protected $userStore;
/**
* @var \PHPCI\Security\Authentication\Service
* @var Service
*/
protected $authentication;
@ -41,7 +43,7 @@ class SessionController extends Controller
{
$this->response->disableLayout();
$this->userStore = b8\Store\Factory::getStore('User');
$this->authentication = \PHPCI\Security\Authentication\Service::getInstance();
$this->authentication = Service::getInstance();
}
/**

View file

@ -119,10 +119,12 @@ class Email
*
* @return integer
*/
public function send(Builder $builder)
public function send(Builder $builder = null)
{
$smtpServer = $this->config->get('php-censor.email_settings.smtp_address');
$builder->logDebug(sprintf("SMTP: '%s'", !empty($smtpServer) ? 'true' : 'false'));
if (null !== $builder) {
$builder->logDebug(sprintf("SMTP: '%s'", !empty($smtpServer) ? 'true' : 'false'));
}
$factory = new MailerFactory($this->config->get('php-censor'));
$mailer = $factory->getSwiftMailerFromConfig();

View file

@ -3,16 +3,16 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Security\Authentication\UserProvider;
namespace PHPCensor\Security\Authentication\UserProvider;
use b8\Config;
use PHPCI\Model\User;
use PHPCI\Security\Authentication\LoginPasswordProvider;
use PHPCensor\Model\User;
use PHPCensor\Security\Authentication\LoginPasswordProvider;
/**
* Ldap user provider.
@ -24,7 +24,7 @@ class Ldap extends AbstractProvider implements LoginPasswordProvider
public function verifyPassword(User $user, $password)
{
$config = Config::getInstance()->get('phpci.security.ldap', []);
$config = Config::getInstance()->get('php-censor.security.ldap', []);
$server = $config["server"];
$mailAttribute = $config["mailAttribute"];
$ldap = ldap_connect($server);

View file

@ -3,19 +3,19 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Security\Authentication;
namespace PHPCensor\Security\Authentication;
use PHPCI\Model\User;
use PHPCensor\Model\User;
/**
* User provider which authenticiation using a password.
*
* @author Adirelle <adirelle@gmail.com>
* @author Adirelle <adirelle@gmail.com>
*/
interface LoginPasswordProvider extends UserProvider
{

View file

@ -3,19 +3,19 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Security\Authentication;
namespace PHPCensor\Security\Authentication;
use b8\Config;
/**
* Authentication facade.
*
* @author Adirelle <adirelle@gmail.com>
* @author Adirelle <adirelle@gmail.com>
*/
class Service
{
@ -33,7 +33,7 @@ class Service
{
if (self::$instance === null) {
$config = Config::getInstance()->get(
'phpci.security.authentication',
'php-censor.security.authentication',
['internal' => ['type' => 'internal']]
);
@ -43,6 +43,7 @@ class Service
}
self::$instance = new self($providers);
}
return self::$instance;
}
@ -55,8 +56,8 @@ class Service
public static function buildProvider($key, $config)
{
$class = ucfirst($config['type']);
if (class_exists('\\PHPCI\\Security\\Authentication\\UserProvider\\' . $class)) {
$class = '\\PHPCI\\Security\\Authentication\\UserProvider\\' . $class;
if (class_exists('\\PHPCensor\\Security\\Authentication\\UserProvider\\' . $class)) {
$class = '\\PHPCensor\\Security\\Authentication\\UserProvider\\' . $class;
}
return new $class($key, $config);

View file

@ -3,14 +3,14 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Security\Authentication;
namespace PHPCensor\Security\Authentication;
use PHPCI\Model\User;
use PHPCensor\Model\User;
/**
* User provider interface.
@ -22,7 +22,7 @@ interface UserProvider
/** Check if all software requirements are met (libraries, extensions, ...)
*
* @throws Exception
* @throws \Exception
*/
public function checkRequirements();

View file

@ -3,19 +3,19 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Security\Authentication\UserProvider;
namespace PHPCensor\Security\Authentication\UserProvider;
use PHPCI\Security\Authentication\UserProvider;
use PHPCensor\Security\Authentication\UserProvider;
/**
* Abstract user provider.
*
* @author Adirelle <adirelle@gmail.com>
* @author Adirelle <adirelle@gmail.com>
*/
abstract class AbstractProvider implements UserProvider
{

View file

@ -3,19 +3,20 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Security\Authentication\UserProvider;
namespace PHPCensor\Security\Authentication\UserProvider;
use PHPCI\Model\User;
use PHPCI\Security\Authentication\LoginPasswordProvider;
use PHPCensor\Model\User;
use PHPCensor\Security\Authentication\LoginPasswordProvider;
/**
* Internal user provider.
* @author Adirelle <adirelle@gmail.com>
* Internal user provider
*
* @author Adirelle <adirelle@gmail.com>
*/
class Internal extends AbstractProvider implements LoginPasswordProvider
{