function printT3Diff($sourcesDiff) { $out = '<pre width="10"><table border="0" cellspacing="0" cellpadding="0" style="width:780px;padding:8px;">'; $out .= '<tr><td style="background-color: #FDD;"><strong>Local file</strong></td></tr>'; $out .= '<tr><td style="background-color: #DFD;"><strong>TER file</strong></td></tr>'; if (version_compare(TYPO3_version, '7.6.0', '>=')) { $out .= $sourcesDiff; } else { unset($sourcesDiff[0]); unset($sourcesDiff[1]); foreach ($sourcesDiff as $line => $content) { switch (substr($content, 0, 1)) { case '+': $out .= '<tr><td style="background-color: #DFD;">' . formatcode($content) . '</td></tr>'; break; case '-': $out .= '<tr><td style="background-color: #FDD;">' . formatcode($content) . '</td></tr>'; break; case '@': $out .= '<tr><td><br/><br/><br/></td></tr>'; $out .= '<tr><td><strong>' . formatcode($content) . '</strong></td></tr>'; break; default: $out .= '<tr><td>' . formatcode($content) . '</td></tr>'; } } } $out .= '</table></pre>'; echo $out; }
if (!defined("IN_FUSION")) { die("Access Denied"); } if (preg_match("/\\/forum\\//i", FUSION_REQUEST)) { global $data; } $code_count = substr_count($text, "[code]"); // obtained for ($i = 0; $i < $code_count; $i++) { if (phpversion() > 5.4) { $text = preg_replace_callback("#\\[code\\](.*?)\\[/code\\]#si", function ($m) use(&$i) { global $data; require LOCALE . LOCALESET . "bbcodes/code.php"; if (preg_match("/\\/forum\\//i", FUSION_REQUEST) && isset($_GET['thread_id']) && (isset($data['post_id']) && isnum($data['post_id']))) { // this one rely on global. $code_save = "<a class='pull-right m-t-0 btn btn-sm btn-default' href='" . INCLUDES . "bbcodes/code_bbcode_save.php?thread_id=" . $_GET['thread_id'] . "&post_id=" . $data['post_id'] . "&code_id=" . $i . "'><i class='entypo download'></i> " . $locale['bb_code_save'] . "</a> "; } else { $code_save = ""; } $i++; return "<div class='code_bbcode'/><div class='tbl-border tbl2 tbl-code'><strong/>" . $locale['bb_code_code'] . "</strong>" . $code_save . "</div>\n <div class='tbl-border tbl1' style='width:100%; white-space:nowrap;overflow:auto;'><pre class='prettyprint linenums' style='white-space:nowrap'>" . formatcode($m['1']) . "</pre></div></div>"; }, $text); } else { if (preg_match("/\\/forum\\//i", FUSION_REQUEST) && isset($data['post_id'])) { $code_save = "<a class=\\'pull-right m-t-0 btn btn-sm btn-default\\' href=\\'" . INCLUDES . "bbcodes/code_bbcode_save.php?thread_id=" . $_GET['thread_id'] . "&post_id=" . $data['post_id'] . "&code_id=" . $i . "\\'><i class=\\'entypo download\\'></i> " . $locale['bb_code_save'] . "</a> "; } else { $code_save = ""; } $text = preg_replace("#\\[code\\](.*?)\\[/code\\]#sie", "'<div class=\\'code_bbcode\\'><div class=\\'tbl-border tbl2 tbl-code\\'><strong/>" . $locale['bb_code_code'] . "</strong>" . $code_save . "</div><div class=\\'tbl-border tbl1\\' style=\\'width:100%;white-space:nowrap;overflow:auto\\'><pre class=\\'prettyprint linenums\\' style=\\'white-space:nowrap\\'/>'.formatcode('\\1').'</pre></div></div>'", $text, 1); } }