Remove logic code in declaration files.

Move declaration out of logic file.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
This commit is contained in:
Hugues Peccatte 2015-10-04 20:49:49 +02:00
parent 560b321d0c
commit dffc8c34e9
51 changed files with 28 additions and 204 deletions

View File

@ -3,12 +3,7 @@
<!-- http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php -->
<description>phpMyAdmin custom coding standard</description>
<rule ref="PEAR">
<exclude name="PEAR.Commenting.FileComment" />
<exclude name="PEAR.Commenting.ClassComment" />
<exclude name="PEAR.Commenting.FunctionComment" />
<exclude name="Generic.Commenting.DocComment" />
</rule>
<rule ref="PSR1" />
<rule ref="Generic.Metrics.NestingLevel" />
<!-- There MUST NOT be trailing whitespace at the end of lines. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />

View File

@ -7,10 +7,6 @@
*/
namespace PMA\libraries;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Class to handle database QBE search
*

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Formats interval like 10 per hour

View File

@ -6,10 +6,6 @@
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Defines the bookmark parameters for the current user
*

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Function to get html for one relational key

View File

@ -1,14 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* HTML generator for database listing
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Prepares the $column_order array

View File

@ -8,10 +8,6 @@
use PMA\libraries\Message;
use PMA\libraries\Util;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Defines the central_columns parameters for the current user
*

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Removes all variables from request except whitelisted ones.

View File

@ -5,13 +5,8 @@
*
* @package PhpMyAdmin
*/
use PMA\libraries\Table;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Transforms the radio button field_key into 4 arrays
*

View File

@ -7,10 +7,6 @@
*/
use PMA\libraries\Message;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Get HTML for the Change password dialog
*

View File

@ -10,10 +10,6 @@ use PMA\libraries\Message;
use PMA\libraries\plugins\ExportPlugin;
use PMA\libraries\Table;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Outputs appropriate checked statement for checkbox.
*

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Prints details about the current Git commit revision

View File

@ -8,14 +8,9 @@
*
* @package PhpMyAdmin
*/
use PMA\libraries\Message;
use PMA\libraries\plugins\ImportPlugin;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Prints Html For Display Import Hidden Input
*

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Compares the names of two languages.

View File

@ -6,16 +6,11 @@
*
* @package PhpMyAdmin
*/
use PMA\libraries\Message;
use PMA\libraries\plugins\ExportPlugin;
use PMA\libraries\Table;
use PMA\libraries\ZipFile;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Sets a session variable upon a possible fatal error during export
*

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns array of filtered file names

View File

@ -1,14 +1,10 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* set of functions for structure section in pma
*
* @package PhpMyAdmin
*/
if (!defined('PHPMYADMIN')) {
exit;
}
/**
* Get HTML for display indexes

View File

@ -5,14 +5,9 @@
*
* @package PhpMyAdmin
*/
use PMA\libraries\Message;
use PMA\libraries\plugins\TransformationsPlugin;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Retrieve form parameters for insert/edit form
*

View File

@ -6,9 +6,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Gets the "true" IP address of the current user

View File

@ -6,9 +6,6 @@
* @package PhpMyAdmin
*
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Format a string so it can be a string inside JavaScript code inside an

View File

@ -7,9 +7,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Logs user information to webserver logs.

View File

@ -6,9 +6,6 @@
* @package PhpMyAdmin
* @todo Maybe we could try to use fileinfo module if loaded
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Tries to detect MIME type of content.

View File

@ -7,9 +7,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Gets url params

View File

@ -7,10 +7,6 @@
*/
use PMA\libraries\Util;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Generate charset dropdown box
*

View File

@ -1,19 +1,13 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* set of functions used for normalization
*
* @package PhpMyAdmin
*/
use PMA\libraries\Message;
use PMA\libraries\Util;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* build the html for columns of $colTypeCategory category
* in form of given $listType in a table

View File

@ -16,10 +16,6 @@ use PMA\libraries\StorageEngine;
use PMA\libraries\Table;
use PMA\libraries\Util;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Get HTML output for database comment
*

View File

@ -10,10 +10,6 @@ use PMA\libraries\Table;
use PMA\libraries\RecentFavoriteTable;
use SqlParser\Statements\CreateStatement;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Executes a query as controluser if possible, otherwise as normal user
*

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Cleanup column related relation stuff

