From 2d0f04f389dc5e054255b6485daa4a1cc92a6837 Mon Sep 17 00:00:00 2001 From: Felipe Figueroa Date: Wed, 30 Dec 2020 08:01:04 -0300 Subject: refactor variables interpolated in string with sprintf --- .phive/phars.xml | 2 +- rector.php | 8 +- src/classes/ADONewConnection.php | 4 +- src/classes/ADORecordSet.php | 10 +- src/classes/ADOdbException.php | 49 +- src/classes/Connection.php | 37 +- src/classes/ContainerHandlers.php | 28 +- src/classes/ContainerUtils.php | 45 +- src/classes/Misc.php | 73 +-- src/classes/ViewManager.php | 151 +++-- src/controllers/AcinsertController.php | 36 +- src/controllers/AggregatesController.php | 223 +++++-- src/controllers/AlldbController.php | 131 ++++- src/controllers/BaseController.php | 76 ++- src/controllers/BrowserController.php | 3 +- src/controllers/ColpropertiesController.php | 76 ++- src/controllers/ConstraintsController.php | 202 +++++-- src/controllers/DatabaseController.php | 366 +++++++++--- src/controllers/DataexportController.php | 117 +++- src/controllers/DbexportController.php | 11 +- src/controllers/DisplayController.php | 315 +++++++--- src/controllers/DomainsController.php | 186 ++++-- src/controllers/FulltextController.php | 389 +++++++++--- src/controllers/FunctionsController.php | 490 +++++++++++---- src/controllers/GroupsController.php | 84 ++- src/controllers/HelpController.php | 22 +- src/controllers/HistoryController.php | 66 ++- src/controllers/IndexesController.php | 92 ++- src/controllers/InfoController.php | 255 ++++++-- src/controllers/IntroController.php | 16 +- src/controllers/LoginController.php | 5 +- .../MaterializedviewpropertiesController.php | 104 +++- src/controllers/MaterializedviewsController.php | 72 ++- src/controllers/OperatorsController.php | 96 ++- src/controllers/PrivilegesController.php | 116 +++- src/controllers/RolesController.php | 394 ++++++++++--- src/controllers/RulesController.php | 66 ++- src/controllers/SchemasController.php | 118 +++- src/controllers/SequencesController.php | 239 ++++++-- src/controllers/ServersController.php | 15 +- src/controllers/SqlController.php | 47 +- src/controllers/SqleditController.php | 38 +- src/controllers/TablesController.php | 477 ++++++++++++--- src/controllers/TablespacesController.php | 107 +++- src/controllers/TblpropertiesController.php | 255 ++++++-- src/controllers/TreeController.php | 40 +- src/controllers/TriggersController.php | 150 ++++- src/controllers/TypesController.php | 350 ++++++++--- src/controllers/UsersController.php | 165 +++++- src/controllers/ViewpropertiesController.php | 116 +++- src/controllers/ViewsController.php | 72 ++- src/database/ADOdbBase.php | 170 ++++-- src/database/Connection.php | 27 +- src/database/Postgres.php | 345 +++++++---- src/database/Postgres10.php | 19 +- src/database/Postgres11.php | 32 +- src/database/Postgres12.php | 4 +- src/database/Postgres13.php | 4 +- src/database/Postgres90.php | 4 +- src/database/Postgres91.php | 30 +- src/database/Postgres92.php | 31 +- src/database/Postgres93.php | 30 +- src/database/Postgres94.php | 4 +- src/database/Postgres95.php | 4 +- src/database/Postgres96.php | 35 +- src/database/databasetraits/AggregateTrait.php | 93 ++- src/database/databasetraits/ColumnTrait.php | 126 +++- src/database/databasetraits/DatabaseTrait.php | 183 ++++-- src/database/databasetraits/DomainTrait.php | 150 +++-- src/database/databasetraits/FtsTrait.php | 233 ++++++-- src/database/databasetraits/FunctionTrait.php | 122 +++- src/database/databasetraits/IndexTrait.php | 316 +++++++--- src/database/databasetraits/OperatorTrait.php | 47 +- src/database/databasetraits/PrivilegesTrait.php | 117 +++- src/database/databasetraits/RoleTrait.php | 228 +++++-- src/database/databasetraits/RowTrait.php | 72 ++- src/database/databasetraits/SchemaTrait.php | 57 +- src/database/databasetraits/SequenceTrait.php | 221 ++++--- src/database/databasetraits/StatsTrait.php | 51 +- src/database/databasetraits/TableTrait.php | 654 +++++++++++++++------ src/database/databasetraits/TablespaceTrait.php | 26 +- src/database/databasetraits/TriggerTrait.php | 46 +- src/database/databasetraits/TypeTrait.php | 99 ++-- src/database/databasetraits/ViewTrait.php | 70 +-- src/decorators/CallbackDecorator.php | 4 +- src/decorators/Decorator.php | 15 +- src/decorators/RedirectUrlDecorator.php | 4 +- src/help/PostgresDoc.php | 4 +- src/lib.inc.php | 20 +- src/middleware/Middleware.php | 4 +- src/middleware/PopulateRequestResponse.php | 17 +- src/traits/AdminTrait.php | 75 ++- 92 files changed, 7951 insertions(+), 2447 deletions(-) diff --git a/.phive/phars.xml b/.phive/phars.xml index 76e86e56..556fcde2 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -4,6 +4,6 @@ - + diff --git a/rector.php b/rector.php index 1a9c94b3..d6bc7ba4 100644 --- a/rector.php +++ b/rector.php @@ -18,7 +18,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $parameters->set(Option::AUTO_IMPORT_NAMES, true); - $parameters->set(Option::SETS, [ +/* $parameters->set(Option::SETS, [ SetList::CODING_STYLE, SetList::ACTION_INJECTION_TO_CONSTRUCTOR_INJECTION, SetList::ARRAY_STR_FUNCTIONS_TO_STATIC_CALL, @@ -31,7 +31,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { SetList::PHP_72, SetList::PHPUNIT_CODE_QUALITY, - ]); + ]);*/ // $parameters->set(Option::SKIP, [ @@ -54,8 +54,8 @@ return static function (ContainerConfigurator $containerConfigurator): void { $parameters->set(Option::ENABLE_CACHE, true); $parameters->set(Option::CACHE_DIR, __DIR__ . '/.build/rector'); $parameters->set(Option::PATHS, [ - __DIR__ . '/src/classes', - __DIR__ . '/src/controllers', + __DIR__ . '/src', + //__DIR__ . '/src/controllers', //__DIR__ . '/src/database', //__DIR__ . '/src/decorators', //__DIR__ . '/src/middleware', diff --git a/src/classes/ADONewConnection.php b/src/classes/ADONewConnection.php index 4df6f6fa..4534e17f 100644 --- a/src/classes/ADONewConnection.php +++ b/src/classes/ADONewConnection.php @@ -6,9 +6,11 @@ namespace PHPPgAdmin; +use ADODB_postgres9; + /** * Extends \ADODB_postgres9 to let correct inference on PHPDoc params. */ -class ADONewConnection extends \ADODB_postgres9 +class ADONewConnection extends ADODB_postgres9 { } diff --git a/src/classes/ADORecordSet.php b/src/classes/ADORecordSet.php index c18a02ff..feae209c 100644 --- a/src/classes/ADORecordSet.php +++ b/src/classes/ADORecordSet.php @@ -5,11 +5,15 @@ */ namespace PHPPgAdmin; + +use ADOFieldObject; use ADORecordSet as ADODBRecordsetClass; +use Countable; + /** * Extends ADORecordSet to let correct inference on PHPDoc params. */ -class ADORecordSet extends ADODBRecordsetClass implements \Countable +class ADORecordSet extends ADODBRecordsetClass implements Countable { /** * Returns the recordCount. @@ -34,9 +38,9 @@ class ADORecordSet extends ADODBRecordsetClass implements \Countable * * @param int $fieldoffset * - * @return \ADOFieldObject the field + * @return ADOFieldObject the field */ - public function fetchField($fieldoffset = -1): \ADOFieldObject + public function fetchField($fieldoffset = -1): ADOFieldObject { return parent::fetchField(); } diff --git a/src/classes/ADOdbException.php b/src/classes/ADOdbException.php index cb405343..3dbe8418 100644 --- a/src/classes/ADOdbException.php +++ b/src/classes/ADOdbException.php @@ -6,11 +6,12 @@ namespace PHPPgAdmin; +use Exception; + /** * @file * Handles Exceptions on ADODb */ - /** * Released under both BSD-3-CLAUSE license and GPL-2.0-OR-LATER. Whenever * there is any discrepancy between the two licenses, the BSD license will take @@ -25,7 +26,7 @@ namespace PHPPgAdmin; * * @version Release: 5.20.9 */ -class ADOdbException extends \Exception +class ADOdbException extends Exception { public $dbms; @@ -72,7 +73,7 @@ class ADOdbException extends \Exception * @param string $p2 parameter 2 * @param mixed $thisConnection connection * - * @throws \Exception + * @throws Exception */ public function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) { @@ -80,18 +81,42 @@ class ADOdbException extends \Exception case 'EXECUTE': $this->sql = \is_array($p1) ? $p1[0] : $p1; $this->params = $p2; - $s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}(\"{$this->sql}\")"; + $s = \sprintf( + '%s error: [%s: %s] in %s("%s")', + $dbms, + $errno, + $errmsg, + $fn, + $this->sql + ); break; case 'PCONNECT': case 'CONNECT': $user = $thisConnection->user; - $s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}({$p1}, '{$user}', '****', {$p2})"; + $s = \sprintf( + '%s error: [%s: %s] in %s(%s, \'%s\', \'****\', %s)', + $dbms, + $errno, + $errmsg, + $fn, + $p1, + $user, + $p2 + ); break; default: - $s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}({$p1}, {$p2})"; + $s = \sprintf( + '%s error: [%s: %s] in %s(%s, %s)', + $dbms, + $errno, + $errmsg, + $fn, + $p1, + $p2 + ); break; } @@ -143,16 +168,20 @@ class ADOdbException extends \Exception 'spacer' => ' ', 'line' => $backtrace[0]['line'], ]; - $errmsg = \htmlentities(\PHPPgAdmin\ContainerUtils::br2ln($errmsg), \ENT_NOQUOTES); - $p1 = \htmlentities(\PHPPgAdmin\ContainerUtils::br2ln($p1), \ENT_NOQUOTES); - $p2 = \htmlentities(\PHPPgAdmin\ContainerUtils::br2ln($p2), \ENT_NOQUOTES); + $errmsg = \htmlentities(ContainerUtils::br2ln($errmsg), \ENT_NOQUOTES); + $p1 = \htmlentities(ContainerUtils::br2ln($p1), \ENT_NOQUOTES); + $p2 = \htmlentities(ContainerUtils::br2ln($p2), \ENT_NOQUOTES); $tag = \implode('', $btarray0); //\PC::debug(['errno' => $errno, 'fn' => $fn, 'errmsg' => $errmsg], $tag); $adoException = new self($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); - echo "{$adoException->msg}\n"; + echo \sprintf( + '%s +', + $adoException->msg + ); // adodb_backtrace($adoException->getTrace()); throw $adoException; diff --git a/src/classes/Connection.php b/src/classes/Connection.php index 2adeb303..a27a1470 100644 --- a/src/classes/Connection.php +++ b/src/classes/Connection.php @@ -6,6 +6,10 @@ namespace PHPPgAdmin; +use ADODB_pdo; +use ADODB_postgres9; +use PHPPgAdmin\Traits\HelperTrait; + /** * @file * Class to represent a database connection @@ -14,7 +18,7 @@ namespace PHPPgAdmin; */ class Connection { - use \PHPPgAdmin\Traits\HelperTrait; + use HelperTrait; public $conn; @@ -62,10 +66,10 @@ class Connection /** * Creates a new connection. Will actually make a database connection. * - * @param array $server_info - * @param string $database database name - * @param \PHPPgAdmin\ContainerUtils $container - * @param int $fetchMode Defaults to associative. Override for different behaviour + * @param array $server_info + * @param string $database database name + * @param ContainerUtils $container + * @param int $fetchMode Defaults to associative. Override for different behaviour */ public function __construct($server_info, $database, $container, $fetchMode = ADODB_FETCH_ASSOC) { @@ -107,7 +111,10 @@ class Connection $serverInfo = $this->conn->ServerInfo(); dump($serverInfo); $this->pgVersion = $serverInfo['version']; - $description = "PostgreSQL {$this->pgVersion}"; + $description = \sprintf( + 'PostgreSQL %s', + $this->pgVersion + ); $version_parts = \explode('.', $this->pgVersion); @@ -153,7 +160,7 @@ class Connection ?string $user, ?string $password, int $fetchMode = \ADODB_FETCH_ASSOC - ): \ADODB_postgres9 { + ): ADODB_postgres9 { $this->conn = ADONewConnection('postgres9'); $this->conn->setFetchMode($fetchMode); // Ignore host if null @@ -164,7 +171,11 @@ class Connection $pghost = ''; } } else { - $pghost = "{$host}:{$port}"; + $pghost = \sprintf( + '%s:%s', + $host, + $port + ); } // Add sslmode to $pghost as needed @@ -189,10 +200,16 @@ class Connection ?string $user, ?string $password, int $fetchMode = \ADODB_FETCH_ASSOC - ): \ADODB_pdo { + ): ADODB_pdo { $this->conn = ADONewConnection('pdo'); $this->conn->setFetchMode($fetchMode); - $dsnString = \sprintf('pgsql:host=%s;port=%d;dbname=%s;sslmode=%s;application_name=PHPPgAdmin6', $host, $port, $database, $sslmode); + $dsnString = \sprintf( + 'pgsql:host=%s;port=%d;dbname=%s;sslmode=%s;application_name=PHPPgAdmin6', + $host, + $port, + $database, + $sslmode + ); $this->conn->connect($dsnString, $user, $password); return $this->conn; diff --git a/src/classes/ContainerHandlers.php b/src/classes/ContainerHandlers.php index 9cc5cb1a..0b5bebf5 100644 --- a/src/classes/ContainerHandlers.php +++ b/src/classes/ContainerHandlers.php @@ -6,6 +6,8 @@ namespace PHPPgAdmin; +use Slim\Flash\Messages; + /** * Auxiliary class to handle injection of dependencies to avoid * declaring them in the container class. @@ -13,14 +15,14 @@ namespace PHPPgAdmin; class ContainerHandlers { /** - * @var \PHPPgAdmin\ContainerUtils + * @var ContainerUtils * */ private $container; /** - * @param \PHPPgAdmin\ContainerUtils $container + * @param ContainerUtils $container */ - public function __construct(\PHPPgAdmin\ContainerUtils $container) + public function __construct(ContainerUtils $container) { $this->container = $container; } @@ -46,9 +48,9 @@ class ContainerHandlers $container = $this->container; /** - * @return \PHPPgAdmin\ViewManager + * @return ViewManager */ - $container['view'] = static function (\PHPPgAdmin\ContainerUtils $c): \PHPPgAdmin\ViewManager { + $container['view'] = static function (ContainerUtils $c): ViewManager { $misc = $c->misc; $view = new ViewManager(BASE_PATH . '/assets/templates', [ 'cache' => BASE_PATH . '/temp/twigcache', @@ -73,10 +75,10 @@ class ContainerHandlers { $container = $this->container; /** - * @return \PHPPgAdmin\Misc + * @return Misc */ - $container['misc'] = static function (\PHPPgAdmin\ContainerUtils $c): \PHPPgAdmin\Misc { - $misc = new \PHPPgAdmin\Misc($c); + $container['misc'] = static function (ContainerUtils $c): Misc { + $misc = new Misc($c); $conf = $c->get('conf'); @@ -97,12 +99,12 @@ class ContainerHandlers public function setExtra(): self { $container = $this->container; - $container['flash'] = static function (): \Slim\Flash\Messages { - return new \Slim\Flash\Messages(); + $container['flash'] = static function (): Messages { + return new Messages(); }; - $container['lang'] = static function (\PHPPgAdmin\ContainerUtils $c): array { - $translations = new \PHPPgAdmin\Translations($c); + $container['lang'] = static function (ContainerUtils $c): array { + $translations = new Translations($c); return $translations->lang; }; @@ -112,7 +114,7 @@ class ContainerHandlers public function setHaltHandler(): self { - $this->container['haltHandler'] = static function (\PHPPgAdmin\ContainerUtils $c) { + $this->container['haltHandler'] = static function (ContainerUtils $c) { return static function ($request, $response, $exits, $status = 500) { $title = 'PHPPgAdmin Error'; diff --git a/src/classes/ContainerUtils.php b/src/classes/ContainerUtils.php index fd719cef..85db5c55 100644 --- a/src/classes/ContainerUtils.php +++ b/src/classes/ContainerUtils.php @@ -6,18 +6,26 @@ namespace PHPPgAdmin; +use ArrayAccess; +use PHPPgAdmin\Decorators\Decorator; +use PHPPgAdmin\Traits\HelperTrait; use Psr\Container\ContainerInterface; +use Slim\App; use Slim\Collection; +use Slim\Container; use Slim\DefaultServicesProvider; +use Slim\Flash\Messages; +use Slim\Http\Request; +use Slim\Http\Response; /** * @property array $deploy_info - * @property \Slim\Flash\Messages $flash + * @property Messages $flash * @property \GuzzleHttp\Client $fcIntranetClient - * @property \PHPPgAdmin\Misc $misc - * @property \PHPPgAdmin\ViewManager $view - * @property \Slim\Http\Request $request - * @property \Slim\Http\Response $response + * @property Misc $misc + * @property ViewManager $view + * @property Request $request + * @property Response $response * @property string $BASE_PATH * @property string $THEME_PATH * @property string $subFolder @@ -29,9 +37,9 @@ use Slim\DefaultServicesProvider; * * @method mixed get(string) */ -class ContainerUtils extends \Slim\Container implements ContainerInterface +class ContainerUtils extends Container implements ContainerInterface { - use \PHPPgAdmin\Traits\HelperTrait; + use HelperTrait; /** * @var null|self @@ -41,7 +49,7 @@ class ContainerUtils extends \Slim\Container implements ContainerInterface /** * $appInstance. * - * @var null|\Slim\App + * @var null|App */ private static $appInstance; @@ -97,14 +105,14 @@ class ContainerUtils extends \Slim\Container implements ContainerInterface return \implode(\DIRECTORY_SEPARATOR, [$this->subFolder, $path]); } - public static function getAppInstance(array $config = []): \Slim\App + public static function getAppInstance(array $config = []): App { $config = \array_merge(self::getDefaultConfig($config['debugmode'] ?? false), $config); $container = self::getContainerInstance($config); if (!self::$appInstance) { - self::$appInstance = new \Slim\App($container); + self::$appInstance = new App($container); } return self::$appInstance; @@ -222,15 +230,18 @@ class ContainerUtils extends \Slim\Container implements ContainerInterface foreach ($url['urlvars'] as $key => $urlvar) { //$this->prtrace($key, $urlvar); - $urlvars[$key] = \PHPPgAdmin\Decorators\Decorator::get_sanitized_value($urlvar, $_REQUEST); + $urlvars[$key] = Decorator::get_sanitized_value($urlvar, $_REQUEST); } $_REQUEST = \array_merge($_REQUEST, $urlvars); $_GET = \array_merge($_GET, $urlvars); } - $actionurl = \PHPPgAdmin\Decorators\Decorator::actionurl($url['url'], $_GET); + $actionurl = Decorator::actionurl($url['url'], $_GET); $destinationurl = $actionurl->value($_GET); - return \str_replace('views/?', "views/{$subject}?", $destinationurl); + return \str_replace('views/?', \sprintf( + 'views/%s?', + $subject + ), $destinationurl); } /** @@ -238,9 +249,9 @@ class ContainerUtils extends \Slim\Container implements ContainerInterface * * @param string $errormsg The error msg * - * @return\Slim\Container The app container + * @return Container The app container */ - public function addError(string $errormsg): \Slim\Container + public function addError(string $errormsg): Container { $container = self::getContainerInstance(); $errors = $container->get('errors'); @@ -291,7 +302,7 @@ class ContainerUtils extends \Slim\Container implements ContainerInterface $container->THEME_PATH = $conf['theme_path']; $container->IN_TEST = $conf['IN_TEST']; $container['errors'] = []; - $container['conf'] = static function (\Slim\Container $c) use ($conf): array { + $container['conf'] = static function (Container $c) use ($conf): array { $display_sizes = $conf['display_sizes']; if (\is_array($display_sizes)) { @@ -352,7 +363,7 @@ class ContainerUtils extends \Slim\Container implements ContainerInterface * * @return array|ArrayAccess */ - $this['settings'] = static function () use ($userSettings, $defaultSettings): \Slim\Collection { + $this['settings'] = static function () use ($userSettings, $defaultSettings): Collection { return new Collection(\array_merge($defaultSettings, $userSettings)); }; diff --git a/src/classes/Misc.php b/src/classes/Misc.php index 218d005a..71fbbb48 100644 --- a/src/classes/Misc.php +++ b/src/classes/Misc.php @@ -6,7 +6,10 @@ namespace PHPPgAdmin; +use Exception; use PHPPgAdmin\Database\Postgres; +use PHPPgAdmin\Traits\HelperTrait; +use PHPPgAdmin\Traits\MiscTrait; /** * @file @@ -22,8 +25,8 @@ use PHPPgAdmin\Database\Postgres; */ class Misc { - use \PHPPgAdmin\Traits\HelperTrait; - use \PHPPgAdmin\Traits\MiscTrait; + use HelperTrait; + use MiscTrait; /** * @var array @@ -68,17 +71,17 @@ class Misc public $postgresqlMinVer; /** - * @var \PHPPgAdmin\ViewManager + * @var ViewManager */ public $view; /** - * @var \PHPPgAdmin\ContainerUtils + * @var ContainerUtils */ protected $container; /** - * @var null|\PHPPgAdmin\Connection + * @var null|Connection */ private $_connection; @@ -113,9 +116,9 @@ class Misc private $_error_msg = ''; /** - * @param \PHPPgAdmin\ContainerUtils $container The container + * @param ContainerUtils $container The container */ - public function __construct(\PHPPgAdmin\ContainerUtils $container) + public function __construct(ContainerUtils $container) { $this->container = $container; @@ -145,7 +148,10 @@ class Misc // Check the version of PHP if (\version_compare(\PHP_VERSION, $this->phpMinVer, '<')) { - $container->addError(\sprintf('Version of PHP not supported. Please upgrade to version %s or later.', $this->phpMinVer)); + $container->addError(\sprintf( + 'Version of PHP not supported. Please upgrade to version %s or later.', + $this->phpMinVer + )); } //$this->dumpAndDie($this->); @@ -232,18 +238,18 @@ class Misc /** * Sets the view instance property of this class. * - * @param \PHPPgAdmin\ViewManager $view view instance + * @param ViewManager $view view instance * * @return \PHPPgAdmin\Misc this class instance */ - public function setView(\PHPPgAdmin\ViewManager $view) + public function setView(ViewManager $view) { $this->view = $view; return $this; } - public function getContainer(): \PHPPgAdmin\ContainerUtils + public function getContainer(): ContainerUtils { return $this->container; } @@ -304,7 +310,7 @@ class Misc * * @internal mixed $plaform placeholder that will receive the value of the platform * - * @return null|\PHPPgAdmin\Database\Postgres|void the database accessor instance + * @return null|Postgres|void the database accessor instance */ public function getDatabaseAccessor($database = '', $server_id = null) { @@ -323,7 +329,7 @@ class Misc if (null === $this->_data) { try { $_connection = $this->getConnection($database, $this->_server_id); - } catch (\Exception $e) { + } catch (Exception $e) { $this->setServerInfo(null, null, $this->_server_id); $this->setNoDBConnection(true); $this->setErrorMsg($e->getMessage()); @@ -343,14 +349,17 @@ class Misc $_type = $_connection->getDriver($platform); if (null === $_type ?? null) { - $errormsg = \sprintf($lang['strpostgresqlversionnotsupported'], $this->postgresqlMinVer); + $errormsg = \sprintf( + $lang['strpostgresqlversionnotsupported'], + $this->postgresqlMinVer + ); $this->container->addError($errormsg); $this->setErrorMsg($errormsg); return null; } /** - * @var \class-string<\PHPPgAdmin\Database\Postgres> + * @var \class-string */ $_type = '\\PHPPgAdmin\\Database\\' . $_type; @@ -373,8 +382,7 @@ class Misc } } - if ( - false !== $this->getNoDBConnection() || + if (false !== $this->getNoDBConnection() || null === $this->getDatabase() || !isset($_REQUEST['schema']) ) { @@ -397,9 +405,9 @@ class Misc * @param string $database * @param string $server_id * - * @return null|\PHPPgAdmin\Connection + * @return null|Connection */ - public function getConnection(string $database = '', $server_id = null): ?\PHPPgAdmin\Connection + public function getConnection(string $database = '', $server_id = null): ?Connection { $lang = $this->lang; @@ -421,34 +429,32 @@ class Misc 'administrator' => 'administrator', ]; - if ( - isset($server_info['username']) && + if (isset($server_info['username']) && \array_key_exists(\mb_strtolower($server_info['username']), $bad_usernames) ) { $msg = $lang['strlogindisallowed']; - throw new \Exception($msg); + throw new Exception($msg); } - if ( - !isset($server_info['password']) || + if (!isset($server_info['password']) || '' === $server_info['password'] ) { $msg = $lang['strlogindisallowed']; - throw new \Exception($msg); + throw new Exception($msg); } } try { // Create the connection object and make the connection - $this->_connection = new \PHPPgAdmin\Connection( + $this->_connection = new Connection( $server_info, $database_to_use, $this->container ); - } catch (\PHPPgAdmin\ADOdbException $e) { - throw new \Exception($lang['strloginfailed']); + } catch (ADOdbException $e) { + throw new Exception($lang['strloginfailed']); } } @@ -483,8 +489,7 @@ class Misc $server_string = $info['host'] . ':' . $info['port'] . ':' . $info['sslmode']; $server_sha = \sha1($server_string); - if ( - $this->_server_id === $server_string || + if ($this->_server_id === $server_string || $this->_server_id === $server_sha ) { if (isset($info['username'])) { @@ -552,8 +557,7 @@ class Misc $server_info = $this->getServerInfo($this->_server_id); - if ( - null !== $this->_server_id && + if (null !== $this->_server_id && isset($server_info['useonlydefaultdb']) && true === $server_info['useonlydefaultdb'] && isset($server_info['defaultdb']) @@ -803,7 +807,10 @@ class Misc $server = $this->container->server ? $this->container->server : $_REQUEST['server']; $database = $this->container->database ? $this->container->database : $_REQUEST['database']; - $_SESSION['history'][$server][$database]["{$time}"] = [ + $_SESSION['history'][$server][$database][\sprintf( + '%s', + $time + )] = [ 'query' => $script, 'paginate' => !isset($_REQUEST['paginate']) ? 'f' : 't', 'queryid' => $time, diff --git a/src/classes/ViewManager.php b/src/classes/ViewManager.php index 4b906c05..e78a646c 100644 --- a/src/classes/ViewManager.php +++ b/src/classes/ViewManager.php @@ -6,21 +6,26 @@ namespace PHPPgAdmin; +use PHPPgAdmin\Traits\HelperTrait; +use Psr\Http\Message\ResponseInterface; +use Slim\Http\Response; +use Slim\Views\Twig; +use Slim\Views\TwigExtension; + /** * @file * Class to hold various commonly used functions * * Id: Misc.php,v 1.171 2008/03/17 21:35:48 ioguix Exp $ */ - /** * Class to hold various commonly used functions. * * Release: Misc.php,v 1.171 2008/03/17 21:35:48 ioguix Exp $ */ -class ViewManager extends \Slim\Views\Twig +class ViewManager extends Twig { - use \PHPPgAdmin\Traits\HelperTrait; + use HelperTrait; /** * @var array @@ -70,12 +75,12 @@ class ViewManager extends \Slim\Views\Twig public $postgresqlMinVer; /** - * @var \PHPPgAdmin\Misc + * @var Misc */ public $misc; /** - * @var \PHPPgAdmin\ContainerUtils + * @var ContainerUtils */ protected $container; @@ -122,11 +127,11 @@ class ViewManager extends \Slim\Views\Twig private static $instance; /** - * @param mixed $path - * @param mixed $settings - * @param \PHPPgAdmin\ContainerUtils $c + * @param mixed $path + * @param mixed $settings + * @param ContainerUtils $c */ - public function __construct($path, $settings, \PHPPgAdmin\ContainerUtils $c) + public function __construct($path, $settings, ContainerUtils $c) { $this->lang = $c->get('lang'); $this->conf = $c->get('conf'); @@ -139,7 +144,7 @@ class ViewManager extends \Slim\Views\Twig // Instantiate and add Slim specific extension $basePath = \rtrim(\str_ireplace($base_script_trailing_str, '', $request_basepath), '/'); - $this->addExtension(new \Slim\Views\TwigExtension($c['router'], $basePath)); + $this->addExtension(new TwigExtension($c['router'], $basePath)); $this->offsetSet('subfolder', \containerInstance()->subFolder); $this->offsetSet('theme', $this->misc->getConf('theme')); @@ -194,7 +199,7 @@ class ViewManager extends \Slim\Views\Twig return $this->_reload_browser; } - public function maybeRenderIframes(\Slim\Http\Response $response, string $subject, string $query_string): \Psr\Http\Message\ResponseInterface + public function maybeRenderIframes(Response $response, string $subject, string $query_string): ResponseInterface { $c = $this->getContainer(); @@ -234,8 +239,7 @@ class ViewManager extends \Slim\Views\Twig // Check if theme is in $_REQUEST, $_SESSION or $_COOKIE // 1.- First priority: $_REQUEST, this happens when you use the selector - if ( - \array_key_exists('theme', $_REQUEST) && + if (\array_key_exists('theme', $_REQUEST) && \array_key_exists($_REQUEST['theme'], $themefolders) ) { $_theme = $_REQUEST['theme']; @@ -246,14 +250,12 @@ class ViewManager extends \Slim\Views\Twig \array_key_exists($_COOKIE['ppaTheme'], $themefolders) ) { $_theme = $_server_info['theme']; - } elseif ( - isset($_SESSION) && \array_key_exists('ppaTheme', $_SESSION) && + } elseif (isset($_SESSION) && \array_key_exists('ppaTheme', $_SESSION) && \array_key_exists($_SESSION['ppaTheme'], $themefolders) ) { // otherwise check $_SESSION $_theme = $_SESSION['ppaTheme']; - } elseif ( - \array_key_exists('ppaTheme', $_COOKIE) && + } elseif (\array_key_exists('ppaTheme', $_COOKIE) && \array_key_exists($_COOKIE['ppaTheme'], $themefolders) ) { // oterwise check $_COOKIE @@ -356,30 +358,100 @@ class ViewManager extends \Slim\Views\Twig $theme = $this->conf['theme']; $path = 'assets/images/themes'; - $default_icon = \sprintf('%s/%s/default/DisconnectedServer.png', \containerInstance()->subFolder, $path); + $default_icon = \sprintf( + '%s/%s/default/DisconnectedServer.png', + \containerInstance()->subFolder, + $path + ); - if (\is_readable(\sprintf('%s/%s/%s/%s.png', \containerInstance()->BASE_PATH, $path, $theme, $icon))) { - return \sprintf('%s/%s/%s/%s.png', \containerInstance()->subFolder, $path, $theme, $icon); + if (\is_readable(\sprintf( + '%s/%s/%s/%s.png', + \containerInstance()->BASE_PATH, + $path, + $theme, + $icon + ))) { + return \sprintf( + '%s/%s/%s/%s.png', + \containerInstance()->subFolder, + $path, + $theme, + $icon + ); } - if (\is_readable(\sprintf('%s/%s/%s/%s.gif', \containerInstance()->BASE_PATH, $path, $theme, $icon))) { - return \sprintf('%s/%s/%s/%s.gif', \containerInstance()->subFolder, $path, $theme, $icon); + if (\is_readable(\sprintf( + '%s/%s/%s/%s.gif', + \containerInstance()->BASE_PATH, + $path, + $theme, + $icon + ))) { + return \sprintf( + '%s/%s/%s/%s.gif', + \containerInstance()->subFolder, + $path, + $theme, + $icon + ); } - if (\is_readable(\sprintf('%s/%s/%s/%s.ico', \containerInstance()->BASE_PATH, $path, $theme, $icon))) { - return \sprintf('%s/%s/%s/%s.ico', \containerInstance()->subFolder, $path, $theme, $icon); + if (\is_readable(\sprintf( + '%s/%s/%s/%s.ico', + \containerInstance()->BASE_PATH, + $path, + $theme, + $icon + ))) { + return \sprintf( + '%s/%s/%s/%s.ico', + \containerInstance()->subFolder, + $path, + $theme, + $icon + ); } - if (\is_readable(\sprintf('%s/%s/default/%s.png', \containerInstance()->BASE_PATH, $path, $icon))) { - return \sprintf('%s/%s/default/%s.png', \containerInstance()->subFolder, $path, $icon); + if (\is_readable(\sprintf( + '%s/%s/default/%s.png', + \containerInstance()->BASE_PATH, + $path, + $icon + ))) { + return \sprintf( + '%s/%s/default/%s.png', + \containerInstance()->subFolder, + $path, + $icon + ); } - if (\is_readable(\sprintf('%s/%s/default/%s.gif', \containerInstance()->BASE_PATH, $path, $icon))) { - return \sprintf('%s/%s/default/%s.gif', \containerInstance()->subFolder, $path, $icon); + if (\is_readable(\sprintf( + '%s/%s/default/%s.gif', + \containerInstance()->BASE_PATH, + $path, + $icon + ))) { + return \sprintf( + '%s/%s/default/%s.gif', + \containerInstance()->subFolder, + $path, + $icon + ); } - if (\is_readable(\sprintf('%s/%s/default/%s.ico', \containerInstance()->BASE_PATH, $path, $icon))) { - return \sprintf('%s/%s/default/%s.ico', \containerInstance()->subFolder, $path, $icon); + if (\is_readable(\sprintf( + '%s/%s/default/%s.ico', + \containerInstance()->BASE_PATH, + $path, + $icon + ))) { + return \sprintf( + '%s/%s/default/%s.ico', + \containerInstance()->subFolder, + $path, + $icon + ); } return $default_icon; @@ -439,7 +511,7 @@ class ViewManager extends \Slim\Views\Twig return '\PHPPgAdmin\Controller\\' . \ucfirst($subject) . 'Controller'; } - private function getContainer(): \PHPPgAdmin\ContainerUtils + private function getContainer(): ContainerUtils { return $this->container; } @@ -469,11 +541,20 @@ class ViewManager extends \Slim\Views\Twig continue; } - $folderpath = \sprintf('%s%s%s', \containerInstance()->THEME_PATH, \DIRECTORY_SEPARATOR, $foldername); - $stylesheet = \sprintf('%s%s%s', $folderpath, \DIRECTORY_SEPARATOR, 'global.css'); + $folderpath = \sprintf( + '%s%s%s', + \containerInstance()->THEME_PATH, + \DIRECTORY_SEPARATOR, + $foldername + ); + $stylesheet = \sprintf( + '%s%s%s', + $folderpath, + \DIRECTORY_SEPARATOR, + 'global.css' + ); // if $folderpath if indeed a folder and contains a global.css file, then it's a theme - if ( - \is_dir($folderpath) && + if (\is_dir($folderpath) && \is_file($stylesheet) ) { $themefolders[$foldername] = $folderpath; diff --git a/src/controllers/AcinsertController.php b/src/controllers/AcinsertController.php index e687ceb1..7194e380 100644 --- a/src/controllers/AcinsertController.php +++ b/src/controllers/AcinsertController.php @@ -19,7 +19,10 @@ class AcinsertController extends BaseController $data = $this->misc->getDatabaseAccessor(); if (isset($_POST['offset'])) { - $offset = " OFFSET {$_POST['offset']}"; + $offset = \sprintf( + ' OFFSET %s', + $_POST['offset'] + ); } else { $_POST['offset'] = 0; $offset = ' OFFSET 0'; @@ -40,10 +43,18 @@ class AcinsertController extends BaseController $f_attname = $fkeynames[$_POST['fattpos'][0]]; $data->fieldClean($f_attname); - $q = "SELECT * - FROM \"{$f_schema}\".\"{$f_table}\" - WHERE \"{$f_attname}\"::text LIKE '{$_POST['fvalue']}%' - ORDER BY \"{$f_attname}\" LIMIT 12 {$offset};"; + $q = \sprintf( + 'SELECT * + FROM "%s"."%s" + WHERE "%s"::text LIKE \'%s%\' + ORDER BY "%s" LIMIT 12 %s;', + $f_schema, + $f_table, + $f_attname, + $_POST['fvalue'], + $f_attname, + $offset + ); $res = $data->selectSet($q); @@ -71,7 +82,10 @@ class AcinsertController extends BaseController $finfo = $res->fetchField($j++); if (\in_array($n, $fkeynames, true)) { - echo "", + echo \sprintf( + '', + $keyspos[$n] + ), $this->misc->printVal($v, $finfo->type, ['clip' => 'collapsed']), ''; } else { @@ -104,7 +118,15 @@ class AcinsertController extends BaseController echo $js . ''; } else { - \printf("{$this->lang['strnofkref']}", "\"{$_POST['f_schema']}\".\"{$_POST['f_table']}\".\"{$fkeynames[$_POST['fattpos']]}\""); + \printf(\sprintf( + '%s', + $this->lang['strnofkref'] + ), \sprintf( + '"%s"."%s"."%s"', + $_POST['f_schema'], + $_POST['f_table'], + $fkeynames[$_POST['fattpos']] + )); if ($_POST['offset']) { echo 'Prev <<'; diff --git a/src/controllers/AggregatesController.php b/src/controllers/AggregatesController.php index 384152f7..aca33ca1 100644 --- a/src/controllers/AggregatesController.php +++ b/src/controllers/AggregatesController.php @@ -101,7 +101,10 @@ class AggregatesController extends BaseController 'aggrname' => [ 'title' => $this->lang['strname'], 'field' => Decorator::field('proname'), - 'url' => "redirect.php?subject=aggregate&action=properties&{$this->misc->href}&", + 'url' => \sprintf( + 'redirect.php?subject=aggregate&action=properties&%s&', + $this->misc->href + ), 'vars' => ['aggrname' => 'proname', 'aggrtype' => 'proargtypes'], ], 'aggrtype' => [ @@ -278,36 +281,96 @@ class AggregatesController extends BaseController echo '' . \PHP_EOL; echo '' . \PHP_EOL; - echo "\t\n\t\t{$this->lang['strname']}" . \PHP_EOL; - echo "\t\tdata->_maxNameLen}\" value=\"", + echo \sprintf( + ' + %s', + $this->lang['strname'] + ) . \PHP_EOL; + echo \sprintf( + ' \n\t" . \PHP_EOL; - echo "\t\n\t\t{$this->lang['straggrbasetype']}" . \PHP_EOL; - echo "\t\tdata->_maxNameLen}\" value=\"", + echo \sprintf( + ' + %s', + $this->lang['straggrbasetype'] + ) . \PHP_EOL; + echo \sprintf( + ' \n\t" . \PHP_EOL; - echo "\t\n\t\t{$this->lang['straggrsfunc']}" . \PHP_EOL; - echo "\t\tdata->_maxNameLen}\" value=\"", + echo \sprintf( + ' + %s', + $this->lang['straggrsfunc'] + ) . \PHP_EOL; + echo \sprintf( + ' \n\t" . \PHP_EOL; - echo "\t\n\t\t{$this->lang['straggrstype']}" . \PHP_EOL; - echo "\t\tdata->_maxNameLen}\" value=\"", + echo \sprintf( + ' + %s', + $this->lang['straggrstype'] + ) . \PHP_EOL; + echo \sprintf( + ' \n\t" . \PHP_EOL; - echo "\t\n\t\t{$this->lang['straggrffunc']}" . \PHP_EOL; - echo "\t\tdata->_maxNameLen}\" value=\"", + echo \sprintf( + ' + %s', + $this->lang['straggrffunc'] + ) . \PHP_EOL; + echo \sprintf( + ' \n\t" . \PHP_EOL; - echo "\t\n\t\t{$this->lang['straggrinitcond']}" . \PHP_EOL; - echo "\t\tdata->_maxNameLen}\" value=\"", + echo \sprintf( + ' + %s', + $this->lang['straggrinitcond'] + ) . \PHP_EOL; + echo \sprintf( + ' \n\t" . \PHP_EOL; - echo "\t\n\t\t{$this->lang['straggrsortop']}" . \PHP_EOL; - echo "\t\tdata->_maxNameLen}\" value=\"", + echo \sprintf( + ' + %s', + $this->lang['straggrsortop'] + ) . \PHP_EOL; + echo \sprintf( + ' \n\t" . \PHP_EOL; - echo "\t\n\t\t{$this->lang['strcomment']}" . \PHP_EOL; + echo \sprintf( + ' + %s', + $this->lang['strcomment'] + ) . \PHP_EOL; echo "\t\t", \htmlspecialchars($_REQUEST['aggrcomment']), "\n\t" . \PHP_EOL; echo '' . \PHP_EOL; echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['strcreate']}\" />" . \PHP_EOL; - echo \sprintf('%s', $this->lang['strcancel'], \PHP_EOL); + echo \sprintf( + '', + $this->lang['strcreate'] + ) . \PHP_EOL; + echo \sprintf( + '
{$this->lang['strnofkref']}
%s
' . \PHP_EOL; echo $this->view->form; - echo "lang['strcreate']}\" />" . \PHP_EOL; - echo \sprintf('
{$this->lang['strnodata']}
', \sprintf($this->lang['strconfdropaggregate'], \htmlspecialchars($_REQUEST['aggrname'])), '
', \sprintf( + $this->lang['strconfdropaggregate'], + \htmlspecialchars($_REQUEST['aggrname']) + ), '
{$this->lang['strcascade']}
' . \PHP_EOL; echo '' . \PHP_EOL; echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['strdrop']}\" />" . \PHP_EOL; - echo \sprintf('
', \sprintf($this->lang['strconfdropdatabase'], $this->misc->printVal($a['database'])), '
', \sprintf( + $this->lang['strconfdropdatabase'], + $this->misc->printVal($a['database']) + ), '
', \sprintf($this->lang['strconfdropdatabase'], $this->misc->printVal($_REQUEST['dropdatabase'])), '
', \sprintf( + $this->lang['strconfdropdatabase'], + $this->misc->printVal($_REQUEST['dropdatabase']) + ), '
' . \nl2br($msg) . '
{$this->lang['strinvalidparam']}
_maxNameLen}\" />" . \PHP_EOL; + \sprintf( + '" size="32" maxlength="%s" />', + $data->_maxNameLen + ) . \PHP_EOL; // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities echo '' . \PHP_EOL; @@ -213,7 +240,10 @@ class DatabaseController extends BaseController } echo '' . \PHP_EOL; - echo "lang['strfind']}\" />" . \PHP_EOL; + echo \sprintf( + '', + $this->lang['strfind'] + ) . \PHP_EOL; echo $this->view->form; echo '
', $rs->recordCount(), ' ', $this->lang['strobjects'], '
{$this->lang['strnoobjects']}
{$this->lang['strentersql']}
{$this->lang['strsql']}" . \PHP_EOL; + echo \sprintf( + '
%s', + $this->lang['strsql'] + ) . \PHP_EOL; echo '', \htmlspecialchars($_SESSION['sqlquery']), '
" . \PHP_EOL; - echo "{$this->lang['struploadscript']}
', + $max_size + ) . \PHP_EOL; + echo \sprintf( + '%s
{$this->lang['strpaginate']}
lang['strexecute']}\" />" . \PHP_EOL; + echo '
', + $this->lang['strexecute'] + ) . \PHP_EOL; echo $this->view->form; - echo "lang['strreset']}\" />
{$this->lang['strshow']}" . \PHP_EOL; - echo "{$this->lang['strdownload']}
%s', + $this->lang['strshow'] + ) . \PHP_EOL; + echo \sprintf( + '%s
' . \PHP_EOL; echo '' . \PHP_EOL; if (isset($_REQUEST['table'])) { echo '' . \PHP_EOL; - echo \sprintf('%s', \htmlspecialchars($_REQUEST['table']), \PHP_EOL); + echo \sprintf( + '%s', + \htmlspecialchars($_REQUEST['table']), + \PHP_EOL + ); } else { echo '' . \PHP_EOL; } @@ -145,7 +164,10 @@ class DataexportController extends BaseController echo '' . \PHP_EOL; } echo $this->view->form; - echo "lang['strexport']}\" />
', $resultset->recordCount(), " {$this->lang['strrows']}
', $resultset->recordCount(), \sprintf( + ' %s
{$this->lang['strrownotunique']}
'; if (!$error) { - echo "lang['strsave']}\" />" . \PHP_EOL; + echo \sprintf( + '', + $this->lang['strsave'] + ) . \PHP_EOL; } - echo "lang['strcancel']}\" />" . \PHP_EOL; + echo \sprintf( + '', + $this->lang['strcancel'] + ) . \PHP_EOL; if (false !== $fksprops) { - $autocomplete_string = "{$this->lang['strac']}"; + $autocomplete_string = \sprintf( + '%s', + $this->lang['strac'] + ); if ('default off' !== $this->conf['autocomplete']) { - $autocomplete_string = "{$this->lang['strac']}"; + $autocomplete_string = \sprintf( + '%s', + $this->lang['strac'] + ); } echo $autocomplete_string . \PHP_EOL; } @@ -809,7 +914,10 @@ class DisplayController extends BaseController echo $this->view->form; if (1 === $resultset->recordCount()) { - echo "
{$this->lang['strconfdeleterow']}
' . \PHP_EOL; if (1 !== $page) { - $result .= \sprintf('%s%s ', $url, $lang['strfirst'], \PHP_EOL); - $result .= \sprintf('%s%s', $url, $page - 1, $lang['strprev'], \PHP_EOL); + $result .= \sprintf( + '%s%s ', + $url, + $lang['strfirst'], + \PHP_EOL + ); + $result .= \sprintf( + '%s%s', + $url, + $page - 1, + $lang['strprev'], + \PHP_EOL + ); } [$min_page, $max_page] = $this->_getMinMaxPages($page, $pages); for ($i = $min_page; $i <= $max_page; ++$i) { - $result .= (($i === $page) ? $i : \sprintf('%s', $url, $i, $i)) . \PHP_EOL; + $result .= (($i === $page) ? $i : \sprintf( + '%s', + $url, + $i, + $i + )) . \PHP_EOL; } if ($page !== $pages) { - $result .= \sprintf('%s%s', $url, $page + 1, $lang['strnext'], \PHP_EOL); - $result .= \sprintf(' %s%s', $url, $pages, $lang['strlast'], \PHP_EOL); + $result .= \sprintf( + '%s%s', + $url, + $page + 1, + $lang['strnext'], + \PHP_EOL + ); + $result .= \sprintf( + ' %s%s', + $url, + $pages, + $lang['strlast'], + \PHP_EOL + ); } $result .= '
' . \PHP_EOL; echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['stralter']}\" />" . \PHP_EOL; - echo \sprintf('
', \sprintf($this->lang['strconfdropdomain'], $this->misc->printVal($_REQUEST['domain'])), '
', \sprintf( + $this->lang['strconfdropdomain'], + $this->misc->printVal($_REQUEST['domain']) + ), '
' . \PHP_EOL; echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['strdrop']}\" />" . \PHP_EOL; - echo \sprintf('
', \sprintf($this->lang['strconfdropftsconfig'], $this->misc->printVal($_REQUEST['ftscfg'])), '
', \sprintf( + $this->lang['strconfdropftsconfig'], + $this->misc->printVal($_REQUEST['ftscfg']) + ), '
', \sprintf($this->lang['strconfdropftsdict'], $this->misc->printVal($_REQUEST['ftsdict'])), '
', \sprintf( + $this->lang['strconfdropftsdict'], + $this->misc->printVal($_REQUEST['ftsdict']) + ), '
' . \PHP_EOL; echo '' . \PHP_EOL; echo '' . \PHP_EOL; //echo "".PHP_EOL; echo '
' . \PHP_EOL; echo '' . \PHP_EOL; echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['strcreate']}\" />" . \PHP_EOL; - echo "lang['strcancel']}\" />" . \PHP_EOL; + echo \sprintf( + '', + $this->lang['strcreate'] + ) . \PHP_EOL; + echo \sprintf( + '', + $this->lang['strcancel'] + ) . \PHP_EOL; echo '
', \sprintf($this->lang['strconfdropmember'], $this->misc->printVal($_REQUEST['user']), $this->misc->printVal($_REQUEST['group'])), '
', \sprintf( + $this->lang['strconfdropmember'], + $this->misc->printVal($_REQUEST['user']), + $this->misc->printVal($_REQUEST['group']) + ), '
', \sprintf($this->lang['strconfdropgroup'], $this->misc->printVal($_REQUEST['group'])), '
', \sprintf( + $this->lang['strconfdropgroup'], + $this->misc->printVal($_REQUEST['group']) + ), '
' . \PHP_EOL; - echo "lang['strcreate']}\" />" . \PHP_EOL; - echo \sprintf('
{$this->lang['strnodatabaseselected']}
{$this->lang['strnohistory']}
{$this->lang['strconfdelhistory']}
', \htmlentities($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']][$qid]['query'], \ENT_QUOTES, 'UTF-8'), '
{$this->lang['strconfclearhistory']}
', \sprintf($this->lang['strconfcluster'], $this->misc->printVal($_REQUEST['index'])), '
', \sprintf( + $this->lang['strconfcluster'], + $this->misc->printVal($_REQUEST['index']) + ), '
'; - echo "{$this->lang['stranalyze']}
', \sprintf($this->lang['strconfdropindex'], $this->misc->printVal($this->getRequestParam('index'))), '
', \sprintf( + $this->lang['strconfdropindex'], + $this->misc->printVal($this->getRequestParam('index')) + ), '
'; echo '' . $this->lang['strcascade'] . '
lang['stralter']}\" />" . \PHP_EOL; - echo \sprintf('
', + $this->lang['stralter'] + ) . \PHP_EOL; + echo \sprintf( + '
', \sprintf($this->lang['strconfdropview'], $this->misc->printVal($a['view'])), '
', \sprintf( + $this->lang['strconfdropview'], + $this->misc->printVal($a['view']) + ), '
', \sprintf($this->lang['strconfdropview'], $this->misc->printVal($_REQUEST['matview'])), '
', \sprintf( + $this->lang['strconfdropview'], + $this->misc->printVal($_REQUEST['matview']) + ), '
', \sprintf($this->lang['strconfdropoperator'], $this->misc->printVal($_REQUEST['operator'])), '
', \sprintf( + $this->lang['strconfdropoperator'], + $this->misc->printVal($_REQUEST['operator']) + ), '
{$this->lang['strnoprivileges']}
', \sprintf($this->lang['strconfdroprole'], $this->misc->printVal($_REQUEST['rolename'])), '
', \sprintf( + $this->lang['strconfdroprole'], + $this->misc->printVal($_REQUEST['rolename']) + ), '
' . \PHP_EOL; echo $this->view->form; - echo "lang['strok']}\" />" . \PHP_EOL; - echo "lang['strcancel']}\" />" . \PHP_EOL; + echo \sprintf( + '', + $this->lang['strok'] + ) . \PHP_EOL; + echo \sprintf( + '', + $this->lang['strcancel'] + ) . \PHP_EOL; echo '
lang['strcreate']}\" />" . \PHP_EOL; - echo \sprintf('
', + $this->lang['strcreate'] + ) . \PHP_EOL; + echo \sprintf( + '
', \sprintf($this->lang['strconfdropschema'], $this->misc->printVal($a['nsp'])), '
', \sprintf( + $this->lang['strconfdropschema'], + $this->misc->printVal($a['nsp']) + ), '
', \sprintf($this->lang['strconfdropschema'], $this->misc->printVal($_REQUEST['nsp'])), '
', \sprintf( + $this->lang['strconfdropschema'], + $this->misc->printVal($_REQUEST['nsp']) + ), '
', \sprintf($this->lang['strconfdropsequence'], $this->misc->printVal($a['sequence'])), '
', \sprintf( + $this->lang['strconfdropsequence'], + $this->misc->printVal($a['sequence']) + ), '
', \sprintf($this->lang['strconfdropsequence'], $this->misc->printVal($_REQUEST['sequence'])), '
', \sprintf( + $this->lang['strconfdropsequence'], + $this->misc->printVal($_REQUEST['sequence']) + ), '
' . \PHP_EOL; echo $this->view->form; - echo "lang['strdrop']}\" />" . \PHP_EOL; - echo \sprintf('
' . \PHP_EOL; echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['strsetval']}\" />" . \PHP_EOL; - echo \sprintf('
' . \PHP_EOL; echo $this->view->form; echo '' . \PHP_EOL; - echo "lang['stralter']}\" />" . \PHP_EOL; - echo \sprintf('
', $rs->recordCount(), " {$this->lang['strrows']}
', $rs->recordCount(), \sprintf( + ' %s
', $data->conn->Affected_Rows(), " {$this->lang['strrowsaff']}
', $data->conn->Affected_Rows(), \sprintf( + ' %s
', $this->lang['strnodata'], '
', \sprintf($this->lang['strruntime'], $this->duration), '
', \sprintf( + $this->lang['strruntime'], + $this->duration + ), '
{$this->lang['strsqlexecuted']}
_maxNameLen}\" />" . \PHP_EOL; + $default_html .= '
', + $data->_maxNameLen + ) . \PHP_EOL; $filters = $this->_getFilters(); $advanced_filters = $this->_getAdvancedFilters(); @@ -159,20 +164,41 @@ class SqleditController extends BaseController // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities $default_html .= "" . \PHP_EOL; - $default_html .= \sprintf('%s{$this->lang['strallobjects']}" . \PHP_EOL, "\t"); + $default_html .= \sprintf( + '%s%s', + $this->lang['strallobjects'] + ) . \PHP_EOL, + "\t" + ); foreach ($filters as $type => $props) { - $default_html .= \sprintf('%s%s' . \PHP_EOL, "\t", $type, $props['selected'], $this->lang[$props['langkey']]); + $default_html .= \sprintf( + '%s%s' . \PHP_EOL, + "\t", + $type, + $props['selected'], + $this->lang[$props['langkey']] + ); } if ($this->conf['show_advanced']) { foreach ($advanced_filters as $type => $props) { - $default_html .= \sprintf('%s%s' . \PHP_EOL, "\t", $type, $props['selected'], $this->lang[$props['langkey']]); + $default_html .= \sprintf( + '%s%s' . \PHP_EOL, + "\t", + $type, + $props['selected'], + $this->lang[$props['langkey']] + ); } } $default_html .= '' . \PHP_EOL; - $default_html .= "lang['strfind']}\" />" . \PHP_EOL; + $default_html .= \sprintf( + '', + $this->lang['strfind'] + ) . \PHP_EOL; $default_html .= '
' . \PHP_EOL; echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['strnext']}\" />" . \PHP_EOL; - echo \sprintf('
' . \PHP_EOL; @@ -491,8 +590,15 @@ class TablesController extends BaseController if (isset($_REQUEST['spcname'])) { echo '' . \PHP_EOL; } - echo "lang['strcreate']}\" />" . \PHP_EOL; - echo \sprintf('
' . \PHP_EOL; - echo \sprintf('%s', \htmlspecialchars($_REQUEST['table']), \PHP_EOL); + echo \sprintf( + '%s', + \htmlspecialchars($_REQUEST['table']), + \PHP_EOL + ); echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['strselect']}\" />" . \PHP_EOL; - echo \sprintf('
lang['strinsert']}\" />" . \PHP_EOL; - echo "lang['strinsertandrepeat']}\" />" . \PHP_EOL; + echo \sprintf( + '%s', + \htmlspecialchars($_REQUEST['table']), + \PHP_EOL + ); + echo \sprintf( + '
', + $this->lang['strinsert'] + ) . \PHP_EOL; + echo \sprintf( + '', + $this->lang['strinsertandrepeat'] + ) . \PHP_EOL; if (false !== $fksprops) { if ('default off' !== $this->conf['autocomplete']) { - echo "{$this->lang['strac']}" . \PHP_EOL; + echo \sprintf( + '%s', + $this->lang['strac'] + ) . \PHP_EOL; } else { - echo "{$this->lang['strac']}" . \PHP_EOL; + echo \sprintf( + '%s', + $this->lang['strac'] + ) . \PHP_EOL; } } echo '
{$this->lang['strnofieldsforinsert']}
' . \sprintf($this->lang['strconfemptytable'], $this->misc->printVal($a['table'])); + echo '
' . \sprintf( + $this->lang['strconfemptytable'], + $this->misc->printVal($a['table']) + ); echo '
', \sprintf($this->lang['strconfemptytable'], $this->misc->printVal($_REQUEST['table'])), '
', \sprintf( + $this->lang['strconfemptytable'], + $this->misc->printVal($_REQUEST['table']) + ), '
', \sprintf($this->lang['strconfdroptable'], $this->misc->printVal($a['table'])), '
', \sprintf( + $this->lang['strconfdroptable'], + $this->misc->printVal($a['table']) + ), '
', \sprintf($this->lang['strconfdroptable'], $this->misc->printVal($_REQUEST['table'])), '
', \sprintf( + $this->lang['strconfdroptable'], + $this->misc->printVal($_REQUEST['table']) + ), '
' . \PHP_EOL; echo '' . \PHP_EOL; - echo "lang['stralter']}\" />" . \PHP_EOL; - echo \sprintf('
', \sprintf($this->lang['strconfdroptablespace'], $this->misc->printVal($_REQUEST['tablespace'])), '
', \sprintf( + $this->lang['strconfdroptablespace'], + $this->misc->printVal($_REQUEST['tablespace']) + ), '
' . \PHP_EOL; - echo \sprintf('%s', \htmlspecialchars($_REQUEST['table']), \PHP_EOL); + echo \sprintf( + '%s', + \htmlspecialchars($_REQUEST['table']), + \PHP_EOL + ); echo $this->view->form; - echo "lang['stralter']}\" />" . \PHP_EOL; - echo \sprintf('
{$this->lang['strnouploads']}
' . \PHP_EOL; echo $this->view->form; - echo \sprintf('%s', \htmlspecialchars($_REQUEST['table']), \PHP_EOL); - echo "lang['strimport']}\" />
' . \sprintf($this->lang['strconfdropcolumn'], $misc->printVal($_REQUEST['column']), $misc->printVal($_REQUEST['table'])) . '
' . \sprintf( + $this->lang['strconfdropcolumn'], + $misc->printVal($_REQUEST['column']), + $misc->printVal($_REQUEST['table']) + ) . '
' . \PHP_EOL; - echo \sprintf('%s', \htmlspecialchars($_REQUEST['table']), \PHP_EOL); + echo \sprintf( + '%s', + \htmlspecialchars($_REQUEST['table']), + \PHP_EOL + ); echo '' . \PHP_EOL; echo $this->view->form; - echo "lang['strok']}\" />" . \PHP_EOL; - echo \sprintf('
', \sprintf($this->lang['strconfdroptype'], $this->misc->printVal($_REQUEST['type'])), '
', \sprintf( + $this->lang['strconfdroptype'], + $this->misc->printVal($_REQUEST['type']) + ), '
', \sprintf($this->lang['strconfdropuser'], $this->misc->printVal($_REQUEST['username'])), '
', \sprintf( + $this->lang['strconfdropuser'], + $this->misc->printVal($_REQUEST['username']) + ), '
- - {$this->view->form} - - + + %s + +
', \sprintf($this->lang['strconfdropview'], $this->misc->printVal($_REQUEST['view'])), '
', \sprintf( + $this->lang['strconfdropview'], + $this->misc->printVal($_REQUEST['view']) + ), '
', \sprintf($this->lang['strconfclustertable'], $this->misc->printVal($a['table'])), '
', \sprintf( + $this->lang['strconfclustertable'], + $this->misc->printVal($a['table']) + ), '
', \sprintf($this->lang['strconfclustertable'], $this->misc->printVal($_REQUEST['object'])), '
', \sprintf( + $this->lang['strconfclustertable'], + $this->misc->printVal($_REQUEST['object']) + ), '
', \sprintf($this->lang['strconfclusterdatabase'], $this->misc->printVal($_REQUEST['object'])), '
', \sprintf( + $this->lang['strconfclusterdatabase'], + $this->misc->printVal($_REQUEST['object']) + ), '
', \sprintf($this->lang['strconfreindextable'], $this->misc->printVal($a['table'])), '
', \sprintf( + $this->lang['strconfreindextable'], + $this->misc->printVal($a['table']) + ), '
', \sprintf($this->lang['strconfreindextable'], $this->misc->printVal($_REQUEST['object'])), '
', \sprintf( + $this->lang['strconfreindextable'], + $this->misc->printVal($_REQUEST['object']) + ), '
', \sprintf($this->lang['strconfreindexdatabase'], $this->misc->printVal($_REQUEST['object'])), '
', \sprintf( + $this->lang['strconfreindexdatabase'], + $this->misc->printVal($_REQUEST['object']) + ), '
', \sprintf($this->lang['strconfanalyzetable'], $this->misc->printVal($a['table'])), '
', \sprintf( + $this->lang['strconfanalyzetable'], + $this->misc->printVal($a['table']) + ), '
', \sprintf($this->lang['strconfanalyzetable'], $this->misc->printVal($_REQUEST['object'])), '
', \sprintf( + $this->lang['strconfanalyzetable'], + $this->misc->printVal($_REQUEST['object']) + ), '
', \sprintf($this->lang['strconfanalyzedatabase'], $this->misc->printVal($_REQUEST['object'])), '
', \sprintf( + $this->lang['strconfanalyzedatabase'], + $this->misc->printVal($_REQUEST['object']) + ), '
', \sprintf($this->lang['strconfvacuumtable'], $this->misc->printVal($a['table'])), '
', \sprintf( + $this->lang['strconfvacuumtable'], + $this->misc->printVal($a['table']) + ), '
', \sprintf($this->lang['strconfvacuumtable'], $this->misc->printVal($_REQUEST['object'])), '
', \sprintf( + $this->lang['strconfvacuumtable'], + $this->misc->printVal($_REQUEST['object']) + ), '
', \sprintf($this->lang['strconfvacuumdatabase'], $this->misc->printVal($_REQUEST['object'])), '
', \sprintf( + $this->lang['strconfvacuumdatabase'], + $this->misc->printVal($_REQUEST['object']) + ), '