Skip to content

Commit

Permalink
PHP7 Project. Commit 20. Fixes in calendar module.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev2-PracticeProvider authored and bradymiller committed Mar 8, 2016
1 parent 5b0643b commit 5ef4515
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
28 changes: 15 additions & 13 deletions interface/main/calendar/includes/pnAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,12 +684,7 @@ function pnVarPrepHTMLDisplay()
// Note that the use of \024 and \022 are needed to ensure that
// this does not break HTML tags that might be around either
// the username or the domain name
static $search = array('/([^\024])@([^\022])/se');

static $replace = array('"&#" .
sprintf("%03d", ord("\\1")) .
";@&#" .
sprintf("%03d", ord("\\2")) . ";";');
static $search = array('/([^\024])@([^\022])/s');

static $allowedhtml;

Expand All @@ -716,18 +711,25 @@ function pnVarPrepHTMLDisplay()

// Prepare var
$ourvar = htmlspecialchars($ourvar);
$ourvar = preg_replace($search, $replace, $ourvar);
$ourvar = preg_replace_callback($search,
function ($matches) {
return "&#" .
sprintf("%03d", ord($matches[1])) .
";@&#" .
sprintf("%03d", ord($matches[2])) . ";";
},
$ourvar);

// Fix the HTML that we want
$ourvar = preg_replace('/\022([^\024]*)\024/e',
"'<' . strtr('\\1', array('&gt;' => '>',
'&lt;' => '<',
'&quot;' => '\"'))
. '>';", $ourvar);
$ourvar = preg_replace_callback('/\022([^\024]*)\024/',
function ($matches) {
return '<' . strtr("$matches[1]", array('&gt;' => '>', '&lt;' => '<', '&quot;' => '\"')) . '>';
}
, $ourvar);

// Fix entities if required
if (pnConfigGetVar('htmlentities')) {
$ourvar = preg_replace('/&amp;([a-z#0-9]+);/i', "&\\1;", $ourvar);
$ourvar = preg_replace_callback('/&amp;([a-z#0-9]+);/i', function ($matches) { return "&$matches[1];";}, $ourvar);
}

// Add to array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
[-/foreach-]
</select>
</td>
[-if (($GLOBALS['translate_appt_categories']) && ($_SESSION['language_choice'] > 1))-]
[-if ($GLOBALS['translate_appt_categories'] && ($_SESSION['language_choice'] > 1))-]
<td valign="top" align="left">[-$_PC_CAT_NAME_XL-]:<br />
<span style="color:green">[-$cat.nameTranslate-]</span>
</td>
Expand All @@ -225,7 +225,7 @@
[-$_PC_CAT_DESC-]:<br />
&nbsp;<textarea name="desc[]" rows="3" cols="20">[-$cat.desc-]</textarea>
</td>
[-if (($GLOBALS['translate_appt_categories']) && ($_SESSION['language_choice'] > 1))-]
[-if ($GLOBALS['translate_appt_categories'] && ($_SESSION['language_choice'] > 1))-]
<td valign="top" align="left">[-$_PC_CAT_DESC_XL-]:<br />
<span style="color:green">[-$cat.descTranslate-]</span>
</td>
Expand Down

0 comments on commit 5ef4515

Please sign in to comment.