View File

@ -7,10 +7,6 @@
*/
use PMA\libraries\Message;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* returns HTML for error message
*

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Checks whether given link is valid

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns language name

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Renders the server selection in list or selectbox form, or option tags only

View File

@ -1,6 +1,5 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* functions for displaying server binary log
*
@ -11,10 +10,6 @@
use PMA\libraries\Message;
use PMA\libraries\Util;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns the html for log selector.
*

View File

@ -8,9 +8,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns the html for server Character Sets and Collations.

View File

@ -5,9 +5,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns the html for the sub-page heading

View File

@ -10,10 +10,6 @@
*/
use PMA\libraries\Message;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns the html for Database List
*

View File

@ -10,10 +10,6 @@
*/
use PMA\libraries\StorageEngine;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* setup HTML for server Engines information
*

View File

@ -8,9 +8,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns the common SQL used to retrieve plugin data

View File

@ -5,16 +5,11 @@
*
* @package PhpMyAdmin
*/
use PMA\libraries\DatabaseInterface;
use PMA\libraries\Message;
use PMA\libraries\Template;
use PMA\libraries\Util;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Get Html for User Group Dialog
*

View File

@ -10,10 +10,6 @@
*/
use PMA\libraries\ServerStatusData;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Prints server status information: processes, connections and traffic
*

View File

@ -8,9 +8,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns html with PMA\libraries\Advisor

View File

@ -11,10 +11,6 @@
use PMA\libraries\ServerStatusData;
use PMA\libraries\Util;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Prints html with monitor
*

View File

@ -12,10 +12,6 @@ use PMA\libraries\Message;
use PMA\libraries\ServerStatusData;
use PMA\libraries\Util;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Prints html for auto refreshing processes list
*

View File

@ -10,10 +10,6 @@
*/
use PMA\libraries\ServerStatusData;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns the html content for the query statistics
*

View File

@ -10,10 +10,6 @@
*/
use PMA\libraries\ServerStatusData;
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns the html for the list filter
*

View File

@ -6,10 +6,6 @@
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Return HTML to list the users belonging to a given user group
*

View File

@ -6,10 +6,6 @@
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Get HTML for secondary level menu tabs on 'Users' page
*

View File

@ -8,9 +8,6 @@
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Get Ajax return when $_REQUEST['type'] === 'getval'

View File

@ -114,21 +114,4 @@ if (! isset($_SESSION[' PMA_token '])) {
$_SESSION[' PMA_token '] = md5(uniqid(rand(), true));
}
/**
* tries to secure session from hijacking and fixation
* should be called before login and after successful login
* (only required if sensitive information stored in session)
*
* @return void
*/
function PMA_secureSession()
{
// prevent session fixation and XSS
// (better to use session_status() if available)
if ((PMA_PHP_INT_VERSION >= 50400 && session_status() === PHP_SESSION_ACTIVE)
|| (PMA_PHP_INT_VERSION < 50400 && session_id() !== '')
) {
session_regenerate_id(true);
}
$_SESSION[' PMA_token '] = md5(uniqid(rand(), true));
}
require_once 'libraries/session.lib.php';

26
libraries/session.lib.php Normal file
View File

@ -0,0 +1,26 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* session library
*
* @package PhpMyAdmin
*/
/**
* tries to secure session from hijacking and fixation
* should be called before login and after successful login
* (only required if sensitive information stored in session)
*
* @return void
*/
function PMA_secureSession()
{
// prevent session fixation and XSS
// (better to use session_status() if available)
if ((PMA_PHP_INT_VERSION >= 50400 && session_status() === PHP_SESSION_ACTIVE)
|| (PMA_PHP_INT_VERSION < 50400 && session_id() !== '')
) {
session_regenerate_id(true);
}
$_SESSION[' PMA_token '] = md5(uniqid(rand(), true));
}

View File

@ -10,10 +10,6 @@ use PMA\libraries\Message;
use PMA\libraries\Table;
use PMA\libraries\Response;
if (!defined('PHPMYADMIN')) {
exit;
}
/**
* Parses and analyzes the given SQL query.
*