summaryrefslogtreecommitdiffstats
path: root/application/models
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-07-01 22:10:59 +0200
committerFlorian Pritz <bluewind@xinu.at>2011-07-01 23:26:34 +0200
commitb4e0acc50ce686cc57ca854dd319bb722d1d7f7d (patch)
tree26890ad3716f02fd863b29aec2378f0310baf671 /application/models
parent92ac1086ce5d3de253a7bb8979bdfd108e227755 (diff)
add ascii highlighting with escape color support
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models')
-rw-r--r--application/models/file_mod.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/application/models/file_mod.php b/application/models/file_mod.php
index 2ba44f551..a1ad73b92 100644
--- a/application/models/file_mod.php
+++ b/application/models/file_mod.php
@@ -247,12 +247,14 @@ class File_mod extends CI_Model {
exit();
}
+
+ $special_modes = array("ascii");
// directly download the file
- if (!$mode // user didn't specify a mode/didn't enable autodetection
+ if (!in_array($mode, $special_modes) && (!$mode // user didn't specify a mode/didn't enable autodetection
|| !$this->mime2extension($type) // file can't be highlighted
|| $mode == "plain" // user wants to the the plain file
|| filesize($file) > $this->config->item('upload_max_text_size')
- ) {
+ )) {
if ($mode == 'plain') {
$type = "text/plain";
}
@@ -283,8 +285,12 @@ class File_mod extends CI_Model {
if (! $cached = $this->memcachelibrary->get($filedata['hash'].'_'.$mode)) {
ob_start();
if ($mode == "rmd") {
- echo '<td class="markdownrender">'."\n";
- passthru('/usr/bin/perl /usr/bin/perlbin/vendor/Markdown.pl '.escapeshellarg($file));
+ echo '<td class="markdownrender">'."\n";
+ passthru('/usr/bin/perl /usr/bin/vendor_perl/vendor/Markdown.pl '.escapeshellarg($file));
+ } elseif ($mode == "ascii") {
+ echo '<td class="code"><pre class="text">'."\n";
+ passthru('/usr/bin/perl '.FCPATH.'scripts/ansi2html '.escapeshellarg($file));
+ echo "</pre>\n";
} else {
echo '<td class="numbers"><pre>';
// generate line numbers (links)