Skip to content

Commit b1e3fe8

Browse files
kojiromikeclaude
andauthored
Merge commit from fork
* refactor: use escaped translation functions consistently Replace direct xl() calls with properly escaped wrappers to ensure consistent string sanitization in translation output: - Add xlx() function for XML context (xl + xmlEscape) - Add type declarations to xl wrapper functions (xlt, xla, xlj, xlx) - Update Smarty {xl} plugin to use xlt() for HTML context - Use xmlEscape/xlx() for XML output in AclExtended.php - Use xlt() for HTML output in controllers and templates - Use text() for dynamic values in HTML context * refactor: replace xls() with xlj() for JavaScript strings Migrate all xls() calls to xlj() which uses proper js_escape() instead of addslashes() for consistent JavaScript string handling. Updated 28 occurrences across 10 files. * refactor(Billing): remove unused return value from arSetupSecondary The return value was never used by any caller - the function is called purely for its side effects (updating claims via BillingUtilities). Added void return type to make this explicit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(Smarty): remove unescaped xl translation function Remove the {xl} Smarty plugin and migrate all usages to escaped variants: - {xlt} for text content - {xla} for HTML attributes This forces developers to use explicit escaped variants and eliminates a potential XSS footgun. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(Zend): remove unsafe z_xl() translation wrapper Remove z_xl() which wrapped the unescaped xl() function. All usages migrated to z_xlt() which properly escapes output for HTML text context. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 66fcce1 commit b1e3fe8

File tree

17 files changed

+43
-100
lines changed

17 files changed

+43
-100
lines changed

controllers/C_Document.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public function note_action_process($patient_id)
416416
$temp_url = $GLOBALS['OE_SITE_DIR'] . '/documents/' . $from_pathname . '/' . $from_filename;
417417
}
418418
if (!file_exists($temp_url)) {
419-
echo xl('The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it.') . ' ' . $temp_url;
419+
echo xlt('The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it.') . ' ' . text($temp_url);
420420
}
421421
$url = $temp_url;
422422
$pdetails = getPatientData($patient_id);

controllers/C_Prescription.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ function multiprintcss_preheader()
649649
echo ("}\n");
650650
echo ("</style>\n");
651651

652-
echo ("<title>" . xl('Prescription') . "</title>\n");
652+
echo ("<title>" . xlt('Prescription') . "</title>\n");
653653
echo ("</head>\n");
654654
echo ("<body>\n");
655655
}
@@ -706,8 +706,8 @@ function multiprint_footer(&$pdf)
706706
function multiprintcss_footer()
707707
{
708708
echo ("<div class='signdiv'>\n");
709-
echo (xl('Signature') . ":________________________________<br />");
710-
echo (xl('Date') . ": " . date('Y-m-d'));
709+
echo (xlt('Signature') . ":________________________________<br />");
710+
echo (xlt('Date') . ": " . text(date('Y-m-d')));
711711
echo ("</div>\n");
712712
echo ("</div>\n");
713713
}

interface/billing/sl_eob_process.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ class: $class,
841841
<?php echo xlt('Amount'); ?>&nbsp;
842842
</td>
843843
<td class="dehead" align="right">
844-
<?php echo xl('Balance'); ?>&nbsp;
844+
<?php echo xlt('Balance'); ?>&nbsp;
845845
</td>
846846
</tr>
847847

interface/clickmap/template/general_new.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
{if !$reportMode}
2727
<div class="col-12">
2828
<div class="btn-group">
29-
<button class="btn btn-primary btn-save" id="btn_save">{xl t="Save"}</button>
30-
<button class="btn btn-secondary btn-delete" id="btn_clear">{xl t="Clear"}</button>
31-
<button class="btn btn-secondary btn-cancel" onclick="top.restoreSession(); location.href='javascript:parent.closeTab(window.name, false)'">{xl t="Cancel"}</button>
29+
<button class="btn btn-primary btn-save" id="btn_save">{xlt t="Save"}</button>
30+
<button class="btn btn-secondary btn-delete" id="btn_clear">{xlt t="Clear"}</button>
31+
<button class="btn btn-secondary btn-cancel" onclick="top.restoreSession(); location.href='javascript:parent.closeTab(window.name, false)'">{xlt t="Cancel"}</button>
3232
</div>
3333
<p>
34-
{xl t="Click a spot on the graphic to add a new annotation, click it again to remove it"} <br/>
35-
{xl t="The 'Clear' button will remove all annotations."}
34+
{xlt t="Click a spot on the graphic to add a new annotation, click it again to remove it"} <br/>
35+
{xlt t="The 'Clear' button will remove all annotations."}
3636
</p>
3737
</div>
3838
{/if}

