-rw-r--r-- | htdocs/view.chtml | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/htdocs/view.chtml b/htdocs/view.chtml index f729465..809c54f 100644 --- a/htdocs/view.chtml +++ b/htdocs/view.chtml | |||
@@ -1,45 +1,46 @@ | |||
1 | % /* 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 | %%pragma main=page |
5 | <%impl> | 5 | <%impl> |
6 | #include <iostream> | 6 | #include <iostream> |
7 | #include <fstream> | 7 | #include <fstream> |
8 | using namespace std; | 8 | using namespace std; |
9 | #include <sitecing/util.h> | 9 | #include <sitecing/util.h> |
10 | #include <sitecing/sitecing_util.h> | 10 | #include <sitecing/sitecing_util.h> |
11 | #include <konforka/util.h> | ||
11 | #include <konforka/exception.h> | 12 | #include <konforka/exception.h> |
12 | #include "acconfig.h" | 13 | #include "acconfig.h" |
13 | </%impl> | 14 | </%impl> |
14 | <%codemethod string title() %> | 15 | <%codemethod string title() %> |
15 | return "introduction"; | 16 | return "introduction"; |
16 | </%codemethod> | 17 | </%codemethod> |
17 | <%method void body() %> | 18 | <%method void body() %> |
18 | <%code> | 19 | <%code> |
19 | string rfile = sitecing::normalize_path( | 20 | string rfile = konforka::normalize_path( |
20 | sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"), | 21 | sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"), |
21 | sitecing::restrict_dotdot|sitecing::strip_leading_slash ); | 22 | konforka::restrict_dotdot|konforka::strip_leading_slash ); |
22 | sourcefile_t *sof = 0; | 23 | sourcefile_t *sof = 0; |
23 | for(int n=0;n<source_files_count;n++) { | 24 | for(int n=0;n<source_files_count;n++) { |
24 | sof = &source_files[n]; | 25 | sof = &source_files[n]; |
25 | if(sof->name && sof->dir) { | 26 | if(sof->name && sof->dir) { |
26 | if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile) | 27 | if(konforka::normalize_path(konforka::combine_path(sof->dir,sof->name,0),konforka::strip_leading_slash)==rfile) |
27 | break; | 28 | break; |
28 | } | 29 | } |
29 | sof = 0; | 30 | sof = 0; |
30 | } | 31 | } |
31 | if(!sof) | 32 | if(!sof) |
32 | throw konforka::exception(CODEPOINT,"no access to the file allowed"); | 33 | throw konforka::exception(CODEPOINT,"no access to the file allowed"); |
33 | string afile = sitecing::combine_path(WEB_ROOT,rfile,0); | 34 | string afile = konforka::combine_path(WEB_ROOT,rfile,0); |
34 | </%code> | 35 | </%code> |
35 | <div class="source"> | 36 | <div class="source"> |
36 | <h1><% rfile %></h1> | 37 | <h1><% rfile %></h1> |
37 | <ul> | 38 | <ul> |
38 | <%code> | 39 | <%code> |
39 | ifstream sf(afile.c_str()); | 40 | ifstream sf(afile.c_str()); |
40 | if(!sf.good()) | 41 | if(!sf.good()) |
41 | throw konforka::exception(CODEPOINT,"could not open source file"); | 42 | throw konforka::exception(CODEPOINT,"could not open source file"); |
42 | while(!sf.eof()) { | 43 | while(!sf.eof()) { |
43 | string sfl; | 44 | string sfl; |
44 | getline(sf,sfl); | 45 | getline(sf,sfl); |
45 | for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) { | 46 | for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) { |