1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 07:06:45 +02:00

Use private visibility on methods

This commit is contained in:
Jakub Vrana
2025-03-11 07:56:28 +01:00
parent c454ea8430
commit 0c15a9f42d
8 changed files with 103 additions and 103 deletions

View File

@@ -16,7 +16,7 @@ if (isset($_GET["mssql"])) {
var $extension = "sqlsrv", $server_info, $affected_rows, $errno, $error;
private $link, $result;
function _get_error() {
private function get_error() {
$this->error = "";
foreach (sqlsrv_errors() as $error) {
$this->errno = $error["code"];
@@ -44,7 +44,7 @@ if (isset($_GET["mssql"])) {
$info = sqlsrv_server_info($this->link);
$this->server_info = $info['SQLServerVersion'];
} else {
$this->_get_error();
$this->get_error();
}
return (bool) $this->link;
}
@@ -62,7 +62,7 @@ if (isset($_GET["mssql"])) {
$result = sqlsrv_query($this->link, $query); //! , array(), ($unbuffered ? array() : array("Scrollable" => "keyset"))
$this->error = "";
if (!$result) {
$this->_get_error();
$this->get_error();
return false;
}
return $this->store_result($result);
@@ -72,7 +72,7 @@ if (isset($_GET["mssql"])) {
$this->result = sqlsrv_query($this->link, $query);
$this->error = "";
if (!$this->result) {
$this->_get_error();
$this->get_error();
return false;
}
return true;

View File

@@ -248,7 +248,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row //! requires MySQL 5
);
echo "</div>\n";
unset($columns[$name]);
} elseif (is_array($options = $this->_foreignKeyOptions($_GET["select"], $name))) {
} elseif (is_array($options = $this->foreignKeyOptions($_GET["select"], $name))) {
if ($fields[$name]["null"]) {
$options[0] = '(' . lang('empty') . ')';
}
@@ -482,7 +482,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row //! requires MySQL 5
. enum_input("radio", $attrs, $field, ($value || isset($_GET["select"]) ? $value : 0), ($field["null"] ? "" : null))
;
}
$options = $this->_foreignKeyOptions($table, $field["field"], $value);
$options = $this->foreignKeyOptions($table, $field["field"], $value);
if ($options !== null) {
return (is_array($options)
? "<select$attrs>" . optionlist($options, $value, true) . "</select>"
@@ -651,7 +651,7 @@ qsl('div').onclick = whisperClick;", "")
}
}
function _foreignKeyOptions($table, $column, $value = null) {
private function foreignKeyOptions($table, $column, $value = null) {
if (list($target, $id, $name) = $this->_foreignColumn(column_foreign_keys($table), $column)) {
$return = &$this->values[$target];
if ($return === null) {

View File

@@ -66,8 +66,8 @@ if (isset($_GET["simpledb"])) {
$row['itemName()'] = (string) $item->Name;
}
foreach ($item->Attribute as $attribute) {
$name = $this->_processValue($attribute->Name);
$value = $this->_processValue($attribute->Value);
$name = $this->processValue($attribute->Name);
$value = $this->processValue($attribute->Value);
if (isset($row[$name])) {
$row[$name] = (array) $row[$name];
$row[$name][] = $value;
@@ -85,7 +85,7 @@ if (isset($_GET["simpledb"])) {
$this->num_rows = count($this->rows);
}
function _processValue($element) {
private function processValue($element) {
return (is_object($element) && $element['encoding'] == 'base64' ? base64_decode($element) : (string) $element);
}
@@ -128,7 +128,7 @@ if (isset($_GET["simpledb"])) {
public $primary = "itemName()";
function _chunkRequest($ids, $action, $params, $expand = array()) {
private function chunkRequest($ids, $action, $params, $expand = array()) {
$connection = connection();
foreach (array_chunk($ids, 25) as $chunk) {
$params2 = $params;
@@ -146,7 +146,7 @@ if (isset($_GET["simpledb"])) {
return true;
}
function _extractIds($table, $queryWhere, $limit) {
private function extractIds($table, $queryWhere, $limit) {
$return = array();
if (preg_match_all("~itemName\(\) = (('[^']*+')+)~", $queryWhere, $matches)) {
$return = array_map('Adminer\idf_unescape', $matches[1]);
@@ -167,8 +167,8 @@ if (isset($_GET["simpledb"])) {
}
function delete($table, $queryWhere, $limit = 0) {
return $this->_chunkRequest(
$this->_extractIds($table, $queryWhere, $limit),
return $this->chunkRequest(
$this->extractIds($table, $queryWhere, $limit),
'BatchDeleteAttributes',
array('DomainName' => $table)
);
@@ -178,7 +178,7 @@ if (isset($_GET["simpledb"])) {
$delete = array();
$insert = array();
$i = 0;
$ids = $this->_extractIds($table, $queryWhere, $limit);
$ids = $this->extractIds($table, $queryWhere, $limit);
$id = idf_unescape($set["`itemName()`"]);
unset($set["`itemName()`"]);
foreach ($set as $key => $val) {
@@ -198,8 +198,8 @@ if (isset($_GET["simpledb"])) {
}
}
$params = array('DomainName' => $table);
return (!$insert || $this->_chunkRequest(($id != "" ? array($id) : $ids), 'BatchPutAttributes', $params, $insert))
&& (!$delete || $this->_chunkRequest($ids, 'BatchDeleteAttributes', $params, $delete))
return (!$insert || $this->chunkRequest(($id != "" ? array($id) : $ids), 'BatchPutAttributes', $params, $insert))
&& (!$delete || $this->chunkRequest($ids, 'BatchDeleteAttributes', $params, $delete))
;
}

View File

@@ -8,14 +8,14 @@
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerJsonColumn {
private function _testJson($value) {
private function testJson($value) {
if ((substr($value, 0, 1) == '{' || substr($value, 0, 1) == '[') && ($json = json_decode($value, true))) {
return $json;
}
return $value;
}
private function _buildTable($json) {
private function buildTable($json) {
echo '<table style="margin:2px; font-size:100%;">';
foreach ($json as $key => $val) {
echo '<tr>';
@@ -31,7 +31,7 @@ class AdminerJsonColumn {
}
echo '<code class="jush-js">' . $val . '</code>';
} else {
$this->_buildTable($val);
$this->buildTable($val);
}
echo '</td>';
echo '</tr>';
@@ -40,9 +40,9 @@ class AdminerJsonColumn {
}
function editInput($table, $field, $attrs, $value) {
$json = $this->_testJson($value);
$json = $this->testJson($value);
if ($json !== $value) {
$this->_buildTable($json);
$this->buildTable($json);
}
}
}

View File

@@ -25,11 +25,11 @@ class AdminerPlugin extends Adminer\Adminer {
//! it is possible to use ReflectionObject to find out which plugins defines which methods at once
}
function _callParent($function, $args) {
private function callParent($function, $args) {
return call_user_func_array(array('parent', $function), $args);
}
function _applyPlugin($function, $args) {
private function applyPlugin($function, $args) {
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $function)) {
switch (count($args)) { // call_user_func_array() doesn't work well with references
@@ -62,11 +62,11 @@ class AdminerPlugin extends Adminer\Adminer {
}
}
}
return $this->_callParent($function, $args);
return $this->callParent($function, $args);
}
function _appendPlugin($function, $args) {
$return = $this->_callParent($function, $args);
private function appendPlugin($function, $args) {
$return = $this->callParent($function, $args);
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $function)) {
$value = call_user_func_array(array($plugin, $function), $args);
@@ -82,333 +82,333 @@ class AdminerPlugin extends Adminer\Adminer {
function dumpFormat() {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
return $this->appendPlugin(__FUNCTION__, $args);
}
function dumpOutput() {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
return $this->appendPlugin(__FUNCTION__, $args);
}
function editRowPrint($table, $fields, $row, $update) {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
return $this->appendPlugin(__FUNCTION__, $args);
}
function editFunctions($field) {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
return $this->appendPlugin(__FUNCTION__, $args);
}
// applyPlugin
function name() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function credentials() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function connectSsl() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function permanentLogin($create = false) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function bruteForceKey() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function serverName($server) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function database() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function schemas() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function databases($flush = true) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function queryTimeout() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function headers() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function csp() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function head() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function css() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function loginForm() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function loginFormField($name, $heading, $value) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function login($login, $password) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function tableName($tableStatus) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function fieldName($field, $order = 0) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectLinks($tableStatus, $set = "") {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function foreignKeys($table) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function backwardKeys($table, $tableName) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function backwardKeysPrint($backwardKeys, $row) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectQuery($query, $start, $failed = false) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function sqlCommandQuery($query) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function rowDescription($table) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function rowDescriptions($rows, $foreignKeys) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectLink($val, $field) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectVal($val, $link, $field, $original) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function editVal($val, $field) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function tableStructurePrint($fields) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function tableIndexesPrint($indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectColumnsPrint($select, $columns) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectSearchPrint($where, $columns, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectOrderPrint($order, $columns, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectLimitPrint($limit) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectLengthPrint($text_length) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectActionPrint($indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectCommandPrint() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectImportPrint() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectEmailPrint($emailFields, $columns) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectColumnsProcess($columns, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectSearchProcess($fields, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectOrderProcess($fields, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectLimitProcess() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectLengthProcess() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectEmailProcess($where, $foreignKeys) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function selectQueryBuild($select, $where, $group, $order, $limit, $page) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function messageQuery($query, $time, $failed = false) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function editInput($table, $field, $attrs, $value) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function editHint($table, $field, $value) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function processInput($field, $value, $function = "") {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function dumpDatabase($db) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function dumpTable($table, $style, $is_view = 0) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function dumpData($table, $style, $query) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function dumpFilename($identifier) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function dumpHeaders($identifier, $multi_table = false) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function importServerPath() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function homepage() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function navigation($missing) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function databasesPrint($missing) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
function tablesPrint($tables) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
return $this->applyPlugin(__FUNCTION__, $args);
}
}

View File

@@ -10,7 +10,7 @@ class AdminerPrettyJsonColumn {
$this->adminer = $adminer;
}
private function _testJson($value) {
private function testJson($value) {
if ((substr($value, 0, 1) == '{' || substr($value, 0, 1) == '[') && ($json = json_decode($value, true))) {
return $json;
}
@@ -18,7 +18,7 @@ class AdminerPrettyJsonColumn {
}
function editInput($table, $field, $attrs, $value) {
$json = $this->_testJson($value);
$json = $this->testJson($value);
if ($json !== $value) {
$jsonText = json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
return <<<HTML
@@ -30,7 +30,7 @@ HTML;
function processInput($field, $value, $function = '') {
if ($function === '') {
$json = $this->_testJson($value);
$json = $this->testJson($value);
if ($json !== $value) {
$value = json_encode($json);
}

View File

@@ -17,14 +17,14 @@ class AdminerSqlLog {
}
function messageQuery($query, $time, $failed = false) {
$this->_log($query);
$this->log($query);
}
function sqlCommandQuery($query) {
$this->_log($query);
$this->log($query);
}
function _log($query) {
private function log($query) {
if ($this->filename == "") {
$adminer = Adminer\adminer();
$this->filename = $adminer->database() . ".sql"; // no database goes to ".sql" to avoid collisions

View File

@@ -18,7 +18,7 @@ CREATE TABLE translation (
*/
class AdminerTranslation {
function _translate($idf) {
private function translate($idf) {
static $translations, $lang;
if ($lang === null) {
$lang = Adminer\get_lang();
@@ -39,16 +39,16 @@ class AdminerTranslation {
}
function tableName(&$tableStatus) {
$tableStatus["Comment"] = $this->_translate($tableStatus["Comment"]);
$tableStatus["Comment"] = $this->translate($tableStatus["Comment"]);
}
function fieldName(&$field, $order = 0) {
$field["comment"] = $this->_translate($field["comment"]);
$field["comment"] = $this->translate($field["comment"]);
}
function editVal(&$val, $field) {
if ($field["type"] == "enum") {
$val = $this->_translate($val);
$val = $this->translate($val);
}
}
}