Skip to content

Commit

Permalink
Make PHPCS happy.
Browse files Browse the repository at this point in the history
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
  • Loading branch information
Tithugues committed Oct 24, 2015
1 parent 8b4590a commit 8ac9634
Show file tree
Hide file tree
Showing 20 changed files with 135 additions and 62 deletions.
5 changes: 4 additions & 1 deletion libraries/Console.php
Expand Up @@ -112,7 +112,10 @@ public static function getBookmarkContent()
__('shared')
);
$output .= sprintf(
/* l10n: First parameter will be replaced with the translation for Total and the number of bookmarks, second one with the translation for private and the third one, with the translation for shared */
/* l10n: First parameter will be replaced with the translation
for Total and the number of bookmarks, second one with the
translation for private and the third one, with the translation
for shared */
__('%1$s, %2$s and %3$s bookmarks included'),
$bookmarks_message,
$private_message,
Expand Down
16 changes: 9 additions & 7 deletions libraries/Header.php
Expand Up @@ -236,7 +236,7 @@ public function getJsParams()
'db' => $db,
'token' => $_SESSION[' PMA_token '],
'text_dir' => $GLOBALS['text_dir'],
'show_databases_navigation_as_tree'=> $GLOBALS['cfg']['ShowDatabasesNavigationAsTree'],
'show_databases_navigation_as_tree' => $GLOBALS['cfg']['ShowDatabasesNavigationAsTree'],
'pma_absolute_uri' => $GLOBALS['cfg']['PmaAbsoluteUri'],
'pma_text_default_tab' => Util::getTitleForTarget(
$GLOBALS['cfg']['DefaultTabTable']
Expand Down Expand Up @@ -531,8 +531,9 @@ public function sendHttpHeaders()
if (!empty($GLOBALS['cfg']['CaptchaLoginPrivateKey'])
&& !empty($GLOBALS['cfg']['CaptchaLoginPublicKey'])
) {
$captcha_url = ' https://apis.google.com https://www.google.com/recaptcha/'
. ' https://www.gstatic.com/recaptcha/ https://ssl.gstatic.com/ ';
$captcha_url
= ' https://apis.google.com https://www.google.com/recaptcha/'
. ' https://www.gstatic.com/recaptcha/ https://ssl.gstatic.com/ ';
} else {
$captcha_url = '';
}
Expand Down Expand Up @@ -593,9 +594,9 @@ public function sendHttpHeaders()
header(
'X-XSS-Protection: 1; mode=block'
);
// "nosniff", prevents Internet Explorer and Google Chrome from MIME-sniffing a
// response away from the declared content-type
/// see https://www.owasp.org/index.php/List_of_useful_HTTP_headers
// "nosniff", prevents Internet Explorer and Google Chrome from MIME-sniffing
// a response away from the declared content-type
// see https://www.owasp.org/index.php/List_of_useful_HTTP_headers
header(
'X-Content-Type-Options: nosniff'
);
Expand Down Expand Up @@ -682,7 +683,8 @@ private function _getLinkTags()
$retval .= '<link rel="stylesheet" type="text/css" href="'
. $basedir . 'phpmyadmin.css.php?'
. 'nocache=' . $theme_id . $GLOBALS['text_dir'] . '" />';
// load Print view's CSS last, so that it overrides all other CSS while 'printing'
// load Print view's CSS last, so that it overrides all other CSS while
// 'printing'
$retval .= '<link rel="stylesheet" type="text/css" href="'
. $theme_path . '/css/printview.css?' . $v . '" />';
}
Expand Down
31 changes: 24 additions & 7 deletions libraries/bookmark.lib.php
Expand Up @@ -69,10 +69,15 @@ function PMA_Bookmark_getList($db = false)
$cfgBookmark['db']
) . '.' . PMA\libraries\Util::backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
. ' AND user = \'' . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . '\''
. ' AND user = \'' . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user'])
. '\''
. ' ORDER BY label';
$per_user = $GLOBALS['dbi']->fetchResult(
$query, 'id', null, $controllink, PMA\libraries\DatabaseInterface::QUERY_STORE
$query,
'id',
null,
$controllink,
PMA\libraries\DatabaseInterface::QUERY_STORE
);

