Skip to content

Commit cbd10aa

Browse files
committed
php 5.2 and nginx related compatibility updates
1 parent 099dad1 commit cbd10aa

10 files changed

Lines changed: 18 additions & 9 deletions

File tree

Docs/changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ version 3.7
44
Updates:
55

66
Bufixes:
7+
- fixes issues starting up MyWebSQL when running php as FCGi in nginx server
8+
- corrupt output on some php configuration, mainly due to incompatible settings
79
- list of table was not displayed for PostgreSQL databases when import a single table data from csv files
810
- on some php configurations, database selection did not work due to cookies and request variables being merged
911
- insert queries generated for some Pgsql databases failed to execute due to syntax errors

config/constants.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
// below is required to adjust for serverside php configuration changes
2121
ini_set("display_errors", "off");
22-
ini_set('zlib.output_compression', 'On');
22+
if ( !isset($_SERVER['FCGI_ROLE'])) // for running as fcgi pass through, compression needs to be off
23+
ini_set('zlib.output_compression', 'On');
2324
ini_set('output_buffering', 'Off');
2425

2526
if (!function_exists('v'))

js/tables.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ $.fn.setSearchFilter = function(text) {
465465

466466
// Trigger `beforetablesort` event that calling scripts can hook into;
467467
// pass parameters for sorted column index and sorting direction
468-
$table.trigger("beforetablesort", {column: th_index, direction: sort_dir});
468+
//$table.trigger("beforetablesort", {column: th_index, direction: sort_dir});
469469
// More reliable method of forcing a redraw
470470
$table.css("display");
471471

@@ -505,8 +505,10 @@ $.fn.setSearchFilter = function(text) {
505505
$table.find("thead th:eq("+th_index+") div").append( sort_dir == dir.ASC ? "<span>&nbsp;&#x25B4;<span>" : "<span>&nbsp;&#x25BE;<span>");
506506
resizeTableHeader('info');
507507

508+
// reset first index numbering
509+
$("tbody tr", $table).each(function(i) { $("td:eq(0)", this).html(i+1); });
508510
// Trigger `aftertablesort` event. Similar to `beforetablesort`
509-
$table.trigger("aftertablesort", {column: th_index, direction: sort_dir});
511+
//$table.trigger("aftertablesort", {column: th_index, direction: sort_dir});
510512
// More reliable method of forcing a redraw
511513
$table.css("display");
512514
}, 10);

lib/db/manager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@ function getError() {
5252
}
5353
}
5454

55+
function replace_single_quotes($s) {
56+
return str_replace("''", "'", $s);
57+
}
58+
5559
?>

lib/db/mysql4.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ function getFieldValues($table, $name) {
442442
if (phpCheck(5.3)) {
443443
$regex = "/\('(.*)'\)/";
444444
preg_match_all($regex, $row['Type'], $list);
445-
return array_map(function($s) { return str_replace("''", "'", $s); }, explode("','", $list[1][0]));
445+
return array_map('replace_single_quotes', explode("','", $list[1][0]));
446446
} else {
447447
$list = explode(',', $matches[1]);
448448
foreach($list as $k => $v)

lib/db/mysql5.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ function getFieldValues($table, $name) {
523523
if (phpCheck(5.3)) {
524524
$regex = "/\('(.*)'\)/";
525525
preg_match_all($regex, $row['Type'], $list);
526-
return array_map(function($s) { return str_replace("''", "'", $s); }, explode("','", $list[1][0]));
526+
return array_map('replace_single_quotes', explode("','", $list[1][0]));
527527
} else {
528528
$list = explode(',', $matches[1]);
529529
foreach($list as $k => $v)

lib/db/mysqli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ function getFieldValues($table, $name) {
541541
if (phpCheck(5.3)) {
542542
$regex = "/\('(.*)'\)/";
543543
preg_match_all($regex, $row['Type'], $list);
544-
return array_map(function($s) { return str_replace("''", "'", $s); }, explode("','", $list[1][0]));
544+
return array_map('replace_single_quotes', explode("','", $list[1][0]));
545545
} else {
546546
$list = explode(',', $matches[1]);
547547
foreach($list as $k => $v)

lib/db/pgsql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ function getFieldValues($table, $name) {
515515
if (phpCheck(5.3)) {
516516
$regex = "/\('(.*)'\)/";
517517
preg_match_all($regex, $row['Type'], $list);
518-
return array_map(function($s) { return str_replace("''", "'", $s); }, explode("','", $list[1][0]));
518+
return array_map('replace_single_quotes', explode("','", $list[1][0]));
519519
} else {
520520
$list = explode(',', $matches[1]);
521521
foreach($list as $k => $v)

lib/db/sqlite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ function getFieldValues($table, $name) {
491491
if (phpCheck(5.3)) {
492492
$regex = "/\('(.*)'\)/";
493493
preg_match_all($regex, $row['Type'], $list);
494-
return array_map(function($s) { return str_replace("''", "'", $s); }, explode("','", $list[1][0]));
494+
return array_map('replace_single_quotes', explode("','", $list[1][0]));
495495
} else {
496496
$list = explode(',', $matches[1]);
497497
foreach($list as $k => $v)

lib/util.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ function createSimpleGrid(&$db, $message) {
282282
$ed = false;
283283
// ------------ print header -----------
284284
print "<tr id=\"fhead\">";
285-
print "<th class=\"th\" data-sort=\"numeric\"><div>#</div></th>";
285+
print "<th class=\"th index\"><div>#</div></th>";
286286

287287
$v = "";
288288

0 commit comments

Comments
 (0)