diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index e158af3f..46ae51f2 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -4,11 +4,13 @@ 0) { $octet_stream = FALSE; @@ -20,8 +22,7 @@ { $octet_stream = TRUE; - $lower_fileext = strtolower($fileext); - if (in_array ($lower_fileext, array ('png', 'jpg', 'jpeg', 'gif', 'tif', 'bmp', 'ico'))) + if (in_array ($fileext, array ('png', 'jpg', 'jpeg', 'gif', 'tif', 'bmp', 'ico'))) { $img = @imagecreatefromstring ($file['content']); if ($img !== FALSE) @@ -32,13 +33,13 @@ break; } } - else if (in_array ($lower_fileext, array ('pdf'))) + else if (in_array ($fileext, array ('pdf'))) { $is_special_stream = TRUE; $is_pdf_file = TRUE; break; } - else if (in_array ($lower_fileext, array ('odt', 'odp', 'ods'))) + else if (in_array ($fileext, array ('odt', 'odp', 'ods'))) { $is_special_stream = TRUE; $is_odf_file = TRUE; @@ -63,6 +64,10 @@ } if ($octet_stream) $is_special_stream = TRUE; } + else if (in_array($fileext, array('md', 'wc'))) + { + $is_wiki_file = TRUE; + } ?>
@@ -74,6 +79,9 @@ + + + @@ -236,6 +244,29 @@ function showRawCode() showing_raw_code = !showing_raw_code; } + +function render_wiki_wc () +{ + creole_render_wiki ( + "code_file_wiki_text", + "code_diff_new_code_view", + codepot_merge_path("", "/wiki/show/id?>/"), + codepot_merge_path("", "/wiki/attachment0/id?>/"), + false + ); +} + +function render_wiki_md () +{ + showdown_render_wiki ( + "code_file_wiki_text", + "code_diff_new_code_view", + codepot_merge_path("", "/wiki/show/id?>/"), + codepot_merge_path("", "/wiki/attachment0/id?>/"), + false + ); +} + var GraphApp = (function () @@ -640,6 +671,16 @@ $(function () { return false; }); + + + + render_wiki_wc (); + + render_wiki_md (); + + + + // for code rendering $("#code_file_result_raw").html ($("#code_file_result_code").html()) prettyPrint (); @@ -858,7 +899,9 @@ $this->load->view ('; + if ($charset == '') + { + print htmlspecialchars($file['content']); + } + else + { + // ignore iconv error + print htmlspecialchars(@iconv ($charset, 'UTF-8//IGNORE', $file['content'])); + } + print ''; + print '