Skip to content

Commit

Permalink
Fix phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 23, 2022
1 parent 64ce13e commit 2f0040e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions htdocs/core/lib/admin.lib.php
Expand Up @@ -320,6 +320,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
// Loop on each request to execute request
$cursorinsert = 0;
$listofinsertedrowid = array();
$keyforsql = md5($sqlfile);
foreach ($arraysql as $i => $sql) {
if ($sql) {
// Replace the prefix tables
Expand All @@ -335,7 +336,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle

// Add log of request
if (!$silent) {
print '<tr class="trforrunsql'.md5($sqlfile).'"><td class="tdtop opacitymedium"'.($colspan ? ' colspan="'.$colspan.'"' : '').'>'.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'</td></tr>\n";
print '<tr class="trforrunsql'.$keyforsql.'"><td class="tdtop opacitymedium"'.($colspan ? ' colspan="'.$colspan.'"' : '').'>'.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'</td></tr>\n";
}
dol_syslog('Admin.lib::run_sql Request '.($i + 1), LOG_DEBUG);
$sqlmodified = 0;
Expand Down Expand Up @@ -454,18 +455,18 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
//if (!empty($conf->use_javascript_ajax)) { // use_javascript_ajax is not defined
print '<script type="text/javascript">
jQuery(document).ready(function() {
function init_trrunsql'.md5($sqlfile).'()
function init_trrunsql'.$keyforsql.'()
{
console.log("toggle .trforrunsql'.md5($sqlfile).'");
jQuery(".trforrunsql'.md5($sqlfile).'").toggle();
console.log("toggle .trforrunsql'.$keyforsql.'");
jQuery(".trforrunsql'.$keyforsql.'").toggle();
}
init_trrunsql'.md5($sqlfile).'();
jQuery(".trforrunsqlshowhide'.md5($sqlfile).'").click(function() {
init_trrunsql'.md5($sqlfile).'();
init_trrunsql'.$keyforsql.'();
jQuery(".trforrunsqlshowhide'.$keyforsql.'").click(function() {
init_trrunsql'.$keyforsql.'();
});
});
</script>';
print ' - <a class="trforrunsqlshowhide'.md5($sqlfile).'" href="#">'.$langs->trans("ShowHideDetails").'</a>';
print ' - <a class="trforrunsqlshowhide'.$keyforsql.'" href="#">'.$langs->trans("ShowHideDetails").'</a>';
//}

print '</td></tr>'."\n";
Expand Down
2 changes: 1 addition & 1 deletion test/phpunit/CodingPhpTest.php
Expand Up @@ -444,7 +444,7 @@ public function testPHP()
$matches=array();
preg_match_all('/GETPOST\s*\(([^\)]+),\s*["\']none["\']/i', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
var_dump($val);
//var_dump($val);
if (!in_array($val[1], array(
"'replacestring'", "'htmlheader'", "'WEBSITE_HTML_HEADER'", "'WEBSITE_CSS_INLINE'", "'WEBSITE_JS_INLINE'", "'WEBSITE_MANIFEST_JSON'", "'PAGE_CONTENT'", "'WEBSITE_README'",
"'search_status'", '"mysqldump"', '"postgresqldump"', "'db_pass_root'", "'db_pass'", '"pass"', '"pass1"', '"pass2"', '"password"', "'password'", '"MAIN_MAIL_SMTPS_PW"'))) {
Expand Down

0 comments on commit 2f0040e

Please sign in to comment.