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