/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
case '1382':
case '1479':
case '1541':
case '1554':
case '1626':
return new Exception\SyntaxErrorException($message, $exception);
case '1044':
case '1045':
case '1046':
case '1049':
case '1095':
case '1142':
case '1143':
case '1227':
case '1370':
case '1429':
case '2002':
case '2005':
return new Exception\ConnectionException($message, $exception);
case '1048':
case '1121':
case '1138':
case '1171':
case '1252':
case '1263':
case '1364':
case '1566':
return new Exception\NotNullConstraintViolationException($message, $exception);
}
return new Exception\DriverException($message, $exception);
}
/**
* {@inheritdoc}
*
* @throws DBALException
*/
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php
* @return \Doctrine\DBAL\DBALException
*/
public static function driverException(Driver $driver, \Exception $driverEx)
{
return static::wrapException($driver, $driverEx, "An exception occurred in driver: " . $driverEx->getMessage());
}
/**
* @param \Doctrine\DBAL\Driver $driver
* @param \Exception $driverEx
*
* @return \Doctrine\DBAL\DBALException
*/
private static function wrapException(Driver $driver, \Exception $driverEx, $msg)
{
if ($driverEx instanceof Exception\DriverException) {
return $driverEx;
}
if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof Driver\DriverException) {
return $driver->convertException($msg, $driverEx);
}
return new self($msg, 0, $driverEx);
}
/**
* Returns a human-readable representation of an array of parameters.
* This properly handles binary data by returning a hex representation.
*
* @param array $params
*
* @return string
*/
private static function formatParameters(array $params)
{
return '[' . implode(', ', array_map(function ($param) {
if (is_resource($param)) {
return (string) $param;
}
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php
public static function driverExceptionDuringQuery(Driver $driver, \Exception $driverEx, $sql, array $params = [])
{
$msg = "An exception occurred while executing '".$sql."'";
if ($params) {
$msg .= " with params " . self::formatParameters($params);
}
$msg .= ":\n\n".$driverEx->getMessage();
return static::wrapException($driver, $driverEx, $msg);
}
/**
* @param \Doctrine\DBAL\Driver $driver
* @param \Exception $driverEx
*
* @return \Doctrine\DBAL\DBALException
*/
public static function driverException(Driver $driver, \Exception $driverEx)
{
return static::wrapException($driver, $driverEx, "An exception occurred in driver: " . $driverEx->getMessage());
}
/**
* @param \Doctrine\DBAL\Driver $driver
* @param \Exception $driverEx
*
* @return \Doctrine\DBAL\DBALException
*/
private static function wrapException(Driver $driver, \Exception $driverEx, $msg)
{
if ($driverEx instanceof Exception\DriverException) {
return $driverEx;
}
if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof Driver\DriverException) {
return $driver->convertException($msg, $driverEx);
}
return new self($msg, 0, $driverEx);
}
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php
* PDO MySql driver.
*
* @since 2.0
*/
class Driver extends AbstractMySQLDriver
{
/**
* {@inheritdoc}
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{
try {
$conn = new PDOConnection(
$this->constructPdoDsn($params),
$username,
$password,
$driverOptions
);
} catch (PDOException $e) {
throw DBALException::driverException($this, $e);
}
return $conn;
}
/**
* Constructs the MySql PDO DSN.
*
* @param array $params
*
* @return string The DSN.
*/
protected function constructPdoDsn(array $params)
{
$dsn = 'mysql:';
if (isset($params['host']) && $params['host'] != '') {
$dsn .= 'host=' . $params['host'] . ';';
}
if (isset($params['port'])) {
$dsn .= 'port=' . $params['port'] . ';';
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
* @since 2.0
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param array|null $options
*
* @throws PDOException in case of an error.
*/
public function __construct($dsn, $user = null, $password = null, array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Doctrine\DBAL\Driver\PDOStatement', []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function getServerVersion()
{
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
/**
* PDO implementation of the Connection interface.
* Used by all PDO-based drivers.
*
* @since 2.0
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param array|null $options
*
* @throws PDOException in case of an error.
*/
public function __construct($dsn, $user = null, $password = null, array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Doctrine\DBAL\Driver\PDOStatement', []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
/**
* PDO implementation of the Connection interface.
* Used by all PDO-based drivers.
*
* @since 2.0
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param array|null $options
*
* @throws PDOException in case of an error.
*/
public function __construct($dsn, $user = null, $password = null, array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Doctrine\DBAL\Driver\PDOStatement', []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Driver\PDOConnection;
use PDOException;
/**
* PDO MySql driver.
*
* @since 2.0
*/
class Driver extends AbstractMySQLDriver
{
/**
* {@inheritdoc}
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{
try {
$conn = new PDOConnection(
$this->constructPdoDsn($params),
$username,
$password,
$driverOptions
);
} catch (PDOException $e) {
throw DBALException::driverException($this, $e);
}
return $conn;
}
/**
* Constructs the MySql PDO DSN.
*
* @param array $params
*
* @return string The DSN.
*/
protected function constructPdoDsn(array $params)
{
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
return $this->_expr;
}
/**
* Establishes the connection with the database.
*
* @return bool TRUE if the connection was successfully established, FALSE if
* the connection is already open.
*/
public function connect()
{
if ($this->_isConnected) {
return false;
}
$driverOptions = $this->_params['driverOptions'] ?? [];
$user = $this->_params['user'] ?? null;
$password = $this->_params['password'] ?? null;
$this->_conn = $this->_driver->connect($this->_params, $user, $password, $driverOptions);
$this->_isConnected = true;
if (false === $this->autoCommit) {
$this->beginTransaction();
}
if ($this->_eventManager->hasListeners(Events::postConnect)) {
$eventArgs = new Event\ConnectionEventArgs($this);
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
}
return true;
}
/**
* Detects and sets the database platform.
*
* Evaluates custom platform class and version in order to set the correct platform.
*
* @throws DBALException if an invalid platform was specified for this connection.
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
* @return string|null
*
* @throws Exception
*/
private function getDatabasePlatformVersion()
{
// Driver does not support version specific platforms.
if ( ! $this->_driver instanceof VersionAwarePlatformDriver) {
return null;
}
// Explicit platform version requested (supersedes auto-detection).
if (isset($this->_params['serverVersion'])) {
return $this->_params['serverVersion'];
}
// If not connected, we need to connect now to determine the platform version.
if (null === $this->_conn) {
try {
$this->connect();
} catch (\Exception $originalException) {
if (empty($this->_params['dbname'])) {
throw $originalException;
}
// The database to connect to might not yet exist.
// Retry detection without database name connection parameter.
$databaseName = $this->_params['dbname'];
$this->_params['dbname'] = null;
try {
$this->connect();
} catch (\Exception $fallbackException) {
// Either the platform does not support database-less connections
// or something else went wrong.
// Reset connection parameters and rethrow the original exception.
$this->_params['dbname'] = $databaseName;
throw $originalException;
}
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
}
if ($this->_eventManager->hasListeners(Events::postConnect)) {
$eventArgs = new Event\ConnectionEventArgs($this);
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
}
return true;
}
/**
* Detects and sets the database platform.
*
* Evaluates custom platform class and version in order to set the correct platform.
*
* @throws DBALException if an invalid platform was specified for this connection.
*/
private function detectDatabasePlatform()
{
$version = $this->getDatabasePlatformVersion();
if ($version !== null) {
assert($this->_driver instanceof VersionAwarePlatformDriver);
$this->platform = $this->_driver->createDatabasePlatformForVersion($version);
} else {
$this->platform = $this->_driver->getDatabasePlatform();
}
$this->platform->setEventManager($this->_eventManager);
}
/**
* Returns the version of the related platform if applicable.
*
* Returns null if either the driver is not capable to create version
* specific platform instances, no explicit server version was specified
* or the underlying driver connection cannot determine the platform
* version without having to query it (performance reasons).
*
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
* Gets the EventManager used by the Connection.
*
* @return \Doctrine\Common\EventManager
*/
public function getEventManager()
{
return $this->_eventManager;
}
/**
* Gets the DatabasePlatform for the connection.
*
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
*
* @throws \Doctrine\DBAL\DBALException
*/
public function getDatabasePlatform()
{
if (null === $this->platform) {
$this->detectDatabasePlatform();
}
return $this->platform;
}
/**
* Gets the ExpressionBuilder for the connection.
*
* @return \Doctrine\DBAL\Query\Expression\ExpressionBuilder
*/
public function getExpressionBuilder()
{
return $this->_expr;
}
/**
* Establishes the connection with the database.
*
* @return bool TRUE if the connection was successfully established, FALSE if
* the connection is already open.
/var/www/u2564609/data/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
return $typeValues;
}
/**
* Quotes a string so it can be safely used as a table or column name, even if
* it is a reserved name.
*
* Delimiting style depends on the underlying database platform that is being used.
*
* NOTE: Just because you CAN use quoted identifiers does not mean
* you SHOULD use them. In general, they end up causing way more
* problems than they solve.
*
* @param string $str The name to be quoted.
*
* @return string The quoted name.
*/
public function quoteIdentifier($str)
{
return $this->getDatabasePlatform()->quoteIdentifier($str);
}
/**
* Quotes a given input parameter.
*
* @param mixed $input The parameter to be quoted.
* @param int|null $type The type of the parameter.
*
* @return string The quoted parameter.
*/
public function quote($input, $type = null)
{
$this->connect();
list($value, $bindingType) = $this->getBindingInfo($input, $type);
return $this->_conn->quote($value, $bindingType);
}
/**
/var/www/u2564609/data/www/vendor/phact-cmf/phact/src/Phact/Orm/QueryLayer.php
return $this->getQuery()->getQueryBuilder();
}
/**
* @return DBALQueryBuilder
*/
public function getQueryBuilder()
{
$qb = $this->getQueryBuilderRaw();
return $qb->from($this->quote($this->getTableName()));
}
public function quoteValue($value)
{
return $this->getQuery()->getConnection()->quote($value);
}
public function quote($value)
{
return $this->getQuery()->getConnection()->quoteIdentifier($value);
}
public function setAliases()
{
$this->_aliases = [];
$relations = $this->getQuerySet()->getRelations();
foreach ($relations as $relationName => $relation) {
if (isset($relation['joins']) && is_array($relation['joins'])) {
foreach ($relation['joins'] as $join) {
if (is_array($join) && isset($join['table'])) {
$tableName = $join['table'];
$this->setAlias($relationName, $tableName);
}
}
}
}
}
public function getAliases()
{
/var/www/u2564609/data/www/vendor/phact-cmf/phact/src/Phact/Orm/QueryLayer.php
/**
* @return string
*/
public function getTableName()
{
return $this->getModel()->getTableName();
}
public function getQueryBuilderRaw()
{
return $this->getQuery()->getQueryBuilder();
}
/**
* @return DBALQueryBuilder
*/
public function getQueryBuilder()
{
$qb = $this->getQueryBuilderRaw();
return $qb->from($this->quote($this->getTableName()));
}
public function quoteValue($value)
{
return $this->getQuery()->getConnection()->quote($value);
}
public function quote($value)
{
return $this->getQuery()->getConnection()->quoteIdentifier($value);
}
public function setAliases()
{
$this->_aliases = [];
$relations = $this->getQuerySet()->getRelations();
foreach ($relations as $relationName => $relation) {
if (isset($relation['joins']) && is_array($relation['joins'])) {
foreach ($relation['joins'] as $join) {
if (is_array($join) && isset($join['table'])) {
/var/www/u2564609/data/www/vendor/phact-cmf/phact/src/Phact/Orm/QueryLayer.php
if ($sql) {
return $this->getSQL($queryBuilder);
}
$result = $queryBuilder->execute()->fetchAll();
return $result;
}
public function rawAll($query, $bindings = [])
{
return $this->getQueryBuilder()->getConnection()->fetchAll($query, $bindings);
}
public function rawGet($query, $bindings = [])
{
return $this->getQueryBuilder()->getConnection()->fetchAssoc($query, $bindings);
}
public function get($sql = false)
{
$queryBuilder = $this->getQueryBuilder();
$qs = $this->getQuerySet();
$this->buildQuery($queryBuilder);
$select = $qs->getSelect();
list($select, $bindings) = $this->buildSelect($select);
$queryBuilder->select($select);
$this->addBindings($queryBuilder, $bindings);
if ($sql) {
return $this->getSQL($queryBuilder);
}
$result = $queryBuilder->execute()->fetch();
return $result;
}
public function defaultSelect()
{
$select = [];
/var/www/u2564609/data/www/vendor/phact-cmf/phact/src/Phact/Orm/QuerySet.php
return $data;
}
public function allSql()
{
return $this->getQueryLayer()->all(true);
}
public function rawAll($query, $params = [])
{
$data = $this->getQueryLayer()->rawAll($query, $params);
return $this->createModels($data);
}
/**
* @return null|Model
*/
public function get()
{
$row = $this->getQueryLayer()->get();
return $row ? $this->createModel($row) : null;
}
public function rawGet($query, $params = [])
{
$row = $this->getQueryLayer()->rawGet($query, $params);
return $row ? $this->createModel($row) : null;
}
public function getSql()
{
return $this->getQueryLayer()->get(true);
}
public function getAggregation()
{
return $this->_aggregation;
}
public function aggregate(Aggregation $aggregation)
/var/www/u2564609/data/www/vendor/phact-cmf/phact/src/Phact/Orm/Manager.php
]);
}
/**
* @return \Phact\Orm\QuerySet
* @throws \Phact\Exceptions\InvalidConfigException
*/
public function getQuerySet(): QuerySet
{
return $this->_querySet ?: $this->createQuerySet();
}
public function all()
{
return $this->getQuerySet()->all();
}
public function get()
{
return $this->getQuerySet()->get();
}
public function count()
{
return $this->getQuerySet()->count();
}
public function sum($attribute)
{
return $this->getQuerySet()->sum($attribute);
}
public function max($attribute)
{
return $this->getQuerySet()->max($attribute);
}
public function avg($attribute)
{
return $this->getQuerySet()->avg($attribute);
/var/www/u2564609/data/www/app/Modules/Redirect/RedirectModule.php
use Phact\Main\Phact;
use Phact\Module\Module;
use Modules\Admin\Traits\AdminTrait;
class RedirectModule extends Module implements AdminMenuInterface
{
use AdminTrait;
public function onApplicationRun()
{
parent::onApplicationRun();
if (Phact::app()->getIsWebMode()) {
$request = Phact::app()->request;
$path = urldecode($request->getUrl());
$pathTrimmed = rtrim($path, '/');
$redirect = Redirect::objects()->filter([
'from' => $path
])->limit(1)->get();
if ($redirect && $redirect->to) {
$request->redirect($redirect->to);
}
}
}
public function getVerboseName()
{
return 'Перенаправления';
}
}
/var/www/u2564609/data/www/vendor/phact-cmf/phact/src/Phact/Application/Application.php
* @throws Exception
*/
protected function eventTrigger($name, $params = array(), $sender = null, $callback = null)
{
if ($this->hasComponent(EventManager::class)) {
$eventManager = $this->getComponent(EventManager::class);
$eventManager->trigger($name, $params, $sender, $callback);
}
}
/**
* Call modules events
*
* @param $event
* @param array $args
*/
protected function provideModuleEvent($event, $args = [])
{
foreach ($this->getModules() as $name => $module) {
call_user_func_array([$module, $event], $args);
}
}
/**
* @param string $name
* @return LoggerInterface|null
*/
public function getLogger($name = 'default')
{
$name = "logger.{$name}";
if ($this->_container->has($name) && ($logger = $this->_container->get($name)) && ($logger instanceof LoggerInterface)) {
return $logger;
}
return null;
}
}
/var/www/u2564609/data/www/vendor/phact-cmf/phact/src/Phact/Application/Application.php
* @throws Exception
*/
protected function eventTrigger($name, $params = array(), $sender = null, $callback = null)
{
if ($this->hasComponent(EventManager::class)) {
$eventManager = $this->getComponent(EventManager::class);
$eventManager->trigger($name, $params, $sender, $callback);
}
}
/**
* Call modules events
*
* @param $event
* @param array $args
*/
protected function provideModuleEvent($event, $args = [])
{
foreach ($this->getModules() as $name => $module) {
call_user_func_array([$module, $event], $args);
}
}
/**
* @param string $name
* @return LoggerInterface|null
*/
public function getLogger($name = 'default')
{
$name = "logger.{$name}";
if ($this->_container->has($name) && ($logger = $this->_container->get($name)) && ($logger instanceof LoggerInterface)) {
return $logger;
}
return null;
}
}
/var/www/u2564609/data/www/vendor/phact-cmf/phact/src/Phact/Application/Application.php
}
}
}
/**
* Check or create system path
*
* @param $path
* @return bool
*/
protected function setUpPath($path): bool
{
return is_dir($path) || mkdir($path, 0755, true);
}
public function run()
{
$this->logDebug("Application run");
$this->eventTrigger("application.beforeRun", [], $this);
$this->provideModuleEvent('onApplicationRun');
register_shutdown_function([$this, 'end'], 0);
$this->logDebug("Start handling request");
$this->handleRequest();
$this->end();
}
public function end($status = 0, $response = null)
{
$this->eventTrigger("application.beforeEnd", [], $this);
$this->provideModuleEvent('onApplicationEnd', [$status, $response]);
exit($status);
}
public function handleRequest()
{
if ($this->getIsWebMode()) {
$this->handleWebRequest();
} else {
$this->handleCliRequest();
}
/var/www/u2564609/data/www/www/index.php
$configPath = __DIR__ . '/../app/config/settings.php';
$localConfigPath = __DIR__ . '/../app/config/local_settings.php';
$debug = false;
if (is_file($localConfigPath)) {
$configPath = $localConfigPath;
$debug = true;
}
if(isset($_SERVER['REMOTE_ADDR'])){
if($_SERVER['REMOTE_ADDR']=='92.204.184.204') $debug = true;
}
define("PHACT_DEBUG", $debug);
$config = include $configPath;
\Phact\Main\Phact::init($config);
\Phact\Main\Phact::app()->run();