$query = 'SELECT query, label, id FROM ' . PMA\libraries\Util::backquote(
Expand All @@ -82,7 +87,11 @@ function PMA_Bookmark_getList($db = false)
. ' AND user = \'\''
. ' ORDER BY label';
$global = $GLOBALS['dbi']->fetchResult(
$query, 'id', null, $controllink, PMA\libraries\DatabaseInterface::QUERY_STORE
$query,
'id',
null,
$controllink,
PMA\libraries\DatabaseInterface::QUERY_STORE
);

foreach ($global as $key => $val) {
Expand All @@ -98,7 +107,8 @@ function PMA_Bookmark_getList($db = false)
. " FROM " . PMA\libraries\Util::backquote($cfgBookmark['db'])
. "." . PMA\libraries\Util::backquote($cfgBookmark['table'])
. " WHERE `user` = '' OR"
. " `user` = '" . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . "'";
. " `user` = '" . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user'])
. "'";

$ret = $GLOBALS['dbi']->fetchResult(
$query,
Expand Down Expand Up @@ -191,7 +201,11 @@ function PMA_Bookmark_save($bkm_fields, $all_users = false)
. ' VALUES (NULL, \''
. PMA\libraries\Util::sqlAddSlashes($bkm_fields['bkm_database']) . '\', '
. '\''
. ($all_users ? '' : PMA\libraries\Util::sqlAddSlashes($bkm_fields['bkm_user']))
. ($all_users
? ''
: PMA\libraries\Util::sqlAddSlashes(
$bkm_fields['bkm_user']
))
. '\', '
. '\''
. PMA\libraries\Util::sqlAddSlashes(urldecode($bkm_fields['bkm_sql_query']))
Expand Down Expand Up @@ -224,7 +238,8 @@ function PMA_Bookmark_delete($id)

$query = 'DELETE FROM ' . PMA\libraries\Util::backquote($cfgBookmark['db'])
. '.' . PMA\libraries\Util::backquote($cfgBookmark['table'])
. ' WHERE (user = \'' . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . '\''
. ' WHERE (user = \''
. PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . '\''
. ' OR user = \'\')'
. ' AND id = ' . $id;
return $GLOBALS['dbi']->tryQuery($query, $controllink);
Expand Down Expand Up @@ -264,7 +279,9 @@ function PMA_Bookmark_applyVariables($query)
for ($i = 1; $i <= $number_of_variables; $i++) {
$var = '';
if (! empty($_REQUEST['bookmark_variable'][$i])) {
$var = PMA\libraries\Util::sqlAddSlashes($_REQUEST['bookmark_variable'][$i]);
$var = PMA\libraries\Util::sqlAddSlashes(
$_REQUEST['bookmark_variable'][$i]
);
}
$query = str_replace('[VARIABLE' . $i . ']', $var, $query);
// backward compatibility
Expand Down
10 changes: 8 additions & 2 deletions libraries/build_html_for_db.lib.php
Expand Up @@ -143,7 +143,10 @@ function PMA_buildHtmlForDb(
$replication_info[$type]['Ignore_DB']
);
if (/*overload*/mb_strlen($key) > 0) {
$out .= PMA\libraries\Util::getIcon('s_cancel.png', __('Not replicated'));
$out .= PMA\libraries\Util::getIcon(
's_cancel.png',
__('Not replicated')
);
} else {
$key = array_search(
$current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']
Expand All @@ -155,7 +158,10 @@ function PMA_buildHtmlForDb(
&& count($replication_info[$type]['Do_DB']) == 1)
) {
// if ($key != null) did not work for index "0"
$out .= PMA\libraries\Util::getIcon('s_success.png', __('Replicated'));
$out .= PMA\libraries\Util::getIcon(
's_success.png',
__('Replicated')
);
}
}

Expand Down
8 changes: 6 additions & 2 deletions libraries/common.inc.php
Expand Up @@ -56,7 +56,10 @@
* PHP 5 function, so cannot easily localize this message.
*/
if (version_compare(PHP_VERSION, '5.5.0', 'lt')) {
die('PHP 5.5+ is required. <br /> Currently installed version is: ' . phpversion());
die(
'PHP 5.5+ is required. <br /> Currently installed version is: '
. phpversion()
);
}

/**
Expand Down Expand Up @@ -804,7 +807,8 @@

// get LoginCookieValidity from preferences cache
// no generic solution for loading preferences from cache as some settings
// need to be kept for processing in PMA\libraries\Config::loadUserPreferences()
// need to be kept for processing in
// PMA\libraries\Config::loadUserPreferences()
$cache_key = 'server_' . $GLOBALS['server'];
if (isset($_SESSION['cache'][$cache_key]['userprefs']['LoginCookieValidity'])
) {
Expand Down
3 changes: 2 additions & 1 deletion libraries/config.values.php
Expand Up @@ -99,7 +99,8 @@
'D' => __('display column')
);
$cfg_db['DefaultTabServer'] = array(
'welcome' => __('Welcome'), // the welcome page (recommended for multiuser setups)
// the welcome page (recommended for multiuser setups)
'welcome' => __('Welcome'),
'databases' => __('Databases'), // list of databases
'status' => __('Status'), // runtime information
'variables' => __('Variables'), // MySQL server variables
Expand Down
9 changes: 7 additions & 2 deletions libraries/create_addfield.lib.php
Expand Up @@ -190,7 +190,8 @@ function PMA_buildIndexStatements($index, $index_choice,

$comment = $index['Index_comment'];
if (! empty($comment)) {
$sql_query .= " COMMENT '" . PMA\libraries\Util::sqlAddSlashes($comment) . "'";
$sql_query .= " COMMENT '" . PMA\libraries\Util::sqlAddSlashes($comment)
. "'";
}

$statement[] = $sql_query;
Expand Down Expand Up @@ -385,7 +386,11 @@ function PMA_getPartitionDefinition($name, $partition, $isSubPartition = false)
$j = 0;
$subpartitions = array();
foreach ($partition['subpartitions'] as $subpartition) {
$subpartitions[] = PMA_getPartitionDefinition($name . 's' . $j, $subpartition, true);
$subpartitions[] = PMA_getPartitionDefinition(
$name . 's' . $j,
$subpartition,
true
);
$j++;
}
$sql_query .= " (" . implode(", ", $subpartitions) . ")";
Expand Down
7 changes: 4 additions & 3 deletions libraries/db_table_exists.lib.php
Expand Up @@ -64,8 +64,8 @@

if (! $is_table) {
$_result = $GLOBALS['dbi']->tryQuery(
'SHOW TABLES LIKE \'' . PMA\libraries\Util::sqlAddSlashes($table, true)
. '\';',
'SHOW TABLES LIKE \''
. PMA\libraries\Util::sqlAddSlashes($table, true) . '\';',
null, PMA\libraries\DatabaseInterface::QUERY_STORE
);
$is_table = @$GLOBALS['dbi']->numRows($_result);
Expand All @@ -87,7 +87,8 @@
* only happen if IS_TRANSFORMATION_WRAPPER?
*/
$_result = $GLOBALS['dbi']->tryQuery(
'SELECT COUNT(*) FROM ' . PMA\libraries\Util::backquote($table) . ';',
'SELECT COUNT(*) FROM ' . PMA\libraries\Util::backquote($table)
. ';',
null,
PMA\libraries\DatabaseInterface::QUERY_STORE
);
Expand Down
7 changes: 5 additions & 2 deletions libraries/dbi/DBIDummy.php
Expand Up @@ -606,7 +606,9 @@
),
array(
'query' => 'SELECT @@default_authentication_plugin',
'result' => array(array('@@default_authentication_plugin' => 'mysql_native_password'))
'result' => array(
array('@@default_authentication_plugin' => 'mysql_native_password')
),
),
array(
'query' => "SELECT TABLE_NAME FROM information_schema.VIEWS WHERE "
Expand Down Expand Up @@ -647,7 +649,8 @@
),
array(
'query' => "SELECT `PLUGIN_NAME`, `PLUGIN_DESCRIPTION` "
. "FROM `information_schema`.`PLUGINS` WHERE `PLUGIN_TYPE` = 'AUTHENTICATION';",
. "FROM `information_schema`.`PLUGINS` "
. "WHERE `PLUGIN_TYPE` = 'AUTHENTICATION';",
'result' => array()
)
);
Expand Down
12 changes: 8 additions & 4 deletions libraries/display_change_password.lib.php
Expand Up @@ -113,15 +113,19 @@ function PMA_getHtmlForChangePassword($mode, $username, $hostname)
. '</table>';

$html .= '<div '
. ($orig_auth_plugin != 'sha256_password' ? 'style="display:none"' : '')
. ($orig_auth_plugin != 'sha256_password'
? 'style="display:none"'
: '')
. ' id="ssl_reqd_warning_cp">'
. Message::notice(
__(
'This method requires using an \'<i>SSL connection</i>\' '
. 'or an \'<i>unencrypted connection that encrypts the password '
. 'using RSA</i>\'; while connecting to the server.'
. 'or an \'<i>unencrypted connection that encrypts the '
. 'password using RSA</i>\'; while connecting to the server.'
)
. PMA\libraries\Util::showMySQLDocu(
'sha256-authentication-plugin'
)
. PMA\libraries\Util::showMySQLDocu('sha256-authentication-plugin')
)
->getDisplay()
. '</div>';
Expand Down
26 changes: 15 additions & 11 deletions libraries/display_export.lib.php
Expand Up @@ -253,21 +253,24 @@ function PMA_getOptionsForExportTemplates($export_type)
. PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
. PMA\libraries\Util::backquote($cfgRelation['export_templates'])
. " WHERE `username` = "
. "'" . PMA\libraries\Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "'"
. " AND `export_type` = '" . $export_type . "'"
. "'" . PMA\libraries\Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user'])
. "' AND `export_type` = '" . $export_type . "'"
. " ORDER BY `template_name`;";

$result = PMA_queryAsControlUser($query);
if ($result) {
while ($row = $GLOBALS['dbi']->fetchAssoc($result, $GLOBALS['controllink'])) {
$ret .= '<option value="' . htmlspecialchars($row['id']) . '"';
if (!empty($_GET['template_id']) && $_GET['template_id'] == $row['id']) {
$ret .= ' selected="selected"';
}
$ret .= '>';
$ret .= htmlspecialchars($row['template_name']) . '</option>';
if (!$result) {
return $ret;
}

while ($row = $GLOBALS['dbi']->fetchAssoc($result, $GLOBALS['controllink'])) {
$ret .= '<option value="' . htmlspecialchars($row['id']) . '"';
if (!empty($_GET['template_id']) && $_GET['template_id'] == $row['id']) {
$ret .= ' selected="selected"';
}
$ret .= '>';
$ret .= htmlspecialchars($row['template_name']) . '</option>';
}

return $ret;
}

Expand Down Expand Up @@ -1080,7 +1083,8 @@ function PMA_getExportDisplay(
. ' name="dump" class="disableAjax">';

//output Hidden Inputs
$single_table_str = isset($GLOBALS['single_table'])? $GLOBALS['single_table'] : '';
$single_table_str = isset($GLOBALS['single_table']) ? $GLOBALS['single_table']
: '';
$html .= PMA_getHtmlForHiddenInput(
$export_type,
$db,
Expand Down
8 changes: 6 additions & 2 deletions libraries/display_git_revision.lib.php
Expand Up @@ -66,15 +66,19 @@ function PMA_printGitRevision()
. sprintf(
__('committed on %1$s by %2$s'),
PMA\libraries\Util::localisedDate(strtotime($committer['date'])),
'<a href="' . PMA_linkURL('mailto:' . htmlspecialchars($committer['email'])) . '">'
'<a href="' . PMA_linkURL(
'mailto:' . htmlspecialchars($committer['email'])
) . '">'
. htmlspecialchars($committer['name']) . '</a>'
)
. ($author != $committer
? ', <br />'
. sprintf(
__('authored on %1$s by %2$s'),
PMA\libraries\Util::localisedDate(strtotime($author['date'])),
'<a href="' . PMA_linkURL('mailto:' . htmlspecialchars($author['email'])) . '">'
'<a href="' . PMA_linkURL(
'mailto:' . htmlspecialchars($author['email'])
) . '">'
. htmlspecialchars($author['name']) . '</a>'
)
: ''),
Expand Down
10 changes: 8 additions & 2 deletions libraries/display_import.lib.php
Expand Up @@ -245,7 +245,10 @@ function PMA_getHtmlForImportOptionsFile(
$html .= ' checked="checked"';
}
$html .= ' />';
$html .= PMA\libraries\Util::getSelectUploadFileBlock($import_list, $cfg['UploadDir']);
$html .= PMA\libraries\Util::getSelectUploadFileBlock(
$import_list,
$cfg['UploadDir']
);
$html .= ' </li>';
$html .= ' </ul>';

Expand All @@ -257,7 +260,10 @@ function PMA_getHtmlForImportOptionsFile(
__('File uploads are not allowed on this server.')
)->getDisplay();
} elseif (!empty($cfg['UploadDir'])) {
$html .= PMA\libraries\Util::getSelectUploadFileBlock($import_list, $cfg['UploadDir']);
$html .= PMA\libraries\Util::getSelectUploadFileBlock(
$import_list,
$cfg['UploadDir']
);
} // end if (web-server upload directory)

$html .= ' </div>';
Expand Down
15 changes: 9 additions & 6 deletions libraries/display_import_ajax.lib.php
Expand Up @@ -43,7 +43,9 @@
$check = "PMA_Import_" . $plugin . "Check";

if ($check()) {
$upload_class = 'PMA\libraries\plugins\import\upload\Upload' . ucwords($plugin);
$upload_class = 'PMA\libraries\plugins\import\upload\Upload' . ucwords(
$plugin
);
$_SESSION[$SESSION_KEY]["handler"] = $upload_class;
break;
}
Expand All @@ -67,11 +69,12 @@ function PMA_Import_apcCheck()
}

/**
* Checks if PMA\libraries\plugins\import\upload\UploadProgress bar extension is available.
*
* @return boolean true if PMA\libraries\plugins\import\upload\UploadProgress extension is available,
* false if it is not
*/
* Checks if PMA\libraries\plugins\import\upload\UploadProgress bar extension is
* available.
*
* @return boolean true if PMA\libraries\plugins\import\upload\UploadProgress
* extension is available, false if it is not
*/
function PMA_Import_progressCheck()
{
if (! function_exists("uploadprogress_get_info")
Expand Down

0 comments on commit 8ac9634

Please sign in to comment.