Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3de8816

Browse files
committed
Replace PMA_String uses by mb_* calls.
Remove part of unused variables. Signed-off-by: Hugues Peccatte <[email protected]>
1 parent 38eb594 commit 3de8816

141 files changed

Lines changed: 1171 additions & 1360 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

changelog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
if (is_readable($filename)) {
2424

2525
// Test if the if is in a compressed format
26-
if ($GLOBALS['PMA_String']->substr($filename, -3) == '.gz') {
26+
if (/*overload*/mb_substr($filename, -3) == '.gz') {
2727
ob_start();
2828
readgzfile($filename);
2929
$changelog = ob_get_contents();

db_operations.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535
/** @var PMA_String $pmaString */
3636
$pmaString = $GLOBALS['PMA_String'];
37-
if ($pmaString->strlen($GLOBALS['db'])
37+
if (/*overload*/mb_strlen($GLOBALS['db'])
3838
&& (! empty($_REQUEST['db_rename']) || ! empty($_REQUEST['db_copy']))
3939
) {
4040
if (! empty($_REQUEST['db_rename'])) {
@@ -44,7 +44,7 @@
4444
}
4545

4646
if (! isset($_REQUEST['newname'])
47-
|| ! $pmaString->strlen($_REQUEST['newname'])
47+
|| ! /*overload*/mb_strlen($_REQUEST['newname'])
4848
) {
4949
$message = PMA_Message::error(__('The database name is empty!'));
5050
} else {

db_printview.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
$odd_row = true;
6060
foreach ($tables as $sts_data) {
6161
if (PMA_Table::isMerge($db, $sts_data['TABLE_NAME'])
62-
|| $GLOBALS['PMA_String']->strtoupper($sts_data['ENGINE']) == 'FEDERATED'
62+
|| /*overload*/mb_strtoupper($sts_data['ENGINE']) == 'FEDERATED'
6363
) {
6464
$merged_size = true;
6565
} else {

examples/openid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function Show_page($contents)
7979

8080
$realm = $base . '/';
8181
$returnTo = $base . dirname($_SERVER['PHP_SELF']);
82-
if ($returnTo[$GLOBALS['PMA_String']->strlen($returnTo) - 1] != '/') {
82+
if ($returnTo[/*overload*/mb_strlen($returnTo) - 1] != '/') {
8383
$returnTo .= '/';
8484
}
8585
$returnTo .= 'openid.php';

export.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
if ($export_type == 'server') {
244244
$err_url = 'server_export.php?' . PMA_URL_getCommon();
245245
} elseif ($export_type == 'database'
246-
&& $pmaString->strlen($db)
246+
&& /*overload*/mb_strlen($db)
247247
) {
248248
$err_url = 'db_export.php?' . PMA_URL_getCommon($db);
249249
// Check if we have something to export
@@ -252,8 +252,8 @@
252252
} else {
253253
$tables = array();
254254
}
255-
} elseif ($export_type == 'table' && $pmaString->strlen($db)
256-
&& $pmaString->strlen($table)
255+
} elseif ($export_type == 'table' && /*overload*/mb_strlen($db)
256+
&& /*overload*/mb_strlen($table)
257257
) {
258258
$err_url = 'tbl_export.php?' . PMA_URL_getCommon($db, $table);
259259
} else {

file_echo.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646

4747
/* Decode data */
4848
if ($extension != 'svg') {
49-
$data = $pmaString->substr(
49+
$data = /*overload*/mb_substr(
5050
$_REQUEST['image'],
51-
$pmaString->strpos($_REQUEST['image'], ',') + 1
51+
/*overload*/mb_strpos($_REQUEST['image'], ',') + 1
5252
);
5353
$data = base64_decode($data);
5454
} else {
@@ -59,7 +59,7 @@
5959
PMA_downloadHeader(
6060
$filename,
6161
$_REQUEST['type'],
62-
$pmaString->strlen($data)
62+
/*overload*/mb_strlen($data)
6363
);
6464

6565
/* Send data */

gis_data_editor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ function escape($variable)
4747
// Extract from field's values if available, if not use the column type passed.
4848
if (! isset($gis_data['gis_type'])) {
4949
if (isset($_REQUEST['type']) && $_REQUEST['type'] != '') {
50-
$gis_data['gis_type'] = $pmaString->strtoupper($_REQUEST['type']);
50+
$gis_data['gis_type'] = /*overload*/mb_strtoupper($_REQUEST['type']);
5151
}
5252
if (isset($_REQUEST['value']) && trim($_REQUEST['value']) != '') {
53-
$start = ($pmaString->substr($_REQUEST['value'], 0, 1) == "'") ? 1 : 0;
54-
$gis_data['gis_type'] = $pmaString->substr(
53+
$start = (/*overload*/mb_substr($_REQUEST['value'], 0, 1) == "'") ? 1 : 0;
54+
$gis_data['gis_type'] = /*overload*/mb_substr(
5555
$_REQUEST['value'],
5656
$start,
57-
$pmaString->strpos($_REQUEST['value'], "(") - $start
57+
/*overload*/mb_strpos($_REQUEST['value'], "(") - $start
5858
);
5959
}
6060
if ((! isset($gis_data['gis_type']))

import.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,17 +240,17 @@
240240
$goto = 'server_import.php';
241241
} else {
242242
if (empty($goto) || !preg_match('@^(server|db|tbl)(_[a-z]*)*\.php$@i', $goto)) {
243-
if ($pmaString->strlen($table) && $pmaString->strlen($db)) {
243+
if (/*overload*/mb_strlen($table) && /*overload*/mb_strlen($db)) {
244244
$goto = 'tbl_structure.php';
245-
} elseif ($pmaString->strlen($db)) {
245+
} elseif (/*overload*/mb_strlen($db)) {
246246
$goto = 'db_structure.php';
247247
} else {
248248
$goto = 'server_sql.php';
249249
}
250250
}
251-
if ($pmaString->strlen($table) && $pmaString->strlen($db)) {
251+
if (/*overload*/mb_strlen($table) && /*overload*/mb_strlen($db)) {
252252
$common = PMA_URL_getCommon($db, $table);
253-
} elseif ($pmaString->strlen($db)) {
253+
} elseif (/*overload*/mb_strlen($db)) {
254254
$common = PMA_URL_getCommon($db);
255255
} else {
256256
$common = PMA_URL_getCommon();
@@ -268,7 +268,7 @@
268268
}
269269

270270

271-
if ($pmaString->strlen($db)) {
271+
if (/*overload*/mb_strlen($db)) {
272272
$GLOBALS['dbi']->selectDb($db);
273273
}
274274

@@ -392,13 +392,13 @@
392392
}
393393

394394
// Calculate value of the limit
395-
if ($pmaString->strtolower($pmaString->substr($memory_limit, -1)) == 'm') {
396-
$memory_limit = (int)$pmaString->substr($memory_limit, 0, -1) * 1024 * 1024;
397-
} elseif ($pmaString->strtolower($pmaString->substr($memory_limit, -1)) == 'k') {
398-
$memory_limit = (int)$pmaString->substr($memory_limit, 0, -1) * 1024;
399-
} elseif ($pmaString->strtolower($pmaString->substr($memory_limit, -1)) == 'g') {
395+
if (/*overload*/mb_strtolower(/*overload*/mb_substr($memory_limit, -1)) == 'm') {
396+
$memory_limit = (int)/*overload*/mb_substr($memory_limit, 0, -1) * 1024 * 1024;
397+
} elseif (/*overload*/mb_strtolower(/*overload*/mb_substr($memory_limit, -1)) == 'k') {
398+
$memory_limit = (int)/*overload*/mb_substr($memory_limit, 0, -1) * 1024;
399+
} elseif (/*overload*/mb_strtolower(/*overload*/mb_substr($memory_limit, -1)) == 'g') {
400400
$memory_limit
401-
= (int)$pmaString->substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
401+
= (int)/*overload*/mb_substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
402402
} else {
403403
$memory_limit = (int)$memory_limit;
404404
}
@@ -680,7 +680,7 @@
680680
// in case of a query typed in the query window
681681
// (but if the query is too large, in case of an imported file, the parser
682682
// can choke on it so avoid parsing)
683-
if ($pmaString->strlen($sql_query) <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']
683+
if (/*overload*/mb_strlen($sql_query) <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']
684684
) {
685685
include_once 'libraries/parse_analyze.inc.php';
686686
}

index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,8 @@
562562

563563
$_client_info = $GLOBALS['dbi']->getClientInfo();
564564
if ($server > 0
565-
&& $pmaString->strpos($_client_info, 'mysqlnd') === false
566-
&& $pmaString->substr(PMA_MYSQL_CLIENT_API, 0, 3) != $pmaString->substr(
565+
&& /*overload*/mb_strpos($_client_info, 'mysqlnd') === false
566+
&& /*overload*/mb_substr(PMA_MYSQL_CLIENT_API, 0, 3) != /*overload*/mb_substr(
567567
PMA_MYSQL_INT_VERSION, 0, 3
568568
)
569569
) {
@@ -572,10 +572,10 @@
572572
sprintf(
573573
__('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
574574
$_client_info,
575-
$pmaString->substr(
575+
/*overload*/mb_substr(
576576
PMA_MYSQL_STR_VERSION,
577577
0,
578-
$pmaString->strpos(PMA_MYSQL_STR_VERSION . '-', '-')
578+
/*overload*/mb_strpos(PMA_MYSQL_STR_VERSION . '-', '-')
579579
)
580580
)
581581
),

libraries/Advisor.class.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,17 +382,14 @@ public static function parseRulesFile()
382382
$ruleNo = -1;
383383
$ruleLine = -1;
384384

385-
/** @var PMA_String $pmaString */
386-
$pmaString = $GLOBALS['PMA_String'];
387-
388385
for ($i = 0; $i < $numLines; $i++) {
389386
$line = $file[$i];
390387
if ($line == "" || $line[0] == '#') {
391388
continue;
392389
}
393390

394391
// Reading new rule
395-
if ($pmaString->substr($line, 0, 4) == 'rule') {
392+
if (/*overload*/mb_substr($line, 0, 4) == 'rule') {
396393
if ($ruleLine > 0) {
397394
$errors[] = sprintf(
398395
__(
@@ -447,7 +444,7 @@ public static function parseRulesFile()
447444
continue;
448445
}
449446
$rules[$ruleNo][$ruleSyntax[$ruleLine]] = chop(
450-
$pmaString->substr($line, 1)
447+
/*overload*/mb_substr($line, 1)
451448
);
452449
$lines[$ruleNo][$ruleSyntax[$ruleLine]] = $i + 1;
453450
$ruleLine += 1;

0 commit comments

Comments
 (0)