interface/forms/ros/templates/ros/general_new.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<html>
1111
<head>
1212

13-
<title>{xl t='Review Of Systems'|text}</title>
13+
<title>{xlt t='Review Of Systems'}</title>
1414

1515
{headerTemplate}
1616

interface/modules/zend_modules/module/Application/src/Application/Controller/IndexController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function ajaxZxlAction()
5050
{
5151
$request = $this->getRequest();
5252
$message = $request->getPost()->msg;
53-
$array = ['msg' => $this->listenerObject->z_xl($message)];
53+
$array = ['msg' => $this->listenerObject->z_xlt($message)];
5454
$return = new JsonModel($array);
5555
return $return;
5656
}

interface/modules/zend_modules/module/Application/src/Application/Listener/Listener.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@ public function detach(EventManagerInterface $events, $priority = 1)
5151
}
5252
}
5353

54-
/**
55-
* Language converter
56-
* @param string $str
57-
* @return string
58-
*/
59-
public static function z_xl($str)
60-
{
61-
return xl($str);
62-
}
63-
6454
/**
6555
* Language converter
6656
* @param string $str
@@ -80,5 +70,4 @@ public static function z_xla($str)
8070
{
8171
return xla($str);
8272
}
83-
8473
}

interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/EncounterccdadispatchTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4336,7 +4336,7 @@ public function getPlanOfCare($pid, $encounter)
43364336
<code_text>" . xmlEscape($row['codetext']) . "</code_text>
43374337
<date>" . xmlEscape($row['date']) . "</date>
43384338
<date_formatted>" . xmlEscape(str_replace("-", '', $row['date'])) . "</date_formatted>
4339-
<assessment>" . xmlEscape(xl('Encounter')) . "</assessment>
4339+
<assessment>" . xlx('Encounter') . "</assessment>
43404340
</concern>";
43414341
}
43424342
// Goal (SNOMED CT or LOINC)

interface/modules/zend_modules/module/Multipledb/src/Multipledb/Controller/MultipledbController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function indexAction()
5656
$this->getCssFiles();
5757
$this->layout()->setVariable('jsFiles', $this->jsFiles);
5858
$this->layout()->setVariable('cssFiles', $this->cssFiles);
59-
$this->layout()->setVariable("title", $this->listenerObject->z_xl("Multiple DataBase"));
59+
$this->layout()->setVariable("title", $this->listenerObject->z_xlt("Multiple DataBase"));
6060
$this->checkAcl();
6161

6262
return new ViewModel([
@@ -74,7 +74,7 @@ public function editAction()
7474
$this->getCssFiles();
7575
$this->layout()->setVariable('jsFiles', $this->jsFiles);
7676
$this->layout()->setVariable('cssFiles', $this->cssFiles);
77-
$this->layout()->setVariable("title", $this->listenerObject->z_xl("Multiple DataBase"));
77+
$this->layout()->setVariable("title", $this->listenerObject->z_xlt("Multiple DataBase"));
7878
$this->checkAcl('write');
7979

8080
return new ViewModel([
@@ -130,7 +130,7 @@ public function generatesafekeyAction()
130130
$this->getCssFiles();
131131
$this->layout()->setVariable('jsFiles', $this->jsFiles);
132132
$this->layout()->setVariable('cssFiles', $this->cssFiles);
133-
$this->layout()->setVariable("title", $this->listenerObject->z_xl("Multiple DataBase"));
133+
$this->layout()->setVariable("title", $this->listenerObject->z_xlt("Multiple DataBase"));
134134
$this->checkAcl('write');
135135

136136
return new ViewModel([

interface/modules/zend_modules/module/Patientvalidation/src/Patientvalidation/Controller/PatientvalidationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function indexAction()
7979
$this->getCssFiles();
8080
$this->layout()->setVariable('jsFiles', $this->jsFiles);
8181
$this->layout()->setVariable('cssFiles', $this->cssFiles);
82-
$this->layout()->setVariable("title", $this->listenerObject->z_xl("Patient validation"));
82+
$this->layout()->setVariable("title", $this->listenerObject->z_xlt("Patient validation"));
8383
$this->layout()->setVariable("translate", $this->translate);
8484

8585
$relatedPatients = $this->getAllRealatedPatients();

0 commit comments

Comments
 (0)