summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-10-07 12:11:24 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-10-07 12:11:24 +0200
commitb12d7cb03ab1ef63baab4a8d4b1380e6990c1437 (patch)
tree334f94ac32eea9d7fed7850b4a966e3dadb299c2 /application/controllers
parent2b96989122a92ca5ce9715328a6b21fa33421d31 (diff)
c/file/download: display an error if highlighting fails
Previously we displayed an empty page since stderr usually goes to the error log of the web server. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/file.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 752d796cc..9616c0fc6 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -169,24 +169,28 @@ class File extends CI_Controller {
ob_start();
if ($mode == "rmd") {
echo '<td class="markdownrender">'."\n";
- passthru('perl '.FCPATH.'scripts/Markdown.pl '.escapeshellarg($file));
+ passthru('perl '.FCPATH.'scripts/Markdown.pl '.escapeshellarg($file), $return_value);
} elseif ($mode == "ascii") {
echo '<td class="code"><pre class="text">'."\n";
- passthru('perl '.FCPATH.'scripts/ansi2html '.escapeshellarg($file));
+ passthru('perl '.FCPATH.'scripts/ansi2html '.escapeshellarg($file), $return_value);
echo "</pre>\n";
} else {
echo '<td class="numbers"><pre>';
// generate line numbers (links)
- passthru('perl -ne \'print "<a href=\"#n$.\" id=\"n$.\">$.</a>\n"\' '.escapeshellarg($file));
+ passthru('perl -ne \'print "<a href=\"#n$.\" id=\"n$.\">$.</a>\n"\' '.escapeshellarg($file), $return_value);
echo '</pre></td><td class="code">'."\n";
- passthru('pygmentize -F codetagify -O encoding=guess,outencoding=utf8 -l '.escapeshellarg($mode).' -f html '.escapeshellarg($file));
+ passthru('pygmentize -F codetagify -O encoding=guess,outencoding=utf8 -l '.escapeshellarg($mode).' -f html '.escapeshellarg($file), $return_value);
}
$cached = ob_get_contents();
ob_end_clean();
$this->memcachelibrary->set($filedata['hash'].'_'.$mode, $cached, 100);
}
- $this->output->append_output($cached);
+ if ($return_value != 0) {
+ show_error("Error trying to process the file. Either the lexer is unknown or something is broken.\n");
+ } else {
+ $this->output->append_output($cached);
+ }
$this->load->view($this->var->view_dir.'/html_footer', $this->data);
}