summaryrefslogtreecommitdiffabout
path: root/htdocs/view.chtml
Unidiff
Diffstat (limited to 'htdocs/view.chtml') (more/less context) (ignore whitespace changes)
-rw-r--r--htdocs/view.chtml54
1 files changed, 54 insertions, 0 deletions
diff --git a/htdocs/view.chtml b/htdocs/view.chtml
new file mode 100644
index 0000000..d885330
--- a/dev/null
+++ b/htdocs/view.chtml
@@ -0,0 +1,54 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive page = "/ancestry/page.chtml";
3%%derive sources = "/ancestry/sources.chtml";
4<%impl>
5 #include <iostream>
6 #include <fstream>
7 using namespace std;
8 #include <sitecing/util.h>
9 #include <sitecing/sitecing_util.h>
10 #include <konforka/exception.h>
11 #include "acconfig.h"
12</%impl>
13<%codemethod string title() %>
14 return "introduction";
15</%codemethod>
16<%method void body() %>
17 <%code>
18 string rfile = sitecing::normalize_path(
19 sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"),
20 sitecing::restrict_dotdot|sitecing::strip_leading_slash );
21 sourcefile_t *sof = 0;
22 for(int n=0;n<source_files_count;n++) {
23 sof = &source_files[n];
24 if(sof->name && sof->dir) {
25 if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile)
26 break;
27 }
28 sof = 0;
29 }
30 if(!sof)
31 throw konforka::exception(CODEPOINT,"no access to the file allowed");
32 string afile = sitecing::combine_path(WEB_ROOT,rfile,0);
33 </%code>
34 <div class="source">
35 <h1><% rfile %></h1>
36 <ul>
37 <%code>
38 ifstream sf(afile.c_str());
39 if(!sf.good())
40 throw konforka::exception(CODEPOINT,"could not open source file");
41 while(!sf.eof()) {
42 string sfl;
43 getline(sf,sfl);
44 for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) {
45 sfl.replace(t,1,8-(t%8),' ');
46 }
47 <%output>
48 <li><% sfl.empty()?"&nbsp;":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %></li>
49 </%output>
50 }
51 </%code>
52 </ul>
53 </div>
54</%method>